aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matheus R <matheusrbarros03@gmail.com> 2021-04-11 16:49:05 +0000
committerGravatar Matheus R <matheusrbarros03@gmail.com> 2021-04-11 16:49:05 +0000
commit3ed5e7a0ba5808209059cc682cecdd6a1e938f59 (patch)
tree2ea3f43d230b17e519ea4410290b435b8ba97413
parent36e0597bdc938cc64ea559a4c8f330e657f95826 (diff)
Scripts na pasta bin alterados para dash
-rwxr-xr-xbin/batt29
-rwxr-xr-xbin/battery_check2
-rwxr-xr-xbin/bspHide2
-rwxr-xr-xbin/bspswallow2
-rwxr-xr-xbin/connect_wlan2
-rwxr-xr-xbin/cpu2
-rwxr-xr-xbin/customwiki2html.sh2
-rwxr-xr-xbin/frame_spawn2
-rwxr-xr-xbin/kbd2
-rwxr-xr-xbin/kbd_udev2
-rwxr-xr-xbin/launch_dwm2
-rwxr-xr-xbin/linkgrabber6
-rwxr-xr-xbin/mem2
-rwxr-xr-xbin/mic_check2
-rwxr-xr-xbin/mpd_scroll2
-rwxr-xr-xbin/pkgs2
-rwxr-xr-xbin/song8
-rwxr-xr-xbin/title2
-rwxr-xr-xbin/transcode2
-rwxr-xr-xbin/urlImage2
-rwxr-xr-xbin/vol2
-rwxr-xr-xbin/wallpaper6
-rwxr-xr-xbin/wlan4
-rwxr-xr-xbin/wmMove2
-rwxr-xr-xbin/xev_keys2
25 files changed, 56 insertions, 37 deletions
diff --git a/bin/batt b/bin/batt
index 10d992b..d61ce16 100755
--- a/bin/batt
+++ b/bin/batt
@@ -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
diff --git a/bin/cpu b/bin/cpu
index 33c797e..657546b 100755
--- a/bin/cpu
+++ b/bin/cpu
@@ -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
diff --git a/bin/kbd b/bin/kbd
index 20a4e0e..f5e2797 100755
--- a/bin/kbd
+++ b/bin/kbd
@@ -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"
diff --git a/bin/mem b/bin/mem
index dab317d..948f8be 100755
--- a/bin/mem
+++ b/bin/mem
@@ -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" \
diff --git a/bin/pkgs b/bin/pkgs
index bb7e807..3d0373c 100755
--- a/bin/pkgs
+++ b/bin/pkgs
@@ -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"
+}
diff --git a/bin/title b/bin/title
index 137272c..30b5593 100755
--- a/bin/title
+++ b/bin/title
@@ -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
diff --git a/bin/vol b/bin/vol
index 9bfbd2a..3f33669 100755
--- a/bin/vol
+++ b/bin/vol
@@ -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'
diff --git a/bin/wlan b/bin/wlan
index 14d0813..61ab1f0 100755
--- a/bin/wlan
+++ b/bin/wlan
@@ -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"
}
diff --git a/bin/wmMove b/bin/wmMove
index 6ee32a5..c35fd2a 100755
--- a/bin/wmMove
+++ b/bin/wmMove
@@ -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 }'