How do I get i3 to switch to a workspace properly when loading Firefox from a script from i3 config? [closed]
i3config:
bindsym Control+Mod4+s exec ~/script.sh
~/script.sh
i3-msg workspace windowname
exec firefox # (or midori)
When I press the shortcut keys, it'll create a new workspace, but then it'll execute the program in the workspace where I pressed the keys instead of in the new workspace (it does the same thing if I run the script directly from dmenu).
I can get the script to work fine by running the script directly from the cli or from xbindkeys.
Possible dublicate of: https://faq.i3wm.org/question/2135/open-new-window-in-specific-workspace-and-focus/
I agree with this being a duplicate. I also just added a scriptless answer to the other question, that should work for you.
Well I'm also interested to know why exec in i3config doesn't function like a normal exec in this case.
I copied the line directly from i3config to .xbindkeysrc, and it functions perfectly under xbindkeys. The script will work properly in i3 if I make it so a terminal runs the script, but I'd rather not run a terminal. I am using a script because I want to check whether a process is already open.