You are not logged in.
Pages: 1


I have this application that always loads on the rightmost monitor. I'd like it to open on my center monitor. It seems that devilspie2 should be able to do that but I can't find a simple example and I get the impression that Xfce might be able to do it native. Can we?
Last edited by rayandrews (2026-01-15 13:39:06)
Offline


devilspie2 has a "centre" option that lets you pick a monitor. Something like:
if (get_application_name() == "APPNAME") then
centre(2);
end...where "2" is the second monitor.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Ok, so xfce can't get involved in that kind of thing, so it's devilspie then.
Xfce doesn't have this kind of functionality built in - you need to use a third party tool like devilspie(2). It integrates well.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


@ToZ, how would you handle this is a second monitor is only connected part time? As in a laptop that could travel.
I AM CANADIAN!
Siduction
Debian Sid
Xfce 4.20 with Wayland/Labwc
Offline


@ToZ, how would you handle this is a second monitor is only connected part time? As in a laptop that could travel.
Devilspie2 supports the lua language so you could do some conditional checks like:
local num_monitors = get_num_monitors()
if (num_monitors > 1) and (get_application_name() == "APPNAME") then
center(2)
endMark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


My apologies, I'm mixing up programming languages. For lua, you need to actually call an external program to get the number of monitors and then act on it. Instead of just thinking out loud, I've tested this and it seems to work (I've also adjusted the function name so you can call any external program if different needs arise):
function external(cmd)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
return s
end
if (get_application_name() == "APPNAME") then
local num_monitors = tonumber(external("xdpyinfo | grep 'number of screens' | awk -F': ' '{print $2}'"))
if (num_monitors > 1) then
center(2)
end
end... the application name is the same as the window name, which is the name of whatever file is given as the argument to geogebra, so the above test, fails for any other file. I'd have thought this would work:
Try get_class_instance_name() or get_process_name() instead - they might not be unique everytime as you indicate.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Thanks. BTW, remembering that this isn't even an xfce issue!
Got it:
To start geogebra:
function gg ()
{
TITLE=$1
export TITLE
devilspie2&
imwheel # Speed up the mouse wheel scrolling
/opt/GeoGebra-Linux-Portable-5-4-911-3/geogebra-portable $1
imwheel -k -q
}
... and the devilspie2 script:
local file = os.getenv("TITLE")
local name = get_window_name()
--debug_print("file is: " .. file)
--debug_print("name is: " .. name)
if (file == get_window_name()) then
set_window_geometry(1920,0,1910,1030);
end
:-)
Last edited by rayandrews (2026-01-16 20:17:54)
Offline


BTW, ToZ, just a followup, I'm up and running with devilspie2, here's the current state of the thing:
debug_print(get_window_name())
debug_print(get_application_name())
if string.match(get_window_name(), "Algebra") then
set_window_geometry(3840, 0, 951, 1045); -- RL
end
-- GG does not set 'get_application_name' so must use title.
if string.match(get_window_name(), ".ggb") then
set_window_geometry(1915,0,1920,1035);
end
if (get_application_name() == "geany" ) then
set_window_geometry(4800, 0, 951, 1035); -- RR
end
... definitely a bug that geogebra doesn't set application name.
Offline
Pages: 1
[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 549.3 KiB (Peak: 566.28 KiB) ]