Don’t hesite to share here your best config file and tips for devilspie2
Good one here :
Inspired from it, I have made this one :
if (get_window_type() ~= "WINDOW_TYPE_NORMAL") then
return
end
-- Associate Qubes to a specific workstation(Format = NameoftheAppVM or NameoftheAppVM+Nameoftheapplication)
workspaceAssociation = {};
workspaceAssociation["vault"] = 1;
workspaceAssociation["vaultgedit"] = 2;
workspaceAssociation["whonix-ws-15-test"] = 25;
workspaceAssociation["whonix-ws-15-testTor"] = 26;
workspaceAssociation["dom0"] = 33;
-- Can detect dispxxxx qubes VM and place it depending of his template
domain = get_window_property('_QUBES_VMNAME');
if (domain == "") then
domain = "dom0";
elseif (string.find(string.lower(domain), "disp")) then
amazingCommand = "sudo qvm-ls|grep " .. domain .. " | tr -s ' ' | cut -d ' ' -f 5| tr -d '\r'"
local handle = io.popen(amazingCommand)
result = handle:read("*a")
result = result:sub(1, -2)
handle:close()
debug_print("This is a dispVM : " .. domain .. "with the following template " .. result)
domain = result;
end
--match a specific application (gedit) from a specific template(vault) to a specific workspace ( Number 2, called vaultgedit)
if string.match(get_application_name(), "gedit") then
domain=domain.."gedit"
if (workspaceAssociation[domain] ~= nil and workspaceAssociation[domain] > 0) then
debug_print("Name application : " .. get_application_name())
end
end
if string.match(get_application_name(), "Tor") then
domain=domain.."Tor"
if (workspaceAssociation[domain] ~= nil and workspaceAssociation[domain] > 0) then
debug_print("Name application : " .. get_application_name())
end
end
-- Move the window to the workspace
if (workspaceAssociation[domain] ~= nil and workspaceAssociation[domain] > 0) then
if (workspaceAssociation[domain] <= get_workspace_count()) then
set_window_workspace(workspaceAssociation[domain])
debug_print("Moving ".. get_application_name() .." to workspace ".. workspaceAssociation[domain] .."\n\n")
maximize()
end
endqube = get_window_property("_QUBES_VMNAME");
ws = 0;
end
Features :
-
Can detect dispxxxx qubes VM and place it depending of his template to a specific workplace
-
match a specific application (gedit) from a specific template(vault) to a specific workspace ( Number 2, called vaultgedit)
-
And of course move the window to a specific workspace
What’s need to be done :
If I launch dispxxxx whonix-ws with a torbrowser application to workspace for exemple number 10
Then when I launch another dispxxx whonix-ws with that new torbrowser, I want it to go to the workplace number 10+1
But I can’t find a function with devilspie2 that would return if a workspace is empty of not that I need to implement that feature
May be faster if
amazingCommand = "sudo qvm-ls|grep " .. domain .. " | tr -s ' ' | cut -d ' ' -f 5| tr -d '\r'"
was replaced by
amazingCommand = "qvm-prefs " .. domain .. " template"
Though I’m a little nervous about using _QUBES_VMNAME as part of a dom0 command line without first validating it.