summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2022-08-27 14:08:12 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2022-08-27 14:08:12 -0400
commit964b463e67fce19ecac9da278233ea4645f95fdd (patch)
treefbd00e47a68f2f56fd22c6934620d309206d2d07
parent4c4ebca3f57d29022fe51f2aa204ff017cdf70b1 (diff)
Add blocks for dwmtmp
-rwxr-xr-x.local/bin/dwmbar/dwmb-cider20
-rwxr-xr-x.local/bin/dwmbar/dwmb-mail4
-rwxr-xr-x.local/bin/dwmbar/dwmb-rss35
-rwxr-xr-x.local/bin/dwmbar/dwmb-todoist22
-rwxr-xr-x.local/bin/dwmbar/dwmb-torrents18
-rwxr-xr-x.local/bin/dwmbar/dwmb-volume22
-rwxr-xr-x.local/bin/dwmbar/dwmb-vpn14
l---------.sfeed/sfeedrc1
8 files changed, 127 insertions, 9 deletions
diff --git a/.local/bin/dwmbar/dwmb-cider b/.local/bin/dwmbar/dwmb-cider
new file mode 100755
index 0000000..ab9845e
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-cider
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+icon=" "
+
+# # Will minimize the block if nothing is in that file
+# expand=$(test -s $HOME/.cache/dwmb-cider-min && echo true || echo false)
+
+
+
+case "$(playerctl status)" in
+ Paused) echo "$icon" ;;
+ Playing) echo "$icon $(cat ~/.config/Cider/Plugins/gh_525515699/dist/title.txt )" ;;
+ *) echo "" ;;
+esac
+
+case $BUTTON in
+ 1) killall sfeed_curses || st -t rss -e sfeed_curses $HOME/.sfeed/feeds/* ;;
+ 3) playerctl play-pause;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
diff --git a/.local/bin/dwmbar/dwmb-mail b/.local/bin/dwmbar/dwmb-mail
index 9c7e4fa..d495f6b 100755
--- a/.local/bin/dwmbar/dwmb-mail
+++ b/.local/bin/dwmbar/dwmb-mail
@@ -15,6 +15,6 @@ 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=" "
+pidof mbsync >/dev/null 2>&1 && icon="  "
-[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "  $unread $icon"
+[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "  $unread$icon"
diff --git a/.local/bin/dwmbar/dwmb-rss b/.local/bin/dwmbar/dwmb-rss
new file mode 100755
index 0000000..07b993f
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-rss
@@ -0,0 +1,35 @@
+#!/bin/sh
+cd "$HOME/.sfeed" || exit 1
+
+LC_ALL=C awk -F '\t' '
+# URL file: amount of fields is 1.
+NF == 1 {
+ u[$1] = 1; # lookup table of URLs
+ next;
+}
+# feed file: check by URL or id.
+{
+ total++;
+ if (u[$3] || u[$6])
+ read++
+}
+END {
+ feedcount=(total - read - 1)
+ if (feedcount == 0)
+ print ""
+ else
+ print "  " (feedcount)
+ # print "Unread: " (total - read)
+ # print "Read: " read
+ # print "Total: " total
+}
+' urls feeds/*
+
+case $BUTTON in
+ 1) killall sfeed_curses || st -t rss -e sfeed_curses $HOME/.sfeed/feeds/* ;;
+ 3) notify-send -a " News" "Updating..." && \
+ sfeed_update && notify-send -a " News" "Done!" \
+ || notify-send -a " News" "Something happened..."
+ sleep 0.2 && kill -37 $(pidof dwmblocks) ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
diff --git a/.local/bin/dwmbar/dwmb-todoist b/.local/bin/dwmbar/dwmb-todoist
new file mode 100755
index 0000000..69a59a0
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-todoist
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+touch ~/.cache/todoist
+
+ping -c1 1.1.1.1 >/dev/null 2>&1 && curl -X GET \
+ https://api.todoist.com/rest/v1/tasks \
+ -H "Authorization: Bearer $(pass Todoist/API)" |\
+ jq ".[]|select(.completed == false)|select(.project_id == 2250555849)" |\
+ grep '"id"' | wc -l > ~/.cache/todoist
+
+num=$(cat ~/.cache/todoist)
+
+printf "  $num "
+
+case $BUTTON in
+ 1) dropdowntoggle todoist nvim +"Todoist" && \
+ kill -39 $(pidof dwmblocks) ;;
+ 2) notify-send -a " Todoist" "- Left click to open Todoist.Nvim
+ - Right click to open todoist in your web browser" ;;
+ 3) setsid $BROWSER "https://todoist.com/app/today" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
diff --git a/.local/bin/dwmbar/dwmb-torrents b/.local/bin/dwmbar/dwmb-torrents
new file mode 100755
index 0000000..11c0792
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-torrents
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+status="$(btcli list -aif "%t\n" )"
+
+starting="$( echo "$status" | grep -c "+" - )"
+stopping="$( echo "$status" | grep -c "-" - )"
+innactive="$(echo "$status" | grep -c "I" - )"
+seeding="$( echo "$status" | grep -c "S" - )"
+leeching="$( echo "$status" | grep -c "L" - )"
+
+# [ "$starting" == "0" ] || echo "Starting: $starting"
+# [ "$stopping" == "0" ] || echo "Stopping: $stopping"
+[ "$innactive" == "0" ] || echo "Innactive: $innactive"
+[ "$seeding" == "0" ] || seed=" $seeding"
+[ "$leeching" == "0" ] || down=" $leeching"
+
+echo "$down $seed"
+
diff --git a/.local/bin/dwmbar/dwmb-volume b/.local/bin/dwmbar/dwmb-volume
new file mode 100755
index 0000000..422c6e6
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-volume
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Low volume threshold (for the icon to change)
+low="50"
+
+# High volume icon
+icon=" "
+
+# Get the percentage
+vol="$(amixer sget Master | tail -n 1 | sed "s/.*\[\([0-9]*\)%\]/\1/")"
+
+# Change to low volume icon if below threshold
+[[ "$vol" -lt "$low" ]] && \
+icon=" "
+
+# Change to muted icon if necessary
+echo $vol | grep off &>/dev/null && icon=" "
+
+echo " $icon$(echo $vol | sed "s/\s\[.*//")%"
+
+#   
+
diff --git a/.local/bin/dwmbar/dwmb-vpn b/.local/bin/dwmbar/dwmb-vpn
index eb5e925..d134a37 100755
--- a/.local/bin/dwmbar/dwmb-vpn
+++ b/.local/bin/dwmbar/dwmb-vpn
@@ -4,13 +4,13 @@
vpnstatus="$(piactl get connectionstate)"
case "$vpnstatus" in
- Disconnected) icon=" " ;;
- Connecting) icon="  " ;;
- Connected) icon=" " ;;
- Interrupted) icon="  " ;;
- Reconnecting) icon="  " ;;
- DisconnectingToReconnect) icon="  ";;
- Disconnecting) icon="  " ;;
+ Disconnected) icon="" ;;
+ Connecting) icon=" " ;;
+ Connected) icon="" ;;
+ Interrupted) icon=" " ;;
+ Reconnecting) icon=" " ;;
+ DisconnectingToReconnect) icon=" ";;
+ Disconnecting) icon=" " ;;
esac
# case "$vpnstatus" in
diff --git a/.sfeed/sfeedrc b/.sfeed/sfeedrc
new file mode 120000
index 0000000..b07c0d3
--- /dev/null
+++ b/.sfeed/sfeedrc
@@ -0,0 +1 @@
+/home/master/Dropbox/sync/sfeedrc \ No newline at end of file