I want to run terminal or focus it by pressing F1 button. What I've tried to implement it:
Add custom shortcut to gnome keyboard settings with such command.
wmctrl -s 4 && pgrep terminator || nohup terminator > /dev/null &`wmctrl -s 4switches screen,- then
pgrep terminatorchecks if terminal already running, nohup terminator > /dev/null &runs terminal if it is not.
The screen switches right, but terminal not opens.
Place the command (as above) to executable
*.shfile and specify absolute path to it in shortcut settings.
All the same.Run above command in another terminal.
Works as expected. (screen switches, terminator opens)Run script with above command:
#!/bin/zsh wmctrl -s 4 && pgrep terminator || nohup terminator > /dev/null &
Not works again. Screen switches but terminator window not appears. Also there is pid number in the terminal after running the script.
It seems like the terminator closes after lunching for some reason.
What I should do to create shortcut with such actions?
pgrep terminatoralways fails. Trypgrep -f terminator || nohup terminatorinstead. That's becauseterminatoris a python program so what you see inpgrepispython, notterminator.pgrep terminatorworks as expected. It returns pid of running terminator instance.