Commit dd315d81 authored by Marco Martin's avatar Marco Martin

fixes to task switcher experience

parent 3f32a18b
......@@ -42,8 +42,8 @@ NanoShell.FullScreenOverlay {
signal closed
width: Screen.width
height: Screen.height
//width: Screen.width
//height: Screen.height
function open() {
window.showFullScreen();
......@@ -70,13 +70,13 @@ NanoShell.FullScreenOverlay {
close();
}
}
onVisibleChanged: {
/*onVisibleChanged: {
if (visible) {
window.width = Screen.width;
window.height = Screen.height;
window.requestActivate();
}
}
}*/
SequentialAnimation {
id: closeAnim
......
......@@ -28,13 +28,21 @@ MouseArea {
id: button
width: Math.min(parent.width, parent.height)
height: width
property alias iconSource: icon.source
property bool checked
property bool checkable
Rectangle {
radius: height/2
anchors.fill: parent
visible: button.pressed
opacity: 0.1
opacity: button.pressed ? 0.1 : 0
color: PlasmaCore.ColorScope.textColor
Behavior on opacity {
OpacityAnimator {
duration: units.longDuration
easing.type: Easing.InOutQuad
}
}
}
PlasmaCore.IconItem {
id: icon
......
......@@ -39,7 +39,7 @@ PlasmaCore.ColorScope {
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
readonly property bool showingApp: plasmoid.nativeInterface.hasCloseableActiveWindow// !plasmoid.nativeInterface.showDesktop && (hasTasks || NanoShell.StartupFeedback.visible)
readonly property bool showingApp: !plasmoid.nativeInterface.allMinimized// !plasmoid.nativeInterface.showDesktop && (hasTasks || NanoShell.StartupFeedback.visible)
readonly property bool hasTasks: tasksModel.count > 0
......@@ -50,8 +50,8 @@ PlasmaCore.ColorScope {
//FIXME: why it crashes on startup if TaskSwitcher is loaded immediately?
Connections {
target: plasmoid.nativeInterface
function onHasCloseableActiveWindowChanged() {
MobileShell.HomeScreenControls.homeScreenVisible = !plasmoid.nativeInterface.hasCloseableActiveWindow
function onAllMinimizedChanged() {
MobileShell.HomeScreenControls.homeScreenVisible = plasmoid.nativeInterface.allMinimized
}
}
Timer {
......@@ -197,6 +197,9 @@ PlasmaCore.ColorScope {
enabled: root.hasTasks
iconSource: "box"
onClicked: {
if (taskSwitcher.visible) {
return;
}
plasmoid.nativeInterface.showDesktop = false;
taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
}
......@@ -214,9 +217,12 @@ PlasmaCore.ColorScope {
enabled: taskSwitcher && taskSwitcher.tasksCount > 0
//checkable: true
onClicked: {
taskSwitcher.hide();
if (taskSwitcher.visible) {
return;
}
root.minimizeAll();
MobileShell.HomeScreenControls.resetHomeScreenPosition()
MobileShell.HomeScreenControls.resetHomeScreenPosition();
plasmoid.nativeInterface.allMinimizedChanged();
//plasmoid.nativeInterface.showDesktop = checked;
}
onPressed: mainMouseArea.managePressed(mouse);
......@@ -238,8 +244,14 @@ PlasmaCore.ColorScope {
anchors.right: parent.right
iconSource: "paint-none"
//FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML
enabled: plasmoid.nativeInterface.hasCloseableActiveWindow
opacity: plasmoid.nativeInterface.hasCloseableActiveWindow ? 1 : 0.4
onClicked: {
if (taskSwitcher.visible) {
return;
}
if (!plasmoid.nativeInterface.hasCloseableActiveWindow) {
return;
}
var index = taskSwitcher.model.activeTask;
if (index) {
taskSwitcher.model.requestClose(index);
......
......@@ -66,6 +66,7 @@ void TaskPanel::initWayland()
}
using namespace KWayland::Client;
ConnectionThread *connection = ConnectionThread::fromApplication(this);
if (!connection) {
return;
}
......@@ -170,6 +171,17 @@ void TaskPanel::updateActiveWindow()
this, &TaskPanel::forgetActiveWindow);
}
bool newAllMinimized = true;
for (auto *w : m_windowManagement->windows()) {
if (!w->isMinimized() && !w->skipTaskbar() && !w->isFullscreen() /*&& w->appId() != QStringLiteral("org.kde.plasmashell")*/) {
newAllMinimized = false;
break;
}
}
if (newAllMinimized != m_allMinimized) {
m_allMinimized = newAllMinimized;
emit allMinimizedChanged();
}
// TODO: connect to closeableChanged, not needed right now as KWin doesn't provide this changeable
emit hasCloseableActiveWindowChanged();
}
......
......@@ -42,6 +42,7 @@ class TaskPanel : public Plasma::Containment
{
Q_OBJECT
Q_PROPERTY(bool showDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged)
Q_PROPERTY(bool allMinimized READ allMinimized NOTIFY allMinimizedChanged)
Q_PROPERTY(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged)
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
......@@ -59,6 +60,9 @@ public:
}
void requestShowingDesktop(bool showingDesktop);
bool allMinimized() const {
return m_allMinimized;
}
bool hasCloseableActiveWindow() const;
public Q_SLOTS:
......@@ -68,12 +72,14 @@ Q_SIGNALS:
void showingDesktopChanged(bool);
void hasCloseableActiveWindowChanged();
void panelChanged();
void allMinimizedChanged();
private:
void initWayland();
void updateActiveWindow();
void updatePanelVisibility();
bool m_showingDesktop;
bool m_showingDesktop = false;
bool m_allMinimized = true;
QWindow *m_panel = nullptr;
KWayland::Client::PlasmaShellSurface *m_shellSurface = nullptr;
KWayland::Client::Surface *m_surface = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment