improvements for global shortcuts based on position

BUG: 403880
pull/4/head
Michail Vourlakos 6 years ago
parent cf93b7516d
commit c1bcd5c5ca

@ -372,22 +372,25 @@ void GlobalShortcuts::activateEntry(int index, Qt::Key modifier)
QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentLatteViews()); QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentLatteViews());
if (m_shortcutsTracker->basedOnPositionEnabled()){ foreach (auto view, sortedViews) {
foreach (auto view, sortedViews) { if (!view->isPreferredForShortcuts()) {
if ((!view->latteTasksPresent() && view->tasksPresent() && continue;
activatePlasmaTaskManagerEntryAtContainment(view->containment(), index, modifier)) }
|| activateLatteEntryAtContainment(view, index, modifier)) {
if (!m_hideViews.contains(view)) { if ((!view->latteTasksPresent() && view->tasksPresent() &&
m_hideViews.append(view); activatePlasmaTaskManagerEntryAtContainment(view->containment(), index, modifier))
} || activateLatteEntryAtContainment(view, index, modifier)) {
view->visibility()->setBlockHiding(true); if (!m_hideViews.contains(view)) {
m_hideViewsTimer.start(); m_hideViews.append(view);
return;
} }
view->visibility()->setBlockHiding(true);
m_hideViewsTimer.start();
return;
} }
} }
} }
//! update badge for specific view item //! update badge for specific view item
@ -593,12 +596,10 @@ void GlobalShortcuts::showViews()
Latte::View *viewWithTasks{nullptr}; Latte::View *viewWithTasks{nullptr};
Latte::View *viewWithMeta{nullptr}; Latte::View *viewWithMeta{nullptr};
if (m_shortcutsTracker->basedOnPositionEnabled()) { foreach (auto view, sortedViews) {
foreach (auto view, sortedViews) { if (!viewWithTasks && view->isPreferredForShortcuts() && isCapableToShowShortcutBadges(view)) {
if (!viewWithTasks && isCapableToShowShortcutBadges(view)) { viewWithTasks = view;
viewWithTasks = view; break;
break;
}
} }
} }

@ -541,6 +541,19 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Activate based on position through global shortcuts")
checked: latteView.isPreferredForShortcuts
//enabled: shortcutsEngine.basedOnPositionEnabled
tooltip: i18n("This view is used for based on position global shortcuts. Take note that only one view can have that option enabled for each layout")
onClicked: {
latteView.isPreferredForShortcuts = checked
}
}
PlasmaComponents.CheckBox { PlasmaComponents.CheckBox {
Layout.leftMargin: units.smallSpacing * 2 Layout.leftMargin: units.smallSpacing * 2
text: i18n("Decrease size automatically when needed") text: i18n("Decrease size automatically when needed")
@ -576,19 +589,6 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Prefer for based on position global shortcuts")
checked: latteView.isPreferredForShortcuts
enabled: shortcutsEngine.basedOnPositionEnabled
tooltip: i18n("This view is preferred to use the based on position global shortcuts. Take note that only one view can have that option enabled for each layout")
onClicked: {
latteView.isPreferredForShortcuts = checked
}
}
PlasmaComponents.CheckBox { PlasmaComponents.CheckBox {
Layout.leftMargin: units.smallSpacing * 2 Layout.leftMargin: units.smallSpacing * 2
text: i18n("Can be above fullscreen windows") text: i18n("Can be above fullscreen windows")

@ -172,7 +172,7 @@ PlasmaComponents.Page {
checked: !plasmoid.configuration.unifiedGlobalShortcuts checked: !plasmoid.configuration.unifiedGlobalShortcuts
tooltip: i18n("Based on position global shortcuts are enabled only for tasks and not for applets") tooltip: i18n("Based on position global shortcuts are enabled only for tasks and not for applets")
visible: dialog.highLevel visible: dialog.highLevel
enabled: shortcutsEngine.basedOnPositionEnabled enabled: latteView.isPreferredForShortcuts
onClicked: { onClicked: {
plasmoid.configuration.unifiedGlobalShortcuts = !checked plasmoid.configuration.unifiedGlobalShortcuts = !checked

Loading…
Cancel
Save