From 1930d5d54bbde453f0d72ed659e2e4744b9997b0 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 10:26:47 -0300 Subject: [PATCH] --tray default to 0 --- CHANGELOG.md | 1 + README.md | 2 +- aur/panel_entry.py | 9 ++++++--- aur/tray_entry.py | 11 +++++++---- fpakman/app.py | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e4e69e..2e563f8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - suggestions are now retrieved asynchronously taking 45% less time. - search response takes an average of 20% less time ( reaching 35% for several results ) - app boot takes 98% less time when snapd is installed, but disabled +- FPAKMAN_TRAY (--tray) is not enabled by default (0). ### Fixes: - [flatpak dependency](https://github.com/vinifmor/fpakman/issues/36) diff --git a/README.md b/README.md index e5edc104..a3b8aa64 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ You can change some application settings via environment variables or arguments - **FPAKMAN_FLATPAK**: enables / disables flatpak usage. Use **0** (disable) or **1** (enabled, default) - **FPAKMAN_SNAP**: enables / disables snap usage. Use **0** (disable) or **1** (enabled, default) - **FPAKMAN_CHECK_PACKAGING_ONCE**: If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Use **0** (disable, default) or **1** (enable). -- **FPAKMAN_TRAY**: If the tray icon and update-check daemon should be created. Use **0** (disable) or **1** (enable, default). +- **FPAKMAN_TRAY**: If the tray icon and update-check daemon should be created. Use **0** (disable, default) or **1** (enable). - **FPAKMAN_SUGGESTIONS**: If application suggestions should be displayed if no app is installed (runtimes do not count as apps). Use **0** (disable) or **1** (enable, default). ### How to improve the application performance diff --git a/aur/panel_entry.py b/aur/panel_entry.py index a2e2887e..56493aa7 100644 --- a/aur/panel_entry.py +++ b/aur/panel_entry.py @@ -1,4 +1,5 @@ # Generates a .desktop file based on the current python version. Used for AUR installation +import os import sys desktop_file = """ @@ -7,11 +8,13 @@ Type = Application Name = fpakman Categories = System; Comment = Manage your Flatpak / Snap applications -Exec = /usr/bin/fpakman --tray=0 -Icon = /usr/lib/python{version}/site-packages/fpakman/resources/img/logo.svg +Exec = {path} +Icon = {lib_path}/python{version}/site-packages/fpakman/resources/img/logo.svg """ py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) with open('fpakman.desktop', 'w+') as f: - f.write(desktop_file.format(version=py_version)) + f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), + version=py_version, + path=os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman'))) diff --git a/aur/tray_entry.py b/aur/tray_entry.py index 881a95e6..77d2d9f2 100644 --- a/aur/tray_entry.py +++ b/aur/tray_entry.py @@ -1,17 +1,20 @@ # Generates a .desktop file based on the current python version. Used for AUR installation +import os import sys desktop_file = """ [Desktop Entry] Type = Application -Name = fpakman ( tray ) +Name = fpakman Categories = System; Comment = Manage your Flatpak / Snap applications -Exec = /usr/bin/fpakman -Icon = /usr/lib/python{version}/site-packages/fpakman/resources/img/logo.svg +Exec = {path} --tray=1 +Icon = {lib_path}/python{version}/site-packages/fpakman/resources/img/logo.svg """ py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) with open('fpakman_tray.desktop', 'w+') as f: - f.write(desktop_file.format(version=py_version)) + f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), + version=py_version, + path=os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman'))) diff --git a/fpakman/app.py b/fpakman/app.py index 1535103e..1eb7b586 100755 --- a/fpakman/app.py +++ b/fpakman/app.py @@ -45,7 +45,7 @@ parser.add_argument('-di', '--download-icons', action="store", choices=[0, 1], d parser.add_argument('--flatpak', action="store", default=os.getenv('FPAKMAN_FLATPAK', 1), choices=[0, 1], type=int, help='Enables / disables flatpak usage. Default: %(default)s') parser.add_argument('--snap', action="store", default=os.getenv('FPAKMAN_SNAP', 1), choices=[0, 1], type=int, help='Enables / disables snap usage. Default: %(default)s') parser.add_argument('-co', '--check-packaging-once', action="store", default=os.getenv('FPAKMAN_CHECK_PACKAGING_ONCE', 0), choices=[0, 1], type=int, help='If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Default: %(default)s') -parser.add_argument('--tray', action="store", default=os.getenv('FPAKMAN_TRAY', 1), choices=[0, 1], type=int, help='If the tray icon and update-check daemon should be created. Default: %(default)s') +parser.add_argument('--tray', action="store", default=os.getenv('FPAKMAN_TRAY', 0), choices=[0, 1], type=int, help='If the tray icon and update-check daemon should be created. Default: %(default)s') parser.add_argument('--sugs', action="store", default=os.getenv('FPAKMAN_SUGGESTIONS', 1), choices=[0, 1], type=int, help='If app suggestions should be displayed if no app is installed (runtimes do not count as apps). Default: %(default)s') args = parser.parse_args()