setup unified global shortcuts per dock

--in multiple layouts environment the user
may prefer different settings for its global
shortcuts, in some may wants to use global
shortcuts for its applets and in another
layout may not.
pull/2/head
Michail Vourlakos 7 years ago
parent 6708510213
commit d4cb4e2410

@ -48,7 +48,6 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent)
connect(this, &UniversalSettings::mouseSensitivityChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::screenTrackerIntervalChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::showInfoWindowChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::unifiedGlobalShortcutsChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::versionChanged, this, &UniversalSettings::saveConfig);
m_metaForwardedToLatte = kwin_metaForwardedToLatte();
@ -92,21 +91,6 @@ void UniversalSettings::setShowInfoWindow(bool show)
emit showInfoWindowChanged();
}
bool UniversalSettings::unifiedGlobalShortcuts() const
{
return m_unifiedGlobalShortcuts;
}
void UniversalSettings::setUnifiedGlobalShortcuts(bool unified)
{
if (m_unifiedGlobalShortcuts == unified) {
return;
}
m_unifiedGlobalShortcuts = unified;
emit unifiedGlobalShortcutsChanged();
}
int UniversalSettings::version() const
{
return m_version;
@ -343,7 +327,6 @@ void UniversalSettings::loadConfig()
m_launchers = m_universalGroup.readEntry("launchers", QStringList());
m_screenTrackerInterval = m_universalGroup.readEntry("screenTrackerInterval", 2500);
m_showInfoWindow = m_universalGroup.readEntry("showInfoWindow", true);
m_unifiedGlobalShortcuts = m_universalGroup.readEntry("unifiedGlobalShortcuts", true);
m_memoryUsage = static_cast<Dock::LayoutsMemoryUsage>(m_universalGroup.readEntry("memoryUsage", (int)Dock::SingleLayout));
m_mouseSensitivity = static_cast<Dock::MouseSensitivity>(m_universalGroup.readEntry("mouseSensitivity", (int)Dock::HighSensitivity));
}
@ -360,7 +343,6 @@ void UniversalSettings::saveConfig()
m_universalGroup.writeEntry("launchers", m_launchers);
m_universalGroup.writeEntry("screenTrackerInterval", m_screenTrackerInterval);
m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow);
m_universalGroup.writeEntry("unifiedGlobalShortcuts", m_unifiedGlobalShortcuts);
m_universalGroup.writeEntry("memoryUsage", (int)m_memoryUsage);
m_universalGroup.writeEntry("mouseSensitivity", (int)m_mouseSensitivity);

@ -42,11 +42,6 @@ class UniversalSettings : public QObject
Q_OBJECT
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged)
//! some v0.7 users wanted the previous global shortcuts behavior that applets werent taken
//! into account. By default unification will take place but the user will be able to change
//! this from latte global settings
Q_PROPERTY(bool unifiedGlobalShortcuts READ unifiedGlobalShortcuts NOTIFY unifiedGlobalShortcutsChanged)
Q_PROPERTY(QString currentLayoutName READ currentLayoutName WRITE setCurrentLayoutName NOTIFY currentLayoutNameChanged)
Q_PROPERTY(QStringList launchers READ launchers WRITE setLaunchers NOTIFY launchersChanged)
@ -71,8 +66,6 @@ public:
bool showInfoWindow() const;
void setShowInfoWindow(bool show);
bool unifiedGlobalShortcuts() const;
int version() const;
void setVersion(int ver);
@ -125,7 +118,6 @@ signals:
void runningActivitiesModelChanged();
void screenTrackerIntervalChanged();
void showInfoWindowChanged();
void unifiedGlobalShortcutsChanged();
void versionChanged();
private slots:
@ -137,8 +129,6 @@ private:
void cleanupSettings();
void setUnifiedGlobalShortcuts(bool unified);
bool kwin_metaForwardedToLatte() const;
Dock::LayoutsMemoryUsage layoutsMemoryUsage() const;
@ -148,7 +138,6 @@ private:
bool m_canDisableBorders{false};
bool m_metaForwardedToLatte{false};
bool m_showInfoWindow{true};
bool m_unifiedGlobalShortcuts{true};
//when there isnt a version it is an old universal file
int m_version{1};

