1

Modules/Hyprland: Update wallpaper and add rofi menu to select wallpapers

This commit is contained in:
2025-07-20 01:48:16 +02:00
parent 1688aad11c
commit 711b78f77e
14 changed files with 94 additions and 18 deletions

View File

@ -84,7 +84,7 @@
hyprland = { hyprland = {
enable = !headless; enable = !headless;
dunst.enable = !config.modules.hyprpanel.enable; # Disable for hyprpanel dunst.enable = !config.modules.hyprpanel.enable; # Disable for hyprpanel
wallpaper = "Foggy-Lake"; wallpaper = "City-Outlook";
keybindings = { keybindings = {
main-mod = "SUPER"; main-mod = "SUPER";

View File

@ -227,7 +227,7 @@ in {
background = [ background = [
{ {
path = "~/NixFlake/wallpapers/${hyprland.theme}.png"; path = "${config.paths.nixflake}/wallpapers/${hyprland.wallpaper}.jpg";
blur_passes = 3; blur_passes = 3;
blur_size = 10; blur_size = 10;
monitor = ""; monitor = "";
@ -293,11 +293,15 @@ in {
splash = false; splash = false;
splash_offset = 2.0; splash_offset = 2.0;
preload = "${config.paths.nixflake}/wallpapers/${hyprland.theme}.png"; # Wallpapers have to be preloaded to be displayed
preload = let
mkPreload = name: "${config.paths.nixflake}/wallpapers/${name}.jpg";
in
hyprland.wallpapers |> builtins.map mkPreload;
wallpaper = let wallpaper = let
mkWallpaper = monitor: mkWallpaper = monitor:
"${monitor}, " "${monitor}, "
+ "${config.paths.nixflake}/wallpapers/${hyprland.theme}.png"; + "${config.paths.nixflake}/wallpapers/${hyprland.wallpaper}.jpg";
in in
hyprland.monitors hyprland.monitors
|> builtins.attrNames |> builtins.attrNames

View File

@ -2,7 +2,7 @@
lib, lib,
mylib, mylib,
... ...
}: { }: rec {
enable = lib.mkEnableOption "Hyprland Window Manager + Compositor"; enable = lib.mkEnableOption "Hyprland Window Manager + Compositor";
kb-layout = lib.mkOption { kb-layout = lib.mkOption {
@ -17,10 +17,32 @@
description = "Keyboard layout variant"; description = "Keyboard layout variant";
}; };
theme = lib.mkOption { # A bit dumb, but I want a single location where those are defined.
type = lib.types.str; # Only supposed to be set from here.
wallpapers = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "Available wallpapers";
# Run eza -1 | sd ".png" "" | sd "^" "\"" | sd "\$" "\"" | sd "\"\"" "" | wl-copy
# in ~/NixFlake/wallpapers/
default = [
"Blade-Runner-Atari"
"Blade-Runner-Coca-Cola"
"Blade-Runner-Downwards"
"Blade-Runner-Upwards"
"City-Outlook"
"Cozy-Bedroom"
"Everest-Fishing"
"Foggy-Lake"
"Three-Bears"
];
};
wallpaper = lib.mkOption {
type = lib.types.enum wallpapers.default;
example = "Three-Bears"; example = "Three-Bears";
description = "Wallpaper and colorscheme to use"; description = "Wallpaper to use";
default = "Foggy-Lake";
}; };
dunst.enable = lib.mkEnableOption "Enable dunst notification daemon"; dunst.enable = lib.mkEnableOption "Enable dunst notification daemon";

View File

@ -66,13 +66,13 @@ in {
"error-message" = { "error-message" = {
background-color = mkLiteral trans; background-color = mkLiteral trans;
margin = mkLiteral "0px 0px 20px 0px"; margin = mkLiteral "0px 0px 10px 0px";
}; };
"textbox" = { "textbox" = {
background-color = mkLiteral trans; background-color = mkLiteral trans;
padding = 6; padding = 6;
margin = mkLiteral "20px 20px 0px 20px"; margin = mkLiteral "10px 10px 0px 10px";
border-radius = 3; border-radius = 3;
}; };
@ -86,12 +86,12 @@ in {
padding = 6; padding = 6;
text-color = mkLiteral color.hexS.accentText; text-color = mkLiteral color.hexS.accentText;
border-radius = 3; border-radius = 3;
margin = mkLiteral "20px 0px 0px 20px"; margin = mkLiteral "10px 0px 0px 10px";
}; };
"entry" = { "entry" = {
padding = 6; padding = 6;
margin = mkLiteral "20px 20px 0px 10px"; margin = mkLiteral "10px 10px 0px 5px";
text-color = mkLiteral color.hexS.text; text-color = mkLiteral color.hexS.text;
background-color = mkLiteral trans; background-color = mkLiteral trans;
border = mkLiteral "2 solid 2 solid 2 solid 2 solid"; border = mkLiteral "2 solid 2 solid 2 solid 2 solid";
@ -102,7 +102,7 @@ in {
"listview" = { "listview" = {
# border = mkLiteral "0px 0px 0px"; # border = mkLiteral "0px 0px 0px";
padding = 0; padding = 0;
margin = mkLiteral "10px 20px 20px 20px"; margin = mkLiteral "5px 10px 10px 10px";
columns = 1; columns = 1;
background-color = mkLiteral trans; background-color = mkLiteral trans;
border = mkLiteral "2 solid 2 solid 2 solid 2 solid"; border = mkLiteral "2 solid 2 solid 2 solid 2 solid";
@ -130,6 +130,21 @@ in {
}; };
modules.hyprland.keybindings = let modules.hyprland.keybindings = let
vpn-menu =
pkgs.writeScript
"rofi-menu-vpn"
(builtins.readFile ./menus/vpn.fish);
keybinds-menu =
pkgs.writeScript
"rofi-menu-keybinds"
(builtins.readFile ./menus/keybinds.fish);
lectures-menu =
pkgs.writeScript
"rofi-menu-lectures"
(builtins.readFile ./menus/lectures.fish);
power-menu = power-menu =
mylib.rofi.mkSimpleMenu mylib.rofi.mkSimpleMenu
"power" "power"
@ -142,15 +157,32 @@ in {
" Exit Hyprland" = "hyprctl dispatch exit"; " Exit Hyprland" = "hyprctl dispatch exit";
}; };
vpn-menu = pkgs.writeScript "rofi-menu-vpn" (builtins.readFile ./menus/vpn.fish); wallpaper-menu = let
keybinds-menu = pkgs.writeScript "rofi-menu-keybinds" (builtins.readFile ./menus/keybinds.fish); setWallpaperOnMonitor = name: monitor:
lectures-menu = pkgs.writeScript "rofi-menu-lectures" (builtins.readFile ./menus/lectures.fish); "hyprctl hyprpaper wallpaper "
+ "${monitor},${config.paths.nixflake}/wallpapers/${name}.png";
setWallpaperOnMonitors = monitors: name: {
${name} =
monitors
|> builtins.map (setWallpaperOnMonitor name)
|> builtins.concatStringsSep " && ";
};
monitors = builtins.attrNames config.modules.hyprland.monitors;
in
mylib.rofi.mkSimpleMenu
"wall"
(config.modules.hyprland.wallpapers
|> builtins.map (setWallpaperOnMonitors monitors)
|> lib.mergeAttrsList);
in { in {
bindings = lib.mergeAttrsList [ bindings = lib.mergeAttrsList [
{ {
"$mainMod, escape" = ["exec, \"${power-menu}\""]; "$mainMod, escape" = ["exec, \"${power-menu}\""];
"$mainMod, M" = ["exec, \"${keybinds-menu}\""]; "$mainMod, m" = ["exec, \"${keybinds-menu}\""];
# "$mainMod, O" = ["exec, \"${lectures-menu}\""]; "$mainMod, w" = ["exec, \"${wallpaper-menu}\""];
# "$mainMod, o" = ["exec, \"${lectures-menu}\""];
} }
(lib.optionalAttrs (!nixosConfig.modules.network.useNetworkManager) { (lib.optionalAttrs (!nixosConfig.modules.network.useNetworkManager) {
"$mainMod, U" = ["exec, \"${vpn-menu}\""]; "$mainMod, U" = ["exec, \"${vpn-menu}\""];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 MiB

BIN
wallpapers/Blade-Runner-Downwards.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
wallpapers/Blade-Runner-Upwards.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
wallpapers/City-Outlook.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
wallpapers/Everest-Fishing.jpg (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 MiB

BIN
wallpapers/Foggy-Lake.jpg (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 MiB

BIN
wallpapers/Three-Bears.jpg (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 MiB