hyprland: Refactor to accommodate more DEs

This commit is contained in:
SebastianStork 2026-03-05 20:57:20 +01:00
parent 927f056987
commit 048c7fb888
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
7 changed files with 72 additions and 63 deletions

View file

@ -0,0 +1,51 @@
{
config,
pkgs,
lib,
...
}:
{
options.custom.de.hyprland.classic.enable = lib.mkEnableOption "";
config = lib.mkIf config.custom.de.hyprland.classic.enable {
custom = {
programs = {
hyprland.enable = true;
rofi.enable = true;
hyprlock.enable = true;
};
services = {
wpaperd.enable = true;
hypridle.enable = true;
waybar.enable = true;
cliphist.enable = true;
};
};
services.dunst.enable = true;
home.packages = [
pkgs.playerctl
pkgs.grimblast
];
wayland.windowManager.hyprland.extraConfig = lib.mkBefore ''
# Variables
$play-pause = playerctl --ignore-player=firefox play-pause
$play-next = playerctl --ignore-player=firefox next
$play-previous = playerctl --ignore-player=firefox previous
$mute = wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
$volume-up = wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
$volume-down = wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
$mute-mic = wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
# Launch programs
bind = SUPER, R, exec, rofi -show drun
bind = SUPER, V, exec, rofi-clipboard
# Manage session
bindrl = SUPER CONTROL, L, exec, loginctl lock-session
'';
};
}

View file

@ -1,42 +0,0 @@
{
config,
osConfig,
pkgs,
lib,
...
}:
{
options.custom.de.hyprland.enable = lib.mkEnableOption "" // {
default = osConfig.custom.de.hyprland.enable;
};
config = lib.mkIf config.custom.de.hyprland.enable {
wayland.windowManager.hyprland = {
enable = true;
package = null;
portalPackage = null;
};
home.packages = [
pkgs.playerctl
pkgs.grimblast
];
custom = {
services = {
wpaperd.enable = true;
hypridle.enable = true;
waybar.enable = true;
cliphist.enable = true;
};
programs = {
rofi.enable = true;
hyprlock.enable = true;
btop.enable = true;
};
};
services.dunst.enable = true;
};
}

View file

@ -0,0 +1,12 @@
{ config, lib, ... }:
{
options.custom.programs.hyprland.enable = lib.mkEnableOption "";
config = lib.mkIf config.custom.programs.hyprland.enable {
wayland.windowManager.hyprland = {
enable = true;
package = null;
portalPackage = null;
};
};
}

View file

@ -1,30 +1,19 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
config = lib.mkIf config.custom.de.hyprland.enable { config = lib.mkIf config.custom.programs.hyprland.enable {
wayland.windowManager.hyprland.extraConfig = '' wayland.windowManager.hyprland.extraConfig = ''
# Bindflags: # Bindflags:
# r = release # r = release
# e = repeat # e = repeat
# l = locked # l = locked
# Variables
$play-pause = playerctl --ignore-player=firefox play-pause
$play-next = playerctl --ignore-player=firefox next
$play-previous = playerctl --ignore-player=firefox previous
$mute = wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
$volume-up = wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
$volume-down = wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
$mute-mic = wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
# Essentials # Essentials
bind = SUPER SHIFT, C, killactive, bind = SUPER SHIFT, C, killactive,
bind = SUPER SHIFT, V, togglefloating, bind = SUPER SHIFT, V, togglefloating,
bind = SUPER SHIFT, F, fullscreen, 0 bind = SUPER SHIFT, F, fullscreen, 0
# Launch programs # Launch programs
bind = SUPER, R, exec, rofi -show drun
bind = SUPER, RETURN, exec, kitty bind = SUPER, RETURN, exec, kitty
bind = SUPER, V, exec, rofi-clipboard
bind = SUPER, B, exec, firefox bind = SUPER, B, exec, firefox
bind = SUPER, C, exec, code bind = SUPER, C, exec, code
@ -61,7 +50,6 @@
bindrl = SUPER CONTROL, R, exec, reboot bindrl = SUPER CONTROL, R, exec, reboot
bindrl = SUPER CONTROL, H, exec, systemctl hibernate bindrl = SUPER CONTROL, H, exec, systemctl hibernate
bindrl = SUPER CONTROL, S, exec, systemctl sleep bindrl = SUPER CONTROL, S, exec, systemctl sleep
bindrl = SUPER CONTROL, L, exec, loginctl lock-session
bindrl = SUPER CONTROL, B, exec, sleep 1 && hyprctl dispatch dpms off bindrl = SUPER CONTROL, B, exec, sleep 1 && hyprctl dispatch dpms off
# Control media # Control media

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
config = lib.mkIf config.custom.de.hyprland.enable { config = lib.mkIf config.custom.programs.hyprland.enable {
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
input = { input = {
kb_layout = "de"; kb_layout = "de";

View file

@ -8,11 +8,6 @@
options.custom.services.cliphist.enable = lib.mkEnableOption ""; options.custom.services.cliphist.enable = lib.mkEnableOption "";
config = lib.mkIf config.custom.services.cliphist.enable { config = lib.mkIf config.custom.services.cliphist.enable {
assertions = lib.singleton {
assertion = config.custom.programs.rofi.enable;
message = "Cliphist requires Rofi";
};
services.cliphist = { services.cliphist = {
enable = true; enable = true;
extraOptions = [ ]; extraOptions = [ ];
@ -23,7 +18,9 @@
home.packages = [ home.packages = [
pkgs.wl-clipboard pkgs.wl-clipboard
(pkgs.writeScriptBin "rofi-clipboard" "cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy") ]
]; ++ lib.optional config.custom.programs.rofi.enable (
pkgs.writeScriptBin "rofi-clipboard" "cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy"
);
}; };
} }

View file

@ -19,6 +19,8 @@
custom = { custom = {
sops.enable = true; sops.enable = true;
de.hyprland.classic.enable = true;
programs = { programs = {
shell = { shell = {
zsh.enable = true; zsh.enable = true;
@ -32,6 +34,7 @@
vscode.enable = true; vscode.enable = true;
firefox.enable = true; firefox.enable = true;
libreoffice.enable = true; libreoffice.enable = true;
btop.enable = true;
}; };
}; };