summaryrefslogtreecommitdiff
path: root/.scripts
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2020-12-27 12:47:51 +0000
committer0scar <qgt268@alumni.ku.dk>2020-12-27 12:47:51 +0000
commitafa225e8322c2a53ef755d2f2d02241c36d5111f (patch)
treec0dbea6737ad0c3af6adfc5958be0a4386e42c4f /.scripts
parent776e889e385b5a49b3ca048dbca034fb10e9d276 (diff)
Minor improvements
Diffstat (limited to '.scripts')
-rwxr-xr-x.scripts/batinfo8
-rwxr-xr-x.scripts/bt2
-rwxr-xr-x.scripts/checkupdates4
-rwxr-xr-x.scripts/cpuinfo2
-rwxr-xr-x.scripts/is_docker_running4
-rwxr-xr-x.scripts/meminfo5
-rwxr-xr-x.scripts/netinfo2
-rwxr-xr-x.scripts/vimura1
8 files changed, 15 insertions, 13 deletions
diff --git a/.scripts/batinfo b/.scripts/batinfo
index 92b95c1..87676ac 100755
--- a/.scripts/batinfo
+++ b/.scripts/batinfo
@@ -1,8 +1,8 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
set -e
-status=$(acpi -abi) # get battery and adapter info
+status="$(acpi -abi)" # get battery and adapter info
case $BLOCK_BUTTON in
3) notify-send "Battery status" "$status" ;;
@@ -10,7 +10,7 @@ case $BLOCK_BUTTON in
5) brightnessctl -q s 10%- ;;
esac
-power=$(echo $status | awk '/Battery/{s+=$4}; END{printf "%.1f%%", s/NR}')
+power=$(echo "${status}" | awk '/Battery [0-9]+: [A-Z]/{s+=$4;c++}; END{printf "%.1f%%", s/c}')
icon='?'
if [[ -z $(echo $status | sed -n '/on-line/p') ]]; then
@@ -30,4 +30,4 @@ else
icon='\uf583'
fi
-echo -ne "$icon $power"
+echo -e "$icon $power"
diff --git a/.scripts/bt b/.scripts/bt
index 2e4203d..d4604f1 100755
--- a/.scripts/bt
+++ b/.scripts/bt
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
set -e
diff --git a/.scripts/checkupdates b/.scripts/checkupdates
index 380afd3..5a95974 100755
--- a/.scripts/checkupdates
+++ b/.scripts/checkupdates
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
set -e
updates=$(pacman -Qu | sed '/\[ignored\]$/d')
@@ -6,7 +6,7 @@ updates=$(pacman -Qu | sed '/\[ignored\]$/d')
case $BLOCK_BUTTON in
1) ;& # fallthrough
3) if [ -n "${updates}" ]; then
- notify-send "Available updates" "$updates"
+ notify-send -t $((1000 * 20)) "Available updates" "$updates"
else
notify-send "Available updates" "No available updates"
fi;;
diff --git a/.scripts/cpuinfo b/.scripts/cpuinfo
index 412e405..8db8456 100755
--- a/.scripts/cpuinfo
+++ b/.scripts/cpuinfo
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
set -e
# Load
diff --git a/.scripts/is_docker_running b/.scripts/is_docker_running
index 3e5eab5..0724a32 100755
--- a/.scripts/is_docker_running
+++ b/.scripts/is_docker_running
@@ -1,5 +1,5 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
-[ -n "$BLOCK_BUTTON" ] && notify-send 'Running containers' "$(docker ps --format '{{.Names}}')"
+[ ! -z "$BLOCK_BUTTON" ] && notify-send 'Running containers' "$(docker ps --format '{{.Names}}')" && exit
systemctl is-active docker >/dev/null && echo -e "\uf308$(docker ps -q | wc -l)"
diff --git a/.scripts/meminfo b/.scripts/meminfo
index ddb93f6..3df9b73 100755
--- a/.scripts/meminfo
+++ b/.scripts/meminfo
@@ -1,2 +1,3 @@
-#!/usr/bin/env bash
-free -h | awk '/Mem/{print "[" $3 " RAM " $2 "]" }' | tr -d '\n'
+#!/usr/bin/env sh
+set -e
+free -h | awk '/Mem/{print "[" $3 " RAM " $2 "]" }'
diff --git a/.scripts/netinfo b/.scripts/netinfo
index 92dd78c..48789da 100755
--- a/.scripts/netinfo
+++ b/.scripts/netinfo
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
netstatus="$(awk '{
n = split(FILENAME, a, "/")
diff --git a/.scripts/vimura b/.scripts/vimura
index da85bc9..21eaac0 100755
--- a/.scripts/vimura
+++ b/.scripts/vimura
@@ -2,3 +2,4 @@
echo ${1%.pdf}
zathura --fork -x "vim --servername ${1%.pdf} -c \"let g:syncpdf='${1%.pdf}'\" --remote +%{line} %{input}" $*
+#zathura --fork -x "vim --servername vim -c \"let g:syncpdf='${1:0:5}'\" --remote +%{line} %{input}" $1