This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 2configs / desktops / sway / noctalia.nix
3.0 kB 95 lines
1{ 2 pkgs, 3 config, 4 self, 5 ... 6}: 7let 8 # Patch noctalia-shell to use workspace name instead of number for sway 9 # Quickshell's activate() sends "workspace number <num>" which fails for named workspaces (num=-1) 10 noctalia-shell-patched = pkgs.noctalia-shell.overrideAttrs (old: { 11 postInstall = (old.postInstall or "") + '' 12 substituteInPlace $out/share/noctalia-shell/Services/Compositor/SwayService.qml \ 13 --replace-fail 'workspace.handle.activate();' \ 14 'Quickshell.execDetached([msgCommand, "workspace", workspace.name]);' 15 ''; 16 }); 17in 18{ 19 systemd.user.services.noctalia-shell = { 20 description = "Noctalia Shell - Wayland desktop shell"; 21 documentation = [ "https://docs.noctalia.dev" ]; 22 partOf = [ "sway-session.target" ]; 23 wantedBy = [ "sway-session.target" ]; 24 after = [ "sway-session.target" ]; 25 path = [ 26 pkgs.bash 27 pkgs.coreutils 28 pkgs.gnugrep 29 pkgs.gawk 30 pkgs.procps 31 pkgs.util-linux 32 pkgs.sway 33 pkgs.brightnessctl 34 pkgs.pulseaudio 35 pkgs.networkmanager 36 pkgs.wl-clipboard 37 ]; 38 serviceConfig = { 39 ExecStart = "${noctalia-shell-patched}/bin/noctalia-shell"; 40 Restart = "on-failure"; 41 }; 42 }; 43 44 environment.systemPackages = [ 45 noctalia-shell-patched 46 # ryzenadj and power-profile for power profile control 47 pkgs.ryzenadj 48 self.packages.${pkgs.system}.power-profile 49 ]; 50 51 # Idle inhibit service - toggled by bar button 52 systemd.user.services.sway-idle-inhibit = { 53 description = "Inhibit idle/sleep"; 54 serviceConfig = { 55 Type = "simple"; 56 ExecStart = "${pkgs.systemd}/bin/systemd-inhibit --what=idle:sleep --who=noctalia --why='User requested' --mode=block sleep infinity"; 57 }; 58 }; 59 60 # Allow user to run ryzenadj without password (for power profile switching) 61 security.sudo.extraRules = [ 62 { 63 users = [ config.users.users.mainUser.name ]; 64 commands = [ 65 { 66 command = "/run/current-system/sw/bin/ryzenadj"; 67 options = [ "NOPASSWD" ]; 68 } 69 ]; 70 } 71 ]; 72 73 # Make RAPL energy counters readable for power monitoring 74 services.udev.extraRules = '' 75 SUBSYSTEM=="powercap", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+r /sys/class/powercap/%k/energy_uj" 76 ''; 77 78 # Configure noctalia darkModeChange hook to trigger switch-theme 79 # This makes noctalia's dark mode button also switch the system theme 80 system.activationScripts.noctalia-hooks.text = 81 let 82 jq = "${pkgs.jq}/bin/jq"; 83 settingsFile = "/home/${config.users.users.mainUser.name}/.config/noctalia/settings.json"; 84 in 85 '' 86 if [ -f "${settingsFile}" ]; then 87 ${jq} ' 88 .hooks.enabled = true | 89 .hooks.darkModeChange = "if [ \"$1\" = \"true\" ]; then switch-theme dark; else switch-theme light; fi" 90 ' "${settingsFile}" > "${settingsFile}.tmp" && \ 91 mv "${settingsFile}.tmp" "${settingsFile}" && \ 92 chown ${config.users.users.mainUser.name}:users "${settingsFile}" || true 93 fi 94 ''; 95}