From dc98cba24cb5f1f3e260c49fc61add4a113a1df0 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 19 Jun 2023 08:25:41 +0200 Subject: Update to status (now I use a statusbar) --- Makefile | 5 +---- brightness | 16 ---------------- notify-status | 7 ------- old/brightness | 16 ++++++++++++++++ old/notify-status | 7 +++++++ old/togglemute | 18 ++++++++++++++++++ old/volume | 13 +++++++++++++ status | 10 ++++++++-- togglemute | 18 ------------------ volume | 13 ------------- xroot-update | 8 ++++++++ 11 files changed, 71 insertions(+), 60 deletions(-) delete mode 100755 brightness delete mode 100755 notify-status create mode 100755 old/brightness create mode 100755 old/notify-status create mode 100755 old/togglemute create mode 100755 old/volume delete mode 100755 togglemute delete mode 100755 volume create mode 100755 xroot-update diff --git a/Makefile b/Makefile index d4c07a4..b4872ac 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ PREFIX = /usr/local SCRIPTS = addressgrep \ battery-checknow \ battery-status \ - brightness \ clip \ config-backup \ cth \ @@ -19,7 +18,6 @@ SCRIPTS = addressgrep \ ffmpeg-facecam \ mail-compose \ mergepdf \ - notify-status \ open-file \ open-stdin \ open-url \ @@ -35,17 +33,16 @@ SCRIPTS = addressgrep \ templess \ terminal \ theme \ - togglemute \ translate \ trash \ urlgrep \ virename \ - volume \ websearch \ xedit \ xedit-filter \ xplumb \ xprop-active-window-id \ + xroot-update \ xwallpaper-random-notify all: install diff --git a/brightness b/brightness deleted file mode 100755 index a7294fb..0000000 --- a/brightness +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# Increase / decrease brightness, and pops up a notification -# Requires: xbacklight, a notification program such as herbe or notify-send -# Usage: brightness {inc|dec} n - -# ksh completion -# set -A complete_brightness_1 inc dec -# set -A complete_brightness_2 5 - -#notify="notify-send" -notify="herbe" - -pkill herbe # comment this too if not using herbe - -xbacklight -$1 $2 && $notify "Brightness: $(xbacklight | sed 's/\..*$//')%" diff --git a/notify-status b/notify-status deleted file mode 100755 index 73a9435..0000000 --- a/notify-status +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Simple script to send a notification displaying the output of status - -# Requires: status, herbe (or similar, e.g. notify-send) - -herbe "$(status '\n\n')" diff --git a/old/brightness b/old/brightness new file mode 100755 index 0000000..a7294fb --- /dev/null +++ b/old/brightness @@ -0,0 +1,16 @@ +#!/bin/sh + +# Increase / decrease brightness, and pops up a notification +# Requires: xbacklight, a notification program such as herbe or notify-send +# Usage: brightness {inc|dec} n + +# ksh completion +# set -A complete_brightness_1 inc dec +# set -A complete_brightness_2 5 + +#notify="notify-send" +notify="herbe" + +pkill herbe # comment this too if not using herbe + +xbacklight -$1 $2 && $notify "Brightness: $(xbacklight | sed 's/\..*$//')%" diff --git a/old/notify-status b/old/notify-status new file mode 100755 index 0000000..73a9435 --- /dev/null +++ b/old/notify-status @@ -0,0 +1,7 @@ +#!/bin/sh + +# Simple script to send a notification displaying the output of status + +# Requires: status, herbe (or similar, e.g. notify-send) + +herbe "$(status '\n\n')" diff --git a/old/togglemute b/old/togglemute new file mode 100755 index 0000000..b799b02 --- /dev/null +++ b/old/togglemute @@ -0,0 +1,18 @@ +#!/bin/sh + +# Toggle mute state and notify +# Requires: pulsemixer, notify-send or similar + +#notify=notify-send +notify=herbe + +ismute=$(pulsemixer --toggle-mute --get-mute) + +if [ "$ismute" = "1" ]; then + m="muted" +else + m="unmuted" +fi + +pkill herbe # comment this line too if not using herbe +$notify "Audio $m" diff --git a/old/volume b/old/volume new file mode 100755 index 0000000..8dcd36a --- /dev/null +++ b/old/volume @@ -0,0 +1,13 @@ +#!/bin/sh + +# Change volume and notify +# Usage: volume {+n|-n} +# Requires: pulsemixer, notify-send or similar + +#notify=notify-send +notify=herbe + +newvol=$(pulsemixer --change-volume "$1" --get-volume | awk '{print $1}') + +pkill herbe # comment this line too if not using herbe +$notify "Volume" "$newvol%" diff --git a/status b/status index 7a2825f..10b43f9 100755 --- a/status +++ b/status @@ -10,9 +10,15 @@ sep=${1:-" | "} -time=$(date +"%H:%M:%S") +time=$(date +"%H:%M") date=$(date +"%d %B %Y, %A") +if [ "$(pulsemixer --get-mute)" -eq 1 ]; then + volume="Audio muted" +else + volume="Volume: $(pulsemixer --get-volume | awk '{print $1}')%%" +fi + bat="/sys/class/power_supply/BAT0" if [ -d $bat ]; then battery="Battery: $(cat $bat/capacity)%% $(cat $bat/status)" @@ -28,6 +34,6 @@ network="Network: $(nmcli device status | head -n 2 | tail -n 1 | sed 's/ *$//' events=$(sdep-list past | wc -l) -printf "$time$sep$date$sep$battery$sep$network" +printf "$network$sep$volume$sep$battery$sep$date$sep$time" [ "$events" != "0" ] && printf "$sep$events TODO task(s)" printf "\n" diff --git a/togglemute b/togglemute deleted file mode 100755 index b799b02..0000000 --- a/togglemute +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Toggle mute state and notify -# Requires: pulsemixer, notify-send or similar - -#notify=notify-send -notify=herbe - -ismute=$(pulsemixer --toggle-mute --get-mute) - -if [ "$ismute" = "1" ]; then - m="muted" -else - m="unmuted" -fi - -pkill herbe # comment this line too if not using herbe -$notify "Audio $m" diff --git a/volume b/volume deleted file mode 100755 index 8dcd36a..0000000 --- a/volume +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Change volume and notify -# Usage: volume {+n|-n} -# Requires: pulsemixer, notify-send or similar - -#notify=notify-send -notify=herbe - -newvol=$(pulsemixer --change-volume "$1" --get-volume | awk '{print $1}') - -pkill herbe # comment this line too if not using herbe -$notify "Volume" "$newvol%" diff --git a/xroot-update b/xroot-update new file mode 100755 index 0000000..44ab6c1 --- /dev/null +++ b/xroot-update @@ -0,0 +1,8 @@ +#!/bin/sh + +# Updates the xroot window with info from status +# Requires: status + +# Usage: xroot-update + +xsetroot -name " $(status) " -- cgit v1.3