Add wallpaper selection script + rofi theme

This commit is contained in:
retrilzzy committed 2025-11-16 19:21:12 +05:00
1 parent a83fca168a
commit 721cfdd1b2
3 files changed
+208 -2

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -euo pipefail
CACHE_DIR="$HOME/.cache"
LOCK_BG_PATH="$CACHE_DIR/lock_background"
WALLPAPER_DIR="$HOME/Pictures/Wallpapers"
IMAGE_PICKER_CONFIG="$HOME/.config/rofi/wallpapers.rasi"
mapfile -t WALLPAPERS < <(
find "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | sort
)
CURRENT_WALLPAPER=$(basename "$(swww query | awk '/image:/ {print $NF}')")
ROFI_MENU=""
for path in "${WALLPAPERS[@]}"; do
name=$(basename "$path")
if [[ "$name" == "$CURRENT_WALLPAPER" ]]; then
ROFI_MENU+="${name} (current)\0icon\x1f${path}\n"
else
ROFI_MENU+="${name}\0icon\x1f${path}\n"
fi
done
SELECTED=$(printf "%b" "$ROFI_MENU" | rofi -dmenu -theme "$IMAGE_PICKER_CONFIG" -p " ")
[[ -z "$SELECTED" ]] && exit 0
SELECTED_CLEAN=${SELECTED// \(current\)/}
SELECTED_PATH="$WALLPAPER_DIR/$SELECTED_CLEAN"
if [[ ! -f "$SELECTED_PATH" ]]; then
notify-send "Wallpaper error" "File not found: $SELECTED_PATH"
exit 1
fi
px=$(shuf -i 0-100 -n 1 | awk '{printf "%.2f", $1/100}')
py=$(shuf -i 0-100 -n 1 | awk '{printf "%.2f", $1/100}')
transition_pos="$px,$py"
swww img -t grow \
--transition-pos "$transition_pos" \
--transition-duration 1.8 \
--transition-step 255 \
--transition-fps 60 \
"$SELECTED_PATH"
matugen image "$SELECTED_PATH"
mkdir -p "$CACHE_DIR"
cp "$SELECTED_PATH" "$LOCK_BG_PATH"
@@ -5,7 +5,7 @@
# https://wiki.hyprland.org/Configuring/Keywords/
$terminal = kitty
$fileManager = nautilus
$editor = code
$editor = vscodium
$browser = brave
$passwordManager = keepassxc
@@ -28,7 +28,9 @@ bind = $mainMod, C, exec, $editor
bind = $mainMod, B, exec, $browser
bind = $mainMod, K, exec, $passwordManager
bind = $mainMod SHIFT, P, exec, waypaper
# bind = $mainMod SHIFT, P, exec, waypaper
bind = $mainMod SHIFT, P, exec, ~/.config/bin/wall-selector.sh
bind = $mainMod SHIFT, E, exec, emote
bind = $mainMod, R, exec, rofi -show drun -theme ~/.config/rofi/launcher.rasi
+152
View File
@@ -0,0 +1,152 @@
/*****----- Global Properties -----*****/
@import "./colors.rasi"
/*****----- Configuration -----*****/
configuration {
modi: "drun";
show-icons: true;
display-drun: " ";
drun-display-format: "{name}";
}
/*****----- Main Window -----*****/
window {
transparency: "real";
location: south;
width: 950px;
x-offset: 0px;
y-offset: -50px;
margin: 0px;
padding: 0px;
border: 2px solid;
border-radius: 30px;
border-color: @selected;
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 20px;
margin: 0px;
padding: 30px;
border: 0px solid;
border-radius: 0px 0px 0px 0px;
border-color: @selected;
background-color: transparent;
children: [ "inputbar", "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
spacing: 8px;
margin: 0px;
padding: 8px 16px;
border: 0px 0px 2px 0px;
border-radius: 100%;
border-color: @selected;
background-color: @background-alt;
text-color: @foreground;
children: [ "prompt", "entry" ];
}
prompt {
background-color: inherit;
text-color: inherit;
}
textbox-prompt-colon {
expand: false;
str: "::";
background-color: inherit;
text-color: inherit;
}
entry {
background-color: inherit;
text-color: inherit;
cursor: text;
placeholder: "Search";
placeholder-color: inherit;
}
/*****----- Listview -----*****/
listview {
columns: 3;
lines: 1;
cycle: false;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: false;
spacing: 5px;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
}
scrollbar {
handle-width: 5px ;
handle-color: @selected;
border-radius: 0px;
background-color: @background-alt;
}
/*****----- Elements -----*****/
element {
spacing: 0px;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
orientation: vertical;
cursor: pointer;
}
element normal.normal {
background-color: transparent;
text-color: @foreground;
}
element selected.normal {
border: 0px 0px 2px 0px;
border-radius: 12px;
border-color: @selected;
background-color: @background-alt;
text-color: @foreground;
}
element-icon {
background-color: transparent;
text-color: inherit;
size: 256px;
cursor: inherit;
}
element-text {
background-color: transparent;
text-color: inherit;
highlight: inherit;
cursor: inherit;
horizontal-align: 0.5;
padding: 10px;
}
/*****----- Message -----*****/
error-message {
padding: 20px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: black / 10%;
text-color: @foreground;
}
textbox {
background-color: transparent;
text-color: @foreground;
vertical-align: 0.5;
horizontal-align: 0.0;
}