support no-unified global shortcuts

--v0.8 introduced unified global shortcuts for all
cases, that means that applets are also taken into
account for Latte activation/new instance global
shortcuts. A new parameter is introduced with
the patch at Latte global settings file called
"unifiedGlobalShortcuts", the user can set that
parameter to false before Latte startup in order
to use only global shortcuts relevant to the
Latte plasmoid.
v0.8
Michail Vourlakos 7 years ago
parent 0cf3452a6c
commit 5803366cb3

@ -45,6 +45,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent)
connect(this, &UniversalSettings::mouseSensitivityChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::mouseSensitivityChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::screenTrackerIntervalChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::screenTrackerIntervalChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::showInfoWindowChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::showInfoWindowChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::unifiedGlobalShortcutsChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::versionChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::versionChanged, this, &UniversalSettings::saveConfig);
} }
@ -86,6 +87,21 @@ void UniversalSettings::setShowInfoWindow(bool show)
emit showInfoWindowChanged(); 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 int UniversalSettings::version() const
{ {
return m_version; return m_version;
@ -304,6 +320,7 @@ void UniversalSettings::loadConfig()
m_launchers = m_universalGroup.readEntry("launchers", QStringList()); m_launchers = m_universalGroup.readEntry("launchers", QStringList());
m_screenTrackerInterval = m_universalGroup.readEntry("screenTrackerInterval", 2500); m_screenTrackerInterval = m_universalGroup.readEntry("screenTrackerInterval", 2500);
m_showInfoWindow = m_universalGroup.readEntry("showInfoWindow", true); 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_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)); m_mouseSensitivity = static_cast<Dock::MouseSensitivity>(m_universalGroup.readEntry("mouseSensitivity", (int)Dock::HighSensitivity));
} }
@ -320,6 +337,7 @@ void UniversalSettings::saveConfig()
m_universalGroup.writeEntry("launchers", m_launchers); m_universalGroup.writeEntry("launchers", m_launchers);
m_universalGroup.writeEntry("screenTrackerInterval", m_screenTrackerInterval); m_universalGroup.writeEntry("screenTrackerInterval", m_screenTrackerInterval);
m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow); m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow);
m_universalGroup.writeEntry("unifiedGlobalShortcuts", m_unifiedGlobalShortcuts);
m_universalGroup.writeEntry("memoryUsage", (int)m_memoryUsage); m_universalGroup.writeEntry("memoryUsage", (int)m_memoryUsage);
m_universalGroup.writeEntry("mouseSensitivity", (int)m_mouseSensitivity); m_universalGroup.writeEntry("mouseSensitivity", (int)m_mouseSensitivity);

@ -42,6 +42,10 @@ class UniversalSettings : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged) Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged) 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(QString currentLayoutName READ currentLayoutName WRITE setCurrentLayoutName NOTIFY currentLayoutNameChanged)
@ -65,6 +69,8 @@ public:
bool showInfoWindow() const; bool showInfoWindow() const;
void setShowInfoWindow(bool show); void setShowInfoWindow(bool show);
bool unifiedGlobalShortcuts() const;
int version() const; int version() const;
void setVersion(int ver); void setVersion(int ver);
@ -117,6 +123,7 @@ signals:
void runningActivitiesModelChanged(); void runningActivitiesModelChanged();
void screenTrackerIntervalChanged(); void screenTrackerIntervalChanged();
void showInfoWindowChanged(); void showInfoWindowChanged();
void unifiedGlobalShortcutsChanged();
void versionChanged(); void versionChanged();
private slots: private slots:
@ -126,12 +133,15 @@ private slots:
private: private:
void cleanupSettings(); void cleanupSettings();
void setUnifiedGlobalShortcuts(bool unified);
Dock::LayoutsMemoryUsage layoutsMemoryUsage() const; Dock::LayoutsMemoryUsage layoutsMemoryUsage() const;
void setLayoutsMemoryUsage(Dock::LayoutsMemoryUsage layoutsMemoryUsage); void setLayoutsMemoryUsage(Dock::LayoutsMemoryUsage layoutsMemoryUsage);
private: private:
bool m_canDisableBorders{false}; bool m_canDisableBorders{false};
bool m_showInfoWindow{true}; bool m_showInfoWindow{true};
bool m_unifiedGlobalShortcuts{true};
//when there isnt a version it is an old universal file //when there isnt a version it is an old universal file
int m_version{1}; int m_version{1};

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

@ -607,7 +607,8 @@ Item{
Component.onCompleted: fixedIndex = parabolicManager.pseudoAppletIndex(index); Component.onCompleted: fixedIndex = parabolicManager.pseudoAppletIndex(index);
property real opacityN: root.showAppletsNumbers && container.canShowAppletNumberBadge && fixedIndex<20 ? 1 : 0 property real opacityN: universalSettings && universalSettings.unifiedGlobalShortcuts && root.showAppletsNumbers
&& container.canShowAppletNumberBadge && fixedIndex<20 ? 1 : 0
Behavior on opacityN { Behavior on opacityN {
NumberAnimation { duration: root.durationTime*2*units.longDuration } NumberAnimation { duration: root.durationTime*2*units.longDuration }

@ -1090,7 +1090,7 @@ DragDrop.DropArea {
//! this is called from globalshortcuts c++ side //! this is called from globalshortcuts c++ side
function setShowAppletsNumbers(showNumbers){ function setShowAppletsNumbers(showNumbers){
if (latteApplet) { if (latteApplet) {
var base = parabolicManager.pseudoAppletIndex(latteAppletPos); var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
latteApplet.setTasksNumbersBase(base - 1); latteApplet.setTasksNumbersBase(base - 1);
latteApplet.setShowTasksNumbers(showNumbers); latteApplet.setShowTasksNumbers(showNumbers);
} }
@ -1105,7 +1105,7 @@ DragDrop.DropArea {
} }
if (latteApplet) { if (latteApplet) {
var base = parabolicManager.pseudoAppletIndex(latteAppletPos); var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
latteApplet.setTasksNumbersBase(base - 1); latteApplet.setTasksNumbersBase(base - 1);
} }
@ -1119,7 +1119,7 @@ DragDrop.DropArea {
} }
if (latteApplet) { if (latteApplet) {
var base = parabolicManager.pseudoAppletIndex(latteAppletPos); var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
latteApplet.setTasksNumbersBase(base - 1); latteApplet.setTasksNumbersBase(base - 1);
} }

Loading…
Cancel
Save