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.mkIf config.custom.de.hyprland.enable {
config = lib.mkIf config.custom.programs.hyprland.enable {
wayland.windowManager.hyprland.extraConfig = ''
# Bindflags:
# r = release
# e = repeat
# 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
bind = SUPER SHIFT, C, killactive,
bind = SUPER SHIFT, V, togglefloating,
bind = SUPER SHIFT, F, fullscreen, 0
# Launch programs
bind = SUPER, R, exec, rofi -show drun
bind = SUPER, RETURN, exec, kitty
bind = SUPER, V, exec, rofi-clipboard
bind = SUPER, B, exec, firefox
bind = SUPER, C, exec, code
@ -61,7 +50,6 @@
bindrl = SUPER CONTROL, R, exec, reboot
bindrl = SUPER CONTROL, H, exec, systemctl hibernate
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
# Control media

View file

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

View file

@ -8,11 +8,6 @@
options.custom.services.cliphist.enable = lib.mkEnableOption "";
config = lib.mkIf config.custom.services.cliphist.enable {
assertions = lib.singleton {
assertion = config.custom.programs.rofi.enable;
message = "Cliphist requires Rofi";
};
services.cliphist = {
enable = true;
extraOptions = [ ];
@ -23,7 +18,9 @@
home.packages = [
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"
);
};
}