You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.2 KiB
79 lines
3.2 KiB
From cf7f7a6520897b485f002a38bd86f837b404b971 Mon Sep 17 00:00:00 2001
|
|
From: Lukas Holecek <hluk@email.cz>
|
|
Date: Sun, 24 Jul 2016 09:07:37 +0200
|
|
Subject: [PATCH] Add hidden option to open tray menu on left mouse click
|
|
|
|
Adds option "tray_menu_open_on_left_click" which is "false" by default
|
|
so the main window opens on left mouse click.
|
|
|
|
Since tray/indicator areas in some desktop environments may override the
|
|
mouse behavior this option is not visible in configuration dialog. It
|
|
can be only change by editing configuration file and restarting the app.
|
|
|
|
Fixes #378
|
|
---
|
|
src/common/appconfig.h | 5 +++++
|
|
src/gui/mainwindow.cpp | 5 ++++-
|
|
src/gui/mainwindow.h | 2 ++
|
|
3 files changed, 11 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/common/appconfig.h b/src/common/appconfig.h
|
|
index 49c4a22..1c3cdb1 100644
|
|
--- a/src/common/appconfig.h
|
|
+++ b/src/common/appconfig.h
|
|
@@ -217,6 +217,11 @@ struct tray_images : Config<bool> {
|
|
static Value defaultValue() { return true; }
|
|
};
|
|
|
|
+struct tray_menu_open_on_left_click : Config<bool> {
|
|
+ static QString name() { return "tray_menu_open_on_left_click"; }
|
|
+ static Value defaultValue() { return false; }
|
|
+};
|
|
+
|
|
struct tray_tab : Config<QString> {
|
|
static QString name() { return "tray_tab"; }
|
|
};
|
|
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
|
|
index e575a12..7d6dbfc 100644
|
|
--- a/src/gui/mainwindow.cpp
|
|
+++ b/src/gui/mainwindow.cpp
|
|
@@ -1692,6 +1692,7 @@ void MainWindow::loadSettings()
|
|
m_options.trayCurrentTab = appConfig.option<Config::tray_tab_is_current>();
|
|
m_options.trayTabName = appConfig.option<Config::tray_tab>();
|
|
m_options.trayImages = appConfig.option<Config::tray_images>();
|
|
+ m_options.trayMenuOpenOnLeftClick = appConfig.option<Config::tray_menu_open_on_left_click>();
|
|
m_options.itemPopupInterval = appConfig.option<Config::item_popup_interval>();
|
|
m_options.clipboardNotificationLines = appConfig.option<Config::clipboard_notification_lines>();
|
|
m_options.clipboardTab = appConfig.option<Config::clipboard_tab>();
|
|
@@ -1821,7 +1822,9 @@ void MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason)
|
|
// Don't do this on OS X, we only ever get "Trigger"
|
|
Q_UNUSED(reason);
|
|
#else
|
|
- if ( reason == QSystemTrayIcon::MiddleClick ) {
|
|
+ if ( reason == QSystemTrayIcon::MiddleClick
|
|
+ || (m_options.trayMenuOpenOnLeftClick && reason == QSystemTrayIcon::Trigger) )
|
|
+ {
|
|
toggleMenu();
|
|
} else if ( reason == QSystemTrayIcon::Trigger || reason == QSystemTrayIcon::DoubleClick ) {
|
|
// Like toggleVisible() but hide window if visible and not focused
|
|
diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h
|
|
index 2ac800a..af1ccb4 100644
|
|
--- a/src/gui/mainwindow.h
|
|
+++ b/src/gui/mainwindow.h
|
|
@@ -66,6 +66,7 @@ struct MainWindowOptions {
|
|
, trayTabName()
|
|
, trayItems(5)
|
|
, trayImages(true)
|
|
+ , trayMenuOpenOnLeftClick(false)
|
|
, itemPopupInterval(0)
|
|
, clipboardNotificationLines(0)
|
|
, transparency(0)
|
|
@@ -89,6 +90,7 @@ struct MainWindowOptions {
|
|
QString trayTabName;
|
|
int trayItems;
|
|
bool trayImages;
|
|
+ bool trayMenuOpenOnLeftClick;
|
|
int itemPopupInterval;
|
|
int clipboardNotificationLines;
|
|
int transparency;
|