aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/PortalHyprland.sh
blob: 3d3dc41034851243eecbd661a92b297f9ca6888f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
# ==================================================
#  KoolDots (2026)
#  Project URL: https://github.com/LinuxBeginnings
#  License: GNU GPLv3
#  SPDX-License-Identifier: GPL-3.0-or-later
# ==================================================
# For manually starting xdg-desktop-portal-hyprland

set -euo pipefail
is_ubuntu_family() {
  if [[ ! -r /etc/os-release ]]; then
    return 1
  fi

  # shellcheck disable=SC1091
  . /etc/os-release
  [[ "${ID:-}" == "ubuntu" \
    || "${ID:-}" == "linuxmint" \
    || "${ID:-}" == "zorin" \
    || "${ID:-}" == "rhino" \
    || "${ID_LIKE:-}" == *ubuntu* ]]
}

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
}
if ! is_ubuntu_family; then
  exit 0
fi

sleep 1
kill_quietly xdg-desktop-portal-hyprland
kill_quietly xdg-desktop-portal-wlr
kill_quietly xdg-desktop-portal-gnome
kill_quietly xdg-desktop-portal-gtk
kill_quietly xdg-desktop-portal
sleep 1

start_portal_binary "xdg-desktop-portal-hyprland" \
  /usr/lib/xdg-desktop-portal-hyprland \
  /usr/libexec/xdg-desktop-portal-hyprland

sleep 2

start_portal_binary "xdg-desktop-portal-gtk" \
  /usr/lib/xdg-desktop-portal-gtk \
  /usr/libexec/xdg-desktop-portal-gtk

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