feat(hypr): update config with latest variables from hyprland
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-06-15 01:40:26 -04:00
parent eea2b60b91
commit ecbabde0bd
4 changed files with 73 additions and 46 deletions

View file

@ -8,8 +8,15 @@
inherit (lib) concatStringsSep optionals; inherit (lib) concatStringsSep optionals;
inherit (config.vars) mainUser; inherit (config.vars) mainUser;
cfg = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland;
isTouchscreen = config.hardware.sensor.iio.enable; isTouchscreen = config.hardware.sensor.iio.enable;
cfg =
config
.home-manager
.users
.${mainUser}
.wayland
.windowManager
.hyprland;
in { in {
# SYSTEM CONFIG # SYSTEM CONFIG
imports = [ imports = [
@ -19,11 +26,6 @@ in {
./security.nix ./security.nix
]; ];
environment.sessionVariables = {
GTK_USE_PORTAL = "1";
NIXOS_OZONE_WL = "1";
};
services = { services = {
dbus.enable = true; dbus.enable = true;
gvfs.enable = true; gvfs.enable = true;
@ -31,12 +33,14 @@ in {
xserver.wacom.enable = isTouchscreen; xserver.wacom.enable = isTouchscreen;
}; };
programs.hyprland = let programs.hyprland = {
inherit (hyprland.packages.${pkgs.system}) xdg-desktop-portal-hyprland;
in {
enable = true; enable = true;
package = cfg.finalPackage; package = cfg.finalPackage;
portalPackage = xdg-desktop-portal-hyprland; portalPackage =
hyprland
.packages
.${pkgs.system}
.xdg-desktop-portal-hyprland;
}; };
xdg.portal = { xdg.portal = {
@ -51,7 +55,10 @@ in {
"hyprland" "hyprland"
"gtk" "gtk"
]; ];
"org.freedesktop.impl.portal.FileChooser" = ["kde"];
"org.freedesktop.impl.portal.FileChooser" = [
"kde"
];
}; };
}; };
@ -66,27 +73,35 @@ in {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
package = hyprland.packages.${pkgs.system}.default; package =
hyprland
.packages
.${pkgs.system}
.default;
systemd.variables = ["-all"]; systemd.variables = ["-all"];
settings = { settings = {
env = let envd = let
gset = pkgs.gsettings-desktop-schemas; mkGSchemas = pkg: "${pkg}/share/gsettings-schemas/${pkg.name}";
in in
[ [
"GTK_USE_PORTAL, 1"
"NIXOS_OZONE_WL, 1"
"ELECTRON_OZONE_PLATFORM_HINT, auto"
"XDG_DATA_DIRS, ${concatStringsSep ":" [ "XDG_DATA_DIRS, ${concatStringsSep ":" [
"${gset}/share/gsettings-schemas/${gset.name}" (mkGSchemas pkgs.gsettings-desktop-schemas)
"${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" (mkGSchemas pkgs.gtk3)
"$XDG_DATA_DIRS" "$XDG_DATA_DIRS"
]}" ]}"
] ]
++ (optionals config.nvidia.enable [ ++ (optionals config.nvidia.enable [
"LIBVA_DRIVER_NAME, nvidia" "LIBVA_DRIVER_NAME, nvidia"
"NVD_BACKEND, direct"
"XDG_SESSION_TYPE, wayland" "XDG_SESSION_TYPE, wayland"
"GBM_BACKEND, nvidia-drm" "GBM_BACKEND, nvidia-drm"
"__GLX_VENDOR_LIBRARY_NAME, nvidia" "__GLX_VENDOR_LIBRARY_NAME, nvidia"
"WLR_NO_HARDWARE_CURSORS, 1"
]); ]);
xwayland.force_zero_scaling = true; xwayland.force_zero_scaling = true;
@ -113,19 +128,13 @@ in {
]) ])
]; ];
gestures = {
workspace_swipe = true;
workspace_swipe_fingers = 3;
workspace_swipe_cancel_ratio = 0.15;
};
"$mainMod" = "SUPER"; "$mainMod" = "SUPER";
bind = [ bind = [
# Defaults # Defaults
"$mainMod, F, fullscreen" "$mainMod, F, fullscreen"
"$mainMod, C, killactive, " "$mainMod, C, killactive"
"$mainMod SHIFT, SPACE, togglefloating, " "$mainMod SHIFT, SPACE, togglefloating"
"$mainMod, J, layoutmsg, togglesplit" "$mainMod, J, layoutmsg, togglesplit"
## Move focus with arrow keys ## Move focus with arrow keys
@ -176,6 +185,7 @@ in {
misc = { misc = {
disable_hyprland_logo = true; disable_hyprland_logo = true;
disable_splash_rendering = true; disable_splash_rendering = true;
initial_workspace_tracking = 2; # persistent (all children too)
vfr = true; vfr = true;
}; };

View file

@ -1,9 +1,4 @@
{ {osConfig, ...}: let
lib,
osConfig,
...
}: let
inherit (lib) optionals;
inherit (osConfig.services.xserver) xkb; inherit (osConfig.services.xserver) xkb;
inherit (osConfig.vars) mainMonitor; inherit (osConfig.vars) mainMonitor;
@ -11,7 +6,7 @@
"logitech-g502-x" "logitech-g502-x"
"logitech-g502-hero-gaming-mouse" "logitech-g502-hero-gaming-mouse"
]; ];
nagaConf = name: { mkConf = name: {
inherit name; inherit name;
sensitivity = 0; sensitivity = 0;
accel_profile = "flat"; accel_profile = "flat";
@ -19,29 +14,49 @@
in { in {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
settings = { settings = {
device = map (d: (nagaConf d)) miceNames; device = map (d: (mkConf d)) miceNames;
cursor = {
no_hardware_cursors = osConfig.nvidia.enable;
hide_on_touch = true;
default_monitor =
if mainMonitor != null
then mainMonitor
else "";
};
input = { input = {
# Keyboard
kb_layout = xkb.layout; kb_layout = xkb.layout;
kb_variant = xkb.variant; kb_variant = xkb.variant;
numlock_by_default = true;
repeat_rate = 100;
# Mouse
follow_mouse = true; follow_mouse = true;
# Touchpad
touchpad = { touchpad = {
natural_scroll = true; natural_scroll = true;
disable_while_typing = false; disable_while_typing = false;
drag_lock = true;
tap-and-drag = true;
}; };
}; };
gestures = {
workspace_swipe = true;
workspace_swipe_fingers = 3;
workspace_swipe_touch = true;
workspace_swipe_cancel_ratio = 0.15;
};
bind = [ bind = [
",XF86AudioPlay, exec, playerctl play-pause" ",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioStop, exec, playerctl stop" ",XF86AudioStop, exec, playerctl stop"
",XF86AudioNext, exec, playerctl next" ",XF86AudioNext, exec, playerctl next"
",XF86AudioPrev, exec, playerctl previous" ",XF86AudioPrev, exec, playerctl previous"
]; ];
exec-once =
optionals (! isNull mainMonitor)
["hyprctl dispatch focusmonitor ${mainMonitor}"];
}; };
}; };
} }

View file

@ -8,7 +8,7 @@ in {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
settings = { settings = {
env = ["XCURSOR_SIZE, 24"]; envd = ["XCURSOR_SIZE, 24"];
exec-once = [ exec-once = [
"hyprctl setcursor Dracula-cursors 24" "hyprctl setcursor Dracula-cursors 24"

View file

@ -60,7 +60,7 @@ in {
finegrained = false; finegrained = false;
}; };
open = cfg.enableWayland; open = false;
package = package =
if !cfg.enableWayland if !cfg.enableWayland
@ -87,6 +87,8 @@ in {
vdpauinfo vdpauinfo
]); ]);
boot.kernelModules = optionals cfg.enableCUDA ["nvidia-uvm"]; boot.kernelModules =
optionals cfg.enableCUDA ["nvidia-uvm"]
++ ["nvidia" "nvidia-drm"];
}; };
} }