niri: redo a lot

Signed-off-by: unexplrd <unexplrd@linerds.us>
This commit is contained in:
2025-07-19 13:19:54 +03:00
parent bba55dc973
commit c0d1341448
4 changed files with 424 additions and 263 deletions

View File

@ -7,7 +7,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf mkEnableOption mkDefault mkForce getExe; inherit (lib) mkIf mkEnableOption mkForce getExe;
inherit (osConfig.networking) hostName; inherit (osConfig.networking) hostName;
cfg = config.desktop.niri; cfg = config.desktop.niri;
@ -131,7 +131,7 @@ in {
}; };
targets.tray.Unit.Description = "Home Manager System Tray"; # workaround for udiskie targets.tray.Unit.Description = "Home Manager System Tray"; # workaround for udiskie
services = let services = let
mkGraphicalService = config: graphicalService // config; mkGraphicalService = config: lib.attrsets.recursiveUpdate graphicalService config;
graphicalService = { graphicalService = {
Install.WantedBy = ["niri.service"]; Install.WantedBy = ["niri.service"];
Unit = { Unit = {
@ -148,33 +148,25 @@ in {
in in
lib.mkMerge [ lib.mkMerge [
{ {
udiskie = mkGraphicalService {}; copyq = mkGraphicalService {Service.Environment = mkForce "QT_QPA_PLATFORM=wayland";};
waybar = mkGraphicalService {};
network-manager-applet = mkGraphicalService {}; network-manager-applet = mkGraphicalService {};
copyq = mkGraphicalService { udiskie = 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;
};
walker = 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 { # gnome-polkit-agent = mkGraphicalService {
# Service = # Service = {
# graphicalService.Service
# // {
# Type = "simple"; # Type = "simple";
# ExecStart = pkgs.polkit_gnome + "/libexec/polkit-gnome-authentication-agent-1"; # ExecStart = pkgs.polkit_gnome + "/libexec/polkit-gnome-authentication-agent-1";
# }; # };
@ -182,20 +174,18 @@ in {
} }
(lib.mkIf (hostName == "morphius") { (lib.mkIf (hostName == "morphius") {
lisgd = mkGraphicalService { lisgd = mkGraphicalService {
Service = Service = {
graphicalService.Service # Group = "input";
// { Type = "simple";
# Group = "input"; ExecStart =
Type = "simple"; "${pkgs.lisgd}/bin/lisgd"
ExecStart = + " -d /dev/input/by-path/pci-0000:00:15.1-platform-i2c_designware.1-event"
"${pkgs.lisgd}/bin/lisgd" + " -g \"1,DU,TL,*,P,niri msg action toggle-overview\""
+ " -d /dev/input/by-path/pci-0000:00:15.1-platform-i2c_designware.1-event" + " -g \"3,UD,T,*,P,niri msg action focus-workspace-up\""
+ " -g \"1,DU,TL,*,P,niri msg action toggle-overview\"" + " -g \"3,DU,B,*,P,niri msg action focus-workspace-down\""
+ " -g \"3,UD,T,*,P,niri msg action focus-workspace-up\"" + " -g \"3,LR,L,*,P,niri msg action focus-column-left\""
+ " -g \"3,DU,B,*,P,niri msg action focus-workspace-down\"" + " -g \"3,RL,R,*,P,niri msg action focus-column-right\"";
+ " -g \"3,LR,L,*,P,niri msg action focus-column-left\"" };
+ " -g \"3,RL,R,*,P,niri msg action focus-column-right\"";
};
}; };
}) })
]; ];

View File

@ -6,44 +6,30 @@
launcher, launcher,
... ...
}: let }: let
inherit (lib) mkIf getExe;
inherit (config.lib.stylix) colors; inherit (config.lib.stylix) colors;
inherit (osConfig.networking) hostName;
ifLaptop = mkIf (hostName != "dunamis"); ifLaptop = lib.mkIf (osConfig.networking.hostName != "dunamis");
in { in {
enable = true; enable = true;
systemd = { systemd = {
enable = true; enable = true;
target = "graphical-session.target"; target = "graphical-session.target";
}; };
settings.bar-0 = { settings.bottom = {
# layer = "top";
position = "bottom"; position = "bottom";
height = 33; height = 33;
spacing = 0; spacing = 0;
# margin-left = 3; # margin-left = 36 + 3;
# margin-right = 3; # margin-right = 36 + 3;
margin-left = 36 + 3; # margin-bottom = 3;
margin-right = 36 + 3;
margin-bottom = 3;
modules-left = [ modules-left = [
"custom/launcher" "custom/launcher"
"clock"
"wlr/taskbar" "wlr/taskbar"
"privacy" # "privacy"
];
modules-center = [
# "clock"
"niri/language"
"niri/workspaces"
"idle_inhibitor"
]; ];
modules-right = [ modules-right = [
"wireplumber" "niri/workspaces"
(ifLaptop "group/laptop") "niri/language"
"tray"
"custom/notification"
]; ];
"niri/workspaces" = { "niri/workspaces" = {
format = "{index}"; format = "{index}";
@ -61,7 +47,7 @@ in {
"power-profiles-daemon" "power-profiles-daemon"
]; ];
}; };
"backlight" = { backlight = {
format = "{percent}% {icon}"; format = "{percent}% {icon}";
format-icons = [ format-icons = [
"󰃚" "󰃚"
@ -73,18 +59,18 @@ in {
"󰃠" "󰃠"
]; ];
}; };
"idle_inhibitor" = { idle_inhibitor = {
format = "{icon}"; format = "{icon}";
format-icons = { format-icons = {
activated = "󰅶"; activated = "󰅶";
deactivated = "󰾪"; deactivated = "󰾪";
}; };
}; };
"tray" = { tray = {
icon-size = 16; icon-size = 16;
spacing = 6; spacing = 6;
}; };
"clock" = { clock = {
interval = 1; interval = 1;
format = "{:%R}"; format = "{:%R}";
tooltip = true; tooltip = true;
@ -103,25 +89,29 @@ in {
format-alt = "{icon} {time}"; format-alt = "{icon} {time}";
format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
}; };
mpris = { memory = {
format = "{player_icon} {dynamic}"; format = "{used:0.1f}G ";
format-paused = "{status_icon} <i>{dynamic}</i>"; tooltip-format = ''
playing-len = 30; RAM: {used:0.1f}G/{total:0.1f}G ({percentage}%)
playing-paused = 30; Swap: {swapUsed:0.1f}G/{swapTotal:0.1f}G ({swapPercentage}%)'';
player-icons = {
default = "";
mpv = "🎵";
};
status-icons = {paused = "";};
}; };
"upower" = { network = {
format = "{bandwidthDownBits} 󰇚 | {bandwidthUpBits} 󰕒";
interval = 3;
tooltip = false;
};
cpu = {
format = "{usage}% 󰍛";
interval = 3;
};
upower = {
icon-size = 16; icon-size = 16;
format = "{percentage}"; format = "{percentage}";
hide-if-empty = true; hide-if-empty = true;
tooltip = true; tooltip = true;
tooltip-spacing = 20; tooltip-spacing = 20;
}; };
"power-profiles-daemon" = { power-profiles-daemon = {
format = "{icon}"; format = "{icon}";
tooltip-format = "Power profile: {profile}\nDriver: {driver}"; tooltip-format = "Power profile: {profile}\nDriver: {driver}";
tooltip = true; tooltip = true;
@ -132,12 +122,12 @@ in {
power-saver = ""; power-saver = "";
}; };
}; };
"wireplumber" = { wireplumber = {
scroll-step = 3; scroll-step = 3;
format = "{volume}% {icon}"; format = "{volume}% {icon}";
format-muted = "󰖁"; format-muted = "󰖁";
format-icons = ["󰕿" "󰖀" "󰕾"]; format-icons = ["󰕿" "󰖀" "󰕾"];
on-click = getExe pkgs.pwvucontrol; on-click = lib.getExe pkgs.pwvucontrol;
on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle"; on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle";
}; };
"custom/launcher" = { "custom/launcher" = {
@ -177,7 +167,172 @@ in {
}; };
}; };
"wlr/taskbar" = { "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 = "{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-size = 18;
icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}"; icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}";
tooltip-format = "{title}"; tooltip-format = "{title}";
@ -185,175 +340,198 @@ in {
}; };
}; };
# TODO: broken padding on taskbar button # TODO: figure out magic waybar css styling (does it pick up `~/.config/gtk-3.0/gtk.css` ?)
style = '' style =
@define-color base00 #${colors.base00}; @define-color base08 #${colors.base08}; # css
@define-color base01 #${colors.base01}; @define-color base09 #${colors.base09}; ''
@define-color base02 #${colors.base02}; @define-color base0A #${colors.base0A}; @define-color base00 #${colors.base00}; @define-color base08 #${colors.base08};
@define-color base03 #${colors.base03}; @define-color base0B #${colors.base0B}; @define-color base01 #${colors.base01}; @define-color base09 #${colors.base09};
@define-color base04 #${colors.base04}; @define-color base0C #${colors.base0C}; @define-color base02 #${colors.base02}; @define-color base0A #${colors.base0A};
@define-color base05 #${colors.base05}; @define-color base0D #${colors.base0D}; @define-color base03 #${colors.base03}; @define-color base0B #${colors.base0B};
@define-color base06 #${colors.base06}; @define-color base0E #${colors.base0E}; @define-color base04 #${colors.base04}; @define-color base0C #${colors.base0C};
@define-color base07 #${colors.base07}; @define-color base0F #${colors.base0F}; @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; /* all: unset; */
font-family: ${config.stylix.fonts.sansSerif.name}, Symbols Nerd Font, FontAwesome; font-family: Symbols Nerd Font, FontAwesome, ${config.stylix.fonts.sansSerif.name};
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
min-width: 1em; }
}
.modules-left, .modules-center, .modules-right, window#waybar { .modules-left, .modules-center, .modules-right, window#waybar {
background-color: @base00; background-color: @base00;
color: @base05; color: @base05;
border-radius: 12px; border-radius: 12px;
} }
tooltip { window#waybar {
background: @base01; border-radius: 0;
border: 1px solid @base0D; }
border-radius: 16px;
padding: 2em;
}
tooltip label { /* for leftmost modules */
color: @base05; .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 { tooltip label {
box-shadow: inset 0 -3px transparent; color: @base05;
border-radius: 6px; }
}
button:hover { button {
background: inherit; box-shadow: inset 0 -3px transparent;
box-shadow: inset 0 -3px transparent; border-radius: 6px;
} }
#backlight, button:hover {
#battery, background: inherit;
#clock, box-shadow: inset 0 -3px transparent;
#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;
}
/* #clock, */ #backlight,
#custom-launcher, #battery,
#language, #clock,
#wireplumber { #cpu,
margin: 3px; #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, #backlight,
#battery, #battery,
#custom-launcher, #custom-launcher,
#custom-notification, #custom-notification,
#idle_inhibitor, #idle_inhibitor,
#power-profiles-daemon, #power-profiles-daemon,
#wireplumber { #wireplumber {
padding: 0 0.5em; padding: 0 0.5em;
} }
#custom-notification,
#power-profiles-daemon {
min-width: 1em;
}
#privacy, #privacy,
#taskbar, #taskbar,
#workspaces { #workspaces {
padding: 0; padding: 0;
} }
#workspaces { #workspaces {
padding-left: 3px; padding-left: 3px;
} }
#privacy-item { #privacy-item {
padding: 0 0.3em; padding: 0 0.3em;
} }
#workspaces button { #taskbar button {
border-radius: 6px; padding-left: 0;
min-width: 0.4em; }
} #taskbar button,
#tray button,
#workspaces button {
border-radius: 6px;
min-width: 0.8em;
}
#battery.critical:not(.charging) { #battery.critical:not(.charging) {
background-color: @base09; background-color: @base09;
color: @base00; color: @base00;
} }
#power-profiles-daemon.performance { #power-profiles-daemon.performance {
background-color: @base0D; background-color: @base0D;
color: @base00; color: @base00;
} }
#power-profiles-daemon.power-saver { #power-profiles-daemon.power-saver {
background-color: @base0A; background-color: @base0A;
color: @base00; color: @base00;
} }
#privacy-item.audio-in { #privacy-item.audio-in {
background-color: @base0E; background-color: @base0E;
color: @base00; color: @base00;
margin: 3px; margin: 3px;
} }
#privacy-item.screenshare { #privacy-item.screenshare {
background-color: @base0C; background-color: @base0C;
color: @base00; color: @base00;
margin: 3px 0 3px 3px; margin: 3px 0 3px 3px;
} }
#workspaces button.active, #taskbar button,
#taskbar button.active { #tray button {
background-color: @base02; padding: 0 0.4em;
} margin: 3px;
}
#workspaces button:hover, #workspaces button.active,
#workspaces button.active:hover, #taskbar button.active {
#taskbar button.active:hover, background-color: @base02;
#taskbar button:hover { }
background-color: @base0D;
color: @base00;
}
#taskbar.empty { #workspaces button:hover,
background-color: transparent; #workspaces button.active:hover,
} #taskbar button.active:hover,
#taskbar button:hover {
background-color: @base0D;
color: @base00;
}
#taskbar button, #taskbar.empty {
#tray button { background-color: transparent;
min-width: 0.4em; }
margin: 3px;
}
#tray > .needs-attention { #tray > .needs-attention {
-gtk-icon-effect: highlight; -gtk-icon-effect: highlight;
background-color: @base08; background-color: @base08;
} }
#tray > .passive { #tray > .passive {
-gtk-icon-effect: dim; -gtk-icon-effect: dim;
} }
/* #workspaces button.active { /* #workspaces button.active {
color: @base00; color: @base00;
background-color: @base0D; background-color: @base0D;
} */ } */
label:focus { label:focus {
background-color: #000000; background-color: #000000;
} }
''; '';
} }

