From ac22e07388a7942ec9d5577f642cb1848ac0846d Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 14 Dec 2023 10:33:27 +0000 Subject: [PATCH] sxmo: bring wob service in-house --- hosts/common/programs/default.nix | 1 + hosts/common/programs/wob.nix | 40 +++++++++++++++++++ hosts/modules/gui/sxmo/default.nix | 7 ++-- .../modules/gui/sxmo/hooks/sxmo_hook_start.sh | 2 +- 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 hosts/common/programs/wob.nix diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index 77e19b6b..d2a64871 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -80,6 +80,7 @@ ./wike.nix ./wine.nix ./wireshark.nix + ./wob.nix ./xarchiver.nix ./zeal.nix ./zsh diff --git a/hosts/common/programs/wob.nix b/hosts/common/programs/wob.nix new file mode 100644 index 00000000..b2aea43e --- /dev/null +++ b/hosts/common/programs/wob.nix @@ -0,0 +1,40 @@ +{ config, lib, ... }: +let + cfg = config.sane.programs.wob; +in +{ + sane.programs.wob = { + configOption = with lib; mkOption { + default = {}; + type = types.submodule { + options.autostart = mkOption { + type = types.bool; + default = true; + }; + options.sock = mkOption { + type = types.str; + default = "sxmo.wobsock"; + }; + }; + }; + + services.wob = { + description = "Wayland Overlay Bar (renders volume/backlight levels)"; + wantedBy = lib.mkIf cfg.config.autostart [ "default.target" ]; + serviceConfig = { + # ExecStart = "${cfg.package}/bin/wob"; + Type = "simple"; + Restart = "always"; + RestartSec = "20s"; + }; + script = '' + wobsock="$XDG_RUNTIME_DIR/${cfg.config.sock}" + rm -f "$wobsock" || true + mkfifo "$wobsock" && ${cfg.package}/bin/wob <> "$wobsock" + + # TODO: cleanup should be done in a systemd OnFailure, or OnExit, or whatever + rm -f "$wobsock" + ''; + }; + }; +} diff --git a/hosts/modules/gui/sxmo/default.nix b/hosts/modules/gui/sxmo/default.nix index 73478849..30a60201 100644 --- a/hosts/modules/gui/sxmo/default.nix +++ b/hosts/modules/gui/sxmo/default.nix @@ -265,9 +265,10 @@ in suggestedPrograms = [ "guiApps" "bemenu" # specifically to import its theming - "sfeed" # want this here so that the user's ~/.sfeed/sfeedrc gets created - # "superd" # make superctl (used by sxmo) be on PATH + "sfeed" # want this here so that the user's ~/.sfeed/sfeedrc gets created + # "superd" # make superctl (used by sxmo) be on PATH # "sway-autoscaler" + "wob" # volume/brightness on-screen display ]; persist.byStore.cryptClearOnBoot = [ @@ -645,7 +646,7 @@ in sxmo_networkmonitor = sxmoService "networkmonitor"; sxmo_notificationmonitor = sxmoService "notificationmonitor"; sxmo_soundmonitor = sxmoService "soundmonitor"; - sxmo_wob = sxmoService "wob"; + # sxmo_wob = sxmoService "wob"; sxmo-x11-status = sxmoService "status_xsetroot"; bonsaid.path = sxmoPath; diff --git a/hosts/modules/gui/sxmo/hooks/sxmo_hook_start.sh b/hosts/modules/gui/sxmo/hooks/sxmo_hook_start.sh index a660b9ac..7336abc9 100755 --- a/hosts/modules/gui/sxmo/hooks/sxmo_hook_start.sh +++ b/hosts/modules/gui/sxmo/hooks/sxmo_hook_start.sh @@ -18,7 +18,7 @@ sxmo_jobs.sh start daemon_manager # TODO: start these externally, via `wantedBy` in nix # don't: i don't use mako # superctl start mako -systemctl --user start sxmo_wob +# systemctl --user start sxmo_wob systemctl --user start sxmo_menumode_toggler systemctl --user start bonsaid # don't: sway background is managed externally