Last active
December 12, 2024 13:42
-
-
Save bendera/8a3a83a14280dfceaf29c5998779e7ae to your computer and use it in GitHub Desktop.
Multi-monitor devilspie2 config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://www.howtoforge.com/tutorial/ubuntu-desktop-devilspie-2/ | |
debug_print("--------------------------------------------------------------------------------") | |
debug_print("Window Name: ".. get_window_name()); | |
debug_print("Application name: "..get_application_name()) | |
debug_print("--------------------------------------------------------------------------------") | |
editor_workspace = 1 | |
browser_workspace = 2 | |
terminal_workspace = 1 | |
-- x,y, xsize, ysize | |
monitor_primary = {0, 0, 1920, 1080} | |
monitor_secondary = {1920, 0, 1680, 1050} | |
-- { application_name, window_name } | |
devtools = { | |
{'Firefox', 'Untitled window'}, | |
{'chrome-devtools', 'chrome-devtools'}, | |
{'Chromium', 'chrome-devtools'}, | |
} | |
editors = { | |
{'PhpStorm', 'PhpStorm'}, | |
{'Visual Studio Code', 'Visual Studio Code'}, | |
{'Sublime Text', 'Untitled window'}, | |
{'Mousepad', 'Mousepad'}, | |
} | |
browsers = { | |
{'Firefox', 'Mozilla Firefox'}, | |
{'Google Chrome', 'Google Chrome'}, | |
{'Chromium', 'Chromium'}, | |
} | |
terminals = { | |
{'Xfce Terminal', 'Terminal'} | |
} | |
function move_to_secondary_monitor() | |
unmaximize() | |
set_window_geometry(monitor_primary[3], 0, 200, 200) | |
end | |
function place_devtools() | |
for key, app in ipairs(devtools) | |
do | |
if (string.find(get_application_name(), app[1], 1, true) and string.find(get_window_name(), app[2], 1, true)) then | |
-- x,y, xsize, ysize | |
set_window_workspace(browser_workspace) | |
move_to_secondary_monitor() | |
maximize() | |
end | |
end | |
end | |
function place_editors() | |
for key, app in ipairs(editors) | |
do | |
if (string.find(get_application_name(), app[1], 1, true) and string.find(get_window_name(), app[2], 1, true)) then | |
set_window_workspace(editor_workspace) | |
maximize() | |
end | |
end | |
end | |
function place_browsers() | |
for key, app in ipairs(browsers) | |
do | |
if (string.find(get_application_name(), app[1], 1, true) and string.find(get_window_name(), app[2], 1, true)) then | |
set_window_workspace(browser_workspace) | |
maximize() | |
end | |
end | |
end | |
function place_terminals() | |
for key, app in ipairs(terminals) | |
do | |
if (string.find(get_application_name(), app[1], 1, true) and string.find(get_window_name(), app[2], 1, true)) then | |
set_window_workspace(terminal_workspace) | |
move_to_secondary_monitor() | |
maximize() | |
end | |
end | |
end | |
place_devtools() | |
place_editors() | |
place_browsers() | |
place_terminals() | |
if (string.find(get_application_name(), 'Slack', 1, true) and string.find(get_window_name(), 'Slack', 1, true)) then | |
stick_window() | |
end | |
if (get_application_name() == 'Remmina') then | |
set_window_workspace(3) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment