aboutsummaryrefslogtreecommitdiff
path: root/wmutils/bin/wm
blob: 2124a6b811d3922d0e387928e35630690860e690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
#                                  ██   ██  ██        
#                                 ░██  ░░  ░██        
# ███     ██ ██████████  ██   ██ ██████ ██ ░██  ██████
#░░██  █ ░██░░██░░██░░██░██  ░██░░░██░ ░██ ░██ ██░░░░ 
# ░██ ███░██ ░██ ░██ ░██░██  ░██  ░██  ░██ ░██░░█████ 
# ░████░████ ░██ ░██ ░██░██  ░██  ░██  ░██ ░██ ░░░░░██
# ███░ ░░░██ ███ ░██ ░██░░██████  ░░██ ░██ ███ ██████ 
#░░░    ░░░ ░░░  ░░  ░░  ░░░░░░    ░░  ░░ ░░░ ░░░░░░  


wmutilsdir="/tmp/wmutils"
mkdir -p "$wmutilsdir/window"
cat "/dev/null" > "$wmutilsdir/window/active"

~/bin/tray &
~/bin/clock &
~/bin/wgrp -m &
~/bin/bar 'wgrp -b' &
~/bin/pulse &

wew | while IFS=: read ev wid; do
    wattr o $wid && continue
    case $ev in
        # enter/leave
        7)
          echo "$(wname "$wid")" > "$wmutilsdir/window/active"
        ;;
        # create
        16)
          echo "$(wname "$wid")" > "$wmutilsdir/window/active"
        ;;
        # close
        18)
          ~/bin/focus.sh prev 2>/dev/null
          ~/bin/wgrp -R $wid  2>/dev/null
          echo "$(wname `pfw`)" > "$wmutilsdir/window/active"
        ;;
        # window map 
        19)
          echo "$(wname "$wid")" > "$wmutilsdir/window/active"
          ~/bin/focus.sh $wid
        ;;
    esac
done