diff --git a/.gitignore b/.gitignore
index 5db2bdc..3a062ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ nexus.egg-info/
**/__pycache__/
src/nexus/ui/*.py
src/nexus/translations/
+/resources_rc.py
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1c32a4f..1a4173a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -7,6 +7,7 @@ repos:
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
+ exclude: '^.+\.desktop$'
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: check-symlinks
@@ -46,7 +47,7 @@ repos:
- --statistics
- --max-line-length=120
- --per-file-ignores=src/nexus/Freqlog/backends/__init__.py:F401
- - --exclude=venv,src/nexus/ui
+ - --exclude=venv,src/nexus/ui,resources_rc.py
additional_dependencies: [flake8]
- id: pytest
name: pytest
diff --git a/com.charachorder.nexus.desktop b/com.charachorder.nexus.desktop
new file mode 100755
index 0000000..7c28cd4
--- /dev/null
+++ b/com.charachorder.nexus.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Comment=CharaChorder's all-in-one desktop app, supporting Linux, Windows, and macOS.
+Exec=nexus
+Icon=ui/images/icon.ico
+Name=nexus
+StartupNotify=true
+StartupWMClass=nexus
+Terminal=false
+Type=Application
diff --git a/dist.py b/dist.py
index 08e563d..262d96b 100755
--- a/dist.py
+++ b/dist.py
@@ -61,6 +61,10 @@ def run_command(command: str):
for f in glob.glob('ui/*.ui'):
run_command(f"{venv_path}pyside6-uic {f} -o src/nexus/ui/{Path(f).stem}.py")
+# Generate resources
+print("Generating resources...")
+run_command(f"{venv_path}pyside6-rcc ui/resources.qrc -o resources_rc.py")
+
# Generate translations
print("Generating TS templates...")
run_command(f"{venv_path}pyside6-lupdate " +
@@ -73,7 +77,7 @@ def run_command(command: str):
if not (args.no_build or args.ui_only):
# Pyinstaller command
- build_cmd = "pyinstaller --onefile --name nexus src/nexus/__main__.py"
+ build_cmd = "pyinstaller --onefile --name nexus src/nexus/__main__.py --icon ui/images/icon.ico"
if os_name == "notwin": # Add hidden imports for Linux
build_cmd += " --hidden-import pynput.keyboard._xorg --hidden-import pynput.mouse._xorg"
diff --git a/src/nexus/GUI.py b/src/nexus/GUI.py
index 0ba625e..3238047 100644
--- a/src/nexus/GUI.py
+++ b/src/nexus/GUI.py
@@ -9,15 +9,19 @@
QDialog, QFileDialog, QDialogButtonBox, QVBoxLayout, QLabel, QMenu, QSystemTrayIcon
from PySide6.QtGui import QIcon, QAction
+from nexus import __id__, __version__
from nexus.Freqlog import Freqlog
from nexus.ui.BanlistDialog import Ui_BanlistDialog
from nexus.ui.BanwordDialog import Ui_BanwordDialog
from nexus.ui.MainWindow import Ui_MainWindow
-
from nexus.style import Stylesheet, Colors
-
from nexus.Freqlog.Definitions import CaseSensitivity, WordMetadataAttr, WordMetadataAttrLabel, WordMetadata, Defaults
+if os.name == 'nt': # Needed for taskbar icon on Windows
+ import ctypes
+
+ ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(f"{__id__}.{__version__}")
+
class MainWindow(QMainWindow, Ui_MainWindow):
"""Set up the main window. Required because Qt is a PITA."""
@@ -85,10 +89,10 @@ def __init__(self, args: argparse.Namespace):
self.tr = self.translator.translate
# System tray
- self.tray_icon = QIcon(os.path.join(script_parent_path, 'assets', 'images', 'icon.ico'))
+ self.nexus_icon = QIcon(":images/icon.ico")
self.tray = QSystemTrayIcon()
self.tray.activated.connect(self.show_hide)
- self.tray.setIcon(self.tray_icon)
+ self.tray.setIcon(self.nexus_icon)
self.tray.setVisible(True)
# System tray menu
@@ -101,6 +105,9 @@ def __init__(self, args: argparse.Namespace):
self.tray_menu.addAction(self.quit_tray_menu_action)
self.tray.setContextMenu(self.tray_menu)
+ # Set window icon - required for Wayland
+ self.app.setDesktopFileName(f"{__id__}")
+
# Components
self.start_stop_button: QPushButton = self.window.startStopButton
self.chentry_table: QTableWidget = self.window.chentryTable
diff --git a/src/nexus/__init__.py b/src/nexus/__init__.py
index 162d56b..a334ccb 100644
--- a/src/nexus/__init__.py
+++ b/src/nexus/__init__.py
@@ -1,4 +1,5 @@
"""All-in-one cross-platform CharaChorder desktop app."""
__author__ = "CharaChorder"
-__version__ = "0.3.0"
+__id__ = "com.charachorder.nexus"
+__version__ = "0.4.0"
diff --git a/translations/i18n_en.ts b/translations/i18n_en.ts
index 5b24bea..3f1527e 100644
--- a/translations/i18n_en.ts
+++ b/translations/i18n_en.ts
@@ -9,27 +9,27 @@
-
+
Word
-
+
Date added
-
+
Case
-
+
Add
-
+
Remove
@@ -42,27 +42,27 @@
-
+
Word to ban:
-
+
Case:
-
+
Insensitive
-
+
Sensitive
-
+
First char
@@ -70,152 +70,152 @@
GUI
-
+
GUI
Start logging
-
+
GUI
Starting...
-
+
GUI
Start/stop logging
-
+
GUI
Quit
-
+
GUI
-
+
GUI
Ban and delete
-
+
GUI
Stop logging
-
+
GUI
Logging started
-
+
GUI
Logging stopped
-
+
GUI
Loaded {}/{} freqlogged words
-
-
+
+
GUI
Banned '{}'
-
-
+
+
GUI
'{}' already banned
-
+
GUI
Unban {} words?
-
+
GUI
Unban '{}'?
-
+
GUI
Unbanned '{}'
-
+
GUI
'{}' not banned
-
+
GUI
None of the selected words were banned
-
+
GUI
Unbanned {}/{} selected words
-
+
GUI
Exported {} entries to {}
-
+
GUI
Ban and delete {} words?
-
+
GUI
Ban and delete '{}'?
-
+
GUI
All of the selected words were already banned
-
+
GUI
Banned and deleted {}/{} selected words
-
+
GUI
Confirm ban
-
+
GUI
Confirm unban
@@ -229,129 +229,129 @@
-
+
Start logging
-
-
+
+
Refresh
-
+
Entries to show:
-
+
Banlist
-
+
Export
-
+
Chorded Entry
-
+
Chord
-
+
Frequency
-
-
+
+
Last used
-
+
Character Entry
-
+
Enter 0 to show all entries
-
+
Search:
-
+
Start typing to search for words...
-
+
Word
-
+
Score
-
+
Avg speed
-
+
Freq.
-
+
File
-
+
View
-
+
Theme
-
+
Quit
-
+
Alt+Q
-
+
Qt Default
-
+
Platform Default
-
+
Nexus Dark
diff --git a/ui/BanlistDialog.ui b/ui/BanlistDialog.ui
index c5aa365..6987b3e 100644
--- a/ui/BanlistDialog.ui
+++ b/ui/BanlistDialog.ui
@@ -13,6 +13,10 @@
Banlist
+
+
+ :/images/icon.ico:/images/icon.ico
+
-
@@ -77,6 +81,8 @@
-
+
+
+
diff --git a/ui/BanwordDialog.ui b/ui/BanwordDialog.ui
index ed3da11..2053bcf 100644
--- a/ui/BanwordDialog.ui
+++ b/ui/BanwordDialog.ui
@@ -16,6 +16,10 @@
Ban word
+
+
+ :/images/icon.ico:/images/icon.ico
+
-
@@ -78,7 +82,9 @@
-
+
+
+
buttonBox
diff --git a/ui/MainWindow.ui b/ui/MainWindow.ui
index 2aff112..2c41798 100644
--- a/ui/MainWindow.ui
+++ b/ui/MainWindow.ui
@@ -7,12 +7,16 @@
0
0
900
- 550
+ 580
Nexus
+
+
+ :/images/icon.ico:/images/icon.ico
+
@@ -552,6 +556,8 @@
-
+
+
+
diff --git a/src/nexus/assets/images/icon.ico b/ui/images/icon.ico
similarity index 100%
rename from src/nexus/assets/images/icon.ico
rename to ui/images/icon.ico
diff --git a/src/nexus/assets/images/icon.svg b/ui/images/icon.svg
similarity index 100%
rename from src/nexus/assets/images/icon.svg
rename to ui/images/icon.svg
diff --git a/ui/resources.qrc b/ui/resources.qrc
new file mode 100644
index 0000000..5e618e6
--- /dev/null
+++ b/ui/resources.qrc
@@ -0,0 +1,5 @@
+
+
+ images/icon.ico
+
+