From ceaa91c43e11cd57d1c90f5a581d03ed8bef874d Mon Sep 17 00:00:00 2001 From: dx Date: Tue, 12 May 2020 22:06:42 +0100 Subject: +scripts to version control Stored in .local/scripts, scripts I use for my init. I will be adding my xinit shortly for a full experience. --- Scripts/.local/scripts/background | 3 ++ Scripts/.local/scripts/rdwm | 3 ++ Scripts/.local/scripts/reboot_services | 8 +++++ Scripts/.local/scripts/refresh_bar | 4 +++ Scripts/.local/scripts/set_bar | 64 ++++++++++++++++++++++++++++++++++ Scripts/.local/scripts/suctl | 3 ++ 6 files changed, 85 insertions(+) create mode 100755 Scripts/.local/scripts/background create mode 100755 Scripts/.local/scripts/rdwm create mode 100755 Scripts/.local/scripts/reboot_services create mode 100755 Scripts/.local/scripts/refresh_bar create mode 100755 Scripts/.local/scripts/set_bar create mode 100755 Scripts/.local/scripts/suctl (limited to 'Scripts') diff --git a/Scripts/.local/scripts/background b/Scripts/.local/scripts/background new file mode 100755 index 0000000..8a64d0f --- /dev/null +++ b/Scripts/.local/scripts/background @@ -0,0 +1,3 @@ +#!/bin/bash + +feh --bg-scale --randomize $HOME/Pictures/Backgrounds; diff --git a/Scripts/.local/scripts/rdwm b/Scripts/.local/scripts/rdwm new file mode 100755 index 0000000..131fbb9 --- /dev/null +++ b/Scripts/.local/scripts/rdwm @@ -0,0 +1,3 @@ +#!/bin/bash + +killall dwm; diff --git a/Scripts/.local/scripts/reboot_services b/Scripts/.local/scripts/reboot_services new file mode 100755 index 0000000..85f0c88 --- /dev/null +++ b/Scripts/.local/scripts/reboot_services @@ -0,0 +1,8 @@ +#!/bin/bash + +killall nm-applet; +killall blueman-applet; +killall sxhkd; +killall mpd; + +nm-applet & blueman-applet & refresh_bar & mpd & sxhkd; diff --git a/Scripts/.local/scripts/refresh_bar b/Scripts/.local/scripts/refresh_bar new file mode 100755 index 0000000..6491ecc --- /dev/null +++ b/Scripts/.local/scripts/refresh_bar @@ -0,0 +1,4 @@ +#!/bin/bash + +killall set_bar; +$HOME/.local/scripts/set_bar; diff --git a/Scripts/.local/scripts/set_bar b/Scripts/.local/scripts/set_bar new file mode 100755 index 0000000..5141bb9 --- /dev/null +++ b/Scripts/.local/scripts/set_bar @@ -0,0 +1,64 @@ +#!/bin/bash + +delimiter=' | ' + +timedate() { + echo $(date +'%a %F %R') +} + +battery() { + capacity=$(cat /sys/class/power_supply/BAT0/capacity) || break + status=$(cat /sys/class/power_supply/BAT0/status) + + if [[ $status == "Charging" ]] + then + status="" + else + if [[ $capacity -ge 75 ]] + then + status="" + elif [[ $capacity -ge 50 ]] + then + status="" + elif [[ $capacity -ge 25 ]] + then + status="" + elif [[ $capacity -ge 10 ]] + then + status="" + else + status="" + fi + fi + echo "$status $capacity%" +} + +volume() { + sinks="$(pactl list sinks)" + vol="$(echo "$sinks" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")" + + if [[ $vol -gt 50 ]] + then + icon="" + elif [[ $vol -gt 10 ]] + then + icon="" + else + icon="" + fi + + echo "$icon $vol%" +} + +ram() { + echo $(vmstat -s -a -S M | grep 'used memory' | grep -Po "\d+")M +} + +disk() { + echo $(df | grep /dev/sda2 | awk '{print $5}') +} + +while true; do + xsetroot -name "Meme level at $(disk) $delimiter $(ram) $delimiter $(volume) $delimiter $(battery) $delimiter $(timedate)" + sleep 30s; +done diff --git a/Scripts/.local/scripts/suctl b/Scripts/.local/scripts/suctl new file mode 100755 index 0000000..feb2a0f --- /dev/null +++ b/Scripts/.local/scripts/suctl @@ -0,0 +1,3 @@ +#!/bin/bash + +systemctl --user $@ -- cgit v1.2.3-13-gbd6f