Skip to content

Commit eba4a14

Browse files
committed
feat: "Fullscreen window" preset auto-loading condition
1 parent cc80c59 commit eba4a14

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

package/contents/ui/TasksModel.qml

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Item {
2727
property var screenGeometry
2828
property bool activeExists: false
2929
property bool maximizedExists: false
30+
property bool fullscreenExists: false
3031
property bool visibleExists: false
3132
property var abstractTasksModel: TaskManager.AbstractTasksModel
3233
property var isMaximized: abstractTasksModel.IsMaximized
@@ -86,6 +87,7 @@ Item {
8687
let activeCount = 0
8788
let visibleCount = 0
8889
let maximizedCount = 0
90+
let fullscreenCount = 0
8991
for (var i = 0; i < tasksModel.count; i++) {
9092
const currentTask = tasksModel.index(i, 0)
9193
if (currentTask === undefined || !tasksModel.data(currentTask, isWindow)) continue
@@ -94,9 +96,11 @@ Item {
9496
if (filterByActive && !active) continue
9597
if (active) activeTask = currentTask
9698
if (tasksModel.data(currentTask, isMaximized)) maximizedCount += 1
99+
if (tasksModel.data(currentTask, isFullScreen)) fullscreenCount += 1
97100
}
98101
root.visibleExists = visibleCount > 0
99102
root.maximizedExists = filterByActive ? tasksModel.data(activeTask, isMaximized) : maximizedCount > 0
103+
root.fullscreenExists = filterByActive ? tasksModel.data(activeTask, isFullScreen) : fullscreenCount > 0
100104
root.activeExists = activeCount > 0
101105
}
102106
}

package/contents/ui/code/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function getPresetName(panelState, presetAutoloading) {
358358
if (presetAutoloading.hasOwnProperty("enabled") && !presetAutoloading.enabled) return null
359359
// loop until we find a the currently active 'true' panel state with a configured preset
360360
// normal is our fallback so does not need active state
361-
const priority = ["maximized", "touchingWindow", "visibleWindows", "floating", "normal"]
361+
const priority = ["fullscreenWindow", "maximized", "touchingWindow", "visibleWindows", "floating", "normal"]
362362
for (let state of priority) {
363363
if ((panelState[state] || state === "normal") && presetAutoloading[state]) {
364364
console.error("getPresetName()", state, "->", presetAutoloading[state])

package/contents/ui/configPresetAutoload.qml

+12
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ KCM.SimpleKCM {
123123
Kirigami.ContextualHelpButton {
124124
toolTipText: i18n("Priorities go in descending order. E.g. if both <b>Maximized window is shown</b> and <b>Panel touching window</b> have a preset selected, and there is a maximized window on the screen, the <b>Maximized</b> preset will be applied.")
125125
}
126+
ComboBox {
127+
model: presetsModel
128+
textRole: "name"
129+
Kirigami.FormData.label: i18n("Fullscreen window:")
130+
onCurrentIndexChanged: {
131+
autoLoadConfig.fullscreenWindow = model.get(currentIndex)["value"]
132+
updateConfig()
133+
}
134+
currentIndex: getIndex(model, autoLoadConfig.fullscreenWindow)
135+
enabled: enabledCheckbox.checked
136+
}
137+
126138
ComboBox {
127139
model: presetsModel
128140
textRole: "name"

package/contents/ui/main.qml

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ PlasmoidItem {
6868
StandardPaths.HomeLocation).toString().substring(7) + "/.config/panel-colorizer/presets/"
6969
property var presetContent: ""
7070
property var panelState: {
71+
"fullscreenWindow": tasksModel.fullscreenExists,
7172
"maximized": tasksModel.maximizedExists,
7273
"visibleWindows": tasksModel.visibleExists,
7374
"touchingWindow": !panelElement ? false : Boolean(panelElement.touchingWindow),
@@ -407,12 +408,16 @@ PlasmoidItem {
407408
if (!fgEnabled && !inTray) {
408409
return Kirigami.Theme.textColor
409410
} else if ((!fgEnabled && inTray && widgetEnabled)) {
411+
// inherit tray widget fg color to tray icons
410412
return trayWidgetBgItem.fgColor
411413
} else if (separateTray || cfgOverride) {
414+
// passs override config
412415
return getColor(rect.fgColorCfg, targetIndex, rect.color, itemType, fgColorHolder)
413416
} else if (inTray) {
417+
// pass tray icon index
414418
return getColor(widgetSettings.foregroundColor, trayIndex, rect.color, itemType, fgColorHolder)
415419
} else {
420+
// pass regular widget index
416421
return getColor(widgetSettings.foregroundColor, targetIndex, rect.color, itemType, fgColorHolder)
417422
}
418423
}

0 commit comments

Comments
 (0)