From 0375f1c658571190d1b26ac8c12dac1b3ff8821e Mon Sep 17 00:00:00 2001 From: adam <56338480+adastx@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:20:33 +0200 Subject: scripts: cleanup --- .local/bin/barpos | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) (limited to '.local/bin/barpos') diff --git a/.local/bin/barpos b/.local/bin/barpos index 6caf44d..5f36451 100755 --- a/.local/bin/barpos +++ b/.local/bin/barpos @@ -2,46 +2,23 @@ BAR_CFG=$XDG_CONFIG_HOME/polybar/config.ini -BOTTOM="bottom = true" -TOP="bottom = false" - main () { if [ ! -n "$1" ]; then toggle fi - while [ -n "$1" ]; do # while loop starts - case "$1" in - -b) - bottom; break ;; - -t) - top; break ;; - -h|--help) - help ; break ;; - *) - usage; echo "error: unrecognized arguments: $1" ; exit 1 ;; - esac - shift - done -} - -usage () { - echo "usage: barpos [options]" -} - -help () { - usage - echo - echo "Toggles status bar position, or sets it as specified" - echo - echo "options:" - echo " -h, --help show this help message and exit" - echo " -b bottom" - echo " -t top" + case "$1" in + t|top) + top ;; + b|bottom) + bottom ;; + *) + echo "usage: barpos [top|bottom]" ;; + esac } toggle () { - if grep -Eq "^$BOTTOM$" $BAR_CFG; then + if grep -Eq "^bottom = true$" $BAR_CFG; then top else bottom -- cgit v1.2.3-70-g09d2