You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I installed the .rpm file I had to follow the GitHub to keep up with version updates.
Because then I would know when to update the program, since you do not get notified about it.
❔ Possible Solution
In SuperProductivity it would notify users of a new version being available.
This could be done in the form of a banner or a notification for example.
Then you could choose to install the update and restart the program.
⤴️ Describe alternatives you've considered
Currently I use a (bad) Python script which checks the current version of the program and the newest version from GitHub.
When it recognizes there is an out-of-date version in use, the Python script will show a red system tray icon.
When right-clicking on it you have to option to install the update or exit the tray icon.
I have created a new SuperProductivity desktop file, which launches this script at launch.
➕ Additional context
My Python script, maybe it can be useful.
Be warned I am a amateur Python programmer :).
importrequestsimportxml.etree.ElementTreeasETimportsubprocessimportosimportrefromPILimportImage, ImageDrawimportsysimportpystrayfrompystrayimportMenuItem, Iconfromdatetimeimportdatetimedefget_latest_version_from_atom_feed(atom_url):
response=requests.get(atom_url)
response.raise_for_status()
root=ET.fromstring(response.content)
entries=root.findall('{http://www.w3.org/2005/Atom}entry')
latest_version=Noneforentryinentries:
title=entry.find('{http://www.w3.org/2005/Atom}title').textiftitle:
version_match=re.search(r'(\d+\.\d+\.\d+)(?:-.*)?', title)
ifversion_match:
version=version_match.group(1)
if'-rc'notintitleand'-beta'notintitleand'-alpha'notintitle:
latest_version=versionbreakreturnlatest_versiondefget_current_version():
version_string=subprocess.check_output(['rpm', '-q', 'superProductivity']).decode().strip()
version_match=re.search(r'(\d+\.\d+\.\d+)', version_string)
returnversion_match.group(1) ifversion_matchelseNonedefcreate_color_block_icon(color):
width, height=64, 64image=Image.new('RGB', (width, height), (255, 255, 255))
draw=ImageDraw.Draw(image)
draw.rectangle([0, 0, width, height], fill=color)
returnimagedefon_quit(icon, item):
icon.stop()
deflog_update_status(message):
log_file_path=os.path.expanduser('~/Software/SuperProductivity/Update/update_log.txt')
os.makedirs(os.path.dirname(log_file_path), exist_ok=True)
withopen(log_file_path, 'a') aslog_file:
log_file.write(f"{datetime.now()}: {message}\n")
defdownload_and_update(icon):
icon.title="Downloading Update..."download_dir=os.path.expanduser('~/Software/SuperProductivity/Update')
rpm_file=os.path.join(download_dir, 'superProductivity-x86_64.rpm')
latest_release_url='https://github.com/johannesjo/super-productivity/releases/latest/download/superProductivity-x86_64.rpm'os.makedirs(download_dir, exist_ok=True)
print("Downloading latest update...")
log_update_status("Starting download of the latest update.")
try:
subprocess.run(['wget', '-O', rpm_file, latest_release_url], check=True)
print("Download complete.")
log_update_status("Download complete.")
exceptsubprocess.CalledProcessErrorase:
print("Failed to download the update.")
log_update_status(f"Failed to download the update: {e}")
returninstall_command=f"sudo rpm --upgrade {rpm_file}"print("Installing update...")
log_update_status("Installing update...")
try:
os.system(install_command)
print(f"Update installed successfully. SuperProductivity has been updated from {current_version} to {latest_version}.")
log_update_status(f"Update installed successfully. SuperProductivity has been updated from {current_version} to {latest_version}.")
os.remove(rpm_file)
print(f"Deleted the RPM file: {rpm_file}")
log_update_status(f"Deleted the RPM file: {rpm_file}")
sys.exit(0)
exceptExceptionase:
print(f"Error during installation: {e}")
log_update_status(f"Error during installation: {e}")
exit_choice=input("An error occurred during installation. Do you want to exit? (y/n): ").strip().lower()
ifexit_choice=='y':
print("Exiting the program.")
sys.exit(1)
atom_feed_url='https://github.com/johannesjo/super-productivity/releases.atom'latest_version=get_latest_version_from_atom_feed(atom_feed_url)
current_version=get_current_version()
print(f"Current Version: {current_version}")
print(f"Latest Version: {latest_version}")
iflatest_versionandcurrent_version<latest_version:
print(f"\033[91mYour SuperProductivity of version {current_version} is not up to date. The latest version is {latest_version}.\033[0m")
log_update_status(f"Your SuperProductivity of version {current_version} is not up to date. The latest version is {latest_version}.")
icon=Icon("version_check", create_color_block_icon((255, 0, 0)), "Update Available",
menu=pystray.Menu(
MenuItem("Download and Update", lambdaicon: download_and_update(icon)),
MenuItem("Quit", on_quit)
))
icon.run()
eliflatest_versionandcurrent_version==latest_version:
print(f"\033[92mYour SuperProductivity of version {current_version} is up to date since the latest version is {latest_version}.\033[0m")
log_update_status(f"Your SuperProductivity of version {current_version} is up to date since the latest version is {latest_version}.")
else:
print(f"\033[93mWe could not determine version information!\033[0m")
log_update_status("We could not determine version information!")
The text was updated successfully, but these errors were encountered:
tegridyfarmer
changed the title
Add update checker to for non-snap Linux versions.
Add update checker and installer for non-snap Linux versions.
Dec 5, 2024
Problem Statement
When I installed the .rpm file I had to follow the GitHub to keep up with version updates.
Because then I would know when to update the program, since you do not get notified about it.
❔ Possible Solution
In SuperProductivity it would notify users of a new version being available.
This could be done in the form of a banner or a notification for example.
Then you could choose to install the update and restart the program.
Currently I use a (bad) Python script which checks the current version of the program and the newest version from GitHub.
When it recognizes there is an out-of-date version in use, the Python script will show a red system tray icon.
When right-clicking on it you have to option to install the update or exit the tray icon.
I have created a new SuperProductivity desktop file, which launches this script at launch.
➕ Additional context
My Python script, maybe it can be useful.
Be warned I am a amateur Python programmer :).
The text was updated successfully, but these errors were encountered: