Compare commits
1
Commits
3f0e31b116
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc197339fa |
No files matched your search
@@ -33,6 +33,8 @@ PanelWindow {
|
||||
item: root.notch ? leftIsland : panel
|
||||
Region { item: root.notch ? notchPill : null; intersection: Intersection.Combine }
|
||||
Region { item: root.notch ? rightIsland : null; intersection: Intersection.Combine }
|
||||
Region { item: root.notch && innerLeft.shown ? innerLeft : null; intersection: Intersection.Combine }
|
||||
Region { item: root.notch && innerRight.shown ? innerRight : null; intersection: Intersection.Combine }
|
||||
}
|
||||
color: Theme.transparent
|
||||
// Reserve the bar itself (margin + height), not the overhang below it, so
|
||||
@@ -151,6 +153,39 @@ PanelWindow {
|
||||
}
|
||||
Island { id: leftIsland; side: "left" }
|
||||
Island { id: rightIsland; side: "right" }
|
||||
// Spots right beside the notch, one each side at the same distance. Always
|
||||
// bare (no pill), they ride the notch's edges as it springs wider for media,
|
||||
// and step aside while it is opened or widened for the launcher or a banner.
|
||||
readonly property int innerGap: 10
|
||||
readonly property bool notchBusy: ShellState.notchOpen || notchPill.searching || notchPill.showing
|
||||
component InnerSlot: Item {
|
||||
id: slot
|
||||
property string side
|
||||
readonly property bool used: root.notch && ConfigService.ready && (ConfigService.data.notch[side] || []).length > 0
|
||||
readonly property bool shown: used && opacity > 0.01
|
||||
visible: shown
|
||||
opacity: used && !root.notchBusy ? 1 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
x: side === "innerLeft" ? notchPill.x - root.innerGap - width : notchPill.x + notchPill.width + root.innerGap
|
||||
y: root.islandY
|
||||
width: slotRow.implicitWidth
|
||||
height: BarDrawers.height
|
||||
ModuleRow {
|
||||
id: slotRow
|
||||
position: slot.side === "innerLeft" ? "left" : "right"
|
||||
active: slot.used
|
||||
modules: BarLayout.notchModules(root.screen ? root.screen.name : "", slot.side)
|
||||
barScreen: root.screen
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
InnerSlot { id: innerLeft; side: "innerLeft" }
|
||||
InnerSlot { id: innerRight; side: "innerRight" }
|
||||
NotchPill {
|
||||
id: notchPill
|
||||
barScreen: root.screen
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import QtQuick
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
// Caffeine on the bar: keeps the system awake while lit.
|
||||
BarToggle {
|
||||
property var entry: ({})
|
||||
objectName: "caffeineModule"
|
||||
tip: "Caffeine"
|
||||
glyph: CaffeineService.active ? "" : ""
|
||||
on: CaffeineService.active
|
||||
bare: entry.bare === true
|
||||
onClicked: CaffeineService.toggle()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import QtQuick
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
// Night Light on the bar. Shows the provider's acknowledged state; while
|
||||
// only the bar watches, the state is polled slowly.
|
||||
BarToggle {
|
||||
property var entry: ({})
|
||||
readonly property var info: SystemService.state.nightLight || ({
|
||||
available: false
|
||||
})
|
||||
objectName: "nightLightModule"
|
||||
tip: "Night Light"
|
||||
glyph: ""
|
||||
on: !!info.enabled
|
||||
bare: entry.bare === true
|
||||
enabled: !!info.available && !SystemService.acting
|
||||
onClicked: SystemService.action("nightLight", !info.enabled, false)
|
||||
Component.onCompleted: SystemService.nightLightWatchers++
|
||||
Component.onDestruction: SystemService.nightLightWatchers--
|
||||
}
|
||||
@@ -25,7 +25,8 @@ GlassPill {
|
||||
readonly property bool shown: !!widget && (noctalia || widgetObject.hasVisualContent !== false) && widget.implicitWidth > 0
|
||||
// A plugin can offer a "background" setting; "transparent" drops the
|
||||
// pill so its widget sits straight on the bar, like the tray's option.
|
||||
readonly property bool bare: settings.background === "transparent"
|
||||
// The spots beside the notch drop it too.
|
||||
readonly property bool bare: settings.background === "transparent" || entry.bare === true
|
||||
color: bare ? "transparent" : Qt.alpha(Theme.surface, surfaceOpacity)
|
||||
border.width: bare ? 0 : 1
|
||||
plain: bare
|
||||
|
||||
@@ -7,6 +7,7 @@ import "../../core"
|
||||
Item {
|
||||
id: root
|
||||
property var barScreen
|
||||
property var entry: ({})
|
||||
readonly property bool shown: TrayService.options.enabled && TrayService.items.length > 0
|
||||
implicitWidth: shown ? row.implicitWidth + 12 : 0
|
||||
implicitHeight: shown ? ModuleRegistry.pillHeight : 0
|
||||
@@ -14,7 +15,7 @@ Item {
|
||||
// The whole pill is hover space: gaps between icons keep a hover menu open.
|
||||
readonly property bool hovered: hover.hovered
|
||||
HoverHandler { id: hover }
|
||||
GlassPill { anchors.fill: parent; visible: TrayService.options.background === "pill" }
|
||||
GlassPill { anchors.fill: parent; visible: TrayService.options.background === "pill" && root.entry.bare !== true }
|
||||
Row {
|
||||
id: row; anchors.centerIn: parent; spacing: TrayService.options.spacing
|
||||
Repeater {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import QtQuick
|
||||
import "../core"
|
||||
import "../theme"
|
||||
// A bar module that is one glyph switching something on and off (Caffeine,
|
||||
// Night Light). Lit in the accent colour while on. `bare` (the spots beside
|
||||
// the notch) drops the pill and keeps only a soft hover circle.
|
||||
Item {
|
||||
id: root
|
||||
property string glyph
|
||||
property bool on: false
|
||||
property bool bare: false
|
||||
property string tip: ""
|
||||
signal clicked
|
||||
implicitWidth: ModuleRegistry.pillHeight
|
||||
implicitHeight: ModuleRegistry.pillHeight
|
||||
opacity: enabled ? 1 : 0.45
|
||||
GlassPill {
|
||||
anchors.fill: parent
|
||||
visible: !root.bare
|
||||
}
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.height - 6
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: root.on ? Qt.alpha(Theme.accent, 0.16) : Theme.hover
|
||||
opacity: area.containsMouse || root.on ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: Theme.duration / 2 } }
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: root.glyph
|
||||
color: root.on ? Theme.accent : Theme.text
|
||||
font.pixelSize: Math.round(root.height * 0.46)
|
||||
Behavior on color { ColorAnimation { duration: Theme.duration } }
|
||||
}
|
||||
scale: area.pressed ? 1 - 0.06 * Theme.intensity : 1
|
||||
Behavior on scale { NumberAnimation { duration: Theme.duration / 2; easing.type: Easing.OutCubic } }
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.clicked()
|
||||
}
|
||||
Accessible.role: Accessible.CheckBox
|
||||
Accessible.name: root.tip
|
||||
Accessible.checked: root.on
|
||||
}
|
||||
@@ -268,6 +268,8 @@
|
||||
"mediaFirst": true,
|
||||
"left": ["workspaces"],
|
||||
"right": ["tray"],
|
||||
"innerLeft": [],
|
||||
"innerRight": [],
|
||||
"strip": [],
|
||||
"controls": [],
|
||||
"opacity": 0,
|
||||
|
||||
@@ -16,8 +16,9 @@ Singleton {
|
||||
return [];
|
||||
return hasOwn(screenName) ? screens[screenName].modules : ConfigService.data.bar.modules;
|
||||
}
|
||||
// Entries for a notch module list ("left", "right" or "strip"). Each reuses
|
||||
// the module's bar entry for its options when the layout has one.
|
||||
// Entries for a notch module list ("left", "right", "innerLeft",
|
||||
// "innerRight" or "strip"). Each reuses the module's bar entry for its
|
||||
// options when the layout has one.
|
||||
function notchModules(screenName, key) {
|
||||
if (!ConfigService.ready || !ConfigService.data.notch)
|
||||
return [];
|
||||
@@ -28,7 +29,9 @@ Singleton {
|
||||
id: id,
|
||||
enabled: true,
|
||||
notch: true,
|
||||
position: key === "right" ? "right" : key === "left" ? "left" : "center"
|
||||
// The spots beside the notch never draw pills.
|
||||
bare: key === "innerLeft" || key === "innerRight",
|
||||
position: key === "right" || key === "innerRight" ? "right" : key === "left" || key === "innerLeft" ? "left" : "center"
|
||||
}));
|
||||
}
|
||||
// Saves to the screen's own layout when it has one, else the shared layout.
|
||||
|
||||
@@ -21,7 +21,9 @@ Singleton {
|
||||
clock: Qt.resolvedUrl("../bar/modules/ClockModule.qml"),
|
||||
tray: Qt.resolvedUrl("../bar/modules/TrayModule.qml"),
|
||||
system: Qt.resolvedUrl("../bar/modules/SystemModule.qml"),
|
||||
volume: Qt.resolvedUrl("../bar/modules/VolumeModule.qml")
|
||||
volume: Qt.resolvedUrl("../bar/modules/VolumeModule.qml"),
|
||||
caffeine: Qt.resolvedUrl("../bar/modules/CaffeineModule.qml"),
|
||||
nightLight: Qt.resolvedUrl("../bar/modules/NightLightModule.qml")
|
||||
})
|
||||
// Installed plugin bar widgets are modules named "plugin:<id>".
|
||||
function isPlugin(id) { return String(id).startsWith("plugin:"); }
|
||||
@@ -33,7 +35,7 @@ Singleton {
|
||||
activeWindow: "Windows", cava: "Visualizer", clock: "Clock", cpu: "CPU", cpuTemperature: "CPU temp",
|
||||
gpu: "GPU", gpuTemperature: "GPU temp", networkThroughput: "Network", nowPlaying: "Now playing",
|
||||
ram: "Memory", settings: "Settings", storage: "Storage", system: "System", tray: "Tray",
|
||||
volume: "Volume", workspaces: "Workspaces"
|
||||
volume: "Volume", workspaces: "Workspaces", caffeine: "Caffeine", nightLight: "Night Light"
|
||||
})
|
||||
function title(id) { return isPlugin(id) ? PluginService.title(String(id).slice(7)) : titles[id] || id; }
|
||||
// Per-module options edited from the cog on each card in Settings → Bar.
|
||||
|
||||
@@ -86,7 +86,7 @@ function validate(c) {
|
||||
const dashTabs=new Set();
|
||||
for(const t of dash.tabs) { if(!t || typeof t.id!=="string" || dashTabs.has(t.id) || typeof t.enabled!=="boolean")throw Error("Invalid dashboard tab"); dashTabs.add(t.id); }
|
||||
if(!c.notch || ["enabled","mediaFirst"].some(k=>typeof c.notch[k]!=="boolean"))throw Error("Invalid notch preferences");
|
||||
for(const key of ["left","right","strip"]) if(!Array.isArray(c.notch[key]) || c.notch[key].some(id=>typeof id!=="string" || !id))throw Error("Invalid notch modules");
|
||||
for(const key of ["left","right","innerLeft","innerRight","strip"]) if(!Array.isArray(c.notch[key]) || c.notch[key].some(id=>typeof id!=="string" || !id))throw Error("Invalid notch modules");
|
||||
if(!Array.isArray(c.notch.controls) || c.notch.controls.some(m=>!m || typeof m.id!=="string" || typeof m.enabled!=="boolean" || ["w","h"].some(k=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<1 || m[k]>4)) || [["x",3],["y",63]].some(([k,max])=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<0 || m[k]>max))))throw Error("Invalid notch controls");
|
||||
if(!Number.isFinite(c.notch.opacity) || c.notch.opacity<0 || c.notch.opacity>100 || typeof c.notch.color!=="string" || (c.notch.color!=="" && !/^#[0-9a-fA-F]{6}$/.test(c.notch.color)))throw Error("Invalid notch colour");
|
||||
if(typeof c.notch.glassOnOpen!=="boolean" || typeof c.notch.launcherMatch!=="boolean" || ["openSpeed","closeSpeed","colorSpeed","panelOpenSpeed","panelCloseSpeed"].some(k=>!Number.isFinite(c.notch[k]) || c.notch[k]<25 || c.notch[k]>300))throw Error("Invalid notch animation");
|
||||
|
||||
@@ -13,7 +13,14 @@ Singleton {
|
||||
// them for every background status poll flickered them every five seconds.
|
||||
readonly property bool acting: (job.running && job.request.op === "action") || queued !== null
|
||||
property var queued: null
|
||||
// Bar modules showing Night Light; while only they watch, it polls slowly.
|
||||
property int nightLightWatchers: 0
|
||||
readonly property var features: {
|
||||
const own = panelFeatures;
|
||||
return nightLightWatchers > 0 && !own.includes("nightLight") ? own.concat(["nightLight"]) : own;
|
||||
}
|
||||
readonly property bool panelObserved: panelFeatures.length > 0
|
||||
readonly property var panelFeatures: {
|
||||
if (!ConfigService.ready)
|
||||
return [];
|
||||
if (ShellState.controlCenterOpen || ShellState.notchOpen)
|
||||
@@ -79,7 +86,7 @@ Singleton {
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 5000
|
||||
interval: root.panelObserved ? 5000 : 30000
|
||||
repeat: true
|
||||
running: root.observed
|
||||
onTriggered: root.refresh()
|
||||
|
||||
@@ -10,15 +10,26 @@ import "../../theme"
|
||||
SettingsPage {
|
||||
id: root
|
||||
readonly property var options: ConfigService.data.notch
|
||||
// The four spots in the bar row; a module sits in one of them at a time.
|
||||
readonly property var sideKeys: ["left", "innerLeft", "innerRight", "right"]
|
||||
// Adds or removes a bar module from one of the notch's module lists.
|
||||
// Adding it to a side spot moves it there from the other side spots.
|
||||
function toggleModule(key, id) {
|
||||
const list = (options[key] || []).slice();
|
||||
const at = list.indexOf(id);
|
||||
if (at >= 0)
|
||||
if (at >= 0) {
|
||||
list.splice(at, 1);
|
||||
else
|
||||
return ConfigService.setValue("notch." + key, list);
|
||||
}
|
||||
list.push(id);
|
||||
ConfigService.setValue("notch." + key, list);
|
||||
const next = Object.assign({}, options, {
|
||||
[key]: list
|
||||
});
|
||||
if (sideKeys.includes(key))
|
||||
for (const other of sideKeys)
|
||||
if (other !== key)
|
||||
next[other] = (options[other] || []).filter(m => m !== id);
|
||||
ConfigService.setValue("notch", next);
|
||||
}
|
||||
// Chips for every bar module; filled ones are shown there, in click order.
|
||||
component ModulePicker: SettingRow {
|
||||
@@ -104,6 +115,18 @@ SettingsPage {
|
||||
icon: ""
|
||||
key: "right"
|
||||
}
|
||||
ModulePicker {
|
||||
title: "Left of the notch"
|
||||
description: "Right beside the notch, always without a pill"
|
||||
icon: ""
|
||||
key: "innerLeft"
|
||||
}
|
||||
ModulePicker {
|
||||
title: "Right of the notch"
|
||||
description: "Right beside the notch, always without a pill"
|
||||
icon: ""
|
||||
key: "innerRight"
|
||||
}
|
||||
PreferenceChoice {
|
||||
label: "Workspace style"
|
||||
description: "\"bar\" uses the style from Settings → Bar"
|
||||
|
||||
Reference in new issue
Block a user