Debain system Shortcut inside SH Script

Solution 1:

Looks like you are close, but:

  • The key code is slightly off
  • xdotool needs to run before you attach to the Tmux session, otherwise it won't run until after you exit or disconnect from Tmux
  • Not that it is causing a problem, but the $SHELL at the end isn't needed. It also isn't running until after you exit/detach from Tmux, so you just ended up with a nested subshell after exiting.

So this seems to work for me:

#!/bin/bash
tmux new-session -d 
tmux split-window -h 
tmux split-window -v
tmux select-pane -t 0
tmux new-window 'k'
xdotool key Alt+F10
tmux -2 attach-session -d

The xdotool invocation can really come anywhere in the script, as long as it is before the attach-session.