mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
NPill: allow to open left or right depending on
This commit is contained in:
+12
-3
@@ -65,7 +65,10 @@ Variants {
|
||||
delegate: NWidgetLoader {
|
||||
widgetName: modelData
|
||||
widgetProps: {
|
||||
"screen": root.modelData || null
|
||||
"screen": root.modelData || null,
|
||||
"barSection": parent.objectName,
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.left.length
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
@@ -87,7 +90,10 @@ Variants {
|
||||
delegate: NWidgetLoader {
|
||||
widgetName: modelData
|
||||
widgetProps: {
|
||||
"screen": root.modelData || null
|
||||
"screen": root.modelData || null,
|
||||
"barSection": parent.objectName,
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.center.length
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
@@ -110,7 +116,10 @@ Variants {
|
||||
delegate: NWidgetLoader {
|
||||
widgetName: modelData
|
||||
widgetProps: {
|
||||
"screen": root.modelData || null
|
||||
"screen": root.modelData || null,
|
||||
"barSection": parent.objectName,
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.right.length
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
@@ -8,14 +8,20 @@ import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
implicitWidth: pill.width
|
||||
implicitHeight: pill.height
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
// Track if we've already notified to avoid spam
|
||||
property bool hasNotifiedLowBattery: false
|
||||
|
||||
implicitWidth: pill.width
|
||||
implicitHeight: pill.height
|
||||
|
||||
|
||||
// Helper to evaluate and possibly notify
|
||||
function maybeNotify(percent, charging) {
|
||||
const p = Math.round(percent)
|
||||
@@ -57,8 +63,9 @@ Item {
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
// Test mode
|
||||
property bool testMode: false
|
||||
property bool testMode: true
|
||||
property int testPercent: 20
|
||||
property bool testCharging: false
|
||||
property var battery: UPower.displayDevice
|
||||
@@ -91,8 +98,9 @@ Item {
|
||||
return "battery_android_0"
|
||||
}
|
||||
|
||||
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
||||
icon: batteryIcon()
|
||||
text: (isReady && battery.isLaptopBattery) ? Math.round(percent) + "%" : "-"
|
||||
text: ((isReady && battery.isLaptopBattery) || testMode) ? Math.round(percent) + "%" : "-"
|
||||
textColor: charging ? Color.mPrimary : Color.mOnSurface
|
||||
iconCircleColor: Color.mPrimary
|
||||
collapsedIconColor: Color.mOnSurface
|
||||
|
||||
@@ -10,6 +10,9 @@ Item {
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstBrightnessReceived: false
|
||||
@@ -58,6 +61,8 @@ Item {
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
||||
icon: getIcon()
|
||||
iconCircleColor: Color.mPrimary
|
||||
collapsedIconColor: Color.mOnSurface
|
||||
|
||||
@@ -11,6 +11,9 @@ Row {
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
// Use the shared service for keyboard layout
|
||||
property string currentLayout: KeyboardLayoutService.currentLayout
|
||||
@@ -20,6 +23,8 @@ Row {
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
||||
icon: "keyboard_alt"
|
||||
iconCircleColor: Color.mPrimary
|
||||
collapsedIconColor: Color.mOnSurface
|
||||
|
||||
@@ -12,6 +12,9 @@ Item {
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstVolumeReceived: false
|
||||
@@ -53,6 +56,8 @@ Item {
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
||||
icon: getIcon()
|
||||
iconCircleColor: Color.mPrimary
|
||||
collapsedIconColor: Color.mOnSurface
|
||||
|
||||
Reference in New Issue
Block a user