This allow theming for wob, but the patch has an issue: to get the
width of the screen we must wait until sway is started. It's not
the case when `.config/sxmo/profile` is sourced (in `sxmo_winit.sh`),
so `profile` is maybe not the best place.
3 solutions:
1. We keep this configuration into `profile`, as we did
with BEMENU_OPTS (BTW bemenu could also need info from sway
to fine tune its options). This is less flexible for the
user but more simple.
2. We advise to use the start hook, as I did in the patch
3. We create a new hook that is sourced in sxmo_hook_start.sh
before we start the daemons. This removes the need to
override hook_start for a bunch of env vars
---
configs/default_hooks/sxmo_hook_start.sh | 4 ++++
scripts/core/sxmo_wob.sh | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/configs/default_hooks/sxmo_hook_start.sh b/configs/default_hooks/sxmo_hook_start.sh
index 5270284..7b93c54 100644
--- a/configs/default_hooks/sxmo_hook_start.sh
+++ b/configs/default_hooks/sxmo_hook_start.sh
@@ -15,6 +15,10 @@ echo "unlock" > "$SXMO_STATE"
case "$SXMO_WM" in
sway)
+ # This env var requires sxmo to be started, hence we can't set
+ # it in profile
+ # useable_width="$(swaymsg -t get_outputs -r | jq '.[] | select(.focused == true) | .rect.width')"
+ # export WOB_ARGS='-W "$((useable_width - 60))" -a top -a left -a right --border-color "#DBCBA2AA" --background-color "#000000AA" --bar-color "#DBCBA2AA" -b 1 -M 10'
sxmo_daemons.sh start desktop_notifier mako
sxmo_daemons.sh start wob sxmo_wob.sh
sxmo_daemons.sh start menu_mode_toggler sxmo_menumode_toggler.sh
diff --git a/scripts/core/sxmo_wob.sh b/scripts/core/sxmo_wob.sh
index ae2911f..632a873 100644
--- a/scripts/core/sxmo_wob.sh
+++ b/scripts/core/sxmo_wob.sh
@@ -9,13 +9,15 @@
. "$(which sxmo_common.sh)"
useable_width="$(swaymsg -t get_outputs -r | jq '.[] | select(.focused == true) | .rect.width')"
+default_args="-W $((useable_width - 60)) -a top -a left -a right -M 10"
+WOB_ARGS="${WOB_ARGS:-$default_args}"
wob_sock="$XDG_RUNTIME_DIR"/sxmo.wobsock
rm -f "$wob_sock"
mkfifo "$wob_sock"
# By opening the socket as read-write it isn't closed after the first write
# see https://unix.stackexchange.com/questions/392697
-wob -W "$((useable_width - 60))" -a top -a left -a right -M 10 <> "$wob_sock" &
+eval "wob $WOB_ARGS" <> "$wob_sock" &
WOBPID=$!
finish() {
--
2.35.1