Name: athena-tweak-tool Version: 0 Release: 3.g7552982%{?dist} Summary: Tweak Tool to manage the graphical environment in Athena OS License: GPL-3.0-or-later URL: https://github.com/Athena-OS/athena-tweak-tool Source0: https://github.com/Athena-OS/athena-tweak-tool/archive/refs/heads/main.tar.gz#/athena-tweak-tool-main.tar.gz Source1: theme-switcher BuildArch: noarch Requires: exo Requires: python3-distro Requires: python3-numpy Requires: python3-psutil Requires: xorg-x11-xauth %description A graphical TUI tool to tweak the Athena OS desktop environment. Provides wrappers for actions using polkit authentication. %prep %autosetup -n %{name}-main %build # No build required %install mkdir -p %{buildroot}/usr/bin mkdir -p %{buildroot}/usr/share/%{name} mkdir -p %{buildroot}/usr/share/applications mkdir -p %{buildroot}/usr/share/polkit-1/actions # Script and data install -m 755 %{SOURCE1} %{buildroot}/usr/bin/theme-switcher install -m 644 athena-tweak-tool.desktop %{buildroot}/usr/share/applications/ install -m 644 org.athena.tweaktool.policy %{buildroot}/usr/share/polkit-1/actions/ # Python files and assets cp -a athena-tweak-tool/* %{buildroot}/usr/share/%{name}/ # Wrapper script cat > %{buildroot}/usr/bin/athena-tweak-tool << 'EOF' #!/usr/bin/env bash echo "---------------------------------------------------------------------------" echo "[INFO]: Checking session" test $(whoami) == "root" && echo "[ERROR]: Do not run this script as root." && exit 1 test -z $DISPLAY && echo "[ERROR]: DISPLAY variable is not set." && exit 1 SESSION=$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type | awk -F= '{print $2}' | grep "x11\|wayland\|tty") test -z "$SESSION" && echo "[ERROR]: Failed to verify session for user, SESSION = $SESSION" && exit 1 XAUTHORITY=$(xauth info | awk -F"Authority file:" '{print $2}' | tr -d ' ') test -z "$XAUTHORITY" && echo "[ERROR]: XAUTHORITY file is not set" && exit 1 test -s "$XAUTHORITY" || touch "$XAUTHORITY" XAUTH_HONORED=$(xauth info | awk -F"Changes honored:" '{print $2}' | tr -d ' ') test $XAUTH_HONORED = "yes" || echo "[ERROR]: Xauth changes honored = no, restart X server" || exit 1 echo "[INFO]: XAUTHORITY = $XAUTHORITY" echo "[INFO]: DBUS_SESSION_BUS_ADDRESS = $DBUS_SESSION_BUS_ADDRESS" echo "[INFO]: DESKTOP SESSION = $DESKTOP_SESSION" function start_in_wayland() { echo "[INFO]: Starting in Wayland session" xauth gen $DISPLAY &> /dev/null pkexec '/usr/share/athena-tweak-tool/athena-tweak-tool.py' } function start_in_x11() { echo "[INFO]: Starting in X11 session" pkexec '/usr/share/athena-tweak-tool/athena-tweak-tool.py' } function start_in_tty() { echo "[INFO]: Starting in TTY session" pkexec '/usr/share/athena-tweak-tool/athena-tweak-tool.py' } case "$SESSION" in "wayland") start_in_wayland ;; "x11") start_in_x11 ;; "tty") start_in_tty ;; *) echo "[WARN]: Session unknown, checking XDG_SESSION_TYPE" case "$XDG_SESSION_TYPE" in "wayland") start_in_wayland ;; "tty") start_in_tty ;; "x11") start_in_x11 ;; *) echo "[ERROR]: Unknown session, cannot continue"; exit 1 ;; esac ;; esac echo "---------------------------------------------------------------------------" EOF chmod +x %{buildroot}/usr/bin/athena-tweak-tool %files /usr/bin/athena-tweak-tool /usr/bin/theme-switcher /usr/share/%{name} /usr/share/applications/athena-tweak-tool.desktop /usr/share/polkit-1/actions/org.athena.tweaktool.policy %changelog Sat Apr 12 2025 Little Owl - synced with upstream