nix-config/modules/wm/hyprland/default.nix

345 lines
7.4 KiB
Nix

{
lib,
config,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.horseman.wm.hyprland;
in {
imports = [
./options.nix
./keybindings.nix
];
options = {
horseman.wm.hyprland.enable = mkEnableOption "Hyprland";
};
config = mkIf cfg.enable {
programs.hyprland = {
enable = true;
xwayland.enable = true;
};
security.polkit.enable = true;
environment.systemPackages = with pkgs; [
brightnessctl
eww
fortune
hypridle
hyprlock
hyprpaper
hyprpolkitagent
hyprshot
jq
networkmanagerapplet
playerctl
pulsemixer
python312Packages.gpustat
swaynotificationcenter
wirelesstools
wl-clipboard
wofi
xdg-desktop-portal-hyprland
];
horseman.wm.hyprland.config = {
execOnce = [
"hyprpaper"
"eww daemon"
"hypridle"
"hyprpaper"
"swaync"
"systemctl --user start hyprpolkitagent"
];
env = [
"XCURSOR_SIZE,24"
"HYPRCURSOR_SIZE,24"
];
windowrules = [
"suppressevent maximize, class:.*"
"nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0"
"rounding 0, floating:0 onworkspace:w[t1]"
"bordersize 0, floating:0 onworkspace:w[t1]"
"float, initialTitle:^Picture-in-Picture$"
"center, initialTitle:^Picture-in-Picture$"
"size 33% 33%, initialTitle:^Picture-in-Picture$"
"float, initialClass:CImg"
"float, initialTitle:GLFW"
];
workspaces = [
"w[t1], gapsout:0, gapsin:0"
];
general = {
gapsIn = 5;
gapsOut = 5;
borderSize = 2;
resizeOnBorder = true;
allowTearing = false;
col.activeBorder = "rgba(b7bdf8ff)";
col.inactiveBorder = "rgba(b7bdf840)";
layout = "dwindle";
};
decoration = {
rounding = 10;
activeOpacity = 1.0;
inactiveOpacity = 1.0;
shadow = {
enabled = true;
range = 4;
renderPower = 3;
color = "rgba(1a1a1aee)";
};
blur = {
enabled = true;
size = 3;
passes = 3;
vibrancy = 0.1696;
};
};
animations = {
enabled = true;
beziers = [
{
name = "easeOutQuint";
startX = 0.23;
startY = 1.0;
endX = 0.32;
endY = 1.0;
}
{
name = "easeInOutCubic";
startX = 0.65;
startY = 0.05;
endX = 0.36;
endY = 1.0;
}
{
name = "linear";
startX = 0.0;
startY = 0.0;
endX = 1.0;
endY = 1.0;
}
{
name = "almostLinear";
startX = 0.5;
startY = 0.5;
endX = 0.75;
endY = 1.0;
}
{
name = "quick";
startX = 0.15;
startY = 0.0;
endX = 0.1;
endY = 1.0;
}
];
animations = [
{
name = "global";
on = true;
speed = 10.0;
curve = "default";
}
{
name = "border";
on = true;
speed = 5.39;
curve = "easeOutQuint";
}
{
name = "windows";
on = true;
speed = 4.79;
curve = "easeOutQuint";
}
{
name = "windowsIn";
on = true;
speed = 4.1;
curve = "easeOutQuint";
style = "popin 87%";
}
{
name = "windowsOut";
on = true;
speed = 1.49;
curve = "linear";
style = "popin 87%";
}
{
name = "fadeIn";
on = true;
speed = 1.73;
curve = "almostLinear";
}
{
name = "fadeOut";
on = true;
speed = 1.46;
curve = "almostLinear";
}
{
name = "fade";
on = true;
speed = 3.03;
curve = "quick";
}
{
name = "layers";
on = true;
speed = 3.81;
curve = "easeOutQuint";
}
{
name = "layersIn";
on = true;
speed = 4.0;
curve = "easeOutQuint";
style = "fade";
}
{
name = "layersOut";
on = true;
speed = 1.5;
curve = "linear";
style = "fade";
}
{
name = "fadeLayersIn";
on = true;
speed = 1.79;
curve = "almostLinear";
}
{
name = "fadeLayersOut";
on = true;
speed = 1.39;
curve = "almostLinear";
}
{
name = "workspaces";
on = true;
speed = 1.94;
curve = "almostLinear";
style = "fade";
}
{
name = "workspacesIn";
on = true;
speed = 1.21;
curve = "almostLinear";
style = "fade";
}
{
name = "workspacesOut";
on = true;
speed = 1.94;
curve = "almostLinear";
style = "fade";
}
];
};
dwindle = {
pseudotile = true;
preserveSplit = true;
};
master = {
newStatus = "master";
};
misc = {
forceDefaultWallpaper = 0;
keyPressEnablesDPMS = true;
newWindowTakesOverFullscreen = 2;
enableSwallow = true;
swallowRegex = "^kitty$";
};
input = {
kbLayout = "us";
repeatRate = 50;
repeatDelay = 300;
followMouse = 1;
sensitivity = 0.0;
touchpad.naturalScroll = true;
numlockByDefault = true;
touchpad.dragLock = true;
};
gestures = {
workspaceSwipe = false;
};
group = {
autoGroup = false;
dragIntoGroup = 1;
col = {
borderActive = config.horseman.wm.hyprland.config.general.col.activeBorder; # I don't wanna believe this can't be done better :(
borderInactive = config.horseman.wm.hyprland.config.general.col.inactiveBorder;
borderLockedActive = config.horseman.wm.hyprland.config.general.col.activeBorder;
borderLockedInactive = config.horseman.wm.hyprland.config.general.col.inactiveBorder;
};
groupbar = {
fontSize = 14;
height = 26;
keepUpperGap = true;
};
};
binds = {
workspaceCenterOn = 1;
dragThreshold = 50;
};
ecosystem = {
noDonationNag = true;
};
monitors = {
defaultMonitor = true;
};
sleep = {
lockCommand = "pidof hyprlock || hyprlock";
listeners = [
{
timeout = 300;
onTimeout = "hyprctl dispatch dpms off";
onResume = "hyprctl dispatch dpms on";
}
{
timeout = 310;
onTimeout = "loginctl lock-session";
}
];
};
};
services.logind.extraConfig = ''
HandlePowerKey=ignore
'';
};
}