mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 02:34:45 +00:00
fixes to task switcher experience
This commit is contained in:
parent
3f32a18b62
commit
dd315d81e0
5 changed files with 51 additions and 13 deletions
|
|
@ -42,8 +42,8 @@ NanoShell.FullScreenOverlay {
|
||||||
|
|
||||||
signal closed
|
signal closed
|
||||||
|
|
||||||
width: Screen.width
|
//width: Screen.width
|
||||||
height: Screen.height
|
//height: Screen.height
|
||||||
|
|
||||||
function open() {
|
function open() {
|
||||||
window.showFullScreen();
|
window.showFullScreen();
|
||||||
|
|
@ -70,13 +70,13 @@ NanoShell.FullScreenOverlay {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onVisibleChanged: {
|
/*onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
window.width = Screen.width;
|
window.width = Screen.width;
|
||||||
window.height = Screen.height;
|
window.height = Screen.height;
|
||||||
window.requestActivate();
|
window.requestActivate();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: closeAnim
|
id: closeAnim
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,21 @@ MouseArea {
|
||||||
id: button
|
id: button
|
||||||
width: Math.min(parent.width, parent.height)
|
width: Math.min(parent.width, parent.height)
|
||||||
height: width
|
height: width
|
||||||
|
|
||||||
property alias iconSource: icon.source
|
property alias iconSource: icon.source
|
||||||
property bool checked
|
property bool checked
|
||||||
property bool checkable
|
property bool checkable
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
radius: height/2
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: button.pressed
|
opacity: button.pressed ? 0.1 : 0
|
||||||
opacity: 0.1
|
color: PlasmaCore.ColorScope.textColor
|
||||||
|
Behavior on opacity {
|
||||||
|
OpacityAnimator {
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
|
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
|
readonly property bool hasTasks: tasksModel.count > 0
|
||||||
|
|
||||||
|
|
@ -50,8 +50,8 @@ PlasmaCore.ColorScope {
|
||||||
//FIXME: why it crashes on startup if TaskSwitcher is loaded immediately?
|
//FIXME: why it crashes on startup if TaskSwitcher is loaded immediately?
|
||||||
Connections {
|
Connections {
|
||||||
target: plasmoid.nativeInterface
|
target: plasmoid.nativeInterface
|
||||||
function onHasCloseableActiveWindowChanged() {
|
function onAllMinimizedChanged() {
|
||||||
MobileShell.HomeScreenControls.homeScreenVisible = !plasmoid.nativeInterface.hasCloseableActiveWindow
|
MobileShell.HomeScreenControls.homeScreenVisible = plasmoid.nativeInterface.allMinimized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
|
|
@ -197,6 +197,9 @@ PlasmaCore.ColorScope {
|
||||||
enabled: root.hasTasks
|
enabled: root.hasTasks
|
||||||
iconSource: "box"
|
iconSource: "box"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (taskSwitcher.visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
plasmoid.nativeInterface.showDesktop = false;
|
plasmoid.nativeInterface.showDesktop = false;
|
||||||
taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
|
taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
|
||||||
}
|
}
|
||||||
|
|
@ -214,9 +217,12 @@ PlasmaCore.ColorScope {
|
||||||
enabled: taskSwitcher && taskSwitcher.tasksCount > 0
|
enabled: taskSwitcher && taskSwitcher.tasksCount > 0
|
||||||
//checkable: true
|
//checkable: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
taskSwitcher.hide();
|
if (taskSwitcher.visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
root.minimizeAll();
|
root.minimizeAll();
|
||||||
MobileShell.HomeScreenControls.resetHomeScreenPosition()
|
MobileShell.HomeScreenControls.resetHomeScreenPosition();
|
||||||
|
plasmoid.nativeInterface.allMinimizedChanged();
|
||||||
//plasmoid.nativeInterface.showDesktop = checked;
|
//plasmoid.nativeInterface.showDesktop = checked;
|
||||||
}
|
}
|
||||||
onPressed: mainMouseArea.managePressed(mouse);
|
onPressed: mainMouseArea.managePressed(mouse);
|
||||||
|
|
@ -238,8 +244,14 @@ PlasmaCore.ColorScope {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
iconSource: "paint-none"
|
iconSource: "paint-none"
|
||||||
//FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML
|
//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: {
|
onClicked: {
|
||||||
|
if (taskSwitcher.visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!plasmoid.nativeInterface.hasCloseableActiveWindow) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var index = taskSwitcher.model.activeTask;
|
var index = taskSwitcher.model.activeTask;
|
||||||
if (index) {
|
if (index) {
|
||||||
taskSwitcher.model.requestClose(index);
|
taskSwitcher.model.requestClose(index);
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ void TaskPanel::initWayland()
|
||||||
}
|
}
|
||||||
using namespace KWayland::Client;
|
using namespace KWayland::Client;
|
||||||
ConnectionThread *connection = ConnectionThread::fromApplication(this);
|
ConnectionThread *connection = ConnectionThread::fromApplication(this);
|
||||||
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -170,6 +171,17 @@ void TaskPanel::updateActiveWindow()
|
||||||
this, &TaskPanel::forgetActiveWindow);
|
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
|
// TODO: connect to closeableChanged, not needed right now as KWin doesn't provide this changeable
|
||||||
emit hasCloseableActiveWindowChanged();
|
emit hasCloseableActiveWindowChanged();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ class TaskPanel : public Plasma::Containment
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool showDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged)
|
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(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged)
|
||||||
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
|
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
|
||||||
|
|
||||||
|
|
@ -59,6 +60,9 @@ public:
|
||||||
}
|
}
|
||||||
void requestShowingDesktop(bool showingDesktop);
|
void requestShowingDesktop(bool showingDesktop);
|
||||||
|
|
||||||
|
bool allMinimized() const {
|
||||||
|
return m_allMinimized;
|
||||||
|
}
|
||||||
bool hasCloseableActiveWindow() const;
|
bool hasCloseableActiveWindow() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
@ -68,12 +72,14 @@ Q_SIGNALS:
|
||||||
void showingDesktopChanged(bool);
|
void showingDesktopChanged(bool);
|
||||||
void hasCloseableActiveWindowChanged();
|
void hasCloseableActiveWindowChanged();
|
||||||
void panelChanged();
|
void panelChanged();
|
||||||
|
void allMinimizedChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initWayland();
|
void initWayland();
|
||||||
void updateActiveWindow();
|
void updateActiveWindow();
|
||||||
void updatePanelVisibility();
|
void updatePanelVisibility();
|
||||||
bool m_showingDesktop;
|
bool m_showingDesktop = false;
|
||||||
|
bool m_allMinimized = true;
|
||||||
QWindow *m_panel = nullptr;
|
QWindow *m_panel = nullptr;
|
||||||
KWayland::Client::PlasmaShellSurface *m_shellSurface = nullptr;
|
KWayland::Client::PlasmaShellSurface *m_shellSurface = nullptr;
|
||||||
KWayland::Client::Surface *m_surface = nullptr;
|
KWayland::Client::Surface *m_surface = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue