From 9ebf91e892cbafbf03d09f3adca652db181d1587 Mon Sep 17 00:00:00 2001
From: Benjamin Chausse <benjamin@chausse.xyz>
Date: Mon, 5 Aug 2024 19:30:47 -0400
Subject: Wayland migration (first of many)

---
 .local/bin/colorbars            | 48 ++++++++++++-----------------------------
 .local/bin/dropdowntoggle       |  4 ++++
 .local/bin/dwmbar/dwmb-battery  |  2 +-
 .local/bin/dwmbar/dwmb-date     |  5 ++++-
 .local/bin/dwmbar/dwmb-dotfiles |  2 +-
 .local/bin/dwmbar/dwmb-eselect  | 12 ++++++-----
 .local/bin/dwmbar/dwmb-mail     |  6 +++---
 .local/bin/dwmbar/dwmb-time     |  5 ++++-
 .local/bin/makewall             | 13 ++++++++---
 9 files changed, 48 insertions(+), 49 deletions(-)

(limited to '.local/bin')

diff --git a/.local/bin/colorbars b/.local/bin/colorbars
index e8e0b9d..459e707 100755
--- a/.local/bin/colorbars
+++ b/.local/bin/colorbars
@@ -1,35 +1,15 @@
 #!/bin/sh
-echo
-
-# mini smpte color bars
-for y in $(seq 0 6); do
-  printf %s '      '
-  for color in 7 3 6 2 5 1 4; do
-    tput setab ${color}
-    printf %s '    '
-  done
-  tput sgr0
-  echo
-done
-
-for y in 0 1; do
-  printf %s '      '
-  for color in 4 0 5 0 6 0 7; do
-    tput setab ${color}
-    printf %s '    '
-  done
-  tput sgr0
-  echo
-done
-
-for y in $(seq 0 2); do
-  printf %s '      '
-  for color in 4 4 4 4 4 7 7 7 7 7 5 5 5 5 5 0 0 0 0 0 0 0 0 0 0 0 0 0; do
-    tput setab ${color}
-    printf %s ' '
-  done
-  tput sgr0
-  echo
-done
-
-echo
+printf '
+                                  
+                                  
+                                  
+                                  
+                                  
+                                  
+                                  
+                                  
+                                  
+                                  
+                                  
+                                  
+'
diff --git a/.local/bin/dropdowntoggle b/.local/bin/dropdowntoggle
index 91e834e..11f5521 100755
--- a/.local/bin/dropdowntoggle
+++ b/.local/bin/dropdowntoggle
@@ -22,6 +22,10 @@ case "$TERMINAL" in
 	titleflag="--title"
 	cmdflag="--command"
 	;;
+ *foot)
+	classflag="-a"
+	titleflag="-T"
+	cmdflag="-e"
 esac
 
 case "$active" in
diff --git a/.local/bin/dwmbar/dwmb-battery b/.local/bin/dwmbar/dwmb-battery
index 38673ef..c888fd8 100755
--- a/.local/bin/dwmbar/dwmb-battery
+++ b/.local/bin/dwmbar/dwmb-battery
@@ -44,4 +44,4 @@ esac
 	[8-9][0-9] | 100) icon=" " ;;
 	esac
 
-printf " %s%s%%" "$icon" "$capacity"
+printf '{ "text": "%s%s%%", "class":"block"}\n' "$icon" "$capacity"
diff --git a/.local/bin/dwmbar/dwmb-date b/.local/bin/dwmbar/dwmb-date
index cd598b1..ece4e5f 100755
--- a/.local/bin/dwmbar/dwmb-date
+++ b/.local/bin/dwmbar/dwmb-date
@@ -1,3 +1,6 @@
 #!/bin/sh
 
-date +"  %a %b %d"
+text=$(date +" %a %b %d")
+
+printf '{ "text": "%s", "class": "block" }\n' "$text"
+
diff --git a/.local/bin/dwmbar/dwmb-dotfiles b/.local/bin/dwmbar/dwmb-dotfiles
index 8485120..7d43cce 100755
--- a/.local/bin/dwmbar/dwmb-dotfiles
+++ b/.local/bin/dwmbar/dwmb-dotfiles
@@ -22,4 +22,4 @@ status=$(yadm status --porcelain 2>/dev/null)
 
 [ -z "$status" ] && exit 0
 
