feat(dms): dms

This commit is contained in:
2026-01-19 11:03:04 -07:00
parent d4b1621d04
commit 944175c655
8 changed files with 628 additions and 131 deletions

View File

@@ -17,24 +17,32 @@ in {
xwayland-satellite.enable =
lib.mkEnableOption "xwayland-satellite starting with Niri"
// { default = true; };
polkit.enable =
lib.mkEnableOption "Niri/Gnome Polkit" // { default = true; };
swaylock.enable =
lib.mkEnableOption "Niri Swaylock" // { default = true; };
portal.enable =
lib.mkEnableOption "Niri Portal" // { default = true; };
gammastep.enable =
lib.mkEnableOption "Niri gammastep" // { default = true; };
swaync.enable =
lib.mkEnableOption "Niri Sway Notification Center" // { default = true; };
binds = lib.mkOption {
type = lib.types.anything;
default = {};
};
};
config = lib.mkIf cfg.enable {
stylix.targets.swaylock.enable = true;
services.polkit-gnome.enable = true;
# File-picker.
home.packages = [ pkgs.nautilus ];
# Enable the XDG portal, an interface for programs to request
# permissions/resources. This is necessary to screen-cast on
# Wayland/Pipewire.
#
# See https://github.com/YaLTeR/niri/wiki/Important-Software#portals.
# Niri's NixOS module automatically brings in xdg-desktop-portal-gnome and
# gnome-keyring.
xdg.portal = {
# See
# https://github.com/YaLTeR/niri/wiki/Important-Software#portals.
# Niri's NixOS module automatically brings in
# xdg-desktop-portal-gnome and gnome-keyring.
xdg.portal = lib.mkIf cfg.portal.enable {
enable = true;
xdgOpenUsePortal = true;
@@ -44,9 +52,10 @@ in {
];
# Use xdg-desktop-portal-gtk by default, but fallback to
# xdg-desktop-portal-gnome for screenshots and screen-casts, two important
# features unsupported by the GTK implementation. See implementations and
# their supported interfaces at
# xdg-desktop-portal-gnome for screenshots and screen-casts,
# two important features unsupported by the GTK
# implementation. See implementations and their supported
# interfaces at
# https://wiki.archlinux.org/title/XDG_Desktop_Portal.
config.niri = {
default = [ "gtk" ];
@@ -55,6 +64,13 @@ in {
};
};
stylix.targets.swaylock.enable = cfg.swaylock.enable;
services.polkit-gnome.enable = cfg.polkit.enable;
# File-picker.
home.packages = [ pkgs.nautilus ];
systemd.user.services.xwayland-satellite =
lib.mkIf cfg.xwayland-satellite.enable {
Service.ExecStart =
@@ -68,28 +84,38 @@ in {
settings = {
# Activates some Nixpkgs patches to help run Electron applications under
# Wayland.
environment."NIXOS_OZONE_WL" = "1";
environment."DISPLAY" = ":0";
environment = {
NIXOS_OZONE_WL = "1";
DISPLAY = ":0";
XDG_CURRENT_DESKTOP = "niri";
QT_QPA_PLATFORM = "wayland";
ELECTRON_OZONE_PLATFORM_HINT = "auto";
QT_QPA_PLATFORMTHEME = "gtk3";
QT_QPA_PLATFORMTHEME_QT6 = "gtk3";
};
spawn-at-startup =
lib.optional cfg.swaync.enable
{ command = [ "${pkgs.swaynotificationcenter}/bin/swaync" ]; }
++ lib.optional cfg.gammastep.enable
{ command = [ "${pkgs.gammastep}/bin/gammastep" "-o" "-O" "4000k"
"-b" "0.9:0.9" "-l" "0:0"]; }
++ lib.optional
(! builtins.isNull cfg.wallpaper)
{ command = [ "${pkgs.wbg}/bin/wbg" "${cfg.wallpaper}" ]; };
spawn-at-startup =
[{ command = [ "${pkgs.swaynotificationcenter}/bin/swaync" ]; }
{ command = [ "${pkgs.gammastep}/bin/gammastep" "-o" "-O" "4000k"
"-b" "0.9:0.9" "-l" "0:0"]; }]
++ lib.optional
(! builtins.isNull cfg.wallpaper)
{ command = [ "${pkgs.wbg}/bin/wbg" "${cfg.wallpaper}" ]; };
input = {
keyboard.xkb = {
layout = "us";
options = "ctrl:swapcaps,compose:menu,compose:ralt";
layout = "us";
options = "ctrl:swapcaps,compose:menu,compose:ralt";
};
mouse = {
accel-speed = -0.5;
accel-profile = "flat";
accel-speed = -0.5;
accel-profile = "flat";
};
touchpad = {
# Disable while typing.
dwt = true;
# Disable while typing.
dwt = true;
};
focus-follows-mouse.enable = true;
};
@@ -112,37 +138,37 @@ in {
gaps = 8;
center-focused-column = "never";
preset-column-widths = [
{ proportion = 1.0 / 3.0; }
{ proportion = 1.0 / 2.0; }
{ proportion = 2.0 / 3.0; }
{ proportion = 1.0 / 3.0; }
{ proportion = 1.0 / 2.0; }
{ proportion = 2.0 / 3.0; }
];
default-column-width.proportion = 0.5;
focus-ring = {
enable = false;
width = 2;
enable = false;
width = 2;
};
border = {
enable = true;
width = 2;
# Override Niri's Stylix integration. Default uses Crystal Blue
# (from the Kanagawa palette); we override it with Old White.
active.color = config.lib.stylix.colors.withHashtag.base06;
enable = true;
width = 2;
# Override Niri's Stylix integration. Default uses Crystal Blue
# (from the Kanagawa palette); we override it with Old White.
active.color = config.lib.stylix.colors.withHashtag.base06;
};
shadow = {
enable = true;
softness = 30;
spread = 5;
offset.x = 5;
offset.y = 5;
enable = true;
softness = 30;
spread = 5;
offset.x = 5;
offset.y = 5;
};
tab-indicator = {
place-within-column = true;
position = "top";
# active.color = config.lib.stylix.colors.withHashtag.blue;
inactive.color = config.lib.stylix.colors.withHashtag.base01;
width = 8;
corner-radius = 2.0;
gaps-between-tabs = 10;
place-within-column = true;
position = "top";
# active.color = config.lib.stylix.colors.withHashtag.blue;
inactive.color = config.lib.stylix.colors.withHashtag.base01;
width = 8;
corner-radius = 2.0;
gaps-between-tabs = 10;
};
};
prefer-no-csd = true;
@@ -153,89 +179,89 @@ in {
};
window-rules = [
{ # Set red borders to indicate that a window is being captured.
matches = [
{ is-window-cast-target = true; }
];
focus-ring = {
enable = true;
width = 2;
active.color = "#f38ba8";
inactive.color = "#7d0d2d";
};
border = {
width = 2;
inactive.color = "#7d0d2d";
active.color = "#7d0d2d";
};
shadow = {
color = "#7d0d2d70";
softness = 30;
spread = 10;
offset.x = 0;
offset.y = 0;
};
tab-indicator = {
active.color = "#f38ba8";
inactive.color = "#7d0d2d";
};
matches = [
{ is-window-cast-target = true; }
];
focus-ring = {
enable = true;
width = 2;
active.color = "#f38ba8";
inactive.color = "#7d0d2d";
};
border = {
width = 2;
inactive.color = "#7d0d2d";
active.color = "#7d0d2d";
};
shadow = {
color = "#7d0d2d70";
softness = 30;
spread = 10;
offset.x = 0;
offset.y = 0;
};
tab-indicator = {
active.color = "#f38ba8";
inactive.color = "#7d0d2d";
};
}
{ # Block private DMs from screencast...
matches = [
{ title = "Element.*\\|"; }
{ title = "Discord.*@"; }
];
excludes = [
# ... except when explicitly targeting the window.
{ is-window-cast-target = true; }
];
block-out-from = "screen-capture";
matches = [
{ title = "Element.*\\|"; }
{ title = "Discord.*@"; }
];
excludes = [
# ... except when explicitly targeting the window.
{ is-window-cast-target = true; }
];
block-out-from = "screen-capture";
}
{
# This regular expression is intentionally made as specific as
# possible, since this is the default config, and we want no false
# positives. You can get away with just app-id="wezterm" if you
# want.
matches = [
{ app-id = "^org\\.wezfurlong\\.wezterm$"; }
];
default-column-width = {};
# This regular expression is intentionally made as specific as
# possible, since this is the default config, and we want no false
# positives. You can get away with just app-id="wezterm" if you
# want.
matches = [
{ app-id = "^org\\.wezfurlong\\.wezterm$"; }
];
default-column-width = {};
}
{
# Floating windows.
matches = [
# Open the Firefox picture-in-picture player as floating by default.
{ app-id = "firefox$"; title = "^Picture-in-Picture$"; }
# Gimp pop-ups.
{
# Floating windows.
matches = [
# Open the Firefox picture-in-picture player as floating by default.
{ app-id = "firefox$"; title = "^Picture-in-Picture$"; }
# Gimp pop-ups.
{
app-id = "^Gimp$";
title = "^(New Layer|Change Foreground Color|Save Image)$";
}
];
open-floating = true;
}
];
open-floating = true;
}
{ # Start with low width.
matches = [
{ app-id = "com\\.mitchellh\\.ghostty"; }
];
default-column-width.proportion = 1.0 / 3.0;
matches = [
{ app-id = "com\\.mitchellh\\.ghostty"; }
];
default-column-width.proportion = 1.0 / 3.0;
}
{
matches = [
{ app-id = "^emacs$"; }
];
default-column-width.fixed = 640;
matches = [
{ app-id = "^emacs$"; }
];
default-column-width.fixed = 640;
}
{
# Enable rounded corners for all windows.
geometry-corner-radius =
let r = 8.0;
in {
# Enable rounded corners for all windows.
geometry-corner-radius =
let r = 8.0;
in {
bottom-left = r;
top-left = r;
bottom-right = r;
top-right = r;
};
clip-to-geometry = true;
};
clip-to-geometry = true;
}
];
binds = {
@@ -273,11 +299,9 @@ in {
"Print".action.screenshot-screen = [];
"Mod+Print".action.screenshot-window = [];
"Mod+X".action.spawn = [
"emacsclient-or-emacs"
"-ce"
"(eshell t)"
];
"Mod+X".action.spawn = ["ghostty"];
"Mod+E".action.spawn = ["emacsclient" "-c"];
"Mod+O".action.toggle-overview = [];
"Mod+Shift+F".action.toggle-window-floating = [];
"Mod+F".action.switch-focus-between-floating-and-tiling = [];
@@ -296,9 +320,9 @@ in {
"Mod+Shift+L".action.move-column-right = [];
"XF86MonBrightnessDown".action.spawn =
[(lib.getExe pkgs.brightnessctl) "s" "5%-"];
[(lib.getExe pkgs.brightnessctl) "s" "5%-"];
"XF86MonBrightnessUp".action.spawn =
[(lib.getExe pkgs.brightnessctl) "s" "+5%"];
[(lib.getExe pkgs.brightnessctl) "s" "+5%"];
"Mod+1".action.focus-workspace = [1];
"Mod+2".action.focus-workspace = [2];
@@ -323,16 +347,16 @@ in {
"Mod+Ctrl+R".action.reset-window-height = [];
"XF86AudioRaiseVolume".action.spawn =
["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05+"];
["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05+"];
"XF86AudioLowerVolume".action.spawn =
["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05-"];
};
["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05-"];
} // cfg.binds;
layer-rules = [
# Don't move wallpaper with workspace.
{
matches = [{ namespace = "^wallpaper$"; }];
place-within-backdrop = true;
matches = [{ namespace = "^wallpaper$"; }];
place-within-backdrop = true;
}
];