diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-02-03 17:24:53 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-02-03 17:24:53 +0900 |
| commit | 90fe32a08a1c6a9234916d5fab15c82851b0f0a2 (patch) | |
| tree | f8619d735c712345fa0196af5cee4c2877ce110b | |
| parent | c7fd362a7c2c69434890ed5edfcea58d32cfeb53 (diff) | |
added support to make current wallpaper to SDDM (NOTE: need sequoia wallpaper)
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperEffects.sh | 25 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperSelect.sh | 26 | ||||
| -rwxr-xr-x | copy.sh | 80 |
3 files changed, 102 insertions, 29 deletions
diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh index ccb5b744..14da323d 100755 --- a/config/hypr/UserScripts/WallpaperEffects.sh +++ b/config/hypr/UserScripts/WallpaperEffects.sh @@ -10,6 +10,7 @@ focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{pri # Directory for swaync iDIR="$HOME/.config/swaync/images" +iDIRi="$HOME/.config/swaync/icons" # swww transition config FPS=60 @@ -62,7 +63,6 @@ main() { [[ "$effect" != "No Effects" ]] && options+=("$effect") done - # Show rofi menu and handle user choice choice=$(printf "%s\n" "${options[@]}" | LC_COLLATE=C sort | rofi -dmenu -i -config ~/.config/rofi/config-wallpaper-effect.rasi) # Process user choice @@ -98,3 +98,26 @@ if pidof rofi > /dev/null; then fi main + +sleep 2 +# supports sddm sequoia_2 theme only +sddm_sequoia="/usr/share/sddm/themes/sequoia_2" +if [ -d "$sddm_sequoia" ]; then + notify-send -i "$iDIRi/picture.png" "Set wallpaper" "as SDDM background?" \ + -t 10000 \ + -A "yes=Yes" \ + -A "no=No" \ + -h string:x-canonical-private-synchronous:wallpaper-notify + + dbus-monitor "interface='org.freedesktop.Notifications',member='ActionInvoked'" | + while read -r line; do + if echo "$line" | grep -q "yes"; then + # User chose "Yes", copy the wallpaper with correct syntax + pkexec /usr/bin/cp -r "$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified" "$sddm_sequoia/backgrounds/default" + notify-send -i "$iDIRi/picture.png" "SDDM" "Background SET" + break + elif echo "$line" | grep -q "no"; then + break + fi + done & +fi diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 7d6b339f..043c3c96 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -5,6 +5,7 @@ # WALLPAPERS PATH wallDIR="$HOME/Pictures/wallpapers" SCRIPTSDIR="$HOME/.config/hypr/scripts" +iDIR="$HOME/.config/swaync/icons" # variables focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}') @@ -106,4 +107,27 @@ wait $! wait $! sleep 2 -"$SCRIPTSDIR/Refresh.sh"
\ No newline at end of file +"$SCRIPTSDIR/Refresh.sh" + +sleep 2 +sddm_sequoia="/usr/share/sddm/themes/sequoia_2" +if [ -d "$sddm_sequoia" ]; then + notify-send -i "$iDIR/picture.png" "Set wallpaper" "as SDDM background?" \ + -t 10000 \ + -A "yes=Yes" \ + -A "no=No" \ + -h string:x-canonical-private-synchronous:wallpaper-notify + + # Wait for user input using a background process + dbus-monitor "interface='org.freedesktop.Notifications',member='ActionInvoked'" | + while read -r line; do + if echo "$line" | grep -q "yes"; then + # User chose "Yes", copy the wallpaper with correct syntax + pkexec /usr/bin/cp -r "$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" "$sddm_sequoia/backgrounds/default" + notify-send -i "$iDIR/picture.png" "SDDM" "Background SET" + break + elif echo "$line" | grep -q "no"; then + break + fi + done & +fi @@ -296,8 +296,8 @@ while true; do # Convert the answer to lowercase for comparison answer=$(echo "$answer" | tr '[:upper:]' '[:lower:]') -# Check if the answer is valid -if [[ "$answer" == "y" ]]; then + # Check if the answer is valid + if [[ "$answer" == "y" ]]; then # Modify waybar clock modules if 12hr is selected # Clock 1 sed -i 's#^\(\s*\)//\("format": " {:%I:%M %p}",\) #\1\2 #g' config/waybar/Modules 2>&1 | tee -a "$LOG" @@ -327,36 +327,39 @@ if [[ "$answer" == "y" ]]; then echo "${OK} 12H format set on waybar clocks succesfully." 2>&1 | tee -a "$LOG" - # for SDDM (simple-sddm) - sddm_folder="/usr/share/sddm/themes/simple-sddm" - if [ -d "$sddm_folder" ]; then - echo "Simple sddm exists. Editing to 12H format" 2>&1 | tee -a "$LOG" + # Function to apply 12H format to SDDM themes + apply_sddm_12h_format() { + local sddm_directory=$1 + echo "Editing $sddm_directory to 12H format" 2>&1 | tee -a "$LOG" - sudo sed -i 's|^## HourFormat="hh:mm AP"|HourFormat="hh:mm AP"|' "$sddm_folder/theme.conf" 2>&1 | tee -a "$LOG" || true - sudo sed -i 's|^HourFormat="HH:mm"|## HourFormat="HH:mm"|' "$sddm_folder/theme.conf" 2>&1 | tee -a "$LOG" || true + sudo sed -i 's|^## HourFormat="hh:mm AP"|HourFormat="hh:mm AP"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$LOG" || true + sudo sed -i 's|^HourFormat="HH:mm"|## HourFormat="HH:mm"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$LOG" || true + } - echo "${OK} 12H format set to SDDM theme successfully." 2>&1 | tee -a "$LOG" - fi - - # for SDDM (simple-sddm-2) - sddm_folder_2="/usr/share/sddm/themes/simple-sddm-2" - if [ -d "$sddm_folder_2" ]; then - echo "Simple sddm 2 exists. Editing to 12H format" 2>&1 | tee -a "$LOG" + # Applying to different SDDM themes + apply_sddm_12h_format "/usr/share/sddm/themes/simple-sddm" + apply_sddm_12h_format "/usr/share/sddm/themes/simple-sddm-2" + apply_sddm_12h_format "/usr/share/sddm/themes/sequoia_2" - sudo sed -i 's|^## HourFormat="hh:mm AP"|HourFormat="hh:mm AP"|' "$sddm_folder_2/theme.conf" 2>&1 | tee -a "$LOG" || true - sudo sed -i 's|^HourFormat="HH:mm"|## HourFormat="HH:mm"|' "$sddm_folder_2/theme.conf" 2>&1 | tee -a "$LOG" || true + # for SDDM (sequoia_2) + sddm_directory_3="/usr/share/sddm/themes/sequoia_2" + if [ -d "$sddm_directory_3" ]; then + echo "sddm sequoia_2 theme exists. Editing to 12H format" 2>&1 | tee -a "$LOG" + sudo sed -i 's|^clockFormat="HH:mm"|## clockFormat="HH:mm"|' "$sddm_directory_3/theme.conf" 2>&1 | tee -a "$LOG" || true + if ! grep -q 'clockFormat="hh:mm AP"' "$sddm_directory_3/theme.conf"; then + sudo sed -i '/^clockFormat=/a clockFormat="hh:mm AP"' "$sddm_directory_3/theme.conf" 2>&1 | tee -a "$LOG" || true + fi - echo "${OK} 12H format set to SDDM theme successfully." 2>&1 | tee -a "$LOG" + echo "${OK} 12H format set to SDDM successfully." 2>&1 | tee -a "$LOG" + fi + break + elif [[ "$answer" == "n" ]]; then + echo "${NOTE} You chose not to change to 12H format." 2>&1 | tee -a "$LOG" + break + else + echo "${ERROR} Invalid choice. Please enter y for yes or n for no." fi - - break - elif [[ "$answer" == "n" ]]; then - echo "${NOTE} You chose not to change to 12H format." 2>&1 | tee -a "$LOG" - break - else - echo "${ERROR} Invalid choice. Please enter y for yes or n for no." - fi -done + done printf "\n" @@ -627,6 +630,29 @@ else "$HOME/.config/waybar/configs/[TOP] Default_v5" 2>&1 | tee -a "$LOG" || true fi +# for SDDM (sequoia_2) +sddm_sequioa="/usr/share/sddm/themes/sequoia_2" +if [ -d "$sddm_sequioa" ]; then + while true; do + read -rp "${CAT} SDDM sequoia_2 theme detected! Apply current wallpaper as SDDM background? (y/n)" SDDM_WALL + case $SDDM_WALL in + [Yy]) + # Copy the wallpaper, ignore errors if the file exists or fails + sudo cp -r "config/hypr/wallpaper_effects/.wallpaper_current" "/usr/share/sddm/themes/sequoia_2/backgrounds/default" || true + echo "${NOTE} Current wallpaper applied as default SDDM background" 2>&1 | tee -a "$LOG" + ;; + [Nn]) + echo "${NOTE} You chose not to apply the current wallpaper to SDDM." 2>&1 | tee -a "$LOG" + break + ;; + *) + echo "Please enter 'y' or 'n' to proceed." + ;; + esac + done +fi + + # additional wallpapers printf "\n%.0s" {1..1} echo "${MAGENTA}By default only a few wallpapers are copied${RESET}..." |
