From 72ebffe3b52dda9bb5e4e39aea6b7e69bd9f2e15 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Mon, 1 Dec 2025 18:24:30 +0800 Subject: [PATCH] Add administrator restart support on macOS Note: 1. some shortcuts are not working 2. copy & paste not working, clipboard may not be useable Signed-off-by: Loren Eteval --- Furious/Widget/GuiTUNSettings.py | 6 +++++- Furious/Window/AppMainWindow.py | 37 +++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Furious/Widget/GuiTUNSettings.py b/Furious/Widget/GuiTUNSettings.py index 4697698..0b1934d 100644 --- a/Furious/Widget/GuiTUNSettings.py +++ b/Furious/Widget/GuiTUNSettings.py @@ -232,7 +232,11 @@ class GuiTUNSettings(GuiEditorWidgetQDialog): super().__init__(*args, tabTranslatable=tabTranslatable, style=style, **kwargs) self.setTabText(_('Customize TUN Settings')) - self.setFixedSize(int(480 * GOLDEN_RATIO), int(480)) + + if PLATFORM == 'Darwin': + self.setFixedSize(int(550 * GOLDEN_RATIO), int(550)) + else: + self.setFixedSize(int(480 * GOLDEN_RATIO), int(480)) # Shallow copy config = Storage.UserTUNSettings() diff --git a/Furious/Window/AppMainWindow.py b/Furious/Window/AppMainWindow.py index 388fb90..a7aeb60 100644 --- a/Furious/Window/AppMainWindow.py +++ b/Furious/Window/AppMainWindow.py @@ -238,19 +238,6 @@ class AppMainWindow(AppQMainWindow): ), ] - if PLATFORM == 'Darwin': - openAppFolderAction = [] - else: - openAppFolderAction = [ - AppQAction( - _('Open Application Folder'), - icon=bootstrapIcon('folder2.svg'), - checkable=False, - callback=lambda: self.openApplicationFolder(), - ), - AppQSeperator(), - ] - if PLATFORM == 'Windows' or PLATFORM == 'Darwin': customizeTUNSettingsAction = [ AppQAction( @@ -281,6 +268,21 @@ class AppMainWindow(AppQMainWindow): else: restartAsAdminAction = [] + if PLATFORM == 'Darwin': + openAppFolderAction = [ + AppQSeperator(), + ] + else: + openAppFolderAction = [ + AppQAction( + _('Open Application Folder'), + icon=bootstrapIcon('folder2.svg'), + checkable=False, + callback=lambda: self.openApplicationFolder(), + ), + AppQSeperator(), + ] + toolsActions = [ *customizeTUNSettingsAction, *restartAsAdminAction, @@ -503,6 +505,15 @@ class AppMainWindow(AppQMainWindow): f'\'{AppCommands.RunAs.value}\' -Verb runAs', ], ) + elif PLATFORM == 'Darwin': + process.startDetached( + 'osascript', + arguments=[ + '-e', + f'do shell script \"{APP().applicationFilePath()} ' + f'{AppCommands.RunAs.value}\" with administrator privileges', + ], + ) else: mbox = AppQMessageBox(icon=AppQMessageBox.Icon.Information) mbox.setWindowTitle(_(APPLICATION_NAME))