I use keepass2 to manage passwords (hence I want it always on top and pinned to all workspaces and that core reason I installed devilspie2).
While I am able to to both "pin" and "position" the keepass window according to its window class and/or application name (both work)... after, I open an "Edit Entry" window, the "pin" to functionality simply stops working for the keepass application and none of the solutions below will get it work consistently.
These can pin and position the keepass window prior to opening an "Edit Entry" window:
if (string.match(get_application_name(), "KeePass2")) then
set_window_geometry(960, 500, 960, 500);
end
if (string.match(get_application_name(), "KeePass2")) then
pin_window();
end
if (string.match(get_application_name(), "KeePass")) then
set_window_geometry(960, 500, 960, 500);
end
if (string.match(get_application_name(), "KeePass")) then
pin_window();
end
if (string.match(get_window_name(), "Edit Entry")) then
set_window_geometry(960, 500, 960, 500);
end
if (string.match(get_window_name(), "Edit Entry")) then
pin_window();
end
if (get_window_name() == "Edit Entry") then
pin_window();
end
NOTE:
the positioning of "Edit Entry" is not vital... it cannot be changed outside of devilspie2 as well. Also if I stop and restart devilspie2 with the "Edit Entry" window open... it immediately starts working. If I close the "Edit Entry" and open a new "Edit Entry", devilspie2 stops working (no pinning) and devilspie2 needs a restart.
Also something odd that I noticed is that the application name changes when an "Edit Entry" window is open (hence the use of both "Keepass" and "Keepass2" above.
When "Edit Entry" window is -NOT- open and a database is -NOT- open debug shows:
Class: KeePass2
Application: KeePass
Window: KeePass
When "Edit Entry" window is -NOT- open, but a database is open debug shows:
Class: KeePass2
Application: PrivateDBNName.kdbx - KeePass
Window: PrivateDBname.kdbx - KeePass
When "Edit Entry" window is open debug shows:
Class: KeePass2
Application: KeePass2
Window: Edit Entry
Obviously, positioning and pinning the Keepass windows according to their window class names seems the most intuitive, but doing so just results in the same problem that I describe above, where after opening the "Edit Entry" window devilspie2 simply stops working for KeePass altogether, thereby defeating the purpose installing it and doing this much to configure it :-/.
Any advice appreciated.
Something Interesting
The output of this command shows something odd for keepass:
$ wmctrl -lx
0x06a000f8 2 gedit.Gedit localhost debug.lua (~/.config/devilspie2) - gedit
0x0260005d 2 keepass2.KeePass2 N/A PrivteDBName.kdbx - KeePass
0x026009a2 2 keepass2.KeePass2 N/A Edit Entry
--the hostname is always missing, whether keepass is working or not working
Yup Pesky Bug
So I installed KeePassXC via PPA and the first thing I did was run:
$ wmctrl -lx
0x07800006 2 keepassxc.KeePassXC localhost PrivateDBName - KeePassXC
Another Bug
While the positioning and pinning with KeePassXC now works. After I actually create a new password entry in the database, devilspie2 again stops working.
So that is now two different versions of KeePass (fairly popular app) that will not work correctly with devilspie2 pinning. But somehow fractional scaling is a higher priority than the commonly user expected ability to position and pin a window.. :-/ going for ice cream... avoiding "the devil."
Pleasant Update: deleted Keepass2 and rebooted machine.. now KeePassXC pinning continues to work after I create a new db entry... buggy dependency libraries?
--The localhost name -does- exist.
I configured devilspie2 and -almost- everything works exactly as expected. hint, hint post #3 coming shortly.
Minus the window height setting, the following works:
if (get_window_class() == "KeePassXC") then
set_window_geometry(960, 500, 960, 495)
pin_window();
end
Side note:
This app really seems like something that gnome/ubuntu should natively incorporate since it provides such a high value-add in terms of usability. I am sure many users would choose this position & pinning windows via an accurate GUI over fractional scaling any day. (just my humble opinion)