Port kwinrules kcm to kconfigxt
Reviewers: meven, crossi, bport, ervin, #kwin Subscribers: iasensio, ognarb, zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D27682master
parent
ede53f73bd
commit
7c1c9d8164
|
@ -466,6 +466,7 @@ set(kwin_SRCS
|
||||||
popup_input_filter.cpp
|
popup_input_filter.cpp
|
||||||
rootinfo_filter.cpp
|
rootinfo_filter.cpp
|
||||||
rules.cpp
|
rules.cpp
|
||||||
|
rulebooksettings.cpp
|
||||||
scene.cpp
|
scene.cpp
|
||||||
screenedge.cpp
|
screenedge.cpp
|
||||||
screenlockerwatcher.cpp
|
screenlockerwatcher.cpp
|
||||||
|
@ -556,6 +557,8 @@ endif()
|
||||||
|
|
||||||
kconfig_add_kcfg_files(kwin_SRCS settings.kcfgc)
|
kconfig_add_kcfg_files(kwin_SRCS settings.kcfgc)
|
||||||
kconfig_add_kcfg_files(kwin_SRCS colorcorrection/colorcorrect_settings.kcfgc)
|
kconfig_add_kcfg_files(kwin_SRCS colorcorrection/colorcorrect_settings.kcfgc)
|
||||||
|
kconfig_add_kcfg_files(kwin_SRCS rulesettings.kcfgc)
|
||||||
|
kconfig_add_kcfg_files(kwin_SRCS rulebooksettingsbase.kcfgc)
|
||||||
|
|
||||||
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
|
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
|
||||||
qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface)
|
qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface)
|
||||||
|
|
|
@ -6,10 +6,13 @@ add_definitions(-DKCMRULES)
|
||||||
include_directories(../../)
|
include_directories(../../)
|
||||||
set(kwinrules_MOC_HDRS yesnobox.h ../../cursor.h ../../plugins/platforms/x11/standalone/x11cursor.h)
|
set(kwinrules_MOC_HDRS yesnobox.h ../../cursor.h ../../plugins/platforms/x11/standalone/x11cursor.h)
|
||||||
qt5_wrap_cpp(kwinrules_MOC_SRCS ${kwinrules_MOC_HDRS})
|
qt5_wrap_cpp(kwinrules_MOC_SRCS ${kwinrules_MOC_HDRS})
|
||||||
set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp main.cpp ${kwinrules_MOC_SRCS})
|
set(kwinrules_SRCS ../../rulebooksettings.cpp ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp main.cpp ${kwinrules_MOC_SRCS})
|
||||||
|
|
||||||
ki18n_wrap_ui(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui ruleswidgetbase.ui)
|
ki18n_wrap_ui(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui ruleswidgetbase.ui)
|
||||||
|
|
||||||
|
kconfig_add_kcfg_files(kwinrules_SRCS ../../rulesettings.kcfgc)
|
||||||
|
kconfig_add_kcfg_files(kwinrules_SRCS ../../rulebooksettingsbase.kcfgc)
|
||||||
|
|
||||||
add_executable(kwin_rules_dialog ${kwinrules_SRCS})
|
add_executable(kwin_rules_dialog ${kwinrules_SRCS})
|
||||||
|
|
||||||
set(kwin_kcm_rules_XCB_LIBS
|
set(kwin_kcm_rules_XCB_LIBS
|
||||||
|
|
|
@ -39,7 +39,6 @@ namespace KWin
|
||||||
|
|
||||||
KCMRules::KCMRules(QWidget *parent, const QVariantList &)
|
KCMRules::KCMRules(QWidget *parent, const QVariantList &)
|
||||||
: KCModule(parent)
|
: KCModule(parent)
|
||||||
, config("kwinrulesrc", KConfig::NoGlobals)
|
|
||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
@ -56,7 +55,6 @@ KCMRules::KCMRules(QWidget *parent, const QVariantList &)
|
||||||
|
|
||||||
void KCMRules::load()
|
void KCMRules::load()
|
||||||
{
|
{
|
||||||
config.reparseConfiguration();
|
|
||||||
widget->load();
|
widget->load();
|
||||||
emit KCModule::changed(false);
|
emit KCModule::changed(false);
|
||||||
}
|
}
|
||||||
|
@ -65,8 +63,6 @@ void KCMRules::save()
|
||||||
{
|
{
|
||||||
widget->save();
|
widget->save();
|
||||||
emit KCModule::changed(false);
|
emit KCModule::changed(false);
|
||||||
// Send signal to kwin
|
|
||||||
config.sync();
|
|
||||||
// Send signal to all kwin instances
|
// Send signal to all kwin instances
|
||||||
QDBusMessage message =
|
QDBusMessage message =
|
||||||
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
||||||
|
|
|
@ -44,7 +44,6 @@ protected Q_SLOTS:
|
||||||
void moduleChanged(bool state);
|
void moduleChanged(bool state);
|
||||||
private:
|
private:
|
||||||
KCMRulesList* widget;
|
KCMRulesList* widget;
|
||||||
KConfig config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
// Include some code from kwin core in order to avoid
|
// Include some code from kwin core in order to avoid
|
||||||
// double implementation.
|
// double implementation.
|
||||||
|
|
||||||
#include "ruleslist.h"
|
|
||||||
#include "../../cursor.cpp"
|
#include "../../cursor.cpp"
|
||||||
#include "../../plugins/platforms/x11/standalone/x11cursor.cpp"
|
#include "../../plugins/platforms/x11/standalone/x11cursor.cpp"
|
||||||
#include "../../rules.cpp"
|
#include "../../rules.cpp"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <kwindowsystem.h>
|
#include <kwindowsystem.h>
|
||||||
|
|
||||||
#include "ruleswidget.h"
|
#include "ruleswidget.h"
|
||||||
|
#include "rulebooksettings.h"
|
||||||
#include "../../rules.h"
|
#include "../../rules.h"
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
|
@ -37,40 +38,7 @@ Q_DECLARE_METATYPE(NET::WindowType)
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
static void loadRules(QList< Rules* >& rules)
|
static Rules *findRule(const QVector<Rules *> &rules, const QVariantMap &data, bool whole_app)
|
||||||
{
|
|
||||||
KConfig _cfg("kwinrulesrc", KConfig::NoGlobals);
|
|
||||||
KConfigGroup cfg(&_cfg, "General");
|
|
||||||
int count = cfg.readEntry("count", 0);
|
|
||||||
for (int i = 1;
|
|
||||||
i <= count;
|
|
||||||
++i) {
|
|
||||||
cfg = KConfigGroup(&_cfg, QString::number(i));
|
|
||||||
Rules* rule = new Rules(cfg);
|
|
||||||
rules.append(rule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void saveRules(const QList< Rules* >& rules)
|
|
||||||
{
|
|
||||||
KConfig cfg("kwinrulesrc", KConfig::NoGlobals);
|
|
||||||
QStringList groups = cfg.groupList();
|
|
||||||
for (QStringList::ConstIterator it = groups.constBegin();
|
|
||||||
it != groups.constEnd();
|
|
||||||
++it)
|
|
||||||
cfg.deleteGroup(*it);
|
|
||||||
cfg.group("General").writeEntry("count", rules.count());
|
|
||||||
int i = 1;
|
|
||||||
for (QList< Rules* >::ConstIterator it = rules.constBegin();
|
|
||||||
it != rules.constEnd();
|
|
||||||
++it) {
|
|
||||||
KConfigGroup cg(&cfg, QString::number(i));
|
|
||||||
(*it)->write(cg);
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Rules* findRule(const QList< Rules* >& rules, const QVariantMap &data, bool whole_app)
|
|
||||||
{
|
{
|
||||||
QByteArray wmclass_class = data.value("resourceClass").toByteArray().toLower();
|
QByteArray wmclass_class = data.value("resourceClass").toByteArray().toLower();
|
||||||
QByteArray wmclass_name = data.value("resourceName").toByteArray().toLower();
|
QByteArray wmclass_name = data.value("resourceName").toByteArray().toLower();
|
||||||
|
@ -80,11 +48,8 @@ static Rules* findRule(const QList< Rules* >& rules, const QVariantMap &data, bo
|
||||||
QByteArray machine = data.value("clientMachine").toByteArray();
|
QByteArray machine = data.value("clientMachine").toByteArray();
|
||||||
Rules* best_match = nullptr;
|
Rules* best_match = nullptr;
|
||||||
int match_quality = 0;
|
int match_quality = 0;
|
||||||
for (QList< Rules* >::ConstIterator it = rules.constBegin();
|
for (const auto rule : rules) {
|
||||||
it != rules.constEnd();
|
|
||||||
++it) {
|
|
||||||
// try to find an exact match, i.e. not a generic rule
|
// try to find an exact match, i.e. not a generic rule
|
||||||
Rules* rule = *it;
|
|
||||||
int quality = 0;
|
int quality = 0;
|
||||||
bool generic = true;
|
bool generic = true;
|
||||||
if (rule->wmclassmatch != Rules::ExactMatch)
|
if (rule->wmclassmatch != Rules::ExactMatch)
|
||||||
|
@ -202,8 +167,8 @@ static Rules* findRule(const QList< Rules* >& rules, const QVariantMap &data, bo
|
||||||
|
|
||||||
static void edit(const QVariantMap &data, bool whole_app)
|
static void edit(const QVariantMap &data, bool whole_app)
|
||||||
{
|
{
|
||||||
QList< Rules* > rules;
|
RuleBookSettings settings(KConfig::NoGlobals);
|
||||||
loadRules(rules);
|
QVector<Rules *> rules = settings.rules();
|
||||||
Rules *orig_rule = findRule(rules, data, whole_app);
|
Rules *orig_rule = findRule(rules, data, whole_app);
|
||||||
RulesDialog dlg;
|
RulesDialog dlg;
|
||||||
if (whole_app)
|
if (whole_app)
|
||||||
|
@ -223,7 +188,8 @@ static void edit(const QVariantMap &data, bool whole_app)
|
||||||
rules.prepend(edited_rule);
|
rules.prepend(edited_rule);
|
||||||
delete orig_rule;
|
delete orig_rule;
|
||||||
}
|
}
|
||||||
saveRules(rules);
|
settings.setRules(rules);
|
||||||
|
settings.save();
|
||||||
// Send signal to all kwin instances
|
// Send signal to all kwin instances
|
||||||
QDBusMessage message =
|
QDBusMessage message =
|
||||||
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
#include "../../rules.h"
|
||||||
|
#include "rulesettings.h"
|
||||||
#include "ruleswidget.h"
|
#include "ruleswidget.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -57,11 +59,8 @@ KCMRulesList::KCMRulesList(QWidget* parent)
|
||||||
|
|
||||||
KCMRulesList::~KCMRulesList()
|
KCMRulesList::~KCMRulesList()
|
||||||
{
|
{
|
||||||
for (QVector< Rules* >::Iterator it = rules.begin();
|
qDeleteAll(m_rules);
|
||||||
it != rules.end();
|
m_rules.clear();
|
||||||
++it)
|
|
||||||
delete *it;
|
|
||||||
rules.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KCMRulesList::activeChanged()
|
void KCMRulesList::activeChanged()
|
||||||
|
@ -87,7 +86,7 @@ void KCMRulesList::newClicked()
|
||||||
int pos = rules_listbox->currentRow() + 1;
|
int pos = rules_listbox->currentRow() + 1;
|
||||||
rules_listbox->insertItem(pos , rule->description);
|
rules_listbox->insertItem(pos , rule->description);
|
||||||
rules_listbox->setCurrentRow(pos, QItemSelectionModel::ClearAndSelect);
|
rules_listbox->setCurrentRow(pos, QItemSelectionModel::ClearAndSelect);
|
||||||
rules.insert(rules.begin() + pos, rule);
|
m_rules.insert(m_rules.begin() + pos, rule);
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +96,11 @@ void KCMRulesList::modifyClicked()
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
return;
|
return;
|
||||||
RulesDialog dlg(this);
|
RulesDialog dlg(this);
|
||||||
Rules* rule = dlg.edit(rules[ pos ], {}, false);
|
Rules *rule = dlg.edit(m_rules[pos], {}, false);
|
||||||
if (rule == rules[ pos ])
|
if (rule == m_rules[pos])
|
||||||
return;
|
return;
|
||||||
delete rules[ pos ];
|
delete m_rules[pos];
|
||||||
rules[ pos ] = rule;
|
m_rules[pos] = rule;
|
||||||
rules_listbox->item(pos)->setText(rule->description);
|
rules_listbox->item(pos)->setText(rule->description);
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +110,7 @@ void KCMRulesList::deleteClicked()
|
||||||
int pos = rules_listbox->currentRow();
|
int pos = rules_listbox->currentRow();
|
||||||
Q_ASSERT(pos != -1);
|
Q_ASSERT(pos != -1);
|
||||||
delete rules_listbox->takeItem(pos);
|
delete rules_listbox->takeItem(pos);
|
||||||
rules.erase(rules.begin() + pos);
|
m_rules.erase(m_rules.begin() + pos);
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,9 +122,9 @@ void KCMRulesList::moveupClicked()
|
||||||
QListWidgetItem * item = rules_listbox->takeItem(pos);
|
QListWidgetItem * item = rules_listbox->takeItem(pos);
|
||||||
rules_listbox->insertItem(pos - 1 , item);
|
rules_listbox->insertItem(pos - 1 , item);
|
||||||
rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
|
rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
|
||||||
Rules* rule = rules[ pos ];
|
Rules *rule = m_rules[pos];
|
||||||
rules[ pos ] = rules[ pos - 1 ];
|
m_rules[pos] = m_rules[pos - 1];
|
||||||
rules[ pos - 1 ] = rule;
|
m_rules[pos - 1] = rule;
|
||||||
}
|
}
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
@ -138,9 +137,9 @@ void KCMRulesList::movedownClicked()
|
||||||
QListWidgetItem * item = rules_listbox->takeItem(pos);
|
QListWidgetItem * item = rules_listbox->takeItem(pos);
|
||||||
rules_listbox->insertItem(pos + 1 , item);
|
rules_listbox->insertItem(pos + 1 , item);
|
||||||
rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
|
rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
|
||||||
Rules* rule = rules[ pos ];
|
Rules *rule = m_rules[pos];
|
||||||
rules[ pos ] = rules[ pos + 1 ];
|
m_rules[pos] = m_rules[pos + 1];
|
||||||
rules[ pos + 1 ] = rule;
|
m_rules[pos + 1] = rule;
|
||||||
}
|
}
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
@ -153,10 +152,11 @@ void KCMRulesList::exportClicked()
|
||||||
i18n("KWin Rules (*.kwinrule)"));
|
i18n("KWin Rules (*.kwinrule)"));
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
KConfig config(path, KConfig::SimpleConfig);
|
const auto cfg = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
|
||||||
KConfigGroup group(&config, rules[pos]->description);
|
RuleSettings settings(cfg, m_rules[pos]->description);
|
||||||
group.deleteGroup();
|
settings.setDefaults();
|
||||||
rules[pos]->write(group);
|
m_rules[pos]->write(&settings);
|
||||||
|
settings.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KCMRulesList::importClicked()
|
void KCMRulesList::importClicked()
|
||||||
|
@ -165,29 +165,28 @@ void KCMRulesList::importClicked()
|
||||||
i18n("KWin Rules (*.kwinrule)"));
|
i18n("KWin Rules (*.kwinrule)"));
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
KConfig config(path, KConfig::SimpleConfig);
|
const auto config = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
|
||||||
QStringList groups = config.groupList();
|
QStringList groups = config->groupList();
|
||||||
if (groups.isEmpty())
|
if (groups.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int pos = qMax(0, rules_listbox->currentRow());
|
int pos = qMax(0, rules_listbox->currentRow());
|
||||||
foreach (const QString &group, groups) {
|
for (const QString &group : groups) {
|
||||||
KConfigGroup grp(&config, group);
|
RuleSettings settings(config, group);
|
||||||
const bool remove = grp.readEntry("DeleteRule", false);
|
const bool remove = settings.deleteRule();
|
||||||
Rules* new_rule = new Rules(grp);
|
Rules *new_rule = new Rules(&settings);
|
||||||
|
|
||||||
// try to replace existing rule first
|
// try to replace existing rule first
|
||||||
for (int i = 0; i < rules.count(); ++i) {
|
for (int i = 0; i < m_rules.count(); ++i) {
|
||||||
if (rules[i]->description == new_rule->description) {
|
if (m_rules[i]->description == new_rule->description) {
|
||||||
delete rules[i];
|
delete m_rules[i];
|
||||||
if (remove) {
|
if (remove) {
|
||||||
rules.remove(i);
|
m_rules.remove(i);
|
||||||
delete rules_listbox->takeItem(i);
|
delete rules_listbox->takeItem(i);
|
||||||
delete new_rule;
|
delete new_rule;
|
||||||
pos = qMax(0, rules_listbox->currentRow()); // might have changed!
|
pos = qMax(0, rules_listbox->currentRow()); // might have changed!
|
||||||
}
|
} else
|
||||||
else
|
m_rules[i] = new_rule;
|
||||||
rules[i] = new_rule;
|
|
||||||
new_rule = nullptr;
|
new_rule = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +200,7 @@ void KCMRulesList::importClicked()
|
||||||
|
|
||||||
// plain insertion
|
// plain insertion
|
||||||
if (new_rule) {
|
if (new_rule) {
|
||||||
rules.insert(pos, new_rule);
|
m_rules.insert(pos, new_rule);
|
||||||
rules_listbox->insertItem(pos++, new_rule->description);
|
rules_listbox->insertItem(pos++, new_rule->description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,24 +210,13 @@ void KCMRulesList::importClicked()
|
||||||
void KCMRulesList::load()
|
void KCMRulesList::load()
|
||||||
{
|
{
|
||||||
rules_listbox->clear();
|
rules_listbox->clear();
|
||||||
for (QVector< Rules* >::Iterator it = rules.begin();
|
m_settings.load();
|
||||||
it != rules.end();
|
m_rules = m_settings.rules();
|
||||||
++it)
|
for (const auto rule : qAsConst(m_rules)) {
|
||||||
delete *it;
|
|
||||||
rules.clear();
|
|
||||||
KConfig _cfg("kwinrulesrc");
|
|
||||||
KConfigGroup cfg(&_cfg, "General");
|
|
||||||
int count = cfg.readEntry("count", 0);
|
|
||||||
rules.reserve(count);
|
|
||||||
for (int i = 1;
|
|
||||||
i <= count;
|
|
||||||
++i) {
|
|
||||||
cfg = KConfigGroup(&_cfg, QString::number(i));
|
|
||||||
Rules* rule = new Rules(cfg);
|
|
||||||
rules.append(rule);
|
|
||||||
rules_listbox->addItem(rule->description);
|
rules_listbox->addItem(rule->description);
|
||||||
}
|
}
|
||||||
if (rules.count() > 0)
|
|
||||||
|
if (m_rules.count() > 0)
|
||||||
rules_listbox->setCurrentItem(rules_listbox->item(0));
|
rules_listbox->setCurrentItem(rules_listbox->item(0));
|
||||||
else
|
else
|
||||||
rules_listbox->setCurrentItem(nullptr);
|
rules_listbox->setCurrentItem(nullptr);
|
||||||
|
@ -237,21 +225,8 @@ void KCMRulesList::load()
|
||||||
|
|
||||||
void KCMRulesList::save()
|
void KCMRulesList::save()
|
||||||
{
|
{
|
||||||
KConfig cfg(QLatin1String("kwinrulesrc"));
|
m_settings.setRules(m_rules);
|
||||||
QStringList groups = cfg.groupList();
|
m_settings.save();
|
||||||
for (QStringList::ConstIterator it = groups.constBegin();
|
|
||||||
it != groups.constEnd();
|
|
||||||
++it)
|
|
||||||
cfg.deleteGroup(*it);
|
|
||||||
cfg.group("General").writeEntry("count", rules.count());
|
|
||||||
int i = 1;
|
|
||||||
for (QVector< Rules* >::ConstIterator it = rules.constBegin();
|
|
||||||
it != rules.constEnd();
|
|
||||||
++it) {
|
|
||||||
KConfigGroup cg(&cfg, QString::number(i));
|
|
||||||
(*it)->write(cg);
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KCMRulesList::defaults()
|
void KCMRulesList::defaults()
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
#ifndef __RULESLIST_H__
|
#ifndef __RULESLIST_H__
|
||||||
#define __RULESLIST_H__
|
#define __RULESLIST_H__
|
||||||
|
|
||||||
#include "../../rules.h"
|
|
||||||
|
|
||||||
#include "ui_ruleslist.h"
|
#include "ui_ruleslist.h"
|
||||||
|
#include "rulebooksettings.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
class Rules;
|
||||||
|
|
||||||
class KCMRulesList
|
class KCMRulesList
|
||||||
: public QWidget, Ui_KCMRulesList
|
: public QWidget, Ui_KCMRulesList
|
||||||
|
@ -49,7 +49,8 @@ private Q_SLOTS:
|
||||||
void importClicked();
|
void importClicked();
|
||||||
void activeChanged();
|
void activeChanged();
|
||||||
private:
|
private:
|
||||||
QVector< Rules* > rules;
|
QVector<Rules *> m_rules;
|
||||||
|
RuleBookSettings m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
/********************************************************************
|
||||||
|
KWin - the KDE window manager
|
||||||
|
This file is part of the KDE project.
|
||||||
|
|
||||||
|
Copyright (C) 2020 Henri Chain <henri.chain@enioka.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#include "rulebooksettings.h"
|
||||||
|
#include "rulesettings.h"
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
RuleBookSettings::RuleBookSettings(KSharedConfig::Ptr config, QObject *parent)
|
||||||
|
: RuleBookSettingsBase(config, parent)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= count(); i++) {
|
||||||
|
m_list.append(new RuleSettings(config, QString::number(i), this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RuleBookSettings::RuleBookSettings(const QString &configname, KConfig::OpenFlags flags, QObject *parent)
|
||||||
|
: RuleBookSettings(KSharedConfig::openConfig(configname, flags), parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RuleBookSettings::RuleBookSettings(KConfig::OpenFlags flags, QObject *parent)
|
||||||
|
: RuleBookSettings(QStringLiteral("kwinrulesrc"), flags, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RuleBookSettings::RuleBookSettings(QObject *parent)
|
||||||
|
: RuleBookSettings(KConfig::FullConfig, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void RuleBookSettings::setRules(const QVector<Rules *> &rules)
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
const int list_length = m_list.length();
|
||||||
|
for (const auto &rule : rules) {
|
||||||
|
RuleSettings *settings;
|
||||||
|
if (i <= list_length) {
|
||||||
|
settings = m_list[i - 1];
|
||||||
|
settings->setDefaults();
|
||||||
|
} else {
|
||||||
|
// If there are more rules than in cache
|
||||||
|
settings = new RuleSettings(this->sharedConfig(), QString::number(i), this);
|
||||||
|
m_list.append(settings);
|
||||||
|
}
|
||||||
|
rule->write(settings);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCount(rules.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<Rules *> RuleBookSettings::rules()
|
||||||
|
{
|
||||||
|
QVector<Rules *> result;
|
||||||
|
result.reserve(mCount);
|
||||||
|
// mCount is always <= m_list.length()
|
||||||
|
for (int i = 0; i < mCount; i++) {
|
||||||
|
result.append(new Rules(m_list[i]));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RuleBookSettings::usrSave()
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
for (const auto &settings : qAsConst(m_list)) {
|
||||||
|
result &= settings->save();
|
||||||
|
}
|
||||||
|
int nRuleGroups = sharedConfig()->groupList().length() - 1;
|
||||||
|
// Remove any extra groups currently in config
|
||||||
|
for (int i = mCount + 1; i <= nRuleGroups; i++) {
|
||||||
|
sharedConfig()->deleteGroup(QString::number(i));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RuleBookSettings::usrRead()
|
||||||
|
{
|
||||||
|
const int list_length = m_list.length();
|
||||||
|
for (int i = 1; i <= mCount; i++) {
|
||||||
|
if (i <= list_length) {
|
||||||
|
m_list[i - 1]->load();
|
||||||
|
} else {
|
||||||
|
// If there are more groups than in cache
|
||||||
|
m_list.append(new RuleSettings(sharedConfig(), QString::number(i), this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
/********************************************************************
|
||||||
|
KWin - the KDE window manager
|
||||||
|
This file is part of the KDE project.
|
||||||
|
|
||||||
|
Copyright (C) 2020 Henri Chain <henri.chain@enioka.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#ifndef RULEBOOKSETTINGS_H
|
||||||
|
#define RULEBOOKSETTINGS_H
|
||||||
|
|
||||||
|
#include "rulebooksettingsbase.h"
|
||||||
|
#include <KSharedConfig>
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
class Rules;
|
||||||
|
class RuleSettings;
|
||||||
|
|
||||||
|
class RuleBookSettings : public RuleBookSettingsBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RuleBookSettings(KSharedConfig::Ptr config, QObject *parent = nullptr);
|
||||||
|
RuleBookSettings(const QString &configname, KConfig::OpenFlags, QObject *parent = nullptr);
|
||||||
|
RuleBookSettings(KConfig::OpenFlags, QObject *parent = nullptr);
|
||||||
|
RuleBookSettings(QObject *parent = nullptr);
|
||||||
|
void setRules(const QVector<Rules *> &);
|
||||||
|
QVector<Rules *> rules();
|
||||||
|
bool usrSave() override;
|
||||||
|
void usrRead() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVector<RuleSettings *> m_list;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RULEBOOKSETTINGS_H
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||||
|
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
|
||||||
|
<kcfgfile arg="true">
|
||||||
|
</kcfgfile>
|
||||||
|
<group name="General">
|
||||||
|
<entry name="count" type="int">
|
||||||
|
<label>Total rules count</label>
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
</kcfg>
|
|
@ -0,0 +1,5 @@
|
||||||
|
File=rulebooksettingsbase.kcfg
|
||||||
|
NameSpace=KWin
|
||||||
|
ClassName=RuleBookSettingsBase
|
||||||
|
Mutators=true
|
||||||
|
ParentInConstructor=true
|
319
rules.cpp
319
rules.cpp
|
@ -36,6 +36,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "rulesettings.h"
|
||||||
|
#include "rulebooksettings.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -95,105 +98,92 @@ Rules::Rules(const QString& str, bool temporary)
|
||||||
file.write(s.data(), s.length());
|
file.write(s.data(), s.length());
|
||||||
}
|
}
|
||||||
file.flush();
|
file.flush();
|
||||||
KConfig cfg(file.fileName(), KConfig::SimpleConfig);
|
auto cfg = KSharedConfig::openConfig(file.fileName(), KConfig::SimpleConfig);
|
||||||
readFromCfg(cfg.group(QString()));
|
RuleSettings settings(cfg, QString());
|
||||||
|
readFromSettings(&settings);
|
||||||
if (description.isEmpty())
|
if (description.isEmpty())
|
||||||
description = QStringLiteral("temporary");
|
description = QStringLiteral("temporary");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_MATCH_STRING(var, func) \
|
#define READ_MATCH_STRING(var, func) \
|
||||||
var = cfg.readEntry( #var ) func; \
|
var = settings->var() func; \
|
||||||
var##match = (StringMatch) qMax( FirstStringMatch, \
|
var##match = static_cast<StringMatch>(settings->var##match())
|
||||||
qMin( LastStringMatch, static_cast< StringMatch >( cfg.readEntry( #var "match",0 ))));
|
|
||||||
|
|
||||||
#define READ_SET_RULE( var, func, def ) \
|
#define READ_SET_RULE(var) \
|
||||||
var = func ( cfg.readEntry( #var, def)); \
|
var = settings->var(); \
|
||||||
var##rule = readSetRule( cfg, QStringLiteral( #var "rule" ) );
|
var##rule = static_cast<SetRule>(settings->var##rule())
|
||||||
|
|
||||||
#define READ_SET_RULE_DEF( var , func, def ) \
|
#define READ_FORCE_RULE(var, func) \
|
||||||
var = func ( cfg.readEntry( #var, def )); \
|
var = func(settings->var()); \
|
||||||
var##rule = readSetRule( cfg, QStringLiteral( #var "rule" ) );
|
var##rule = convertForceRule(settings->var##rule())
|
||||||
|
|
||||||
#define READ_FORCE_RULE( var, func, def) \
|
|
||||||
var = func ( cfg.readEntry( #var, def)); \
|
|
||||||
var##rule = readForceRule( cfg, QStringLiteral( #var "rule" ) );
|
|
||||||
|
|
||||||
#define READ_FORCE_RULE2( var, def, func, funcarg ) \
|
|
||||||
var = func ( cfg.readEntry( #var, def),funcarg ); \
|
|
||||||
var##rule = readForceRule( cfg, QStringLiteral( #var "rule" ) );
|
|
||||||
|
|
||||||
|
|
||||||
|
Rules::Rules(const RuleSettings *settings)
|
||||||
Rules::Rules(const KConfigGroup& cfg)
|
|
||||||
: temporary_state(0)
|
: temporary_state(0)
|
||||||
{
|
{
|
||||||
readFromCfg(cfg);
|
readFromSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int limit0to4(int i)
|
void Rules::readFromSettings(const RuleSettings *settings)
|
||||||
{
|
{
|
||||||
return qMax(0, qMin(4, i));
|
description = settings->description();
|
||||||
|
if (description.isEmpty()) {
|
||||||
|
description = settings->descriptionLegacy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rules::readFromCfg(const KConfigGroup& cfg)
|
|
||||||
{
|
|
||||||
description = cfg.readEntry("Description");
|
|
||||||
if (description.isEmpty()) // capitalized first, lowercase for backwards compatibility
|
|
||||||
description = cfg.readEntry("description");
|
|
||||||
READ_MATCH_STRING(wmclass, .toLower().toLatin1());
|
READ_MATCH_STRING(wmclass, .toLower().toLatin1());
|
||||||
wmclasscomplete = cfg.readEntry("wmclasscomplete" , false);
|
wmclasscomplete = settings->wmclasscomplete();
|
||||||
READ_MATCH_STRING(windowrole, .toLower().toLatin1());
|
READ_MATCH_STRING(windowrole, .toLower().toLatin1());
|
||||||
READ_MATCH_STRING(title,);
|
READ_MATCH_STRING(title,);
|
||||||
READ_MATCH_STRING(clientmachine, .toLower().toLatin1());
|
READ_MATCH_STRING(clientmachine, .toLower().toLatin1());
|
||||||
types = NET::WindowTypeMask(cfg.readEntry<uint>("types", NET::AllTypesMask));
|
types = NET::WindowTypeMask(settings->types());
|
||||||
READ_FORCE_RULE2(placement, QString(), Placement::policyFromString, false);
|
READ_FORCE_RULE(placement,);
|
||||||
READ_SET_RULE_DEF(position, , invalidPoint);
|
READ_SET_RULE(position);
|
||||||
READ_SET_RULE(size, , QSize());
|
READ_SET_RULE(size);
|
||||||
if (size.isEmpty() && sizerule != (SetRule)Remember)
|
if (size.isEmpty() && sizerule != static_cast<SetRule>(Remember))
|
||||||
sizerule = UnusedSetRule;
|
sizerule = UnusedSetRule;
|
||||||
READ_FORCE_RULE(minsize, , QSize());
|
READ_FORCE_RULE(minsize,);
|
||||||
if (!minsize.isValid())
|
if (!minsize.isValid())
|
||||||
minsize = QSize(1, 1);
|
minsize = QSize(1, 1);
|
||||||
READ_FORCE_RULE(maxsize, , QSize());
|
READ_FORCE_RULE(maxsize,);
|
||||||
if (maxsize.isEmpty())
|
if (maxsize.isEmpty())
|
||||||
maxsize = QSize(32767, 32767);
|
maxsize = QSize(32767, 32767);
|
||||||
READ_FORCE_RULE(opacityactive, , 0);
|
READ_FORCE_RULE(opacityactive,);
|
||||||
if (opacityactive < 0 || opacityactive > 100)
|
READ_FORCE_RULE(opacityinactive,);
|
||||||
opacityactive = 100;
|
READ_SET_RULE(ignoregeometry);
|
||||||
READ_FORCE_RULE(opacityinactive, , 0);
|
READ_SET_RULE(desktop);
|
||||||
if (opacityinactive < 0 || opacityinactive > 100)
|
READ_SET_RULE(screen);
|
||||||
opacityinactive = 100;
|
READ_SET_RULE(activity);
|
||||||
READ_SET_RULE(ignoregeometry, , false);
|
READ_FORCE_RULE(type, static_cast<NET::WindowType>);
|
||||||
READ_SET_RULE(desktop, , 0);
|
if (type == NET::Unknown)
|
||||||
READ_SET_RULE(screen, , 0);
|
typerule = UnusedForceRule;
|
||||||
READ_SET_RULE(activity, , QString());
|
READ_SET_RULE(maximizevert);
|
||||||
type = readType(cfg, QStringLiteral("type"));
|
READ_SET_RULE(maximizehoriz);
|
||||||
typerule = type != NET::Unknown ? readForceRule(cfg, QStringLiteral("typerule")) : UnusedForceRule;
|
READ_SET_RULE(minimize);
|
||||||
READ_SET_RULE(maximizevert, , false);
|
READ_SET_RULE(shade);
|
||||||
READ_SET_RULE(maximizehoriz, , false);
|
READ_SET_RULE(skiptaskbar);
|
||||||
READ_SET_RULE(minimize, , false);
|
READ_SET_RULE(skippager);
|
||||||
READ_SET_RULE(shade, , false);
|
READ_SET_RULE(skipswitcher);
|
||||||
READ_SET_RULE(skiptaskbar, , false);
|
READ_SET_RULE(above);
|
||||||
READ_SET_RULE(skippager, , false);
|
READ_SET_RULE(below);
|
||||||
READ_SET_RULE(skipswitcher, , false);
|
READ_SET_RULE(fullscreen);
|
||||||
READ_SET_RULE(above, , false);
|
READ_SET_RULE(noborder);
|
||||||
READ_SET_RULE(below, , false);
|
|
||||||
READ_SET_RULE(fullscreen, , false);
|
READ_FORCE_RULE(decocolor, getDecoColor);
|
||||||
READ_SET_RULE(noborder, , false);
|
if (decocolor.isEmpty())
|
||||||
decocolor = readDecoColor(cfg);
|
decocolorrule = UnusedForceRule;
|
||||||
decocolorrule = decocolor.isEmpty() ? UnusedForceRule : readForceRule(cfg, QStringLiteral("decocolorrule"));
|
|
||||||
READ_FORCE_RULE(blockcompositing, , false);
|
READ_FORCE_RULE(blockcompositing,);
|
||||||
READ_FORCE_RULE(fsplevel, limit0to4, 0); // fsp is 0-4
|
READ_FORCE_RULE(fsplevel,);
|
||||||
READ_FORCE_RULE(fpplevel, limit0to4, 0); // fpp is 0-4
|
READ_FORCE_RULE(fpplevel,);
|
||||||
READ_FORCE_RULE(acceptfocus, , false);
|
READ_FORCE_RULE(acceptfocus,);
|
||||||
READ_FORCE_RULE(closeable, , false);
|
READ_FORCE_RULE(closeable,);
|
||||||
READ_FORCE_RULE(autogroup, , false);
|
READ_FORCE_RULE(autogroup,);
|
||||||
READ_FORCE_RULE(autogroupfg, , true);
|
READ_FORCE_RULE(autogroupfg,);
|
||||||
READ_FORCE_RULE(autogroupid, , QString());
|
READ_FORCE_RULE(autogroupid,);
|
||||||
READ_FORCE_RULE(strictgeometry, , false);
|
READ_FORCE_RULE(strictgeometry,);
|
||||||
READ_SET_RULE(shortcut, , QString());
|
READ_SET_RULE(shortcut);
|
||||||
READ_FORCE_RULE(disableglobalshortcuts, , false);
|
READ_FORCE_RULE(disableglobalshortcuts,);
|
||||||
READ_SET_RULE(desktopfile, , QString());
|
READ_SET_RULE(desktopfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef READ_MATCH_STRING
|
#undef READ_MATCH_STRING
|
||||||
|
@ -201,78 +191,60 @@ void Rules::readFromCfg(const KConfigGroup& cfg)
|
||||||
#undef READ_FORCE_RULE
|
#undef READ_FORCE_RULE
|
||||||
#undef READ_FORCE_RULE2
|
#undef READ_FORCE_RULE2
|
||||||
|
|
||||||
#define WRITE_MATCH_STRING( var, force ) \
|
#define WRITE_MATCH_STRING(var, capital, force) \
|
||||||
|
settings->set##capital##match(var##match); \
|
||||||
if (!var.isEmpty() || force) \
|
if (!var.isEmpty() || force) \
|
||||||
{ \
|
{ \
|
||||||
cfg.writeEntry( #var, var ); \
|
settings->set##capital(var); \
|
||||||
cfg.writeEntry( #var "match", (int)var##match ); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
cfg.deleteEntry( #var ); \
|
|
||||||
cfg.deleteEntry( #var "match" ); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WRITE_SET_RULE( var, func ) \
|
#define WRITE_SET_RULE(var, capital, func) \
|
||||||
|
settings->set##capital##rule(var##rule); \
|
||||||
if (var##rule != UnusedSetRule) \
|
if (var##rule != UnusedSetRule) \
|
||||||
{ \
|
{ \
|
||||||
cfg.writeEntry( #var, func ( var )); \
|
settings->set##capital(func(var)); \
|
||||||
cfg.writeEntry( #var "rule", (int)var##rule ); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
cfg.deleteEntry( #var ); \
|
|
||||||
cfg.deleteEntry( #var "rule" ); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WRITE_FORCE_RULE( var, func ) \
|
#define WRITE_FORCE_RULE(var, capital, func) \
|
||||||
|
settings->set##capital##rule(var##rule); \
|
||||||
if ( var##rule != UnusedForceRule ) \
|
if ( var##rule != UnusedForceRule ) \
|
||||||
{ \
|
{ \
|
||||||
cfg.writeEntry( #var, func ( var )); \
|
settings->set##capital(func(var)); \
|
||||||
cfg.writeEntry( #var "rule", (int)var##rule ); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
cfg.deleteEntry( #var ); \
|
|
||||||
cfg.deleteEntry( #var "rule" ); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rules::write(KConfigGroup& cfg) const
|
void Rules::write(RuleSettings *settings) const
|
||||||
{
|
{
|
||||||
cfg.writeEntry("Description", description);
|
settings->setDescription(description);
|
||||||
// always write wmclass
|
// always write wmclass
|
||||||
WRITE_MATCH_STRING(wmclass, true);
|
WRITE_MATCH_STRING(wmclass, Wmclass, true);
|
||||||
cfg.writeEntry("wmclasscomplete", wmclasscomplete);
|
settings->setWmclasscomplete(wmclasscomplete);
|
||||||
WRITE_MATCH_STRING(windowrole, false);
|
WRITE_MATCH_STRING(windowrole, Windowrole, false);
|
||||||
WRITE_MATCH_STRING(title, false);
|
WRITE_MATCH_STRING(title, Title, false);
|
||||||
WRITE_MATCH_STRING(clientmachine, false);
|
WRITE_MATCH_STRING(clientmachine, Clientmachine, false);
|
||||||
if (types != NET::AllTypesMask)
|
settings->setTypes(types);
|
||||||
cfg.writeEntry("types", uint(types));
|
WRITE_FORCE_RULE(placement, Placement,);
|
||||||
else
|
WRITE_SET_RULE(position, Position,);
|
||||||
cfg.deleteEntry("types");
|
WRITE_SET_RULE(size, Size,);
|
||||||
WRITE_FORCE_RULE(placement, Placement::policyToString);
|
WRITE_FORCE_RULE(minsize, Minsize,);
|
||||||
WRITE_SET_RULE(position,);
|
WRITE_FORCE_RULE(maxsize, Maxsize,);
|
||||||
WRITE_SET_RULE(size,);
|
WRITE_FORCE_RULE(opacityactive, Opacityactive,);
|
||||||
WRITE_FORCE_RULE(minsize,);
|
WRITE_FORCE_RULE(opacityinactive, Opacityinactive,);
|
||||||
WRITE_FORCE_RULE(maxsize,);
|
WRITE_SET_RULE(ignoregeometry, Ignoregeometry,);
|
||||||
WRITE_FORCE_RULE(opacityactive,);
|
WRITE_SET_RULE(desktop, Desktop,);
|
||||||
WRITE_FORCE_RULE(opacityinactive,);
|
WRITE_SET_RULE(screen, Screen,);
|
||||||
WRITE_SET_RULE(ignoregeometry,);
|
WRITE_SET_RULE(activity, Activity,);
|
||||||
WRITE_SET_RULE(desktop,);
|
WRITE_FORCE_RULE(type, Type,);
|
||||||
WRITE_SET_RULE(screen,);
|
WRITE_SET_RULE(maximizevert, Maximizevert,);
|
||||||
WRITE_SET_RULE(activity,);
|
WRITE_SET_RULE(maximizehoriz, Maximizehoriz,);
|
||||||
WRITE_FORCE_RULE(type, int);
|
WRITE_SET_RULE(minimize, Minimize,);
|
||||||
WRITE_SET_RULE(maximizevert,);
|
WRITE_SET_RULE(shade, Shade,);
|
||||||
WRITE_SET_RULE(maximizehoriz,);
|
WRITE_SET_RULE(skiptaskbar, Skiptaskbar,);
|
||||||
WRITE_SET_RULE(minimize,);
|
WRITE_SET_RULE(skippager, Skippager,);
|
||||||
WRITE_SET_RULE(shade,);
|
WRITE_SET_RULE(skipswitcher, Skipswitcher,);
|
||||||
WRITE_SET_RULE(skiptaskbar,);
|
WRITE_SET_RULE(above, Above,);
|
||||||
WRITE_SET_RULE(skippager,);
|
WRITE_SET_RULE(below, Below,);
|
||||||
WRITE_SET_RULE(skipswitcher,);
|
WRITE_SET_RULE(fullscreen, Fullscreen,);
|
||||||
WRITE_SET_RULE(above,);
|
WRITE_SET_RULE(noborder, Noborder,);
|
||||||
WRITE_SET_RULE(below,);
|
|
||||||
WRITE_SET_RULE(fullscreen,);
|
|
||||||
WRITE_SET_RULE(noborder,);
|
|
||||||
auto colorToString = [](const QString &value) -> QString {
|
auto colorToString = [](const QString &value) -> QString {
|
||||||
if (value.endsWith(QLatin1String(".colors"))) {
|
if (value.endsWith(QLatin1String(".colors"))) {
|
||||||
return QFileInfo(value).baseName();
|
return QFileInfo(value).baseName();
|
||||||
|
@ -280,19 +252,19 @@ void Rules::write(KConfigGroup& cfg) const
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
WRITE_FORCE_RULE(decocolor, colorToString);
|
WRITE_FORCE_RULE(decocolor, Decocolor, colorToString);
|
||||||
WRITE_FORCE_RULE(blockcompositing,);
|
WRITE_FORCE_RULE(blockcompositing, Blockcompositing,);
|
||||||
WRITE_FORCE_RULE(fsplevel,);
|
WRITE_FORCE_RULE(fsplevel, Fsplevel,);
|
||||||
WRITE_FORCE_RULE(fpplevel,);
|
WRITE_FORCE_RULE(fpplevel, Fpplevel,);
|
||||||
WRITE_FORCE_RULE(acceptfocus,);
|
WRITE_FORCE_RULE(acceptfocus, Acceptfocus,);
|
||||||
WRITE_FORCE_RULE(closeable,);
|
WRITE_FORCE_RULE(closeable, Closeable,);
|
||||||
WRITE_FORCE_RULE(autogroup,);
|
WRITE_FORCE_RULE(autogroup, Autogroup,);
|
||||||
WRITE_FORCE_RULE(autogroupfg,);
|
WRITE_FORCE_RULE(autogroupfg, Autogroupfg,);
|
||||||
WRITE_FORCE_RULE(autogroupid,);
|
WRITE_FORCE_RULE(autogroupid, Autogroupid,);
|
||||||
WRITE_FORCE_RULE(strictgeometry,);
|
WRITE_FORCE_RULE(strictgeometry, Strictgeometry,);
|
||||||
WRITE_SET_RULE(shortcut,);
|
WRITE_SET_RULE(shortcut, Shortcut,);
|
||||||
WRITE_FORCE_RULE(disableglobalshortcuts,);
|
WRITE_FORCE_RULE(disableglobalshortcuts, Disableglobalshortcuts,);
|
||||||
WRITE_SET_RULE(desktopfile,);
|
WRITE_SET_RULE(desktopfile, Desktopfile,);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef WRITE_MATCH_STRING
|
#undef WRITE_MATCH_STRING
|
||||||
|
@ -340,33 +312,15 @@ bool Rules::isEmpty() const
|
||||||
&& desktopfilerule == UnusedSetRule);
|
&& desktopfilerule == UnusedSetRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rules::SetRule Rules::readSetRule(const KConfigGroup& cfg, const QString& key)
|
Rules::ForceRule Rules::convertForceRule(int v)
|
||||||
{
|
{
|
||||||
int v = cfg.readEntry(key, 0);
|
|
||||||
if (v >= DontAffect && v <= ForceTemporarily)
|
|
||||||
return static_cast< SetRule >(v);
|
|
||||||
return UnusedSetRule;
|
|
||||||
}
|
|
||||||
|
|
||||||
Rules::ForceRule Rules::readForceRule(const KConfigGroup& cfg, const QString& key)
|
|
||||||
{
|
|
||||||
int v = cfg.readEntry(key, 0);
|
|
||||||
if (v == DontAffect || v == Force || v == ForceTemporarily)
|
if (v == DontAffect || v == Force || v == ForceTemporarily)
|
||||||
return static_cast<ForceRule>(v);
|
return static_cast<ForceRule>(v);
|
||||||
return UnusedForceRule;
|
return UnusedForceRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
NET::WindowType Rules::readType(const KConfigGroup& cfg, const QString& key)
|
QString Rules::getDecoColor(const QString &themeName)
|
||||||
{
|
{
|
||||||
int v = cfg.readEntry(key, 0);
|
|
||||||
if (v >= NET::Normal && v <= NET::Splash)
|
|
||||||
return static_cast< NET::WindowType >(v);
|
|
||||||
return NET::Unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Rules::readDecoColor(const KConfigGroup &cfg)
|
|
||||||
{
|
|
||||||
QString themeName = cfg.readEntry("decocolor", QString());
|
|
||||||
if (themeName.isEmpty()) {
|
if (themeName.isEmpty()) {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@ -1067,14 +1021,7 @@ void RuleBook::load()
|
||||||
} else {
|
} else {
|
||||||
m_config->reparseConfiguration();
|
m_config->reparseConfiguration();
|
||||||
}
|
}
|
||||||
int count = m_config->group("General").readEntry("count", 0);
|
m_rules = RuleBookSettings(m_config).rules().toList();
|
||||||
for (int i = 1;
|
|
||||||
i <= count;
|
|
||||||
++i) {
|
|
||||||
KConfigGroup cg(m_config, QString::number(i));
|
|
||||||
Rules* rule = new Rules(cg);
|
|
||||||
m_rules.append(rule);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RuleBook::save()
|
void RuleBook::save()
|
||||||
|
@ -1084,23 +1031,15 @@ void RuleBook::save()
|
||||||
qCWarning(KWIN_CORE) << "RuleBook::save invoked without prior invocation of RuleBook::load";
|
qCWarning(KWIN_CORE) << "RuleBook::save invoked without prior invocation of RuleBook::load";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList groups = m_config->groupList();
|
QVector<Rules *> filteredRules;
|
||||||
for (QStringList::ConstIterator it = groups.constBegin();
|
for (const auto &rule : qAsConst(m_rules)) {
|
||||||
it != groups.constEnd();
|
if (!rule->isTemporary()) {
|
||||||
++it)
|
filteredRules.append(rule);
|
||||||
m_config->deleteGroup(*it);
|
|
||||||
m_config->group("General").writeEntry("count", m_rules.count());
|
|
||||||
int i = 1;
|
|
||||||
for (QList< Rules* >::ConstIterator it = m_rules.constBegin();
|
|
||||||
it != m_rules.constEnd();
|
|
||||||
++it) {
|
|
||||||
if ((*it)->isTemporary())
|
|
||||||
continue;
|
|
||||||
KConfigGroup cg(m_config, QString::number(i));
|
|
||||||
(*it)->write(cg);
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
m_config->sync();
|
}
|
||||||
|
RuleBookSettings settings(m_config);
|
||||||
|
settings.setRules(filteredRules);
|
||||||
|
settings.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RuleBook::temporaryRulesMessage(const QString& message)
|
void RuleBook::temporaryRulesMessage(const QString& message)
|
||||||
|
|
30
rules.h
30
rules.h
|
@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <netwm_def.h>
|
#include <netwm_def.h>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <kconfiggroup.h>
|
|
||||||
|
|
||||||
#include "placement.h"
|
#include "placement.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -40,6 +39,7 @@ namespace KWin
|
||||||
|
|
||||||
class AbstractClient;
|
class AbstractClient;
|
||||||
class Rules;
|
class Rules;
|
||||||
|
class RuleSettings;
|
||||||
|
|
||||||
#ifndef KCMRULES // only for kwin core
|
#ifndef KCMRULES // only for kwin core
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class Rules
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Rules();
|
Rules();
|
||||||
explicit Rules(const KConfigGroup&);
|
explicit Rules(const RuleSettings*);
|
||||||
Rules(const QString&, bool temporary);
|
Rules(const QString&, bool temporary);
|
||||||
enum Type {
|
enum Type {
|
||||||
Position = 1<<0, Size = 1<<1, Desktop = 1<<2,
|
Position = 1<<0, Size = 1<<1, Desktop = 1<<2,
|
||||||
|
@ -130,7 +130,15 @@ public:
|
||||||
RegExpMatch,
|
RegExpMatch,
|
||||||
LastStringMatch = RegExpMatch
|
LastStringMatch = RegExpMatch
|
||||||
};
|
};
|
||||||
void write(KConfigGroup&) const;
|
enum SetRule {
|
||||||
|
UnusedSetRule = Unused,
|
||||||
|
SetRuleDummy = 256 // so that it's at least short int
|
||||||
|
};
|
||||||
|
enum ForceRule {
|
||||||
|
UnusedForceRule = Unused,
|
||||||
|
ForceRuleDummy = 256 // so that it's at least short int
|
||||||
|
};
|
||||||
|
void write(RuleSettings*) const;
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
#ifndef KCMRULES
|
#ifndef KCMRULES
|
||||||
bool discardUsed(bool withdrawn);
|
bool discardUsed(bool withdrawn);
|
||||||
|
@ -183,19 +191,9 @@ private:
|
||||||
bool matchRole(const QByteArray& match_role) const;
|
bool matchRole(const QByteArray& match_role) const;
|
||||||
bool matchTitle(const QString& match_title) const;
|
bool matchTitle(const QString& match_title) const;
|
||||||
bool matchClientMachine(const QByteArray& match_machine, bool local) const;
|
bool matchClientMachine(const QByteArray& match_machine, bool local) const;
|
||||||
enum SetRule {
|
void readFromSettings(const RuleSettings *settings);
|
||||||
UnusedSetRule = Unused,
|
static ForceRule convertForceRule(int v);
|
||||||
SetRuleDummy = 256 // so that it's at least short int
|
static QString getDecoColor(const QString &themeName);
|
||||||
};
|
|
||||||
enum ForceRule {
|
|
||||||
UnusedForceRule = Unused,
|
|
||||||
ForceRuleDummy = 256 // so that it's at least short int
|
|
||||||
};
|
|
||||||
void readFromCfg(const KConfigGroup& cfg);
|
|
||||||
static SetRule readSetRule(const KConfigGroup&, const QString& key);
|
|
||||||
static ForceRule readForceRule(const KConfigGroup&, const QString& key);
|
|
||||||
static NET::WindowType readType(const KConfigGroup&, const QString& key);
|
|
||||||
static QString readDecoColor(const KConfigGroup &cfg);
|
|
||||||
#ifndef KCMRULES
|
#ifndef KCMRULES
|
||||||
static bool checkSetRule(SetRule rule, bool init);
|
static bool checkSetRule(SetRule rule, bool init);
|
||||||
static bool checkForceRule(ForceRule rule);
|
static bool checkForceRule(ForceRule rule);
|
||||||
|
|
|
@ -0,0 +1,435 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||||
|
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
|
||||||
|
<kcfgfile arg="true">
|
||||||
|
<parameter name="ruleDescriptionOrNumber"/>
|
||||||
|
</kcfgfile>
|
||||||
|
<group name="$(ruleDescriptionOrNumber)">
|
||||||
|
<entry name="description" key="Description" type="String">
|
||||||
|
<label>Rule description</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="descriptionLegacy" key="description" type="String">
|
||||||
|
<label>Rule description (legacy)</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="DeleteRule" key="deleteRule" type="Bool">
|
||||||
|
<label>Delete this rule (for use in imports)</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="wmclass" type="String">
|
||||||
|
<label>Window class (application)</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="wmclassmatch" type="Int">
|
||||||
|
<label>Window class string match type</label>
|
||||||
|
<default code="true">Rules::UnimportantMatch</default>
|
||||||
|
<min code="true">Rules::FirstStringMatch</min>
|
||||||
|
<max code="true">Rules::LastStringMatch</max>
|
||||||
|
</entry>
|
||||||
|
<entry name="wmclasscomplete" type="Bool">
|
||||||
|
<label>Match whole window class</label>
|
||||||
|
<default code="true">Rules::UnimportantMatch</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="windowrole" type="String">
|
||||||
|
<label>Window role</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="windowrolematch" type="Int">
|
||||||
|
<label>Window role string match type</label>
|
||||||
|
<default code="true">Rules::UnimportantMatch</default>
|
||||||
|
<min code="true">Rules::FirstStringMatch</min>
|
||||||
|
<max code="true">Rules::LastStringMatch</max>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="title" type="String">
|
||||||
|
<label>Window title</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="titlematch" type="Int">
|
||||||
|
<label>Window title string match type</label>
|
||||||
|
<default code="true">Rules::UnimportantMatch</default>
|
||||||
|
<min code="true">Rules::FirstStringMatch</min>
|
||||||
|
<max code="true">Rules::LastStringMatch</max>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="clientmachine" type="String">
|
||||||
|
<label>Machine (hostname)</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="clientmachinematch" type="Int">
|
||||||
|
<label>Machine string match type</label>
|
||||||
|
<default code="true">Rules::UnimportantMatch</default>
|
||||||
|
<min code="true">Rules::FirstStringMatch</min>
|
||||||
|
<max code="true">Rules::LastStringMatch</max>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="types" type="UInt">
|
||||||
|
<label>Window types that match</label>
|
||||||
|
<default>NET::AllTypesMask</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="placement" type="Enum">
|
||||||
|
<label>Inital placement</label>
|
||||||
|
<choices name="Placement::Policy"/>
|
||||||
|
<default code="true">Placement::Smart</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="placementrule" type="Int">
|
||||||
|
<label>Inital placement rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="position" type="Point">
|
||||||
|
<label>Window position</label>
|
||||||
|
<default>invalidPoint</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="positionrule" type="Int">
|
||||||
|
<label>Window position rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="size" type="Size">
|
||||||
|
<label>Window size</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="sizerule" type="Int">
|
||||||
|
<label>Window size rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="minsize" type="Size">
|
||||||
|
<label>Window minimum size</label>
|
||||||
|
<!-- <default>QSize(1, 1)</default> -->
|
||||||
|
</entry>
|
||||||
|
<entry name="minsizerule" type="Int">
|
||||||
|
<label>Window minimum size rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="maxsize" type="Size">
|
||||||
|
<label>Window maximum size</label>
|
||||||
|
<!-- <default>QSize(32767, 32767)</default> -->
|
||||||
|
</entry>
|
||||||
|
<entry name="maxsizerule" type="Int">
|
||||||
|
<label>Window maximum size rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="opacityactive" type="Int">
|
||||||
|
<label>Active opacity</label>
|
||||||
|
<min>0</min>
|
||||||
|
<max>100</max>
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="opacityactiverule" type="Int">
|
||||||
|
<label>Active opacity rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="opacityinactive" type="Int">
|
||||||
|
<label>Inactive opacity</label>
|
||||||
|
<min>0</min>
|
||||||
|
<max>100</max>
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="opacityinactiverule" type="Int">
|
||||||
|
<label>Inactive opacity rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="ignoregeometry" type="Bool">
|
||||||
|
<label>Ignore requested geometry</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="ignoregeometryrule" type="Int">
|
||||||
|
<label>Ignore requested geometry rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="desktop" type="Int">
|
||||||
|
<label>Desktop number</label>
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="desktoprule" type="Int">
|
||||||
|
<label>Desktop number rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="screen" type="Int">
|
||||||
|
<label>Screen number</label>
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="screenrule" type="Int">
|
||||||
|
<label>Screen number rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="activity" type="String">
|
||||||
|
<label>Activity</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="activityrule" type="Int">
|
||||||
|
<label>Activity rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="type" type="Int">
|
||||||
|
<label>Set window type to</label>
|
||||||
|
<min code="true">NET::Normal</min>
|
||||||
|
<max code="true">NET::Splash</max>
|
||||||
|
<default code="true">NET::Unknown</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="typerule" type="Int">
|
||||||
|
<label>Set window type rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="maximizevert" type="Bool">
|
||||||
|
<label>Maximized vertically</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="maximizevertrule" type="Int">
|
||||||
|
<label>Maximized vertically rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="maximizehoriz" type="Bool">
|
||||||
|
<label>Maximized horizontally</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="maximizehorizrule" type="Int">
|
||||||
|
<label>Maximized horizontally rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="minimize" type="Bool">
|
||||||
|
<label>Minimized</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="minimizerule" type="Int">
|
||||||
|
<label>Minimized rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="shade" type="Bool">
|
||||||
|
<label>Shaded</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="shaderule" type="Int">
|
||||||
|
<label>Shaded rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="skiptaskbar" type="Bool">
|
||||||
|
<label>Skip taskbar</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="skiptaskbarrule" type="Int">
|
||||||
|
<label>Skip taskbar rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="skippager" type="Bool">
|
||||||
|
<label>Skip pager</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="skippagerrule" type="Int">
|
||||||
|
<label>Skip pager rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="skipswitcher" type="Bool">
|
||||||
|
<label>Skip switcher</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="skipswitcherrule" type="Int">
|
||||||
|
<label>Skip switcher rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="above" type="Bool">
|
||||||
|
<label>Keep above</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="aboverule" type="Int">
|
||||||
|
<label>Keep above rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="below" type="Bool">
|
||||||
|
<label>Keep below</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="belowrule" type="Int">
|
||||||
|
<label>Keep below rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="fullscreen" type="Bool">
|
||||||
|
<label>Fullscreen</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fullscreenrule" type="Int">
|
||||||
|
<label>Fullscreen rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="noborder" type="Bool">
|
||||||
|
<label>No titlebar and frame</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="noborderrule" type="Int">
|
||||||
|
<label>No titlebar rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="decocolor" type="String">
|
||||||
|
<label>Titlebar color and scheme</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="decocolorrule" type="Int">
|
||||||
|
<label>Titlebar color rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="blockcompositing" type="Bool">
|
||||||
|
<label>Block Compositing</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="blockcompositingrule" type="Int">
|
||||||
|
<label>Block Compositing rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="fsplevel" type="Int">
|
||||||
|
<label>Focus stealing prevention</label>
|
||||||
|
<default>0</default>
|
||||||
|
<min>0</min>
|
||||||
|
<max>4</max>
|
||||||
|
</entry>
|
||||||
|
<entry name="fsplevelrule" type="Int">
|
||||||
|
<label>Focus stealing prevention rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="fpplevel" type="Int">
|
||||||
|
<label>Focus protection</label>
|
||||||
|
<default>0</default>
|
||||||
|
<min>0</min>
|
||||||
|
<max>4</max>
|
||||||
|
</entry>
|
||||||
|
<entry name="fpplevelrule" type="Int">
|
||||||
|
<label>Focus protection rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="acceptfocus" type="Bool">
|
||||||
|
<label>Accept Focus</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="acceptfocusrule" type="Int">
|
||||||
|
<label>Accept Focus rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="closeable" type="Bool">
|
||||||
|
<label>Closeable</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="closeablerule" type="Int">
|
||||||
|
<label>Closeable rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="autogroup" type="Bool">
|
||||||
|
<label>Autogroup with identical</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="autogrouprule" type="Int">
|
||||||
|
<label>Autogroup with identical rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="autogroupfg" type="Bool">
|
||||||
|
<label>Autogroup in foreground</label>
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="autogroupfgrule" type="Int">
|
||||||
|
<label>Autogroup in foreground rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="autogroupid" type="String">
|
||||||
|
<label>Autogroup by ID</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="autogroupidrule" type="Int">
|
||||||
|
<label>Autogroup by ID rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="strictgeometry" type="Bool">
|
||||||
|
<label>Obey geometry restrictions</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="strictgeometryrule" type="Int">
|
||||||
|
<label>Obey geometry restrictions rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="shortcut" type="String">
|
||||||
|
<label>Shortcut</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="shortcutrule" type="Int">
|
||||||
|
<label>Shortcut rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="disableglobalshortcuts" type="Bool">
|
||||||
|
<label>Ignore global shortcuts</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="disableglobalshortcutsrule" type="Int">
|
||||||
|
<label>Ignore global shortcuts rule type</label>
|
||||||
|
<default code="true">Rules::UnusedForceRule</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
|
<entry name="desktopfile" type="String">
|
||||||
|
<label>Desktop file name</label>
|
||||||
|
</entry>
|
||||||
|
<entry name="desktopfilerule" type="Int">
|
||||||
|
<label>Desktop file name rule type</label>
|
||||||
|
<min code="true">Rules::UnusedSetRule</min>
|
||||||
|
<max code="true">static_cast<Rules::SetRule>(Rules::ForceTemporarily)</max>
|
||||||
|
<default code="true">Rules::UnusedSetRule</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
</kcfg>
|
|
@ -0,0 +1,7 @@
|
||||||
|
File=rulesettings.kcfg
|
||||||
|
IncludeFiles=\"rules.h\",\"placement.h\",netwm_def.h
|
||||||
|
NameSpace=KWin
|
||||||
|
ClassName=RuleSettings
|
||||||
|
UseEnumTypes=true
|
||||||
|
Mutators=true
|
||||||
|
ParentInConstructor=true
|
Loading…
Reference in New Issue