diff options
author | adam <56338480+adastx@users.noreply.github.com> | 2022-11-04 21:43:06 +0100 |
---|---|---|
committer | adam <56338480+adastx@users.noreply.github.com> | 2022-11-04 21:43:06 +0100 |
commit | 767c0821ee0a1ad893efe9b5bc8e84f5629f8416 (patch) | |
tree | b3b8b619dd99f020f41f54fa1186421901d78fd0 | |
parent | bb2359c30f8ade19fc7e60ab825d2744d0c04fcf (diff) |
scripts: removed bashisms
-rwxr-xr-x | .local/bin/aurignored | 6 | ||||
-rwxr-xr-x | .local/bin/barlaunch | 2 | ||||
-rwxr-xr-x | .local/bin/barpos | 6 | ||||
-rwxr-xr-x | .local/bin/comptoggle | 4 | ||||
-rwxr-xr-x | .local/bin/dock | 8 | ||||
-rwxr-xr-x | .local/bin/in-git-repo | 2 | ||||
-rwxr-xr-x | .local/bin/pashare | 4 | ||||
-rwxr-xr-x | .local/bin/scheme | 14 | ||||
-rwxr-xr-x | .local/bin/screenshot | 2 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-forecast | 19 |
10 files changed, 34 insertions, 33 deletions
diff --git a/.local/bin/aurignored b/.local/bin/aurignored index 0db9148..efb12f7 100755 --- a/.local/bin/aurignored +++ b/.local/bin/aurignored @@ -1,10 +1,10 @@ #!/bin/sh # Get list of ignored pkgs -function ignored() { +ignored() { pkgs="$(grep IgnorePkg /etc/pacman.conf | sed -e 's/IgnorePkg =//' -e 's/#.*//')" grps="$(grep IgnoreGroup /etc/pacman.conf | sed -e 's/IgnoreGroup =//' -e 's/#.*//')" - [[ -n $grps ]] && pkgs="$pkgs $(pacman -Sgq $grps)" + [ -n "$grps" ] && pkgs="$pkgs $(pacman -Sgq "$grps")" echo -n "$pkgs" | tail -n -1 } @@ -12,5 +12,5 @@ function ignored() { # Return only AUR pkgs for pkg in $(ignored) do - pacman -Si $pkg &>/dev/null || echo "$pkg" + pacman -Si "$pkg" >/dev/null 2>&1 || echo "$pkg" done diff --git a/.local/bin/barlaunch b/.local/bin/barlaunch index f1d76ff..5a8fec0 100755 --- a/.local/bin/barlaunch +++ b/.local/bin/barlaunch @@ -3,4 +3,4 @@ polybar-msg cmd quit >/dev/null echo "---" >> /tmp/polybar.log -polybar bar1 --reload >> /tmp/polybar.log 2>&1 & disown +nohup polybar bar1 --reload >> /tmp/polybar.log 2>&1 & diff --git a/.local/bin/barpos b/.local/bin/barpos index 16626a3..d84709d 100755 --- a/.local/bin/barpos +++ b/.local/bin/barpos @@ -1,6 +1,6 @@ #!/bin/sh -BAR_CFG=$XDG_CONFIG_HOME/polybar/config.ini +BAR_CFG="$XDG_CONFIG_HOME/polybar/config.ini" main () { if [ ! -n "$1" ]; then @@ -26,11 +26,11 @@ toggle () { } bottom () { - sed -ir "s|^bottom = .*$|bottom = true|" $BAR_CFG + sed -Ei "s|^bottom = .*$|bottom = true|" $BAR_CFG } top () { - sed -ir "s|^bottom = .*$|bottom = false|" $BAR_CFG + sed -Ei "s|^bottom = .*$|bottom = false|" $BAR_CFG } main "$@" diff --git a/.local/bin/comptoggle b/.local/bin/comptoggle index 259ba2d..438ac32 100755 --- a/.local/bin/comptoggle +++ b/.local/bin/comptoggle @@ -1,7 +1,7 @@ #!/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 + picom -b --config "$HOME/.config/picom/picom.conf" fi diff --git a/.local/bin/dock b/.local/bin/dock index c4ffb01..9be72c1 100755 --- a/.local/bin/dock +++ b/.local/bin/dock @@ -19,16 +19,16 @@ dock () { barpos bottom xrandr --output HDMI-1 --mode 2560x1440 --rate 70 --primary xrandr --output eDP-1 --off - xwallpaper --center $XDG_CONFIG_HOME/wallpaper/bg - betterlockscreen -u $XDG_CONFIG_HOME/wallpaper/lock &>/dev/null & + xwallpaper --center "$XDG_CONFIG_HOME/wallpaper/bg" + betterlockscreen -u "$XDG_CONFIG_HOME/wallpaper/lock" >/dev/null 2>&1 & } undock () { barpos top xrandr --output eDP-1 --mode 1920x1080 --primary xrandr --output HDMI-1 --off - xwallpaper --center $XDG_CONFIG_HOME/wallpaper/bg - betterlockscreen -u $XDG_CONFIG_HOME/wallpaper/lock &>/dev/null & + xwallpaper --center "$XDG_CONFIG_HOME/wallpaper/bg" + betterlockscreen -u "$XDG_CONFIG_HOME/wallpaper/lock" >/dev/null 2>&1 & } main "$@" diff --git a/.local/bin/in-git-repo b/.local/bin/in-git-repo index 56e2e33..0372e32 100755 --- a/.local/bin/in-git-repo +++ b/.local/bin/in-git-repo @@ -2,7 +2,7 @@ res=$(git rev-parse --is-inside-work-tree 2>/dev/null) -if [[ $res == true ]]; then +if [ "$res" = true ]; then exit 0 else exit 1 diff --git a/.local/bin/pashare b/.local/bin/pashare index a13c25e..0e6d885 100755 --- a/.local/bin/pashare +++ b/.local/bin/pashare @@ -15,9 +15,9 @@ main () { } start () { - stop &>/dev/null + stop >/dev/null 2>&1 - DEST=$(<$XDG_CONFIG_HOME/pashare/dest) + DEST=$(cat $XDG_CONFIG_HOME/pashare/dest) pactl load-module module-null-sink \ sink_name=rtp \ diff --git a/.local/bin/scheme b/.local/bin/scheme index a4b9b38..128d8f2 100755 --- a/.local/bin/scheme +++ b/.local/bin/scheme @@ -12,17 +12,17 @@ main () { } set_scheme () { - if [[ $1 == "dark" ]]; then - GTK_THEME=$(<"$XDG_CONFIG_HOME"/scheme/gtk-theme-dark) - QT_THEME=$(<"$XDG_CONFIG_HOME"/scheme/qt-theme-dark) - TERM_THEME=$(<"$XDG_CONFIG_HOME"/scheme/term-theme-dark) + if [ "$1" = "dark" ]; then + GTK_THEME=$(cat "$XDG_CONFIG_HOME/scheme/gtk-theme-dark") + QT_THEME=$(cat "$XDG_CONFIG_HOME/scheme/qt-theme-dark") + TERM_THEME=$(cat "$XDG_CONFIG_HOME/scheme/term-theme-dark") FZF_COLOR=dark PREFER_DARK="true" PREFER_DARK_STR="prefer-dark" else - GTK_THEME=$(<"$XDG_CONFIG_HOME"/scheme/gtk-theme-light) - QT_THEME=$(<"$XDG_CONFIG_HOME"/scheme/qt-theme-light) - TERM_THEME=$(<"$XDG_CONFIG_HOME"/scheme/term-theme-light) + GTK_THEME=$(cat "$XDG_CONFIG_HOME/scheme/gtk-theme-light") + QT_THEME=$(cat "$XDG_CONFIG_HOME/scheme/qt-theme-light") + TERM_THEME=$(cat "$XDG_CONFIG_HOME/scheme/term-theme-light") FZF_COLOR=light PREFER_DARK="false" PREFER_DARK_STR="prefer-light" diff --git a/.local/bin/screenshot b/.local/bin/screenshot index eca47ea..04b28cd 100755 --- a/.local/bin/screenshot +++ b/.local/bin/screenshot @@ -1,7 +1,7 @@ #!/bin/sh main () { - if [ ! -n "$1" ]; then + if [ $# -eq 0 ]; then print_screen ; exit 0 fi diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index c70f671..dd997c8 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -1,24 +1,25 @@ #!/bin/sh -LOCATION=$(<$XDG_CONFIG_HOME/forecast/location) +LOCATION=$(cat "$XDG_CONFIG_HOME/forecast/location") main () { case "$1" in -b|--browser) - xdg-open https://wttr.in/$LOCATION + xdg-open "https://wttr.in/$LOCATION" exit 0 ;; esac - res=$(curl -sf wttr.in/$LOCATION?format="%x+%t") || exit 1 - arr=($res) + res=$(curl -sf wttr.in/"$LOCATION"?format="%x+%t") || exit 1 - icon=$(condition_icon ${arr[0]}) - temp=$(temperature ${arr[1]}) - echo $icon $temp + icon=$(condition_icon "$res") + temp=$(temperature "$res") + echo "$icon" "$temp" } condition_icon () { - case "$1" in + icon=$(echo "$1" | cut -d\ -f1) + + case "$icon" in 'mm') echo ;; '=') echo ;; '///') echo ;; @@ -42,7 +43,7 @@ condition_icon () { } temperature () { - echo $1 | sed 's/+//' | sed 's/C//' + echo "$1" | cut -d\ -f2 | sed 's/+//' | sed 's/C//' } main "$@" |