diff --git a/containment/package/contents/config/main.xml b/containment/package/contents/config/main.xml index eca9e78c1..dc53cc553 100644 --- a/containment/package/contents/config/main.xml +++ b/containment/package/contents/config/main.xml @@ -227,6 +227,10 @@ false + + false + + false diff --git a/containment/package/contents/ui/ParabolicManager.qml b/containment/package/contents/ui/ParabolicManager.qml index 59a27630c..280fddaaf 100644 --- a/containment/package/contents/ui/ParabolicManager.qml +++ b/containment/package/contents/ui/ParabolicManager.qml @@ -48,7 +48,8 @@ Item { var taskIndex = -1; var internSepStep = 0; if(appIndexroot.latteAppletPos){ - if (root.latteApplet.parabolicManager.taskIsSeparator(root.tasksCount-1)) + if (root.latteApplet.parabolicManager.taskIsSeparator(root.tasksCount-1) + || (!root.showWindowsWithNoLaunchers && root.latteApplet.parabolicManager.taskIsHiddenBecauseNoLauncherExists(root.tasksCount-1)) ) internSepStep = Math.abs(root.tasksCount-1 - root.latteApplet.parabolicManager.availableLowerIndex(root.tasksCount-1)); taskIndex = root.tasksCount-1 - (signalStep-appStep) - internSepStep; diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 5f5a4565a..1c083d917 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -278,7 +278,8 @@ DragDrop.DropArea { //! for that value between 0.04 - 0.5 of iconSize, this way 100% iconMargin means //! equal to the iconSize property int iconMargin: Math.ceil( ((0.5 * (plasmoid.configuration.iconMargin))/100) * iconSize) - property int statesLineSize: latteApplet || (activeIndicator !== Latte.Dock.NoneIndicator) ? Math.ceil( root.iconSize/13 ) : 0 + property int statesLineSize: (latteApplet && !(root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator)) + || (activeIndicator !== Latte.Dock.NoneIndicator) ? Math.ceil( root.iconSize/13 ) : 0 ///FIXME: I can't remember why this is needed, maybe for the anchorings!!! In order for the Double Layout to not mess the anchorings... @@ -322,6 +323,7 @@ DragDrop.DropArea { property bool glow3D: plasmoid.configuration.glow3D property bool showToolTips: plasmoid.configuration.showToolTips property bool showWindowActions: plasmoid.configuration.showWindowActions + property bool showWindowsOnlyFromLaunchers: plasmoid.configuration.showWindowsOnlyFromLaunchers property bool showOnlyCurrentScreen: plasmoid.configuration.showOnlyCurrentScreen property bool showOnlyCurrentDesktop: plasmoid.configuration.showOnlyCurrentDesktop property bool showOnlyCurrentActivity: plasmoid.configuration.showOnlyCurrentActivity diff --git a/plasmoid/package/contents/ui/ContextMenu.qml b/plasmoid/package/contents/ui/ContextMenu.qml index 7ac2d93f8..d27ee799a 100644 --- a/plasmoid/package/contents/ui/ContextMenu.qml +++ b/plasmoid/package/contents/ui/ContextMenu.qml @@ -636,6 +636,7 @@ PlasmaComponents.ContextMenu { } else { root.launcherForRemoval = launcher; tasksModel.requestRemoveLauncher(launcher); + root.launchersUpdatedFor(launcher); } } else { @@ -645,6 +646,7 @@ PlasmaComponents.ContextMenu { latteDock.launchersGroup, launcher); } else { tasksModel.requestAddLauncher(launcher); + root.launchersUpdatedFor(launcher); } } } @@ -696,6 +698,7 @@ PlasmaComponents.ContextMenu { } tasksModel.requestAddLauncherToActivity(url, id); + root.launchersUpdatedFor(url); } } else { if (latteDock && latteDock.launchersGroup >= Latte.Dock.LayoutLaunchers) { @@ -706,6 +709,7 @@ PlasmaComponents.ContextMenu { root.launcherForRemoval = url; } tasksModel.requestRemoveLauncherFromActivity(url, id); + root.launchersUpdatedFor(url); } } } @@ -761,6 +765,7 @@ PlasmaComponents.ContextMenu { } else { root.launcherForRemoval = launcher tasksModel.requestRemoveLauncher(launcher); + root.launchersUpdatedFor(launcher); } } } @@ -803,6 +808,7 @@ PlasmaComponents.ContextMenu { } else { root.launcherForRemoval = launcher; tasksModel.requestRemoveLauncher(launcher); + root.launchersUpdatedFor(launcher); } } } diff --git a/plasmoid/package/contents/ui/ParabolicManager.qml b/plasmoid/package/contents/ui/ParabolicManager.qml index 1363abdea..5ca8d757d 100644 --- a/plasmoid/package/contents/ui/ParabolicManager.qml +++ b/plasmoid/package/contents/ui/ParabolicManager.qml @@ -368,7 +368,8 @@ Item { function availableLowerIndex(from) { var next = from; - while (next>=0 && taskIsSeparator(next)) + while (next>=0 + && (taskIsSeparator(next) || (root.showWindowsOnlyFromLaunchers && taskIsHiddenBecauseNoLauncherExists(next))) ) next = next - 1; return next; @@ -377,8 +378,10 @@ Item { function availableHigherIndex(from) { var next = from; - while (next<=root.tasksCount-1 && taskIsSeparator(next)) + while (next<=root.tasksCount-1 + && (taskIsSeparator(next) || (root.showWindowsOnlyFromLaunchers && taskIsHiddenBecauseNoLauncherExists(next))) ) { next = next + 1; + } return next; } @@ -402,6 +405,22 @@ Item { return false; } + function taskIsHiddenBecauseNoLauncherExists(taskIndex) { + var task = icList.childAtIndex(taskIndex); + + if (task && root.showWindowsOnlyFromLaunchers) { + var launcherExists = !(((tasksModel.launcherPosition(task.launcherUrl) == -1) + && (tasksModel.launcherPosition(task.launcherUrlWithIcon) == -1) ) + || !task.launcherIsPresent(task.launcherUrl)); + + //console.log(task.launcherUrl + " ::: " +!launcherExists + " _ " + task.isWindow); + + return (!launcherExists && task.isWindow); + } + + return false; + } + function separatorExists(separator){ return (tasksModel.launcherPosition(separator)>=0); } @@ -444,7 +463,7 @@ Item { return pseudoIndex + root.tasksNumbersBase; } - //! first available task index found after consequent internal separators in the start + //! first available task index found after consequent internal separators or hidden tasks in the start function firstRealTask() { if (hasInternalSeparator) { var i=0; @@ -463,11 +482,11 @@ Item { //! last available task index found after consequent internal separators in the end function lastRealTask() { - if (hasInternalSeparator) { - var i=root.tasksCount - 1; + if (hasInternalSeparator || root.showWindowsOnlyFromLaunchers) { + var i = tasksModel.count - 1; while (i>=0) { - if (!taskIsSeparator(i)) { + if (!taskIsSeparator(i) && !taskIsHiddenBecauseNoLauncherExists(i) ) { return i; } @@ -478,7 +497,7 @@ Item { return root.tasksCount > 0 ? root.tasksCount-1 : -1; } - //! the real number of tasks if we remove the internal separators + //! the real number of tasks if we remove the internal separators and hidden windows in the end function realTasks() { var space = lastRealTaskIndex - firstRealTaskIndex; diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index aad1a105e..79816679f 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -181,11 +181,13 @@ Item { property bool showOnlyCurrentActivity: latteDock ? latteDock.showOnlyCurrentActivity : plasmoid.configuration.showOnlyCurrentActivity property bool showPreviews: latteDock ? latteDock.showToolTips : plasmoid.configuration.showToolTips property bool showWindowActions: latteDock ? latteDock.showWindowActions : plasmoid.configuration.showWindowActions + property bool showWindowsOnlyFromLaunchers: latteDock ? latteDock.showWindowsOnlyFromLaunchers : false property bool smartLaunchersEnabled: latteDock ? latteDock.smartLaunchersEnabled : plasmoid.configuration.smartLaunchersEnabled property bool threeColorsWindows: latteDock ? latteDock.threeColorsWindows : plasmoid.configuration.threeColorsWindows property bool titleTooltips: latteDock ? latteDock.titleTooltips : false property alias windowPreviewIsShown: windowsPreviewDlg.visible + property int activeIndicator: latteDock ? latteDock.activeIndicator : Latte.Dock.AllIndicator property int activeIndicatorType: latteDock ? latteDock.activeIndicatorType : Latte.Dock.LineIndicator property int animationStep: latteDock ? latteDock.animationStep : 1 property int directRenderAnimationTime: latteDock ? latteDock.directRenderAnimationTime : 0 @@ -244,6 +246,7 @@ Item { signal clearZoomSignal(); signal draggingFinished(); + signal launchersUpdatedFor(string launcher); signal presentWindows(variant winIds); signal requestLayout; signal separatorsUpdated(); @@ -1499,6 +1502,7 @@ Item { function extSignalAddLauncher(group, launcher) { if (group === latteDock.launchersGroup) { tasksModel.requestAddLauncher(launcher); + launchersUpdatedFor(launcher); } } @@ -1506,6 +1510,7 @@ Item { if (group === latteDock.launchersGroup) { root.launcherForRemoval = launcher; tasksModel.requestRemoveLauncher(launcher); + launchersUpdatedFor(launcher); } } @@ -1518,6 +1523,7 @@ Item { } tasksModel.requestAddLauncherToActivity(launcher, activity); + launchersUpdatedFor(launcher); } } @@ -1528,6 +1534,7 @@ Item { } tasksModel.requestRemoveLauncherFromActivity(launcher, activity); + launchersUpdatedFor(launcher); } } @@ -1685,6 +1692,7 @@ Item { } tasksModel.requestAddLauncher(url); + launchersUpdatedFor(url); } function resetDragSource() { diff --git a/plasmoid/package/contents/ui/task/TaskDelegate.qml b/plasmoid/package/contents/ui/task/TaskDelegate.qml index 94f3f8722..12a27c262 100644 --- a/plasmoid/package/contents/ui/task/TaskDelegate.qml +++ b/plasmoid/package/contents/ui/task/TaskDelegate.qml @@ -221,6 +221,10 @@ MouseArea{ property int previousCount: 0 onWindowsCountChanged: { + if (root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator) { + return; + } + if ((windowsCount >= 2) && (windowsCount > previousCount) && !(mainItemContainer.containsMouse || parabolicManager.neighbourIsHovered(itemIndex)) ){ if(root.dragSource == null) @@ -333,6 +337,20 @@ MouseArea{ restoreAnimation.stop(); } } + + onShowWindowsOnlyFromLaunchersChanged: { + if (!root.editMode) { + return; + } + + mainItemContainer.updateVisibilityBasedOnLaunchers(); + } + + onInActivityChangeChanged: { + if (root.showWindowsOnlyFromLaunchers && !root.inActivityChange) { + mainItemContainer.updateVisibilityBasedOnLaunchers(); + } + } } Rectangle { @@ -876,7 +894,7 @@ MouseArea{ } function activateTask() { - if( mainItemContainer.isLauncher){ + if( mainItemContainer.isLauncher || (root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator)){ if (Latte.WindowSystem.compositingActive) { wrapper.runLauncherAnimation(); } else { @@ -990,10 +1008,16 @@ MouseArea{ // if ((lastButtonClicked == Qt.LeftButton)||(lastButtonClicked == Qt.MidButton)){ if (Latte.WindowSystem.compositingActive) { inBouncingAnimation = true; - root.addWaitingLauncher(mainItemContainer.launcherUrl); + if (!(root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator)) { + root.addWaitingLauncher(mainItemContainer.launcherUrl); + } + } + + if (root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator) { + tasksModel.requestNewInstance(modelIndex()); + } else { + tasksModel.requestActivate(modelIndex()); } - tasksModel.requestActivate(modelIndex()); - // } } ///window previews/// @@ -1197,6 +1221,34 @@ MouseArea{ } } + function slotLaunchersChangedFor(launcher) { + if (root.showWindowsOnlyFromLaunchers && launcher === launcherUrl) { + updateVisibilityBasedOnLaunchers() + } + } + + function updateVisibilityBasedOnLaunchers(){ + var launcherExists = !(((tasksModel.launcherPosition(mainItemContainer.launcherUrl) == -1) + && (tasksModel.launcherPosition(mainItemContainer.launcherUrlWithIcon) == -1) ) + || !launcherIsPresent(mainItemContainer.launcherUrl)); + + if (root.showWindowsOnlyFromLaunchers) { + var hideWindow = !launcherExists && mainItemContainer.isWindow; + + if (hideWindow) { + taskRealRemovalAnimation.start(); + } else if (launcherExists && mainItemContainer.isWindow && !mainItemContainer.isVisible) { + showWindowAnimation.showWindow(); + } + } else { + var showWindow = !launcherExists && mainItemContainer.isWindow; + + if (showWindow) { + showWindowAnimation.showWindow(); + } + } + } + function toggleMuted() { if (muted) { mainItemContainer.audioStreams.forEach(function (item) { item.unmute(); }); @@ -1261,6 +1313,7 @@ MouseArea{ root.publishTasksGeometries.connect(slotPublishGeometries); root.showPreviewForTasks.connect(slotShowPreviewForTasks); root.mimicEnterForParabolic.connect(slotMimicEnterForParabolic); + root.launchersUpdatedFor.connect(slotLaunchersChangedFor); //startup without launcher var hideStartup = ((((tasksModel.launcherPosition(mainItemContainer.launcherUrl) == -1) @@ -1290,6 +1343,7 @@ MouseArea{ root.publishTasksGeometries.disconnect(slotPublishGeometries); root.showPreviewForTasks.disconnect(slotShowPreviewForTasks); root.mimicEnterForParabolic.disconnect(slotMimicEnterForParabolic); + root.launchersUpdatedFor.disconnect(slotLaunchersChangedFor); wrapper.sendEndOfNeedBothAxisAnimation(); } @@ -1413,9 +1467,14 @@ MouseArea{ repeat: false onTriggered: { - if (mainItemContainer.itemIndex >= 0) + if (mainItemContainer.itemIndex >= 0){ mainItemContainer.lastValidIndex = mainItemContainer.itemIndex; + if (root.showWindowsOnlyFromLaunchers) { + parabolicManager.updateTasksEdgesIndexes(); + } + } + if (latteDock && latteDock.debugModeTimers) { console.log("plasmoid timer: lastValidTimer called..."); } diff --git a/plasmoid/package/contents/ui/task/TaskWrapper.qml b/plasmoid/package/contents/ui/task/TaskWrapper.qml index cde04fdf9..137ba51f2 100644 --- a/plasmoid/package/contents/ui/task/TaskWrapper.qml +++ b/plasmoid/package/contents/ui/task/TaskWrapper.qml @@ -151,6 +151,7 @@ Item{ && !root.reverseLinesPosition) || (((root.position === PlasmaCore.Types.BottomPositioned) || (root.position === PlasmaCore.Types.RightPositioned)) && root.reverseLinesPosition) ) + && !(root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator) visible: active sourceComponent: Component{ @@ -164,6 +165,7 @@ Item{ active: secondIndicator.active && !root.reverseLinesPosition && (mainItemContainer.inAttentionAnimation || mainItemContainer.inFastRestoreAnimation) + && !(root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator) visible: active sourceComponent: Component{ @@ -192,6 +194,7 @@ Item{ active: firstIndicator.active && !root.reverseLinesPosition && (mainItemContainer.inAttentionAnimation || mainItemContainer.inFastRestoreAnimation) + && !(root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator) visible: active sourceComponent: Component{ @@ -215,6 +218,7 @@ Item{ Loader{ id: secondIndicator active: !firstIndicator.active + && !(root.showWindowsOnlyFromLaunchers && root.activeIndicator === Latte.Dock.NoneIndicator) visible: active sourceComponent: Component{ diff --git a/plasmoid/package/contents/ui/task/animations/TaskRealRemovalAnimation.qml b/plasmoid/package/contents/ui/task/animations/TaskRealRemovalAnimation.qml index 680a08d3c..a27f96c05 100644 --- a/plasmoid/package/contents/ui/task/animations/TaskRealRemovalAnimation.qml +++ b/plasmoid/package/contents/ui/task/animations/TaskRealRemovalAnimation.qml @@ -60,7 +60,7 @@ SequentialAnimation { //trying to fix the ListView nasty behavior //during the removal the anchoring for ListView children changes a lot var previousTask = icList.childAtIndex(mainItemContainer.lastValidIndex-1); - if (previousTask !== undefined && !previousTask.isStartup && !previousTask.inBouncingAnimation){ + if (previousTask !== undefined && !previousTask.isStartup && !previousTask.inBouncingAnimation && !root.showWindowsOnlyFromLaunchers){ if (root.vertical) { mainItemContainer.anchors.top = previousTask.bottom; } else { diff --git a/plasmoid/package/contents/ui/task/animations/TaskShowWindowAnimation.qml b/plasmoid/package/contents/ui/task/animations/TaskShowWindowAnimation.qml index e8655e264..d3633c3fe 100644 --- a/plasmoid/package/contents/ui/task/animations/TaskShowWindowAnimation.qml +++ b/plasmoid/package/contents/ui/task/animations/TaskShowWindowAnimation.qml @@ -131,17 +131,25 @@ SequentialAnimation{ //startup without launcher, animation should be blocked - var hideStartup = ((((tasksModel.launcherPosition(mainItemContainer.launcherUrl) == -1) - && (tasksModel.launcherPosition(mainItemContainer.launcherUrlWithIcon) == -1) ) - || !launcherIsPresent(mainItemContainer.launcherUrl)) - && mainItemContainer.isStartup); + var launcherExists = !(((tasksModel.launcherPosition(mainItemContainer.launcherUrl) == -1) + && (tasksModel.launcherPosition(mainItemContainer.launcherUrlWithIcon) == -1) ) + || !launcherIsPresent(mainItemContainer.launcherUrl)); + + var hideStartup = launcherExists && mainItemContainer.isStartup; + var hideWindow = root.showWindowsOnlyFromLaunchers && !launcherExists && mainItemContainer.isWindow; if (root.immediateLauncherExists(mainItemContainer.launcherUrl) && mainItemContainer.isLauncher) { root.removeImmediateLauncher(mainItemContainer.launcherUrl); } - if (!Latte.WindowSystem.compositingActive || root.inDraggingPhase - || mainItemContainer.isSeparator) { + if (hideStartup || hideWindow) { + mainItemContainer.visible = false; + wrapper.tempScaleWidth = 0; + wrapper.tempScaleHeight = 0; + wrapper.opacity = 0; + mainItemContainer.inAnimation = false; + } else if (!Latte.WindowSystem.compositingActive || root.inDraggingPhase + || mainItemContainer.isSeparator) { mainItemContainer.visible = true; wrapper.tempScaleWidth = 1; wrapper.tempScaleHeight = 1; @@ -149,15 +157,10 @@ SequentialAnimation{ wrapper.opacity = 1; mainItemContainer.inAnimation = false; } else if (( animation2 || animation3 || animation6) && (root.durationTime !== 0)){ + mainItemContainer.visible = true; wrapper.tempScaleWidth = 0; wrapper.tempScaleHeight = 0; start(); - } else if (hideStartup) { - mainItemContainer.visible = false; - wrapper.tempScaleWidth = 0; - wrapper.tempScaleHeight = 0; - wrapper.opacity = 0; - mainItemContainer.inAnimation = false; } else { var frozenTask = parabolicManager.getFrozenTask(mainItemContainer.launcherUrl); @@ -169,6 +172,7 @@ SequentialAnimation{ wrapper.tempScaleHeight = 1; } + mainItemContainer.visible = true; wrapper.opacity = 1; mainItemContainer.inAnimation = false; } diff --git a/shell/package/contents/configuration/TasksConfig.qml b/shell/package/contents/configuration/TasksConfig.qml index 987b282c4..8829e1c0f 100644 --- a/shell/package/contents/configuration/TasksConfig.qml +++ b/shell/package/contents/configuration/TasksConfig.qml @@ -330,6 +330,17 @@ PlasmaComponents.Page { plasmoid.configuration.showOnlyCurrentActivity = checked } } + + PlasmaComponents.CheckBox { + id: showWindowsOnlyFromLaunchersChk + Layout.leftMargin: units.smallSpacing * 2 + text: i18n("Show only tasks from launchers") + checked: plasmoid.configuration.showWindowsOnlyFromLaunchers + + onClicked: { + plasmoid.configuration.showWindowsOnlyFromLaunchers = checked + } + } } //! END: Tasks Filters