Skip to content

Commit

Permalink
Unpause wallpaper when peeking at desktop (#71)
Browse files Browse the repository at this point in the history
* Added ability to exclude some windows from filtering
and did some code cleanup

* fixed an oopsie

* Unpause wallpaper when peeking at desktop

* wrapped task iteration in if
  • Loading branch information
Tech-Tac authored Jan 28, 2025
1 parent 8268ed3 commit dc2db5b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
29 changes: 19 additions & 10 deletions package/contents/ui/WindowModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import QtQuick
import org.kde.taskmanager 0.1 as TaskManager
import org.kde.kwindowsystem

Item {
id: wModel
Expand All @@ -31,11 +32,12 @@ Item {
property bool activeExists: false
property var abstractTasksModel: TaskManager.AbstractTasksModel
property var appId: abstractTasksModel.AppId
property var isMaximized: abstractTasksModel.IsMaximized
property var isActive: abstractTasksModel.IsActive
property var isWindow: abstractTasksModel.IsWindow
property var isFullScreen: abstractTasksModel.IsFullScreen
property var isMinimized: abstractTasksModel.IsMinimized
property var isMaximized: abstractTasksModel.IsMaximized
property var isFullScreen: abstractTasksModel.IsFullScreen
property var isActive: abstractTasksModel.IsActive
property var isHidden: abstractTasksModel.IsHidden
property bool activeScreenOnly: wallpaper.configuration.checkActiveScreen
property var excludeWindows: wallpaper.configuration.excludeWindows

Expand All @@ -46,6 +48,13 @@ Item {
}
}

Connections {
target: KWindowSystem
function onShowingDesktopChanged() {
updateWindowsInfo();
}
}

onPauseModeChanged: {
updateWindowsInfo();
}
Expand Down Expand Up @@ -105,14 +114,14 @@ Item {
let visibleCount = 0;
let maximizedCount = 0;

for (var i = 0; i < tasksModel.count; i++) {
const currentTask = tasksModel.index(i, 0);
if (currentTask === undefined)
continue;
if (excludeWindows.includes(tasksModel.data(currentTask, appId).replace(/\.desktop$/, "")))
continue;
if (!KWindowSystem.showingDesktop) {
for (var i = 0; i < tasksModel.count; i++) {
const currentTask = tasksModel.index(i, 0);

// Long line
if (currentTask === undefined || excludeWindows.includes(tasksModel.data(currentTask, appId).replace(/\.desktop$/, "")) || tasksModel.data(currentTask, isHidden) || !tasksModel.data(currentTask, isWindow) || tasksModel.data(currentTask, isMinimized))
continue;

if (tasksModel.data(currentTask, isWindow) && !tasksModel.data(currentTask, isMinimized)) {
visibleCount += 1;
if (tasksModel.data(currentTask, isMaximized) || tasksModel.data(currentTask, isFullScreen))
maximizedCount += 1;
Expand Down
13 changes: 9 additions & 4 deletions package/contents/ui/config.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Kirigami.FormLayout {
property var cfg_excludeWindows: wallpaper.configuration.excludeWindows
property bool cfg_running: wallpaper.configuration.running

Palette {
id: palette
}

RowLayout {
Kirigami.FormData.label: i18nd("online.knowmad.shaderwallpaper", "Select shader:")
ComboBox {
Expand Down Expand Up @@ -180,8 +184,8 @@ Kirigami.FormLayout {
}
}
background: Rectangle {
color: shaderSpeedField.activeFocus ? Palette.base : "transparent"
border.color: shaderSpeedField.activeFocus ? Palette.highlight : "transparent"
color: shaderSpeedField.activeFocus ? palette.base : "transparent"
border.color: shaderSpeedField.activeFocus ? palette.highlight : "transparent"
border.width: 1
radius: 4
anchors.fill: shaderSpeedField
Expand Down Expand Up @@ -250,8 +254,8 @@ Kirigami.FormLayout {
}
}
background: Rectangle {
color: mouseBiasField.activeFocus ? Palette.base : "transparent"
border.color: mouseBiasField.activeFocus ? Palette.highlight : "transparent"
color: mouseBiasField.activeFocus ? palette.base : "transparent"
border.color: mouseBiasField.activeFocus ? palette.highlight : "transparent"
border.width: 1
radius: 4
anchors.fill: mouseBiasField
Expand Down Expand Up @@ -498,6 +502,7 @@ Kirigami.FormLayout {
Text {
text: i18nd("@button:kofi", "Kofi")
horizontalAlignment: Text.AlignHCenter
color: palette.text
transform: Translate {
x: -8
}
Expand Down

0 comments on commit dc2db5b

Please sign in to comment.