dsalt / devilspie2

Devilspie2 is a window matching utility, allowing the user to perform scripted actions on windows as they are opened and closed.
GNU General Public License v3.0
132 stars 15 forks source link

set_on_back() #4

Closed EricBlanquer closed 2 years ago

EricBlanquer commented 2 years ago

Hi, I'm looking for a method to set a new window at the back instead of the top I've seen the method "set_on_top()", is it possible to have "set_on_back()"? Thanks, Eric

dsalt commented 2 years ago

I've created a new branch, raise+lower, which should do the job: it adds a Lua function set_on_bottom().

Also, I've altered set_on_top() to use XRaiseWindow(…) instead of messing with _NET_WM_STATE_ABOVE, mirroring the new code (setting then clearing _NET_WM_STATE_BELOW doesn't work usefully with Xfwm4, and this is cleaner anyway).

EricBlanquer commented 2 years ago

Hi, thanks you very much! but I'm not able to build it, I get an error message:

make
Package lua was not found in the pkg-config search path.
Perhaps you should add the directory containing 'lua.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua' found
cc -Wall -Wformat -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -Wformat=2  -O2  -DLOCALEDIR=\"/usr/local/share/locale\" -DPACKAGE=\"devilspie2\" -DDEVILSPIE2_VERSION=\"0.45\"  -c src/config.c -o obj/config.o
src/config.c:19:10: fatal error: glib.h: No such file or directory
   19 | #include <glib.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [Makefile:101: obj/config.o] Error 1

I've checked install dependencies:

sudo apt install pkg-config libglib2.0-dev liblua5.1-0-dev libwnck-3-dev libgtk-3-dev
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
libglib2.0-dev est déjà la version la plus récente (2.66.1-2ubuntu0.2).
libgtk-3-dev est déjà la version la plus récente (3.24.23-1ubuntu1).
liblua5.1-0-dev est déjà la version la plus récente (5.1.5-8.1build4).
libwnck-3-dev est déjà la version la plus récente (3.36.0-1).`
pkg-config est déjà la version la plus récente (0.29.2-1ubuntu1).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.

sorry to bother you, but can you help me please?

dsalt commented 2 years ago
make clean
LUA=lua5.1 make

(I've just updated master & raise+lower to fix a bug related to Lua version selection, so you'll want to git pull first.)

EricBlanquer commented 2 years ago

Thank you, I've been able to build it :)

but this script throws an exception:

if (get_application_name() == "terminator" and string.match(get_window_name(), "HttpProxy")) then
    set_window_geometry(0, 540, 1650, 540);
    set_on_bottom();
end
Erreur: /home/eric/.config/devilspie2/HttpProxy.lua:3: attempt to call global 'set_on_bottom' (a nil value)

HttpProxy.lua.txt

EricBlanquer commented 2 years ago

devilspie2 -v Devilspie2 v0.45

dsalt commented 2 years ago

Not happening here. I'm testing with this script fragment as it's easy to trigger on starting devilspie2 (terminal windows etc. with titles set appropriately):

if string.match(get_window_name(), "devilspie2") then
  set_on_bottom();
end

Are you sure that the freshly-built version was running at the time?

(Also, I've edited your comments to use code blocks, with Lua highlighting where appropriate, rather than inline code.)

EricBlanquer commented 2 years ago

arg, sorry, I was on the master branch not on the raise+lower branch that's perfect, all is OK now thank you very much