diff --git a/applets/taskmanager/package/contents/code/layout.js b/applets/taskmanager/package/contents/code/layout.js --- a/applets/taskmanager/package/contents/code/layout.js +++ b/applets/taskmanager/package/contents/code/layout.js @@ -191,7 +191,7 @@ adjustedWidth = width; - if (!tasks.vertical && !tasks.iconsOnly) { + if (!tasks.vertical && !tasks.iconsOnly && (plasmoid.configuration.separateLaunchers || stripes == 1)) { if (item.isLauncher) { adjustedWidth = launcherWidth(); } else if (stripes > 1 && i == tasksModel.launcherCount) { diff --git a/applets/taskmanager/package/contents/config/main.xml b/applets/taskmanager/package/contents/config/main.xml --- a/applets/taskmanager/package/contents/config/main.xml +++ b/applets/taskmanager/package/contents/config/main.xml @@ -36,6 +36,9 @@ 2 + + true + 2 1 diff --git a/applets/taskmanager/package/contents/ui/ConfigGeneral.qml b/applets/taskmanager/package/contents/ui/ConfigGeneral.qml --- a/applets/taskmanager/package/contents/ui/ConfigGeneral.qml +++ b/applets/taskmanager/package/contents/ui/ConfigGeneral.qml @@ -40,6 +40,7 @@ property alias cfg_groupPopups: groupPopups.checked property alias cfg_onlyGroupWhenFull: onlyGroupWhenFull.checked property alias cfg_sortingStrategy: sortingStrategy.currentIndex + property alias cfg_separateLaunchers: separateLaunchers.checked property alias cfg_showOnlyCurrentScreen: showOnlyCurrentScreen.checked property alias cfg_showOnlyCurrentDesktop: showOnlyCurrentDesktop.checked property alias cfg_showOnlyCurrentActivity: showOnlyCurrentActivity.checked @@ -142,27 +143,35 @@ model: [i18n("Do Not Sort"), i18n("Manually"), i18n("Alphabetically"), i18n("By Desktop"), i18n("By Activity")] } + CheckBox { + id: separateLaunchers + Layout.column: 1 + Layout.row: 1 + Layout.columnSpan: 2 + text: i18n("Keep launchers separate") + enabled: sortingStrategy.currentIndex == 1 + } Label { Layout.fillWidth: true - Layout.row: 1 + Layout.row: 2 Layout.column: 0 text: i18n("Grouping:") horizontalAlignment: Text.AlignRight } ComboBox { id: groupingStrategy - Layout.row: 1 + Layout.row: 2 Layout.column: 1 Layout.fillWidth: true model: [i18n("Do Not Group"), i18n("By Program Name")] } CheckBox { id: groupPopups Layout.column: 1 - Layout.row: 2 + Layout.row: 3 Layout.columnSpan: 2 text: i18n("Open groups in popups") enabled: groupingStrategy.currentIndex > 0 @@ -173,7 +182,7 @@ height: childrenRect.height Layout.column: 1 - Layout.row: 3 + Layout.row: 4 Layout.columnSpan: 2 CheckBox { diff --git a/applets/taskmanager/package/contents/ui/MouseHandler.qml b/applets/taskmanager/package/contents/ui/MouseHandler.qml --- a/applets/taskmanager/package/contents/ui/MouseHandler.qml +++ b/applets/taskmanager/package/contents/ui/MouseHandler.qml @@ -30,6 +30,30 @@ signal urlDropped(url url) property Item target + property Item ignoredItem + property bool moved: false + + Timer { + id: ignoreItemTimer + + repeat: false + interval: 750 + + onTriggered: { + ignoredItem = null; + } + } + + Connections { + target: tasks + + onDragSourceChanged: { + if (!dragSource) { + ignoredItem = null; + ignoreItemTimer.stop(); + } + } + } DropArea { id: dropHandler @@ -47,11 +71,30 @@ var above = target.childAt(event.x, event.y); + // If we're mixing launcher tasks with other tasks and are moving + // a (small) launcher task across a non-launcher task, don't allow + // the latter to be the move target twice in a row for a while, as + // it will naturally be moved underneath the cursor as result of the + // initial move, due to being far larger than the launcher delegate. + // TODO: This restriction (minus the timer, which improves things) + // has been proven out in the EITM fork, but could be improved later + // by tracking the cursor movement vector and allowing the drag if + // the movement direction has reversed, etablishing user intent to + // move back. + if (!plasmoid.configuration.separateLaunchers && tasks.dragSource.isLauncher + && above != null && !above.isLauncher && above == ignoredItem) { + return; + } else { + ignoredItem = null; + } + if (tasksModel.sortMode == TaskManager.TasksModel.SortManual && tasks.dragSource) { var insertAt = TaskTools.insertIndexAt(above, event.x, event.y); if (!groupDialog.visible && tasks.dragSource != above && tasks.dragSource.itemIndex != insertAt) { tasksModel.move(tasks.dragSource.itemIndex, insertAt); + ignoredItem = above; + ignoreItemTimer.restart(); } } else if (!tasks.dragSource && above && hoveredItem != above) { hoveredItem = above; diff --git a/applets/taskmanager/package/contents/ui/Task.qml b/applets/taskmanager/package/contents/ui/Task.qml --- a/applets/taskmanager/package/contents/ui/Task.qml +++ b/applets/taskmanager/package/contents/ui/Task.qml @@ -104,7 +104,14 @@ } onItemIndexChanged: { - if (!inPopup && !tasks.vertical && LayoutManager.calculateStripes() > 1) { + if (!inPopup && !tasks.vertical + && (LayoutManager.calculateStripes() > 1 || !plasmoid.configuration.separateLaunchers)) { + tasks.requestLayout(); + } + } + + onIsLauncherChanged: { + if (!plasmoid.configuration.separateLaunchers) { tasks.requestLayout(); } } diff --git a/applets/taskmanager/package/contents/ui/main.qml b/applets/taskmanager/package/contents/ui/main.qml --- a/applets/taskmanager/package/contents/ui/main.qml +++ b/applets/taskmanager/package/contents/ui/main.qml @@ -94,6 +94,8 @@ sortMode: iconsOnly ? TaskManager.TasksModel.SortManual : sortModeEnumValue(plasmoid.configuration.sortingStrategy) launchInPlace: iconsOnly + separateLaunchers: (!iconsOnly + && plasmoid.configuration.sortingStrategy.currentIndex != 1 && plasmoid.configuration.separateLaunchers) groupMode: iconsOnly ? TaskManager.TasksModel.GroupApplication : sortModeEnumValue(plasmoid.configuration.groupingStrategy)