2

Ok.. I finally got around to installing devilspie2 and running through this very clear tutorial. Of course, it is not working. However, all my reading leads to 3 year old articles and troubleshooting.

Question 1:

Is devilspie2 still applicable / compatible with gnome version 3.36.8 on ubuntu 20.04 running X11 window manager?

Assuming it is still applicable / compatible... (github repository still active https://github.com/dsalt/devilspie2)

Question 2:

What am I doing wrong? My script(s) have no effect on windows of any applications:

debug_print("Application: " .. get_application_name())
debug_print("Window: " .. get_window_name());

if (get_window_name() == "gedit") then set_window_workspace(8); end

if (get_window_name() == "Mozilla Firefox") then set_window_geometry(50, 100, 800, 600); end

devilspie2 --debug runs without problem and confirms that is reading the file that contains my scripts

Using scripts from folder: /home/user/.config/devilspie2
------------
List of Lua files handling "window_open" events in folder:
/home/user/.config/devilspie2/debug.lua
List of Lua files handling "window_close" events in folder:
List of Lua files handling "window_focus" events in folder:
List of Lua files handling "window_blur" events in folder:
------------

I can find no errors in my system logs related to devilspie2 and/or lua

I have restarted display-manager and I have fully rebooted... no effect.

Any tips?

Additional Info
This my list of installed gnome-extensions in case there is some sort of conflict someone can recognize:
enter image description here

  • I am using it for many years, now in Ubuntu 22.04, so it definitely should work (on Xorg). I cannot see what you may have wrong, though. It has to be running in order to work. – vanadium Jul 09 '22 at 15:50
  • @vanadium so how can I verify that it is running? is there a systemd daemon? – nightwatch Jul 09 '22 at 15:53
  • the debug detects window open/close but there is no effect on windows by the scripts – nightwatch Jul 09 '22 at 15:59

1 Answers1

3

Question 1: Is devilspie2 still applicable / compatible with gnome version 3.36.8 on > ubuntu 20.04 running X11 window manager?

It is, even on 22.04, provided your run X11. It will not work on Wayland.

Question 2: What am I doing wrong? My script(s) have no effect on windows of any applications:

If your configuration file is correct, and devilspie2 is running (check in the output of ps ax | grep devilspie2) then the installation should be correct. There still may be specific reasons why some rules do not work.

  • get_window_name() will return the window title. (get_window_name() == "Mozilla Firefox") will only match a window with the exact title "Mozilla Firefox", i.e., an empty, new Firefox window. A window of Gedit never is named gedit, so will never be matched. Use e.g. (string.match(get_window_name(), "Mozilla Firefox")) or (string.match(get_window_name(), "gedit")) to match a substring in the window title.

  • set_window_workspace(8); will work only provided there is a workspace 8. For this to work on Gnome Shell, change to "Static workspaces" in "Settings", "Multitasking" (Ubuntu 22.04) or in Gnome Tweaks (earlier versions).

Tips

  • You can "debug" your devilpie2 setup by killing the running proces (killall devilspie2, then adapt the configuration file, then restart devilspie2. In that terminal, you can conveniently kill devilspie2 using Ctrl+C and restart it again.

  • A quite comprehensive manual listing all commands is hidden on your system after you installed devilspie2. Use less /usr/share/doc/devilspie2/README.gz to see it.

  • Do not hesitate to use the window class instead of a title. That can for example avoid that a firefox window opened on an article about gedit is being matched as a gedit window:

      if (get_window_class() == "Gedit") then
          set_window_workspace(8);
      end
    

    See the window class in the output of wmctl -lx, or xprop | grep WM_CLASS (second entry).

vanadium
  • 98,427
  • much appreciate the expended advice...I seem to have gotten devilspie2 working for all my core apps except keepass.. see the above edit to my post... any additional advice appreciated. – nightwatch Jul 15 '22 at 02:10
  • You should not change the scope and focus of a question. Feel free to open an dedicated question for these problems specific to your use case of KeepasX. – vanadium Jul 15 '22 at 09:54
  • Fair enough... I will open a new question... thx for the advice – nightwatch Jul 15 '22 at 15:21
  • whoops... there's 50. thanks for the help. – nightwatch Jul 19 '22 at 02:04
  • @vanadium on Ubuntu 22.04 devilspie doesn't work, with the error "An X11 display is required for devilspie2." – user2342558 Oct 27 '24 at 14:59
  • @user2342558 The second line of my answer indeed says it will not work on Wayland, the default on Ubuntu – vanadium Nov 05 '24 at 11:50