blob: 66f29dec71c3107d3ef2c429485f7c39e64b4793 (
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
|
#!/bin/sh
BAR_CFG="$XDG_CONFIG_HOME/polybar/config.ini"
main () {
if [ -z "$1" ]; then
toggle ; exit 0
fi
case "$1" in
t|top)
top ;;
b|bottom)
bottom ;;
*)
echo "usage: barpos [top|bottom]" ;;
esac
}
toggle () {
if grep -Eq "^bottom = true$" "$BAR_CFG"; then
top
else
bottom
fi
}
bottom () {
sed -Ei "s|^bottom = .*$|bottom = true|" "$BAR_CFG"
}
top () {
sed -Ei "s|^bottom = .*$|bottom = false|" "$BAR_CFG"
}
main "$@"
|