Migrate to lua hyprland
This commit is contained in:
Generated
+3
-3
@@ -1479,11 +1479,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1782233665,
|
"lastModified": 1782358560,
|
||||||
"narHash": "sha256-h/xOtrByoA/Ak1lWHn0O1lVZz4qWYbwOSLQ8YSwQO0I=",
|
"narHash": "sha256-vCcLh9pw3XO/+Lxk8r6xv6QnoCrTfGqiACcI7O637Wg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "062581938b4a378a82dfbb294b494808157153a1",
|
"rev": "3a70e333f2950c302e875c44cfcfaff3f80f36bc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -37,9 +37,11 @@ in {
|
|||||||
"hyprland/window"
|
"hyprland/window"
|
||||||
];
|
];
|
||||||
|
|
||||||
"hyprland/workspaces" = {
|
# NOTE: the hyprland/workspaces module is configured in
|
||||||
active-only = true;
|
# ~/.config/waybar/config.json (waybar4.json), which is merged in via
|
||||||
};
|
# `include` and overrides anything set here. "Show only workspaces
|
||||||
|
# with windows" is achieved by disabling persistent workspaces in the
|
||||||
|
# Hyprland split-monitor-workspaces setup, not by a waybar flag.
|
||||||
|
|
||||||
modules-center = [
|
modules-center = [
|
||||||
"clock"
|
"clock"
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ in {
|
|||||||
programs.hyprland = {
|
programs.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
xwayland.enable = true;
|
xwayland.enable = true;
|
||||||
|
# Launch Hyprland via UWSM (Universal Wayland Session Manager). This
|
||||||
|
# automatically enables programs.uwsm and manages the systemd
|
||||||
|
# graphical-session / wayland-session@Hyprland targets and environment.
|
||||||
|
withUWSM = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
@@ -60,194 +64,194 @@ in {
|
|||||||
hypridle
|
hypridle
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# The Hyprland config below is generated as native Lua (Hyprland >= 0.55).
|
||||||
|
# Stylix's hyprland target emits hyprlang-style `settings` (flat dotted
|
||||||
|
# keys like "col.active_border") which do not map cleanly onto the Lua
|
||||||
|
# `hl.config{}` table API, and the previous config already force-overrode
|
||||||
|
# stylix's borders anyway. We therefore disable the stylix hyprland target
|
||||||
|
# and set the colors we care about explicitly in the Lua config.
|
||||||
|
stylix.targets.hyprland.enable = lib.mkForce false;
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
xwayland.enable = true;
|
xwayland.enable = true;
|
||||||
package = null;
|
package = null;
|
||||||
portalPackage = null;
|
portalPackage = null;
|
||||||
configType = "hyprlang";
|
configType = "lua";
|
||||||
|
|
||||||
plugins = [
|
# Required when launching Hyprland through UWSM: UWSM owns the systemd
|
||||||
#inputs.split-monitor-workspaces.packages.${pkgs.stdenv.hostPlatform.system}.split-monitor-workspaces
|
# graphical-session target, so home-manager must not create its own.
|
||||||
];
|
systemd.enable = false;
|
||||||
|
|
||||||
settings = {
|
# split-monitor-workspaces is a Lua package (Hyprland >= 0.55), not a
|
||||||
monitor = ",preferred,auto,1";
|
# C++ plugin: it's require()d in extraConfig, not loaded here.
|
||||||
source = "~/.config/hypr/colors";
|
plugins = [ ];
|
||||||
|
|
||||||
env = [
|
# Whole config written as native Lua. We use `extraConfig` (raw Lua)
|
||||||
"LIBVA_DRIVER_NAME,nvidia"
|
# rather than the `settings` attrset because Lua-mode binds need
|
||||||
"XDG_SESSION_TYPE,wayland"
|
# `hl.dsp.*` dispatcher expressions, a `mainMod` local and a loop for
|
||||||
"WLR_NO_HARDWARE_CURSORS,1"
|
# the workspace binds - none of which the attrset form expresses
|
||||||
];
|
# cleanly ($variables render to invalid `hl.$mainMod(...)`).
|
||||||
|
extraConfig = ''
|
||||||
|
-- Migrated from hyprlang to Lua. See https://wiki.hypr.land/Configuring/Start/
|
||||||
|
local mainMod = "SUPER"
|
||||||
|
|
||||||
#Autostart
|
-- split-monitor-workspaces (Lua package). Use the absolute Nix store
|
||||||
exec = [
|
-- path: Hyprland's cwd is not the config dir, so the relative ./?.lua
|
||||||
# Fix slow startup
|
-- trick from upstream's README does not resolve under UWSM.
|
||||||
"systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
|
package.path = package.path .. ";${inputs.split-monitor-workspaces}/lua/?.lua"
|
||||||
"dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
|
local smw = require("split-monitor-workspaces")
|
||||||
];
|
smw.setup({
|
||||||
|
workspace_count = 10,
|
||||||
|
keep_focused = true,
|
||||||
|
enable_notifications = false,
|
||||||
|
-- Don't pre-create empty workspaces: keeps the waybar workspaces
|
||||||
|
-- module showing only workspaces that actually have windows (plus
|
||||||
|
-- the currently focused one).
|
||||||
|
enable_persistent_workspaces = false,
|
||||||
|
enable_wrapping = true,
|
||||||
|
})
|
||||||
|
|
||||||
exec-once = [
|
-- Monitors (was: monitor = ",preferred,auto,1")
|
||||||
"polkit-kde-agent"
|
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = 1 })
|
||||||
"emacs --fg-daemon"
|
|
||||||
"hypridle"
|
|
||||||
"kanshi"
|
|
||||||
"virsh net-start default"
|
|
||||||
#"thunderbird"
|
|
||||||
#"element-desktop"
|
|
||||||
"keepassxc"
|
|
||||||
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
|
|
||||||
] ++ lib.optionals hm-cfg.bar.waybar.enable [ "waybar" "mako" ];
|
|
||||||
|
|
||||||
"$mainMod" = "SUPER";
|
-- Environment
|
||||||
|
hl.env("LIBVA_DRIVER_NAME", "nvidia")
|
||||||
|
hl.env("XDG_SESSION_TYPE", "wayland")
|
||||||
|
hl.env("WLR_NO_HARDWARE_CURSORS", "1")
|
||||||
|
|
||||||
bind = [
|
-- Config variables
|
||||||
"$mainMod, G, fullscreen,"
|
hl.config({
|
||||||
"$mainMod, t, togglegroup"
|
general = {
|
||||||
"$mainMod, v, togglefloating"
|
gaps_in = 5,
|
||||||
#"$mainMod, s, togglesplit" # invalid dispatcher, requested "togglesplit" does not exist
|
gaps_out = 20,
|
||||||
|
border_size = 2,
|
||||||
|
col = {
|
||||||
|
-- gradient active border (rgba(33ccffee) rgba(00ff99ee) 45deg)
|
||||||
|
active_border = { colors = { "rgba(33ccffee)", "rgba(00ff99ee)" }, angle = 45 },
|
||||||
|
inactive_border = "rgba(595959aa)",
|
||||||
|
},
|
||||||
|
layout = "dwindle",
|
||||||
|
},
|
||||||
|
decoration = {
|
||||||
|
rounding = 10,
|
||||||
|
shadow = { enabled = true, range = 4, render_power = 3 },
|
||||||
|
},
|
||||||
|
input = {
|
||||||
|
kb_layout = "us,ru,ua",
|
||||||
|
kb_options = "grp:win_space_toggle",
|
||||||
|
follow_mouse = 1,
|
||||||
|
touchpad = { natural_scroll = false },
|
||||||
|
sensitivity = 0,
|
||||||
|
},
|
||||||
|
animations = { enabled = true },
|
||||||
|
dwindle = { preserve_split = true },
|
||||||
|
master = { new_status = "master" },
|
||||||
|
})
|
||||||
|
|
||||||
#bind = $mainMod, RETURN, exec, kitty
|
-- Animation curves (was: bezier = ease,0.4,0.02,0.21,1)
|
||||||
"$mainMod, RETURN, exec, alacritty"
|
hl.curve("ease", { type = "bezier", points = { { 0.4, 0.02 }, { 0.21, 1 } } })
|
||||||
"$mainMod, o, exec, emacsclient -c"
|
|
||||||
"SUPER_SHIFT, RETURN, exec, thunar"
|
|
||||||
"SUPER_SHIFT, l, exec, hyprctl switchxkblayout at-translated-set-2-keyboard 0 && hyprlock"
|
|
||||||
|
|
||||||
#bind = $mainMod, M, exit,
|
-- Animations (was: NAME, ONOFF, SPEED, CURVE, [STYLE])
|
||||||
"SUPER_SHIFT, q, killactive,"
|
hl.animation({ leaf = "windows", enabled = true, speed = 3.5, bezier = "ease", style = "slide" })
|
||||||
|
hl.animation({ leaf = "windowsOut", enabled = true, speed = 3.5, bezier = "ease", style = "slide" })
|
||||||
|
hl.animation({ leaf = "border", enabled = true, speed = 6, bezier = "ease" })
|
||||||
|
hl.animation({ leaf = "fade", enabled = true, speed = 3, bezier = "ease" })
|
||||||
|
hl.animation({ leaf = "workspaces", enabled = true, speed = 3.5, bezier = "ease" })
|
||||||
|
|
||||||
# Switch Keyboard Layouts
|
-- Keybinds
|
||||||
"$mainMod, SPACE, exec, hyprctl switchxkblayout teclado-gamer-husky-blizzard next"
|
hl.bind(mainMod .. " + G", hl.dsp.window.fullscreen())
|
||||||
|
hl.bind(mainMod .. " + t", hl.dsp.group.toggle())
|
||||||
|
hl.bind(mainMod .. " + v", hl.dsp.window.float({ action = "toggle" }))
|
||||||
|
|
||||||
'', Print, exec, grim -g "$(slurp)" - | wl-copy''
|
hl.bind(mainMod .. " + RETURN", hl.dsp.exec_cmd("alacritty"))
|
||||||
''
|
hl.bind(mainMod .. " + o", hl.dsp.exec_cmd("emacsclient -c"))
|
||||||
SHIFT, Print, exec, IMG=~/Pictures/$(date +%Y-%m-%d_%H-%m-%s).png && grim -g "$(slurp)" $IMG''
|
hl.bind("SUPER + SHIFT + RETURN", hl.dsp.exec_cmd("thunar"))
|
||||||
|
hl.bind("SUPER + SHIFT + l", hl.dsp.exec_cmd("hyprctl switchxkblayout at-translated-set-2-keyboard 0 && hyprlock"))
|
||||||
|
hl.bind("SUPER + SHIFT + q", hl.dsp.window.close())
|
||||||
|
|
||||||
# Functional keybinds
|
-- Switch keyboard layouts
|
||||||
",XF86AudioMicMute,exec,pamixer --default-source -t"
|
hl.bind(mainMod .. " + SPACE", hl.dsp.exec_cmd("hyprctl switchxkblayout teclado-gamer-husky-blizzard next"))
|
||||||
",XF86MonBrightnessDown,exec,brightnessctl s 20-"
|
|
||||||
",XF86MonBrightnessUp,exec,brightnessctl s 20+"
|
|
||||||
",XF86AudioMute,exec,amixer -q sset Master toggle"
|
|
||||||
",XF86AudioLowerVolume,exec,amixer -q sset Master 5%-"
|
|
||||||
",XF86AudioRaiseVolume,exec,amixer -q sset Master 5%+"
|
|
||||||
",XF86AudioPlay,exec,playerctl play-pause"
|
|
||||||
",XF86AudioPause,exec,playerctl play-pause"
|
|
||||||
|
|
||||||
# to switch between windows in a floating workspace
|
-- Screenshots
|
||||||
"SUPER,Tab,changegroupactive, f"
|
hl.bind("Print", hl.dsp.exec_cmd([[grim -g "$(slurp)" - | wl-copy]]))
|
||||||
"SUPER_SHIFT,Tab,changegroupactive, b"
|
hl.bind("SHIFT + Print", hl.dsp.exec_cmd([[IMG=~/Pictures/$(date +%Y-%m-%d_%H-%m-%s).png && grim -g "$(slurp)" $IMG]]))
|
||||||
|
|
||||||
# Move focus with mainMod + arrow keys
|
-- Functional / media keys
|
||||||
"$mainMod, h, movefocus, l"
|
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("pamixer --default-source -t"))
|
||||||
"$mainMod, l, movefocus, r"
|
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl s 20-"))
|
||||||
"$mainMod, k, movefocus, u"
|
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl s 20+"))
|
||||||
"$mainMod, j, movefocus, d"
|
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("amixer -q sset Master toggle"))
|
||||||
|
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("amixer -q sset Master 5%-"))
|
||||||
|
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("amixer -q sset Master 5%+"))
|
||||||
|
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"))
|
||||||
|
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"))
|
||||||
|
|
||||||
# Switch workspaces with mainMod + [0-9]
|
-- Switch between windows in a floating workspace (changegroupactive)
|
||||||
"$mainMod, 1, workspace, 1"
|
hl.bind("SUPER + Tab", hl.dsp.group.next())
|
||||||
"$mainMod, 2, workspace, 2"
|
hl.bind("SUPER + SHIFT + Tab", hl.dsp.group.prev())
|
||||||
"$mainMod, 3, workspace, 3"
|
|
||||||
"$mainMod, 4, workspace, 4"
|
|
||||||
"$mainMod, 5, workspace, 5"
|
|
||||||
"$mainMod, 6, workspace, 6"
|
|
||||||
"$mainMod, 7, workspace, 7"
|
|
||||||
"$mainMod, 8, workspace, 8"
|
|
||||||
"$mainMod, 9, workspace, 9"
|
|
||||||
"$mainMod, 0, workspace, 10"
|
|
||||||
|
|
||||||
# Move active window to a workspace with mainMod + SHIFT + [0-9]
|
-- Move focus
|
||||||
"$mainMod SHIFT, 1, movetoworkspace, 1"
|
hl.bind(mainMod .. " + h", hl.dsp.focus({ direction = "left" }))
|
||||||
"$mainMod SHIFT, 2, movetoworkspace, 2"
|
hl.bind(mainMod .. " + l", hl.dsp.focus({ direction = "right" }))
|
||||||
"$mainMod SHIFT, 3, movetoworkspace, 3"
|
hl.bind(mainMod .. " + k", hl.dsp.focus({ direction = "up" }))
|
||||||
"$mainMod SHIFT, 4, movetoworkspace, 4"
|
hl.bind(mainMod .. " + j", hl.dsp.focus({ direction = "down" }))
|
||||||
"$mainMod SHIFT, 5, movetoworkspace, 5"
|
|
||||||
"$mainMod SHIFT, 6, movetoworkspace, 6"
|
|
||||||
"$mainMod SHIFT, 7, movetoworkspace, 7"
|
|
||||||
"$mainMod SHIFT, 8, movetoworkspace, 8"
|
|
||||||
"$mainMod SHIFT, 9, movetoworkspace, 9"
|
|
||||||
"$mainMod SHIFT, 0, movetoworkspace, 10"
|
|
||||||
|
|
||||||
# Scroll through existing workspaces with mainMod + scroll
|
-- Workspaces 1-10 (per-monitor): key 0 -> workspace 10
|
||||||
"$mainMod, mouse_down, workspace, e+1"
|
for i = 1, smw.get_amount_of_workspaces() do
|
||||||
"$mainMod, mouse_up, workspace, e-1"
|
local key = tostring(i)
|
||||||
"$mainMod,SPACE, exec, hyprctl switchxkblayout at-translated-set-2-keyboard next"
|
if key == "10" then key = "0" end
|
||||||
|
hl.bind(mainMod .. " + " .. key, smw.workspace(tostring(i)))
|
||||||
|
hl.bind(mainMod .. " + SHIFT + " .. key, smw.move_to_workspace_silent(tostring(i)))
|
||||||
|
end
|
||||||
|
|
||||||
] ++ lib.optionals hm-cfg.launcher.wofi.enable
|
-- Scroll through workspaces with mainMod + scroll
|
||||||
[ "$mainMod, p, exec, wofi --show drun" ];
|
hl.bind(mainMod .. " + mouse_down", smw.cycle_workspaces("next"))
|
||||||
|
hl.bind(mainMod .. " + mouse_up", smw.cycle_workspaces("prev"))
|
||||||
|
|
||||||
bindm = [
|
-- NOTE: pre-existing duplicate SUPER+SPACE bind (last one wins,
|
||||||
"$mainMod, mouse:272, movewindow"
|
-- identical to the original hyprlang config).
|
||||||
"$mainMod, mouse:273, resizewindow"
|
hl.bind(mainMod .. " + SPACE", hl.dsp.exec_cmd("hyprctl switchxkblayout at-translated-set-2-keyboard next"))
|
||||||
"ALT, mouse:272, resizewindow"
|
''
|
||||||
];
|
+ lib.optionalString hm-cfg.launcher.wofi.enable ''
|
||||||
|
hl.bind(mainMod .. " + p", hl.dsp.exec_cmd("wofi --show drun"))
|
||||||
|
''
|
||||||
|
+ ''
|
||||||
|
|
||||||
input = {
|
-- Mouse binds (was: bindm)
|
||||||
kb_layout = "us,ru,ua";
|
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||||
kb_options = "grp:win_space_toggle";
|
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||||
|
hl.bind("ALT + mouse:272", hl.dsp.window.resize(), { mouse = true })
|
||||||
|
|
||||||
follow_mouse = 1;
|
-- Workspace rules
|
||||||
|
hl.workspace_rule({ workspace = "8", monitor = "eDP-1" })
|
||||||
|
hl.workspace_rule({ workspace = "9", monitor = "eDP-1" })
|
||||||
|
|
||||||
touchpad = { natural_scroll = false; };
|
-- Window rules
|
||||||
|
hl.window_rule({ match = { title = "^(.*KeePassXC.*)$" }, workspace = "8" })
|
||||||
|
|
||||||
sensitivity = 0;
|
-- Autostart (was: exec-once). UWSM imports the session environment,
|
||||||
};
|
-- so the old systemctl/dbus import-environment lines are dropped.
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
general = {
|
hl.exec_cmd("polkit-kde-agent")
|
||||||
gaps_in = 5;
|
hl.exec_cmd("emacs --fg-daemon")
|
||||||
gaps_out = 20;
|
hl.exec_cmd("hypridle")
|
||||||
border_size = 2;
|
hl.exec_cmd("kanshi")
|
||||||
"col.active_border" =
|
hl.exec_cmd("virsh net-start default")
|
||||||
lib.mkForce "rgba(33ccffee) rgba(00ff99ee) 45deg";
|
hl.exec_cmd("keepassxc")
|
||||||
"col.inactive_border" = lib.mkForce "rgba(595959aa)";
|
''
|
||||||
|
+ lib.optionalString hm-cfg.bar.waybar.enable ''
|
||||||
layout = "dwindle";
|
hl.exec_cmd("waybar")
|
||||||
};
|
hl.exec_cmd("mako")
|
||||||
|
''
|
||||||
decoration = {
|
+ ''
|
||||||
rounding = 10;
|
end)
|
||||||
|
'';
|
||||||
shadow = {
|
|
||||||
enabled = true;
|
|
||||||
range = 4;
|
|
||||||
render_power = 3;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
animations = {
|
|
||||||
enabled = "yes";
|
|
||||||
|
|
||||||
bezier = "ease,0.4,0.02,0.21,1";
|
|
||||||
|
|
||||||
animation = [
|
|
||||||
"windows, 1, 3.5, ease, slide"
|
|
||||||
"windowsOut, 1, 3.5, ease, slide"
|
|
||||||
"border, 1, 6, default"
|
|
||||||
"fade, 1, 3, ease"
|
|
||||||
"workspaces, 1, 3.5, ease"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
dwindle = {
|
|
||||||
preserve_split = "yes";
|
|
||||||
};
|
|
||||||
|
|
||||||
master = { new_status = "master"; };
|
|
||||||
|
|
||||||
workspace = [
|
|
||||||
#"0, monitor:DP-1"
|
|
||||||
"8, monitor:eDP-1"
|
|
||||||
"9, monitor:eDP-1"
|
|
||||||
#"9, on-created-empty:[tiled] thunderbird"
|
|
||||||
];
|
|
||||||
|
|
||||||
windowrule = [
|
|
||||||
"workspace 8, match:title ^(.*KeePassXC.*)$"
|
|
||||||
#"noinitialfocus,match:class (jetbrains-)(.*),title:^win(.*), initialTitle:win.*, floating:1"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Stylix base16 palette exported as hyprlang variables. No longer sourced
|
||||||
|
# from the main Lua config (Lua has no `source`); kept for reference and
|
||||||
|
# for any hyprlang consumer that wants to source it.
|
||||||
home.file.".config/hypr/colors".text = ''
|
home.file.".config/hypr/colors".text = ''
|
||||||
$background = ${colors.base00}
|
$background = ${colors.base00}
|
||||||
$foreground = ${colors.base05}
|
$foreground = ${colors.base05}
|
||||||
@@ -272,6 +276,8 @@ in {
|
|||||||
|
|
||||||
xdg.configFile."hypr/hyprlock.conf".source = ./hyprlock.conf;
|
xdg.configFile."hypr/hyprlock.conf".source = ./hyprlock.conf;
|
||||||
xdg.configFile."hypr/hypridle.conf".source = ./hypridle.conf;
|
xdg.configFile."hypr/hypridle.conf".source = ./hypridle.conf;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user