scripts

random scripts
git clone https://git.parazyd.org/scripts
Log | Files | Refs

dmenuraise (628B)


      1 #!/bin/sh
      2 #
      3 # parayzd - (c) wtfpl 2016
      4 # list open windows in a dmenu
      5 
      6 normfg="#939393"
      7 normbg="#000000"
      8 selbg="#800000"
      9 selfg="#ffffff"
     10 
     11 height=$(wmctrl -l | wc -l)
     12 if [ $height -gt 30 ]; then
     13 	heightfit=30
     14 else
     15 	heightfit=$height
     16 fi
     17 
     18 num=$(wmctrl -l \
     19 	| sed 's/ tatooine/ /' \
     20 	| cut -d " " -f 4- \
     21 	| nl -w 3 -n rn \
     22 	| sed -r 's/^([ 0-9]+)[ \t]*(.*)$/\1 - \2/' \
     23 	| dmenu -i \
     24 		-nb $normbg \
     25 		-nf $normfg \
     26 		-sb $selbg \
     27 		-sf $selfg \
     28 		-l $heightfit \
     29 	| cut -d '-' -f -1 \
     30 )
     31 
     32 [ -z "$num" ] && exit
     33 wmctrl -l | sed -n "$num p" | cut -c -10 | xargs wmctrl -i -a
     34 ## dwm hack because wmctrl is broken
     35 xdotool key super+u