3

Assume I would open a new workspace e.g. to run a terminal in the next unused workspace.

i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1)) && /usr/bin/x-terminal-emulator

Additionally I also want to specify for this workspace that if I stroke $mod+D the program dmenu runs with a custom list of applications like dmenu -i "app1\napp2\napp3".

And if I switch to an other workspace and stroke $mod+D dmenu should run in default mode unless I defined a specific list of applications.

Hölderlin
  • 1,160
  • 5
  • 14
  • 34

1 Answers1

1

You could bind to $mod+D script that will detect your current workspace and launch dmenu with different parameters. E.g:

~/.config/i3/config:

...
bindsym $mod+d exec /tmp/dm.sh
...

/tmp/dm.sh

#!/usr/bin/env sh

ws="$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).name')"

if [ "$ws" -eq "3" ]; then
  echo "app1\napp2\napp3" | dmenu
else
  dmenu_run
fi

Here you will get custom list of applications on workspace #3 and default one on others.

anlar
  • 4,096
  • 3
  • 30
  • 54