From 377a595dff0329cf9a6a15facef5261905bde7b4 Mon Sep 17 00:00:00 2001 From: Nino PChome Date: Mon, 30 Mar 2026 15:21:50 -0600 Subject: [PATCH] mod 3 --- dmenu_set_wallpaper.sh | 111 ++++++++++++++++++++++++++++++++++++ wallpaper-caelestia-main.sh | 5 ++ 2 files changed, 116 insertions(+) create mode 100644 dmenu_set_wallpaper.sh diff --git a/dmenu_set_wallpaper.sh b/dmenu_set_wallpaper.sh new file mode 100644 index 0000000..e45f042 --- /dev/null +++ b/dmenu_set_wallpaper.sh @@ -0,0 +1,111 @@ +#!/bin/bash/ + +#SE ENCARGA DE DESPLEGAR EN UN DMENU CON LA LISTA DE WALLPAPERS QUE HAY EN /scripts/wallpapers_list.txt +#Y AL SELECCIONAR UNO MODIFICA EL ARCHIVO + +source ~/scripts/constantlib.sh +#modifica el wallpaper recibe 3 parametros el link de steam, el monitor y el ajuste de pantalla +setwallpaper='/home/arthur/scripts/set-wallpaperengine.sh' +wengine_setter='/home/arthur/.config/themes/wallpaper-engine.sh' +wengine_setter_tema='/home/arthur/.config/themes/wallpaper-engine.sh.' +not_found="$HOME/Pictures/.cache_wgengine/not_found.jpg" +hyprpaper="$HOME/.config/hypr/hyprpaper.conf" +dir="$HOME/.config/rofi/launchers/type-7" +theme='style-9' + +wallpapers_dir="$HOME/Pictures/wallpapers" + +opciones_monitors="" +opciones_wallpapers="" +lineas_wallpapers=0 + +label="󰍹_Monitor: " +label_w="_Wallpaper: " + +linea4=$( sed -n '4p' ~/.bashrc ) +valor_tem=$(echo $linea4 | cut -d '=' -f2) +wengine_setter_tema=$wengine_setter_tema$valor_tem + +opciones_wallpapers=$opciones_wallpapers"kill ~ none\n" +while read -r nombre url scaling; do + ID=$(cut -c 56-$lenght <<< $url) + img="$HOME/Pictures/.cache_wgengine/$ID.png" + nombre=$(printf '%-35s' "$nombre") + if [ -e "$img" ]; then + opciones_wallpapers=$opciones_wallpapers$nombre" ~ "$url" ~ "$scaling"\0icon\x1f$img\n" + else + opciones_wallpapers=$opciones_wallpapers$nombre" ~ "$url" ~ "$scaling"\0icon\x1f$not_found\n" + fi +done < ~/scripts/wallpapers_list.txt + + +wallpaper=$(echo -e "$opciones_wallpapers" | rofi -dmenu -p "$label_w" -theme ${dir}/${theme}.rasi ) + if [ -z "$wallpaper" ]; then + exit 1 + fi + +IFS='~' read -r -a partes <<< "$wallpaper" + +wallpaper=${partes[1]} +opc=${partes[0]} +scaling=${partes[2]} + + +wallpaper=$(echo "$wallpaper" | sed 's/^[ \t]*//;s/[ \t]*$//') +opc=$(echo "$opc" | sed 's/^[ \t]*//;s/[ \t]*$//') + +#poner wallpaper al inicio del archivo de wallpapers +#primero eliminar fila + sed -i "/^$opc[[:space:]]/d" ~/scripts/wallpapers_list.txt + sed -i "1i$opc $wallpaper $scaling" ~/scripts/wallpapers_list.txt + + +if [ $opc == 'kill' ]; then + killall linux-wallpaperengine + sed -i "/^sh /c\sh ${setwallpaper} > /dev/null \&" "$wengine_setter" + sed -i "/^sh /c\sh ${setwallpaper} > /dev/null \&" "$wengine_setter_tema" +else + + temp_mon=$( hyprctl monitors -j | jq -r '.[].name' ) + + while IFS= read -r line + do + ruta=$(grep "wallpaper = $line," $hyprpaper | cut -d',' -f2) + opciones_monitors="$opciones_monitors$line""\0icon\x1f$ruta\n" + done <<< "$temp_mon" + + + monitor=$( echo -e "$opciones_monitors" |rofi -dmenu -p "$label" -theme ${dir}/${theme}.rasi ) + + IFS='\0icon' read -r -a partes <<< "$monitor" + + monitor=${partes[0]} + echo "MONITORES: "$monitor + + if [ -z "$monitor" ]; then + exit 1 + fi + + echo "HACIENDO SED DE :>>>>>>>"$monitor + sed -i "/#${monitor} preload/{n;s|^sh .*|sh ${setwallpaper} ${wallpaper} ${monitor} ${scaling} > /dev/null \& |}" "$wengine_setter" + #sed -i "/#${monitor} preload/{n;s|^sh .*|sh ${setwallpaper} ${wallpaper} ${monitor} ${scaling} |}" "$wengine_setter_tema" + + #PYWAL GENERATE + lenght=$(echo $wallpaper| wc -c) + workspace_ID=$(cut -c 56-$lenght <<< $wallpaper) + IMG_PATH=$HOME'/Pictures/.cache_wgengine/'$workspace_ID'.png' + + if [ -e "$IMG_PATH" ]; then + echo "El archivo existe" + else + linux-wallpaperengine --bg $workspace_ID --screenshot $IMG_PATH > /dev/null & + sleep 3 + echo "El archivo no existe" + echo "archivo creado>>>"$IMG_PATH + fi + + sh $HOME/.config/ranger/set_wallpaper.sh $IMG_PATH $monitor +fi + +killall linux-wallpaperengine +sh $wengine_setter diff --git a/wallpaper-caelestia-main.sh b/wallpaper-caelestia-main.sh index dc8d3bc..ef6f1b7 100644 --- a/wallpaper-caelestia-main.sh +++ b/wallpaper-caelestia-main.sh @@ -13,4 +13,9 @@ if [ "$scaling" == '' ]; then scaling='default' fi +##GENERAR PREVIEW + linux-wallpaperengine --fps 30 --scaling $scaling -s --disable-parallax --screen-root $monitor --bg $workspace_ID + + +