3 ##############################################
4 ## dwm popup to choose between open windows ##
5 ## does not change to respective monitor ##
6 ##############################################
9 # Date format, for use as the prompt.
10 date=$(date +"%a %d. %b %R")
12 # dmenu cannot display more than 30 lines, to avoid screen clutter. Only relevant if you have more than 30 windows open.
13 height=$(wmctrl -l | wc -l)
14 if [[ $height -gt 30 ]]; then
20 num=$(wmctrl -l | sed 's/ / /' | cut -d " " -f 4- | nl -w 3 -n rn | sed -r 's/^([ 0-9]+)[ \t]*(.*)$/\1 - \2/' | dmenu -b -i -p "$date" -l $heightfit | cut -d '-' -f -1)
21 [[ -z "$num" ]] && exit
23 WID=$(wmctrl -l | sed -n "$num p" | cut -c -10)
28 echo "focus target $WID"
31 [[ $1 =~ "," ]] && echo "error focussing" && return 1
35 if ! [ -e ~/paperbenni/ismultimonitor ]; then
42 XPOS=$(xdotool getwindowfocus getwindowgeometry | grep -Eoi 'position.*,' | grep -o '[0-9]*')
43 if [ "$XPOS" -gt "1919" ]; then
53 if [ "$(pfw)" = "$WID" ]; then
56 if ! [ "$(pfw)" = "$OLDWID" ]; then
57 if ! [ "$OLDWID" = "0x000001e1" ]; then
58 xdotool key "super+Tab"
61 xdotool key "super+comma"