forked from RomaniukVadim/hack_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patholdpanel
More file actions
126 lines (107 loc) · 1.88 KB
/
Copy patholdpanel
File metadata and controls
126 lines (107 loc) · 1.88 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
#
# See also: spawner
#
# lemonbar params
LBARGS="-B $(gxc background \#) -F $(gxc foreground \#)\
-g 1206x20+80+10 -f -*-lemon-*-*-*-10-*-*-*-*-*-*-*"
# Colors
BG=$(gxc bg ff) # background
FG=$(gxc fg ff) # foreground
GN=$(gxc boldgreen ff) # green
GY=$(gxc boldblack ff) # gray
RD=$(gxc boldred ff) # red
# Clickable area
#
# $1 text
# $2 command
#
function A {
[[ -n $2 ]] && echo -n "%{A:$2:}${1}%{A}"
}
# Background color
#
# $1 text
# $2 background color
#
function B {
[[ -n $2 ]] && echo -n "%{B#$2}${1}%{B-}"
}
# Foreground color
#
# $1 text
# $2 foreground color
#
function F {
[[ -n $2 ]] && echo -n "%{F#$2}${1}%{F-}"
}
# Overlined text
#
# $1 text
#
function o {
[[ -n $1 ]] && echo -n "%{+o}${1}%{-o}"
}
# Underlined text
#
# $1 text
#
function u {
[[ -n $1 ]] && echo -n "%{+u}${1}%{-u}"
}
# Special
DV=$(F ' :: ' $GY) # divider
SP=$(F '--' $BG) # spacer
# Panel parts
NET0=$(F + $GN)
NET1=$(F - $RD)
network() {
ping -c 1 google.com >/dev/null 2>&1 && echo -n $NET0 || echo -n $NET1
}
datetime() {
date -u '+%H:%M %d/%m/%y' | tr -d '\n'
}
# In that case ``pamw'' is equal to ``pamixer --get-volume''
volume() {
A $(pamw) volume
}
battery() {
VAL=$(acpi -b | awk '{ print $4 }' | tr -d ',%')
[[ $VAL -gt 20 ]] && echo -n $VAL || F $VAL $RD
}
layout() {
A $(xkb-switch) layout
}
# I have to use sed, because mpc does not print ``#''
MPCFMT=' [%title%] _DV [%album%] _DV [%artist%] '
mpc_status() {
mpc current -f "$MPCFMT" | tr -d '\n' | sed s/_DV/"$DV"/g
}
desktops() {
printf "desk"
}
BSPWM=" $(F bspwm $(gxc boldcyan ff))"
while true; do
# Left part
# mpc_status
# Right part
echo -n " $BSPWM"
A ' web' 1
A ' rest' 2
echo -n '%{r}'
network
# echo -n $DV
# layout
# echo -n $DV
# volume
# echo -n $DV
# battery
echo -n $DV
datetime
echo -n $DV
A "$(F 'x' $RD) " 'quit'
# Sleep
sleep 0.5s
# Clear bar
echo
done | lemonbar $LBARGS $@ | spawner