#!/bin/bash set -euo pipefail source "$(dirname "${BASH_SOURCE[0]}")/../../lib/logging.sh" log "Installing ydotool (pacman)..." sudo pacman -S --noconfirm --needed ydotool log "Installing OpenDeck (Flatpak)..." ensure_flatpak flatpak install -y flathub com.mairtech.OpenDeck log "Wiring ydotoold + OpenDeck into Hyprland autostart..." AUTOSTART="$HOME/Dotfiles/desktopenvs/hyprlua/hypr/usr/autostart.lua" if grep -q "ydotoold\|OpenDeck\|com.mairtech.OpenDeck" "$AUTOSTART"; then skip "ydotoold/OpenDeck already present in autostart.lua — skipping." else # Insert before the closing end) so entries appear inside the on("hyprland.start") block sed -i 's|^end)$| hl.exec_cmd("ydotoold")\n hl.exec_cmd("flatpak run com.mairtech.OpenDeck")\nend)|' "$AUTOSTART" log "Autostart entries added." fi log "OpenDeck + ydotool installed."