{ perSystem, osConfig, config, pkgs, lib, ... }: let inherit (lib) mkIf mkEnableOption mkDefault mkForce getExe; inherit (osConfig.networking) hostId; inherit (config.lib.stylix) colors; cfg = config.desktop.niri; cursorSize = config.stylix.cursor.size; cursorName = config.stylix.cursor.name; keyboard = if hostId == "eldrid" then "chromeos" else "platform"; xdgPics = config.xdg.userDirs.pictures; ifLaptop = mkIf (hostId != "c7f6c4a1"); # TODO: make terminal depent on thing outside a module terminal = getExe pkgs.wezterm; launcher = getExe pkgs.fuzzel; browser = "app.zen_browser.zen"; lockscreen = getExe pkgs.gtklock; in { options = { desktop.jay.enable = mkEnableOption "enable jay desktop"; }; config = mkIf cfg.enable { stylix.targets = { waybar.enable = false; wpaperd.enable = true; qt.enable = false; }; services = { copyq.enable = true; network-manager-applet.enable = true; playerctld.enable = true; swayosd = { enable = true; topMargin = 0.8; }; wpaperd.enable = true; gnome-keyring = { enable = true; components = ["secrets"]; }; gammastep = { enable = true; provider = "manual"; latitude = 49.6; longitude = 36.1; tray = true; temperature = { day = 6500; night = 3000; }; }; udiskie = { enable = true; automount = false; notify = true; tray = "auto"; }; swaync = { enable = true; settings = { cssPriority = "user"; image-visibility = "when-available"; keyboard-shortcut = true; relative-timestamps = true; timeout = 5; timeout-low = 5; timeout-critical = 0; script-fail-notify = true; transition-time = 200; # Layer settings layer-shell = true; layer = "overlay"; control-center-layer = "overlay"; # Notification settings positionX = "right"; positionY = "top"; notification-2fa-action = true; notification-inline-replies = false; notification-icon-size = 32; notification-body-image-height = 100; notification-body-image-width = 200; notification-window-width = 400; # Control center settings control-center-positionX = "right"; control-center-positionY = "top"; control-center-width = 500; control-center-exclusive-zone = true; fit-to-screen = true; hide-on-action = true; hide-on-clear = false; # Widget settings widgets = [ "title" "dnd" "notifications" "mpris" ]; widget-config = { title = { text = "Notifications"; clear-all-button = true; button-text = "Clear All"; }; dnd = { text = "Do Not Disturb"; }; mpris = { image-size = 96; image-radius = 12; blur = true; }; }; }; style = '' /*** Global ***/ progress, progressbar, trough { border-radius: 16px; } .app-icon, .image { -gtk-icon-effect: none; } .notification-action { border-radius: 12px; margin: 0.5rem; } .close-button { margin: 24px; padding: 0.2rem; border-radius: 16px; } /*** Notifications ***/ .notification-group.collapsed .notification-row:not(:last-child) .notification-action, .notification-group.collapsed .notification-row:not(:last-child) .notification-default-action { opacity: 0; } .trough { margin: 4px; border-radius: 7px; } .notification, .notification.low, .notification.normal, .notification.critical, .control-center { margin: 16px; border-radius: 7px; } .floating-notifications, .notification-content { border-radius: 7px; } .control-center-list { background: transparent; } /*** Widgets ***/ /* Title widget */ .widget-title { margin: 0.5rem; } .widget-title > label { font-weight: bold; } .widget-title > button { border-radius: 16px; padding: 0.5rem; } /* DND Widget */ .widget-dnd { margin: 0.5rem; } .widget-dnd > label { font-weight: bold; } .widget-dnd > switch { border-radius: 16px; } .widget-dnd > switch slider { border-radius: 16px; padding: 0.25rem; } /* Mpris widget */ .widget-mpris .widget-mpris-player { border-radius: 16px; margin: 0.5rem; padding: 0.5rem; } .widget-mpris .widget-mpris-player .widget-mpris-album-art { border-radius: 16px; } .widget-mpris .widget-mpris-player .widget-mpris-title { font-weight: bold; } .widget-mpris .widget-mpris-player .widget-mpris-subtitle { font-weight: normal; } .widget-mpris .widget-mpris-player > box > button { border: 1px solid transparent; border-radius: 16px; padding: 0.25rem; } ''; }; }; programs.fuzzel = { enable = true; settings = { main = { terminal = terminal + " -e"; fields = "filename,name,generic,keywords,categories,exec"; dpi-aware = true; horizontal-pad = 12; vertical-pad = 12; show-actions = true; match-mode = "fuzzy"; icon-theme = config.dconf.settings."org/gnome/desktop/interface".icon-theme; }; border = mkDefault { width = 3; radius = 12; }; }; }; programs.i3status-rust = { enable = true; bars = { default = { theme = "plain"; blocks = [ { alert = 10.0; block = "disk_space"; info_type = "available"; interval = 60; path = "/"; warning = 20.0; } { block = "memory"; format = " $icon mem_used_percents "; format_alt = " $icon $swap_used_percents "; } { block = "cpu"; interval = 1; } { block = "load"; format = " $icon $1m "; interval = 1; } { block = "sound"; } { block = "time"; format = " $timestamp.datetime(f:'%a %d/%m %R') "; interval = 60; } ]; }; }; }; xdg.configFile.jay = { target = "jay/config.toml"; recursive = true; source = (pkgs.formats.toml {}).generate "jay-config" { keymap = '' xkb_keymap { xkb_keycodes { include "evdev+aliases(qwerty)" }; xkb_types { include "complete" }; xkb_compat { include "complete" }; xkb_symbols { include "pc+us+inet(evdev)" }; }; ''; on-graphics-initialized = [ { type = "exec"; exec = "${perSystem.self.wl-tray-bridge}/bin/wl-tray-bridge"; } ]; outputs = [ { match.connector = "eDP-1"; scale = 1.2; } { match.connector = "DP-2"; scale = 1.33; } ]; vrr = { mode = "always"; cursor-hz = 75; }; repeat-rate = { rate = 50; delay = 200; }; theme = { bg-color = "#${colors.base00}"; bar-bg-color = "#${colors.base00}"; border-color = "#${colors.base0D}"; separator-color = "#${colors.base01}"; bar-status-text-color = "#${colors.base05}"; focused-title-text-color = "#${colors.base07}"; focused-title-bg-color = "#${colors.base00}"; focused-inactive-title-text-color = "#${colors.base03}"; focused-inactive-title-bg-color = "#${colors.base00}"; unfocused-title-text-color = "#${colors.base03}"; unfocused-title-bg-color = "#${colors.base01}"; attention-requested-bg-color = "#${colors.base09}"; font = "${config.stylix.fonts.serif.name}"; border-width = 2; title-height = config.stylix.fonts.serif.size; }; status = { # format = "pango"; exec = ["${getExe pkgs.i3status-rs}" "config-default"]; }; window-management-key = "Super_L"; shortcuts = let left = "n"; down = "e"; up = "i"; right = "o"; in { "logo-${left}" = "focus-left"; "logo-${down}" = "focus-down"; "logo-${up}" = "focus-up"; "logo-${right}" = "focus-right"; "logo-shift-${left}" = "move-left"; "logo-shift-${down}" = "move-down"; "logo-shift-${up}" = "move-up"; "logo-shift-${right}" = "move-right"; logo-d = "split-horizontal"; logo-v = "split-vertical"; logo-t = "toggle-split"; logo-m = "toggle-mono"; logo-shift-m = "toggle-fullscreen"; logo-f = "focus-parent"; logo-q = "close"; logo-shift-f = "toggle-floating"; logo-Return = { type = "exec"; exec = "wezterm"; }; logo-space = { type = "exec"; exec = launcher; }; logo-shift-ctrl-q = "quit"; logo-shift-r = "reload-config-toml"; ctrl-alt-F1 = { type = "switch-to-vt"; num = 1; }; ctrl-alt-F2 = { type = "switch-to-vt"; num = 2; }; ctrl-alt-F3 = { type = "switch-to-vt"; num = 3; }; ctrl-alt-F4 = { type = "switch-to-vt"; num = 4; }; ctrl-alt-F5 = { type = "switch-to-vt"; num = 5; }; ctrl-alt-F6 = { type = "switch-to-vt"; num = 6; }; ctrl-alt-F7 = { type = "switch-to-vt"; num = 7; }; ctrl-alt-F8 = { type = "switch-to-vt"; num = 8; }; ctrl-alt-F9 = { type = "switch-to-vt"; num = 9; }; ctrl-alt-F10 = { type = "switch-to-vt"; num = 10; }; ctrl-alt-F11 = { type = "switch-to-vt"; num = 11; }; ctrl-alt-F12 = { type = "switch-to-vt"; num = 12; }; logo-1 = { type = "show-workspace"; name = "1"; }; logo-2 = { type = "show-workspace"; name = "2"; }; logo-3 = { type = "show-workspace"; name = "3"; }; logo-4 = { type = "show-workspace"; name = "4"; }; logo-5 = { type = "show-workspace"; name = "5"; }; logo-6 = { type = "show-workspace"; name = "6"; }; logo-7 = { type = "show-workspace"; name = "7"; }; logo-8 = { type = "show-workspace"; name = "8"; }; logo-9 = { type = "show-workspace"; name = "9"; }; logo-0 = { type = "show-workspace"; name = "10"; }; logo-shift-1 = { type = "move-to-workspace"; name = "1"; }; logo-shift-2 = { type = "move-to-workspace"; name = "2"; }; logo-shift-3 = { type = "move-to-workspace"; name = "3"; }; logo-shift-4 = { type = "move-to-workspace"; name = "4"; }; logo-shift-5 = { type = "move-to-workspace"; name = "5"; }; logo-shift-6 = { type = "move-to-workspace"; name = "6"; }; logo-shift-7 = { type = "move-to-workspace"; name = "7"; }; logo-shift-8 = { type = "move-to-workspace"; name = "8"; }; logo-shift-9 = { type = "move-to-workspace"; name = "9"; }; logo-shift-0 = { type = "move-to-workspace"; name = "10"; }; }; }; }; home.packages = with pkgs; [ jay (ifLaptop brightnessctl) nautilus helvum loupe papers junction celluloid mission-center dconf libnotify playerctl wdisplays pwvucontrol wl-clipboard-rs libqalculate ]; # gtk = { # enable = true; # iconTheme = { # name = # if config.stylix.polarity == "dark" # then "Papirus-Dark" # else "Papirus-Light"; # package = # if osConfig.module.stylix.theme == "nord" # then pkgs.papirus-nord # else pkgs.papirus-icon-theme; # }; # }; qt = { enable = true; platformTheme.name = "gtk3"; }; # dconf.settings = { # "org/gnome/desktop/interface" = { # icon-theme = config.gtk.iconTheme.name; # }; # }; xdg = { mime.enable = true; mimeApps = { enable = true; defaultApplications = let file_manager = ["org.gnome.Nautilus.desktop"]; image_viewer = ["org.gnome.Loupe.desktop"]; pdf_reader = ["org.gnome.Papers.desktop"]; video_player = ["io.github.celluloid_player.Celluloid.desktop"]; web_browser = ["re.sonny.Junction.desktop"]; in { "application/pdf" = pdf_reader; "image/jpeg" = image_viewer; "image/png" = image_viewer; "inode/directory" = file_manager; "text/html" = web_browser; "video/mp4" = video_player; "video/mpeg" = video_player; "video/x-matroska" = video_player; "video/x-mpeg" = video_player; "x-scheme-handler/about" = web_browser; "x-scheme-handler/http" = web_browser; "x-scheme-handler/https" = web_browser; "x-scheme-handler/unknown" = web_browser; }; }; }; systemd.user = { settings.Manager.DefaultEnvironment = { QT_QPA_PLATFORM = "wayland"; DISPLAY = ":123"; }; targets.tray.Unit.Description = "Home Manager System Tray"; # workaround for udiskie services = let mkGraphicalService = config: graphicalService // config; graphicalService = { Install.WantedBy = ["niri.service"]; Unit = { Requisite = ["graphical-session.target"]; PartOf = ["graphical-session.target"]; After = ["graphical-session.target"]; }; Service = { Restart = "on-failure"; TimeoutStopSec = 10; RestartSec = 1; }; }; in { udiskie = mkGraphicalService {}; waybar = mkGraphicalService {}; network-manager-applet = mkGraphicalService {}; copyq = mkGraphicalService { Service = graphicalService.Service // { Environment = mkForce "QT_QPA_PLATFORM=wayland"; }; }; xwayland-satellite = mkGraphicalService { Service = graphicalService.Service // { Type = "simple"; ExecStart = getExe pkgs.xwayland-satellite + " :123"; }; }; wpaperd = mkGraphicalService { Service = mkDefault graphicalService.Service; }; gnome-polkit-agent = mkGraphicalService { Service = graphicalService.Service // { Type = "simple"; ExecStart = pkgs.polkit_gnome + "/libexec/polkit-gnome-authentication-agent-1"; }; }; }; }; }; }