diff options
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/barpos | 41 | ||||
-rwxr-xr-x | .local/bin/comptoggle | 3 | ||||
-rwxr-xr-x | .local/bin/dock | 44 | ||||
-rwxr-xr-x | .local/bin/screenshot | 28 |
4 files changed, 38 insertions, 78 deletions
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 diff --git a/.local/bin/comptoggle b/.local/bin/comptoggle index c579fc7..259ba2d 100755 --- a/.local/bin/comptoggle +++ b/.local/bin/comptoggle @@ -1,7 +1,6 @@ #!/bin/sh -if pgrep -x "picom" > /dev/null -then +if pgrep -x "picom" > /dev/null; then killall picom else picom -b --config $HOME/.config/picom/picom.conf diff --git a/.local/bin/dock b/.local/bin/dock index ada7b64..3d0c06f 100755 --- a/.local/bin/dock +++ b/.local/bin/dock @@ -1,38 +1,14 @@ #!/bin/bash main () { - if [ ! -n "$1" ]; then - help - fi - - while [ -n "$1" ]; do # while loop starts - case "$1" in - -d) - dock; break ;; - -u) - undock; break ;; - -h|--help) - help ;; - *) - usage; echo "error: unrecognized arguments: $1" ; exit 1 ;; - esac - shift - done -} - -usage () { - echo "usage: dock [options]" -} - -help () { - usage - echo - echo "Dock or undock laptop" - echo - echo "options:" - echo " -h, --help show this help message and exit" - echo " -d dock" - echo " -u undock" + case "$1" in + -d) + dock ;; + -u) + undock ;; + *) + echo "usage: dock [-du]";; + esac } dock () { @@ -40,7 +16,7 @@ dock () { echo "error: HDMI not connected"; exit 1 fi - barpos -b + barpos bottom xrandr --output HDMI-1 --mode 2560x1440 --rate 70 --primary xrandr --output eDP-1 --off xwallpaper --center $XDG_CONFIG_HOME/wallpaper/bg @@ -48,7 +24,7 @@ dock () { } undock () { - barpos -t + barpos top xrandr --output eDP-1 --mode 1920x1080 --primary xrandr --output HDMI-1 --off xwallpaper --center $XDG_CONFIG_HOME/wallpaper/bg diff --git a/.local/bin/screenshot b/.local/bin/screenshot index 6d65898..3eed12b 100755 --- a/.local/bin/screenshot +++ b/.local/bin/screenshot @@ -1,17 +1,25 @@ #!/bin/sh -if [ ! -n "$1" ]; then - scrot -q 100 -e 'xclip -selection c -t image/png < $f; mv $f ~/Pictures/screenshots/' -fi +main () { + if [ ! -n "$1" ]; then + print_screen + fi -while [ -n "$1" ]; do # while loop starts case "$1" in -s) - sleep 0.2 - scrot -l mode=edge -i -s -e 'xclip -sel clip -t image/png $f; mv $f ~/Pictures/screenshots/' - ;; - *) echo "Option $1 not recognized" ;; + screenshot-select ;; + *) + echo "usage: screenshot [-s]" ;; esac - shift -done +} + +print_screen () { + scrot -q 100 -e 'xclip -selection c -t image/png < $f; mv $f ~/Pictures/screenshots/' +} + +screenshot-select () { + sleep 0.2 + scrot -l mode=edge -i -s -e 'xclip -sel clip -t image/png $f; mv $f ~/Pictures/screenshots/' +} +main "$@" |