-
Devilspie2: Lua Scripts
Prompted by that suggestion, here’s the current collection of Devilspie2 scripts (in
~/.config/devilspie2/) that make my dual-monitor setup (left: 2560×1440 landscape, right: 1050×1680 portrait) usable with a single X session in Xubuntu 12.10. The window manager understands about the monitor layout, so maximizing a window will fill whatever monitor it’s currently occupying.acroread.lua— maximized on portraitif (get_window_name()=="Adobe Reader") then unmaximize(); set_window_geometry(0,0,1000,100); set_window_geometry(2561,0,1000,100); maximize(); endchromium.lua— right half of landscapeif (get_application_name()=="Chromium" and get_window_name() ~= "Print") then set_window_geometry(1400,0,1150,1200); maximize_vertically(); end
debugging.lua— handy with –debug optiondebug_print("Window Name: " .. get_window_name()); debug_print("Application name: " .. get_application_name());digikam.lua— right half of landscape, force large Search dialog, dammitif (get_application_name() == "Digikam") then debug_print("DigiKam conditional - top"); if (get_window_name() == "Advanced Search") then debug_print("Digikam - Adv Search"); set_window_geometry(750,100,1000,1300); else debug_print("Main DigiKam window"); set_window_geometry(0,0,1400,1000); maximize_vertically(); end endfirefox.lua— left half of landscape, enlarge dialogsif (get_application_name()=="Firefox") then debug_print("FF conditional - top"); if (get_window_name() == "Print") then set_window_position(700,350); elseif (0 == string.find(get_window_name(),"Password")) then set_window_position(0,0); maximize_vertically(); end endgimp.lua— force Gutenprint dialog to the top, dammitif (get_application_name() == "GNU Image Manipulation Program") then debug_print("GIMP conditional - top"); if (string.find(get_window_name(),"Print")) then debug_print("GIMP - GutenPrint") set_window_position(700,350); make_always_on_top(); else debug_print("GIMP - Main window"); end endpasswords.lua— put password dialogs in mid-screenif (get_window_name()=="Password Required") then debug_print("Password"); set_window_position(700,350); endpronterface.lua— force to middle-ish of Desktop 2if (get_window_name()=="Printer Interface") then set_window_workspace(2); set_window_position(1200,750); end
slic3r.lua— force to right side of Desktop 2if (get_window_name()=="Slic3r") then set_window_workspace(2); set_window_geometry(1600,0,700,700); end
terminal.lua— maximized on portraitif (get_window_name()=="Terminal") then set_window_position(2561,0); maximize(); end
thunderbird.lua— left half of landscape, force big dialogsif (get_application_name() == "Thunderbird") then debug_print("TBird conditional - top"); if (1 == string.find(get_window_name(),"Print")) then debug_print("TBird - print..."); set_window_position(700,350); elseif (string.find(get_window_name(),"Sending") or string.find(get_window_name(),"Confirm") or string.find(get_window_name(),"Processing")) then debug_print("TBird - generic dialog"); set_window_position(200,600); elseif (string.find(get_window_name(),"Write:")) then debug_print("TBird - writing"); set_window_geometry(1300,0,900,600); maximize_vertically(); elseif (0 == string.find(get_window_name(),"Password")) then debug_print("Main TBird window?"); debug_print(" name: ",get_window_name()); set_window_geometry(0,0,1300,1200); maximize_vertically(); end end