Skip to content

Commit

Permalink
Adds basic support for non-NETWM compliant window managers, to fix #443.
Browse files Browse the repository at this point in the history
  • Loading branch information
gyunaev committed Jan 4, 2021
1 parent f167ed4 commit ff65c93
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/dialogsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ DialogSettings::DialogSettings( QWidget *parent)
onlyShowIconOnNewMail->setChecked(settings->onlyShowIconOnUnreadMessages);
leProcessRunOnCountChange->setText( settings->mProcessRunOnCountChange );
boxIgnoreEmailsOnMinimize->setChecked(settings->mForceIgnoreUnreadEmailsOnMinimize);
boxSupportNonNetwmCompliant->setChecked( settings->mIgnoreNETWMhints );

if ( settings->mIndexFilesRereadIntervalSec > 0 )
{
Expand Down Expand Up @@ -170,6 +171,7 @@ void DialogSettings::accept()
settings->ignoreStartUnreadCount = ignoreStartupMailCountBox->isChecked();
settings->onlyShowIconOnUnreadMessages = onlyShowIconOnNewMail->isChecked();
settings->mProcessRunOnCountChange = leProcessRunOnCountChange->text();
settings->mIgnoreNETWMhints = boxSupportNonNetwmCompliant->isChecked();

settings->setNotificationIcon(btnNotificationIcon->icon().pixmap( settings->mIconSize ));

Expand Down
26 changes: 20 additions & 6 deletions src/dialogsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>4</number>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
Expand Down Expand Up @@ -786,11 +786,25 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="boxBlinkingUsesAlpha">
<property name="text">
<string>When blinking, use the fade-in/fade-out transition (increases CPU use!)</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QCheckBox" name="boxBlinkingUsesAlpha">
<property name="text">
<string>When blinking, use the fade-in/fade-out transition (increases CPU use!)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="boxSupportNonNetwmCompliant">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Support non-NETWM compliant WMs</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
Expand Down
3 changes: 3 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Settings::Settings()
mIndexFilesRereadIntervalSec = 0;
mThunderbirdCmdLine = Utils::getDefaultThunderbirdCommand();
mForceIgnoreUnreadEmailsOnMinimize = false;
mIgnoreNETWMhints = false;
}

Settings::~Settings()
Expand Down Expand Up @@ -111,6 +112,7 @@ void Settings::save()
out[ ONLY_SHOW_ICON_ON_UNREAD_MESSAGES_KEY ] = onlyShowIconOnUnreadMessages;
out[ "advanced/forcedRereadInterval" ] = static_cast<int>( mIndexFilesRereadIntervalSec );
out[ "advanced/runProcessOnChange" ] = mProcessRunOnCountChange;
out[ "advanced/ignoreNetWMhints" ] = mIgnoreNETWMhints;

// Store the account map
QJsonArray accounts;
Expand Down Expand Up @@ -244,6 +246,7 @@ void Settings::fromJSON( const QJsonObject& settings )
mIgnoreUpdateVersion = settings.value("advanced/ignoreUpdateVersion").toString();
mIndexFilesRereadIntervalSec = settings.value("advanced/forcedRereadInterval").toInt();
mProcessRunOnCountChange = settings.value( "advanced/runProcessOnChange" ).toString();
mIgnoreNETWMhints = settings.value( "advanced/ignoreNetWMhints").toBool();

QStringList thunderbirdCommand = settings.value("advanced/tbcmdline").toVariant().toStringList();
if ( !thunderbirdCommand.isEmpty() && !thunderbirdCommand[0].isEmpty() )
Expand Down
3 changes: 3 additions & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class Settings
// When the number of unread emails changes, Birdtray can start this process
QString mProcessRunOnCountChange;

// Whether to support non-compliant NetWM WMs by ignoring NETWM hints
bool mIgnoreNETWMhints;

// Load and save them
void save();
void load();
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Nach einer neuen Version von Birdtray suchen.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ p, li { white-space: pre-wrap; }
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If not empty, this command will be invoked every time the unread counter changes (including when it becomes zero). It is invoked via shell, as-is, with %NEW% replaced by the new unread count value and %OLD% replaced with the old unread count value (which may be the same as new).&lt;/p&gt;&lt;p&gt;Most users don&apos;t need this functionality and should leave it empty.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Comprobar si existe una nueva versión de Birdtray.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Cerca una nuova versione di Birdtray.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Controleer of er een nieuwe Birdtray-versie beschikbaar is.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Sprawdź, czy dostępne sa nowe wersje Birdtray.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Verificar nova versão do Birdtray.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Проверка новой версии Birdtray.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Sök efter ny Birdtray-version.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
8 changes: 8 additions & 0 deletions src/translations/main_tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,14 @@ p, li { white-space: pre-wrap; }
<source>Check for a new Birdtray version.</source>
<translation>Yeni Birdtray sürümünü kontrol edin.</translation>
</message>
<message>
<source>Support non-NETWM compliant WMs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If your desktop manager is not fully NETWM compliant, you may need to check this checkbox so it can detect Thunderbird window and is able to minimise and hide it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
Expand Down
2 changes: 1 addition & 1 deletion src/windowtools_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ bool WindowTools_X11::lookup()
if ( isValid() )
return true;

mWinId = findWindow(QX11Info::display(), QX11Info::appRootWindow(), true,
mWinId = findWindow(QX11Info::display(), QX11Info::appRootWindow(), ! BirdtrayApp::get()->getSettings()->mIgnoreNETWMhints,
BirdtrayApp::get()->getSettings()->mThunderbirdWindowMatch);

Log::debug("Window ID found: %lX", mWinId );
Expand Down

0 comments on commit ff65c93

Please sign in to comment.