nichts/modules/wms/wayland/hypr/land.nix

373 lines
12 KiB
Nix
Raw Normal View History

2024-05-22 14:29:45 +02:00
{
config,
pkgs,
lib,
2024-07-21 20:14:19 +02:00
inputs',
2024-05-22 14:29:45 +02:00
...
}: let
2024-07-20 13:56:02 +02:00
cfg = config.modules.usrEnv.desktops.hyprland;
2024-05-26 02:36:36 +02:00
inherit (config.modules.other.system) username;
2024-07-21 20:14:19 +02:00
inherit (inputs'.anyrun.packages) anyrun;
2024-08-15 23:13:09 +02:00
inherit (config.modules.style) cursor;
2024-05-22 14:29:45 +02:00
inherit
2024-07-21 20:14:19 +02:00
(inputs'.nixpkgs-wayland.packages)
2024-05-22 14:29:45 +02:00
foot
swww
wlsunset
;
inherit
2024-07-21 20:14:19 +02:00
(inputs'.split-monitor-workspaces.packages)
2024-05-22 14:29:45 +02:00
split-monitor-workspaces
;
2024-08-17 11:19:57 +02:00
inherit (lib) mkIf mkDefault;
2024-08-15 23:13:09 +02:00
inherit (builtins) toString;
2024-05-04 15:00:14 +02:00
in {
2024-08-07 23:31:14 +02:00
config = mkIf cfg.enable {
2024-08-15 23:13:09 +02:00
programs.hyprland = {
2024-08-17 11:19:57 +02:00
enable = false;
inherit (cfg) package portalPackage;
2024-08-15 23:13:09 +02:00
};
2024-05-18 20:07:17 +02:00
# xdg Portal
xdg.portal = {
enable = true;
2024-08-17 11:19:57 +02:00
configPackages = mkDefault [
inputs'.hyprland.packages.xdg-desktop-portal-hyprland
2024-07-10 22:10:54 +02:00
];
extraPortals = [
pkgs.xdg-desktop-portal-gtk
2024-07-21 20:14:19 +02:00
inputs'.hyprland.packages.xdg-desktop-portal-hyprland
];
2024-07-22 22:46:11 +02:00
config = {
common.default = ["hyprland"];
};
};
home-manager.users.${username} = {
wayland.windowManager.hyprland = {
enable = true;
2024-08-16 16:03:47 +02:00
inherit (cfg) package;
2024-07-22 22:46:11 +02:00
2024-05-18 20:07:17 +02:00
# Split-monitor-workspaces provides awesome-like workspace behaviour
2024-05-25 15:13:09 +02:00
plugins = [
split-monitor-workspaces
];
2024-07-22 22:46:11 +02:00
2024-05-18 20:07:17 +02:00
# Xwayland for X applications
xwayland.enable = true;
2024-05-18 20:07:17 +02:00
# No idea why I set this
systemd = {
2024-05-05 14:01:33 +02:00
enable = true;
2024-05-22 14:29:45 +02:00
variables = ["--all"];
};
2024-05-18 20:07:17 +02:00
# Hyprland settings
settings = {
"$mainMod" = "SUPER";
2024-05-18 20:07:17 +02:00
# Monitor config
monitor = [
2024-08-17 11:19:57 +02:00
"eDP-1,1920x1080,0x0,1"
# "DP-2,1920x1080,0x0,1"
# "HDMI-A-2,1920x1080,1920x0,1"
# "HDMI-A-1,1920x1080,3840x0,1"
2024-05-18 20:07:17 +02:00
# Had the shadow monitor bug, so had to disable all unknown monitors.
2024-05-25 20:17:14 +02:00
"Unknown-1,disable"
2024-05-05 14:01:33 +02:00
];
2024-05-18 20:07:17 +02:00
# Workspace config
workspace = [
2024-08-17 11:19:57 +02:00
"1,monitor:eDP-1, default:true"
"2,monitor:eDP-1"
"3,monitor:eDP-1"
"4,monitor:eDP-1"
"5,monitor:eDP-1"
"6,monitor:eDP-1"
"7,monitor:eDP-1"
"8,monitor:eDP-1"
"9,monitor:eDP-1"
"10,monitor:eDP-1"
# "1,monitor:HDMI-A-1, default:true"
# "2,monitor:HDMI-A-1"
# "3,monitor:HDMI-A-1"
# "4,monitor:HDMI-A-1"
# "5,monitor:HDMI-A-1"
# "6,monitor:HDMI-A-1"
# "7,monitor:HDMI-A-1"
# "8,monitor:HDMI-A-1"
# "9,monitor:HDMI-A-1"
# "10,monitor:HDMI-A-1"
#
# "11, monitor:HDMI-A-2, default:true"
# "12, monitor:HDMI-A-2"
# "13, monitor:HDMI-A-2"
# "14, monitor:HDMI-A-2"
# "15, monitor:HDMI-A-2"
# "16, monitor:HDMI-A-2"
# "17, monitor:HDMI-A-2"
# "18, monitor:HDMI-A-2"
# "19, monitor:HDMI-A-2"
# "20, monitor:HDMI-A-2"
#
# "21, monitor:DP-2, default:true"
# "22, monitor:DP-2"
# "23, monitor:DP-2"
# "24, monitor:DP-2"
# "25, monitor:DP-2"
# "26, monitor:DP-2"
# "27, monitor:DP-2"
# "28, monitor:DP-2"
# "29, monitor:DP-2"
# "30, monitor:DP-2"
#
# scratchpads
"special:pipewire, decorate:false"
"special:nixos, decorate:false"
"special:keepassxc, decorate:false"
];
2024-05-18 20:07:17 +02:00
# Input settings
input = {
2024-08-08 10:21:47 +02:00
kb_layout = "de,us";
kb_variant = ",colemak_dh_wide";
2024-08-09 00:17:17 +02:00
kb_options = "grp:rctrl_rshift_toggle";
2024-05-05 21:33:33 +02:00
follow_mouse = true;
2024-07-22 22:46:11 +02:00
repeat_rate = 50;
2024-07-30 19:24:53 +02:00
repeat_delay = 200;
2024-07-22 22:46:11 +02:00
2024-07-10 22:10:54 +02:00
touchpad = {
disable_while_typing = true;
};
};
2024-08-07 23:31:14 +02:00
general = {
sensitivity = 1.0;
2024-08-01 01:18:12 +02:00
gaps_in = 0;
gaps_out = 0;
2024-05-19 03:10:49 +02:00
border_size = 2;
2024-07-22 22:46:11 +02:00
no_border_on_floating = true;
};
2024-08-07 23:31:14 +02:00
2024-05-18 20:07:17 +02:00
#Decoration settings
decoration = {
2024-08-01 01:18:12 +02:00
rounding = 0;
blur = {
enabled = true;
size = 3;
passes = 2;
};
drop_shadow = 1;
shadow_range = 15;
shadow_render_power = 2;
shadow_ignore_window = 1;
shadow_offset = "2 4";
shadow_scale = 1;
};
2024-05-22 14:29:45 +02:00
# Bezier curves for aninmations.
2024-05-18 20:07:17 +02:00
# Generate your own at https://www.cssportal.com/css-cubic-bezier-generator/
bezier = [
"dupa, 0.1, 0.9, 0.1, 1.05"
];
2024-05-18 20:07:17 +02:00
# Hyprland anomations, using the above bezier curves
animations = {
2024-07-23 00:00:26 +02:00
enabled = true;
animation = [
"windows, 1, 4, dupa, popin"
"windowsOut, 1, 4, dupa, slide"
"border, 1, 15, default"
"fade, 1, 10, default"
"workspaces, 1, 5, dupa, slidevert"
];
};
2024-08-07 23:31:14 +02:00
2024-05-22 14:29:45 +02:00
dwindle = {no_gaps_when_only = true;};
2024-05-14 23:47:14 +02:00
2024-07-13 22:08:21 +02:00
cursor = {
hide_on_key_press = true;
2024-07-21 13:18:00 +02:00
no_hardware_cursors = true;
2024-07-13 22:08:21 +02:00
};
2024-08-07 23:31:14 +02:00
misc = {
enable_swallow = true;
2024-05-21 22:30:34 +02:00
swallow_regex = "foot";
focus_on_activate = true;
vrr = 1;
vfr = true;
animate_manual_resizes = false;
animate_mouse_windowdragging = false;
force_default_wallpaper = 0;
};
2024-08-07 23:31:14 +02:00
2024-05-18 20:07:17 +02:00
# Window rules for some programs.
windowrulev2 = [
"float, class:^(Tor Browser)$"
"float, class:^(mpv)$"
"float, class:^(imv)$"
"float, title:^(Picture-in-Picture)$"
"float, title:^(.*)(Choose User Profile)(.*)$"
"float, title:^(blob:null/)(.*)$"
"float, class:^(xdg-desktop-portal-gtk)$"
"float, class:^(code), title: ^(Open*)"
"size 70% 70%, class:^(code), title: ^(Open*)"
"center, class: ^(code), title: ^(Open*)"
"float, class:^(org.keepassxc.KeePassXC)$"
];
2024-08-07 23:31:14 +02:00
2024-05-18 20:07:17 +02:00
# Keybinds
bind = [
2024-07-22 22:46:11 +02:00
"$mainMod, RETURN, exec, ${foot}/bin/foot"
"$mainMod, Q, killactive"
"$mainMod, F, fullscreen, 0"
2024-08-20 21:37:28 +02:00
"$mainMod, D, exec, ${pkgs.procps}/bin/pkill fuzzel || ${anyrun}/bin/fuzzel"
"$mainMod, SPACE, togglefloating, active"
2024-07-21 15:11:55 +02:00
# workspaces
2024-05-18 20:07:17 +02:00
# split-workspace is because of the split-workspace plugin
2024-08-17 11:19:57 +02:00
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
"$mainMod SHIFT, 1, movetoworkspacesilent, 1"
"$mainMod SHIFT, 2, movetoworkspacesilent, 2"
"$mainMod SHIFT, 3, movetoworkspacesilent, 3"
"$mainMod SHIFT, 4, movetoworkspacesilent, 4"
"$mainMod SHIFT, 5, movetoworkspacesilent, 5"
"$mainMod SHIFT, 6, movetoworkspacesilent, 6"
"$mainMod SHIFT, 7, movetoworkspacesilent, 7"
"$mainMod SHIFT, 8, movetoworkspacesilent, 8"
"$mainMod SHIFT, 9, movetoworkspacesilent, 9"
"$mainMod SHIFT, 0, movetoworkspacesilent, 10"
2024-07-06 22:13:28 +02:00
# split-workspace is because of the split-workspace plugin
2024-08-17 11:19:57 +02:00
# "$mainMod, 1, split-workspace, 1"
# "$mainMod, 2, split-workspace, 2"
# "$mainMod, 3, split-workspace, 3"
# "$mainMod, 4, split-workspace, 4"
# "$mainMod, 5, split-workspace, 5"
# "$mainMod, 6, split-workspace, 6"
# "$mainMod, 7, split-workspace, 7"
# "$mainMod, 8, split-workspace, 8"
# "$mainMod, 9, split-workspace, 9"
# "$mainMod, 0, split-workspace, 10"
# "$mainMod SHIFT, 1, split-movetoworkspacesilent, 1"
# "$mainMod SHIFT, 2, split-movetoworkspacesilent, 2"
# "$mainMod SHIFT, 3, split-movetoworkspacesilent, 3"
# "$mainMod SHIFT, 4, split-movetoworkspacesilent, 4"
# "$mainMod SHIFT, 5, split-movetoworkspacesilent, 5"
# "$mainMod SHIFT, 6, split-movetoworkspacesilent, 6"
# "$mainMod SHIFT, 7, split-movetoworkspacesilent, 7"
# "$mainMod SHIFT, 8, split-movetoworkspacesilent, 8"
# "$mainMod SHIFT, 9, split-movetoworkspacesilent, 9"
# "$mainMod SHIFT, 0, split-movetoworkspacesilent, 10"
#
2024-05-25 20:17:14 +02:00
# Move Windows
2024-05-26 00:29:40 +02:00
"$mainMod SHIFT, H, movewindow, l"
"$mainMod SHIFT, J, movewindow, d"
"$mainMod SHIFT, K, movewindow, u"
"$mainMod SHIFT, L, movewindow, r"
2024-07-21 15:11:55 +02:00
2024-05-18 20:07:17 +02:00
# Screenshotting
"$mainMod, S, exec, ${pkgs.grimblast}/bin/grimblast copy area"
2024-07-21 15:11:55 +02:00
2024-05-18 20:07:17 +02:00
# File manager
2024-07-21 20:14:19 +02:00
"$mainMod, E, exec, ${pkgs.xfce.thunar}/bin/thunar"
2024-07-22 22:46:11 +02:00
2024-08-07 22:34:38 +02:00
# Toggle the three different special workspaces.
"$mainMod, V, togglespecialworkspace, pipewire"
"$mainMod, N, togglespecialworkspace, nixos"
"$mainMod, X, togglespecialworkspace, keepassxc"
2024-05-18 20:07:17 +02:00
# Reload hyprland
2024-07-21 15:11:55 +02:00
"$mainMod, R, exec, ${cfg.package}/bin/hyprctl reload"
2024-07-22 22:46:11 +02:00
2024-05-18 20:07:17 +02:00
# Restart waybar
2024-05-29 11:37:09 +02:00
"$mainMod CONTROL, B, exec, ${pkgs.procps}/bin/pkill waybar || ${pkgs.waybar}/bin/waybar"
];
2024-07-22 22:46:11 +02:00
binde = [
# window focus
"$mainMod, H, movefocus, l"
"$mainMod, J, movefocus, d"
2024-05-17 15:52:06 +02:00
"$mainMod, K, movefocus, u"
"$mainMod, L, movefocus, r"
];
2024-07-22 22:46:11 +02:00
2024-05-18 20:07:17 +02:00
# Media controls
bindl = let
play-pause = "${pkgs.playerctl}/bin/playerctl play-pause";
stop = "${pkgs.playerctl}/bin/playerctl stop";
prev = "${pkgs.playerctl}/bin/playerctl previous";
next = "${pkgs.playerctl}/bin/playerctl next";
toggle-mute = "${pkgs.pamixer}/bin/pamixer --toggle-mute";
in [
", XF86AudioMedia, exec, ${play-pause}"
", XF86AudioPlay, exec, ${play-pause}"
", XF86AudioStop, exec, ${stop}"
", XF86AudioPrev, exec, ${prev}"
", XF86AudioNext, exec, ${next}"
", XF86AudioMute, exec, ${toggle-mute}"
];
2024-05-05 21:33:33 +02:00
# locked + repeat
bindle = let
volume_up = "${pkgs.pamixer}/bin/pamixer -ui 5";
volume_down = "${pkgs.pamixer}/bin/pamixer -ud 5";
in [
", XF86AudioRaiseVolume, exec, ${volume_up}"
", XF86AudioLowerVolume, exec, ${volume_down}"
];
2024-05-18 20:07:17 +02:00
# Mouse settings
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
2024-07-22 22:46:11 +02:00
2024-05-18 20:07:17 +02:00
# Some more movement-related settings
binds = {
pass_mouse_when_bound = false;
movefocus_cycles_fullscreen = false;
};
2024-05-18 20:07:17 +02:00
# Programs which get executed at Hyprland start.
exec-once = [
2024-08-15 23:13:09 +02:00
"hyprctl setcursor ${cursor.name} ${toString cursor.size}"
#start waybar
2024-07-22 22:46:11 +02:00
"${pkgs.waybar}/bin/waybar"
2024-05-05 21:33:33 +02:00
# run persistent special workspace windows
2024-08-17 11:19:57 +02:00
"[workspace special:nixos; silent;tile] ${foot}/bin/foot -D ~/projects/nichts"
2024-05-21 22:30:34 +02:00
2024-05-15 23:47:37 +02:00
"[workspace special:keepassxc; silent;tile] ${pkgs.keepassxc}/bin/keepassxc"
2024-05-05 21:33:33 +02:00
2024-07-28 11:00:54 +02:00
"${swww}/bin/swww-daemon"
2024-07-22 22:46:11 +02:00
"${wlsunset}/bin/wlsunset -S 06:00 -s 20:00"
];
2024-05-05 21:33:33 +02:00
exec = [
# kill (almost) everything on special workspaces
"${pkgs.procps}/bin/pkill pavucontrol"
2024-07-24 17:47:16 +02:00
"${pkgs.procps}/bin/pkill helvum"
2024-05-18 17:49:42 +02:00
2024-07-24 17:47:16 +02:00
# and run it all again
2024-08-07 23:31:14 +02:00
"[workspace special:pipewire; silent;tile] ${pkgs.helvum}/bin/helvum"
"[workspace special:pipewire; silent;tile] ${pkgs.pavucontrol}/bin/pavucontrol"
];
2024-08-07 23:31:14 +02:00
2024-07-23 00:00:26 +02:00
plugin = {
split-monitor-workspaces = {
keep-focued = true;
count = 10;
};
};
};
2024-05-05 14:01:33 +02:00
};
};
2024-05-04 15:00:14 +02:00
};
}