dotfiles-nix/nix/users/nicolaivds/wayland/hyprland.nix
2023-10-13 15:56:14 +02:00

228 lines
7.4 KiB
Nix

{
config,
custom ? {
fontsize = "12";
primary_accent = "cba6f7";
secondary_accent = "89b4fa";
tertiary_accent = "f5f5f5";
background = "11111B";
opacity = ".85";
cursor = "Numix-Cursor";
},
inputs,
pkgs,
...
}:
{
wayland.windowManager.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
enableNvidiaPatches = true;
xwayland.enable = true;
systemd.enable = true;
settings = {
"$mainMod" = "SUPER";
monitor = [
"DP-2, 2560x1440@144, 0x0, 1"
];
exec-once = [
"waybar"
"swww init"
''swayidle -w timeout 1800 'swaylock -f -i ${config.home.homeDirectory}/photos/wallpapers/wallpaper.png' timeout 1805 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep "swaylock -f -i ${config.home.homeDirectory}/photos/wallpapers/wallpaper.png"''
"hyprctl setcursor ${custom.cursor} ${custom.fontsize}"
"wl-paste --type text --watch cliphist store &"
"wl-paste --type image --watch cliphist store &"
"swaync"
];
input = {
kb_layout = "be";
follow_mouse = 1;
force_no_accel = 1;
numlock_by_default = true;
sensitivity = 0;
};
general = {
gaps_in = 6;
gaps_out = 10;
border_size = 2;
# "col.active_border" = "rgb(${custom.primary_accent})";
"col.active_border" = "rgba(${custom.palette.tertiary_background_hex}00)";
"col.inactive_border" = "rgba(${custom.background}00)";
#allow_tearing = true;
layout = "dwindle";
};
decoration = {
rounding = 10;
shadow_ignore_window = true;
drop_shadow = true;
shadow_range = 40;
shadow_render_power = 2;
# "col.shadow" = "rgb(${custom.primary_accent})";
"col.shadow" = "rgb(${custom.background})";
"col.shadow_inactive" = "rgba(${custom.background}00)";
blur = {
enabled = false;
size = 6;
passes = 3;
new_optimizations = true;
ignore_opacity = true;
noise = 0.0117;
contrast = 1.2;
xray = false;
brightness = 1;
};
};
animations = {
enabled = true;
bezier = "overshot,0.13,0.99,0.29,1.1";
animation = [
"windows,1,6,overshot,slide"
"border,1,10,default"
"fade,1,10,default"
"workspaces,1,6,overshot,slide"
];
};
dwindle = {
pseudotile = true;
preserve_split = true;
force_split = 2;
};
master = {
new_is_master = true;
};
gestures = {
workspace_swipe = false;
};
misc = {
vfr = true;
vrr = 0;
disable_hyprland_logo = true;
disable_splash_rendering = true;
};
bind = [
# TODO: Look into using special workspace
# Exit to tty
"$mainMod SHIFT, X, exit "
# Launch
"$mainMod, RETURN, exec, foot"
"$mainMod, D, exec, wofi"
''$mainMod,P,exec,mkdir -p ${config.home.homeDirectory}/photos/screenshots; grim -t png -g "$(slurp)" ${config.home.homeDirectory}/photos/screenshots/$(date +%Y-%m-%d_%H-%m-%s).png''
"$mainMod SHIFT,N,exec, swaync-client -t -sw"
"$mainMod,X,exec, wlogout -b 4"
"$mainMod,V,exec, cliphist list | wofi -dmenu | cliphist decode | wl-paste"
# Window Options
"$mainMod SHIFT, P, pseudo"
"$mainMod, S, togglesplit"
"$mainMod, F, fullscreen"
"$mainMod, Space, togglefloating "
"$mainMod, Q, killactive"
# Focus Windows
"$mainMod, H, movefocus, l"
"$mainMod, L, movefocus, r"
"$mainMod, K, movefocus, u"
"$mainMod, J, movefocus, d"
# Move Windows
"$mainMod SHIFT,H,movewindow,l"
"$mainMod SHIFT,L,movewindow,r"
"$mainMod SHIFT,K,movewindow,u"
"$mainMod SHIFT,J,movewindow,d"
# Switch workspaces
"$mainMod, AMPERSAND, workspace, 1"
"$mainMod, EACUTE, workspace, 2"
"$mainMod, QUOTEDBL, workspace, 3"
"$mainMod, APOSTROPHE, workspace, 4"
"$mainMod, PARENLEFT, workspace, 5"
"$mainMod, SECTION, workspace, 6"
"$mainMod, EGRAVE, workspace, 7"
"$mainMod, EXCLAM, workspace, 8"
"$mainMod, CCEDILLA, workspace, 9"
"$mainMod, AGRAVE, workspace, 10"
# Switch active window to workspace
"$mainMod SHIFT, AMPERSAND, movetoworkspace, 1"
"$mainMod SHIFT, EACUTE, movetoworkspace, 2"
"$mainMod SHIFT, QUOTEDBL, movetoworkspace, 3"
"$mainMod SHIFT, APOSTROPHE, movetoworkspace, 4"
"$mainMod SHIFT, PARENLEFT, movetoworkspace, 5"
"$mainMod SHIFT, SECTION, movetoworkspace, 6"
"$mainMod SHIFT, EGRAVE, movetoworkspace, 7"
"$mainMod SHIFT, EXCLAM, movetoworkspace, 8"
"$mainMod SHIFT, CCEDILLA, movetoworkspace, 9"
"$mainMod SHIFT, AGRAVE, movetoworkspace, 10"
# Scroll workspace with mouse scrollwheel
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
];
bindm = [
# Move and resize windows with mouse too
"$mainMod, mouse:272, movewindow"
"$mainMod SHIFT, mouse:272, resizewindow"
];
bindle = [
# Volume Keys
",XF86AudioRaiseVolume,exec,pactl set-sink-volume @DEFAULT_SINK@ +5% "
",XF86AudioLowerVolume,exec,pactl set-sink-volume @DEFAULT_SINK@ -5% "
];
windowrulev2 = [
# "opacity ${custom.opacity} ${custom.opacity},class:^(thunar)$"
# "opacity ${custom.opacity} ${custom.opacity},class:^(WebCord)$"
# "opacity 0.90 0.90,class:^(Brave-browser)$"
# "opacity 0.90 0.90,class:^(brave-browser)$"
# "opacity 0.90 0.90,class:^(firefox)$"
"float,class:^(pavucontrol)$"
"float,class:^(file_progress)$"
"float,class:^(confirm)$"
"float,class:^(dialog)$"
"float,class:^(download)$"
"float,class:^(notification)$"
"float,class:^(error)$"
"float,class:^(confirmreset)$"
"float,title:^(Open File)$"
"float,title:^(branchdialog)$"
"float,title:^(Confirm to replace files)$"
"float,title:^(File Operation Progress)$"
"float,title:^(mpv)$"
"float, title:^(Picture-in-Picture)$"
# Ensure tearing for specific games
# "immediate, class:^(cs2)$"
# "immediate, class:^(love)$"
# "immediate, title:^(Freesync test)$"
];
layerrule = [
"blur, waybar"
"blur, wofi"
"ignorezero, wofi"
];
};
# Submaps
extraConfig = ''
# will switch to a submap called resize
bind=$mainMod,R,submap,resize
# will start a submap called "resize"
submap=resize
# sets repeatable binds for resizing the active window
binde=,L,resizeactive,15 0
binde=,H,resizeactive,-15 0
binde=,K,resizeactive,0 -15
binde=,J,resizeactive,0 15
# use reset to go back to the global submap
bind=,escape,submap,reset
bind=$mainMod,R,submap,reset
# will reset the submap, meaning end the current one and return to the global one
submap=reset
# For tearing
env = WLR_DRM_NO_ATOMIC,1
'';
};
}