154 lines
4.2 KiB
Nix
154 lines
4.2 KiB
Nix
{ inputs, config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.samfelag.modules.desktop.wm.hyprland;
|
|
mod = "Mod4";
|
|
in {
|
|
|
|
options.samfelag.modules.desktop.wm.hyprland = with lib; {
|
|
enable = mkEnableOption "hyprland window manager";
|
|
|
|
mod = my.mkOpt' types.str "Mod4" "Main modifier key for hyprland";
|
|
|
|
kb_layout = my.mkOpt' types.str "es" "Keyboard layout(s) for hyprland";
|
|
|
|
extraKeybindings = my.mkOpt (types.listOf types.str) [ ];
|
|
# extraStartup = my.mkOpt (types.listOf types.attrs) [ ];
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
];
|
|
|
|
# - Configuration -----------------------------
|
|
|
|
# Hyprland config
|
|
programs.hyprland = {
|
|
enable = true;
|
|
xwayland.enable = true;
|
|
};
|
|
|
|
hm.wayland.windowManager.hyprland = {
|
|
enable = true;
|
|
xwayland.enable = true;
|
|
|
|
package = pkgs.hyprland;
|
|
# Optional
|
|
# Whether to enable hyprland-session.target on hyprland startup
|
|
systemd.enable = true;
|
|
|
|
plugins = [
|
|
pkgs.hyprlandPlugins.hy3
|
|
];
|
|
|
|
settings = {
|
|
|
|
general = {
|
|
layout = "hy3";
|
|
};
|
|
|
|
env = [
|
|
"HYPRCURSOR_THEME,rose-pine-hyprcursor"
|
|
"HYPRCURSOR_SIZE,24"
|
|
];
|
|
|
|
input = {
|
|
kb_layout = cfg.kb_layout;
|
|
};
|
|
|
|
monitor = ",highres,auto,1";
|
|
|
|
exec-once = [
|
|
"hyprpaper"
|
|
"eww open top-bar"
|
|
];
|
|
|
|
decoration = {
|
|
rounding = 10;
|
|
};
|
|
|
|
gestures = {
|
|
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
|
workspace_swipe = true;
|
|
};
|
|
|
|
bind = [
|
|
|
|
"${cfg.mod}, Q, killactive,"
|
|
|
|
"${cfg.mod}, F, fullscreen, 1"
|
|
"${cfg.mod} SHIFT, F, fullscreen, 0"
|
|
|
|
"${cfg.mod} SHIFT, SPACE, togglefloating"
|
|
|
|
# Move focus
|
|
"${cfg.mod}, left, hy3:movefocus, l"
|
|
"${cfg.mod}, right, hy3:movefocus, r"
|
|
"${cfg.mod}, up, hy3:movefocus, u"
|
|
"${cfg.mod}, down, hy3:movefocus, d"
|
|
|
|
"${cfg.mod}, h, hy3:movefocus, l"
|
|
"${cfg.mod}, l, hy3:movefocus, r"
|
|
"${cfg.mod}, k, hy3:movefocus, u"
|
|
"${cfg.mod}, j, hy3:movefocus, d"
|
|
|
|
# Move focus
|
|
"${cfg.mod} SHIFT, left, hy3:movewindow, l"
|
|
"${cfg.mod} SHIFT, right, hy3:movewindow, r"
|
|
"${cfg.mod} SHIFT, up, hy3:movewindow, u"
|
|
"${cfg.mod} SHIFT, down, hy3:movewindow, d"
|
|
|
|
"${cfg.mod} SHIFT, h, hy3:movewindow, l"
|
|
"${cfg.mod} SHIFT, l, hy3:movewindow, r"
|
|
"${cfg.mod} SHIFT, k, hy3:movewindow, u"
|
|
"${cfg.mod} SHIFT, j, hy3:movewindow, d"
|
|
|
|
# Switch workspace
|
|
"${cfg.mod}, 1, workspace, 1"
|
|
"${cfg.mod}, 2, workspace, 2"
|
|
"${cfg.mod}, 3, workspace, 3"
|
|
"${cfg.mod}, 4, workspace, 4"
|
|
"${cfg.mod}, 5, workspace, 5"
|
|
"${cfg.mod}, 0, workspace, 6"
|
|
|
|
# Move to workspace
|
|
"${cfg.mod} SHIFT, 1, movetoworkspace, 1"
|
|
"${cfg.mod} SHIFT, 2, movetoworkspace, 2"
|
|
"${cfg.mod} SHIFT, 3, movetoworkspace, 3"
|
|
"${cfg.mod} SHIFT, 4, movetoworkspace, 4"
|
|
"${cfg.mod} SHIFT, 5, movetoworkspace, 5"
|
|
"${cfg.mod} SHIFT, 0, movetoworkspace, 6"
|
|
|
|
# - Media ------------------------------
|
|
|
|
# Pulse Audio controls (mute)
|
|
", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
|
|
|
|
# Media player controls
|
|
", XF86AudioPlay, exec, playerctl play-pause"
|
|
", XF86AudioPause, exec, playerctl play-pause"
|
|
", XF86AudioNext, exec, playerctl next"
|
|
", XF86AudioPrev, exec, playerctl previous"
|
|
", XF86AudioStop, exec, playerctl stop"
|
|
|
|
# - Keyboard ---------------------------
|
|
"${cfg.mod}, Escape, exec, hyprctl switchxkblayout current next"
|
|
|
|
] ++ cfg.extraKeybindings;
|
|
|
|
binde = [
|
|
# Pulse Audio controls (volume)
|
|
", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%"
|
|
", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%"
|
|
];
|
|
|
|
bindm = [
|
|
"${cfg.mod}, mouse:272, hy3:movewindow"
|
|
"${cfg.mod} SHIFT, mouse:272, resizewindow 1"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|