Skip to content
Commits on Source (3)
......@@ -72,6 +72,11 @@
<_long>Windows to exclude from filtering.</_long>
<default>type=Desktop</default>
</option>
<option name="notifications_enable" type="bool">
<_short>Enable notifications upon filter change</_short>
<_long>Whether to show a notification when switching filter. This requires for the plugin to have been built with libnotify support.</_long>
<default>true</default>
</option>
</options>
</plugin>
</compiz>
......@@ -75,7 +75,8 @@ ColorfilterScreen::toggle ()
}
void
ColorfilterScreen::logFilterChange (const char *fmt, ...)
ColorfilterScreen::logFilterChange (bool notify,
const char *fmt, ...)
{
va_list ap;
char message[2048];
......@@ -85,9 +86,10 @@ ColorfilterScreen::logFilterChange (const char *fmt, ...)
fmt, ap);
va_end (ap);
compLogMessage ("colorfilter", CompLogLevelInfo, "%s", message);
compLogMessage ("colorfilter", CompLogLevelInfo,
"Filter change: %s", message);
#ifdef HAVE_LIBNOTIFY
if (notification)
if (notify && optionGetNotificationsEnable () && notification)
{
notify_notification_update (notification,
_("Color filter change"),
......@@ -102,7 +104,7 @@ ColorfilterScreen::logFilterChange (const char *fmt, ...)
* Switch current filter
*/
void
ColorfilterScreen::switchFilter ()
ColorfilterScreen::switchFilter (bool userAction)
{
/* % (count + 1) because of the cumulative filters mode */
currentFilter = (currentFilter + 1) % (filtersFunctions.size () + 1);
......@@ -113,19 +115,19 @@ ColorfilterScreen::switchFilter ()
{
/* avoid the message if no filter is loaded and cumulative mode is disabled */
if (optionGetCumulativeEnable ())
logFilterChange (_("Cumulative filters mode"));
logFilterChange (userAction, _("Cumulative filters mode"));
}
else
{
std::shared_ptr <ColorfilterFunction> func = filtersFunctions.at (currentFilter - 1);
if (func && func->loaded ())
{
logFilterChange (_("Single filter mode (using %s filter)"),
logFilterChange (userAction, _("Using %s filter"),
func->name.c_str ());
}
else
{
logFilterChange (_("Single filter mode (filter loading failure)"));
logFilterChange (userAction, _("Filter loading failure"));
}
}
......@@ -329,7 +331,7 @@ ColorfilterScreen::loadFilters ()
count, loaded);
if (currentFilter == 0 && !optionGetCumulativeEnable ())
switchFilter ();
switchFilter (false);
/* Damage currently filtered windows */
foreach (CompWindow *w, screen->windows ())
......@@ -469,7 +471,7 @@ ColorfilterScreen::cumulativeEnableChanged (CompOption *opt,
ColorfilterOptions::Options num)
{
if (currentFilter == 0 && !optionGetCumulativeEnable ())
switchFilter ();
switchFilter (false);
}
/*
......
......@@ -80,11 +80,12 @@ class ColorfilterScreen :
toggle ();
void
logFilterChange (const char *fmt,
logFilterChange (bool notify,
const char *fmt,
...);
void
switchFilter ();
switchFilter (bool userAction = true);
bool
toggleWindow (CompAction *action,
......
......@@ -13,7 +13,7 @@ msgstr ""
"Project-Id-Version: fr-compiz\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-12 17:37+0100\n"
"PO-Revision-Date: 2019-03-20 15:36+0100\n"
"PO-Revision-Date: 2019-03-21 14:13+0100\n"
"Last-Translator: Colomban Wendling <cwendling@hypra.fr>\n"
"Language-Team: <fr@li.org>\n"
"Language: \n"
......@@ -991,6 +991,19 @@ msgstr ""
"Définit si un mode qui applique tous les filtres en même temps est activé "
"et peut être sélectionné avec le raccourci \"Changer de filtre\"."
#: ../plugins/colorfilter/colorfilter.xml.in.h
msgid "Enable notifications upon filter change"
msgstr "Activer les notifications lors du changement de filtre"
#: ../plugins/colorfilter/colorfilter.xml.in.h
msgid ""
"Whether to show a notification when switching filter. This requires "
"for the plugin to have been built with libnotify support."
msgstr ""
"Définit si une notification est affichée quand le filtre actif change. "
"Cette option n'a d'effet que si le plugin a été construit avec le "
"support de libnotify."
#: ../plugins/colorfilter/src/colorfilter.cpp:92
#: ../plugins/colorfilter/src/colorfilter.cpp:506
msgid "Color filter change"
......@@ -1002,12 +1015,12 @@ msgstr "Mode de filtrage cumulatif"
#: ../plugins/colorfilter/src/colorfilter.cpp:121
#, c-format
msgid "Single filter mode (using %s filter)"
msgstr "Mode de filtrage simple (avec le filtre « %s »)"
msgid "Using %s filter"
msgstr "Utilisation du filtre « %s »"
#: ../plugins/colorfilter/src/colorfilter.cpp:126
msgid "Single filter mode (filter loading failure)"
msgstr "Mode de filtrage simple (erreur de chargement du filtre)"
msgid "Filter loading failure"
msgstr "Erreur de chargement du filtre"
#: ../plugins/colorfilter/src/colorfilter.cpp:510
msgid "Next Filter"
......