aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-03-11 12:30:27 +0100
committerDavid Runge <dave@sleepmap.de>2016-03-11 12:30:27 +0100
commit1339b8e7b05d70e2e5aefb5d4898d46039870767 (patch)
tree97694009c889d75fdd794236fa4c14d5cb32da71 /bin
parentb7be00a2818fdc2c5b47a318a67c95bde3fda7f1 (diff)
parent4fddd5572d8ae4ddb8f56278c2945b10ed3ce3cb (diff)
downloaddotfiles-1339b8e7b05d70e2e5aefb5d4898d46039870767.tar.gz
dotfiles-1339b8e7b05d70e2e5aefb5d4898d46039870767.tar.bz2
dotfiles-1339b8e7b05d70e2e5aefb5d4898d46039870767.tar.xz
dotfiles-1339b8e7b05d70e2e5aefb5d4898d46039870767.zip
Merge branch 'master' of sleepmap.de:dotfiles
* 'master' of sleepmap.de:dotfiles: .gitignore: Adding further processing, arduino, qtpass, weather configs and cache folders to ignore list. .config/SuperCollider/sc_ide_conf.yaml: Post 3.7 settings .config/psd/.psd.conf: Removing backup from the index .config/conky/side: Changing to execpi for dig launch. Reversing the hostname check. .tmux.conf: Adding own scripts to status-right, removing tpm. bin/get_*: Adding helper scripts to be used in tmux. .processing/language.txt: Adding default language setting. .arduino/preferences.txt: updating sketch stuff .mutt/*: Updating footer. .config/gtk-3.0/settings.ini: Removing dark-theme settings, as they make fields in browsers unusable. Thx gnome!
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get_battery_status27
-rwxr-xr-xbin/get_cpu_status10
-rwxr-xr-xbin/get_load8
-rwxr-xr-xbin/sclang8
4 files changed, 49 insertions, 4 deletions
diff --git a/bin/get_battery_status b/bin/get_battery_status
new file mode 100755
index 0000000..5ad18ce
--- /dev/null
+++ b/bin/get_battery_status
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+set -euo pipefail
+IFS=$'\n\t'
+
+acpi_output=""
+battery_number=0
+battery_percentage=0
+battery_remaining=""
+
+if [ -x /usr/bin/acpi ]; then
+ acpi_output=$(/usr/bin/acpi -b)
+ battery_number=$(echo $acpi_output|cut -d':' -f1|cut -d' ' -f2)
+ battery_state=$(echo $acpi_output|cut -d' ' -f3)
+ battery_state=${battery_state%","}
+ battery_percentage=$(echo $acpi_output|cut -d' ' -f4)
+ battery_percentage=${battery_percentage%","}
+ battery_percentage=${battery_percentage%"%"}
+ if [ $battery_state = "Discharging" ]; then
+ battery_remaining=$(echo $acpi_output|cut -d' ' -f5)
+ echo "$battery_percentage% ($battery_remaining)"
+ else
+ echo "$battery_percentage%"
+ fi
+else
+ exit 1
+fi
+
diff --git a/bin/get_cpu_status b/bin/get_cpu_status
new file mode 100755
index 0000000..2aece18
--- /dev/null
+++ b/bin/get_cpu_status
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -euo pipefail
+IFS=$'\n\t'
+
+proc_output=""
+
+proc_output=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {printf("%5.1f", usage)}')
+proc_output=${proc_output#" "}
+
+echo "$proc_output%"
diff --git a/bin/get_load b/bin/get_load
new file mode 100755
index 0000000..7991d26
--- /dev/null
+++ b/bin/get_load
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -euo pipefail
+IFS=$'\n\t'
+
+uptime_output=$(uptime| cut -d',' -f4,5,6|cut -d':' -f2)
+uptime_output=${uptime_output#" "}
+
+echo "$uptime_output"
diff --git a/bin/sclang b/bin/sclang
index a34f4ea..937ce94 100755
--- a/bin/sclang
+++ b/bin/sclang
@@ -1,10 +1,10 @@
#!/bin/sh
# If not running my laptop (with X screen), run sclang in a xvfb environment.
# This ensures getting around a bug with QPixmaps that needs a X server to run.
-if [[ $HOSTNAME == *dvzrv* ]]; then
- echo "/usr/bin/sclang"
- /usr/bin/sclang "$@"
-else
+if [[ $HOSTNAME == *pitheunlord* ]]; then
echo "/usr/bin/sclang in fake X screen"
/usr/bin/xvfb-run -s "-screen 1, 1280x800x24" -a -e ~/.log/xvfb-run-sclang.error /usr/bin/sclang "$@"
+else
+ echo "/usr/bin/sclang"
+ /usr/bin/sclang "$@"
fi