aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr
diff options
context:
space:
mode:
Diffstat (limited to 'config/hypr')
-rw-r--r--config/hypr/configs/Startup_Apps.conf8
-rw-r--r--config/hypr/lua/startup.lua2
-rw-r--r--config/hypr/lua/user_startup_helper.lua2
-rwxr-xr-xconfig/hypr/scripts/DarkLight.sh3
-rwxr-xr-xconfig/hypr/scripts/PortalHyprland.sh14
-rwxr-xr-xconfig/hypr/scripts/Refresh.sh19
-rwxr-xr-xconfig/hypr/scripts/ToggleWaybarTime.sh6
-rwxr-xr-xconfig/hypr/scripts/WaybarStartup.sh49
8 files changed, 47 insertions, 56 deletions
diff --git a/config/hypr/configs/Startup_Apps.conf b/config/hypr/configs/Startup_Apps.conf
index dd078b70..990f9e1d 100644
--- a/config/hypr/configs/Startup_Apps.conf
+++ b/config/hypr/configs/Startup_Apps.conf
@@ -13,14 +13,10 @@ $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 & $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
-
-### Startup ###
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
+exec-once = $HOME/.config/hypr/scripts/WaybarStartup.sh
+exec-once = sh -c 'sleep 1; $HOME/.config/hypr/scripts/WallpaperDaemon.sh & $HOME/.config/hypr/scripts/ApplyThemeMode.sh'
exec-once = $scriptsDir/Polkit.sh
exec-once = nm-applet
#exec-once = nm-tray # For ubuntu Optional now
diff --git a/config/hypr/lua/startup.lua b/config/hypr/lua/startup.lua
index 88a9b106..429c2ce7 100644
--- a/config/hypr/lua/startup.lua
+++ b/config/hypr/lua/startup.lua
@@ -26,7 +26,7 @@ local function exec_once(cmd)
local marker = "/tmp/hypr-lua-exec-once-" .. session .. "-" .. key
local log = "/tmp/hypr-lua-startup-" .. key .. ".log"
local readiness =
- 'runtime=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}; export XDG_RUNTIME_DIR="$runtime"; for _ in $(seq 1 200); do if [ -n "$WAYLAND_DISPLAY" ] && [ -S "$runtime/$WAYLAND_DISPLAY" ]; then break; fi; for sock in "$runtime"/wayland-[0-9]*; do [ -S "$sock" ] || continue; case "$(basename "$sock")" in *awww*) continue ;; esac; export WAYLAND_DISPLAY="$(basename "$sock")"; break 2; done; sleep 0.1; done; if [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ]; then hypr_sock="$runtime/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket.sock"; for _ in $(seq 1 200); do [ -S "$hypr_sock" ] && break; sleep 0.1; done; fi'
+ 'runtime=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}; export XDG_RUNTIME_DIR="$runtime"; for _ in $(seq 1 30); do if [ -n "$WAYLAND_DISPLAY" ] && [ -S "$runtime/$WAYLAND_DISPLAY" ]; then break; fi; for sock in "$runtime"/wayland-[0-9]*; do [ -S "$sock" ] || continue; case "$(basename "$sock")" in *awww*) continue ;; esac; export WAYLAND_DISPLAY="$(basename "$sock")"; break 2; done; sleep 0.1; done; if [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ]; then for hypr_sock in "$runtime/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket.sock" "$runtime/hypr/.socket.sock"; do [ -S "$hypr_sock" ] && break 2; done; sleep 0.1; fi'
local inner = readiness .. "; " .. cmd
local script = "[ -e "
.. shell_quote(marker)
diff --git a/config/hypr/lua/user_startup_helper.lua b/config/hypr/lua/user_startup_helper.lua
index 2cc050b9..b26eac61 100644
--- a/config/hypr/lua/user_startup_helper.lua
+++ b/config/hypr/lua/user_startup_helper.lua
@@ -23,7 +23,7 @@ local function exec_once(cmd, opts)
local key = cmd:gsub("[^%w_.-]", "_"):sub(1, 80)
local marker = marker_prefix .. session .. "-" .. key
local log = log_prefix .. key .. ".log"
- local readiness = [[runtime=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}; export XDG_RUNTIME_DIR="$runtime"; for _ in $(seq 1 200); do if [ -n "$WAYLAND_DISPLAY" ] && [ -S "$runtime/$WAYLAND_DISPLAY" ]; then break; fi; for sock in "$runtime"/wayland-[0-9]*; do [ -S "$sock" ] || continue; case "$(basename "$sock")" in *awww*) continue ;; esac; export WAYLAND_DISPLAY="$(basename "$sock")"; break 2; done; sleep 0.1; done; if [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ]; then hypr_sock="$runtime/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket.sock"; for _ in $(seq 1 200); do [ -S "$hypr_sock" ] && break; sleep 0.1; done; fi]]
+ local readiness = [[runtime=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}; export XDG_RUNTIME_DIR="$runtime"; for _ in $(seq 1 30); do if [ -n "$WAYLAND_DISPLAY" ] && [ -S "$runtime/$WAYLAND_DISPLAY" ]; then break; fi; for sock in "$runtime"/wayland-[0-9]*; do [ -S "$sock" ] || continue; case "$(basename "$sock")" in *awww*) continue ;; esac; export WAYLAND_DISPLAY="$(basename "$sock")"; break 2; done; sleep 0.1; done; if [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ]; then for hypr_sock in "$runtime/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket.sock" "$runtime/hypr/.socket.sock"; do [ -S "$hypr_sock" ] && break 2; done; sleep 0.1; fi]]
local inner = readiness .. "; " .. cmd
local script = "[ -e " .. shell_quote(marker) .. " ] || { touch " .. shell_quote(marker) .. " && sh -lc " .. shell_quote(inner) .. " >>" .. shell_quote(log) .. " 2>&1 & }"
os.execute("sh -lc " .. shell_quote(script))
diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh
index fa62ebc2..913099fc 100755
--- a/config/hypr/scripts/DarkLight.sh
+++ b/config/hypr/scripts/DarkLight.sh
@@ -174,9 +174,8 @@ set_waybar_style() {
theme="$1"
waybar_styles="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/style"
waybar_style_link="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/style.css"
- style_prefix="\\[${theme}\\].*\\.css$"
- style_file=$(find -L "$waybar_styles" -maxdepth 1 -type f -regex ".*$style_prefix" | shuf -n 1)
+ style_file=$(find -L "$waybar_styles" -maxdepth 1 -type f \( -iname "${theme}-*.css" -o -iname "${theme}_*.css" -o -iname "[${theme}]*.css" -o -iname "${theme}*.css" \) | shuf -n 1)
if [ -n "$style_file" ]; then
ln -sf "$style_file" "$waybar_style_link"
diff --git a/config/hypr/scripts/PortalHyprland.sh b/config/hypr/scripts/PortalHyprland.sh
index 54ea71bb..e1ed2cae 100755
--- a/config/hypr/scripts/PortalHyprland.sh
+++ b/config/hypr/scripts/PortalHyprland.sh
@@ -120,12 +120,14 @@ restart_portal_via_systemd() {
done
systemctl --user start xdg-desktop-portal-hyprland.service >/dev/null 2>&1 || true
- if is_ubuntu_family; then
+ if command -v /usr/libexec/xdg-desktop-portal-gtk >/dev/null 2>&1 || command -v /usr/lib/xdg-desktop-portal-gtk >/dev/null 2>&1 || is_ubuntu_family; then
systemctl --user start xdg-desktop-portal-gtk.service >/dev/null 2>&1 || true
fi
+ systemctl --user start xdg-desktop-portal.service >/dev/null 2>&1 || true
for _ in $(seq 1 60); do
- if systemctl --user is-active --quiet xdg-desktop-portal-hyprland.service; then
+ if systemctl --user is-active --quiet xdg-desktop-portal-hyprland.service && \
+ systemctl --user is-active --quiet xdg-desktop-portal.service; then
return 0
fi
sleep 0.1
@@ -144,11 +146,9 @@ restart_portal_manually() {
sleep 2
- if is_ubuntu_family; then
- start_portal_binary "xdg-desktop-portal-gtk" \
- /usr/lib/xdg-desktop-portal-gtk \
- /usr/libexec/xdg-desktop-portal-gtk || true
- fi
+ start_portal_binary "xdg-desktop-portal-gtk" \
+ /usr/lib/xdg-desktop-portal-gtk \
+ /usr/libexec/xdg-desktop-portal-gtk || true
start_portal_binary "xdg-desktop-portal" \
/usr/lib/xdg-desktop-portal \
diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh
index a35b735a..79495d0f 100755
--- a/config/hypr/scripts/Refresh.sh
+++ b/config/hypr/scripts/Refresh.sh
@@ -33,7 +33,10 @@ pkill -f 'waybar-cava\..*\.conf' 2>/dev/null || true
# quit ags & relaunch ags
-ags -q && ags &
+if command -v ags >/dev/null 2>&1; then
+ ags -q >/dev/null 2>&1 || true
+ ags >/dev/null 2>&1 &
+fi
# quit quickshell & relaunch quickshell
pkill qs && qs --log-rules "$QS_TEXTINPUT_LOG_RULE" &
@@ -49,8 +52,10 @@ restart_waybar() {
local manage_with_systemd=0
if command -v systemctl >/dev/null 2>&1; then
- if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then
- manage_with_systemd=1
+ if systemctl --user --quiet is-active graphical-session.target 2>/dev/null || systemctl --user --quiet is-active wayland-session@*.target 2>/dev/null; then
+ if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then
+ manage_with_systemd=1
+ fi
fi
fi
@@ -80,9 +85,11 @@ restart_waybar
# relaunch swaync
sleep 0.3
-swaync >/dev/null 2>&1 &
-# reload swaync
-swaync-client --reload-config
+if ! pidof swaync >/dev/null 2>&1; then
+ swaync >/dev/null 2>&1 &
+fi
+# reload swaync (asynchronous to prevent DBus timeout delays)
+(swaync-client --reload-config >/dev/null 2>&1 &)
# Relaunching rainbow borders based on selected mode
sleep 1
diff --git a/config/hypr/scripts/ToggleWaybarTime.sh b/config/hypr/scripts/ToggleWaybarTime.sh
index 2273c3af..54eefb57 100755
--- a/config/hypr/scripts/ToggleWaybarTime.sh
+++ b/config/hypr/scripts/ToggleWaybarTime.sh
@@ -59,8 +59,10 @@ restart_waybar() {
local manage_with_systemd=0
if command -v systemctl >/dev/null 2>&1; then
- if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then
- manage_with_systemd=1
+ if systemctl --user --quiet is-active graphical-session.target 2>/dev/null || systemctl --user --quiet is-active wayland-session@*.target 2>/dev/null; then
+ if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then
+ manage_with_systemd=1
+ fi
fi
fi
diff --git a/config/hypr/scripts/WaybarStartup.sh b/config/hypr/scripts/WaybarStartup.sh
index 8cd36efb..7f8ee1e2 100755
--- a/config/hypr/scripts/WaybarStartup.sh
+++ b/config/hypr/scripts/WaybarStartup.sh
@@ -62,17 +62,11 @@ start_portal_services() {
}
wait_for_wayland() {
- # If WAYLAND_DISPLAY is already valid, use it.
if [ -n "${WAYLAND_DISPLAY:-}" ] && [ -S "$runtime_dir/$WAYLAND_DISPLAY" ]; then
return 0
fi
- # Otherwise wait briefly for an available Wayland socket.
- for _ in $(seq 1 120); do
- if [ -n "${WAYLAND_DISPLAY:-}" ] && [ -S "$runtime_dir/$WAYLAND_DISPLAY" ]; then
- return 0
- fi
-
+ for _ in $(seq 1 30); do
for socket in "$runtime_dir"/wayland-[0-9]*; do
[ -S "$socket" ] || continue
case "$(basename "$socket")" in
@@ -87,48 +81,41 @@ wait_for_wayland() {
return 1
}
+ensure_wallust_waybar_colors() {
+ local colors_file="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/wallust/colors-waybar.css"
+ mkdir -p "$(dirname "$colors_file")" 2>/dev/null || true
+ if [ ! -f "$colors_file" ]; then
+ touch "$colors_file" 2>/dev/null || true
+ fi
+ if [ ! -s "$colors_file" ] && [ -x "$SCRIPTSDIR/WallustSwww.sh" ]; then
+ "$SCRIPTSDIR/WallustSwww.sh" >/dev/null 2>&1 &
+ fi
+}
+
start_waybar_direct() {
if command -v waybar >/dev/null 2>&1; then
waybar >/dev/null 2>&1 &
- wait_for_waybar
- return $?
+ return 0
fi
if command -v .waybar-wrapped >/dev/null 2>&1; then
.waybar-wrapped >/dev/null 2>&1 &
- wait_for_waybar
- return $?
+ return 0
fi
return 1
}
-start_waybar_via_systemd() {
- [ -x "$(command -v systemctl)" ] || return 1
-
- local load_state
- load_state="$(systemctl --user show waybar.service --property=LoadState --value 2>/dev/null || true)"
- [ -n "$load_state" ] && [ "$load_state" != "not-found" ] || return 1
-
- systemctl --user start waybar.service >/dev/null 2>&1 || return 1
- wait_for_waybar
-}
-
main() {
- wait_for_wayland || true
- sync_portal_env
- # Portal services are already started by PortalHyprland.sh; no need to wait here.
- ensure_wallust_waybar_colors || true
-
is_waybar_running && exit 0
+ wait_for_wayland || true
+ sync_portal_env || true
+ ensure_wallust_waybar_colors
if start_waybar_via_systemd || start_waybar_direct; then
exit 0
fi
- # 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
+ exit 1
}
main
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage