Make program start on second virtual desktop (XFCE)

I'm not sure if you can start it in the other workspace, but you can move it there with a script.

Have a look at this page: https://wiki.xfce.org/faq, at the subitem "How do I programmatically switch workspaces, move windows, etc?"

So you could start your program with a simple shell script like:

#!/bin/sh
yourprogram &
PID="$!"
#echo $PID
sleep 1s 
#sleep is required because the window takes some time to open, maybe it can be adjusted
WINH="$(wmctrl -l -p | grep "$PID" | cut -d " " -f1)"
#echo $WINH
wmctrl -i -r $WINH -t 2

Its not ideal as the process may have multiple windows (no idea what would happen then), but it should work for simple programs.


Most window managers don't offer this functionality. You can run Devil's Pie to perform actions when a window is created, such as sending that window to another workspace. With Devil's Pie 1, create a file ~/.devilspie/myprogram.ds containing something like

(if (and (is (application_name) "specific-program")
         (matches (window_name) "^Program main window:"))
  (set_workspace 2))

With Devil's Pie 2, create a file ~/.devilspie2/myprogram.ds containing something like

if (get_application_name() == "specific-program" and
    string.strfind(get_window_name(), "Program main window") == 1) then
  set_workspace(2);
end

Tags:

Desktop

Xfce