mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
slightly better bottom toolbar behavior
This commit is contained in:
parent
33e3892f96
commit
1c8a653b1d
5 changed files with 28 additions and 19 deletions
|
|
@ -33,8 +33,8 @@ MouseArea {
|
||||||
property bool checkable
|
property bool checkable
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: button.checked
|
visible: button.pressed
|
||||||
opacity: 0.05
|
opacity: 0.1
|
||||||
}
|
}
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,11 @@ FullScreenPanel {
|
||||||
plasmoid.nativeInterface.windowModel.requestToggleMinimized(filteredWindowModel.mapRowToSource(i));
|
plasmoid.nativeInterface.windowModel.requestToggleMinimized(filteredWindowModel.mapRowToSource(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
if (id >= 0) {
|
if (id >= 0) {
|
||||||
plasmoid.nativeInterface.windowModel.requestActivate(filteredWindowModel.mapRowToSource(id));
|
plasmoid.nativeInterface.windowModel.requestActivate(filteredWindowModel.mapRowToSource(id));
|
||||||
|
} else {
|
||||||
|
plasmoid.nativeInterface.forgetActiveWindow();
|
||||||
}
|
}
|
||||||
currentTaskIndex = id;
|
currentTaskIndex = id;
|
||||||
}
|
}
|
||||||
|
|
@ -205,8 +207,8 @@ FullScreenPanel {
|
||||||
}
|
}
|
||||||
iconSource: "go-home"
|
iconSource: "go-home"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
setSingleActiveWindow(-1);
|
|
||||||
window.hide();
|
window.hide();
|
||||||
|
setSingleActiveWindow(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: plasmoid.nativeInterface.panel = window;
|
Component.onCompleted: plasmoid.nativeInterface.panel = window;
|
||||||
|
|
|
||||||
|
|
@ -98,22 +98,11 @@ PlasmaCore.ColorScope {
|
||||||
width: parent.width/3
|
width: parent.width/3
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
iconSource: "go-home"
|
iconSource: "go-home"
|
||||||
checkable: true
|
onClicked: {
|
||||||
onCheckedChanged: {
|
root.taskSwitcher.setSingleActiveWindow(-1);
|
||||||
if (checked) {
|
|
||||||
root.taskSwitcher.setSingleActiveWindow(-1);
|
|
||||||
} else {
|
|
||||||
root.taskSwitcher.setSingleActiveWindow(Math.max(0, root.taskSwitcher.currentTaskIndex));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
onPositionChanged: mainMouseArea.positionChanged(mouse);
|
||||||
onReleased: mainMouseArea.released(mouse);
|
onReleased: mainMouseArea.released(mouse);
|
||||||
Connections {
|
|
||||||
target: root.taskSwitcher
|
|
||||||
onCurrentTaskIndexChanged: {
|
|
||||||
showDesktopButton.checked = root.taskSwitcher.currentTaskIndex < 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
|
|
||||||
|
|
@ -148,10 +148,14 @@ void TaskPanel::updateActiveWindow()
|
||||||
}
|
}
|
||||||
if (m_activeWindow) {
|
if (m_activeWindow) {
|
||||||
disconnect(m_activeWindow, &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
disconnect(m_activeWindow, &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
||||||
|
disconnect(m_activeWindow, &KWayland::Client::PlasmaWindow::unmapped,
|
||||||
|
this, &TaskPanel::forgetActiveWindow);
|
||||||
}
|
}
|
||||||
m_activeWindow = m_windowManagement->activeWindow();
|
m_activeWindow = m_windowManagement->activeWindow();
|
||||||
|
|
||||||
connect(m_activeWindow, &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
connect(m_activeWindow, &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
||||||
|
connect(m_activeWindow, &KWayland::Client::PlasmaWindow::unmapped,
|
||||||
|
this, &TaskPanel::forgetActiveWindow);
|
||||||
|
|
||||||
// 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();
|
||||||
|
|
@ -159,14 +163,25 @@ void TaskPanel::updateActiveWindow()
|
||||||
|
|
||||||
bool TaskPanel::hasCloseableActiveWindow() const
|
bool TaskPanel::hasCloseableActiveWindow() const
|
||||||
{
|
{
|
||||||
return m_activeWindow && m_activeWindow->isCloseable();
|
return m_activeWindow && m_activeWindow->isCloseable() && !m_activeWindow->isMinimized();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPanel::forgetActiveWindow()
|
||||||
|
{
|
||||||
|
if (m_activeWindow) {
|
||||||
|
disconnect(m_activeWindow, &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
||||||
|
disconnect(m_activeWindow, &KWayland::Client::PlasmaWindow::unmapped,
|
||||||
|
this, &TaskPanel::forgetActiveWindow);
|
||||||
|
}
|
||||||
|
m_activeWindow.clear();
|
||||||
|
emit hasCloseableActiveWindowChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::closeActiveWindow()
|
void TaskPanel::closeActiveWindow()
|
||||||
{
|
{
|
||||||
if (m_activeWindow) {
|
if (m_activeWindow) {
|
||||||
m_activeWindow->requestClose();
|
m_activeWindow->requestClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::setTaskGeometry(int row, int x, int y, int width, int height)
|
void TaskPanel::setTaskGeometry(int row, int x, int y, int width, int height)
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,9 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void setTaskGeometry(int row, int x, int y, int width, int height);
|
Q_INVOKABLE void setTaskGeometry(int row, int x, int y, int width, int height);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void forgetActiveWindow();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void windowModelChanged();
|
void windowModelChanged();
|
||||||
void showingDesktopChanged(bool);
|
void showingDesktopChanged(bool);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue