Skip to content

Commit 9a35dbc

Browse files
committed
feat: add set-wallpaper command, use env vars in scripts
1 parent 8b84a29 commit 9a35dbc

6 files changed

Lines changed: 371 additions & 13 deletions

File tree

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ If you love that vibe — welcome home.
6969

7070
### System Management
7171
- 🔄 **System updater** (`update-draphyOS`) — Interactive tool for system updates, security patches, and Fedora version upgrades
72+
- 🖼️ **Wallpaper manager** (`set-wallpaper`) — Updates desktop, lock screen, and login screen wallpaper
7273
- ⬆️ **Config updates** — Update draphyOS configs from GitHub with intelligent three-way merge (preserves your customizations)
7374
- 📦 **Smart uninstall** — Tracks packages installed by draphyOS for clean removal (full reset to pre-install state)
7475
- 🔋 **Battery health** — Configurable charge limit with auto-detection for 10+ laptop vendors
@@ -508,6 +509,7 @@ Auto-detected and installed only if NVIDIA GPU is present.
508509
| Package state | `~/.draphyOS-packages-before` | Snapshot of packages before install (for clean uninstall) |
509510
| Config checksums | `~/.draphyOS-config-checksums` | MD5 checksums for three-way merge during updates |
510511
| Update script | `/usr/local/bin/update-draphyOS` | System-wide update command |
512+
| Wallpaper script | `/usr/local/bin/set-wallpaper` | Manages wallpaper for desktop/lock/login |
511513
| VERSION | `~/.draphyOS/VERSION` | Current draphyOS version number |
512514
| PACKAGES | `~/.draphyOS/PACKAGES` | Package manifest with version requirements |
513515

@@ -599,14 +601,29 @@ The installer automatically handles conflicts between TLP and power-profiles-dae
599601
</details>
600602

601603
<details>
602-
<summary><strong>🖼️ Wallpaper (feh)</strong></summary>
604+
<summary><strong>🖼️ Wallpaper</strong></summary>
605+
606+
draphyOS includes a wallpaper management command that updates desktop, lock screen, and login screen:
603607

604-
Change wallpaper:
605608
```bash
606-
feh --bg-fill /path/to/image.jpg
609+
set-wallpaper /path/to/image.png # Set new wallpaper
610+
set-wallpaper --current # Show current wallpaper paths
611+
set-wallpaper --reset # Reset to default draphyOS wallpaper
607612
```
608613

609-
The wallpaper is set automatically on login via `~/.xprofile`.
614+
**What it does:**
615+
- Copies image to `~/.config/wallpaper.png` (desktop/lock)
616+
- Copies to `/usr/share/backgrounds/draphyOS/` (login screen)
617+
- Clears lock screen cache (regenerates on next lock)
618+
- Applies immediately to desktop
619+
620+
**Supported formats:** PNG, JPG, JPEG, BMP, WEBP
621+
622+
**Manual method (feh only):**
623+
```bash
624+
feh --bg-fill /path/to/image.jpg
625+
```
626+
Note: This only changes the desktop, not lock/login screens.
610627

611628
</details>
612629

configs/i3/scripts/cheatsheet.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#!/bin/bash
2-
# Unified Cheatsheet Viewer with rofi search
2+
# Unified Cheatsheet Viewer with launcher search
33
# i3: Execute keybinding on Enter
44
# Others: Copy command to clipboard on Enter
55

66
set -u
77

