This commit is contained in:
2026-08-03 11:44:27 +09:00
parent d5e4c90710
commit e84fa82710
6 changed files with 159 additions and 105 deletions
+50 -46
View File
@@ -4,48 +4,6 @@ let
in
{
programs.niri.settings = {
input = {
touchpad = {
natural-scroll = true;
scroll-factor = 4.0;
scroll-method = "two-finger";
click-method = "clickfinger";
drag = true;
drag-lock = true;
};
keyboard.xkb = {
layout = "jp";
options = "ctrl:nocaps";
};
mouse = {
accel-profile = "flat";
accel-speed = -0.1;
};
warp-mouse-to-focus.enable = true;
focus-follows-mouse = {
enable = true;
max-scroll-amount = "0%";
};
};
cursor.size = 16;
layout = {
focus-ring = {
active.color = "#bd93f9";
inactive.color = "#6272a4";
};
border = {
active.color = "#ffc87f";
inactive.color = "#505050";
urgent.color = "#9b0000";
};
shadow.color = "#0007";
background-color = "transparent";
};
binds = keybindings // {
"Mod+T" = {
@@ -168,13 +126,59 @@ in
];
};
input = {
touchpad = {
natural-scroll = true;
scroll-factor = 4.0;
scroll-method = "two-finger";
click-method = "clickfinger";
drag = true;
drag-lock = true;
dwt = true;
};
keyboard = {
numlock = true;
xkb = {
layout = "jp";
options = "ctrl:nocaps";
};
};
mouse = {
accel-profile = "flat";
accel-speed = -0.1;
};
trackpoint = {
accel-profile = "flat";
accel-speed = -0.1;
};
warp-mouse-to-focus.enable = true;
focus-follows-mouse = {
enable = true;
max-scroll-amount = "0%";
};
};
cursor.size = 16;
layout = {
focus-ring = {
active.color = "#bd93f9";
inactive.color = "#6272a4";
};
background-color = "transparent";
};
window-rules = [
{
geometry-corner-radius = {
top-left = 20.0;
top-right = 20.0;
bottom-left = 20.0;
bottom-right = 20.0;
top-left = 8.0;
top-right = 8.0;
bottom-left = 8.0;
bottom-right = 8.0;
};
clip-to-geometry = true;
}
+96 -24
View File
@@ -1,44 +1,90 @@
{
"Mod+Shift+Slash".action.show-hotkey-overlay = { };
"Mod+T" = {
hotkey-overlay.title = "Open a Terminal: alacritty";
action.spawn = "alacritty";
};
"Mod+D" = {
hotkey-overlay.title = "Run an Application: fuzzel";
action.spawn = "fuzzel";
};
"Super+Alt+L" = {
hotkey-overlay.title = "Lock the Screen: swaylock";
action.spawn = "swaylock";
};
"Super+Alt+S" = {
allow-when-locked = true;
hotkey-overlay.hidden = true;
action.spawn-sh = "pkill orca || exec orca";
};
"XF86AudioRaiseVolume" = {
allow-when-locked = true;
action.spawn = [
"wpctl"
"set-volume"
"@DEFAULT_AUDIO_SINK@"
"0.1+"
];
action.spawn-sh = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0";
};
"XF86AudioLowerVolume" = {
allow-when-locked = true;
action.spawn = [
"wpctl"
"set-volume"
"@DEFAULT_AUDIO_SINK@"
"0.1-"
];
action.spawn-sh = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-";
};
"XF86AudioMute" = {
allow-when-locked = true;
action.spawn = [
"wpctl"
"set-mute"
"@DEFAULT_AUDIO_SINK@"
"toggle"
];
action.spawn-sh = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
"XF86AudioMicMute" = {
allow-when-locked = true;
action.spawn-sh = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
};
"XF86AudioPlay" = {
allow-when-locked = true;
action.spawn-sh = "playerctl play-pause";
};
"XF86AudioPause" = {
allow-when-locked = true;
action.spawn-sh = "playerctl play-pause";
};
"XF86AudioStop" = {
allow-when-locked = true;
action.spawn-sh = "playerctl stop";
};
"XF86AudioPrev" = {
allow-when-locked = true;
action.spawn-sh = "playerctl previous";
};
"XF86AudioNext" = {
allow-when-locked = true;
action.spawn-sh = "playerctl next";
};
"XF86MonBrightnessUp" = {
allow-when-locked = true;
action.spawn = [
"wpctl"
"set-mute"
"@DEFAULT_AUDIO_SOURCE@"
"toggle"
"brightnessctl"
"--class=backlight"
"set"
"+10%"
];
};
"XF86MonBrightnessDown" = {
allow-when-locked = true;
action.spawn = [
"brightnessctl"
"--class=backlight"
"set"
"10%-"
];
};
"Mod+Q".action.close-window = { };
"Mod+O" = {
repeat = false;
action.toggle-overview = { };
};
"Mod+Q" = {
repeat = false;
action.close-window = { };
};
"Mod+Left".action.focus-column-left = { };
"Mod+Down".action.focus-window-down = { };
@@ -130,6 +176,7 @@
"Mod+7".action.focus-workspace = 7;
"Mod+8".action.focus-workspace = 8;
"Mod+9".action.focus-workspace = 9;
"Mod+Ctrl+1".action.move-column-to-workspace = 1;
"Mod+Ctrl+2".action.move-column-to-workspace = 2;
"Mod+Ctrl+3".action.move-column-to-workspace = 3;
@@ -140,21 +187,46 @@
"Mod+Ctrl+8".action.move-column-to-workspace = 8;
"Mod+Ctrl+9".action.move-column-to-workspace = 9;
"Mod+BracketLeft".action.consume-or-expel-window-left = { };
"Mod+BracketRight".action.consume-or-expel-window-right = { };
"Mod+Comma".action.consume-window-into-column = { };
"Mod+Period".action.expel-window-from-column = { };
"Mod+R".action.switch-preset-column-width = { };
"Mod+Shift+R".action.reset-window-height = { };
"Mod+Shift+R".action.switch-preset-column-width-back = { };
"Mod+Ctrl+Shift+R".action.switch-preset-window-height = { };
"Mod+Ctrl+R".action.reset-window-height = { };
"Mod+F".action.maximize-column = { };
"Mod+Shift+F".action.fullscreen-window = { };
"Mod+M".action.maximize-window-to-edges = { };
"Mod+Ctrl+F".action.expand-column-to-available-width = { };
"Mod+C".action.center-column = { };
"Mod+Ctrl+C".action.center-visible-columns = { };
"Mod+Minus".action.set-column-width = "-10%";
"Mod+Equal".action.set-column-width = "+10%";
"Mod+Shift+Minus".action.set-window-height = "-10%";
"Mod+Shift+Equal".action.set-window-height = "+10%";
"Mod+V".action.toggle-window-floating = { };
"Mod+Shift+V".action.switch-focus-between-floating-and-tiling = { };
"Mod+W".action.toggle-column-tabbed-display = { };
"Print".action.screenshot = { };
"Ctrl+Print".action.screenshot-screen = { };
"Alt+Print".action.screenshot-window = { };
"Mod+Escape" = {
allow-inhibiting = false;
action.toggle-keyboard-shortcuts-inhibit = { };
};
"Mod+Shift+E".action.quit = { };
"Ctrl+Alt+Delete".action.quit = { };
"Mod+Shift+P".action.power-off-monitors = { };
}
+3 -2
View File
@@ -5,7 +5,8 @@
includes = [ "systems.wayland" ];
imports = {
nixos = [ inputs.niri-flake.nixosModules.niri ];
home = [ ./niri-home-module.nix ];
nixos = [
inputs.niri-flake.nixosModules.niri
];
};
}
@@ -1,9 +0,0 @@
{
inputs,
lib,
system,
...
}:
{
imports = lib.optional (lib.hasSuffix "-darwin" system) inputs.niri-flake.homeModules.niri;
}
+10 -2
View File
@@ -1,6 +1,14 @@
{ config, ... }:
{
programs.niri.enable = true;
config,
pkgs,
inputs,
...
}:
{
programs.niri = {
enable = true;
package = inputs.niri-flake.packages.${pkgs.stdenv.hostPlatform.system}.niri-unstable;
};
# niri-flake supplies the compositor package but does not register its
# user units with NixOS. Without this, Ly cannot start niri-session.
@@ -1,22 +0,0 @@
diff --git a/src/headform.c b/src/headform.c
--- a/src/headform.c
+++ b/src/headform.c
@@ -39,1 +39,8 @@
+/* The output-management protocol transmits scale as a Wayland 24.8 fixed
+ * point value. Use that same value for preview geometry so a fractional scale
+ * cannot change underneath positions during the first apply. */
+static double canonicalize_scale(double scale) {
+ return wl_fixed_to_double(wl_fixed_from_double(scale));
+}
+
static void head_form_update_sensitivity(WdHeadForm *form) {
@@ -359,2 +366,3 @@ void wd_head_form_fill_config(WdHeadForm *form, struct wd_head_config *output) {
- output->scale = gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->scale));
+ output->scale = canonicalize_scale(
+ gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->scale)));
output->x = gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->pos_x));
@@ -385,2 +393,3 @@ void wd_head_form_get_dimensions(WdHeadForm *form, WdHeadDimensions *dimensions)
- dimensions->scale = gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->scale));
+ dimensions->scale = canonicalize_scale(
+ gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->scale)));
dimensions->rotation_id = g_variant_get_int32(g_action_get_state(priv->rotate_action)) / 90;