Skip to content

Commit

Permalink
disable more staffs related to macOS trayicon -> dock icon
Browse files Browse the repository at this point in the history
  • Loading branch information
shenlebantongying authored Nov 11, 2024
1 parent 1e3b22e commit 6080162
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ Preferences::Preferences():
hideSingleTab( false ),
mruTabOrder( false ),
hideMenubar( false ),
enableTrayIcon( true ),
startToTray( false ),
autoStart( false ),
doubleClickTranslates( true ),
selectWordBySingleClick( false ),
Expand Down Expand Up @@ -902,11 +900,10 @@ Class load()
c.preferences.hideSingleTab = ( preferences.namedItem( "hideSingleTab" ).toElement().text() == "1" );
c.preferences.mruTabOrder = ( preferences.namedItem( "mruTabOrder" ).toElement().text() == "1" );
c.preferences.hideMenubar = ( preferences.namedItem( "hideMenubar" ).toElement().text() == "1" );

#ifndef Q_OS_MACOS // // macOS uses the dock menu instead of the tray icon
c.preferences.enableTrayIcon = ( preferences.namedItem( "enableTrayIcon" ).toElement().text() == "1" );
c.preferences.startToTray = ( preferences.namedItem( "startToTray" ).toElement().text() == "1" );
#ifndef Q_OS_MACOS // // macOS uses the dock menu instead of the tray icon
c.preferences.closeToTray = ( preferences.namedItem( "closeToTray" ).toElement().text() == "1" );
c.preferences.closeToTray = ( preferences.namedItem( "closeToTray" ).toElement().text() == "1" );
#endif
c.preferences.autoStart = ( preferences.namedItem( "autoStart" ).toElement().text() == "1" );
c.preferences.alwaysOnTop = ( preferences.namedItem( "alwaysOnTop" ).toElement().text() == "1" );
Expand Down
11 changes: 7 additions & 4 deletions src/config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,15 @@ struct Preferences
bool hideSingleTab;
bool mruTabOrder;
bool hideMenubar;
bool enableTrayIcon;
bool startToTray;

#ifdef Q_OS_MACOS // macOS uses the dock menu instead of the tray icon
bool closeToTray = false;
bool closeToTray = false;
bool enableTrayIcon = false;
bool startToTray = false;
#else
bool closeToTray = true;
bool enableTrayIcon = true;
bool closeToTray = true;
bool startToTray = false;
#endif

bool autoStart;
Expand Down
1 change: 1 addition & 0 deletions src/ui/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@ void MainWindow::trayIconUpdateOrInit()
{
#ifdef Q_OS_MACOS
trayIconMenu.setAsDockMenu();
ui.actionCloseToTray->setVisible( false );
#else

if ( !cfg.preferences.enableTrayIcon ) {
Expand Down

0 comments on commit 6080162

Please sign in to comment.