update niri; random tweaks

This commit is contained in:
Reid 2025-08-19 20:33:39 -07:00
parent 99ccea27eb
commit 402d9f4957
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
10 changed files with 171 additions and 130 deletions

View file

@ -34,7 +34,7 @@ in {
# magic environment variables that improve wayland compat
NIXOS_OZONE_WL = "1";
_JAVA_AWT_WM_NONEREPARENTING = "1";
GDK_BACKEND = "wayland,x11";
GDK_BACKEND = "wayland";
ANKI_WAYLAND = "1";
MOZ_ENABLE_WAYLAND = "1";
ELECTRON_OZONE_PLATFORM_HINT = "wayland";

View file

@ -18,7 +18,7 @@ in {
settings = {
main = {
terminal = "wezterm start";
font = with config.modules.desktop.fonts.fonts; "${monospace.family}:pixelsize=${toString monospace.size}";
font = with config.modules.desktop.fonts.fonts.monospace; "${family}:pixelsize=${toString size}";
prompt = "> ";
dpi-aware = "no";
lines = 20;
@ -27,6 +27,10 @@ in {
horizontal-pad = 32;
vertical-pad = 8;
};
border = {
width = 1;
radius = config.modules.desktop.fonts.fonts.monospace.size;
};
};
};
};

View file

@ -5,7 +5,7 @@ let
cfg = config.modules.desktop.monitors;
in {
options.modules.desktop.monitors = {
enable = mkEnableOption "Manually configure monitor settings, use if manual configuration is needed";
enable = mkEnableOption "manually configure monitor settings, use if manual configuration is needed";
monitors = mkOption {
type = types.listOf types.attrs;
description = ''
@ -26,7 +26,6 @@ in {
name = monitor.name;
value = {
scale = monitor.scale;
background-color = config.modules.desktop.themes.niri.background;
};
}) cfg.monitors);
};

View file

@ -55,17 +55,22 @@ in {
size = config.modules.desktop.themes.cursorTheme.size;
};
prefer-no-csd = true;
# xwayland stuff
xwayland-satellite.enable = true;
xwayland-satellite.path = lib.getExe pkgs.xwayland-satellite-unstable;
environment = {
DISPLAY = ":0";
};
prefer-no-csd = true;
layout = {
gaps = 6;
center-focused-column = "on-overflow";
background-color = config.modules.desktop.themes.niri.background;
focus-ring = {
enable = false;
width = 1;
@ -80,33 +85,69 @@ in {
inactive.color = config.modules.desktop.themes.niri.inactive;
};
insert-hint = {
enable = true;
display.color = config.modules.desktop.themes.niri.accent;
};
shadow = {
enable = true;
# TODO: remove this?
# this is a way to make the shadow appear on rounded corners
# see: https://github.com/YaLTeR/niri/blob/e251ca7340bc71870c3a81a7ffc3d9bde58e685a/resources/default-config.kdl#L201
draw-behind-window = true;
draw-behind-window = false;
offset.x = 0;
offset.y = 0;
softness = 30;
spread = 2;
color = config.modules.desktop.themes.niri.shadow;
};
insert-hint.enable = false;
};
overview = {
backdrop-color = config.modules.desktop.themes.niri.background;
workspace-shadow = {
enable = true;
offset.x = 0;
offset.y = 0;
softness = 30;
spread = 2;
color = config.modules.desktop.themes.niri.shadow;
};
};
hotkey-overlay.skip-at-startup = true;
screenshot-path = null;
screenshot-path = "${replaceString "$HOME" "~" config.hm.xdg.userDirs.extraConfig.screenshots}/%Y-%m-%d %H-%M-%S.png";
animations = {
shaders.window-resize = ''
vec4 resize_color(vec3 coords_curr_geo, vec3 size_curr_geo) {
window-open = {
kind.spring = {
damping-ratio = 0.8;
stiffness = 300;
epsilon = 0.001;
};
custom-shader = ''
vec4 default_open(vec3 coords_curr_geo, vec3 size_curr_geo) {
// Scale up the window.
float scale = max(0.0, (niri_progress / 2.0 + 0.5));
coords_curr_geo = vec3((coords_curr_geo.xy - vec2(0.5)) / scale + vec2(0.5), 1.0);
// Get color from the window texture.
vec3 coords_tex = niri_geo_to_tex * coords_curr_geo;
vec4 color = texture2D(niri_tex, coords_tex.st);
// Make the window opaque.
color *= niri_clamped_progress;
return color;
}
vec4 open_color(vec3 coords_curr_geo, vec3 size_curr_geo) {
return default_open(coords_curr_geo, size_curr_geo);
}
'';
};
window-resize.custom-shader = ''
vec4 stretch_or_crop_next(vec3 coords_curr_geo, vec3 size_curr_geo) {
vec3 coords_next_geo = niri_curr_geo_to_next_geo * coords_curr_geo;
vec3 coords_stretch = niri_geo_to_tex_next * coords_curr_geo;
@ -141,36 +182,40 @@ in {
return color;
}
vec4 resize_color(vec3 coords_curr_geo, vec3 size_curr_geo) {
return stretch_or_crop_next(coords_curr_geo, size_curr_geo);
}
'';
window-close = {
easing = {
kind.easing = {
curve = "linear";
duration-ms = 600;
};
custom-shader = ''
vec4 fall_and_rotate(vec3 coords_geo, vec3 size_geo) {
float progress = niri_clamped_progress * niri_clamped_progress;
vec2 coords = (coords_geo.xy - vec2(0.5, 1.0)) * size_geo.xy;
coords.y -= progress * 1440.0;
float random = (niri_random_seed - 0.5) / 2.0;
random = sign(random) - random;
float max_angle = 0.5 * random;
float angle = progress * max_angle;
mat2 rotate = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
coords = rotate * coords;
coords_geo = vec3(coords / size_geo.xy + vec2(0.5, 1.0), 1.0);
vec3 coords_tex = niri_geo_to_tex * coords_geo;
vec4 color = texture2D(niri_tex, coords_tex.st);
return color;
}
vec4 close_color(vec3 coords_geo, vec3 size_geo) {
return fall_and_rotate(coords_geo, size_geo);
}
'';
};
shaders.window-close = ''
vec4 fall_and_rotate(vec3 coords_geo, vec3 size_geo) {
float progress = niri_clamped_progress * niri_clamped_progress;
vec2 coords = (coords_geo.xy - vec2(0.5, 1.0)) * size_geo.xy;
coords.y -= progress * 1440.0;
float random = (niri_random_seed - 0.5) / 2.0;
random = sign(random) - random;
float max_angle = 0.5 * random;
float angle = progress * max_angle;
mat2 rotate = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
coords = rotate * coords;
coords_geo = vec3(coords / size_geo.xy + vec2(0.5, 1.0), 1.0);
vec3 coords_tex = niri_geo_to_tex * coords_geo;
vec4 color = texture2D(niri_tex, coords_tex.st);
return color;
}
vec4 close_color(vec3 coords_geo, vec3 size_geo) {
return fall_and_rotate(coords_geo, size_geo);
}
'';
};
window-rules = [
@ -269,13 +314,24 @@ in {
enable = true;
};
}
# special rounded corner cases. gah!!
# also for some reason int literals aren't accepted
# so multiply by 1.0 to make it a float
{
matches = [
{ namespace = "^launcher$"; }
{ namespace = "^wob$"; }
];
# see earlier shadow config; this is here because it's a transparent window, special case
shadow.draw-behind-window = false;
matches = [ { namespace = "^rofi$"; } ];
geometry-corner-radius = allCorners (config.modules.desktop.fonts.fonts.monospace.size * 1.0); # its 1em, so
}
{
matches = [ { namespace = "^launcher$"; } ];
geometry-corner-radius = allCorners (config.hm.programs.fuzzel.settings.border.radius * 1.0);
}
{
matches = [ { namespace = "^notifications$"; } ];
geometry-corner-radius = allCorners (config.hm.services.dunst.settings.global.corner_radius * 1.0);
}
{
matches = [ { namespace = "^waybar$"; } ];
geometry-corner-radius = allCorners (config.modules.desktop.fonts.fonts.monospace.size * 1.0); # its 1em, so
}
];
@ -330,17 +386,16 @@ in {
"Mod+8".action = focus-workspace 8;
"Mod+9".action = focus-workspace 9;
"Mod+0".action = focus-workspace 10;
# no clue why, this got removed!! TODO: find an alternative
# "Mod+Shift+1".action = move-column-to-workspace 1;
# "Mod+Shift+2".action = move-column-to-workspace 2;
# "Mod+Shift+3".action = move-column-to-workspace 3;
# "Mod+Shift+4".action = move-column-to-workspace 4;
# "Mod+Shift+5".action = move-column-to-workspace 5;
# "Mod+Shift+6".action = move-column-to-workspace 6;
# "Mod+Shift+7".action = move-column-to-workspace 7;
# "Mod+Shift+8".action = move-column-to-workspace 8;
# "Mod+Shift+9".action = move-column-to-workspace 9;
# "Mod+Shift+0".action = move-column-to-workspace 10;
"Mod+Shift+1".action.move-column-to-workspace = 1;
"Mod+Shift+2".action.move-column-to-workspace = 2;
"Mod+Shift+3".action.move-column-to-workspace = 3;
"Mod+Shift+4".action.move-column-to-workspace = 4;
"Mod+Shift+5".action.move-column-to-workspace = 5;
"Mod+Shift+6".action.move-column-to-workspace = 6;
"Mod+Shift+7".action.move-column-to-workspace = 7;
"Mod+Shift+8".action.move-column-to-workspace = 8;
"Mod+Shift+9".action.move-column-to-workspace = 9;
"Mod+Shift+0".action.move-column-to-workspace = 10;
"Mod+Comma".action = consume-window-into-column;
"Mod+Period".action = expel-window-from-column;
@ -361,7 +416,7 @@ in {
"Mod+Shift+Minus".action = set-window-height "-10%";
"Mod+Shift+Equal".action = set-window-height "+10%";
"Print".action = screenshot;
"Print".action = screenshot { show-pointer = false; };
"Mod+Grave".action = toggle-overview;
@ -370,12 +425,12 @@ in {
"XF86AudioMicMute".action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle";
"XF86AudioMicMute".allow-when-locked = true;
"XF86LaunchA".action = screenshot;
"XF86LaunchA".action = screenshot { show-pointer = false; };
"XF86LaunchB".action = sh "${lib.getExe pkgs.rofi-rbw-wayland} -a copy -t password --clear-after 20";
"XF86ScreenSaver".action = sh "${pkgs.systemd}/bin/loginctl lock-session";
# substitutions for when not on laptop
"Mod+Shift+S".action = screenshot;
"Mod+Shift+S".action = screenshot { show-pointer = false; };
"Mod+Shift+P".action = sh "${lib.getExe pkgs.rofi-rbw-wayland} -a copy -t password --clear-after 20";
"Mod+L".action = sh "${pkgs.systemd}/bin/loginctl lock-session";

View file

@ -1,35 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.desktop.xwayland-satellite;
in {
options.modules.desktop.xwayland-satellite = {
enable = mkEnableOption "Enable xwayland-satellite, xwayland outside your wayland";
package = mkOption {
type = types.package;
default = pkgs.xwayland-satellite-unstable;
};
};
config = mkIf cfg.enable {
hm.systemd.user.services.xwayland-satellite = {
Unit = {
Description = "xwayland-satellite, xwayland outside your wayland";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = "${lib.getExe cfg.package}";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}

View file

@ -17,9 +17,6 @@ in {
enableUpdateCheck = false;
extensions = with pkgs.vscode-extensions; [
# nix is *the* language here
jnoortheen.nix-ide
# general extensions
oderwat.indent-rainbow
usernamehw.errorlens
@ -29,22 +26,36 @@ in {
ms-vscode.hexeditor
tamasfe.even-better-toml
github.copilot
leonardssh.vscord
# language specific
# js/ts
# nix
jnoortheen.nix-ide
# javascript/typescript
dbaeumer.vscode-eslint
astro-build.astro-vscode
# rs
# rust
rust-lang.rust-analyzer
# lua
sumneko.lua
# qml
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
# general extensions
# language specific
# qml
{
name = "discord-vscode";
publisher = "icrawl";
version = "5.8.0";
sha256 = "sha256-IU/looiu6tluAp8u6MeSNCd7B8SSMZ6CEZ64mMsTNmU=";
name = "qt-qml";
publisher = "TheQtCompany";
version = "1.4.0";
sha256 = "sha256-9C0EC4vnulg0OjGNU0SfMA2R6+OaHVCqDsipY2TAqxo=";
}
# libraries
# qt core
{
name = "qt-core";
publisher = "TheQtCompany";
version = "1.4.0";
sha256 = "sha256-QiZc6WNh4Q67beyFuiSqkG5G4zRMNmyjuZhWW7ZATO0=";
}
];
@ -70,6 +81,11 @@ in {
"nix.enableLanguageServer" = true;
"nix.serverPath" = "${lib.getExe pkgs.nil}";
"qt-qml.qmlls.enabled" = true;
"qt-qml.qmlls.customExePath" = "${pkgs.qt6.qtdeclarative}/bin/qmlls";
"qt-qml.qmlls.useQmlImportPathEnvVar" = true;
"qt-qml.doNotAskForQmllsDownload" = true;
"security.workspace.trust.enabled" = "false";
"explorer.compactFolders" = false;

View file

@ -2,7 +2,7 @@
{
config = {
hm.xdg.enable = true;
hm.xdg.userDirs = {
hm.xdg.userDirs = rec {
enable = true;
createDirectories = true;
@ -14,6 +14,10 @@
publicShare = "$HOME/public";
templates = "$HOME/templates";
videos = "$HOME/videos";
extraConfig = {
screenshots = "${pictures}/screenshots";
};
};
};
}