cleanup FHT config

This commit is contained in:
Henry Hiles 2026-10-20 20:10:27 -04:00
commit 364297eb86
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -8,31 +8,37 @@
let let
filename = "fht-compositor.toml"; filename = "fht-compositor.toml";
swaync = pkgs.swaynotificationcenter; session-programs = pkgs.writeShellApplication {
swaync-config = (pkgs.formats.json { }).generate "swaync.json" ( name = "session-programs";
let runtimeInputs = with pkgs; [
default = lib.importJSON "${swaync}/etc/xdg/swaync/config.json"; procps
in util-linux
default ];
// lib.genAttrs (map (side: "control-center-margin-${side}") [ text = ''
"top" restart() {
"bottom" pattern=$1
"right" shift
]) (_: 8) pkill -f "$pattern" || true
// { for _ in $(seq 50); do
notification-window-width = 420; pgrep -f "$pattern" >/dev/null || break
ignore-gtk-theme = false; sleep 0.1
fit-to-screen = false; done
control-center-height = -1; setsid "$@" >/dev/null 2>&1 </dev/null &
widget-config = default.widget-config // {
notifications = default.widget-config.notifications or { } // {
vexpand = false;
};
};
} }
);
swaync-style = pkgs.writeText "swaync.css" '' restart '/bin/elephant$' systemd-cat -t elephant ${lib.getExe pkgs.elephant}
@import url("file://${swaync}/etc/xdg/swaync/style.css"); restart 'walker.* --gapplication-service' walker --gapplication-service
restart 'gaypanel-wrapped_' systemd-cat -t gaypanel gaypanel
restart 'bin/swaybg ' ${lib.getExe pkgs.swaybg} -i ${../../../background.jpg} -m fill
restart 'bin/swayosd-server ' ${lib.getExe' pkgs.swayosd "swayosd-server"} --style ${pkgs.writeText "swayosd.css" ''
@import url("file://${pkgs.swayosd}/etc/xdg/swayosd/style.css");
window#osd {
background: shade(@theme_bg_color, 1.15);
}
''}
restart 'bin/swaync ' ${lib.getExe' pkgs.swaynotificationcenter "swaync"} --style ${pkgs.writeText "swaync.css" ''
@import url("file://${pkgs.swaynotificationcenter}/etc/xdg/swaync/style.css");
:root { :root {
--noti-bg-focus: transparent; --noti-bg-focus: transparent;
@ -76,48 +82,36 @@ let
.notification-row .notification-background .notification .notification-default-action .notification-content .text-box .body { .notification-row .notification-background .notification .notification-default-action .notification-content .text-box .body {
opacity: 0.8; opacity: 0.8;
} }
''; ''} --config ${
(pkgs.formats.json { }).generate "swaync.json" (
osd-style = pkgs.writeText "swayosd.css" '' let
@import url("file://${pkgs.swayosd}/etc/xdg/swayosd/style.css"); default = lib.importJSON "${pkgs.swaynotificationcenter}/etc/xdg/swaync/config.json";
in
window#osd { default
background: shade(@theme_bg_color, 1.15); // lib.genAttrs (map (side: "control-center-margin-${side}") [
"top"
"bottom"
"right"
]) (_: 8)
// {
notification-window-width = 420;
ignore-gtk-theme = false;
fit-to-screen = false;
control-center-height = -1;
widget-config = default.widget-config // {
notifications = default.widget-config.notifications or { } // {
vexpand = false;
};
};
} }
''; )
session-programs = pkgs.writeShellApplication {
name = "session-programs";
runtimeInputs = with pkgs; [
procps
util-linux
];
text = ''
restart() {
pattern=$1
shift
pkill -f "$pattern" || true
for _ in $(seq 50); do
pgrep -f "$pattern" >/dev/null || break
sleep 0.1
done
setsid "$@" >/dev/null 2>&1 </dev/null &
} }
restart '/bin/elephant$' systemd-cat -t elephant ${lib.getExe pkgs.elephant}
restart 'walker.* --gapplication-service' walker --gapplication-service
restart 'gaypanel-wrapped_' systemd-cat -t gaypanel gaypanel
restart 'bin/swaybg ' ${lib.getExe pkgs.swaybg} -i ${../../../background.jpg} -m fill
restart 'bin/swayosd-server ' ${lib.getExe' pkgs.swayosd "swayosd-server"} --style ${osd-style}
restart 'bin/swaync ' ${lib.getExe' swaync "swaync"} --style ${swaync-style} --config ${swaync-config}
''; '';
}; };
in in
{ {
imports = [ inputs.fht-compositor.nixosModules.default ]; imports = [ inputs.fht-compositor.nixosModules.default ];
environment.systemPackages = [ session-programs ];
# Prefer the GNOME portal (e.g. Nautilus as the file picker), falling back to GTK. This replaces # Prefer the GNOME portal (e.g. Nautilus as the file picker), falling back to GTK. This replaces
# the portal config fht-compositor ships. # the portal config fht-compositor ships.
xdg.portal.config.fht-compositor = { xdg.portal.config.fht-compositor = {
@ -133,13 +127,20 @@ in
"org.freedesktop.impl.portal.ScreenCast" = [ "fht-compositor" ]; "org.freedesktop.impl.portal.ScreenCast" = [ "fht-compositor" ];
}; };
environment = {
systemPackages = [ session-programs ];
etc = {
"xdg/walker/config.toml".source = (pkgs.formats.toml { }).generate "walker.toml" {
# Take keyboard focus when opened, so you can type into the search straight away # Take keyboard focus when opened, so you can type into the search straight away
environment.etc."xdg/walker/config.toml".source = (pkgs.formats.toml { }).generate "walker.toml" {
force_keyboard_focus = true; force_keyboard_focus = true;
theme = "system"; theme = "system";
}; };
environment.etc = { # The default theme, minus its hardcoded @define-color palette, so the GTK theme's colors show through
"xdg/walker/themes/system/style.css".source = pkgs.runCommand "walker-system-style.css" { } ''
sed '/^@define-color/d' ${pkgs.walker.src}/resources/themes/default/style.css > $out
'';
# Only load the providers Walker uses # Only load the providers Walker uses
"xdg/elephant/elephant.toml".source = (pkgs.formats.toml { }).generate "elephant.toml" { "xdg/elephant/elephant.toml".source = (pkgs.formats.toml { }).generate "elephant.toml" {
terminal_cmd = "ptyxis -x"; terminal_cmd = "ptyxis -x";
@ -169,7 +170,7 @@ in
]; ];
}; };
# Use the same search engines as LibreWolf, with its aliases as prefixes (e.g. "no nix") # Use the same search engines as LibreWolf, with its aliases as prefixes (e.g. "@no nix")
"xdg/elephant/websearch.toml".source = "xdg/elephant/websearch.toml".source =
let let
inherit (config.programs.firefox.policies) SearchEngines; inherit (config.programs.firefox.policies) SearchEngines;
@ -185,16 +186,9 @@ in
// lib.optionalAttrs (engine ? Alias) { prefix = "${engine.Alias} "; } // lib.optionalAttrs (engine ? Alias) { prefix = "${engine.Alias} "; }
) SearchEngines.Add; ) SearchEngines.Add;
}; };
};
# The default theme, minus its hardcoded @define-color palette, so the GTK theme's colors show through # FHT config
environment.etc."xdg/walker/themes/system/style.css".source = ${filename}.source = (pkgs.formats.toml { }).generate "config.toml" {
pkgs.runCommand "walker-system-style.css" { }
''
sed '/^@define-color/d' ${pkgs.walker.src}/resources/themes/default/style.css > $out
'';
environment.etc.${filename}.source = (pkgs.formats.toml { }).generate "config.toml" {
autostart = [ "session-programs" ]; autostart = [ "session-programs" ];
general = { general = {
@ -309,6 +303,7 @@ in
direction = "left"; direction = "left";
min-swipe-distance = 1; min-swipe-distance = 1;
}; };
focus-previous-workspace = { focus-previous-workspace = {
fingers = 3; fingers = 3;
direction = "right"; direction = "right";
@ -333,6 +328,8 @@ in
size = 24; size = 24;
}; };
}; };
};
};
programs.fht-compositor = { programs.fht-compositor = {
enable = true; enable = true;