aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/PortalHyprland.sh
diff options
context:
space:
mode:
Diffstat (limited to 'config/hypr/scripts/PortalHyprland.sh')
-rwxr-xr-xconfig/hypr/scripts/PortalHyprland.sh40
1 files changed, 32 insertions, 8 deletions
diff --git a/config/hypr/scripts/PortalHyprland.sh b/config/hypr/scripts/PortalHyprland.sh
index 21cb7db4..653e9b58 100755
--- a/config/hypr/scripts/PortalHyprland.sh
+++ b/config/hypr/scripts/PortalHyprland.sh
@@ -2,15 +2,39 @@
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
# For manually starting xdg-desktop-portal-hyprland
+set -euo pipefail
+
+kill_quietly() {
+ killall -q "$1" 2>/dev/null || true
+}
+
+start_portal_binary() {
+ local description="$1"
+ shift
+ for candidate in "$@"; do
+ if [[ -x "$candidate" ]]; then
+ "$candidate" &
+ return 0
+ fi
+ done
+ echo "Warning: no $description binary found (checked: $*)" >&2
+ return 1
+}
+
sleep 1
-killall xdg-desktop-portal-hyprland
-killall xdg-desktop-portal-wlr
-killall xdg-desktop-portal-gnome
-killall xdg-desktop-portal
+kill_quietly xdg-desktop-portal-hyprland
+kill_quietly xdg-desktop-portal-wlr
+kill_quietly xdg-desktop-portal-gnome
+kill_quietly xdg-desktop-portal
sleep 1
-/usr/lib/xdg-desktop-portal-hyprland &
-/usr/libexec/xdg-desktop-portal-hyprland &
+
+start_portal_binary "xdg-desktop-portal-hyprland" \
+ /usr/lib/xdg-desktop-portal-hyprland \
+ /usr/libexec/xdg-desktop-portal-hyprland
+
sleep 2
-/usr/lib/xdg-desktop-portal &
-/usr/libexec/xdg-desktop-portal &
+
+start_portal_binary "xdg-desktop-portal" \
+ /usr/lib/xdg-desktop-portal \
+ /usr/libexec/xdg-desktop-portal
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage