dotnix/modules/home/hyprland/hyprland.nix
2025-03-29 19:05:05 +01:00

161 lines
5.1 KiB
Nix

{ host, profile, config, pkgs, ... }:
let
inherit
(import ../../../hosts/${host}/variables.nix)
extraMonitorSettings
keyboardLayout
stylixImage
;
in
{
home.packages = with pkgs; [
swww
grim
slurp
wl-clipboard
swappy
hyprpolkitagent
hyprland-qtutils
];
systemd.user.targets.hyprland-session.Unit.Wants = [
"xdg-desktop-autostart.target"
];
home.file = {
"Pictures/Wallpapers" = {
source = ../../../wallpapers;
recursive = true;
};
};
wayland.windowManager.hyprland = {
enable = true;
package = pkgs.hyprland;
systemd = {
enable = true;
enableXdgAutostart = true;
variables = [ "--all" ];
};
xwayland.enable = true;
settings = {
exec-once = [
"dbus-update-activation-environment --all --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
"systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
"systemctl --user start hyprpolkitagent"
"killall -q swww; sleep .5 && swww init"
"killall -q waybar; sleep .5 && waybar"
"nm-applet --indicator"
"sleep 1.5 && swww img ${stylixImage}"
];
input = {
kb_layout = "${keyboardLayout}";
numlock_by_default = true;
repeat_delay = 300;
follow_mouse = 1;
float_switch_override_focus = 0;
sensitivity = -0.5;
touchpad = {
natural_scroll = true;
disable_while_typing = true;
scroll_factor = 0.8;
};
};
gestures = {
workspace_swipe = 1;
workspace_swipe_fingers = 3;
workspace_swipe_distance = 500;
workspace_swipe_invert = 1;
workspace_swipe_min_speed_to_force = 30;
workspace_swipe_cancel_ratio = 0.5;
workspace_swipe_create_new = 1;
workspace_swipe_forever = 1;
};
general = {
"$modifier" = "SUPER";
layout = "dwindle";
gaps_in = 6;
gaps_out = 8;
border_size = 2;
resize_on_border = true;
"col.active_border" = "rgb(${config.lib.stylix.colors.base08}) rgb(${config.lib.stylix.colors.base0C}) 45deg";
"col.inactive_border" = "rgb(${config.lib.stylix.colors.base01})";
};
misc = {
layers_hog_keyboard_focus = true;
initial_workspace_tracking = 0;
disable_hyprland_logo = true;
disable_splash_rendering = true;
#disable_swallow = false;
};
dwindle = {
pseudotile = true;
preserve_split = true;
};
decoration = {
rounding = 10;
blur = {
enabled = true;
size = 5;
passes = 3;
ignore_opacity = false;
new_optimizations = true;
};
shadow = {
enabled = true;
range = 4;
render_power = 3;
color = "rgba(1a1a1aee)";
};
};
cursor = {
sync_gsettings_theme = true;
no_hardware_cursors = 1;
enable_hyprcursor = false;
warp_on_change_workspace = 2;
no_warps = true;
};
render = {
explicit_sync = 1; # 1 = disable
explicit_sync_kms = 1;
direct_scanout = 0;
};
master = {
new_status = "master";
new_on_top = 1;
mfact = 0.5;
};
env = [
"NIXOS_OZONE_WL, 1"
"NIXPKGS_ALLOW_UNFREE, 1"
"XDG_CURRENT_DESKTOP, Hyprland"
"XDG_SESSION_TYPE, wayland"
"XDG_SESSION_DESKTOP, Hyprland"
"GDK_BACKEND, wayland, x11"
"CLUTTER_BACKEND, wayland"
"QT_QPA_PLATFORM=wayland;xcb"
"QT_WAYLAND_DISABLE_WINDOWDECORATION, 1"
"QT_AUTO_SCREEN_SCALE_FACTOR, 1"
"SDL_VIDEODRIVER, wayland"
"MOZ_ENABLE_WAYLAND, 1"
"AQ_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1"#,/dev/dri/card1:/dev/dri/card0"
"GDK_SCALE,1"
"QT_SCALE_FACTOR,1"
"EDITOR,vim"
"WLR_NO_HARDWARE_CURSORS,1"
]; #++ (if profile == "nvidia" || profile == "nvidia-laptop" then [ "LIBVA_DRIVER_NAME,nvidia" "__GLX_VENDOR_LIBRARY_NAME,nvidia" ] else []); #++ (if profile == "nvidia" || profile == "nvidia-laptop" then [ "LIBVA_DRIVER_NAME,nvidia" "GBM_BACKEND,nvidia-drm" "WLR_DRM_NO_ATOMIC,1" "__GLX_VENDOR_LIBRARY_NAME,nvidia" "__NV_PRIME_RENDER_OFFLOAD,1" "__VK_LAYER_NV_optimus,NVIDIA_onky" "WLR_NO_HARDWARE_CURSORS,1" "WLR_RENDERER_ALLOW_SOFTWARE,1" "MOZ_DISABLE_RDD_SANDBOX,1" "EGL_PLATFORM,wayland" ] else []);
};
extraConfig = if extraMonitorSettings == "" then "monitor=,preferred,auto,auto" else "${extraMonitorSettings}";
#extraConfig = "opengl { nvidia_anti_flicker=false }";
#extraConfig = "" + (if extraMonitorSettings == "" then "monitor=,preferred,auto,auto" else "${extraMonitorSettings}") + (if profile == "nvidia" || profile == "nvidia-laptop" then "opengl { nvidia_anti_flicker=false }" else "");
#extraConfig = "" + (if extraMonitorSettings == "" then "monitor=,preferred,auto,auto" else "${extraMonitorSettings}") + (if profile == "nvidia" || profile == "nvidia-laptop" then "cursor { no_hardware_cursors = true }" else "");
};
}