From 55542f1ce3f313419ebe6a7fa9a7629898e6ce2e Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Mon, 11 Mar 2024 22:16:24 +0530 Subject: dwm --- dist/dwm/bar.sh | 29 +++++++++++++++++++++++++++++ dist/dwm/power.sh | 12 ++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 dist/dwm/bar.sh create mode 100755 dist/dwm/power.sh (limited to 'dist/dwm') diff --git a/dist/dwm/bar.sh b/dist/dwm/bar.sh new file mode 100755 index 0000000..dbc76e5 --- /dev/null +++ b/dist/dwm/bar.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +battery() { + capacity="$(cat /sys/class/power_supply/BAT1/capacity)" + case "$(cat /sys/class/power_supply/BAT1/status)" in + Charging) printf " $capacity +";; + Discharging) printf " $capacity -";; + Full) printf " $capacity";; + esac +} + +wlan() { + case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in + up) echo "󰤨 $(iwgetid -r)";; + down) printf "󰤭 Disconnected";; + esac +} + +clock() { + printf "󱑆 $(date '+%H:%M')" +} + +user() { + printf "$(whoami)" +} + +while(true) do + xsetroot -name "| $(battery) | $(wlan) | $(clock) | $(user) " && sleep 2 +done diff --git a/dist/dwm/power.sh b/dist/dwm/power.sh new file mode 100755 index 0000000..318c7cf --- /dev/null +++ b/dist/dwm/power.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +chosen=$(printf " Power Off\n Restart\n Suspend\n Hibernate\n󰗼 Log Out\n Lock" | rofi -dmenu -i -p "Choice:") + +case "$chosen" in + " Power Off") poweroff ;; + " Restart") reboot ;; + " Suspend") systemctl suspend-then-hibernate ;; + " Hibernate") systemctl hibernate ;; + "󰗼 Log Out") killall dwm ;; + " Lock") betterlockscreen -l ;; + *) exit 1 ;; +esac -- cgit v1.2.3