Skip to content

Instantly share code, notes, and snippets.

@ertwro
Last active March 25, 2020 04:39
Show Gist options
  • Save ertwro/abe6e90fc3844ca9f107b4aba759c2c8 to your computer and use it in GitHub Desktop.
Save ertwro/abe6e90fc3844ca9f107b4aba759c2c8 to your computer and use it in GitHub Desktop.
scratchpad script to either hide, show or open programs.
# modes structure
# $Mod+Tab
set $mode_Tab Mode and more
bindsym $mod+Tab mode "$mode_Tab"
mode "$mode_Tab"{
bindsym $mod+h exec `notify-send 'H'`
bindsym $mod+j exec `notify-send 'J'`
bindsym $mod+k exec `notify-send 'K'`
bindsym $mod+l exec `notify-send 'L'`
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym --release $mod+Tab mode "default"
bindsym --release Tab mode "default"
bindsym --release $mod mode "default"
bindsym Tab mode "default"
}
#!/bin/bash
wmt=$1 # command line title
wmc=$2 # command line class
wmn=$3 # command line instance
wme=$4 # command
attr=class
wcount="$(i3-msg "[$attr=$wmc]" 'scratchpad show ; move position center' | grep -c 'true')"
stp="st -f PragmataProMono:pixelsize=18 -T "$wmt" -c "$wmc" -n "$wmn" -e "$wme""
if (( $wcount == 0 ));
then
flock -n /tmp/${wme}stp.lockfile $stp
else :
fi
# Syntax: [scratcher-i3.sh = script] [$1 = $wmt=title] [$2 = $wmc=class] [$3 = $wmn=instance] [$4 =$wme=command]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment