diff options
Diffstat (limited to 'bin/.bin/lemonconf')
-rwxr-xr-x | bin/.bin/lemonconf | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/bin/.bin/lemonconf b/bin/.bin/lemonconf new file mode 100755 index 0000000..cb5e505 --- /dev/null +++ b/bin/.bin/lemonconf | |||
@@ -0,0 +1,74 @@ | |||
1 | #!/bin/bash | ||
2 | # Outputs a configuration for lemonbar | ||
3 | |||
4 | vol(){ | ||
5 | vol=$(pulsemixer --get-volume | awk '{print $1}') | ||
6 | mute=$(pulsemixer --get-mute) | ||
7 | if [ "$mute" == 1 ]; then | ||
8 | echo -e "%{F#787878}vol%{F-} muted " | ||
9 | elif [ "$mute" == 0 ]; then | ||
10 | echo -e "%{F#787878}vol%{F-} $vol% " | ||
11 | fi | ||
12 | } | ||
13 | |||
14 | bat() { | ||
15 | power=$(cat /sys/class/power_supply/BAT0/capacity) | ||
16 | status=$(cat /sys/class/power_supply/BAT0/status) | ||
17 | if [ "$status" == "Charging" ]; then | ||
18 | echo -e "%{F#787878}bat%{F-} +$power% " | ||
19 | elif [ "$status" == "Discharging" ]; then | ||
20 | echo -e "%{F#787878}bat%{F-} $power% " | ||
21 | fi | ||
22 | } | ||
23 | |||
24 | dte() { | ||
25 | dte=$(date +"%a, %b %d") | ||
26 | echo -e "%{F#787878}date%{F-} $dte " | ||
27 | } | ||
28 | |||
29 | tie() { | ||
30 | tme=$(date +"%I:%M %P") | ||
31 | echo -e "%{F#787878}time%{F-} $tme " | ||
32 | } | ||
33 | |||
34 | groups() { | ||
35 | cur=`xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}'` | ||
36 | tot=`xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}'` | ||
37 | |||
38 | for w in `seq 0 $((cur - 1))`; do line="${line} "; done | ||
39 | line="${line} " | ||
40 | for w in `seq $((cur + 2)) $tot`; do line="${line} "; done | ||
41 | echo $line | ||
42 | } | ||
43 | |||
44 | workspaces() { | ||
45 | all=$(bspc query -D) | ||
46 | occupied=$(bspc query -D -d .occupied) | ||
47 | current=$(bspc query -D -d .focused) | ||
48 | result="" | ||
49 | padding=" " | ||
50 | while IFS= read -r line; do | ||
51 | # Get the name of the current desktop | ||
52 | name="" | ||
53 | if [[ "$occupied" == *"$line"* ]]; | ||
54 | then | ||
55 | name="" | ||
56 | fi | ||
57 | |||
58 | if [[ "$current" == *"$line"* ]]; | ||
59 | then | ||
60 | name="" | ||
61 | fi | ||
62 | |||
63 | result="$result$padding" | ||
64 | result="$result$name" | ||
65 | result="$result$padding" | ||
66 | done <<< "$all" | ||
67 | echo -e "$result" | ||
68 | } | ||
69 | |||
70 | while true; do | ||
71 | echo " $(vol) $(bat) $(tie) $(dte) %{F#787878}%{r}$(workspaces)%{F-} " | ||
72 | xdo above -t $(xdo id -n root) $(xdo id -n lemonbar) | ||
73 | sleep 3 | ||
74 | done | ||