bartab-overhaul: initial commit
This commit is contained in:
parent
835f88d71e
commit
57448f100c
16 changed files with 905 additions and 76 deletions
|
|
@ -18,10 +18,44 @@ RowLayout {
|
|||
spacing: Style.marginS * scaling
|
||||
visible: getTitle() !== ""
|
||||
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userShowIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : ((Settings.data.bar.showActiveWindowIcon !== undefined) ? Settings.data.bar.showActiveWindowIcon : BarWidgetRegistry.widgetMetadata["ActiveWindow"].showIcon)
|
||||
|
||||
function getTitle() {
|
||||
return CompositorService.focusedWindowTitle !== "(No active window)" ? CompositorService.focusedWindowTitle : ""
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].showIcon === undefined
|
||||
&& Settings.data.bar.showActiveWindowIcon !== undefined) {
|
||||
widgets[sectionWidgetIndex].showIcon = Settings.data.bar.showActiveWindowIcon
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getAppIcon() {
|
||||
// Try CompositorService first
|
||||
const focusedWindow = CompositorService.getFocusedWindow()
|
||||
|
|
@ -74,7 +108,7 @@ RowLayout {
|
|||
Layout.preferredWidth: Style.fontSizeL * scaling * 1.2
|
||||
Layout.preferredHeight: Style.fontSizeL * scaling * 1.2
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: getTitle() !== "" && Settings.data.bar.showActiveWindowIcon
|
||||
visible: getTitle() !== "" && userShowIcon
|
||||
|
||||
IconImage {
|
||||
id: windowIcon
|
||||
|
|
|
|||
|
|
@ -14,6 +14,20 @@ Item {
|
|||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userAlwaysShowPercentage: (widgetSettings.alwaysShowPercentage
|
||||
!== undefined) ? widgetSettings.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Brightness"].alwaysShowPercentage
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstBrightnessReceived: false
|
||||
|
||||
|
|
@ -57,6 +71,23 @@ Item {
|
|||
onTriggered: pill.hide()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].alwaysShowPercentage === undefined
|
||||
&& Settings.data.bar.alwaysShowBatteryPercentage !== undefined) {
|
||||
widgets[sectionWidgetIndex].alwaysShowPercentage = Settings.data.bar.alwaysShowBatteryPercentage
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
|
|
@ -69,6 +100,7 @@ Item {
|
|||
var monitor = getMonitor()
|
||||
return monitor ? (Math.round(monitor.brightness * 100) + "%") : ""
|
||||
}
|
||||
forceOpen: userAlwaysShowPercentage
|
||||
tooltipText: {
|
||||
var monitor = getMonitor()
|
||||
if (!monitor)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,29 @@ Rectangle {
|
|||
property ShellScreen screen
|
||||
property real scaling: 1.0
|
||||
|
||||
// Widget properties passed from Bar.qml for per-instance settings
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
// Resolve per-instance widget settings from Settings.data
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
// Use settings or defaults from BarWidgetRegistry metadata
|
||||
readonly property bool userShowDate: (widgetSettings.showDate
|
||||
!== undefined) ? widgetSettings.showDate : BarWidgetRegistry.widgetMetadata["Clock"].showDate
|
||||
readonly property bool userUse12h: (widgetSettings.use12HourClock !== undefined) ? widgetSettings.use12HourClock : BarWidgetRegistry.widgetMetadata["Clock"].use12HourClock
|
||||
readonly property bool userShowSeconds: (widgetSettings.showSeconds !== undefined) ? widgetSettings.showSeconds : BarWidgetRegistry.widgetMetadata["Clock"].showSeconds
|
||||
|
||||
implicitWidth: clock.width + Style.marginM * 2 * scaling
|
||||
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
||||
radius: Math.round(Style.radiusM * scaling)
|
||||
|
|
@ -20,6 +43,10 @@ Rectangle {
|
|||
id: clock
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
// Per-instance overrides to Time formatting
|
||||
showDate: userShowDate
|
||||
use12h: userUse12h
|
||||
showSeconds: userShowSeconds
|
||||
|
||||
NTooltip {
|
||||
id: tooltip
|
||||
|
|
|
|||
|
|
@ -20,6 +20,28 @@ RowLayout {
|
|||
visible: MediaService.currentPlayer !== null && MediaService.canPlay
|
||||
Layout.preferredWidth: MediaService.currentPlayer !== null && MediaService.canPlay ? implicitWidth : 0
|
||||
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userShowAlbumArt: (widgetSettings.showAlbumArt !== undefined) ? widgetSettings.showAlbumArt : ((Settings.data.audio.showMiniplayerAlbumArt !== undefined) ? Settings.data.audio.showMiniplayerAlbumArt : BarWidgetRegistry.widgetMetadata["MediaMini"].showAlbumArt)
|
||||
readonly property bool userShowVisualizer: (widgetSettings.showVisualizer !== undefined) ? widgetSettings.showVisualizer : ((Settings.data.audio.showMiniplayerCava !== undefined) ? Settings.data.audio.showMiniplayerCava : BarWidgetRegistry.widgetMetadata["MediaMini"].showVisualizer)
|
||||
readonly property string userVisualizerType: (widgetSettings.visualizerType !== undefined
|
||||
&& widgetSettings.visualizerType
|
||||
!== "") ? widgetSettings.visualizerType : ((Settings.data.audio.visualizerType !== undefined
|
||||
&& Settings.data.audio.visualizerType !== "") ? Settings.data.audio.visualizerType : BarWidgetRegistry.widgetMetadata["MediaMini"].visualizerType)
|
||||
|
||||
function getTitle() {
|
||||
return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "")
|
||||
}
|
||||
|
|
@ -58,8 +80,7 @@ RowLayout {
|
|||
Loader {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "linear"
|
||||
&& MediaService.isPlaying
|
||||
active: userShowVisualizer && userVisualizerType == "linear" && MediaService.isPlaying
|
||||
z: 0
|
||||
|
||||
sourceComponent: LinearSpectrum {
|
||||
|
|
@ -74,8 +95,7 @@ RowLayout {
|
|||
Loader {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "mirrored"
|
||||
&& MediaService.isPlaying
|
||||
active: userShowVisualizer && userVisualizerType == "mirrored" && MediaService.isPlaying
|
||||
z: 0
|
||||
|
||||
sourceComponent: MirroredSpectrum {
|
||||
|
|
@ -90,8 +110,7 @@ RowLayout {
|
|||
Loader {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "wave"
|
||||
&& MediaService.isPlaying
|
||||
active: userShowVisualizer && userVisualizerType == "wave" && MediaService.isPlaying
|
||||
z: 0
|
||||
|
||||
sourceComponent: WaveSpectrum {
|
||||
|
|
@ -115,12 +134,12 @@ RowLayout {
|
|||
font.pointSize: Style.fontSizeL * scaling
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: !Settings.data.audio.showMiniplayerAlbumArt && getTitle() !== "" && !trackArt.visible
|
||||
visible: !userShowAlbumArt && getTitle() !== "" && !trackArt.visible
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: Settings.data.audio.showMiniplayerAlbumArt
|
||||
visible: userShowAlbumArt
|
||||
spacing: 0
|
||||
|
||||
Item {
|
||||
|
|
@ -199,6 +218,30 @@ RowLayout {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
var w = widgets[sectionWidgetIndex]
|
||||
if (w.showAlbumArt === undefined && Settings.data.audio.showMiniplayerAlbumArt !== undefined) {
|
||||
w.showAlbumArt = Settings.data.audio.showMiniplayerAlbumArt
|
||||
}
|
||||
if (w.showVisualizer === undefined && Settings.data.audio.showMiniplayerCava !== undefined) {
|
||||
w.showVisualizer = Settings.data.audio.showMiniplayerCava
|
||||
}
|
||||
if ((w.visualizerType === undefined || w.visualizerType === "")
|
||||
&& (Settings.data.audio.visualizerType !== undefined && Settings.data.audio.visualizerType !== "")) {
|
||||
w.visualizerType = Settings.data.audio.visualizerType
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NTooltip {
|
||||
id: tooltip
|
||||
text: {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,20 @@ Item {
|
|||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userAlwaysShowPercentage: (widgetSettings.alwaysShowPercentage
|
||||
!== undefined) ? widgetSettings.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Microphone"].alwaysShowPercentage
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstInputVolumeReceived: false
|
||||
property int wheelAccumulator: 0
|
||||
|
|
@ -69,6 +83,23 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].alwaysShowPercentage === undefined
|
||||
&& Settings.data.bar.alwaysShowBatteryPercentage !== undefined) {
|
||||
widgets[sectionWidgetIndex].alwaysShowPercentage = Settings.data.bar.alwaysShowBatteryPercentage
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
|
|
@ -78,6 +109,7 @@ Item {
|
|||
collapsedIconColor: Color.mOnSurface
|
||||
autoHide: false // Important to be false so we can hover as long as we want
|
||||
text: Math.floor(AudioService.inputVolume * 100) + "%"
|
||||
forceOpen: userAlwaysShowPercentage
|
||||
tooltipText: "Microphone: " + Math.round(AudioService.inputVolume * 100)
|
||||
+ "%\nLeft click for advanced settings.\nScroll up/down to change volume.\nRight click to toggle mute."
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,94 @@ NIconButton {
|
|||
property ShellScreen screen
|
||||
property real scaling: 1.0
|
||||
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userShowUnreadBadge: (widgetSettings.showUnreadBadge !== undefined) ? widgetSettings.showUnreadBadge : BarWidgetRegistry.widgetMetadata["NotificationHistory"].showUnreadBadge
|
||||
readonly property bool userHideWhenZero: (widgetSettings.hideWhenZero !== undefined) ? widgetSettings.hideWhenZero : BarWidgetRegistry.widgetMetadata["NotificationHistory"].hideWhenZero
|
||||
readonly property bool userDoNotDisturb: (widgetSettings.doNotDisturb !== undefined) ? widgetSettings.doNotDisturb : BarWidgetRegistry.widgetMetadata["NotificationHistory"].doNotDisturb
|
||||
|
||||
function lastSeenTs() {
|
||||
return widgetSettings.lastSeenTs || 0
|
||||
}
|
||||
|
||||
function computeUnreadCount() {
|
||||
var since = lastSeenTs()
|
||||
var count = 0
|
||||
var model = NotificationService.historyModel
|
||||
for (var i = 0; i < model.count; i++) {
|
||||
var item = model.get(i)
|
||||
var ts = item.timestamp instanceof Date ? item.timestamp.getTime() : item.timestamp
|
||||
if (ts > since)
|
||||
count++
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
sizeRatio: 0.8
|
||||
icon: Settings.data.notifications.doNotDisturb ? "notifications_off" : "notifications"
|
||||
tooltipText: Settings.data.notifications.doNotDisturb ? "Notification history.\nRight-click to disable 'Do Not Disturb'." : "Notification history.\nRight-click to enable 'Do Not Disturb'."
|
||||
icon: (Settings.data.notifications.doNotDisturb || userDoNotDisturb) ? "notifications_off" : "notifications"
|
||||
tooltipText: (Settings.data.notifications.doNotDisturb
|
||||
|| userDoNotDisturb) ? "Notification history.\nRight-click to disable 'Do Not Disturb'." : "Notification history.\nRight-click to enable 'Do Not Disturb'."
|
||||
colorBg: Color.mSurfaceVariant
|
||||
colorFg: Settings.data.notifications.doNotDisturb ? Color.mError : Color.mOnSurface
|
||||
colorFg: (Settings.data.notifications.doNotDisturb || userDoNotDisturb) ? Color.mError : Color.mOnSurface
|
||||
colorBorder: Color.transparent
|
||||
colorBorderHover: Color.transparent
|
||||
|
||||
onClicked: PanelService.getPanel("notificationHistoryPanel")?.toggle(screen, this)
|
||||
onClicked: {
|
||||
// Open first using current geometry as anchor
|
||||
var panel = PanelService.getPanel("notificationHistoryPanel")
|
||||
panel?.toggle(screen, this)
|
||||
// Update last seen right after to avoid affecting anchor calculation
|
||||
Qt.callLater(function () {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
widgets[sectionWidgetIndex].lastSeenTs = Time.timestamp * 1000
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onRightClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
|
||||
|
||||
Loader {
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.rightMargin: -4 * scaling
|
||||
anchors.topMargin: -4 * scaling
|
||||
z: 2
|
||||
active: userShowUnreadBadge && (!userHideWhenZero || computeUnreadCount() > 0)
|
||||
sourceComponent: Rectangle {
|
||||
width: 16 * scaling
|
||||
height: 16 * scaling
|
||||
radius: width / 2
|
||||
color: Color.mError
|
||||
border.color: Color.mSurface
|
||||
border.width: 1
|
||||
visible: computeUnreadCount() > 0 || !userHideWhenZero
|
||||
NText {
|
||||
anchors.centerIn: parent
|
||||
text: Math.min(computeUnreadCount(), 9)
|
||||
font.pointSize: Style.fontSizeXXS * scaling
|
||||
color: Color.mOnError
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import QtQuick.Effects
|
||||
|
|
@ -10,8 +11,24 @@ NIconButton {
|
|||
|
||||
property ShellScreen screen
|
||||
property real scaling: 1.0
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
icon: Settings.data.bar.useDistroLogo ? "" : "widgets"
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userUseDistroLogo: (widgetSettings.useDistroLogo !== undefined) ? widgetSettings.useDistroLogo : ((Settings.data.bar.useDistroLogo !== undefined) ? Settings.data.bar.useDistroLogo : BarWidgetRegistry.widgetMetadata["SidePanelToggle"].useDistroLogo)
|
||||
|
||||
icon: userUseDistroLogo ? "" : "widgets"
|
||||
tooltipText: "Open side panel."
|
||||
sizeRatio: 0.8
|
||||
|
||||
|
|
@ -24,14 +41,30 @@ NIconButton {
|
|||
onClicked: PanelService.getPanel("sidePanel")?.toggle(screen, this)
|
||||
onRightClicked: PanelService.getPanel("settingsPanel")?.toggle(screen)
|
||||
|
||||
// When enabled, draw the distro logo instead of the icon glyph
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].useDistroLogo === undefined
|
||||
&& Settings.data.bar.useDistroLogo !== undefined) {
|
||||
widgets[sectionWidgetIndex].useDistroLogo = Settings.data.bar.useDistroLogo
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
IconImage {
|
||||
id: logo
|
||||
anchors.centerIn: parent
|
||||
width: root.width * 0.6
|
||||
height: width
|
||||
source: Settings.data.bar.useDistroLogo ? DistroLogoService.osLogo : ""
|
||||
visible: false //Settings.data.bar.useDistroLogo && source !== ""
|
||||
source: userUseDistroLogo ? DistroLogoService.osLogo : ""
|
||||
visible: userUseDistroLogo && source !== ""
|
||||
smooth: true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,44 @@ RowLayout {
|
|||
property ShellScreen screen
|
||||
property real scaling: 1.0
|
||||
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userShowCpuUsage: (widgetSettings.showCpuUsage !== undefined) ? widgetSettings.showCpuUsage : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showCpuUsage
|
||||
readonly property bool userShowCpuTemp: (widgetSettings.showCpuTemp !== undefined) ? widgetSettings.showCpuTemp : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showCpuTemp
|
||||
readonly property bool userShowMemoryUsage: (widgetSettings.showMemoryUsage !== undefined) ? widgetSettings.showMemoryUsage : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showMemoryUsage
|
||||
readonly property bool userShowNetworkStats: (widgetSettings.showNetworkStats
|
||||
!== undefined) ? widgetSettings.showNetworkStats : ((Settings.data.bar.showNetworkStats !== undefined) ? Settings.data.bar.showNetworkStats : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showNetworkStats)
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].showNetworkStats === undefined
|
||||
&& Settings.data.bar.showNetworkStats !== undefined) {
|
||||
widgets[sectionWidgetIndex].showNetworkStats = Settings.data.bar.showNetworkStats
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: Style.marginS * scaling
|
||||
|
||||
|
|
@ -34,6 +72,7 @@ RowLayout {
|
|||
id: cpuUsageLayout
|
||||
spacing: Style.marginXS * scaling
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: userShowCpuUsage
|
||||
|
||||
NIcon {
|
||||
id: cpuUsageIcon
|
||||
|
|
@ -59,6 +98,7 @@ RowLayout {
|
|||
// spacing is thin here to compensate for the vertical thermometer icon
|
||||
spacing: Style.marginXXS * scaling
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: userShowCpuTemp
|
||||
|
||||
NIcon {
|
||||
text: "thermometer"
|
||||
|
|
@ -81,6 +121,7 @@ RowLayout {
|
|||
id: memoryUsageLayout
|
||||
spacing: Style.marginXS * scaling
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: userShowMemoryUsage
|
||||
|
||||
NIcon {
|
||||
text: "memory"
|
||||
|
|
@ -103,7 +144,7 @@ RowLayout {
|
|||
id: networkDownloadLayout
|
||||
spacing: Style.marginXS * scaling
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: Settings.data.bar.showNetworkStats
|
||||
visible: userShowNetworkStats
|
||||
|
||||
NIcon {
|
||||
text: "download"
|
||||
|
|
@ -126,7 +167,7 @@ RowLayout {
|
|||
id: networkUploadLayout
|
||||
spacing: Style.marginXS * scaling
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: Settings.data.bar.showNetworkStats
|
||||
visible: userShowNetworkStats
|
||||
|
||||
NIcon {
|
||||
text: "upload"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,19 @@ Item {
|
|||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
readonly property bool userAlwaysShowPercentage: (widgetSettings.alwaysShowPercentage
|
||||
!== undefined) ? widgetSettings.alwaysShowPercentage : ((Settings.data.bar.alwaysShowBatteryPercentage !== undefined) ? Settings.data.bar.alwaysShowBatteryPercentage : BarWidgetRegistry.widgetMetadata["Volume"].alwaysShowPercentage)
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstVolumeReceived: false
|
||||
property int wheelAccumulator: 0
|
||||
|
|
@ -54,6 +67,23 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].alwaysShowPercentage === undefined
|
||||
&& Settings.data.bar.alwaysShowBatteryPercentage !== undefined) {
|
||||
widgets[sectionWidgetIndex].alwaysShowPercentage = Settings.data.bar.alwaysShowBatteryPercentage
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
|
|
@ -63,6 +93,7 @@ Item {
|
|||
collapsedIconColor: Color.mOnSurface
|
||||
autoHide: false // Important to be false so we can hover as long as we want
|
||||
text: Math.floor(AudioService.volume * 100) + "%"
|
||||
forceOpen: userAlwaysShowPercentage
|
||||
tooltipText: "Volume: " + Math.round(AudioService.volume * 100)
|
||||
+ "%\nLeft click for advanced settings.\nScroll up/down to change volume.\nRight click to toggle mute."
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,23 @@ Item {
|
|||
property ShellScreen screen
|
||||
property real scaling: 1.0
|
||||
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
readonly property string userLabelMode: (widgetSettings.labelMode !== undefined) ? widgetSettings.labelMode : ((Settings.data.bar.showWorkspaceLabel !== undefined) ? Settings.data.bar.showWorkspaceLabel : BarWidgetRegistry.widgetMetadata["Workspace"].labelMode)
|
||||
|
||||
property bool isDestroying: false
|
||||
property bool hovered: false
|
||||
|
||||
|
|
@ -50,6 +67,20 @@ Item {
|
|||
|
||||
Component.onCompleted: {
|
||||
refreshWorkspaces()
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].labelMode === undefined
|
||||
&& Settings.data.bar.showWorkspaceLabel !== undefined) {
|
||||
widgets[sectionWidgetIndex].labelMode = Settings.data.bar.showWorkspaceLabel
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
|
|
@ -145,7 +176,7 @@ Item {
|
|||
model: localWorkspaces
|
||||
Item {
|
||||
id: workspacePillContainer
|
||||
height: (Settings.data.bar.showWorkspaceLabel !== "none") ? Math.round(18 * scaling) : Math.round(14 * scaling)
|
||||
height: (userLabelMode !== "none") ? Math.round(18 * scaling) : Math.round(14 * scaling)
|
||||
width: root.calculatedWsWidth(model)
|
||||
|
||||
Rectangle {
|
||||
|
|
@ -153,15 +184,13 @@ Item {
|
|||
anchors.fill: parent
|
||||
|
||||
Loader {
|
||||
active: (Settings.data.bar.showWorkspaceLabel !== "none")
|
||||
active: (userLabelMode !== "none")
|
||||
sourceComponent: Component {
|
||||
Text {
|
||||
// Center horizontally
|
||||
x: (pill.width - width) / 2
|
||||
// Center vertically accounting for font metrics
|
||||
y: (pill.height - height) / 2 + (height - contentHeight) / 2
|
||||
text: {
|
||||
if (Settings.data.bar.showWorkspaceLabel === "name" && model.name && model.name.length > 0) {
|
||||
if (userLabelMode === "name" && model.name && model.name.length > 0) {
|
||||
return model.name.substring(0, 2)
|
||||
} else {
|
||||
return model.idx.toString()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue