feat(hyprland): start lua config migration #146
@@ -49,8 +49,19 @@
|
|||||||
modules.desktop.apps.vencord.enable = true;
|
modules.desktop.apps.vencord.enable = true;
|
||||||
|
|
||||||
home-manager.users.${config.user.name}.wayland.windowManager.hyprland.settings.monitor = [
|
home-manager.users.${config.user.name}.wayland.windowManager.hyprland.settings.monitor = [
|
||||||
"HDMI-A-1,1920x1080@120,0x0,1,transform,3"
|
{
|
||||||
"DP-3,2560x1440@239.96,1080x0,1"
|
output = "HDMI-A-1";
|
||||||
|
mode = "1920x1080@120";
|
||||||
|
position = "0x0";
|
||||||
|
scale = 1;
|
||||||
|
transform = 3;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
output = "DP-3";
|
||||||
|
mode = "2560x1440@239.96";
|
||||||
|
position = "1080x0";
|
||||||
|
scale = 1;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,13 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# The Hyprland compositor.
|
# The Hyprland compositor.
|
||||||
let
|
|
||||||
cfg = config.modules.desktop.session.hyprland; # NOLINT(let_order)
|
|
||||||
cursor = config.stylix.cursor;
|
|
||||||
|
|
||||||
# Numbered-workspace switch and move for 1..9, the operator's i3 muscle memory.
|
|
||||||
workspaceBinds = lib.concatMap (n: [
|
|
||||||
"$mod, ${toString n}, workspace, ${toString n}"
|
|
||||||
"$mod SHIFT, ${toString n}, movetoworkspace, ${toString n}"
|
|
||||||
]) (lib.range 1 9);
|
|
||||||
|
|
||||||
user = config.user.name;
|
|
||||||
|
|
||||||
# Flip the tiling strategy between the two built-in layouts, since neither a
|
|
||||||
# dispatcher nor a keyword toggles it on its own.
|
|
||||||
toggleLayout = pkgs.writeShellScript "hypr-toggle-layout" ''
|
|
||||||
if [ "$(hyprctl getoption -j general:layout | ${pkgs.jq}/bin/jq -r .str)" = dwindle ]; then
|
|
||||||
hyprctl keyword general:layout master
|
|
||||||
else
|
|
||||||
hyprctl keyword general:layout dwindle
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.modules.desktop.session.hyprland = {
|
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
|
||||||
enable = lib.mkEnableOption "the Hyprland compositor";
|
|
||||||
|
|
||||||
blur = lib.mkEnableOption ''
|
config = lib.mkIf config.modules.desktop.session.hyprland.enable {
|
||||||
window blur. Off by default as the single biggest battery cost on a
|
|
||||||
laptop, left on for a host with the headroom to spend it'';
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
# This program integration owns the session, portals, and polkit, launched
|
# This program integration owns the session, portals, and polkit, launched
|
||||||
# through the universal Wayland session manager.
|
# through the universal Wayland session manager.
|
||||||
programs.hyprland = {
|
programs.hyprland = {
|
||||||
@@ -44,7 +15,7 @@ in
|
|||||||
withUWSM = true;
|
withUWSM = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${user}.wayland.windowManager.hyprland = {
|
home-manager.users.${config.user.name}.wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
# One package drives the whole session, so there is never a version split.
|
# One package drives the whole session, so there is never a version split.
|
||||||
@@ -56,134 +27,20 @@ in
|
|||||||
# uwsm owns the systemd graphical-session targets.
|
# uwsm owns the systemd graphical-session targets.
|
||||||
systemd.enable = false;
|
systemd.enable = false;
|
||||||
|
|
||||||
# Write the native hyprlang hyprland.conf, whose variable and bind syntax
|
# Write the native Lua Hyprland config. Home Manager renders the Nix
|
||||||
# the settings below are expressed in.
|
# settings below as hl.* calls.
|
||||||
configType = "hyprlang";
|
configType = "lua";
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
"$mod" = "SUPER";
|
config.general.layout = "dwindle";
|
||||||
"$terminal" = "ghostty";
|
|
||||||
|
|
||||||
# Session variables handed to the compositor directly.
|
|
||||||
# UWSM launches the session without the shell profile that would carry
|
|
||||||
# them, so a variable the compositor or its children must see is set
|
|
||||||
# here rather than through home-manager's sessionVariables.
|
|
||||||
env = [
|
|
||||||
# Chromium and Electron apps read this to select native Wayland;
|
|
||||||
# nixpkgs wrappers (Obsidian's included) gate their Wayland flags on
|
|
||||||
# it, so without it they run under XWayland and blur at this DPI.
|
|
||||||
"NIXOS_OZONE_WL,1"
|
|
||||||
]
|
|
||||||
# Bibata ships XCursor only.
|
|
||||||
# The hyprcursor variables name the same theme, which Hyprland
|
|
||||||
# resolves through its XCursor fallback.
|
|
||||||
++ lib.optionals (cursor != null) [
|
|
||||||
"XCURSOR_THEME,${cursor.name}"
|
|
||||||
"XCURSOR_SIZE,${toString cursor.size}"
|
|
||||||
"HYPRCURSOR_THEME,${cursor.name}"
|
|
||||||
"HYPRCURSOR_SIZE,${toString cursor.size}"
|
|
||||||
];
|
|
||||||
|
|
||||||
input = {
|
|
||||||
kb_layout = "us";
|
|
||||||
# Caps is a second Escape.
|
|
||||||
# Shift+Caps still toggles a real CapsLock.
|
|
||||||
kb_options = "caps:escape_shifted_capslock";
|
|
||||||
# Snappy key repeat.
|
|
||||||
repeat_delay = 250;
|
|
||||||
repeat_rate = 45;
|
|
||||||
accel_profile = "flat";
|
|
||||||
touchpad = {
|
|
||||||
natural_scroll = true;
|
|
||||||
tap-to-click = true;
|
|
||||||
disable_while_typing = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
general = {
|
|
||||||
gaps_in = 4;
|
|
||||||
gaps_out = 8;
|
|
||||||
border_size = 2;
|
|
||||||
layout = "dwindle";
|
|
||||||
};
|
|
||||||
|
|
||||||
decoration = {
|
|
||||||
rounding = 6;
|
|
||||||
blur.enabled = cfg.blur;
|
|
||||||
};
|
|
||||||
|
|
||||||
# XWayland clients render at the panel's native resolution instead of
|
|
||||||
# being raster-scaled by the compositor at the fractional monitor scale.
|
|
||||||
xwayland.force_zero_scaling = true;
|
|
||||||
|
|
||||||
animations = {
|
|
||||||
enabled = true;
|
|
||||||
bezier = [ "ease, 0.25, 0.1, 0.25, 1.0" ];
|
|
||||||
# Durations are in centiseconds.
|
|
||||||
# Short values keep the motion subtle.
|
|
||||||
animation = [
|
|
||||||
"windows, 1, 3, ease"
|
|
||||||
"fade, 1, 3, ease"
|
|
||||||
# Layer surfaces like the launcher fade in a touch quicker than windows.
|
|
||||||
"layersIn, 1, 2, ease"
|
|
||||||
"fadeLayersIn, 1, 2, ease"
|
|
||||||
"workspaces, 1, 3, ease"
|
|
||||||
"border, 1, 3, ease"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
dwindle = {
|
|
||||||
preserve_split = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
bind = [
|
bind = [
|
||||||
"$mod, Return, exec, $terminal"
|
{
|
||||||
|
_args = [
|
||||||
# Move focus.
|
"SUPER + Return"
|
||||||
"$mod, H, movefocus, l"
|
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("ghostty")'')
|
||||||
"$mod, J, movefocus, d"
|
];
|
||||||
"$mod, K, movefocus, u"
|
}
|
||||||
"$mod, L, movefocus, r"
|
|
||||||
|
|
||||||
# Move the window within the layout.
|
|
||||||
"$mod SHIFT, H, movewindow, l"
|
|
||||||
"$mod SHIFT, J, movewindow, d"
|
|
||||||
"$mod SHIFT, K, movewindow, u"
|
|
||||||
"$mod SHIFT, L, movewindow, r"
|
|
||||||
|
|
||||||
# Resize the active window.
|
|
||||||
"$mod ALT, H, resizeactive, -40 0"
|
|
||||||
"$mod ALT, J, resizeactive, 0 40"
|
|
||||||
"$mod ALT, K, resizeactive, 0 -40"
|
|
||||||
"$mod ALT, L, resizeactive, 40 0"
|
|
||||||
|
|
||||||
"$mod, Space, togglefloating,"
|
|
||||||
"$mod, F, fullscreen,"
|
|
||||||
# togglesplit is a dwindle layout message, reached through layoutmsg.
|
|
||||||
"$mod, T, layoutmsg, togglesplit"
|
|
||||||
"$mod SHIFT, T, exec, ${toggleLayout}"
|
|
||||||
"$mod SHIFT, Q, killactive,"
|
|
||||||
"$mod CTRL, Q, forcekillactive,"
|
|
||||||
]
|
|
||||||
++ workspaceBinds;
|
|
||||||
|
|
||||||
# Volume and brightness keys repeat while held, each raising a popup
|
|
||||||
# through the OSD client.
|
|
||||||
# Volume is capped at 100 percent.
|
|
||||||
# The client floors brightness so a full hold cannot black the screen out.
|
|
||||||
binde = [
|
|
||||||
", XF86AudioRaiseVolume, exec, ${pkgs.swayosd}/bin/swayosd-client --output-volume raise --max-volume 100"
|
|
||||||
", XF86AudioLowerVolume, exec, ${pkgs.swayosd}/bin/swayosd-client --output-volume lower"
|
|
||||||
", XF86MonBrightnessUp, exec, ${pkgs.swayosd}/bin/swayosd-client --brightness raise"
|
|
||||||
", XF86MonBrightnessDown, exec, ${pkgs.swayosd}/bin/swayosd-client --brightness lower"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Mute and media transport still fire while the session is locked.
|
|
||||||
bindl = [
|
|
||||||
", XF86AudioMute, exec, ${pkgs.swayosd}/bin/swayosd-client --output-volume mute-toggle"
|
|
||||||
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
|
|
||||||
", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next"
|
|
||||||
", XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -85,10 +85,12 @@ in
|
|||||||
# Lock on Super+X.
|
# Lock on Super+X.
|
||||||
# The guard drops the keypress when a locker is already up, so a second
|
# The guard drops the keypress when a locker is already up, so a second
|
||||||
# hyprlock never stacks over the first.
|
# hyprlock never stacks over the first.
|
||||||
|
/*
|
||||||
wayland.windowManager.hyprland.settings.bind = [
|
wayland.windowManager.hyprland.settings.bind = [
|
||||||
"$mod, X, exec, ${pkgs.procps}/bin/pidof hyprlock || ${hyprlock}"
|
"$mod, X, exec, ${pkgs.procps}/bin/pidof hyprlock || ${hyprlock}"
|
||||||
"$mod CTRL, X, exec, ${idleLockToggle}"
|
"$mod CTRL, X, exec, ${idleLockToggle}"
|
||||||
];
|
];
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,11 @@ in
|
|||||||
# Recall the last notification from history, keyboard-only like the rest
|
# Recall the last notification from history, keyboard-only like the rest
|
||||||
# of the session.
|
# of the session.
|
||||||
# $mod is defined by the compositor config these binds share.
|
# $mod is defined by the compositor config these binds share.
|
||||||
|
/*
|
||||||
wayland.windowManager.hyprland.settings.bind = [
|
wayland.windowManager.hyprland.settings.bind = [
|
||||||
"$mod, N, exec, ${makoctl} restore"
|
"$mod, N, exec, ${makoctl} restore"
|
||||||
];
|
];
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,12 @@ in
|
|||||||
|
|
||||||
# The launcher and the session menu, kept next to the tool they drive.
|
# The launcher and the session menu, kept next to the tool they drive.
|
||||||
# $mod is defined by the compositor config these binds share.
|
# $mod is defined by the compositor config these binds share.
|
||||||
|
/*
|
||||||
wayland.windowManager.hyprland.settings.bind = [
|
wayland.windowManager.hyprland.settings.bind = [
|
||||||
"$mod, R, exec, ${pkgs.rofi}/bin/rofi -show drun"
|
"$mod, R, exec, ${pkgs.rofi}/bin/rofi -show drun"
|
||||||
"$mod SHIFT, X, exec, ${powerMenu}"
|
"$mod SHIFT, X, exec, ${powerMenu}"
|
||||||
];
|
];
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,11 @@ in
|
|||||||
services.cliphist.enable = true;
|
services.cliphist.enable = true;
|
||||||
|
|
||||||
# $mod is defined by the compositor config these binds share.
|
# $mod is defined by the compositor config these binds share.
|
||||||
|
/*
|
||||||
wayland.windowManager.hyprland.settings.bind = [
|
wayland.windowManager.hyprland.settings.bind = [
|
||||||
"$mod SHIFT, V, exec, ${picker}"
|
"$mod SHIFT, V, exec, ${picker}"
|
||||||
];
|
];
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,11 @@ in
|
|||||||
config = lib.mkIf config.modules.desktop.utilities.recording.enable {
|
config = lib.mkIf config.modules.desktop.utilities.recording.enable {
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
# $mod is defined by the compositor config these binds share.
|
# $mod is defined by the compositor config these binds share.
|
||||||
|
/*
|
||||||
wayland.windowManager.hyprland.settings.bind = [
|
wayland.windowManager.hyprland.settings.bind = [
|
||||||
"$mod SHIFT, R, exec, ${toggle}"
|
"$mod SHIFT, R, exec, ${toggle}"
|
||||||
];
|
];
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,18 +42,22 @@ in
|
|||||||
# it claim a tile in the layout.
|
# it claim a tile in the layout.
|
||||||
# windowrule v3 syntax: space-separated field/value tokens, comma
|
# windowrule v3 syntax: space-separated field/value tokens, comma
|
||||||
# separated, with matchers under a match: prefix and effects bare.
|
# separated, with matchers under a match: prefix and effects bare.
|
||||||
|
/*
|
||||||
wayland.windowManager.hyprland.settings.windowrule = [
|
wayland.windowManager.hyprland.settings.windowrule = [
|
||||||
"float 1, match:class ^(com\\.gabm\\.satty)$"
|
"float 1, match:class ^(com\\.gabm\\.satty)$"
|
||||||
];
|
];
|
||||||
|
*/
|
||||||
|
|
||||||
# Print with plain/Shift/Ctrl for region/window/full.
|
# Print with plain/Shift/Ctrl for region/window/full.
|
||||||
# Super+L is already the hjkl focus and movement bind, so screenshots take
|
# Super+L is already the hjkl focus and movement bind, so screenshots take
|
||||||
# the Print key instead.
|
# the Print key instead.
|
||||||
|
/*
|
||||||
wayland.windowManager.hyprland.settings.bind = [
|
wayland.windowManager.hyprland.settings.bind = [
|
||||||
", Print, exec, ${capture "area"}"
|
", Print, exec, ${capture "area"}"
|
||||||
"SHIFT, Print, exec, ${capture "active"}"
|
"SHIFT, Print, exec, ${capture "active"}"
|
||||||
"CTRL, Print, exec, ${capture "screen"}"
|
"CTRL, Print, exec, ${capture "screen"}"
|
||||||
];
|
];
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user