#!/bin/bash BAR_CFG=$XDG_CONFIG_HOME/polybar/config.ini main () { if [ ! -n "$1" ]; then toggle 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 "$@"