mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Revert "envmanager: Handle SSD toggling with kwin rules"
This reverts commit c45f9ed446.
The kwin rules setting causes all desktop windows to have window decorations. Revert this for now until we figure out a solution.
This commit is contained in:
parent
3afd53a2de
commit
9c2e2c7db3
4 changed files with 25 additions and 101 deletions
|
|
@ -72,47 +72,5 @@ QMap<QString, QMap<QString, QVariant>> getKwinrcSettings(KSharedConfig::Ptr m_mo
|
||||||
const QList<QString> KWIN_EFFECTS = {"blur", "mobiletaskswitcher", "screenedge"};
|
const QList<QString> KWIN_EFFECTS = {"blur", "mobiletaskswitcher", "screenedge"};
|
||||||
const QList<QString> KWIN_SCRIPTS = {"convergentwindows"};
|
const QList<QString> KWIN_SCRIPTS = {"convergentwindows"};
|
||||||
|
|
||||||
// ksmserver
|
//ksmserver
|
||||||
const QMap<QString, QMap<QString, QVariant>> KSMSERVER_SETTINGS = {{"General", {{"loginMode", "emptySession"}}}};
|
const QMap<QString, QMap<QString, QVariant>> KSMSERVER_SETTINGS = {{"General", {{"loginMode", "emptySession"}}}};
|
||||||
|
|
||||||
// kwinrulesrc
|
|
||||||
const QList<QString> KWIN_RULES = {"plasma-mobile-desktop", "plasma-mobile-maximized-no-border"};
|
|
||||||
|
|
||||||
QMap<QString, QMap<QString, QVariant>> getKwinrulesrcSettings(KSharedConfig::Ptr m_mobileConfig, bool isMobileSession)
|
|
||||||
{
|
|
||||||
auto group = KConfigGroup{m_mobileConfig, QStringLiteral("General")};
|
|
||||||
bool convergenceModeEnabled = group.readEntry("convergenceModeEnabled", false);
|
|
||||||
|
|
||||||
if (convergenceModeEnabled || !isMobileSession) {
|
|
||||||
return {{"plasma-mobile-desktop",
|
|
||||||
{
|
|
||||||
{"Description", "Desktop windows (controlled by Plasma Mobile)"},
|
|
||||||
{"maximizehoriz", true},
|
|
||||||
{"maximizehorizrule", 1},
|
|
||||||
{"maximizevert", true},
|
|
||||||
{"maximizevertrule", 1},
|
|
||||||
{"noborderrule", 2},
|
|
||||||
}},
|
|
||||||
{"General",
|
|
||||||
{
|
|
||||||
{"count", 1},
|
|
||||||
{"rules", "plasma-mobile-desktop"},
|
|
||||||
}}};
|
|
||||||
} else {
|
|
||||||
return {{"plasma-mobile-maximized-no-border",
|
|
||||||
{
|
|
||||||
{"Description", "Mobile windows (controlled by Plasma Mobile)"},
|
|
||||||
{"maximizehoriz", true},
|
|
||||||
{"maximizehorizrule", 2},
|
|
||||||
{"maximizevert", true},
|
|
||||||
{"maximizevertrule", 2},
|
|
||||||
{"noborder", true},
|
|
||||||
{"noborderrule", 2},
|
|
||||||
}},
|
|
||||||
{"General",
|
|
||||||
{
|
|
||||||
{"count", 1},
|
|
||||||
{"rules", "plasma-mobile-maximized-no-border"},
|
|
||||||
}}};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ Settings::Settings(QObject *parent)
|
||||||
, m_appBlacklistConfig{KSharedConfig::openConfig(u"applications-blacklistrc"_s, KConfig::SimpleConfig)}
|
, m_appBlacklistConfig{KSharedConfig::openConfig(u"applications-blacklistrc"_s, KConfig::SimpleConfig)}
|
||||||
, m_kdeglobalsConfig{KSharedConfig::openConfig(u"kdeglobals"_s, KConfig::SimpleConfig)}
|
, m_kdeglobalsConfig{KSharedConfig::openConfig(u"kdeglobals"_s, KConfig::SimpleConfig)}
|
||||||
, m_ksmServerConfig{KSharedConfig::openConfig(u"ksmserverrc"_s, KConfig::SimpleConfig)}
|
, m_ksmServerConfig{KSharedConfig::openConfig(u"ksmserverrc"_s, KConfig::SimpleConfig)}
|
||||||
, m_kwinrulesrcConfig{KSharedConfig::openConfig(u"kwinrulesrc"_s, KConfig::SimpleConfig)}
|
|
||||||
, m_configWatcher{KConfigWatcher::create(m_mobileConfig)}
|
, m_configWatcher{KConfigWatcher::create(m_mobileConfig)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -55,14 +54,6 @@ void Settings::loadSavedConfiguration()
|
||||||
// kwinrc
|
// kwinrc
|
||||||
loadKeys(u"kwinrc"_s, m_kwinrcConfig, getKwinrcSettings(m_mobileConfig));
|
loadKeys(u"kwinrc"_s, m_kwinrcConfig, getKwinrcSettings(m_mobileConfig));
|
||||||
m_kwinrcConfig->sync();
|
m_kwinrcConfig->sync();
|
||||||
|
|
||||||
// kwinrules
|
|
||||||
for (const auto &groupName : KWIN_RULES) {
|
|
||||||
m_kwinrulesrcConfig->deleteGroup(groupName);
|
|
||||||
}
|
|
||||||
writeKeys(u"kwinrulesrc"_s, m_kwinrulesrcConfig, getKwinrulesrcSettings(m_mobileConfig, false), false, false);
|
|
||||||
m_kwinrulesrcConfig->sync();
|
|
||||||
|
|
||||||
reloadKWinConfig();
|
reloadKWinConfig();
|
||||||
|
|
||||||
// applications-blacklistrc
|
// applications-blacklistrc
|
||||||
|
|
@ -83,14 +74,6 @@ void Settings::applyMobileConfiguration()
|
||||||
// kwinrc
|
// kwinrc
|
||||||
writeKeys(u"kwinrc"_s, m_kwinrcConfig, getKwinrcSettings(m_mobileConfig), false);
|
writeKeys(u"kwinrc"_s, m_kwinrcConfig, getKwinrcSettings(m_mobileConfig), false);
|
||||||
m_kwinrcConfig->sync();
|
m_kwinrcConfig->sync();
|
||||||
|
|
||||||
// kwinrules
|
|
||||||
for (const auto &groupName : KWIN_RULES) {
|
|
||||||
m_kwinrulesrcConfig->deleteGroup(groupName);
|
|
||||||
}
|
|
||||||
writeKeys(u"kwinrulesrc"_s, m_kwinrulesrcConfig, getKwinrulesrcSettings(m_mobileConfig, true), false, false);
|
|
||||||
m_kwinrulesrcConfig->sync();
|
|
||||||
|
|
||||||
reloadKWinConfig();
|
reloadKWinConfig();
|
||||||
|
|
||||||
// applications-blacklistrc
|
// applications-blacklistrc
|
||||||
|
|
@ -114,11 +97,7 @@ void Settings::applyMobileConfiguration()
|
||||||
m_mobileConfig->sync();
|
m_mobileConfig->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::writeKeys(const QString &fileName,
|
void Settings::writeKeys(const QString &fileName, KSharedConfig::Ptr &config, const QMap<QString, QMap<QString, QVariant>> &settings, bool overwriteOnlyIfEmpty)
|
||||||
KSharedConfig::Ptr &config,
|
|
||||||
const QMap<QString, QMap<QString, QVariant>> &settings,
|
|
||||||
bool overwriteOnlyIfEmpty,
|
|
||||||
bool saveSettings)
|
|
||||||
{
|
{
|
||||||
const auto groupNames = settings.keys();
|
const auto groupNames = settings.keys();
|
||||||
for (const auto &groupName : groupNames) {
|
for (const auto &groupName : groupNames) {
|
||||||
|
|
@ -128,9 +107,7 @@ void Settings::writeKeys(const QString &fileName,
|
||||||
for (const auto &key : keys) {
|
for (const auto &key : keys) {
|
||||||
if (!group.hasKey(key) || !overwriteOnlyIfEmpty) {
|
if (!group.hasKey(key) || !overwriteOnlyIfEmpty) {
|
||||||
// save key
|
// save key
|
||||||
if (saveSettings) {
|
saveConfigSetting(fileName, groupName, key, group.readEntry(key));
|
||||||
saveConfigSetting(fileName, groupName, key, group.readEntry(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
// overwrite with mobile setting
|
// overwrite with mobile setting
|
||||||
group.writeEntry(key, settings[groupName][key], KConfigGroup::Notify);
|
group.writeEntry(key, settings[groupName][key], KConfigGroup::Notify);
|
||||||
|
|
@ -230,10 +207,6 @@ void Settings::reloadKWinConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call "start" to load enabled KWin scripts.
|
// Call "start" to load enabled KWin scripts.
|
||||||
QDBusMessage startScriptsMessage = QDBusMessage::createMethodCall(u"org.kde.KWin"_s, u"/Scripting"_s, u"org.kde.kwin.Scripting"_s, u"start"_s);
|
QDBusMessage message = QDBusMessage::createMethodCall(u"org.kde.KWin"_s, u"/Scripting"_s, u"org.kde.kwin.Scripting"_s, u"start"_s);
|
||||||
QDBusConnection::sessionBus().send(startScriptsMessage);
|
QDBusConnection::sessionBus().send(message);
|
||||||
|
|
||||||
// Call reconfigure
|
|
||||||
QDBusMessage reconfigureMessage = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reconfigure");
|
|
||||||
QDBusConnection::sessionBus().send(reconfigureMessage);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,7 @@ private:
|
||||||
// applies our mobile configuration
|
// applies our mobile configuration
|
||||||
void applyMobileConfiguration();
|
void applyMobileConfiguration();
|
||||||
|
|
||||||
void writeKeys(const QString &fileName,
|
void writeKeys(const QString &fileName, KSharedConfig::Ptr &config, const QMap<QString, QMap<QString, QVariant>> &settings, bool overwriteOnlyIfEmpty);
|
||||||
KSharedConfig::Ptr &config,
|
|
||||||
const QMap<QString, QMap<QString, QVariant>> &settings,
|
|
||||||
bool overwriteOnlyIfEmpty,
|
|
||||||
bool saveSettings = true);
|
|
||||||
void loadKeys(const QString &fileName, KSharedConfig::Ptr &config, const QMap<QString, QMap<QString, QVariant>> &settings);
|
void loadKeys(const QString &fileName, KSharedConfig::Ptr &config, const QMap<QString, QMap<QString, QVariant>> &settings);
|
||||||
void saveConfigSetting(const QString &fileName, const QString &group, const QString &key, const QVariant value);
|
void saveConfigSetting(const QString &fileName, const QString &group, const QString &key, const QVariant value);
|
||||||
const QString loadSavedConfigSetting(KSharedConfig::Ptr &config, const QString &fileName, const QString &group, const QString &key, bool write = true);
|
const QString loadSavedConfigSetting(KSharedConfig::Ptr &config, const QString &fileName, const QString &group, const QString &key, bool write = true);
|
||||||
|
|
@ -47,7 +43,6 @@ private:
|
||||||
KSharedConfig::Ptr m_appBlacklistConfig;
|
KSharedConfig::Ptr m_appBlacklistConfig;
|
||||||
KSharedConfig::Ptr m_kdeglobalsConfig;
|
KSharedConfig::Ptr m_kdeglobalsConfig;
|
||||||
KSharedConfig::Ptr m_ksmServerConfig;
|
KSharedConfig::Ptr m_ksmServerConfig;
|
||||||
KSharedConfig::Ptr m_kwinrulesrcConfig;
|
|
||||||
|
|
||||||
KConfigWatcher::Ptr m_configWatcher;
|
KConfigWatcher::Ptr m_configWatcher;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@ import QtQuick
|
||||||
import org.kde.kwin as KWinComponents
|
import org.kde.kwin as KWinComponents
|
||||||
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
|
|
||||||
// This script ensures that windows stay maximized in the shell.
|
|
||||||
//
|
|
||||||
// We eventually want to replace this with the window rules implementation,
|
|
||||||
// but it seems that window maximize rules still don't work for all cases just yet
|
|
||||||
// (ex. unmaximizing fullscreen window)
|
|
||||||
Loader {
|
Loader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
|
@ -28,26 +23,29 @@ Loader {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellSettings.Settings.convergenceModeEnabled) {
|
if (ShellSettings.Settings.convergenceModeEnabled) {
|
||||||
return;
|
window.noBorder = false;
|
||||||
}
|
} else {
|
||||||
|
if (!window.fullScreen) {
|
||||||
|
const output = window.output;
|
||||||
|
const desktop = window.desktops[0]; // assume it's the first desktop that the window is on
|
||||||
|
if (desktop === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const maximizeRect = KWinComponents.Workspace.clientArea(KWinComponents.Workspace.MaximizeArea, output, desktop);
|
||||||
|
|
||||||
if (!window.fullScreen) {
|
// set the window to the maximized size and position instantly, avoiding race condition
|
||||||
const output = window.output;
|
// between maximizing and window decorations being turned off (changing window height)
|
||||||
const desktop = window.desktops[0]; // assume it's the first desktop that the window is on
|
// see: https://invent.kde.org/teams/plasma-mobile/issues/-/issues/256
|
||||||
if (desktop === undefined) {
|
window.frameGeometry = maximizeRect;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const maximizeRect = KWinComponents.Workspace.clientArea(KWinComponents.Workspace.MaximizeArea, output, desktop);
|
|
||||||
|
|
||||||
// set the window to the maximized size and position instantly, avoiding race condition
|
// turn off window decorations
|
||||||
// between maximizing and window decorations being turned off (changing window height)
|
window.noBorder = true;
|
||||||
// see: https://invent.kde.org/teams/plasma-mobile/issues/-/issues/256
|
|
||||||
window.frameGeometry = maximizeRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window.fullScreen) {
|
if (!window.fullScreen) {
|
||||||
// run maximize after to ensure the state is maximized
|
// run maximize after to ensure the state is maximized
|
||||||
window.setMaximize(true, true);
|
window.setMaximize(true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue