mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 05:40:17 +00:00
Bring Configure Window to Top when Opened from System Tray
- Previously the window could get hidden behind other app windows when user clicked configure from the system tray
This commit is contained in:
@@ -6,7 +6,7 @@ import webbrowser
|
|||||||
|
|
||||||
# External Packages
|
# External Packages
|
||||||
from PyQt6 import QtGui, QtWidgets
|
from PyQt6 import QtGui, QtWidgets
|
||||||
from PyQt6.QtCore import QThread, QObject, pyqtSignal
|
from PyQt6.QtCore import Qt, QThread, QObject, pyqtSignal
|
||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from src.configure import configure_server
|
from src.configure import configure_server
|
||||||
@@ -273,6 +273,13 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
window_rectangle.moveCenter(screen_center)
|
window_rectangle.moveCenter(screen_center)
|
||||||
self.move(window_rectangle.topLeft().x(), 25)
|
self.move(window_rectangle.topLeft().x(), 25)
|
||||||
|
|
||||||
|
def show_on_top(self):
|
||||||
|
"Bring Window on Top"
|
||||||
|
self.show()
|
||||||
|
self.setWindowState(Qt.WindowState.WindowActive)
|
||||||
|
self.activateWindow() # For Bringing to Top on Windows
|
||||||
|
self.raise_() # For Bringing to Top from Minimized State on OSX
|
||||||
|
|
||||||
|
|
||||||
class SettingsLoader(QObject):
|
class SettingsLoader(QObject):
|
||||||
"Load Settings Thread"
|
"Load Settings Thread"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ def create_system_tray(gui: QtWidgets.QApplication, main_window: QtWidgets.QMain
|
|||||||
menu = QtWidgets.QMenu()
|
menu = QtWidgets.QMenu()
|
||||||
menu_actions = [
|
menu_actions = [
|
||||||
('Search', lambda: webbrowser.open(f'http://{state.host}:{state.port}/')),
|
('Search', lambda: webbrowser.open(f'http://{state.host}:{state.port}/')),
|
||||||
('Configure', main_window.show),
|
('Configure', main_window.show_on_top),
|
||||||
('Quit', gui.quit),
|
('Quit', gui.quit),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user