diff --git a/modules/home/desktop/niri/default.nix b/modules/home/desktop/niri/default.nix index c9bb819..c950c11 100644 --- a/modules/home/desktop/niri/default.nix +++ b/modules/home/desktop/niri/default.nix @@ -7,7 +7,7 @@ pkgs, ... }: let - inherit (lib) mkIf mkEnableOption mkDefault mkForce getExe; + inherit (lib) mkIf mkEnableOption mkForce getExe; inherit (osConfig.networking) hostName; cfg = config.desktop.niri; @@ -131,7 +131,7 @@ in { }; targets.tray.Unit.Description = "Home Manager System Tray"; # workaround for udiskie services = let - mkGraphicalService = config: graphicalService // config; + mkGraphicalService = config: lib.attrsets.recursiveUpdate graphicalService config; graphicalService = { Install.WantedBy = ["niri.service"]; Unit = { @@ -148,33 +148,25 @@ in { in lib.mkMerge [ { - udiskie = mkGraphicalService {}; - waybar = mkGraphicalService {}; + copyq = mkGraphicalService {Service.Environment = mkForce "QT_QPA_PLATFORM=wayland";}; 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; - }; + udiskie = mkGraphicalService {}; walker = mkGraphicalService {}; + waybar = mkGraphicalService {}; + wpaperd = + mkGraphicalService {} + // { + Service.TimeoutStopSec = mkForce "1"; + Service.Restart = mkForce "always"; + }; + xwayland-satellite = mkGraphicalService { + Service = { + Type = "simple"; + ExecStart = getExe pkgs.xwayland-satellite + " :123"; + }; + }; # gnome-polkit-agent = mkGraphicalService { - # Service = - # graphicalService.Service - # // { + # Service = { # Type = "simple"; # ExecStart = pkgs.polkit_gnome + "/libexec/polkit-gnome-authentication-agent-1"; # }; @@ -182,20 +174,18 @@ in { } (lib.mkIf (hostName == "morphius") { lisgd = mkGraphicalService { - Service = - graphicalService.Service - // { - # Group = "input"; - Type = "simple"; - ExecStart = - "${pkgs.lisgd}/bin/lisgd" - + " -d /dev/input/by-path/pci-0000:00:15.1-platform-i2c_designware.1-event" - + " -g \"1,DU,TL,*,P,niri msg action toggle-overview\"" - + " -g \"3,UD,T,*,P,niri msg action focus-workspace-up\"" - + " -g \"3,DU,B,*,P,niri msg action focus-workspace-down\"" - + " -g \"3,LR,L,*,P,niri msg action focus-column-left\"" - + " -g \"3,RL,R,*,P,niri msg action focus-column-right\""; - }; + Service = { + # Group = "input"; + Type = "simple"; + ExecStart = + "${pkgs.lisgd}/bin/lisgd" + + " -d /dev/input/by-path/pci-0000:00:15.1-platform-i2c_designware.1-event" + + " -g \"1,DU,TL,*,P,niri msg action toggle-overview\"" + + " -g \"3,UD,T,*,P,niri msg action focus-workspace-up\"" + + " -g \"3,DU,B,*,P,niri msg action focus-workspace-down\"" + + " -g \"3,LR,L,*,P,niri msg action focus-column-left\"" + + " -g \"3,RL,R,*,P,niri msg action focus-column-right\""; + }; }; }) ]; diff --git a/modules/home/desktop/niri/programs/waybar/default.nix b/modules/home/desktop/niri/programs/waybar/default.nix index 493159a..f3a51e6 100644 --- a/modules/home/desktop/niri/programs/waybar/default.nix +++ b/modules/home/desktop/niri/programs/waybar/default.nix @@ -6,44 +6,30 @@ launcher, ... }: let - inherit (lib) mkIf getExe; inherit (config.lib.stylix) colors; - inherit (osConfig.networking) hostName; - ifLaptop = mkIf (hostName != "dunamis"); + ifLaptop = lib.mkIf (osConfig.networking.hostName != "dunamis"); in { enable = true; systemd = { enable = true; target = "graphical-session.target"; }; - settings.bar-0 = { - # layer = "top"; + settings.bottom = { position = "bottom"; height = 33; spacing = 0; - # margin-left = 3; - # margin-right = 3; - margin-left = 36 + 3; - margin-right = 36 + 3; - margin-bottom = 3; + # margin-left = 36 + 3; + # margin-right = 36 + 3; + # margin-bottom = 3; modules-left = [ "custom/launcher" - "clock" "wlr/taskbar" - "privacy" - ]; - modules-center = [ - # "clock" - "niri/language" - "niri/workspaces" - "idle_inhibitor" + # "privacy" ]; modules-right = [ - "wireplumber" - (ifLaptop "group/laptop") - "tray" - "custom/notification" + "niri/workspaces" + "niri/language" ]; "niri/workspaces" = { format = "{index}"; @@ -61,7 +47,7 @@ in { "power-profiles-daemon" ]; }; - "backlight" = { + backlight = { format = "{percent}% {icon}"; format-icons = [ "󰃚" @@ -73,18 +59,18 @@ in { "󰃠" ]; }; - "idle_inhibitor" = { + idle_inhibitor = { format = "{icon}"; format-icons = { activated = "󰅶"; deactivated = "󰾪"; }; }; - "tray" = { + tray = { icon-size = 16; spacing = 6; }; - "clock" = { + clock = { interval = 1; format = "{:%R}"; tooltip = true; @@ -103,25 +89,29 @@ in { format-alt = "{icon} {time}"; format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; }; - mpris = { - format = "{player_icon} {dynamic}"; - format-paused = "{status_icon} {dynamic}"; - playing-len = 30; - playing-paused = 30; - player-icons = { - default = "▶"; - mpv = "🎵"; - }; - status-icons = {paused = "⏸";}; + memory = { + format = "{used:0.1f}G "; + tooltip-format = '' + RAM: {used:0.1f}G/{total:0.1f}G ({percentage}%) + Swap: {swapUsed:0.1f}G/{swapTotal:0.1f}G ({swapPercentage}%)''; }; - "upower" = { + network = { + format = "{bandwidthDownBits} 󰇚 | {bandwidthUpBits} 󰕒"; + interval = 3; + tooltip = false; + }; + cpu = { + format = "{usage}% 󰍛"; + interval = 3; + }; + upower = { icon-size = 16; format = "{percentage}"; hide-if-empty = true; tooltip = true; tooltip-spacing = 20; }; - "power-profiles-daemon" = { + power-profiles-daemon = { format = "{icon}"; tooltip-format = "Power profile: {profile}\nDriver: {driver}"; tooltip = true; @@ -132,12 +122,12 @@ in { power-saver = ""; }; }; - "wireplumber" = { + wireplumber = { scroll-step = 3; format = "{volume}% {icon}"; format-muted = "󰖁"; format-icons = ["󰕿" "󰖀" "󰕾"]; - on-click = getExe pkgs.pwvucontrol; + on-click = lib.getExe pkgs.pwvucontrol; on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle"; }; "custom/launcher" = { @@ -177,7 +167,172 @@ in { }; }; "wlr/taskbar" = { + format = "{icon} {name}"; + icon-size = 16; + icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}"; + tooltip-format = "{title}"; + on-click = "activate"; + }; + }; + settings.top = { + position = "top"; + height = 33; + spacing = 0; + # margin-left = 36 + 3; + # margin-right = 36 + 3; + # margin-top = 3; + modules-left = [ + "custom/notification" + "tray" + ]; + modules-center = ["clock"]; + modules-right = [ + "privacy" + "network" + "cpu" + "memory" + "wireplumber" + (ifLaptop "group/laptop") + # "tray" + "idle_inhibitor" + ]; + "niri/workspaces" = { + format = "{index}"; + }; + "niri/language" = { + format = "{}"; + format-en = "🇺🇸"; + format-uk = "🇺🇦"; + }; + "group/laptop" = { + orientation = "inherit"; + modules = [ + "backlight" + "battery" + "power-profiles-daemon" + ]; + }; + backlight = { + format = "{percent}% {icon}"; + format-icons = [ + "󰃚" + "󰃛" + "󰃜" + "󰃝" + "󰃞" + "󰃟" + "󰃠" + ]; + }; + idle_inhibitor = { format = "{icon}"; + format-icons = { + activated = "󰅶"; + deactivated = "󰾪"; + }; + }; + tray = { + icon-size = 16; + spacing = 6; + }; + clock = { + interval = 1; + format = "{:%R}"; + tooltip = true; + tooltip-format = "{:%B %d, %A}"; + }; + battery = { + states = { + good = 95; + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-full = "{capacity}% 󱟢"; + format-charging = "{capacity}% 󰂄"; + format-plugged = "{capacity}% 󰚥"; + format-alt = "{icon} {time}"; + format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; + }; + memory = { + format = "{used:0.1f}G "; + tooltip-format = '' + RAM: {used:0.1f}G/{total:0.1f}G ({percentage}%) + Swap: {swapUsed:0.1f}G/{swapTotal:0.1f}G ({swapPercentage}%)''; + }; + network = { + format = "{bandwidthDownBits} 󰇚 | {bandwidthUpBits} 󰕒"; + interval = 3; + tooltip = false; + }; + cpu = { + format = "{usage}% 󰍛"; + interval = 3; + }; + upower = { + icon-size = 16; + format = "{percentage}"; + hide-if-empty = true; + tooltip = true; + tooltip-spacing = 20; + }; + power-profiles-daemon = { + format = "{icon}"; + tooltip-format = "Power profile: {profile}\nDriver: {driver}"; + tooltip = true; + format-icons = { + default = "󱡮"; + performance = "󱡮"; + balanced = ""; + power-saver = ""; + }; + }; + wireplumber = { + scroll-step = 3; + format = "{volume}% {icon}"; + format-muted = "󰖁"; + format-icons = ["󰕿" "󰖀" "󰕾"]; + on-click = lib.getExe pkgs.pwvucontrol; + on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle"; + }; + "custom/launcher" = { + format = ""; + on-click = launcher; + tooltip = false; + }; + "custom/notification" = { + tooltip = false; + format = "{icon}"; + format-icons = { + notification = "󱅫"; + none = "󰂚"; + dnd-notification = "󰂛"; + dnd-none = "󰂛"; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "swaync-client -t -sw"; + on-click-right = "swaync-client -d -sw"; + escape = true; + }; + "privacy" = { + icon-spacing = 0; + icon-size = 16; + transition-duration = 250; + screenshare = { + type = "screenshare"; + tooltip = true; + tooltip-icon-size = 24; + }; + audio-in = { + type = "audio-in"; + tooltip = true; + tooltip-icon-size = 24; + }; + }; + "wlr/taskbar" = { + format = "{icon} {name}"; icon-size = 18; icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}"; tooltip-format = "{title}"; @@ -185,175 +340,198 @@ in { }; }; - # TODO: broken padding on taskbar button - style = '' - @define-color base00 #${colors.base00}; @define-color base08 #${colors.base08}; - @define-color base01 #${colors.base01}; @define-color base09 #${colors.base09}; - @define-color base02 #${colors.base02}; @define-color base0A #${colors.base0A}; - @define-color base03 #${colors.base03}; @define-color base0B #${colors.base0B}; - @define-color base04 #${colors.base04}; @define-color base0C #${colors.base0C}; - @define-color base05 #${colors.base05}; @define-color base0D #${colors.base0D}; - @define-color base06 #${colors.base06}; @define-color base0E #${colors.base0E}; - @define-color base07 #${colors.base07}; @define-color base0F #${colors.base0F}; + # TODO: figure out magic waybar css styling (does it pick up `~/.config/gtk-3.0/gtk.css` ?) + style = + # css + '' + @define-color base00 #${colors.base00}; @define-color base08 #${colors.base08}; + @define-color base01 #${colors.base01}; @define-color base09 #${colors.base09}; + @define-color base02 #${colors.base02}; @define-color base0A #${colors.base0A}; + @define-color base03 #${colors.base03}; @define-color base0B #${colors.base0B}; + @define-color base04 #${colors.base04}; @define-color base0C #${colors.base0C}; + @define-color base05 #${colors.base05}; @define-color base0D #${colors.base0D}; + @define-color base06 #${colors.base06}; @define-color base0E #${colors.base0E}; + @define-color base07 #${colors.base07}; @define-color base0F #${colors.base0F}; - * { - all: unset; - font-family: ${config.stylix.fonts.sansSerif.name}, Symbols Nerd Font, FontAwesome; - font-weight: 500; - font-size: 16px; - min-width: 1em; - } + * { + /* all: unset; */ + font-family: Symbols Nerd Font, FontAwesome, ${config.stylix.fonts.sansSerif.name}; + font-weight: 500; + font-size: 16px; + } - .modules-left, .modules-center, .modules-right, window#waybar { - background-color: @base00; - color: @base05; - border-radius: 12px; - } + .modules-left, .modules-center, .modules-right, window#waybar { + background-color: @base00; + color: @base05; + border-radius: 12px; + } - tooltip { - background: @base01; - border: 1px solid @base0D; - border-radius: 16px; - padding: 2em; - } + window#waybar { + border-radius: 0; + } - tooltip label { - color: @base05; - } + /* for leftmost modules */ + .modules-left, .modules-center, .modules-right { + padding-left: 3px; + background-color: @base00; + color: @base05; + } + window#bottom.modules-center { + background-color: transparent + } + tooltip { + background: @base01; + border: 1px solid @base0D; + border-radius: 16px; + padding: 2em; + } - button { - box-shadow: inset 0 -3px transparent; - border-radius: 6px; - } + tooltip label { + color: @base05; + } - button:hover { - background: inherit; - box-shadow: inset 0 -3px transparent; - } + button { + box-shadow: inset 0 -3px transparent; + border-radius: 6px; + } - #backlight, - #battery, - #clock, - #custom-launcher, - #custom-notification, - #idle_inhibitor, - #language, - #power-profiles-daemon, - #privacy, - #privacy-item, - #taskbar, - #tray, - #wireplumber, - #workspaces button, - #workspaces { - border-radius: 9px; - background-color: @base01; - margin: 3px 3px 3px 0; - padding: 0 0.42em; - } + button:hover { + background: inherit; + box-shadow: inset 0 -3px transparent; + } - /* #clock, */ - #custom-launcher, - #language, - #wireplumber { - margin: 3px; - } + #backlight, + #battery, + #clock, + #cpu, + #custom-launcher, + #custom-notification, + #idle_inhibitor, + #language, + #memory, + #network, + #power-profiles-daemon, + #privacy, + #privacy-item, + #taskbar button, + #taskbar, + #tray button, + #tray, + #wireplumber, + #workspaces button, + #workspaces { + all: unset; + border-radius: 9px; + background-color: @base01; + margin: 3px 3px 3px 0; + padding: 0 0.42em; + min-width: 1em; + } - #backlight, - #battery, - #custom-launcher, - #custom-notification, - #idle_inhibitor, - #power-profiles-daemon, - #wireplumber { - padding: 0 0.5em; - } + #backlight, + #battery, + #custom-launcher, + #custom-notification, + #idle_inhibitor, + #power-profiles-daemon, + #wireplumber { + padding: 0 0.5em; + } + #custom-notification, + #power-profiles-daemon { + min-width: 1em; + } - #privacy, - #taskbar, - #workspaces { - padding: 0; - } + #privacy, + #taskbar, + #workspaces { + padding: 0; + } - #workspaces { - padding-left: 3px; - } + #workspaces { + padding-left: 3px; + } - #privacy-item { - padding: 0 0.3em; - } + #privacy-item { + padding: 0 0.3em; + } - #workspaces button { - border-radius: 6px; - min-width: 0.4em; - } + #taskbar button { + padding-left: 0; + } + #taskbar button, + #tray button, + #workspaces button { + border-radius: 6px; + min-width: 0.8em; + } - #battery.critical:not(.charging) { - background-color: @base09; - color: @base00; - } + #battery.critical:not(.charging) { + background-color: @base09; + color: @base00; + } - #power-profiles-daemon.performance { - background-color: @base0D; - color: @base00; - } + #power-profiles-daemon.performance { + background-color: @base0D; + color: @base00; + } - #power-profiles-daemon.power-saver { - background-color: @base0A; - color: @base00; - } + #power-profiles-daemon.power-saver { + background-color: @base0A; + color: @base00; + } - #privacy-item.audio-in { - background-color: @base0E; - color: @base00; - margin: 3px; - } + #privacy-item.audio-in { + background-color: @base0E; + color: @base00; + margin: 3px; + } - #privacy-item.screenshare { - background-color: @base0C; - color: @base00; - margin: 3px 0 3px 3px; - } + #privacy-item.screenshare { + background-color: @base0C; + color: @base00; + margin: 3px 0 3px 3px; + } - #workspaces button.active, - #taskbar button.active { - background-color: @base02; - } + #taskbar button, + #tray button { + padding: 0 0.4em; + margin: 3px; + } - #workspaces button:hover, - #workspaces button.active:hover, - #taskbar button.active:hover, - #taskbar button:hover { - background-color: @base0D; - color: @base00; - } + #workspaces button.active, + #taskbar button.active { + background-color: @base02; + } - #taskbar.empty { - background-color: transparent; - } + #workspaces button:hover, + #workspaces button.active:hover, + #taskbar button.active:hover, + #taskbar button:hover { + background-color: @base0D; + color: @base00; + } - #taskbar button, - #tray button { - min-width: 0.4em; - margin: 3px; - } + #taskbar.empty { + background-color: transparent; + } - #tray > .needs-attention { - -gtk-icon-effect: highlight; - background-color: @base08; - } + #tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: @base08; + } - #tray > .passive { - -gtk-icon-effect: dim; - } + #tray > .passive { + -gtk-icon-effect: dim; + } - /* #workspaces button.active { - color: @base00; - background-color: @base0D; - } */ + /* #workspaces button.active { + color: @base00; + background-color: @base0D; + } */ - label:focus { - background-color: #000000; - } - ''; + label:focus { + background-color: #000000; + } + ''; } diff --git a/modules/home/desktop/niri/services/default.nix b/modules/home/desktop/niri/services/default.nix index 3ffa80c..5f77a0c 100644 --- a/modules/home/desktop/niri/services/default.nix +++ b/modules/home/desktop/niri/services/default.nix @@ -1,27 +1,26 @@ { - # perSystem, lib, osConfig, pkgs, lockscreen, ... -}: { +}: +lib.attrsets.recursiveUpdate { blueman-applet.enable = osConfig.services.blueman.enable; - swaync = import ./swaync; + copyq.enable = true; + gammastep.enable = true; + gnome-keyring.enable = true; + hypridle.enable = true; kanshi = import ./kanshi; network-manager-applet.enable = true; playerctld.enable = true; + swaync = import ./swaync; + swayosd.enable = true; + udiskie.enable = true; wpaperd.enable = true; - copyq = { - enable = true; - # package = perSystem.nixpkgs-stable.copyq; - }; - gnome-keyring = { - enable = true; - components = ["secrets"]; - }; +} +{ gammastep = { - enable = true; provider = "manual"; latitude = 49.6; longitude = 36.1; @@ -31,34 +30,28 @@ night = 3000; }; }; - swayosd = { - enable = true; - topMargin = 0.8; + gnome-keyring.components = ["secrets"]; + hypridle.settings = { + general = { + before_sleep_cmd = "loginctl lock-session"; + lock_cmd = "pidof ${lockscreen} || ${lockscreen}"; + # unlock_cmd = "loginctl unlock-session"; + }; + listener = [ + { + timeout = 600; + on-timeout = "pidof ${lockscreen} || ${lockscreen}"; + } + { + timeout = 601; + on-timeout = lib.getExe pkgs.niri + " msg action power-off-monitors"; + } + ]; }; + swayosd.topMargin = 0.8; udiskie = { - enable = true; automount = false; notify = true; tray = "auto"; }; - hypridle = { - enable = true; - settings = { - general = { - before_sleep_cmd = "loginctl lock-session"; - lock_cmd = "pidof ${lockscreen} || ${lockscreen}"; - # unlock_cmd = "loginctl unlock-session"; - }; - listener = [ - { - timeout = 600; - on-timeout = "pidof ${lockscreen} || ${lockscreen}"; - } - { - timeout = 601; - on-timeout = lib.getExe pkgs.niri + " msg action power-off-monitors"; - } - ]; - }; - }; } diff --git a/modules/home/desktop/niri/services/swaync/default.nix b/modules/home/desktop/niri/services/swaync/default.nix index dccdb67..53969eb 100644 --- a/modules/home/desktop/niri/services/swaync/default.nix +++ b/modules/home/desktop/niri/services/swaync/default.nix @@ -17,7 +17,7 @@ control-center-layer = "overlay"; # Notification settings - positionX = "right"; + positionX = "left"; positionY = "top"; notification-2fa-action = true; notification-inline-replies = false; @@ -27,7 +27,7 @@ notification-window-width = 400; # Control center settings - control-center-positionX = "right"; + control-center-positionX = "left"; control-center-positionY = "top"; control-center-width = 500; control-center-exclusive-zone = true;