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());
if (m_shortcutsTracker->basedOnPositionEnabled()){
foreach (auto view, sortedViews) {
if ((!view->latteTasksPresent() && view->tasksPresent() &&
activatePlasmaTaskManagerEntryAtContainment(view->containment(), index, modifier))
|| activateLatteEntryAtContainment(view, index, modifier)) {
foreach (auto view, sortedViews) {
if (!view->isPreferredForShortcuts()) {
continue;
}
if (!m_hideViews.contains(view)) {
m_hideViews.append(view);
}
if ((!view->latteTasksPresent() && view->tasksPresent() &&
activatePlasmaTaskManagerEntryAtContainment(view->containment(), index, modifier))
|| activateLatteEntryAtContainment(view, index, modifier)) {
view->visibility()->setBlockHiding(true);
m_hideViewsTimer.start();
return;
if (!m_hideViews.contains(view)) {
m_hideViews.append(view);
}
view->visibility()->setBlockHiding(true);
m_hideViewsTimer.start();
return;
}
}
}
//! update badge for specific view item
@ -593,12 +596,10 @@ void GlobalShortcuts::showViews()
Latte::View *viewWithTasks{nullptr};
Latte::View *viewWithMeta{nullptr};
if (m_shortcutsTracker->basedOnPositionEnabled()) {
foreach (auto view, sortedViews) {
if (!viewWithTasks && isCapableToShowShortcutBadges(view)) {
viewWithTasks = view;
break;
}
foreach (auto view, sortedViews) {
if (!viewWithTasks && view->isPreferredForShortcuts() && isCapableToShowShortcutBadges(view)) {
viewWithTasks = view;
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 {
Layout.leftMargin: units.smallSpacing * 2
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 {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Can be above fullscreen windows")

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

Loading…
Cancel
Save