Skip to content

Commit 24b3134

Browse files
authored
bar: add config option to disable on selected screens (caelestia-dots#920)
* modules/drawers: Added a bar config option to disable the bar on selected screens Extended the visualizer on screens that the bar is hidden * modules/drawers: surrounded barwrapper with a loader * fix/modules/drawers: fix a null reference missed to fix a reference to bar object to barLoader.item * modules/drawers: added regex support also reverted the barLoader, added a disabled property to BarLoader instead * fix: module/drawers: applied requested changes
1 parent 11282f6 commit 24b3134

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ default, you must create it manually.
400400
}
401401
]
402402
},
403+
"excludedScreens": [""],
403404
"activeWindow": {
404405
"inverted": false
405406
}

config/BarConfig.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ JsonObject {
1212
property Status status: Status {}
1313
property Clock clock: Clock {}
1414
property Sizes sizes: Sizes {}
15+
property list<string> excludedScreens: []
1516

1617
property list<var> entries: [
1718
{

modules/bar/BarWrapper.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ Item {
1212
required property ShellScreen screen
1313
required property PersistentProperties visibilities
1414
required property BarPopouts.Wrapper popouts
15+
required property bool disabled
1516

1617
readonly property int padding: Math.max(Appearance.padding.smaller, Config.border.thickness)
1718
readonly property int contentWidth: Config.bar.sizes.innerWidth + padding * 2
18-
readonly property int exclusiveZone: Config.bar.persistent || visibilities.bar ? contentWidth : Config.border.thickness
19-
readonly property bool shouldBeVisible: Config.bar.persistent || visibilities.bar || isHovered
19+
readonly property int exclusiveZone: !disabled && (Config.bar.persistent || visibilities.bar) ? contentWidth : Config.border.thickness
20+
readonly property bool shouldBeVisible: !disabled && (Config.bar.persistent || visibilities.bar || isHovered)
2021
property bool isHovered
2122

2223
function closeTray(): void {

modules/drawers/Drawers.qml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ Variants {
1818
id: scope
1919

2020
required property ShellScreen modelData
21+
readonly property bool barDisabled: {
22+
const regexChecker = /^\^.*\$$/;
23+
for (const filter of Config.bar.excludedScreens) {
24+
// If filter is a regex
25+
if (regexChecker.test(filter)) {
26+
if ((new RegExp(filter)).test(modelData.name))
27+
return true;
28+
} else {
29+
if (filter === modelData.name)
30+
return true;
31+
}
32+
}
33+
return false;
34+
}
2135

2236
Exclusions {
2337
screen: scope.modelData
@@ -169,6 +183,8 @@ Variants {
169183
visibilities: visibilities
170184
popouts: panels.popouts
171185

186+
disabled: scope.barDisabled
187+
172188
Component.onCompleted: Visibilities.bars.set(scope.modelData, this)
173189
}
174190
}

0 commit comments

Comments
 (0)