diff --git a/config/sway/keys b/config/sway/keys index 7dd6af7..3b61ba9 100644 --- a/config/sway/keys +++ b/config/sway/keys @@ -143,7 +143,7 @@ bindsym --to-code { # Scratchpads $mod+i exec $sway/scratchpad-toggle "[app_id=^scratchpad_input$]" "$term --class scratchpad_input -e nvim /tmp/scratchpad.md" - $mod+q exec $sway/scratchpad-toggle "[app_id=^scratchpad$]" "$term --class scratchpad -e sway-scratchpad" + $mod+q exec $sway/scratchpad-toggle "[app_id=^scratchpad$]" "$term --class scratchpad -e $sway/sway-scratchpad" # Eww keybinds # $mod+grave exec "$eww/manage show sidebar" diff --git a/config/sway/scripts/sway-scratchpad b/config/sway/scripts/sway-scratchpad new file mode 100755 index 0000000..8edc29e --- /dev/null +++ b/config/sway/scripts/sway-scratchpad @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Terminal window with class/app_id = 'scratchpad' needs to exist already +SCRATCHPAD_SESSION="$(tmux ls | grep '^sway-scratchpad')" + +# If the session does not exist, create a new one +if [ ${#SCRATCHPAD_SESSION} -eq "0" ]; then + tmux -2 new-session -s sway-scratchpad +else + # Else attach to the session + tmux -2 attach -t sway-scratchpad +fi