nichts/hosts/lars/hyprland.nix

159 lines
4.9 KiB
Nix
Raw Normal View History

2024-04-12 15:53:06 +02:00
{ config, lib, inputs, pkgs, ... }:
with lib; let
2024-04-12 22:03:29 +02:00
username = config.modules.other.system.username;
cfg = config.modules.hyprland;
2024-04-15 13:18:01 +02:00
gitPath = config.modules.other.system.gitPath;
2024-04-12 14:33:26 +02:00
in {
2024-04-14 09:49:41 +02:00
imports = [
./waybar.nix
];
2024-04-12 22:03:29 +02:00
options.modules.hyprland.nvidia.enable = mkEnableOption "nvidia";
options.modules.hyprland = {
2024-04-12 19:30:10 +02:00
enable = mkEnableOption "hyprland";
monitor = mkOption {
description = "hyprland monitor config";
default = ",preferred,auto,1";
2024-04-13 10:34:59 +02:00
type = types.listOf(types.str);
2024-04-12 19:30:10 +02:00
};
2024-04-13 19:00:23 +02:00
extra = mkOption {
description = "any extra configuration to add to the hyprland config file";
default = {};
type = types.attrs;
};
2024-04-15 13:18:01 +02:00
wallpaper = mkOption {
description = "wallpaper relative from assets";
default = "";
type = types.str;
};
2024-04-12 19:30:10 +02:00
};
2024-04-12 15:53:06 +02:00
2024-04-14 21:11:01 +02:00
config = mkIf cfg.enable {
environment.sessionVariables = mkIf cfg.nvidia.enable {
2024-04-12 15:53:06 +02:00
LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
WLR_NO_HARDWARE_CURSORS = "1";
SDL_VIDEODRIVER = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
CLUTTER_BACKEND = "wayland";
WLR_RENDERER = "vulkan";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
GTK_USE_PORTAL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
};
2024-04-14 21:11:01 +02:00
2024-04-12 14:33:26 +02:00
programs.hyprland = {
enable = true;
2024-04-14 21:11:01 +02:00
xwayland.enable = true;
};
2024-04-12 15:53:06 +02:00
xdg.portal.wlr.enable = true;
2024-04-14 21:11:01 +02:00
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
xdg.portal.config.common.default = "gtk";
2024-04-12 15:53:06 +02:00
xdg.portal.lxqt.enable = false;
systemd.user.services.xdg-desktop-portal-gnome.enable = false;
2024-04-12 14:33:26 +02:00
2024-04-12 15:53:06 +02:00
home-manager.users.${username} = {
wayland.windowManager.hyprland = {
enable = true;
2024-04-13 19:00:23 +02:00
settings = lib.mkMerge [{
2024-04-13 10:34:59 +02:00
# Monitor config
monitor = cfg.monitor;
2024-04-12 15:53:06 +02:00
"$mod" = "SUPER";
input = {
kb_layout = "ch";
};
2024-04-13 19:35:09 +02:00
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"
];
2024-04-13 19:00:23 +02:00
animation = [
2024-04-13 19:35:09 +02:00
"windows, 1, 6, wind, slide"
"windowsIn, 1, 6, winIn, slide"
"windowsOut, 1, 5, winOut, slide"
"windowsMove, 1, 5, wind, slide"
"border, 1, 1, liner"
"borderangle, 1, 30, liner, loop"
"fade, 1, 10, default"
"workspaces, 1, 5, wind"
];
exec-once = [
2024-04-14 09:49:41 +02:00
"waybar"
2024-04-15 13:18:01 +02:00
"swww init & swww img ${gitPath}/${cfg.wallpaper}"
2024-04-17 23:09:58 +02:00
"keepassxc"
"nextcloud"
"element-desktop --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu"
2024-04-13 19:00:23 +02:00
];
2024-04-12 15:53:06 +02:00
bind = [
"$mod, Q, killactive"
"$mod, return, exec, alacritty"
"$mod SHIFT, return, exec, firefox"
2024-04-13 10:34:59 +02:00
"$mod SHIFT, m, exit"
2024-04-13 19:35:09 +02:00
", F11, exec, pamixer -d 2"
", F12, exec, pamixer -i 2"
2024-04-13 21:08:08 +02:00
"$mod, d, exec, wofi --show drun"
2024-04-13 09:32:56 +02:00
# Application
2024-04-13 10:34:59 +02:00
"$mod SHIFT, c, exec, code --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu"
2024-04-14 23:11:54 +02:00
"$mod, o, exec, obsidian --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu"
"$mod SHIFT, D, exec, webcord --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu"
"$mod SHIFT, L, exec, element-desktop --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu"
2024-04-16 20:25:10 +02:00
"$mod, v, exec, vivaldi --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu"
2024-04-12 15:53:06 +02:00
# Monitor management
"$mod SHIFT, k, movecurrentworkspacetomonitor, DP-2"
"$mod SHIFT, j, movecurrentworkspacetomonitor, DP-1"
2024-04-12 19:30:10 +02:00
# Window Management
"$mod, left, movefocus, l"
"$mod, right, movefocus, r"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"
"$mod, F, fullscreen"
2024-04-17 15:56:45 +02:00
# Special Workspaces
"$mod SHIFT, F, movetoworkspacesilent, special"
"$mod, s, togglespecialworkspace,"
2024-04-12 19:30:10 +02:00
# Screenshot
2024-04-17 10:45:18 +02:00
"$mod SHIFT, s, exec, grim -g \"$(slurp -d)\" - | wl-copy"
2024-04-12 15:53:06 +02:00
]
++ (
builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x+1-(c * 10));
in [
"$mod, ${ws}, workspace, ${toString (x+1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString(x + 1)}"
]
)
10)
);
2024-04-17 10:45:18 +02:00
# Mouse movement
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
2024-04-13 19:00:23 +02:00
} cfg.extra];
2024-04-12 15:53:06 +02:00
};
2024-04-12 14:33:26 +02:00
};
2024-04-12 15:53:06 +02:00
};
2024-04-12 14:33:26 +02:00
}