taffybar: tighten session and host handling

This commit is contained in:
2026-05-01 22:18:41 -07:00
parent 0750934622
commit 439b95a593
4 changed files with 38 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
@import url("taffybar.css");
/* Host-specific density tweaks for strixi-minaj. */
.taffy-box {
font-size: 10pt;
}

View File

@@ -265,7 +265,15 @@ defaultCssFiles = ["taffybar.css"]
cssFilesByHostname :: [(String, [FilePath])] cssFilesByHostname :: [(String, [FilePath])]
cssFilesByHostname = 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 :: [String]
laptopHosts = laptopHosts =
@@ -695,9 +703,9 @@ mkSimpleTaffyConfig hostName backend cssFiles =
barLevels = Nothing, barLevels = Nothing,
barPosition = Top, barPosition = Top,
widgetSpacing = 0, widgetSpacing = 0,
barPadding = if hostName == "ryzen-shine" then 2 else 4, barPadding = if hostName `elem` compactBarHosts then 2 else 4,
barHeight = barHeight =
if hostName == "ryzen-shine" if hostName `elem` compactBarHosts
then ScreenRatio $ 1 / 40 then ScreenRatio $ 1 / 40
else ScreenRatio $ 1 / 33, else ScreenRatio $ 1 / 33,
cssPaths = cssFiles cssPaths = cssFiles

View File

@@ -69,6 +69,21 @@ let
taffybarExecCondition = pkgs.writeShellScript "taffybar-exec-condition" '' taffybarExecCondition = pkgs.writeShellScript "taffybar-exec-condition" ''
${skipTaffybarInOtherShells} || exit 1 ${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 if [ -x /run/current-system/sw/bin/desktop_shell_ui ]; then
exec /run/current-system/sw/bin/desktop_shell_ui exec-condition taffybar exec /run/current-system/sw/bin/desktop_shell_ui exec-condition taffybar
fi fi
@@ -91,6 +106,11 @@ makeEnable config "myModules.taffybar" false {
services."status-notifier-watcher".package = pkgs.lib.mkForce services."status-notifier-watcher".package = pkgs.lib.mkForce
inputs.imalison-taffybar.packages.${system}.status-notifier-item; 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 # Disable kded6's statusnotifierwatcher module so it doesn't race with
# the Haskell status-notifier-watcher for the org.kde.StatusNotifierWatcher bus name. # the Haskell status-notifier-watcher for the org.kde.StatusNotifierWatcher bus name.
xdg.configFile."kded6rc".text = '' xdg.configFile."kded6rc".text = ''