mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-28 18:50:40 +03:00
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.
This commit is contained in:
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::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);
|
||||
}
|
||||
|
||||
@ -86,6 +87,21 @@ 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;
|
||||
@ -304,6 +320,7 @@ 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));
|
||||
}
|
||||
@ -320,6 +337,7 @@ 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,6 +42,10 @@ 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)
|
||||
|
||||
@ -65,6 +69,8 @@ public:
|
||||
bool showInfoWindow() const;
|
||||
void setShowInfoWindow(bool show);
|
||||
|
||||
bool unifiedGlobalShortcuts() const;
|
||||
|
||||
int version() const;
|
||||
void setVersion(int ver);
|
||||
|
||||
@ -117,6 +123,7 @@ signals:
|
||||
void runningActivitiesModelChanged();
|
||||
void screenTrackerIntervalChanged();
|
||||
void showInfoWindowChanged();
|
||||
void unifiedGlobalShortcutsChanged();
|
||||
void versionChanged();
|
||||
|
||||
private slots:
|
||||
@ -126,12 +133,15 @@ private slots:
|
||||
private:
|
||||
void cleanupSettings();
|
||||
|
||||
void setUnifiedGlobalShortcuts(bool unified);
|
||||
|
||||
Dock::LayoutsMemoryUsage layoutsMemoryUsage() const;
|
||||
void setLayoutsMemoryUsage(Dock::LayoutsMemoryUsage layoutsMemoryUsage);
|
||||
|
||||
private:
|
||||
bool m_canDisableBorders{false};
|
||||
bool m_showInfoWindow{true};
|
||||
bool m_unifiedGlobalShortcuts{true};
|
||||
|
||||
//when there isnt a version it is an old universal file
|
||||
int m_version{1};
|
||||
|
@ -438,7 +438,7 @@ Item {
|
||||
onSignalActivateEntryAtIndex: {
|
||||
if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && container.isLattePlasmoid) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -446,7 +446,7 @@ Item {
|
||||
onSignalNewInstanceForEntryAtIndex: {
|
||||
if (parabolicManager.pseudoIndexBelongsToLatteApplet(entryIndex) && container.isLattePlasmoid) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -607,7 +607,8 @@ Item{
|
||||
|
||||
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 {
|
||||
NumberAnimation { duration: root.durationTime*2*units.longDuration }
|
||||
|
@ -1090,7 +1090,7 @@ DragDrop.DropArea {
|
||||
//! this is called from globalshortcuts c++ side
|
||||
function setShowAppletsNumbers(showNumbers){
|
||||
if (latteApplet) {
|
||||
var base = parabolicManager.pseudoAppletIndex(latteAppletPos);
|
||||
var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
|
||||
latteApplet.setTasksNumbersBase(base - 1);
|
||||
latteApplet.setShowTasksNumbers(showNumbers);
|
||||
}
|
||||
@ -1105,7 +1105,7 @@ DragDrop.DropArea {
|
||||
}
|
||||
|
||||
if (latteApplet) {
|
||||
var base = parabolicManager.pseudoAppletIndex(latteAppletPos);
|
||||
var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
|
||||
latteApplet.setTasksNumbersBase(base - 1);
|
||||
}
|
||||
|
||||
@ -1119,7 +1119,7 @@ DragDrop.DropArea {
|
||||
}
|
||||
|
||||
if (latteApplet) {
|
||||
var base = parabolicManager.pseudoAppletIndex(latteAppletPos);
|
||||
var base = universalSettings.unifiedGlobalShortcuts ? parabolicManager.pseudoAppletIndex(latteAppletPos) : 1;
|
||||
latteApplet.setTasksNumbersBase(base - 1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user