Files
nix-config/systems/modules/home/wm/hyprland.nix
2026-04-28 09:11:55 +02:00

157 lines
4.1 KiB
Nix

{ lib, pkgs, config, ... }:
let
cfg = config.home.hyprland;
in
{
options.home.hyprland = {
execOnce = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "waybar" ];
description = "Commands to run once when Hyprland starts (maps to Hyprland `exec-once`).";
};
};
config = {
home.packages = with pkgs; [
bzmenu
hyprshot
hyprlock
playerctl
speedcrunch
];
wayland.windowManager.hyprland = {
enable = true;
settings = {
### MONITOR
monitor = [
"DP-3,1920x1080,auto,1"
",preferred,auto,1"
];
### VARIABLES
"$mod" = "SUPER";
"$terminal" = "kitty";
"$menu" = "rofi -show drun";
"$bluetoothMenu" = "bzmenu --launcher rofi";
"$files" = "rofi -show filebrowser";
### BASIC LAYOUT
general = {
layout = "dwindle";
resize_on_border = true;
};
decoration = {
inactive_opacity = 0.8;
active_opacity = 0.9;
rounding = 5;
rounding_power = 2.5;
blur = {
enabled = true;
brightness = 1.0;
contrast = 1.0;
noise = 0.01;
vibrancy = 0.2;
vibrancy_darkness = 0.5;
passes = 4;
size = 7;
popups = true;
popups_ignorealpha = 0.2;
};
shadow = {
enabled = true;
color = "rgba(00000055)";
ignore_window = true;
offset = "0 15";
range = 100;
render_power = 2;
scale = 0.97;
};
};
# Use the configurable option here (default `[ "waybar" ]`)
exec-once = (if cfg == null then { execOnce = [ "waybar" ]; } else cfg).execOnce;
### INPUT
input = {
kb_layout = "us";
};
### KEYBINDINGS
bind = [
# Apps
"$mod, RETURN, exec, $terminal"
"$mod, D, exec, $menu"
"$mod, B, exec, $bluetoothMenu"
"$mod, G, exec, $files"
"$mod, Q, killactive"
"$mod, F, fullscreen"
"$mod, M, exit"
"$mod, L, exec, hyprlock"
# show/hide waybar
"$mod, W, exec, pkill -SIGUSR1 -f '^waybar$'"
# Focus
"$mod, LEFT, movefocus, l"
"$mod, RIGHT, movefocus, r"
"$mod, UP, movefocus, u"
"$mod, DOWN, movefocus, d"
# Workspaces
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
# Window movement
"$mod SHIFT, LEFT, movewindow, l"
"$mod SHIFT, RIGHT, movewindow, r"
"$mod SHIFT, UP, movewindow, u"
"$mod SHIFT, DOWN, movewindow, d"
# Hyprshot
"$mod, Z, exec, hyprshot -m region"
# Media keys
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86Calculator, exec, speedcrunch"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
};
};
};
}