aboutsummaryrefslogtreecommitdiff
path: root/scripts/scripts/bar.sh
blob: 190346272bb1af8992acd3bf900f2da8c0aa3a8e (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /usr/bin/env bash


fg="$(get_xres color15)"
fg_light="$(get_xres color10)"
bg="$(get_xres color0)"
# %{F$fg} $(date +%d/%m) %{F$fg_light} $(date +%Y)

(while true; do echo -e "\n$(date +%H)\n$(date +%M)\n"; sleep 10; done) | dzen2 \
    -e "onstart=uncollapse;" \
    -fg "$fg" \
    -bg "$fg_light" \
    -tw 0 \
    -l 3 \
    -x 20 \
    -y 600 \
    -w 70 \
    -h 30 \
    -sa c \
    -p &

(echo -e "\n"; while true; do echo -e "$(bat -i)"; sleep 1; done )| dzen2 \
    -e "onstart=uncollapse;" \
    -fg "$fg" \
    -bg "$fg_light" \
    -tw 70 \
    -l 4 \
    -x 20 \
    -y 500 \
    -w 70 \
    -h 15 \
    -sa c \
    -p &

ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' )

# colors
current="$( ~/scripts/get_xres color5 )"
occupied="$( ~/scripts/get_xres color8 )"
unoccupied="$( ~/scripts/get_xres color8 )"

#  print workspaces to stdout
draw() {
    for i in {0..5}; do
        # get the number of windows in each workspace
        windows=$( wmctrl -l | cut -d ' ' -f3 | grep $i | wc -l )


        if [[ $i -eq $ws ]]
        then
            # current workspace
            echo -ne "^($current)O"
        else
            if [[ $windows -eq 0 ]]
            then
                echo -ne "^($unoccupied)o"
            else
                echo -ne "^($occupied)x"
            fi
        fi
    done
}

# echo -e "\n\n$(draw)\n" | dzen2 \
#     -e "onstart=uncollapse;" \
#     -fg "$fg" \
#     -bg "$fg_light" \
#     -tw 70 \
#     -l 4 \
#     -x 20 \
#     -y 500 \
#     -w 70 \
#     -h 15 \
#     -sa c \
#     -p &