Allow opening Syncthing directly when clicking on tray icon

This might be useful if minimalism is desired or to avoid positioning
issues on Wayland.
This commit is contained in:
Martchus 2023-11-10 14:33:03 +01:00
parent 9360bf8bc8
commit 04a8905a83
4 changed files with 16 additions and 1 deletions

View File

@ -544,6 +544,9 @@ the appearance settings. That doesn't fix the positioning issue but then it
looks just like a normal application so not being positioned in the tray area is
less problematic.
You can also select the window type "None". This disables Syncthing Tray's own UI
completely and instead opens Syncthing directly when the tray icon is clicked.
### Workaround broken High-DPI scaling of Plasmoid under X11
Setting the environment variable `PLASMA_USE_QT_SCALING=1` should fix the
[issue](https://bugs.kde.org/show_bug.cgi?id=356446) on recent Plasma versions but

View File

@ -388,6 +388,11 @@
<string>Window without titlebar</string>
</property>
</item>
<item>
<property name="text">
<string>None - open Syncthing directly</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">

View File

@ -64,6 +64,10 @@ static void moveInside(QPoint &point, const QSize &innerRect, const QRect &outer
void TrayMenu::showUsingPositioningSettings()
{
if (m_windowType == WindowType::None) {
widget().showWebUI();
return;
}
resize(sizeHint());
auto pos = Settings::values().appearance.positioning.positionToUse();
if (pos.has_value()) {
@ -77,7 +81,7 @@ void TrayMenu::showUsingPositioningSettings()
void TrayMenu::setWindowType(int windowType)
{
if (windowType >= 0 && windowType <= 2) {
if (windowType >= 0 && windowType <= 3) {
setWindowType(static_cast<WindowType>(windowType));
}
}
@ -98,6 +102,8 @@ void TrayMenu::setWindowType(WindowType windowType)
case WindowType::CustomWindow:
flags = Qt::Dialog | Qt::CustomizeWindowHint;
break;
case WindowType::None:
break;
}
setWindowFlags(flags);
}

View File

@ -16,6 +16,7 @@ public:
Popup,
NormalWindow,
CustomWindow,
None,
};
explicit TrayMenu(TrayIcon *trayIcon = nullptr, QWidget *parent = nullptr);