From adcb6518d48ab41b26aeba77b3d0147d24dc287d Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Thu, 25 Jan 2024 00:16:30 -0500 Subject: Remove BLOCK_BUTTONS from dwmblocks --- .local/bin/dwmbar/dwmb-date | 5 ----- .local/bin/dwmbar/dwmb-dotfiles | 38 +++++++++++++++++++++++++------------- .local/bin/dwmbar/dwmb-mail | 10 ---------- .local/bin/dwmbar/dwmb-time | 4 +--- .local/bin/dwmbar/dwmb-vpn | 24 ------------------------ 5 files changed, 26 insertions(+), 55 deletions(-) (limited to '.local/bin/dwmbar') diff --git a/.local/bin/dwmbar/dwmb-date b/.local/bin/dwmbar/dwmb-date index 4caf8b4..cd598b1 100755 --- a/.local/bin/dwmbar/dwmb-date +++ b/.local/bin/dwmbar/dwmb-date @@ -1,8 +1,3 @@ #!/bin/sh date +"  %a %b %d" - -case $BLOCK_BUTTON in -1) notify-send -a " Calendar" "$(cal | tail -n +2)" ;; -6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac diff --git a/.local/bin/dwmbar/dwmb-dotfiles b/.local/bin/dwmbar/dwmb-dotfiles index aca2727..1138929 100755 --- a/.local/bin/dwmbar/dwmb-dotfiles +++ b/.local/bin/dwmbar/dwmb-dotfiles @@ -1,20 +1,32 @@ #!/bin/bash -dotfiles=$(yadm status | sed '1,3d; - 5,$d; - s/.$//g') +# Other icons that could be used: +# Git:                     +# Config:   -if [[ ${dotfiles:0:1} == "n" ]]; then - warn="" -else - warn=" " -fi +# Dotfiles tracker for dwmblocks (using yadm) +# This block aims to never show up (to be out of sight, out of mind) +# If the following situation occurs, the following icons will be shown: +# +# -  : There are uncommitted changes +# -  : There are staged changes +# -  : Unpushed changes +# -  : Upstream has changes that are not pulled +# +# These icons will sit next the this block's base icon +# +# Only one icon will be shown at a time, and the order of priority is: +# uncommitted > staged > unpushed > upstream +status=$(yadm status --porcelain 2>/dev/null) +[ -z "$status" ] && exit 0 -echo " $warn " -case $BLOCK_BUTTON in - 1) $TERMINAL -c dropdown -e yadm diff ;; - 3) $TERMINAL -c dropdown -e dfup ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +case "$status" in +*M*) icon=" " ;; +*A*) icon=" " ;; +*U*) icon=" " ;; +*D*) icon=" " ;; esac + +printf " %s" "$icon" diff --git a/.local/bin/dwmbar/dwmb-mail b/.local/bin/dwmbar/dwmb-mail index 1d78528..faa01e6 100755 --- a/.local/bin/dwmbar/dwmb-mail +++ b/.local/bin/dwmbar/dwmb-mail @@ -3,16 +3,6 @@ # Displays number of unread mail and an loading icon if updating. # When clicked, brings up `neomutt`. -case $BLOCK_BUTTON in -1) setsid -f "$TERMINAL" -e neomutt && mw -Y ;; -2) setsid -f mw -Y ;; -3) notify-send " Mail module" "\- Shows unread mail -- Shows  if syncing mail -- Left click opens neomutt -- Middle click syncs mail" ;; -6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/*/new/* -type f | wc -l 2>/dev/null)" pidof mbsync >/dev/null 2>&1 && icon=" " diff --git a/.local/bin/dwmbar/dwmb-time b/.local/bin/dwmbar/dwmb-time index 4fb102b..fc17227 100755 --- a/.local/bin/dwmbar/dwmb-time +++ b/.local/bin/dwmbar/dwmb-time @@ -1,6 +1,4 @@ #!/bin/sh date +"  %H:%M " -case $BLOCK_BUTTON in - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac \ No newline at end of file + diff --git a/.local/bin/dwmbar/dwmb-vpn b/.local/bin/dwmbar/dwmb-vpn index 4ce86f9..d049f60 100755 --- a/.local/bin/dwmbar/dwmb-vpn +++ b/.local/bin/dwmbar/dwmb-vpn @@ -13,28 +13,4 @@ DisconnectingToReconnect) icon="  " ;; Disconnecting) icon="  " ;; esac -# case "$vpnstatus" in -# *"Not"*) icon="" -# ;; -# *"Connected"*) icon="" -# ;; -# *"Connecting"*) icon=" " -# ;; -# *) icon="" -# esac - echo " $icon" - -# \033]01;31\] # pink -# \033]00m\] # white -# \033]01;36\] # bold green -# \033]02;36\] # green -# \033]01;34\] # blue -# \033]01;33\] # bold yellow -# s/onnected\sto\s//; -case $BLOCK_BUTTON in -1) piactl connect && notify-send -a "VPN" "Connected" && kill -36 "$(pidof dwmblocks)" ;; -2) vpnmenu ;; -3) piactl disconnect && notify-send -a "VPN" "Disonnected" && kill -36 "$(pidof dwmblocks)" ;; -6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac -- cgit v1.2.3