diff options
| author | 2021-04-11 16:49:05 +0000 | |
|---|---|---|
| committer | 2021-04-11 16:49:05 +0000 | |
| commit | 3ed5e7a0ba5808209059cc682cecdd6a1e938f59 (patch) | |
| tree | 2ea3f43d230b17e519ea4410290b435b8ba97413 /bin | |
| parent | 36e0597bdc938cc64ea559a4c8f330e657f95826 (diff) | |
Scripts na pasta bin alterados para dash
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/batt | 29 | ||||
| -rwxr-xr-x | bin/battery_check | 2 | ||||
| -rwxr-xr-x | bin/bspHide | 2 | ||||
| -rwxr-xr-x | bin/bspswallow | 2 | ||||
| -rwxr-xr-x | bin/connect_wlan | 2 | ||||
| -rwxr-xr-x | bin/cpu | 2 | ||||
| -rwxr-xr-x | bin/customwiki2html.sh | 2 | ||||
| -rwxr-xr-x | bin/frame_spawn | 2 | ||||
| -rwxr-xr-x | bin/kbd | 2 | ||||
| -rwxr-xr-x | bin/kbd_udev | 2 | ||||
| -rwxr-xr-x | bin/launch_dwm | 2 | ||||
| -rwxr-xr-x | bin/linkgrabber | 6 | ||||
| -rwxr-xr-x | bin/mem | 2 | ||||
| -rwxr-xr-x | bin/mic_check | 2 | ||||
| -rwxr-xr-x | bin/mpd_scroll | 2 | ||||
| -rwxr-xr-x | bin/pkgs | 2 | ||||
| -rwxr-xr-x | bin/song | 8 | ||||
| -rwxr-xr-x | bin/title | 2 | ||||
| -rwxr-xr-x | bin/transcode | 2 | ||||
| -rwxr-xr-x | bin/urlImage | 2 | ||||
| -rwxr-xr-x | bin/vol | 2 | ||||
| -rwxr-xr-x | bin/wallpaper | 6 | ||||
| -rwxr-xr-x | bin/wlan | 4 | ||||
| -rwxr-xr-x | bin/wmMove | 2 | ||||
| -rwxr-xr-x | bin/xev_keys | 2 |
25 files changed, 56 insertions, 37 deletions
@@ -1,24 +1,33 @@ -#!/bin/env bash +#!/bin/env dash batt() { batt="$(acpi | awk '{print $4}' | sed -e 's/%,//g')" state="$(cat /sys/class/power_supply/BAT0/status)" + # resets when the script is called again + notif=0 + icon="" - [ "$batt" -e 98 ] && icon="" + if [ "$state" -eq "Discharging" ]; then + + [ "$batt" -le 7 ] && icon="" && [ notif -eq 0 ] && notify-send -u critical 'Bateria crítica!' 'Bateria atingiu 7%' && "$notif"=1 + + [ "$batt" -ge 7 ] && [ "$batt" -le 10 ] && icon="" && [ "$notif" -eq 0 ] && notify-send 'Bateria descarregando' 'Bateria atingiu 10%' && "$notif"=1 + + [ "$batt" -ge 10 ] && [ "$batt" -le 20 ] && icon="" && [ "$notif" -eq 0 ] && notify-send 'Bateria descarregando' 'Bateria atingiu 20%' && "$notif"=1 + + [ "$batt" -ge 20 ] && [ "$batt" -le 50 ] && icon="" - [ "$batt" -ge 90 ] && icon="" + [ "$batt" -le 96 ] && [ "$batt" -ge 90 ] && icon="" - [ "$batt" -le 50 ] && icon="" - - [ "$batt" -le 20 ] && icon="" - - [ "$batt" -le 5 ] && icon="" + [ "$batt" -ge 96 ] && icon="" - [ "$state" == "Charging" ] && icon="" + elif [ "$state" -eq "Charging" ]; then + icon="" - battery_check "$batt" "$state" + [ "$batt" -ge 98 ] && notify-send 'Bateria completamente carregada!' 'Bateria alcançou 100%' && icon="" + fi printf "%s %d%%" "$icon" "$batt" } diff --git a/bin/battery_check b/bin/battery_check index 3ee4ca1..5e27913 100755 --- a/bin/battery_check +++ b/bin/battery_check @@ -16,3 +16,5 @@ elif [[ $batt -eq 10 ]] ; then elif [[ $batt -le "$critical_level" ]]; then notify-send -u critical "Bateria crítica!" "Nível de bateria alcançou 7%"; pkill -RTMIN+20 dwmblocks fi + +sleep 50 diff --git a/bin/bspHide b/bin/bspHide index c69182d..09e5123 100755 --- a/bin/bspHide +++ b/bin/bspHide @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # hides focused window # if there are any hidden windows in the current desktop, \ diff --git a/bin/bspswallow b/bin/bspswallow index 35784a2..c2cd57a 100755 --- a/bin/bspswallow +++ b/bin/bspswallow @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/env dash # Get class of a wid get_class() { diff --git a/bin/connect_wlan b/bin/connect_wlan index fd2c8cd..7d27878 100755 --- a/bin/connect_wlan +++ b/bin/connect_wlan @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # script to pipe scanned networks to dmenu, using iwd @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # checks the amount of CPU being used cpu() { diff --git a/bin/customwiki2html.sh b/bin/customwiki2html.sh index 4818d02..4e69a4b 100755 --- a/bin/customwiki2html.sh +++ b/bin/customwiki2html.sh @@ -20,7 +20,7 @@ # # Then, in your .vimrc file, set: # -# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh' +# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.dash' # # On your next restart, Vimwiki will run this script instead of using the # internal wiki2html converter. diff --git a/bin/frame_spawn b/bin/frame_spawn index 5e6dfd3..66c0612 100755 --- a/bin/frame_spawn +++ b/bin/frame_spawn @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # Based on: # https://github.com/herbstluftwm/herbstluftwm/issues/1164 @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/dash sleep 1 DISPLAY=":0.0" diff --git a/bin/kbd_udev b/bin/kbd_udev index 7c51dfa..0c2346c 100755 --- a/bin/kbd_udev +++ b/bin/kbd_udev @@ -1,3 +1,3 @@ -#!/bin/env bash +#!/bin/dash /home/math/.local/bin/kbd & diff --git a/bin/launch_dwm b/bin/launch_dwm index 9868f00..df91af0 100755 --- a/bin/launch_dwm +++ b/bin/launch_dwm @@ -1,4 +1,4 @@ -#!/bin/env sh +#!/bin/env dash # relaunch DWM if the binary changes, otherwise bail csum="" diff --git a/bin/linkgrabber b/bin/linkgrabber index bf29fef..8f8bd89 100755 --- a/bin/linkgrabber +++ b/bin/linkgrabber @@ -1,10 +1,10 @@ -#!/bin/sh +#!/bin/env dash # opens url in browser: intended use with st -# copied from: https://st.suckless.org/patches/externalpipe/linkgrabber.sh +# copied from: https://st.suckless.org/patches/externalpipe/linkgrabber.dash regex='(((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]' url=$(grep -Po "$regex" | dmenu -p "Go:" -w "$WINDOWID") || exit -$BROWSER "$url" +"$BROWSER" "$url" @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # sends used memory to stdout mem() { diff --git a/bin/mic_check b/bin/mic_check index 19ce263..05df57e 100755 --- a/bin/mic_check +++ b/bin/mic_check @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # mutes the microphone and send a notification diff --git a/bin/mpd_scroll b/bin/mpd_scroll index bbb6872..52814a3 100755 --- a/bin/mpd_scroll +++ b/bin/mpd_scroll @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env dash zscroll --before-text "ﱘ No current song playing" --delay 0.3 \ --match-command "mpc status" \ @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # prints the number of current installed packages (pacman-based) pkgs() { diff --git a/bin/song b/bin/song new file mode 100755 index 0000000..538f71e --- /dev/null +++ b/bin/song @@ -0,0 +1,8 @@ +#!/bin/env dash + +# prints current song playing in mpd +song(){ + song="$(mpc current)" + + printf "%s" "$song" +} @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # prints window title title(){ diff --git a/bin/transcode b/bin/transcode index 6f6a3c7..d8c343d 100755 --- a/bin/transcode +++ b/bin/transcode @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # Este script faz a transcodagem de um vídeo de um codec para outro, feito para reduzir em até 80% o tamanho do arquivo original. diff --git a/bin/urlImage b/bin/urlImage index 21ff6f5..6832e54 100755 --- a/bin/urlImage +++ b/bin/urlImage @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env dash # Pipe images from URLs into sxiv @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/bin/env dash # prints volume from pulseaudio vol() { diff --git a/bin/wallpaper b/bin/wallpaper index 0ae3e93..e2433e6 100755 --- a/bin/wallpaper +++ b/bin/wallpaper @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env dash # Baseado no script do Luke Smith @@ -6,9 +6,9 @@ DIR="$HOME/Imagens/Wallpapers" WAL="~/Imagens/Wallpapers/wall.png" # se o diretório existir, pegue um arquivo aleatoriamente -[[ -d "$DIR" ]] && IMG=$(find "$DIR"/* | shuf -n 1) +[ -d "$DIR" ] && IMG=$(find "$DIR"/* | shuf -n 1) # se a imagem for diferente do wallpaper atual, copie-a -[[ "$IMG" != "$WAL" ]] && cp $IMG ~/Imagens/Wallpapers/wall.png +[ "$IMG" != "$WAL" ] && cp $IMG ~/Imagens/Wallpapers/wall.png xwallpaper --stretch "$DIR"/wall.png && notify-send -i '"$DIR"/wall.png' 'Wallpaper alterado' @@ -1,9 +1,9 @@ -#!/bin/env bash +#!/bin/env dash # prints connected SSID name wlan() { station="$(iwctl device list | grep station | awk ' { print $1 } ')" - essid="$(iwgetid | sed -e 's/ESSID://g' -e 's/"//g' -e "s:$station::g" -e 's/^\W*/ /g')" + essid="$(iwgetid | sed -e 's/ESSID://g' -e 's/\"//g' -e "s:$station::g" -e 's/^\W*/ /g')" printf "%s" "$essid" } @@ -1,4 +1,4 @@ -#!/bin/env sh +#!/bin/env dash # copied from: # https://www.reddit.com/r/herbstluftwm/comments/j4oq4k/does_anyone_know_how_i_could_allign_a_frame_to/gaejwks/?utm_source=reddit&utm_medium=web2x&context=3 diff --git a/bin/xev_keys b/bin/xev_keys index d370c49..8cc40f8 100755 --- a/bin/xev_keys +++ b/bin/xev_keys @@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/env dash xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }' |
