nixos-configuration/modules/window-managers/hyprland/default.nix

182 lines
4.2 KiB
Nix
Executable file

{ monitors ? []
, border-radius ? 0
}:
{ lib, pkgs, inputs, config, ... } @ params:
{
imports = [
./exec.nix
./env.nix
];
# programs.alacritty.enable = lib.mkDefault true;
wayland.windowManager.hyprland =
let
pluginsNix = (import ./plugins.nix params);
inherit (pluginsNix) plugins;
in
{
enable = true;
# plugins = plugins;
settings = {
autogenerated = false;
# monitor = [
# "eDP-1, 1920x1080@60, auto, 1"
# ];
monitor = monitors;
general = {
gaps_in = 5;
gaps_out = 10;
};
input = {
kb_layout = "us";
follow_mouse = true;
# Maps capslock to escape
kb_options = "caps:escape";
sensitivity = 0.3;
accel_profile = "flat";
touchpad.natural_scroll = true;
};
master = {
new_status = "master";
};
animations = {
enabled = true;
bezier = [
"myBezier, 0.05, 0.9, 0.1, 1.05"
];
animation = [
"windows, 1, 7, myBezier"
"windowsOut, 1, 7, default, popin 80%"
"border, 1, 10, default"
"borderangle, 1, 8, default"
"fade, 1, 7, default"
"workspaces, 1, 6, default"
];
};
gestures = {
workspace_swipe = true;
};
cursor = {
no_hardware_cursors = true;
};
misc = {
vfr = true;
# begone satan, why is this so fucking hard to disable 99% of the time
middle_click_paste = false;
};
decoration = {
blur.enabled = false;
rounding = border-radius;
};
binds = {
workspace_back_and_forth = true;
disable_keybind_grabbing = true;
};
# screencopy = {
# allow_token_by_default = true;
# };
# Set mod key
"$mod" = "super";
bind = [
"$mod, Return, exec, ${config.home.sessionVariables.TERMCMD}"
"$mod, C, killactive"
"$mod, V, togglefloating"
"$mod, G, fullscreen"
"$mod, D, exec, tofi-drun | bash"
"$mod, F, exec, ${pkgs.writeScriptBin "run_anything.sh" ''
package=$(echo "" | tofi --require-match=false --prompt-text=", " --height=35);
if [[ -z "$package" ]]; then
exit 1;
fi
notify-send "Running $package";
error=$(, -P tofi $package 2>&1)
if [ $? -ne 0 ]; then
notify-send "Error with $package" "$error"
fi
''}/bin/run_anything.sh"
"$mod SHIFT, S, exec, grimblast --freeze copy area"
"$mod SHIFT, Q, exec, hyprctl kill"
"$mod, L, exec, hyprlock"
] ++ (
# Auto generate workspace switching from [0-9] and shift + [0-9]
builtins.concatLists (builtins.genList
(
x:
let
ws =
let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in
[
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
]
)
10)
);
# XF86AudioMedia
# XF86AudioPrev
# XF86AudioNext
# XF86AudioPlay
# XF86AudioStop
binde = [
# Volume keys
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_SINK@ toggle"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioNext, exec, playerctl next"
", XF86MonBrightnessUp, exec, brightnessctl s 5%+"
", XF86MonBrightnessDown, exec, brightnessctl s 5%-"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
windowrulev2 = [
"pin, initialClass:^(zen-alpha)$, initialTitle:^(Zen)$"
];
};
extraConfig = ''
''
# + (import ./plugins.nix { inherit pkgs; inherit inputs; }).pluginConfig
;
};
}