@ -253,5 +253,9 @@
<entry name="mouseWheelActions" type="Bool">
<default>true</default>
</entry>
<entry name="unifiedGlobalShortcuts" type="Bool">
<default>true</default>
<label>Global Shortcuts are combined between applets and tasks</label>
</entry>
</group>
</kcfg>

@ -438,7 +438,7 @@ Item {
onSignalActivateEntryAtIndex: {
if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && container.isLattePlasmoid) {
latteApplet.activateTaskAtIndex(entryIndex - latteApplet.tasksNumbersBase);
} else if (universalSettings.unifiedGlobalShortcuts && (entryIndex === parabolicManager.pseudoAppletIndex(container.index))) {
} else if (root.unifiedGlobalShortcuts && (entryIndex === parabolicManager.pseudoAppletIndex(container.index))) {
dock.toggleAppletExpanded(applet.id);
}
}
@ -446,7 +446,7 @@ Item {
onSignalNewInstanceForEntryAtIndex: {
if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && container.isLattePlasmoid) {
latteApplet.newInstanceForTaskAtIndex(entryIndex - latteApplet.tasksNumbersBase);
} else if (universalSettings.unifiedGlobalShortcuts && (entryIndex === parabolicManager.pseudoAppletIndex(container.index))) {
} else if (root.unifiedGlobalShortcuts && (entryIndex === parabolicManager.pseudoAppletIndex(container.index))) {
dock.toggleAppletExpanded(applet.id);
}
}

@ -607,8 +607,8 @@ Item{
Component.onCompleted: fixedIndex = parabolicManager.pseudoAppletIndex(index);
property real opacityN: universalSettings && container.canShowAppletNumberBadge &&
((universalSettings.unifiedGlobalShortcuts && root.showAppletsNumbers && fixedIndex<20)
property real opacityN: container.canShowAppletNumberBadge &&
((root.unifiedGlobalShortcuts && root.showAppletsNumbers && fixedIndex<20)
|| (root.showMetaBadge && applet.id===applicationLauncherId)) ? 1 : 0
Behavior on opacityN {

@ -338,6 +338,7 @@ DragDrop.DropArea {
property bool smartLaunchersEnabled: plasmoid.configuration.smartLaunchersEnabled
property bool threeColorsWindows: plasmoid.configuration.threeColorsWindows
property bool titleTooltips: plasmoid.configuration.titleTooltips
property bool unifiedGlobalShortcuts: plasmoid.configuration.unifiedGlobalShortcuts
readonly property bool hasInternalSeparator: latteApplet ? latteApplet.hasInternalSeparator : false
@ -1094,7 +1095,7 @@ DragDrop.DropArea {
//! this is called from globalshortcuts c++ side
function setShowAppletsNumbers(showNumbers, showMeta, applicationLauncher){
if (latteApplet) {
var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
var base = unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
latteApplet.setTasksNumbersBase(base - 1);
latteApplet.setShowTasksNumbers(showNumbers);
}
@ -1111,7 +1112,7 @@ DragDrop.DropArea {
}
if (latteApplet) {
var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
var base = unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
latteApplet.setTasksNumbersBase(base - 1);
}
@ -1125,7 +1126,7 @@ DragDrop.DropArea {
}
if (latteApplet) {
var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
var base = unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
latteApplet.setTasksNumbersBase(base - 1);
}

@ -168,6 +168,19 @@ PlasmaComponents.Page {
}
}
PlasmaComponents.CheckBox {
id: unifyGlobalShortcutsChk
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Unify global shortcuts with applets")
checked: plasmoid.configuration.unifiedGlobalShortcuts
tooltip: i18n("Global shortcuts are used both from applets and tasks")
visible: plasmoid.configuration.advanced
onClicked: {
plasmoid.configuration.unifiedGlobalShortcuts = checked
}
}
PlasmaComponents.CheckBox {
id: mouseWheelChk
Layout.leftMargin: units.smallSpacing * 2

Loading…
Cancel
Save