Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.gigaide
.idea
tests/test.spec
-__pycache__
4 changes: 4 additions & 0 deletions bin/epm
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ check_command()
epm_cmd=play
direct_args=1
;;
play-update-tray) # HELPCMD: system tray applet for epm play updates
epm_cmd=play_update_tray
direct_args=1
;;
create-fake) # HELPCMD: create fake rpm
epm_cmd=create_fake
direct_args=1
Expand Down
121 changes: 121 additions & 0 deletions bin/epm-play_update_tray
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/sh
#
# Copyright (C) 2026 Etersoft
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

epm_play_update_tray()
{
local autostart_mode=""
local remove_autostart_mode=""
local help_mode=""

while [ -n "$1" ] ; do
case "$1" in
-h|--help)
help_mode="1"
shift
;;
-a|--autostart)
autostart_mode="1"
shift
;;
-r|--remove-autostart)
remove_autostart_mode="1"
shift
;;
*)
echo "Unknown option: $1" >&2
echo "Run 'epm play-update-tray --help' for help." >&2
return 1
;;
esac
done

if [ -n "$help_mode" ] ; then
message '
Usage: epm play-update-tray [options]

System tray applet for checking and applying epm play updates.

Options:
-a, --autostart Configure the applet to run automatically on login
-r, --remove-autostart Remove the autostart configuration
-h, --help Show this help message
'
return 0
fi

local autostart_dir="$HOME/.config/autostart"
local desktop_file="$autostart_dir/epm-play-update-tray.desktop"

if [ -n "$autostart_mode" ] ; then
mkdir -p "$autostart_dir"
cat <<EOF >"$desktop_file"
[Desktop Entry]
Type=Application
Name=EPM Update Tray
Comment=System tray applet for epm play updates
Exec=epm play-update-tray
Icon=system-software-update
Terminal=false
Categories=System;Monitor;
EOF
echo "Autostart configured: $desktop_file"
return 0
fi

if [ -n "$remove_autostart_mode" ] ; then
if [ -f "$desktop_file" ] ; then
rm -f "$desktop_file"
echo "Autostart configuration removed."
else
echo "No autostart configuration found."
fi
return 0
fi

if ! python3 -c "import PySide6" 2>/dev/null && \
! python3 -c "import PyQt6" 2>/dev/null ; then
echo "Error: PySide6 or PyQt6 is required to run the tray applet." >&2
if [ -t 0 ] ; then
printf "Would you like to install python3-module-pyside6 now? [y/N]: "
read -r answer
case "$answer" in
[yY]|[yY][eE][sS])
epm install python3-module-pyside6 || return 1
;;
*)
echo "Please install python3-module-pyside6 manually." >&2
return 1
;;
esac
else
echo "Please install python3-module-pyside6 to run the tray applet." >&2
return 1
fi
fi

export EPM_BIN
if [ -x "$PROGDIR/epm" ] ; then
EPM_BIN="$PROGDIR/epm"
else
EPM_BIN="epm"
fi

local tray_script="$SHAREDIR/epm-play_update_tray.py"
[ -r "$tray_script" ] || tray_script="$PROGDIR/epm-play_update_tray.py"
python3 "$tray_script"
}
Loading
Loading