diff options
Diffstat (limited to 'config/hypr')
| -rw-r--r-- | config/hypr/configs/Startup_Apps.conf | 4 | ||||
| -rw-r--r-- | config/hypr/lua/startup.lua | 4 | ||||
| -rwxr-xr-x | config/hypr/scripts/WallpaperDaemon.sh | 50 | ||||
| -rwxr-xr-x | config/hypr/scripts/WaybarStartup.sh | 44 |
4 files changed, 83 insertions, 19 deletions
diff --git a/config/hypr/configs/Startup_Apps.conf b/config/hypr/configs/Startup_Apps.conf index f29b26f5..e83c414c 100644 --- a/config/hypr/configs/Startup_Apps.conf +++ b/config/hypr/configs/Startup_Apps.conf @@ -13,7 +13,7 @@ $livewallpaper="" $wallDIR = $HOME/Pictures/wallpapers # change path manually here if needed ### wallpaper stuff ### -exec-once = sh -c 'sleep 2; $HOME/.config/hypr/scripts/WallpaperDaemon.sh' +exec-once = sh -c 'sleep 2; $HOME/.config/hypr/scripts/WallpaperDaemon.sh; $HOME/.config/hypr/scripts/ApplyThemeMode.sh; $HOME/.config/hypr/scripts/WaybarStartup.sh' #exec-once = mpvpaper '*' -o "load-scripts=no no-audio --loop" $livewallpaper # wallpaper random #exec-once = $SwwwRandom $wallDIR # random wallpaper switcher every 30 minutes @@ -29,8 +29,6 @@ exec-once = swaync #exec-once = blueman-applet #exec-once = rog-control-center exec-once = $scriptsDir/PortalHyprland.sh -exec-once = sh $HOME/.config/hypr/scripts/ApplyThemeMode.sh -exec-once = sh $scriptsDir/WaybarStartup.sh # Cursor refresh (enabled by installer on hybrid NVIDIA/GDM setups) exec-once = sh -c 'sleep 0.3; hyprctl setcursor "${HYPRCURSOR_THEME:-Bibata-Modern-Ice}" "${HYPRCURSOR_SIZE:-24}"' exec-once = qs --log-rules "qt.qpa.wayland.textinput.warning=false" -c overview # Quickshell Overview diff --git a/config/hypr/lua/startup.lua b/config/hypr/lua/startup.lua index 10369d6f..6ff9f8ad 100644 --- a/config/hypr/lua/startup.lua +++ b/config/hypr/lua/startup.lua @@ -42,7 +42,7 @@ end -- Prefer lifecycle-hook orchestration for clarity while keeping exec_once -- reliability semantics for real-world startup behavior. local startup_commands = { - scriptsDir .. "/WallpaperDaemon.sh", + "sleep 2; $HOME/.config/hypr/scripts/WallpaperDaemon.sh; $HOME/.config/hypr/scripts/ApplyThemeMode.sh; $HOME/.config/hypr/scripts/WaybarStartup.sh", "$HOME/.config/hypr/initial-boot.sh", "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP", "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP", @@ -52,8 +52,6 @@ local startup_commands = { -- "nm-tray", "swaync", scriptsDir .. "/PortalHyprland.sh", - "sh $HOME/.config/hypr/scripts/ApplyThemeMode.sh", - "sh " .. scriptsDir .. "/WaybarStartup.sh", 'qs --log-rules "qt.qpa.wayland.textinput.warning=false" -c overview', 'qs --log-rules "qt.qpa.wayland.textinput.warning=false" -p $HOME/.config/quickshell/qs-hyprview', "hypridle", diff --git a/config/hypr/scripts/WallpaperDaemon.sh b/config/hypr/scripts/WallpaperDaemon.sh index aeb6c397..4725bc6b 100755 --- a/config/hypr/scripts/WallpaperDaemon.sh +++ b/config/hypr/scripts/WallpaperDaemon.sh @@ -38,6 +38,32 @@ get_monitors() { fi } +wait_for_monitors() { + local monitors="" + for _ in {1..120}; do + monitors="$(get_monitors 2>/dev/null | awk 'NF')" + if [ -n "$monitors" ]; then + printf '%s\n' "$monitors" + return 0 + fi + sleep 0.1 + done + return 1 +} + +default_wallpaper_path() { + local pictures_dir wall_dir + pictures_dir="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" + wall_dir="$pictures_dir/wallpapers" + + [ -d "$wall_dir" ] || return 1 + + find -L "$wall_dir" -type f \( \ + -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.bmp" -o \ + -iname "*.gif" -o -iname "*.webp" -o -iname "*.tiff" \ + \) -print | LC_ALL=C sort | awk 'NR == 1 {print; exit}' +} + apply_wallpaper_for_monitor() { local monitor="$1" local per_monitor_link="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/.current_wallpaper_${monitor}" @@ -91,6 +117,11 @@ apply_wallpaper_for_monitor() { fi fi + # Final fallback: use the first available wallpaper from the wallpapers directory. + if [ -z "$wallpaper_path" ]; then + wallpaper_path="$(default_wallpaper_path 2>/dev/null || true)" + fi + if [ -n "$wallpaper_path" ] && [ -f "$wallpaper_path" ]; then local resize_mode resize_mode="$(wallpaper_resize_mode "$wallpaper_path" "$monitor")" @@ -98,10 +129,25 @@ apply_wallpaper_for_monitor() { sleep 0.3 "$WWW_CMD" img -o "$monitor" --resize "$resize_mode" "$wallpaper_path" >/dev/null 2>&1 & fi + printf '%s\n' "$wallpaper_path" + return 0 fi + + return 1 } +applied_wallpaper="" while read -r monitor; do [ -n "$monitor" ] || continue - apply_wallpaper_for_monitor "$monitor" -done < <(get_monitors) + applied_path="$(apply_wallpaper_for_monitor "$monitor" || true)" + if [ -z "$applied_wallpaper" ] && [ -n "$applied_path" ] && [ -f "$applied_path" ]; then + applied_wallpaper="$applied_path" + fi +done < <(wait_for_monitors || true) + +"$SCRIPTSDIR/RofiFocusedWallpaperLink.sh" >/dev/null 2>&1 || true + +waybar_colors="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/wallust/colors-waybar.css" +if [ ! -s "$waybar_colors" ] && [ -n "$applied_wallpaper" ] && [ -x "$SCRIPTSDIR/WallustSwww.sh" ]; then + "$SCRIPTSDIR/WallustSwww.sh" "$applied_wallpaper" >/dev/null 2>&1 || true +fi diff --git a/config/hypr/scripts/WaybarStartup.sh b/config/hypr/scripts/WaybarStartup.sh index 5691c86b..575a7a2b 100755 --- a/config/hypr/scripts/WaybarStartup.sh +++ b/config/hypr/scripts/WaybarStartup.sh @@ -10,10 +10,32 @@ runtime_dir="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" export XDG_RUNTIME_DIR="$runtime_dir" +SCRIPTSDIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts" is_waybar_running() { pgrep -x "waybar" >/dev/null 2>&1 || pgrep -x '\.waybar-wrapped' >/dev/null 2>&1 } +wait_for_waybar() { + for _ in $(seq 1 30); do + is_waybar_running && return 0 + sleep 0.1 + done + return 1 +} +ensure_wallust_waybar_colors() { + local colors_file="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/wallust/colors-waybar.css" + [ -s "$colors_file" ] && return 0 + + if [ -x "$SCRIPTSDIR/WallustSwww.sh" ]; then + "$SCRIPTSDIR/WallustSwww.sh" >/dev/null 2>&1 || true + fi + + for _ in $(seq 1 40); do + [ -s "$colors_file" ] && return 0 + sleep 0.1 + done + return 1 +} sync_portal_env() { if command -v dbus-update-activation-environment >/dev/null 2>&1; then dbus-update-activation-environment --systemd \ @@ -68,12 +90,14 @@ wait_for_wayland() { start_waybar_direct() { if command -v waybar >/dev/null 2>&1; then waybar >/dev/null 2>&1 & - return 0 + wait_for_waybar + return $? fi if command -v .waybar-wrapped >/dev/null 2>&1; then .waybar-wrapped >/dev/null 2>&1 & - return 0 + wait_for_waybar + return $? fi return 1 @@ -87,8 +111,7 @@ start_waybar_via_systemd() { [ -n "$load_state" ] && [ "$load_state" != "not-found" ] || return 1 systemctl --user start waybar.service >/dev/null 2>&1 || return 1 - sleep 0.4 - is_waybar_running + wait_for_waybar } main() { @@ -97,18 +120,17 @@ main() { wait_for_wayland || true sync_portal_env start_portal_services || true + ensure_wallust_waybar_colors || true is_waybar_running && exit 0 - if start_waybar_via_systemd; then + if start_waybar_via_systemd || start_waybar_direct; then exit 0 fi - - if is_waybar_running; then - exit 0 - fi - - start_waybar_direct || exit 1 + # One retry after attempting to refresh wallust templates. + ensure_wallust_waybar_colors || true + sleep 0.3 + start_waybar_via_systemd || start_waybar_direct || exit 1 } main |
