KaitoianOS/users/kaitotlex/desktop-environment/hyprland/default.nix

249 lines
7.4 KiB
Nix
Raw Normal View History

2025-04-27 02:36:35 -07:00
{
pkgs,
config,
lib,
osConfig,
2025-05-27 11:44:46 -07:00
inputs,
2025-04-27 02:36:35 -07:00
...
}:
let
cfg = config.liminalOS.desktop.hyprland;
in
{
imports = [
./binds.nix
./utilities.nix
./windowrules.nix
];
options.liminalOS.formFactor = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"laptop"
"desktop"
]
);
default = osConfig.liminalOS.formFactor;
description = ''
Form factor of the machine. Adjusts some UI settings.
'';
};
options.liminalOS.powersave = lib.mkOption {
type = lib.types.bool;
default = osConfig.liminalOS.powersave;
description = ''
Whether to set some options to reduce power consumption (mostly Hyprland).
'';
};
options.liminalOS.desktop.hyprland = {
enable = lib.mkOption {
type = lib.types.bool;
default = config.liminalOS.desktop.enable;
description = ''
Whether to enable and rice Hyprland as well as some basic desktop utilities.
'';
};
gtkUseOpenGL = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to set GSK_RENDERER environment variable to stop GTK apps from crashing.
'';
};
idleDaemon.enable = lib.mkOption {
type = lib.types.bool;
default = cfg.enable;
description = ''
Whether to setup and enable Hypridle with some defaults to automatically lock the screen and suspend after idling.
'';
};
screenlocker.enable = lib.mkOption {
type = lib.types.bool;
default = cfg.enable && cfg.idleDaemon.enable;
description = ''
Whether to set up Hyprlock for screen locking.
'';
};
screenlocker.useCrashFix = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to use a workaround for Hyprlock background blur not working on some machines. Before locking, a screenshot will be taken and placed at `/tmp/__hyprlock-monitor-screenshot.png`.
'';
};
screenlocker.monitor = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = ''
Monitor to use for screen locker. Use `hyprctl monitors` to determine.
'';
};
bluelight.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable `hyprsunset` as a daemon.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
wl-clipboard
libsForQt5.qtstyleplugin-kvantum
libsForQt5.qt5ct
papirus-icon-theme
libsForQt5.qt5ct
hyprland-qtutils
];
2025-05-27 11:44:46 -07:00
wayland.windowManager.hyprland =
let
2025-05-27 15:12:18 -07:00
hyprscroller = pkgs.callPackage ../../pkgs/hyprland/hyprscroller.nix {
2025-05-27 11:44:46 -07:00
src = inputs.hyprscroller-src;
version = inputs.hyprscroller-src.lastModified;
2025-04-27 02:36:35 -07:00
};
2025-05-27 11:44:46 -07:00
in
{
enable = true;
plugins = [ hyprscroller ];
settings = {
input.touchpad = lib.mkIf (config.liminalOS.formFactor == "laptop") {
natural_scroll = true;
disable_while_typing = true;
clickfinger_behavior = true;
tap-to-click = false;
scroll_factor = 0.15;
};
exec-once = [
"hyprctl dispatch workspace 100000"
2025-04-27 02:36:35 -07:00
];
2025-05-27 11:44:46 -07:00
"$mod" = "SUPER";
"$Left" = "H";
"$Right" = "L";
"$Up" = "K";
"$Down" = "J";
env = (
lib.optionals cfg.gtkUseOpenGL [
"GSK_RENDERER,ngl"
2025-04-27 02:36:35 -07:00
]
2025-05-27 11:44:46 -07:00
);
layerrule = [
"blur,rofi"
"ignorezero,rofi"
"animation slide bottom 0.2 0.2 wind,rofi"
"blur,notifications"
"ignorezero,notifications"
"blur,swaync-notification-window"
"animation slide right 0.5 0.5,swaync-control-center"
"animation slide right 0.5 0.5,notifications"
"animation slide right 0.5 0.5,swaync-notification-window"
"ignorezero,swaync-notification-window"
"blur,swaync-control-center"
"ignorezero,swaync-control-center"
"blur,logout_dialog"
];
dwindle = {
pseudotile = "yes";
preserve_split = "yes";
};
animations = {
enabled = "yes";
bezier = [
"wind, 0.05, 0.9, 0.1, 1.05"
"winIn, 0.1, 1.1, 0.1, 1.1"
"winOut, 0.3, -0.3, 0, 1"
"liner, 1, 1, 1, 1"
"windup, 0.05, 0.9, 0.1, 1.05"
];
animation =
[
"windows, 1, 6, wind, slide"
"windowsIn, 1, 6, winIn, slide"
"windowsOut, 1, 5, winOut, slide"
"windowsMove, 1, 5, wind, slide"
"fade, 1, 10, default"
# "layers, 1, 8, default, slide"
"workspaces, 1, 5, wind, slidefadevert"
]
++ (lib.optionals (!osConfig.liminalOS.powersave) [
"border, 1, 1, liner"
"borderangle, 1, 30, liner, loop"
]);
2025-04-27 02:36:35 -07:00
};
2025-05-27 11:44:46 -07:00
general =
let
inherit (config.lib.stylix) colors;
in
{
gaps_in = "3";
gaps_out = "8";
border_size = "2";
# "col.active_border" = pkgs.lib.mkForce "rgba(ca9ee6ff) rgba(f2d5cfff) 45deg";
# "col.inactive_border" = pkgs.lib.mkForce "rgba(b4befecc) rgba(6c7086cc) 45deg";
"col.active_border" = "rgba(${colors.base0A}ff) rgba(${colors.base09}ff) 45deg";
"col.inactive_border" = "rgba(${colors.base01}cc) rgba(${colors.base02}cc) 45deg";
layout = "scroller";
resize_on_border = "true";
};
2025-04-27 02:36:35 -07:00
2025-05-27 11:44:46 -07:00
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
};
2025-04-27 02:36:35 -07:00
2025-05-27 11:44:46 -07:00
cursor = {
hide_on_key_press = true;
2025-04-27 02:36:35 -07:00
};
2025-05-27 11:44:46 -07:00
decoration = {
rounding = "10";
dim_special = "0.3";
blur = {
enabled = "yes";
size = "6";
passes = "3";
new_optimizations = "on";
ignore_opacity = "on";
xray = "false";
special = true;
};
shadow = {
enabled = false;
};
2025-04-27 02:36:35 -07:00
};
2025-05-27 11:44:46 -07:00
input = {
sensitivity = "-0.25";
};
plugin.scroller = {
column_widths = "onethird onehalf twothirds one";
column_heights = "onethird onehalf twothirds one";
};
experimental.xx_color_management_v4 = true;
2025-04-27 02:36:35 -07:00
};
};
2025-05-27 11:44:46 -07:00
# wayland.windowManager.hyprland.settings.input.touchpad =
# lib.mkIf (config.liminalOS.formFactor == "laptop")
# {
# natural_scroll = true;
# disable_while_typing = true;
# clickfinger_behavior = true;
# tap-to-click = false;
# scroll_factor = 0.15;
# };
#
2025-04-27 02:36:35 -07:00
assertions = [
{
assertion =
!cfg.screenlocker.useCrashFix || (cfg.screenlocker.useCrashFix && cfg.screenlocker.monitor != null);
message = "To use the Nvidia crash fix, you must set screenlocker.monitor to the monitor you want to use as the lock screen that blurs! Use `hyprctl monitors` to determine the monitor codes (should be something like DP-1, HDMI-A-1, etc).";
}
];
};
}