8+
# Source global defaults
9+
if [ -f "${HOME}/.config/environment.d/defaults.conf" ]; then
10+
. "${HOME}/.config/environment.d/defaults.conf"
11+
fi
12+
13+
# Fallback if not set
14+
LAUNCHER="${LAUNCHER:-rofi}"
15+
816
SCRIPT_DIR="${HOME}/.config/i3/scripts"
917
CHEATSHEETS_DIR="${SCRIPT_DIR}/cheatsheets"
1018
I3_CONFIG="${HOME}/.config/i3/config"
@@ -21,8 +29,8 @@ check_dependencies() {
2129
local missing=()
2230

2331
# Required
24-
if ! command -v rofi &>/dev/null; then
25-
missing+=("rofi")
32+
if ! command -v "$LAUNCHER" &>/dev/null; then
33+
missing+=("$LAUNCHER")
2634
fi
2735

2836
# At least one clipboard tool
@@ -31,7 +39,7 @@ check_dependencies() {
3139
fi
3240

3341
if [ ${#missing[@]} -gt 0 ]; then
34-
# Try to show error via rofi if available, otherwise echo
42+
# Try to show error via notification, otherwise echo
3543
local msg="Missing required commands: ${missing[*]}"
3644
if command -v notify-send &>/dev/null; then
3745
notify-send "Cheatsheet Error" "$msg" -u critical
@@ -138,7 +146,7 @@ show_categories() {
138146
fi
139147
fi
140148

141-
printf '%s' "$categories" | sort -u | rofi -dmenu -i -p "Category" \
149+
printf '%s' "$categories" | sort -u | "$LAUNCHER" -dmenu -i -p "Category" \
142150
-no-show-icons \
143151
-theme-str 'window {location: center; anchor: center; width: 300px;}' \
144152
-theme-str 'listview {lines: 12; scrollbar: true;}'
@@ -170,7 +178,7 @@ show_i3() {
170178
sed 's/^[[:space:]]*## //' | \
171179
sed 's/ ##$//' | \
172180
awk -F ' // ' '{printf "%-12s │ %-25s │ %s\n", $1, $2, $3}' | \
173-
rofi -dmenu -i -p "$prompt" \
181+
"$LAUNCHER" -dmenu -i -p "$prompt" \
174182
-no-show-icons \
175183
-theme-str 'window {location: center; anchor: center; width: 800px; height: 70%;}' \
176184
-theme-str 'listview {lines: 15; scrollbar: true; fixed-height: false;}' \
@@ -194,7 +202,7 @@ show_i3() {
194202
if [ -n "$xdotool_key" ]; then
195203
# Validate key sequence before execution (security)
196204
if validate_xdotool_key "$xdotool_key"; then
197-
# Small delay to let rofi close
205+
# Small delay to let launcher close
198206
sleep 0.1
199207
xdotool key "$xdotool_key" || true
200208
else
@@ -236,7 +244,7 @@ show_cheatsheet() {
236244
fi
237245

238246
local selected
239-
selected=$(rofi -dmenu -i -p "$name (Enter to copy)" \
247+
selected=$("$LAUNCHER" -dmenu -i -p "$name (Enter to copy)" \
240248
-no-show-icons \
241249
-theme-str 'window {location: center; anchor: center; width: 850px; height: 70%;}' \
242250
-theme-str 'listview {lines: 15; scrollbar: true; fixed-height: false;}' \

install.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,6 +3056,39 @@ install_update_script() {
30563056
fi
30573057
}
30583058

3059+
# Install wallpaper management script
3060+
install_wallpaper_script() {
3061+
print_step "Installing wallpaper management script..."
3062+
3063+
local wallpaper_script="$INSTALL_DIR/scripts/set-wallpaper"
3064+
local target="/usr/local/bin/set-wallpaper"
3065+
3066+
if [ ! -f "$wallpaper_script" ]; then
3067+
print_warning "Wallpaper script not found, skipping"
3068+
return 0
3069+
fi
3070+
3071+
if ! sudo cp "$wallpaper_script" "$target"; then
3072+
print_warning "Failed to copy wallpaper script"
3073+
FAILED_ITEMS+=("wallpaper-script-copy")
3074+
return 1
3075+
fi
3076+
3077+
if ! sudo chmod +x "$target"; then
3078+
print_warning "Failed to make wallpaper script executable"
3079+
FAILED_ITEMS+=("wallpaper-script-chmod")
3080+
return 1
3081+
fi
3082+
3083+
# Verify installation
3084+
if [ -x "$target" ]; then
3085+
print_success "Wallpaper script installed: set-wallpaper (verified)"
3086+
else
3087+
print_warning "Wallpaper script may not be executable"
3088+
FAILED_ITEMS+=("wallpaper-script-verify")
3089+
fi
3090+
}
3091+
30593092
# Configure for VM environment (picom compatibility)
30603093
configure_vm() {
30613094
local is_vm=false
@@ -3253,6 +3286,7 @@ main() {
32533286
configure_battery_limit
32543287
create_marker
32553288
install_update_script
3289+
install_wallpaper_script
32563290

32573291
# Show summary of any failed items
32583292
show_summary
@@ -3275,6 +3309,7 @@ main() {
32753309
echo -e " Press ${MINT}Super+Return${NC} for terminal"
32763310
echo ""
32773311
echo -e " Run ${MINT}update-draphyOS${NC} to update your system"
3312+
echo -e " Run ${MINT}set-wallpaper${NC} <image> to change wallpaper"
32783313
echo ""
32793314
echo -e " ${MINT}Enjoy draphyOS!${NC}"
32803315
echo ""

0 commit comments

Comments
 (0)