blob: 16626a3a99d55e828e7efad167f7eb7696090760 (
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 [ ! -n "$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 -ir "s|^bottom = .*$|bottom = true|" $BAR_CFG
}
top () {
sed -ir "s|^bottom = .*$|bottom = false|" $BAR_CFG
}
main "$@"
|