nixos/home/system/hyprland/default.nix
2025-10-11 08:24:26 +07:00

193 lines
5.0 KiB
Nix

# So best window tiling manager
{ pkgs, config, inputs, ... }:
let
inherit (config.var.theme)
border-size gaps-in gaps-out active-opacity inactive-opacity rounding blur;
inherit (config.var) keyboardLayout;
in {
imports =
[ ./animations.nix ./bindings.nix ./polkitagent.nix ./windowrule.nix ];
home.packages = with pkgs; [
qt5.qtwayland
qt6.qtwayland
libsForQt5.qt5ct
qt6ct
hyprshot
hyprpicker
swappy
imv
wf-recorder
wlr-randr
wl-clipboard
brightnessctl
gnome-themes-extra
libva
dconf
wayland-utils
wayland-protocols
glib
direnv
meson
];
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = true;
systemd.variables = [ "--all" ];
package =
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage =
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
settings = {
"$mod" = "SUPER";
"$shiftMod" = "SUPER_SHIFT";
"$ctrlMod" = "SUPER_CTRL";
exec-once = [
"systemctl --user import-environment"
"hash dbus-update-activation-environment 2>/dev/null"
"dbus-update-activation-environment --systemd --all"
];
ecosystem = { no_update_news = true; };
plugin = { overview = { autoDrag = false; }; };
monitor = [
"eDP-1,preffered,0x0,1"
"desc:LG Electronics 16EN33 305INKH5P181,preferred,0x-768,1"
",prefered,auto,1"
];
# workspace = [
# "1,monitor:eDP-1"
# "2,monitor:eDP-1"
# "3,monitor:eDP-1"
# "4,monitor:eDP-1"
# "5,monitor:eDP-1"
# ];
env = [
"XDG_SESSION_TYPE,wayland"
"XDG_CURRENT_DESKTOP,Hyprland"
"MOZ_ENABLE_WAYLAND,1"
"ANKI_WAYLAND,1"
"DISABLE_QT5_COMPAT,0"
"NIXOS_OZONE_WL,1"
"XDG_SESSION_TYPE,wayland"
"XDG_SESSION_DESKTOP,Hyprland"
"QT_AUTO_SCREEN_SCALE_FACTOR,1"
"QT_QPA_PLATFORM=wayland,xcb"
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
"ELECTRON_OZONE_PLATFORM_HINT,auto"
"__GL_GSYNC_ALLOWED,0"
"__GL_VRR_ALLOWED,0"
"DISABLE_QT5_COMPAT,0"
"DIRENV_LOG_FORMAT,"
"WLR_DRM_NO_ATOMIC,1"
"WLR_BACKEND,vulkan"
"WLR_RENDERER,vulkan"
"WLR_NO_HARDWARE_CURSORS,1"
"XDG_SESSION_TYPE,wayland"
"SDL_VIDEODRIVER,wayland"
"CLUTTER_BACKEND,wayland"
];
cursor = {
no_hardware_cursors = true;
default_monitor = "eDP-1";
};
general = {
resize_on_border = true;
gaps_in = gaps-in;
gaps_out = gaps-out;
border_size = border-size;
layout = "master";
};
decoration = {
blur = {
enabled = if blur then "true" else "false";
size = 18;
};
shadow = {
enabled = true;
range = 20;
render_power = 3;
};
active_opacity = active-opacity;
inactive_opacity = inactive-opacity;
rounding = rounding;
};
master = {
new_status = true;
allow_small_split = true;
mfact = 0.6;
};
gesture = [ "3, horizontal, workspace" ];
misc = {
vfr = true;
disable_hyprland_logo = true;
disable_splash_rendering = true;
disable_autoreload = true;
focus_on_activate = true;
new_window_takes_over_fullscreen = 2;
};
windowrulev2 = [
"float, tag:modal"
"pin, tag:modal"
"center, tag:modal"
"float, title:^(Media viewer)$"
# Bitwarden extension
"float, title:^(.*Bitwarden Password Manager.*)$"
# make Firefox/Zen PiP window floating and sticky
"float, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
# idle inhibit while watching videos
"idleinhibit focus, class:^(mpv|.+exe|celluloid)$"
"idleinhibit focus, class:^(zen)$, title:^(.*YouTube.*)$"
"idleinhibit fullscreen, class:^(zen)$"
"dimaround, class:^(gcr-prompter)$"
"dimaround, class:^(xdg-desktop-portal-gtk)$"
"dimaround, class:^(polkit-gnome-authentication-agent-1)$"
"dimaround, class:^(zen)$, title:^(File Upload)$"
# fix xwayland apps
"rounding 0, xwayland:1"
"center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$"
"size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$"
];
layerrule = [ "noanim, launcher" "noanim, ^ags-.*" ];
input = {
kb_layout = keyboardLayout;
follow_mouse = 1;
sensitivity = 0;
repeat_delay = 300;
repeat_rate = 50;
numlock_by_default = true;
touchpad = {
natural_scroll = true;
clickfinger_behavior = true;
};
};
};
};
# systemd.user.targets.hyprland-session.Unit.Wants =
# [ "xdg-desktop-autostart.target" ];
}