summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorryukamish <[email protected]>2026-04-19 19:26:28 +0530
committerryukamish <[email protected]>2026-04-19 19:26:28 +0530
commit484dcc01c26d2567048d5d279dfce25399d7a6be (patch)
treec7ca94149934ef2354bf3ead8c64ade78b485497 /scripts
parent457a1eb0b6d1e835d04388b6ecea718817df1f62 (diff)
add: path fix for niriwall and idling toggle for swayidle
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/niriwall32
-rwxr-xr-xscripts/rofi-menu2
-rwxr-xr-xscripts/toggle-idle12
3 files changed, 45 insertions, 1 deletions
diff --git a/scripts/niriwall b/scripts/niriwall
new file mode 100755
index 0000000..11c098a
--- /dev/null
+++ b/scripts/niriwall
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+WALLDIR="$HOME/Pictures/Wallpapers"
+CACHE="$HOME/.cache/rofi-wallpaper"
+mkdir -p "$CACHE"
+
+# Generate thumbnails (only missing ones)
+find "$WALLDIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" \) | while read -r img; do
+ name="$(basename "$img")"
+ thumb="$CACHE/$name.png"
+ [ ! -f "$thumb" ] && magick "$img" -resize 500x500^ -gravity center -extent 500x500 "$thumb"
+done
+
+# This is the key: use -show-icons and tell rofi where the icons are
+chosen=$(find "$WALLDIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" \) | sort |
+ while read -r img; do
+ name="$(basename "$img")"
+ echo -e "$name\0icon\x1f$CACHE/$name.png"
+ done |
+ rofi -dmenu \
+ -p "Wallpaper" \
+ -i \
+ -show-icons \
+ -theme-str 'window { width: 90%; height: 80%; }' \
+ -theme-str 'listview { columns: 5; lines: 3; spacing: 20px; }' \
+ -theme-str 'element-icon { size: 200px; horizontal-align: 0.5; }' \
+ -theme-str 'element-text { enabled: false; }')
+
+[ -z "$chosen" ] && exit
+
+fullpath="$WALLDIR/$chosen"
+awww img "$fullpath" --transition-type wipe --transition-fps 60 --transition-angle 45 --transition-step 30
diff --git a/scripts/rofi-menu b/scripts/rofi-menu
index 199a32c..cec9287 100755
--- a/scripts/rofi-menu
+++ b/scripts/rofi-menu
@@ -38,7 +38,7 @@ case "$menu_args" in
theme_args=$(printf '%b' '󰸉 Change Wallpaper\n Colorscheme' | rofi -dmenu -p '' -i)
case "$theme_args" in
*Change\ Wallpaper)
- ~/.local/bin/hyprwall
+ ~/.local/bin/niriwall
;;
*Colorscheme)
theme_args=$(printf '%b' 'Black Lotus\nCatppuccin Mocha\nDracula\nGruvbox Dark\nKanagawa\nRose Pine\nTokyonight' | rofi -dmenu -p 'Colorscheme: ' -i)
diff --git a/scripts/toggle-idle b/scripts/toggle-idle
new file mode 100755
index 0000000..c5334bf
--- /dev/null
+++ b/scripts/toggle-idle
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+chk_idle=$(pgrep swayidle)
+if [ -n "$chk_idle" ]; then
+ pkill swayidle && notify-send "SWAYIDLE" "Idling stopped"
+else
+ setsid -f swayidle -w \
+ timeout 600 'swaylock -f' \
+ timeout 630 'niri msg action power-off-monitors' \
+ resume 'niri msg action power-on-monitors' \
+ before-sleep 'swaylock -f' && \
+ notify-send "SWAYIDLE" "Idling started"
+fi