From b59ac5e0ebb069074a227cea7e527367a7449570 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Tue, 2 Jun 2020 14:18:57 +0200 Subject: [PATCH] dwmblocks/statusbar: starting to add clickable buttons LukeSmith made a guide on how to set this up. I did it analog to him. - clock shows the calendar - internet shows nmtui --- .local/bin/tools/statusbar/battery | 3 --- .local/bin/tools/statusbar/clock | 6 ++++-- .local/bin/tools/statusbar/cpu | 2 -- .local/bin/tools/statusbar/disk | 5 +---- .local/bin/tools/statusbar/internet | 6 ++++-- .local/bin/tools/statusbar/memory | 2 -- .local/bin/tools/statusbar/volume | 2 -- 7 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.local/bin/tools/statusbar/battery b/.local/bin/tools/statusbar/battery index 94af092..ad7295f 100755 --- a/.local/bin/tools/statusbar/battery +++ b/.local/bin/tools/statusbar/battery @@ -1,8 +1,5 @@ #!/usr/bin/env sh -# Give a battery name (e.g. BAT0) as an argument. -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice - capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit time=$(acpi | awk '{ print $5 }') status=$(cat /sys/class/power_supply/"$1"/status) diff --git a/.local/bin/tools/statusbar/clock b/.local/bin/tools/statusbar/clock index 846ffaa..3e85d26 100755 --- a/.local/bin/tools/statusbar/clock +++ b/.local/bin/tools/statusbar/clock @@ -1,5 +1,7 @@ #!/bin/sh -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice - date +" %d %b %H:%M" + +case $BLOCK_BUTTON in + 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" ;; +esac diff --git a/.local/bin/tools/statusbar/cpu b/.local/bin/tools/statusbar/cpu index 3268e86..fd6bde4 100755 --- a/.local/bin/tools/statusbar/cpu +++ b/.local/bin/tools/statusbar/cpu @@ -1,5 +1,3 @@ #!/bin/sh -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice - sensors | awk '/Core 0/ {print " " $3}' diff --git a/.local/bin/tools/statusbar/disk b/.local/bin/tools/statusbar/disk index 43dec94..af07058 100755 --- a/.local/bin/tools/statusbar/disk +++ b/.local/bin/tools/statusbar/disk @@ -2,13 +2,10 @@ # Status bar module for disk space # $1 should be drive mountpoint -# $2 is optional icon, otherwise mountpoint will displayed -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice disk="/" [ ! -z "$1" ] && disk="$1" -icon="$2" -[ -z "$2" ] && icon="$disk" +icon="$disk" printf " %s %s\n" "$icon" "$(df -h "$disk" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.local/bin/tools/statusbar/internet b/.local/bin/tools/statusbar/internet index fa811d0..eb0d410 100755 --- a/.local/bin/tools/statusbar/internet +++ b/.local/bin/tools/statusbar/internet @@ -1,9 +1,11 @@ #!/usr/bin/env sh -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice - [ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="" [ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70) "%" }') printf "%s %s\n" "$(cat /sys/class/net/e*/operstate | sed "s/down//;s/up//")" "$wifiicon" + +case $BLOCK_BUTTON in + 1) $TERMINAL -e "nmtui" ;; +esac diff --git a/.local/bin/tools/statusbar/memory b/.local/bin/tools/statusbar/memory index 49240f4..c1f98aa 100755 --- a/.local/bin/tools/statusbar/memory +++ b/.local/bin/tools/statusbar/memory @@ -1,5 +1,3 @@ #!/bin/sh -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice - free -h | awk '/^Mem:/ {print " " $3 "/" $2}' diff --git a/.local/bin/tools/statusbar/volume b/.local/bin/tools/statusbar/volume index a72987f..7e07875 100755 --- a/.local/bin/tools/statusbar/volume +++ b/.local/bin/tools/statusbar/volume @@ -1,7 +1,5 @@ #!/bin/sh -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice - [ "$(pulsemixer --get-mute)" = "1" ] && printf "\\n" && exit vol=$(pulsemixer --get-volume | awk '{print $1}')