summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2020-10-08 01:53:07 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2020-10-08 01:53:07 -0400
commite860d9a8f7ca586fa88ba2f0b1325377ebb14615 (patch)
tree22775fb8343e95ae56b26a8207b6a31c857ee419 /.local
parentc295d8331ff5193cb97b1e3f6b15836654b010cc (diff)
dwmblocks scripts
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/dbshare14
-rwxr-xr-x.local/bin/dwmbar-battery22
-rwxr-xr-x.local/bin/dwmbar/dwmb-bat29
-rwxr-xr-x.local/bin/dwmbar/dwmb-date (renamed from .local/bin/datetime)0
-rwxr-xr-x.local/bin/dwmbar/dwmb-dotfiles (renamed from .local/bin/yadms)2
-rwxr-xr-x.local/bin/dwmbar/dwmb-layout (renamed from .local/bin/kblayout)0
-rwxr-xr-x.local/bin/dwmbar/dwmb-news3
-rwxr-xr-x.local/bin/dwmbar/dwmb-test3
-rwxr-xr-x.local/bin/dwmbar/dwmb-vpn (renamed from .local/bin/vpnstatus)0
-rwxr-xr-x.local/bin/dwmbar/dwmbar (renamed from .local/bin/dwmbar)14
-rwxr-xr-x.local/bin/newsup5
11 files changed, 59 insertions, 33 deletions
diff --git a/.local/bin/dbshare b/.local/bin/dbshare
new file mode 100755
index 0000000..817fe8c
--- /dev/null
+++ b/.local/bin/dbshare
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+output="$(dropbox-cli sharelink $1)"
+
+case "$output" in
+ https*)
+ echo "$output" | xsel -b
+ notify-send -a " Dropbox" "Your file $1 can now be shared. It's url is:
+$output
+It has been copied to your clipboard." ;;
+ *)
+ notify-send -a " Dropbox" "ERROR:
+Your file could not be shared." ;;
+esac
diff --git a/.local/bin/dwmbar-battery b/.local/bin/dwmbar-battery
deleted file mode 100755
index bb2b76e..0000000
--- a/.local/bin/dwmbar-battery
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# Better battery manager for polybar
-
-# 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-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/datetime b/.local/bin/dwmbar/dwmb-date
index e2198bd..e2198bd 100755
--- a/.local/bin/datetime
+++ b/.local/bin/dwmbar/dwmb-date
diff --git a/.local/bin/yadms b/.local/bin/dwmbar/dwmb-dotfiles
index 56e8fce..9c9c34d 100755
--- a/.local/bin/yadms
+++ b/.local/bin/dwmbar/dwmb-dotfiles
@@ -12,4 +12,4 @@ fi
-echo "  $warn"
+echo " $warn"
diff --git a/.local/bin/kblayout b/.local/bin/dwmbar/dwmb-layout
index 3cd1132..3cd1132 100755
--- a/.local/bin/kblayout
+++ b/.local/bin/dwmbar/dwmb-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/vpnstatus b/.local/bin/dwmbar/dwmb-vpn
index 908aa76..908aa76 100755
--- a/.local/bin/vpnstatus
+++ b/.local/bin/dwmbar/dwmb-vpn
diff --git a/.local/bin/dwmbar b/.local/bin/dwmbar/dwmbar
index a322665..24657d2 100755
--- a/.local/bin/dwmbar
+++ b/.local/bin/dwmbar/dwmbar
@@ -6,17 +6,17 @@
# When given the echo option, echo to stdout instead
# of refreshing (useful for debugging)
-battery=$(battery)
-datetime=$(datetime)
+battery=$(dwmb-bat)
+datetime=$(dwmb-date)
# dropbox=$(dropbox-status)
-kblayout=$(kblayout)
+kblayout=$(dwmb-layout)
# mailbox=$(mailbox)
-news=$(news)
-vpnstatus=$(vpnstatus)
+news=$(dwmb-news)
+vpnstatus=$(dwmb-vpn)
# wifi=$(wifi)
-yadms=$(yadms)
+dotfiles=$(dwmb-dotfiles)
-bar="$yadms|$news|$datetime|$kblayout|$vpnstatus|$battery |"
+bar="$dotfiles|$news|$datetime|$kblayout|$vpnstatus|$battery "
case "$1" in
echo) echo "$bar" ;;
diff --git a/.local/bin/newsup b/.local/bin/newsup
index 2f47b6f..7cef34c 100755
--- a/.local/bin/newsup
+++ b/.local/bin/newsup
@@ -8,8 +8,7 @@ ping -q -c 1 1.1.1.1 > /dev/null || exit
pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
-echo "" > /tmp/newsupdate && dwmbar
-pkill -RTMIN+6 i3blocks
+echo "   " > /tmp/newsupdate && kill -37 $(pidof dwmblocks)
/usr/bin/newsboat -x reload
rm -f /tmp/newsupdate
-/usr/bin/notify-send -t 1 -i "$HOME/.fonts/svg/rss.svg" -a RSS "RSS feed update complete." && dwmbar
+/usr/bin/notify-send -t 1 -a " RSS" "RSS feed update complete." && kill -37 $(pidof dwmblocks)