dotfiles

beau's configuration files
git clone https://git.beauhilton.com/dotfiles.git
Log | Files | Refs | README

ddspawn (593B)


      1 #!/usr/bin/env sh
      2 
      3 # Toggle floating dropdown terminal in i3, or start if non-existing.
      4 # $1 is	the script run in the terminal.
      5 # All other args are terminal settings.
      6 # Terminal names are in dropdown_* to allow easily setting i3 settings.
      7 
      8 [ -z "$1" ] && exit
      9 
     10 script=$1
     11 shift
     12 if xwininfo -tree -root | grep "(\"dropdown_$script\" ";
     13 then
     14 	echo "Window detected."
     15 	i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center"
     16 else
     17 	echo "Window not detected... spawning."
     18 	i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script"
     19 fi