Separate WM dependencies via systemd

This commit is contained in:
js0ny 2025-12-03 00:24:15 +00:00
parent 47d967bfc9
commit a343383c49
18 changed files with 124 additions and 95 deletions

View file

@ -125,7 +125,8 @@ in {
prismlauncher
obsidian
file-roller
siyuan
steamtinkerlaunch
scanmem
]
++ (mkFcitxIM [
pkgs.neovim-qt

View file

@ -28,10 +28,10 @@
krunner = {
position = "center";
};
workspace = {
iconTheme = "${config.my.desktop.style.iconTheme.dark}";
colorScheme = "BreezeDark";
};
# workspace = {
# iconTheme = "${config.my.desktop.style.iconTheme.dark}";
# colorScheme = "BreezeDark";
# };
kwin = {
virtualDesktops.number = 8;
titlebarButtons = {
@ -139,18 +139,4 @@
};
inputMode = "vi";
};
programs.konsole = {
enable = true;
defaultProfile = "Default";
profiles = {
Default = {
command = "${pkgs.fish}/bin/fish";
colorScheme = "catppuccin-mocha";
font = {
name = "Maple Mono NF CN";
size = 12;
};
};
};
};
}

View file

@ -0,0 +1,12 @@
{lib, ...}: {
services.dunst.enable = true;
systemd.user.services.dunst = {
Install.WantedBy = lib.mkForce ["niri.service"];
Service = {
# Disable on KDE
ExecCondition = lib.mkForce ''
/bin/sh -c '[ "$XDG_CURRENT_DESKTOP" != "KDE" ] && [ "$XDG_CURRENT_DESKTOP" != "Plasma" ]'
'';
};
};
}

View file

@ -21,11 +21,7 @@
ecosystem = {
no_update_news = true;
};
# exec-once = [
# "waybar"
# "dunst"
# "${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"
# ];
exec-once = ["systemctl --user start waylandwm-session.target"];
general = {
gaps_in = 2;
gaps_out = 2;

View file

@ -4,6 +4,7 @@
in {
services.kanshi = {
enable = true;
systemdTarget = "niri.service";
settings = [
# Outputs
{

View file

@ -22,10 +22,7 @@
};
spawn-at-startup = [
{argv = ["fcitx5"];}
{argv = ["swww-daemon"];}
# polkit/portal helpers
# {argv = ["${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"];}
{argv = ["systemctl" " --user" "start" "waylandwm-session.target"];}
];
input = {

View file

@ -1,4 +1,8 @@
{pkgs, ...}: let
{
pkgs,
lib,
...
}: let
# swayidleWrapper = pkgs.writeShellScriptBin "swayidle-wrapper" ''
# ${pkgs.swayidle}/bin/swayidle -w \
# timeout 300 'swaylock -f' \
@ -42,6 +46,8 @@ in {
./hyprlock.nix
./swayidle.nix
./sunsetr.nix
./systemd.nix
./dunst.nix
];
home.packages = with pkgs; [
swayidle # Screensaver
@ -50,14 +56,15 @@ in {
brightnessctl
playerctl
powerprofiles-next
blueman
];
xdg.portal = {
enable = true;
extraPortals = with pkgs; [xdg-desktop-portal-wlr xdg-desktop-portal-gtk];
};
services.cliphist.enable = true;
services.dunst.enable = true;
# TODO: Allow launching components from all wayland-wm sessions
# services.cliphist.enable = true; # use elephant + walker
services.network-manager-applet.enable = true;
catppuccin.dunst.enable = false;
services.blueman-applet.enable = true;
services.blueman-applet.systemdTargets = ["niri.service"];
systemd.user.services.network-manager-applet.Install.WantedBy = lib.mkForce ["niri.service"];
}

View file

@ -2,7 +2,7 @@
systemd.user.services.hyprpolkitagent = {
Unit = {
Description = "Hyprland Polkit Authentication Agent";
PartOf = ["graphical-session.target"];
PartOf = ["waylandwm-session.target"];
After = ["graphical-session.target"];
};
@ -15,7 +15,7 @@
};
Install = {
WantedBy = ["graphical-session.target"];
WantedBy = ["waylandwm-session.target"];
};
};
}

View file

@ -1,8 +1,11 @@
{pkgs, ...}: {
# Expose CLI tool
home.packages = [pkgs.sunsetr];
systemd.user.services.sunsetr = {
Unit = {
Description = "Sunsetr blue-light filtering";
PartOf = ["graphical-session.target"];
PartOf = ["waylandwm-session.target"];
After = ["graphical-session.target"];
};
@ -15,7 +18,7 @@
};
Install = {
WantedBy = ["graphical-session.target"];
WantedBy = ["niri.service"];
};
};

View file

@ -1,6 +1,7 @@
{pkgs, ...}: {
services.swayidle = {
enable = true;
systemdTarget = "waylandwm-session.target";
timeouts = [
{
timeout = 300;

View file

@ -0,0 +1,13 @@
{lib, ...}: {
systemd.user.targets.waylandwm-session = {
Unit = {
Description = "Window Manager session, used to run services tied to the WM lifecycle";
Documentation = ["man:systemd.special(7)"];
BindsTo = ["niri.service"];
After = ["niri.service"];
PartOf = ["graphical-session.target"];
};
};
}

View file

@ -9,7 +9,7 @@
enable = true;
systemd = {
enable = true;
target = "graphical-session.target";
target = "niri.service";
};
style = ''
* {

View file

@ -18,6 +18,8 @@
};
};
imports = [./konsole.nix];
# Manually merge dolphin config to existing file
home.activation.mergeDolphinrc = lib.hm.dag.entryAfter ["writeBoundary"] ''
if [ -f ~/.config/dolphinrc-override ]; then

View file

@ -0,0 +1,22 @@
{
config,
lib,
...
}: {
# Dependency: plasma-manager
# Required by dolphin's terminal integration
programs.konsole = {
enable = true;
defaultProfile = "Default";
profiles = {
Default = {
command = lib.getExe config.my.desktop.preferredApps.interactiveShell;
colorScheme = "catppuccin-mocha";
font = {
name = "Maple Mono NF CN";
size = 12;
};
};
};
};
}

View file

@ -3,14 +3,20 @@
# * when `rga-fzf`: nvim wrapper failed to launch
# * nvim wrapper reports error on parsing filename with spaces
gvim = "neovide.desktop";
simpleText = [
"text/plain"
"text/x-csrc" # .c
"text/x-chdr" # .h
"text/javascript"
"text/x-python"
"application/yaml" # .yaml, .yml
];
simpleText =
[
"text/plain"
"text/x-csrc" # .c
"text/x-chdr" # .h
"text/javascript"
"text/x-python"
"application/yaml" # .yaml, .yml
"text/x-patch" # .patch .diff
]
++ [
"text/csv"
"text/markdown"
];
image = [
"image/jpeg"
"image/jpg"
@ -44,62 +50,40 @@
audioPlayers = "mpv.desktop;org.kde.elisa";
browsers = "firefox.desktop;chromium-browser.desktop";
archiveManager = "org.gnome.FileRoller.desktop;org.kde.ark.desktop;peazip.desktop";
mkAssoc = app: mimes:
builtins.listToAttrs (map (mime: {
name = mime;
value = app;
})
mimes);
in {
xdg.configFile."mimeapps.list".force = true;
xdg.mime.enable = true;
xdg.mimeApps = {
enable = true;
# In Dolphin, middle click to open with 2nd order default app
defaultApplications = {
# PDF
"application/pdf" = "org.kde.okular.desktop";
# Plain text
"text/plain" = gvim;
# Source Code - C
"text/x-csrc" = gvim; # .c
"text/x-chdr" = gvim; # .h
"text/javascript" = gvim;
"text/x-python" = gvim;
"application/yaml" = gvim; # .yaml, .yml
# CSV
"text/csv" = gvim;
"text/markdown" = gvim;
# File Explorer
"inode/directory" = "org.kde.dolphin.desktop";
"image/jpeg" = imageViewers;
"image/jpg" = imageViewers;
"image/png" = imageViewers;
"image/gif" = imageViewers;
"image/bmp" = imageViewers;
"image/avif" = imageViewers;
"image/webp" = imageViewers;
# Microsoft Office
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = "onlyoffice-desktopeditors.desktop";
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = "onlyoffice-desktopeditors.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.presentation" = "onlyoffice-desktopeditors.desktop";
defaultApplications =
mkAssoc "org.kde.okular.desktop" ["application/pdf"]
// mkAssoc gvim simpleText
// {
"inode/directory" = "org.kde.dolphin.desktop";
}
// mkAssoc imageViewers image
// mkAssoc "onlyoffice-desktopeditors.desktop" [
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
]
# Audio:
# music: elisa: fully featured, good cjk support
# audio: mpv: simple and fast
"audio/flac" = audioPlayers;
"audio/vnd.wave" = audioPlayers; # .wav
# Browser
"text/html" = browsers;
"x-scheme-handler/http" = browsers;
"x-scheme-handler/https" = browsers;
# URL Scheme
"x-scheme-handler/tg" = "org.telegram.desktop.desktop";
"x-scheme-handler/tonsite" = "org.telegram.desktop.desktop";
# Archives
"application/zip" = archiveManager;
"application/x-rar" = archiveManager;
"application/x-7z-compressed" = archiveManager;
"application/x-tar" = archiveManager;
"application/x-zstd-compressed-tar" = archiveManager; # .tar.zst
};
// mkAssoc audioPlayers audio
// mkAssoc browsers browser
// mkAssoc "org.telegram.desktop.desktop" [
"x-scheme-handler/tg"
"x-scheme-handler/tonsite"
]
// mkAssoc archiveManager archive;
};
home.sessionVariables.BROWSER = "firefox";
}

View file

@ -68,7 +68,7 @@
./programs/walker.nix
# Desktop Linux
./programs/desktop/wayland-wm/hyprland
./programs/desktop/plasma
./programs/desktop/wayland-wm/niri
../../modules/home/do-not-track.nix