From 439b95a593c3517bb2acbc79faef44163ea495bd Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 1 May 2026 22:18:41 -0700 Subject: [PATCH] taffybar: tighten session and host handling --- dotfiles/config/taffybar/strixi-minaj.css | 6 ++++++ dotfiles/config/taffybar/taffybar | 2 +- dotfiles/config/taffybar/taffybar.hs | 14 +++++++++++--- nixos/taffybar.nix | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 dotfiles/config/taffybar/strixi-minaj.css diff --git a/dotfiles/config/taffybar/strixi-minaj.css b/dotfiles/config/taffybar/strixi-minaj.css new file mode 100644 index 00000000..0832fe33 --- /dev/null +++ b/dotfiles/config/taffybar/strixi-minaj.css @@ -0,0 +1,6 @@ +@import url("taffybar.css"); + +/* Host-specific density tweaks for strixi-minaj. */ +.taffy-box { + font-size: 10pt; +} diff --git a/dotfiles/config/taffybar/taffybar b/dotfiles/config/taffybar/taffybar index d985cabb..697ce422 160000 --- a/dotfiles/config/taffybar/taffybar +++ b/dotfiles/config/taffybar/taffybar @@ -1 +1 @@ -Subproject commit d985cabb6ce104c7c74df6da23454cf0a747f3ed +Subproject commit 697ce4220b76152b8a03a7078d736efb1a798197 diff --git a/dotfiles/config/taffybar/taffybar.hs b/dotfiles/config/taffybar/taffybar.hs index 31f5ae74..57b03ec6 100644 --- a/dotfiles/config/taffybar/taffybar.hs +++ b/dotfiles/config/taffybar/taffybar.hs @@ -265,7 +265,15 @@ defaultCssFiles = ["taffybar.css"] cssFilesByHostname :: [(String, [FilePath])] cssFilesByHostname = - [("ryzen-shine", ["ryzen-shine.css"])] + [ ("ryzen-shine", ["ryzen-shine.css"]), + ("strixi-minaj", ["strixi-minaj.css"]) + ] + +compactBarHosts :: [String] +compactBarHosts = + [ "ryzen-shine", + "strixi-minaj" + ] laptopHosts :: [String] laptopHosts = @@ -695,9 +703,9 @@ mkSimpleTaffyConfig hostName backend cssFiles = barLevels = Nothing, barPosition = Top, widgetSpacing = 0, - barPadding = if hostName == "ryzen-shine" then 2 else 4, + barPadding = if hostName `elem` compactBarHosts then 2 else 4, barHeight = - if hostName == "ryzen-shine" + if hostName `elem` compactBarHosts then ScreenRatio $ 1 / 40 else ScreenRatio $ 1 / 33, cssPaths = cssFiles diff --git a/nixos/taffybar.nix b/nixos/taffybar.nix index 0dda3880..f3fdada1 100644 --- a/nixos/taffybar.nix +++ b/nixos/taffybar.nix @@ -69,6 +69,21 @@ let taffybarExecCondition = pkgs.writeShellScript "taffybar-exec-condition" '' ${skipTaffybarInOtherShells} || exit 1 + runtime_dir="''${XDG_RUNTIME_DIR:-/run/user/$(${pkgs.coreutils}/bin/id -u)}" + if [ "''${XDG_SESSION_TYPE:-}" = "wayland" ] || [ -n "''${WAYLAND_DISPLAY:-}" ]; then + if [ -z "''${WAYLAND_DISPLAY:-}" ] || [ ! -S "$runtime_dir/$WAYLAND_DISPLAY" ]; then + exit 1 + fi + elif [ -n "''${DISPLAY:-}" ]; then + display_number="''${DISPLAY#:}" + display_number="''${display_number%%.*}" + if [ -z "$display_number" ] || [ ! -S "/tmp/.X11-unix/X$display_number" ]; then + exit 1 + fi + else + exit 1 + fi + if [ -x /run/current-system/sw/bin/desktop_shell_ui ]; then exec /run/current-system/sw/bin/desktop_shell_ui exec-condition taffybar fi @@ -91,6 +106,11 @@ makeEnable config "myModules.taffybar" false { services."status-notifier-watcher".package = pkgs.lib.mkForce inputs.imalison-taffybar.packages.${system}.status-notifier-item; + systemd.user.targets.tray.Unit = { + PartOf = [ "graphical-session.target" ]; + StopWhenUnneeded = true; + }; + # Disable kded6's statusnotifierwatcher module so it doesn't race with # the Haskell status-notifier-watcher for the org.kde.StatusNotifierWatcher bus name. xdg.configFile."kded6rc".text = ''