View File

@ -1,27 +1,26 @@
{ {
# perSystem,
lib, lib,
osConfig, osConfig,
pkgs, pkgs,
lockscreen, lockscreen,
... ...
}: { }:
lib.attrsets.recursiveUpdate {
blueman-applet.enable = osConfig.services.blueman.enable; 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; kanshi = import ./kanshi;
network-manager-applet.enable = true; network-manager-applet.enable = true;
playerctld.enable = true; playerctld.enable = true;
swaync = import ./swaync;
swayosd.enable = true;
udiskie.enable = true;
wpaperd.enable = true; wpaperd.enable = true;
copyq = { }
enable = true; {
# package = perSystem.nixpkgs-stable.copyq;
};
gnome-keyring = {
enable = true;
components = ["secrets"];
};
gammastep = { gammastep = {
enable = true;
provider = "manual"; provider = "manual";
latitude = 49.6; latitude = 49.6;
longitude = 36.1; longitude = 36.1;
@ -31,34 +30,28 @@
night = 3000; night = 3000;
}; };
}; };
swayosd = { gnome-keyring.components = ["secrets"];
enable = true; hypridle.settings = {
topMargin = 0.8; 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 = { udiskie = {
enable = true;
automount = false; automount = false;
notify = true; notify = true;
tray = "auto"; 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";
}
];
};
};
} }

View File

@ -17,7 +17,7 @@
control-center-layer = "overlay"; control-center-layer = "overlay";
# Notification settings # Notification settings
positionX = "right"; positionX = "left";
positionY = "top"; positionY = "top";
notification-2fa-action = true; notification-2fa-action = true;
notification-inline-replies = false; notification-inline-replies = false;
@ -27,7 +27,7 @@
notification-window-width = 400; notification-window-width = 400;
# Control center settings # Control center settings
control-center-positionX = "right"; control-center-positionX = "left";
control-center-positionY = "top"; control-center-positionY = "top";
control-center-width = 500; control-center-width = 500;
control-center-exclusive-zone = true; control-center-exclusive-zone = true;