1

After suffering from a bug in Redshift, I found a great replacement, Iris.

I have put the Iris folder in my home directory, and added the following command to Startup Applications sh /home/arun/Iris/Iris.sh.

That all works splendidly, but upon startup, the settings GUI window also launches. All I really need is the little panel indicator icon. Sort of like the "Hide" function in OS X's "Login Items".

Can this be achieved?

Fiksdal
  • 2,181

1 Answers1

1

The Iris settingswindow

If we close Iris' settings window with the X, it is seemingly closed.

If we do the same, with the help of wmctrl (wmctrl -ic <window_id>) however, it turns out not only the window is closed, but the complete application.

My conclusion is then that the window is not actually closed, but unmapped when we press the X.

We can do the same with the help of xdotool. With an edited version of this answer: How can I run a program on startup, minimized?, we can then startup Iris without the settings window to appear.

Starting up iris without the settings window (script)

  1. The script uses both wmctrl and xdotool:

    sudo apt-get install wmctrl xdotool
    
  2. Copy the script below into an empty file, save it into the same directory as your Iris.sh file (so they are together in the same directory), as start_iris.py.

    #!/usr/bin/env python3
    import subprocess
    import time
    import sys
    import os
    
    command = os.path.dirname(sys.argv[0])+"/Iris.sh"
    subprocess.Popen(["/bin/bash", "-c", command])
    
    def get(cmd):
        return subprocess.check_output(cmd).decode("utf-8").strip()
    
    t = 0
    
    while t < 12:
        time.sleep(1)
        try:
            w_list = [l.split()[0] for l in get(["wmctrl", "-l"]).splitlines() if "Iris" in l]
            for w in w_list:
                check = [l for l in get(["xprop", "-id", w]).splitlines()\
                         if "WM_CLASS(STRING)" in l][0]
                if "Iris" in check:
                    subprocess.Popen(["xdotool", "windowunmap", w])
                    break
            break
        except (IndexError, subprocess.CalledProcessError):
            pass
        t += 1
    
  3. Now run the following command instead of the original command to start Iris:

    python3 /path/to/start_iris.py
    

The settings window will no longer appear!

Explanation

  • The script looks into its own directory for the file Iris.sh, and launches it.
  • Subsequently, it watches for the creation of new windows of WM_CLASS Iris (your settings window).
  • If it found the targeted window, it unmaps the window with the xdotool command:

    xdotool windowunmap <window_id>
    

Notes

  1. Obviously, clicking on the X of the settings window also unmaps the window.
    Apparantly this is done in a different way from xdotool. The consequence is that you cannot reach the settings window (from the indicator menu), without restarting Iris.

    You mentioned however you normally do not need the settings window at all.

  2. Note that when starting up GUI applications from Startup APplications (especially when it involves screen settings), you might need to build in a little break for it to work fine. If it doesn't work from Startup Applications, change the command to add to Stratup Applications into:

    /bin/bash -c "sleep 10 && python3 /path/to/start_iris.py"
    
Jacob Vlijm
  • 85,475