Compare commits
1 Commits
master
...
layer-shel
Author | SHA1 | Date |
---|---|---|
Martchus | 864d2777b5 |
|
@ -132,6 +132,18 @@ endif ()
|
|||
# apply basic configuration
|
||||
include(BasicConfig)
|
||||
|
||||
# configure support for layer-shell protocol
|
||||
if (LINUX)
|
||||
option(LAYER_SHELL_PROTOCOL_SUPPORT "whether to compile with support for the layer-shell protocol" OFF)
|
||||
if (LAYER_SHELL_PROTOCOL_SUPPORT)
|
||||
use_package(TARGET_NAME LayerShellQt::Interface PACKAGE_NAME LayerShellQt PACKAGE_ARGS "REQUIRED")
|
||||
set_property(
|
||||
SOURCE application/main.cpp
|
||||
APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_LAYER_SHELL_PROTOCOL_SUPPORT)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# add an option to unify left- and right-click context menus useful on Mac OS
|
||||
if (APPLE)
|
||||
set(UNIFY_TRAY_MENUS_BY_DEFAULT ON)
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
#include <qtutilities/resources/resources.h>
|
||||
#include <qtutilities/settingsdialog/qtsettings.h>
|
||||
|
||||
#ifdef SYNCTHINGTRAY_LAYER_SHELL_PROTOCOL_SUPPORT
|
||||
#include <LayerShellQt/Shell>
|
||||
#endif
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
|
@ -106,6 +110,14 @@ int initSyncthingTray(bool windowed, bool waitForTray, const Argument &connectio
|
|||
auto *const trayIcon = new TrayIcon(QString::fromLocal8Bit(connectionConfig), QApplication::instance());
|
||||
trayIcon->show();
|
||||
widget = &trayIcon->trayMenu().widget();
|
||||
#ifdef SYNCTHINGTRAY_LAYER_SHELL_PROTOCOL_SUPPORT
|
||||
if (auto *const qtWindow = trayIcon->trayMenu().windowHandle()) {
|
||||
if (auto *const layerShellWindow = LayerShellQt::Window::get(qtWindow)) {
|
||||
layerShellWindow->setAnchors(
|
||||
static_cast<LayerShellQt::Window::Anchors>(LayerShellQt::Window::AnchorTop | LayerShellQt::Window::AnchorRight));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// show wizard on first launch
|
||||
|
@ -211,6 +223,9 @@ int runApplication(int argc, const char *const *argv)
|
|||
|
||||
// do first-time initializations
|
||||
SET_QT_APPLICATION_INFO;
|
||||
#ifdef SYNCTHINGTRAY_LAYER_SHELL_PROTOCOL_SUPPORT
|
||||
LayerShellQt::Shell::useLayerShell();
|
||||
#endif
|
||||
QApplication application(argc, const_cast<char **>(argv));
|
||||
QGuiApplication::setQuitOnLastWindowClosed(false);
|
||||
SingleInstance singleInstance(argc, argv, newInstanceArg.isPresent());
|
||||
|
|
Loading…
Reference in New Issue