aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/batt1
-rwxr-xr-xbin/battery_check32
-rwxr-xr-xbin/connect_wlan11
-rwxr-xr-xbin/linkgrabber10
-rwxr-xr-xbin/transcode2
-rwxr-xr-xbin/wlan5
6 files changed, 45 insertions, 16 deletions
diff --git a/bin/batt b/bin/batt
index c99c3a3..0e88611 100755
--- a/bin/batt
+++ b/bin/batt
@@ -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"
diff --git a/bin/wlan b/bin/wlan
index fcd35e4..14d0813 100755
--- a/bin/wlan
+++ b/bin/wlan
@@ -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