rofi wallpaper select

This commit is contained in:
foglar 2025-04-13 14:15:23 +02:00
parent d59ff29064
commit 45ecc61547
5 changed files with 56 additions and 4 deletions

View File

@ -14,7 +14,7 @@
imports = [
./dependencies.nix
./waybar.nix
./rofi.nix
./rofi/rofi.nix
./wlogout.nix
./hyprlock.nix
./hypridle.nix
@ -27,6 +27,7 @@
rofi = {
enable = lib.mkDefault true;
clipboard.enable = lib.mkDefault true;
wallpaper.enable = lib.mkDefault true;
};
hyprlock.enable = lib.mkDefault true;
hypridle.enable = lib.mkDefault true;
@ -201,6 +202,7 @@
bindd = [
"$mod SHIFT, P, Color Picker, exec, ${pkgs.hyprpicker}/bin/hyprpicker -a"
"$mod SHIFT, R, Random Background, exec, background-switch-random"
"$mod SHIFT, W, Select Background, exec, wallswitch-rofi"
];
bindl = [

View File

@ -11,7 +11,7 @@
config = lib.mkIf config.desktop.hyprland.rofi.clipboard.enable {
home.file = {
".config/rofi/clip_bg.png".source = ../../../../config/backgrounds/${userSettings.background};
".config/rofi/clip_bg.png".source = ../../../../../config/backgrounds/${userSettings.background};
".config/rofi/cliboard.rasi".text = let
main-bg = config.lib.stylix.colors.base01;
main-fg = config.lib.stylix.colors.base02;

View File

@ -11,6 +11,7 @@
imports = [
./clipboard-rofi.nix
./wallpapers-rofi.nix
];
config = lib.mkIf config.desktop.hyprland.rofi.enable {
@ -69,7 +70,7 @@
padding = mkLiteral "5em";
children = ["entry"];
background-color = mkLiteral "transparent";
background-image = mkLiteral "url(\"~/Pictures/config/backgrounds/${userSettings.background}\", WIDTH)";
background-image = mkLiteral "url(\"~/Pictures/backgrounds/${userSettings.background}\", WIDTH)";
};
# Entry field settings

View File

@ -0,0 +1,47 @@
{
lib,
config,
pkgs,
...
}: {
options = {
desktop.hyprland.rofi.wallpaper.enable = lib.mkEnableOption "enable Rofi wallpaper module";
};
config = lib.mkIf config.desktop.hyprland.rofi.wallpaper.enable {
home.packages = with pkgs; [
(writeShellScriptBin "wallswitch-rofi" ''
WALLPAPER_DIR="$HOME/Pictures/backgrounds"
TMP_DIR="/tmp/rofi-wallpapers"
mkdir -p "$TMP_DIR"
# Generate preview list with image name and icon path
WALLPAPERS=$(find "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.png" -o -iname "*.jpeg" \))
ROFI_LIST=""
for wp in $WALLPAPERS; do
filename=$(basename "$wp")
# Generate thumbnail using imagemagick or copy if small
thumb_path="$TMP_DIR/''${filename}.png"
if [[ ! -f "$thumb_path" ]]; then
convert "$wp" -resize 100x100 "$thumb_path"
fi
ROFI_LIST+="$filename\x00icon\x1f$thumb_path\n"
done
SELECTED=$(echo -e "$ROFI_LIST" | rofi -dmenu "Select Wallpaper")
[[ -z "$SELECTED" ]] && exit 1
# Set the selected wallpaper
SELECTED_PATH="$WALLPAPER_DIR/$SELECTED"
# Update hyprpaper config (if needed) and reload
sleep 0.5 # Give it a moment to start
hyprctl hyprpaper unload all
hyprctl hyprpaper preload "$SELECTED_PATH"
hyprctl hyprpaper wallpaper "eDP-1,$SELECTED_PATH"
'')
];
};
}

View File

@ -140,9 +140,11 @@
then ../../../config/nerv.png
else if (userSettings.theme == "tokyo-night-dark")
then ../../../config/copeland.png
else if (userSettings.theme == "purple-dawn")
then ../../../config/ram.png
else ../../../config/mars.png;
logoAnimated =
if "evangelion-blood" == userSettings.theme || "tokyo-night-dark" == userSettings.theme
if "evangelion-blood" == userSettings.theme || "tokyo-night-dark" == userSettings.theme || "purple-dawn" == userSettings.theme
then false
else true;
};