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

View file

@ -1,9 +1,4 @@
{
lib,
osConfig,
...
}: let
inherit (lib) optionals;
{osConfig, ...}: let
inherit (osConfig.services.xserver) xkb;
inherit (osConfig.vars) mainMonitor;
@ -11,7 +6,7 @@
"logitech-g502-x"
"logitech-g502-hero-gaming-mouse"
];
nagaConf = name: {
mkConf = name: {
inherit name;
sensitivity = 0;
accel_profile = "flat";
@ -19,29 +14,49 @@
in {
wayland.windowManager.hyprland = {
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 = {
# Keyboard
kb_layout = xkb.layout;
kb_variant = xkb.variant;
numlock_by_default = true;
repeat_rate = 100;
# Mouse
follow_mouse = true;
# Touchpad
touchpad = {
natural_scroll = true;
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 = [
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioStop, exec, playerctl stop"
",XF86AudioNext, exec, playerctl next"
",XF86AudioPrev, exec, playerctl previous"
];
exec-once =
optionals (! isNull mainMonitor)
["hyprctl dispatch focusmonitor ${mainMonitor}"];
};
};
}

View file

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

View file

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