config.nix/modules/desktop/hyprland.nix

192 lines
6.1 KiB
Nix

{
config,
lib,
pkgs,
inputs,
...
}:
{
options = {
desktop = {
hyprland = {
enable = lib.mkEnableOption "enable hyprland";
monitors = lib.mkOption {
default = [
",preferred,auto,1"
];
description = ''declare monitors'';
};
workspaces = {
workspaces = lib.mkOption {
default = (
builtins.concatLists (
builtins.genList (
i:
let
ws = i + 1;
in
[
"name:${toString i},,persistent:true"
]
) config.desktop.hyprland.workspaces.amount
)
);
description = ''declare workspace'';
};
amount = lib.mkOption {
default = 9;
description = ''declare workspace amount'';
};
};
numlock = lib.mkEnableOption "numlock by default";
};
};
};
config = lib.mkIf config.desktop.hyprland.enable {
xdg.portal = {
enable = true;
configPackages = [
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland
];
extraPortals = [
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland
];
};
programs = {
hyprlock = {
enable = true;
};
};
wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
systemd.enable = true;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage =
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
settings = {
monitor = config.desktop.hyprland.monitors;
workspace = config.desktop.hyprland.workspaces.workspaces;
exec-once = [
"hyprctl plugin load "
(lib.mkIf (config.desktop.walker.enable) "elephant")
(lib.mkIf (config.desktop.waybar.enable) "waybar")
(lib.mkIf (config.desktop.wallpaper.enable) "waypaper --restore --random")
];
"$mod" = "SUPER";
"$shiftmod" = "SUPER_SHIFT";
"$controlmod" = "SUPER_CTRL";
bind = [
(lib.mkIf (config.desktop.walker.enable) "$mod, D, exec, walker")
(lib.mkIf (config.desktop.rofi.enable) "$mod, D, exec, rofi -show drun")
(lib.mkIf (config.terminal.kitty.enable) "$mod, return, exec, kitty")
(lib.mkIf (config.desktop.grimblast.enable) ", print, exec, GRIMBLAST_EDITOR=gradia grimblast edit area")
(lib.mkIf (config.desktop.rofi.enable) (
lib.mkIf (config.misc.bitwarden.enable) "$mod, B, exec, rbw unlocked || kitty --class kitty-floating -e rbw unlock; rofi-rbw"
))
(lib.mkIf (config.desktop.walker.enable) (
lib.mkIf (config.misc.bitwarden.enable) "$mod, B, exec, rbw unlocked || kitty --class kitty-floating -e rbw unlock; selected=$(rbw list | walker -d); wl-copy $(rbw get \"$selected\")"
))
"$mod, F, fullscreen, 1"
"$shiftmod, F, fullscreen, 0"
"$shiftmod, Q, killactive,"
"$mod, S, togglespecialworkspace, magic"
"$mod, O, exec, zen"
"$shiftmod, S, movetoworkspace, special:magic"
"$controlmod, right, workspace, m-1"
"$controlmod, left, workspace, m+1"
"$mod, mouse_down, workspace, m-1"
"$mod, mouse_up, workspace, m+1"
"$mod, left, movefocus, l"
"$mod, right, movefocus, r"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"
"$mod, J, exec, playerctl previous"
"$mod, K, exec, playerctl play-pause"
"$mod, L, exec, playerctl, next"
"$mod, G, togglefloating,"
# "$mod, H, hyprexpo:expo, toggle"
"$mod, F1, exec, hyprlock"
"$shiftmod, E, exec, codium"
"$controlmod, up, exec, light -A 10"
"$controlmod, down, exec, light -U 10"
"$controlmod, Q, exec, hyprctl kill"
]
++ (builtins.concatLists (
builtins.genList (
i:
let
ws = i + 1;
in
[
"$mod, code:1${toString i}, workspace, ${toString ws}"
"$shiftmod, code:1${toString i}, movetoworkspacesilent, ${toString ws}"
]
) config.desktop.hyprland.workspaces.amount
));
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
bindel = [
",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
];
input = {
kb_layout = "de";
numlock_by_default = config.desktop.hyprland.numlock;
follow_mouse = 2;
mouse_refocus = false;
accel_profile = "flat";
sensitivity = 0.2;
touchpad = {
natural_scroll = "no";
disable_while_typing = true;
};
};
cursor = {
inactive_timeout = 0;
no_warps = true;
};
decoration = {
rounding = 20;
blur = {
enabled = true;
size = 3;
passes = 1;
};
shadow = {
range = 4;
render_power = 3;
color = "rgba(1a1a1aee)";
};
};
plugin = {
hyprexpo = {
columns = 3;
gap_size = 20;
bg_col = "rgb(e1e1e2)";
workspace_method = "first 1";
enable_gesture = true;
gesture_distance = 300;
gesture_positive = true;
gesture_negative = true;
};
hyprtrails = {
color = "rgba(1a1a1aee)";
};
};
};
plugins = [
inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprtrails
inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprexpo
];
};
home.sessionVariables.NIXOS_OZONE_WL = "1";
};
}