diff options
| author | 2021-04-08 01:22:13 +0000 | |
|---|---|---|
| committer | 2021-04-08 01:22:13 +0000 | |
| commit | 565a3da2702126e7f10ccb48c3fbf2e188ef37b5 (patch) | |
| tree | e99a753ddf02e524171ff205a49a0f225556c40c /bin | |
| parent | fb6c60c4aa5f2fb1bae1d49b114861cea8f285d4 (diff) | |
Adicionados novos scripts e alteradas configurações
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/batt | 1 | ||||
| -rwxr-xr-x | bin/battery_check | 32 | ||||
| -rwxr-xr-x | bin/connect_wlan | 11 | ||||
| -rwxr-xr-x | bin/linkgrabber | 10 | ||||
| -rwxr-xr-x | bin/transcode | 2 | ||||
| -rwxr-xr-x | bin/wlan | 5 |
6 files changed, 45 insertions, 16 deletions
@@ -3,6 +3,7 @@ batt() { batt="$(acpi | awk '{print $4}' | sed -e 's/%,//g')" icon="" + state="$(cat /sys/class/power_supply/BAT0/status)" [ "$batt" -ge 90 ] && icon="" diff --git a/bin/battery_check b/bin/battery_check index af44108..7d77b82 100755 --- a/bin/battery_check +++ b/bin/battery_check @@ -1,17 +1,23 @@ #!/usr/bin/env bash -# Simple script to monitor the battery's status +# Simple script to monitor the battery's status and level -# calls batt_status script -batt=$(acpi | awk '{print $4}' | sed -e 's/\%,//g') -state=$(acpi | awk '{print }' | sed -e 's/\,//g') +interval=300 # 5 minutes +critical_level=7 -if [[ $batt -ge 99 ]]; then - notify-send "Bateria" "Completamente carregada! (100%)" -elif [[ $batt -eq 20 ]] ; then - notify-send "Bateria descarregando" "Nível de bateria alcançou 20%" -elif [[ $batt -eq 10 ]] ; then - notify-send "Bateria descarregando" "Nível de bateria alcançou 10%" -elif [[ $batt -le 5 ]]; then - notify-send "Bateria crítica!" "Nível de bateria alcançou 5%" -fi +while true +do + batt="$(cat /sys/class/power_supply/BAT0/capacity)" + state="$(cat /sys/class/power_supply/BAT0/status)" + + if [[ $batt -ge 99 ]]; then + notify-send -u normal"Bateria" "Completamente carregada! (100%)"; pkill -RTMIN+20 dwmblocks + elif [[ $batt -eq 20 ]] ; then + notify-send -u normal "Bateria descarregando" "Nível de bateria alcançou 20%"; pkill -RTMIN+20 dwmblocks + elif [[ $batt -eq 10 ]] ; then + notify-send -u normal "Bateria descarregando" "Nível de bateria alcançou 10%"; pkill -RTMIN+20 dwmblocks + 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 "$interval" +done diff --git a/bin/connect_wlan b/bin/connect_wlan new file mode 100755 index 0000000..fd2c8cd --- /dev/null +++ b/bin/connect_wlan @@ -0,0 +1,11 @@ +#!/bin/env bash + +# script to pipe scanned networks to dmenu, using iwd + +station="$(iwctl device list | grep station | awk ' { print $1 } ')" + +iwctl station "$station" scan + +ssid="$(iwctl station "$station" get-networks | dmenu -l 6 -p "Connect to a network:" | sed -e 's/psk.*$//g' -e 's/^\W*//g' -e 's/\W*$//g')" + +[ -v "$ssid" ] && iwctl station "$station" connect "$ssid"; notify-send 'iwctl' "Connected to network $ssid" diff --git a/bin/linkgrabber b/bin/linkgrabber new file mode 100755 index 0000000..bf29fef --- /dev/null +++ b/bin/linkgrabber @@ -0,0 +1,10 @@ +#!/bin/sh + +# opens url in browser: intended use with st +# copied from: https://st.suckless.org/patches/externalpipe/linkgrabber.sh + +regex='(((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]' + +url=$(grep -Po "$regex" | dmenu -p "Go:" -w "$WINDOWID") || exit + +$BROWSER "$url" diff --git a/bin/transcode b/bin/transcode index 094c36e..6f6a3c7 100755 --- a/bin/transcode +++ b/bin/transcode @@ -3,7 +3,7 @@ # 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. ORIG="$1" -NOME=$(basename "$ORIG" .mp4) +NOME="$(basename "$ORIG" .mp4)" NOVO="${2:-"$NOME-trans.mp4"}" ffmpeg -i "$ORIG" -vf mpdecimate -vsync vfr -c:v libx265 -x265-params crf=32 -preset veryslow "$NOVO" @@ -2,9 +2,10 @@ # prints connected SSID name wlan() { - wlan="$(iwgetid | awk ' {print $2, $3, $4, $5, $6} ' | sed -e 's/ESSID://g' -e 's/"//g')" + 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')" - printf "%s %s" "" "$wlan" + printf "%s" "$essid" } wlan |
