fix gnome tiling keymapping

This commit is contained in:
Yan Lin 2025-11-01 00:10:17 +01:00
parent ebf51040e1
commit 0298c1429e
2 changed files with 44 additions and 21 deletions

View file

@ -4,6 +4,10 @@ with lib;
let
cfg = config.desktop-custom;
# Import gvariant for dconf types
mkTuple = lib.gvariant.mkTuple;
mkUint32 = lib.gvariant.mkUint32;
mkEmptyArray = lib.gvariant.mkEmptyArray;
in
{
@ -80,5 +84,42 @@ in
environment.systemPackages = with pkgs; [
hicolor-icon-theme # Fallback icon theme
];
# System-level dconf configuration with lockAll to prevent overrides
# This ensures keybindings persist after suspend/resume
programs.dconf = {
enable = true;
profiles.user.databases = [{
lockAll = true; # Prevents GNOME and extensions from changing these settings
settings = {
# Mutter keybindings - window tiling (vim-style hjkl)
"org/gnome/mutter/keybindings" = {
toggle-tiled-left = [ "<Super>h" ]; # Tile left: Super+h
toggle-tiled-right = [ "<Super>l" ]; # Tile right: Super+l
};
# Window manager keybindings (vim-style hjkl)
"org/gnome/desktop/wm/keybindings" = {
# Window maximize/restore
maximize = [ "<Super>k" ]; # Maximize: Super+k
unmaximize = [ "<Super>j" ]; # Restore: Super+j
# Move window between monitors
move-to-monitor-left = [ "<Super><Shift>h" ]; # Move left: Super+Shift+h
move-to-monitor-right = [ "<Super><Shift>l" ]; # Move right: Super+Shift+l
move-to-monitor-up = [ "<Super><Shift>k" ]; # Move up: Super+Shift+k
move-to-monitor-down = [ "<Super><Shift>j" ]; # Move down: Super+Shift+j
# Disable conflicting keybindings
minimize = mkEmptyArray "s"; # Disable Super+h conflict (was minimize window)
};
# Disable screen lock on Super+L to free it for tiling right
"org/gnome/settings-daemon/plugins/media-keys" = {
screensaver = mkEmptyArray "s"; # Remove Super+L screen lock binding
};
};
}];
};
};
}

View file

@ -120,27 +120,9 @@ in
tile-bottomright-quarter = [ "<Super>g" ]; # Bottom-right: Super+G
};
# Mutter keybindings - window tiling (vim-style hjkl)
"org/gnome/mutter/keybindings" = {
toggle-tiled-left = [ "<Super>h" ]; # Tile left: Super+h (replaces Super+Left)
toggle-tiled-right = [ "<Super>l" ]; # Tile right: Super+l (replaces Super+Right)
};
# Window manager keybindings (vim-style hjkl)
"org/gnome/desktop/wm/keybindings" = {
# Window maximize/restore
maximize = [ "<Super>k" ]; # Maximize: Super+k (replaces Super+Up)
unmaximize = [ "<Super>j" ]; # Restore: Super+j (replaces Super+Down)
# Move window between monitors
move-to-monitor-left = [ "<Super><Shift>h" ]; # Move left: Super+Shift+h
move-to-monitor-right = [ "<Super><Shift>l" ]; # Move right: Super+Shift+l
move-to-monitor-up = [ "<Super><Shift>k" ]; # Move up: Super+Shift+k
move-to-monitor-down = [ "<Super><Shift>j" ]; # Move down: Super+Shift+j
# Disable conflicting keybindings
minimize = []; # Disable Super+h conflict
};
# NOTE: vim-style hjkl keybindings (Super+h/j/k/l) are configured at the
# system level in desktop.nix with lockAll = true to prevent them from
# being overridden after suspend/resume or by GNOME extensions
};