This commit is contained in:
Ly-sec
2025-11-22 18:04:56 +01:00
20 changed files with 1108 additions and 394 deletions
+12 -1
View File
@@ -46,6 +46,7 @@ Item {
readonly property string labelMode: (widgetSettings.labelMode !== undefined) ? widgetSettings.labelMode : widgetMetadata.labelMode
readonly property bool hideUnoccupied: (widgetSettings.hideUnoccupied !== undefined) ? widgetSettings.hideUnoccupied : widgetMetadata.hideUnoccupied
readonly property bool followFocusedScreen: (widgetSettings.followFocusedScreen !== undefined) ? widgetSettings.followFocusedScreen : widgetMetadata.followFocusedScreen
readonly property int characterCount: isVertical ? 2 : ((widgetSettings.characterCount !== undefined) ? widgetSettings.characterCount : widgetMetadata.characterCount)
property bool isDestroying: false
@@ -162,10 +163,20 @@ Item {
function refreshWorkspaces() {
localWorkspaces.clear();
var focusedOutput = null;
if (followFocusedScreen) {
for (var i = 0; i < CompositorService.workspaces.count; i++) {
const ws = CompositorService.workspaces.get(i);
if (ws.isFocused) focusedOutput = ws.output.toLowerCase();
}
}
if (screen !== null) {
for (var i = 0; i < CompositorService.workspaces.count; i++) {
const ws = CompositorService.workspaces.get(i);
if (ws.output.toLowerCase() === screen.name.toLowerCase()) {
if ((followFocusedScreen && ws.output.toLowerCase() == focusedOutput) ||
(!followFocusedScreen && ws.output.toLowerCase() == screen.name.toLowerCase())) {
if (hideUnoccupied && !ws.isOccupied && !ws.isFocused) {
continue;
}
+12 -8
View File
@@ -28,13 +28,13 @@ SmartPanel {
return I18n.tr("battery.no-battery-detected");
if (charging && battery.timeToFull > 0) {
return I18n.tr("battery.time-until-full", {
"time": Time.formatVagueHumanReadableDuration(battery.timeToFull)
});
"time": Time.formatVagueHumanReadableDuration(battery.timeToFull)
});
}
if (!charging && battery.timeToEmpty > 0) {
return I18n.tr("battery.time-left", {
"time": Time.formatVagueHumanReadableDuration(battery.timeToEmpty)
});
"time": Time.formatVagueHumanReadableDuration(battery.timeToEmpty)
});
}
return I18n.tr("battery.idle");
}
@@ -154,7 +154,9 @@ SmartPanel {
visible: healthAvailable
NText {
text: I18n.tr("battery.health", {"percent": healthPercent})
text: I18n.tr("battery.health", {
"percent": healthPercent
})
color: Color.mOnSurface
pointSize: Style.fontSizeS
font.weight: Style.fontWeightMedium
@@ -179,7 +181,9 @@ SmartPanel {
Layout.fillWidth: true
spacing: Style.marginS
NIcon {
icon: PowerProfileService.getIcon(); pointSize: Style.fontSizeM; color: Color.mPrimary
icon: PowerProfileService.getIcon()
pointSize: Style.fontSizeM
color: Color.mPrimary
}
NText {
text: I18n.tr("battery.power-profile")
@@ -188,7 +192,7 @@ SmartPanel {
Layout.fillWidth: true
}
NText {
text: PowerProfileService.getName()
text: PowerProfileService.getName(profileIndex)
color: Color.mOnSurfaceVariant
}
}
@@ -273,7 +277,7 @@ SmartPanel {
interval: 1000
repeat: true
running: true
onTriggered: manualInhibitActive = manualInhibitorEnabled();
onTriggered: manualInhibitActive = manualInhibitorEnabled()
}
Connections {
@@ -14,6 +14,7 @@ ColumnLayout {
property string valueLabelMode: widgetData.labelMode !== undefined ? widgetData.labelMode : widgetMetadata.labelMode
property bool valueHideUnoccupied: widgetData.hideUnoccupied !== undefined ? widgetData.hideUnoccupied : widgetMetadata.hideUnoccupied
property bool valueFollowFocusedScreen: widgetData.followFocusedScreen !== undefined ? widgetData.followFocusedScreen : widgetMetadata.followFocusedScreen
property int valueCharacterCount: widgetData.characterCount !== undefined ? widgetData.characterCount : widgetMetadata.characterCount
function saveSettings() {
@@ -21,6 +22,7 @@ ColumnLayout {
settings.labelMode = valueLabelMode;
settings.hideUnoccupied = valueHideUnoccupied;
settings.characterCount = valueCharacterCount;
settings.followFocusedScreen = valueFollowFocusedScreen;
return settings;
}
@@ -51,6 +53,13 @@ ColumnLayout {
minimumWidth: 200
}
NToggle {
label: I18n.tr("bar.widget-settings.workspace.follow-focused-screen.label")
description: I18n.tr("bar.widget-settings.workspace.follow-focused-screen.description")
checked: valueFollowFocusedScreen
onToggled: checked => valueFollowFocusedScreen = checked
}
NToggle {
label: I18n.tr("bar.widget-settings.workspace.hide-unoccupied.label")
description: I18n.tr("bar.widget-settings.workspace.hide-unoccupied.description")
@@ -853,7 +853,6 @@ ColumnLayout {
}
}
}
}
// Miscellaneous
NCollapsible {