aboutsummaryrefslogtreecommitdiff
path: root/pw-date
blob: 7996b6c5402ed215390ac4ab3d964476ed25fa67 (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
#!/usr/bin/env bash

# unfortunately cal is a bit limited here, 
# so I also use orage, an xfce4 calendar app
# This is updated by signal 1, so 1 + 34 =
# kill -35 $(pidof dwmblocks) or
# pkill -RTMIN+1 dwmblocks

echo -e " $(date '+%d %b %T')"

case $BLOCK_BUTTON in

    #1)
    #  	TODAY=$(date '+%-d')
    # 	HEAD=$(cal | head -n1)
    #  	BODY=$(cal | tail -n7 | sed -z "s|$TODAY|<u><b>$TODAY</b></u>|1")      	
    #  
    #    dunstify "$HEAD" "$BODY" \
    #    -i office-calendar-symbolic \
    #    -h string:x-canonical-private-synchronous:calendar \
    #    -u normal
    #;;
    
    1) 
        # X220 screen is 1366x768

        # toggle Orage on/off
        pid=$(wmctrl -lp | awk '/Orage/{print $3}')
        if (( pid > 0 )) ; then
            kill -9 "$pid" 
        else
            # this works but is slow, sleep + wmctrl is faster
            #xdotool search --onlyvisible --sync --name "Orage" windowmove 1064 23 &
            { orage > /dev/null 2>&1; } &
            sleep 0.2 
            wmctrl -r "Orage" -e 0,1064,23,300,180 &
        fi
    ;;
    
esac

exit 0