summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/raveos-hyprland-session-init.sh
blob: 2734ea46719dea737ac66966edccf0e27a7ac5a0 (plain)
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
#!/usr/bin/env bash
# raveos-hyprland-session-init.sh
# ---------------------------------
# User session init: beállítja a háttérképet és GTK témát Hyprland alatt.
#
# Systemd user service hívja (raveos-hyprland-session-init.service).
# Csak akkor fut, ha HYPRLAND_INSTANCE_SIGNATURE be van állítva.

set -euo pipefail

# ---------------------------------------------------------------------------
# Várakozás Hyprland ready jelzésére
# ---------------------------------------------------------------------------
TIMEOUT=30
ELAPSED=0
while [[ -z "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; do
    if (( ELAPSED >= TIMEOUT )); then
        echo "Hiba: HYPRLAND_INSTANCE_SIGNATURE nem érkezett ${TIMEOUT}s alatt." >&2
        exit 1
    fi
    sleep 1
    (( ELAPSED++ ))
done

# ---------------------------------------------------------------------------
# Háttérkép beállítása (hyprpaper)
# ---------------------------------------------------------------------------
setup_wallpaper() {
    local wallpaper="${HOME}/.config/background.jpg"
    local hypr_conf="${HOME}/.config/hypr/hyprpaper.conf"

    if [[ ! -f "${wallpaper}" ]]; then
        echo "Nincs háttérkép: ${wallpaper}" >&2
        return 1
    fi

    cat > "${hypr_conf}" <<-EOF
preload = ${wallpaper}
wallpaper = ,${wallpaper}
splash = false
EOF

    if ! pgrep -x hyprpaper >/dev/null 2>&1; then
        hyprpaper &
        disown
        sleep 2
    fi
}

# ---------------------------------------------------------------------------
# GTK téma beállítása
# ---------------------------------------------------------------------------
setup_gtk() {
    gsettings set org.gnome.desktop.interface gtk-theme 'Yaru-olive-dark'
    gsettings set org.gnome.desktop.interface icon-theme 'Adwaitaru-olive'
}

# ---------------------------------------------------------------------------
# Futtatás
# ---------------------------------------------------------------------------
setup_wallpaper
setup_gtk