From e860d9a8f7ca586fa88ba2f0b1325377ebb14615 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Thu, 8 Oct 2020 01:53:07 -0400 Subject: dwmblocks scripts --- .local/bin/dwmbar | 26 -------------------------- .local/bin/dwmbar/dwmb-bat | 29 +++++++++++++++++++++++++++++ .local/bin/dwmbar/dwmb-date | 3 +++ .local/bin/dwmbar/dwmb-dotfiles | 15 +++++++++++++++ .local/bin/dwmbar/dwmb-layout | 3 +++ .local/bin/dwmbar/dwmb-news | 3 +++ .local/bin/dwmbar/dwmb-test | 3 +++ .local/bin/dwmbar/dwmb-vpn | 25 +++++++++++++++++++++++++ .local/bin/dwmbar/dwmbar | 26 ++++++++++++++++++++++++++ 9 files changed, 107 insertions(+), 26 deletions(-) delete mode 100755 .local/bin/dwmbar create mode 100755 .local/bin/dwmbar/dwmb-bat create mode 100755 .local/bin/dwmbar/dwmb-date create mode 100755 .local/bin/dwmbar/dwmb-dotfiles create mode 100755 .local/bin/dwmbar/dwmb-layout create mode 100755 .local/bin/dwmbar/dwmb-news create mode 100755 .local/bin/dwmbar/dwmb-test create mode 100755 .local/bin/dwmbar/dwmb-vpn create mode 100755 .local/bin/dwmbar/dwmbar (limited to '.local/bin/dwmbar') diff --git a/.local/bin/dwmbar b/.local/bin/dwmbar deleted file mode 100755 index a322665..0000000 --- a/.local/bin/dwmbar +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# Refreshes the dwm bar using the scripts in: -# $SCRIPTS/dwm/ - -# When given the echo option, echo to stdout instead -# of refreshing (useful for debugging) - -battery=$(battery) -datetime=$(datetime) -# dropbox=$(dropbox-status) -kblayout=$(kblayout) -# mailbox=$(mailbox) -news=$(news) -vpnstatus=$(vpnstatus) -# wifi=$(wifi) -yadms=$(yadms) - -bar="$yadms|$news|$datetime|$kblayout|$vpnstatus|$battery |" - -case "$1" in - echo) echo "$bar" ;; - *) xsetroot -name "$bar" ;; -esac - - diff --git a/.local/bin/dwmbar/dwmb-bat b/.local/bin/dwmbar/dwmb-bat new file mode 100755 index 0000000..4cc14ec --- /dev/null +++ b/.local/bin/dwmbar/dwmb-bat @@ -0,0 +1,29 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send hey ;; + 2) setsid -f "$TERMINAL" -e calcurse ;; + 3) notify-send " Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` +- Middle click opens calcurse if installed" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# Charging:  # +# Discharching:  # +# Full: underscore:  # +# LOW BATTERY:  # + +batstatus=$(acpi | tail -n 1) + +ico="" + +# Change the underscore color according to the charging state +case "$batstatus" in + *Charging*) ico=" ";; + *Discharging*) ico="  " ;; + *) ico="  " ;; +esac + +percentage=$( echo "$batstatus" | sed "s/.*\(\ [0-9]*\)\%.*$/\1/; s/\ //g; 1q") + +echo "$ico$percentage% " diff --git a/.local/bin/dwmbar/dwmb-date b/.local/bin/dwmbar/dwmb-date new file mode 100755 index 0000000..e2198bd --- /dev/null +++ b/.local/bin/dwmbar/dwmb-date @@ -0,0 +1,3 @@ +#!/bin/sh + +date +"  %a %b %d |  %H:%M " diff --git a/.local/bin/dwmbar/dwmb-dotfiles b/.local/bin/dwmbar/dwmb-dotfiles new file mode 100755 index 0000000..9c9c34d --- /dev/null +++ b/.local/bin/dwmbar/dwmb-dotfiles @@ -0,0 +1,15 @@ +#!/bin/bash + +dotfiles=$(yadm status | sed '1,3d; + 5,$d; + s/.$//g') + +if [[ ${dotfiles:0:1} == "n" ]]; then + warn="" +else + warn="  " +fi + + + +echo " $warn" diff --git a/.local/bin/dwmbar/dwmb-layout b/.local/bin/dwmbar/dwmb-layout new file mode 100755 index 0000000..3cd1132 --- /dev/null +++ b/.local/bin/dwmbar/dwmb-layout @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "  $(cat $HOME/.cache/layout) " diff --git a/.local/bin/dwmbar/dwmb-news b/.local/bin/dwmbar/dwmb-news new file mode 100755 index 0000000..45ec966 --- /dev/null +++ b/.local/bin/dwmbar/dwmb-news @@ -0,0 +1,3 @@ +#!/bin/sh + + cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "  " $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null) " diff --git a/.local/bin/dwmbar/dwmb-test b/.local/bin/dwmbar/dwmb-test new file mode 100755 index 0000000..f69b76b --- /dev/null +++ b/.local/bin/dwmbar/dwmb-test @@ -0,0 +1,3 @@ +#!/bin/sh + +cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 diff --git a/.local/bin/dwmbar/dwmb-vpn b/.local/bin/dwmbar/dwmb-vpn new file mode 100755 index 0000000..908aa76 --- /dev/null +++ b/.local/bin/dwmbar/dwmb-vpn @@ -0,0 +1,25 @@ +#!/bin/bash +# Outputs if Express VPN is connected or not + +vpnstatus=$(expressvpn status | head -n 1) + +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//; diff --git a/.local/bin/dwmbar/dwmbar b/.local/bin/dwmbar/dwmbar new file mode 100755 index 0000000..24657d2 --- /dev/null +++ b/.local/bin/dwmbar/dwmbar @@ -0,0 +1,26 @@ +#!/bin/sh + +# Refreshes the dwm bar using the scripts in: +# $SCRIPTS/dwm/ + +# When given the echo option, echo to stdout instead +# of refreshing (useful for debugging) + +battery=$(dwmb-bat) +datetime=$(dwmb-date) +# dropbox=$(dropbox-status) +kblayout=$(dwmb-layout) +# mailbox=$(mailbox) +news=$(dwmb-news) +vpnstatus=$(dwmb-vpn) +# wifi=$(wifi) +dotfiles=$(dwmb-dotfiles) + +bar="$dotfiles|$news|$datetime|$kblayout|$vpnstatus|$battery " + +case "$1" in + echo) echo "$bar" ;; + *) xsetroot -name "$bar" ;; +esac + + -- cgit v1.2.3