-printf "  "
+printf '{"text": "", "class":"block"}\n'
diff --git a/.local/bin/dwmbar/dwmb-eselect b/.local/bin/dwmbar/dwmb-eselect
index 24372b4..1a51bd2 100755
--- a/.local/bin/dwmbar/dwmb-eselect
+++ b/.local/bin/dwmbar/dwmb-eselect
@@ -1,11 +1,13 @@
 #!/bin/sh
 
-icon="  "
+icon=""
 
 total="$(eselect news count all)"
 unread="$(eselect news count new)"
 
-case "$total" in
-0) echo "" ;;
-*) echo "$icon $unread/$total " ;;
-esac
+# case "$total" in
+# 0) echo "" ;;
+# *) printf '{"text":"%s %s/%s", "class":"block" }' "$icon" "$unread" "$total" ;;
+# esac
+#
+printf '{"text":"%s %s/%s", "class":"block" }' "$icon" "$unread" "$total"
diff --git a/.local/bin/dwmbar/dwmb-mail b/.local/bin/dwmbar/dwmb-mail
index 4170c61..92324c6 100755
--- a/.local/bin/dwmbar/dwmb-mail
+++ b/.local/bin/dwmbar/dwmb-mail
@@ -5,6 +5,6 @@
 
 unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/*/new/* -type f | wc -l 2>/dev/null)"
 
-pidof mbsync >/dev/null 2>&1 && icon=" "
-
-[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "  $unread$icon "
+# [ "$unread" = "0" ] && [ "$icon" = "" ] || echo " $unread"
+#
+[ "$unread" = "0" ] && [ "$icon" = "" ] || printf '{"text":" %s", "class":"block"}\n' "$unread"
diff --git a/.local/bin/dwmbar/dwmb-time b/.local/bin/dwmbar/dwmb-time
index bbd6585..15046a3 100755
--- a/.local/bin/dwmbar/dwmb-time
+++ b/.local/bin/dwmbar/dwmb-time
@@ -1,3 +1,6 @@
 #!/bin/sh
 
-date +"  %H:%M "
+text="$(date +" %H:%M")"
+
+printf '{ "text": "%s", "class": "block" }\n' "$text"
+
diff --git a/.local/bin/makewall b/.local/bin/makewall
index ad8fc02..9edd3c2 100755
--- a/.local/bin/makewall
+++ b/.local/bin/makewall
@@ -1,9 +1,14 @@
 #!/bin/sh
 
+# NOTE: (for wayland migration)
+# wlr-randr --json | jq -r '.[] | select(.enabled) | .name'
+
 wallDir="$XDG_CONFIG_HOME/wallpapers"
 
 # Acquire the list of connected displays
-displays=$(xrandr | grep " connected" | sed 's/^\([a-Z,0-9,-]*\).*/\1/')
+# displays=$(xrandr | grep " connected" | sed 's/^\([a-Z,0-9,-]*\).*/\1/')
+displays="$(wlr-randr --json | jq -r '.[] | select(.enabled) | .name')"
+echo "$displays"
 
 # If there is a wallpaper with a filename matching the display
 # name, set it as the wallpaper for that display.
@@ -14,16 +19,18 @@ setDisplay() {
 	case $(ls $wallDir) in
 	*"$1"*)
 		wall=$(ls $wallDir | grep "$1" | head -n 1)
-		xwallpaper --output $1 --zoom $wallDir/$wall
+		# xwallpaper --output $1 --zoom $wallDir/$wall
 		;;
 	*)
 		wall=$(ls $wallDir | grep "default" | head -n 1)
-		xwallpaper --output $1 --zoom $wallDir/$wall
+		# xwallpaper --output $1 --zoom $wallDir/$wall
 		;;
 	esac
+  swaybg --output $1 -m fill --image $wallDir/$wall &
 }
 
 # Set the wallpaper for each display
+killall swaybg > /dev/null 2>&1
 for display in $displays; do
 	setDisplay $display
 done
-- 
cgit v1.2.3