Skip to content

Commit

Permalink
issue #72 ignore hotkey in full screen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonwang committed Dec 18, 2023
1 parent 64f2574 commit 3dd448b
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/Launchy/LaunchyWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,19 +1110,19 @@ void LaunchyWidget::trayNotify(const QString& infoMsg) {

void LaunchyWidget::onHotkey() {

if (!g_app->allowNotification()) {
if (g_settings->value(OPTION_IGNORE_FULL_SCREEN,
OPTION_IGNORE_FULL_SCREEN_DEFAULT).toBool()
&& !g_app->allowNotification()) {
qDebug() << "LaunchyWidget::onHotkey, not allow notification";
return;
}

qDebug() << "LaunchyWidget::onHotkey,"
<< "always show launchy:" << m_alwaysShowLaunchy
<< "visible" << isVisible()
<< "visible:" << isVisible()
<< "fading:" << m_fader->isFading()
<< "active window:" << QApplication::activeWindow();



if (m_menuOpen || m_optionsOpen) {
showLaunchy(true);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Launchy/OptionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,8 @@ void OptionDialog::initGeneralWidget() {
}

// general options
m_pUi->genIgnoreFullScreen->setChecked(g_settings->value(OPTION_IGNORE_FULL_SCREEN, OPTION_IGNORE_FULL_SCREEN_DEFAULT).toBool());

m_pUi->genAlwaysShow->setChecked(g_settings->value(OPTION_ALWAYSSHOW, OPTION_ALWAYSSHOW_DEFAULT).toBool());

m_pUi->genHideFocus->setChecked(g_settings->value(OPTION_HIDEIFLOSTFOCUS, OPTION_HIDEIFLOSTFOCUS_DEFAULT).toBool());
Expand Down Expand Up @@ -688,7 +690,7 @@ bool OptionDialog::saveGeneralSettings() {
g_settings->setValue(OPTION_HOTKEY, hotkey.isEmpty() ? OPTION_HOTKEY_DEFAULT : hotkey[0].toCombined());

// Save General Options
// g_settings->setValue("GenOps/showtrayicon", genShowTrayIcon->isChecked());
g_settings->setValue(OPTION_IGNORE_FULL_SCREEN, m_pUi->genIgnoreFullScreen->isChecked());
g_settings->setValue(OPTION_ALWAYSSHOW, m_pUi->genAlwaysShow->isChecked());
g_settings->setValue(OPTION_ALWAYSTOP, m_pUi->genAlwaysTop->isChecked());

Expand Down
7 changes: 7 additions & 0 deletions src/Launchy/OptionDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="genIgnoreFullScreen">
<property name="text">
<string>Ignore hotkey in full-screen mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="genAlwaysShow">
<property name="sizePolicy">
Expand Down
23 changes: 13 additions & 10 deletions src/Launchy/OptionItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

namespace launchy {

const char* OPTION_ALWAYSSHOW = "GenOps/alwaysshow";
const bool OPTION_ALWAYSSHOW_DEFAULT = false;
const char* OPTION_ALWAYSSHOW = "GenOps/alwaysshow";
const bool OPTION_ALWAYSSHOW_DEFAULT = false;

const char* OPTION_ALWAYSTOP = "GenOps/alwaystop";
const bool OPTION_ALWAYSTOP_DEFAULT = false;
const char* OPTION_ALWAYSTOP = "GenOps/alwaystop";
const bool OPTION_ALWAYSTOP_DEFAULT = false;

const char* OPTION_LOGLEVEL = "GenOps/logLevel";
const int OPTION_LOGLEVEL_DEFAULT = 2;
const char* OPTION_LOGLEVEL = "GenOps/logLevel";
const int OPTION_LOGLEVEL_DEFAULT = 2;

const char* OPTION_DECORATETEXT = "GenOps/decoratetext";
const bool OPTION_DECORATETEXT_DEFAULT = false;
const char* OPTION_DECORATETEXT = "GenOps/decoratetext";
const bool OPTION_DECORATETEXT_DEFAULT = false;

const char* OPTION_HIDEIFLOSTFOCUS = "GenOps/hideiflostfocus";
const bool OPTION_HIDEIFLOSTFOCUS_DEFAULT = true;
const char* OPTION_HIDEIFLOSTFOCUS = "GenOps/hideiflostfocus";
const bool OPTION_HIDEIFLOSTFOCUS_DEFAULT = true;

const char* OPTION_ALWAYSCENTER = "GenOps/alwayscenter";
const int OPTION_ALWAYSCENTER_DEFAULT = 3;
Expand Down Expand Up @@ -102,6 +102,9 @@ const int OPTION_VERSION_DEFAULT = 0;
const char* OPTION_POS = "Display/pos";
const QPoint OPTION_POS_DEFAULT = QPoint(0, 0);

const char* OPTION_IGNORE_FULL_SCREEN = "General/IgnoreFullScreen";
const bool OPTION_IGNORE_FULL_SCREEN_DEFAULT = true;

// Update
const char* OPTION_UPDATE_CHECK_ON_STARTUP = "Update/checkOnStartup";
const bool OPTION_UPDATE_CHECK_ON_STARTUP_DEFAULT = true;
Expand Down
3 changes: 3 additions & 0 deletions src/Launchy/OptionItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ extern const int OPTION_HOTKEYMOD_DEFAULT;
extern const char* OPTION_HOTKEYKEY;
extern const int OPTION_HOTKEYKEY_DEFAULT;

extern const char* OPTION_IGNORE_FULL_SCREEN;
extern const bool OPTION_IGNORE_FULL_SCREEN_DEFAULT;

extern const char* OPTION_ALWAYSSHOW;
extern const bool OPTION_ALWAYSSHOW_DEFAULT;

Expand Down
20 changes: 10 additions & 10 deletions src/Launchy/Windows/AppWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ QString AppWin::expandEnvironmentVars(const QString& vars) const {

return result;
}


bool AppWin::supportsAlphaBorder() const {
return true;
}
Expand Down Expand Up @@ -150,15 +150,15 @@ bool AppWin::getComputers(QStringList& computers) const {

return EnumerateNetworkServers(computers, SV_TYPE_WORKSTATION | SV_TYPE_SERVER);
}

bool AppWin::allowNotification() const {

QUERY_USER_NOTIFICATION_STATE state;
if (SHQueryUserNotificationState(&state) == S_OK) {
return state == QUNS_ACCEPTS_NOTIFICATIONS;
}

return true;

bool AppWin::allowNotification() const {

QUERY_USER_NOTIFICATION_STATE state;
if (SHQueryUserNotificationState(&state) == S_OK) {
return state == QUNS_ACCEPTS_NOTIFICATIONS;
}

return true;
}

// Create the application object
Expand Down

0 comments on commit 3dd448b

Please sign in to comment.