1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

i18n: general term cleanup, add missing terms, interpolate some

This commit is contained in:
bbedward
2025-12-18 16:19:27 -05:00
parent baf23157fc
commit 2a91bc41f7
30 changed files with 1540 additions and 421 deletions

View File

@@ -12,7 +12,7 @@ PluginComponent {
}
ccWidgetIcon: DMSNetworkService.isBusy ? "sync" : (DMSNetworkService.connected ? "vpn_lock" : "vpn_key_off")
ccWidgetPrimaryText: "VPN"
ccWidgetPrimaryText: I18n.tr("VPN")
ccWidgetSecondaryText: {
if (!DMSNetworkService.connected)
return I18n.tr("Disconnected");

View File

@@ -51,13 +51,13 @@ Rectangle {
spacing: 2
Typography {
text: UserInfoService.fullName || UserInfoService.username || "User"
text: UserInfoService.fullName || UserInfoService.username || I18n.tr("User")
style: Typography.Style.Subtitle
color: Theme.surfaceText
}
Typography {
text: DgopService.uptime || "Unknown"
text: DgopService.uptime || I18n.tr("Unknown")
style: Typography.Style.Caption
color: Theme.surfaceVariantText
}

View File

@@ -201,7 +201,7 @@ Rectangle {
}
StyledText {
text: modelData === AudioService.source ? "Active" : "Available"
text: modelData === AudioService.source ? I18n.tr("Active") : I18n.tr("Available")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
elide: Text.ElideRight
@@ -241,7 +241,7 @@ Rectangle {
StyledText {
text: {
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name;
return isThisDevicePinned ? "Pinned" : "Pin";
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin");
}
font.pixelSize: Theme.fontSizeSmall
color: {

View File

@@ -211,7 +211,7 @@ Rectangle {
}
StyledText {
text: modelData === AudioService.sink ? "Active" : "Available"
text: modelData === AudioService.sink ? I18n.tr("Active") : I18n.tr("Available")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
elide: Text.ElideRight
@@ -251,7 +251,7 @@ Rectangle {
StyledText {
text: {
const isThisDevicePinned = (SettingsData.audioOutputDevicePins || {})["preferredOutput"] === modelData.name;
return isThisDevicePinned ? "Pinned" : "Pin";
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin");
}
font.pixelSize: Theme.fontSizeSmall
color: {

View File

@@ -1,6 +1,4 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Services.UPower
import qs.Common
import qs.Services
@@ -66,7 +64,7 @@ Rectangle {
spacing: Theme.spacingS
StyledText {
text: BatteryService.batteryAvailable ? `${BatteryService.batteryLevel}%` : "Power"
text: BatteryService.batteryAvailable ? `${BatteryService.batteryLevel}%` : I18n.tr("Power")
font.pixelSize: Theme.fontSizeXLarge
color: {
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
@@ -81,7 +79,7 @@ Rectangle {
}
StyledText {
text: BatteryService.batteryAvailable ? BatteryService.batteryStatus : "Management"
text: BatteryService.batteryAvailable ? BatteryService.batteryStatus : I18n.tr("Management")
font.pixelSize: Theme.fontSizeLarge
color: {
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
@@ -100,10 +98,10 @@ Rectangle {
StyledText {
text: {
if (!BatteryService.batteryAvailable)
return "Power profile management available";
return I18n.tr("Power profile management available");
const time = BatteryService.formatTimeRemaining();
if (time !== "Unknown") {
return BatteryService.isCharging ? `Time until full: ${time}` : `Time remaining: ${time}`;
return BatteryService.isCharging ? I18n.tr("Time until full: %1").arg(time) : I18n.tr("Time remaining: %1").arg(time);
}
return "";
}
@@ -176,7 +174,7 @@ Rectangle {
}
StyledText {
text: BatteryService.batteryCapacity > 0 ? `${BatteryService.batteryCapacity.toFixed(1)} Wh` : "Unknown"
text: BatteryService.batteryCapacity > 0 ? `${BatteryService.batteryCapacity.toFixed(1)} Wh` : I18n.tr("Unknown")
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Bold

View File

@@ -1,7 +1,4 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
import qs.Widgets
@@ -42,7 +39,7 @@ Item {
if (!device)
return;
BluetoothService.getAvailableCodecs(device, function(codecs, current) {
BluetoothService.getAvailableCodecs(device, function (codecs, current) {
availableCodecs = codecs;
currentCodec = current;
isLoading = false;
@@ -60,7 +57,7 @@ Item {
}
isLoading = true;
BluetoothService.switchCodec(device, profileName, function(success, message) {
BluetoothService.switchCodec(device, profileName, function (success, message) {
isLoading = false;
if (success) {
ToastService.showToast(message, ToastService.levelInfo);
@@ -85,8 +82,12 @@ Item {
propagateComposedEvents: false
onClicked: root.hide()
onWheel: (wheel) => { wheel.accepted = true }
onPositionChanged: (mouse) => { mouse.accepted = true }
onWheel: wheel => {
wheel.accepted = true;
}
onPositionChanged: mouse => {
mouse.accepted = true;
}
}
Rectangle {
@@ -111,8 +112,8 @@ Item {
enabled: root.visible
Keys.onEscapePressed: {
root.hide()
event.accepted = true
root.hide();
event.accepted = true;
}
}
@@ -133,9 +134,15 @@ Item {
hoverEnabled: true
preventStealing: true
propagateComposedEvents: false
onClicked: (mouse) => { mouse.accepted = true }
onWheel: (wheel) => { wheel.accepted = true }
onPositionChanged: (mouse) => { mouse.accepted = true }
onClicked: mouse => {
mouse.accepted = true;
}
onWheel: wheel => {
wheel.accepted = true;
}
onPositionChanged: mouse => {
mouse.accepted = true;
}
}
Column {
@@ -174,9 +181,7 @@ Item {
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceTextMedium
}
}
}
Rectangle {
@@ -186,7 +191,7 @@ Item {
}
StyledText {
text: isLoading ? "Loading codecs..." : `Current: ${currentCodec}`
text: isLoading ? I18n.tr("Loading codecs...") : I18n.tr("Current: %1").arg(currentCodec)
font.pixelSize: Theme.fontSizeSmall
color: isLoading ? Theme.primary : Theme.surfaceTextMedium
font.weight: Font.Medium
@@ -245,9 +250,7 @@ Item {
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceTextMedium
}
}
}
DankIcon {
@@ -271,14 +274,9 @@ Item {
selectCodec(modelData.profile);
}
}
}
}
}
}
Behavior on opacity {
@@ -286,7 +284,6 @@ Item {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on scale {
@@ -294,8 +291,6 @@ Item {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
}
}

View File

@@ -113,7 +113,7 @@ Rectangle {
}
StyledText {
text: BluetoothService.adapter && BluetoothService.adapter.discovering ? "Scanning" : "Scan"
text: BluetoothService.adapter && BluetoothService.adapter.discovering ? I18n.tr("Scanning") : I18n.tr("Scan")
color: BluetoothService.adapter && BluetoothService.adapter.enabled ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
@@ -231,7 +231,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.name || modelData.deviceName || "Unknown Device"
text: modelData.name || modelData.deviceName || I18n.tr("Unknown Device")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: modelData.connected ? Font.Medium : Font.Normal
@@ -245,15 +245,15 @@ Rectangle {
StyledText {
text: {
if (modelData.state === BluetoothDeviceState.Connecting)
return "Connecting..."
return I18n.tr("Connecting...")
if (modelData.connected) {
let status = "Connected"
let status = I18n.tr("Connected")
if (currentCodec) {
status += " • " + currentCodec
}
return status
}
return "Paired"
return I18n.tr("Paired")
}
font.pixelSize: Theme.fontSizeSmall
color: {
@@ -320,7 +320,7 @@ Rectangle {
StyledText {
text: {
const isThisDevicePinned = (SettingsData.bluetoothDevicePins || {})["preferredDevice"] === modelData.address
return isThisDevicePinned ? "Pinned" : "Pin"
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin")
}
font.pixelSize: Theme.fontSizeSmall
color: {
@@ -458,7 +458,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.name || modelData.deviceName || "Unknown Device"
text: modelData.name || modelData.deviceName || I18n.tr("Unknown Device")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
elide: Text.ElideRight
@@ -470,8 +470,8 @@ Rectangle {
StyledText {
text: {
if (modelData.pairing || isBusy) return "Pairing..."
if (modelData.blocked) return "Blocked"
if (modelData.pairing || isBusy) return I18n.tr("Pairing...")
if (modelData.blocked) return I18n.tr("Blocked")
return BluetoothService.getSignalStrength(modelData)
}
font.pixelSize: Theme.fontSizeSmall
@@ -493,9 +493,9 @@ Rectangle {
anchors.rightMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter
text: {
if (isBusy) return "Pairing..."
if (!canConnect) return "Cannot pair"
return "Pair"
if (isBusy) return I18n.tr("Pairing...")
if (!canConnect) return I18n.tr("Cannot pair")
return I18n.tr("Pair")
}
font.pixelSize: Theme.fontSizeSmall
color: (canConnect && !isBusy) ? Theme.primary : Theme.surfaceVariantText
@@ -546,7 +546,7 @@ Rectangle {
}
MenuItem {
text: bluetoothContextMenu.currentDevice && bluetoothContextMenu.currentDevice.connected ? "Disconnect" : "Connect"
text: bluetoothContextMenu.currentDevice && bluetoothContextMenu.currentDevice.connected ? I18n.tr("Disconnect") : I18n.tr("Connect")
height: 32
contentItem: StyledText {

View File

@@ -141,7 +141,7 @@ Rectangle {
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
text: DisplayService.brightnessAvailable ? "No brightness devices available" : "Brightness control not available"
text: DisplayService.brightnessAvailable ? I18n.tr("No brightness devices available") : I18n.tr("Brightness control not available")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
horizontalAlignment: Text.AlignHCenter
@@ -173,7 +173,7 @@ Rectangle {
}
StyledText {
text: root.getScreenPinKey() || "Unknown Monitor"
text: root.getScreenPinKey() || I18n.tr("Unknown Monitor")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
@@ -201,7 +201,7 @@ Rectangle {
}
StyledText {
text: isPinnedToScreen ? "Pinned" : "Pin"
text: isPinnedToScreen ? I18n.tr("Pinned") : I18n.tr("Pin")
font.pixelSize: Theme.fontSizeSmall
color: isPinnedToScreen ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
@@ -317,11 +317,11 @@ Rectangle {
text: {
const deviceClass = modelData.class || "";
if (deviceClass === "backlight")
return "Backlight device";
return I18n.tr("Backlight device");
if (deviceClass === "ddc")
return "DDC/CI monitor";
return I18n.tr("DDC/CI monitor");
if (deviceClass === "leds")
return "LED device";
return I18n.tr("LED device");
return deviceClass;
}
font.pixelSize: Theme.fontSizeSmall
@@ -430,7 +430,7 @@ Rectangle {
}
StyledText {
text: SessionData.getBrightnessExponential(modelData.name) ? "Exponential" : "Linear"
text: SessionData.getBrightnessExponential(modelData.name) ? I18n.tr("Exponential") : I18n.tr("Linear")
font.pixelSize: Theme.fontSizeSmall
color: SessionData.getBrightnessExponential(modelData.name) ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter

View File

@@ -1,6 +1,4 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
@@ -20,11 +18,11 @@ Rectangle {
border.width: 0
Component.onCompleted: {
DgopService.addRef(["diskmounts"])
DgopService.addRef(["diskmounts"]);
}
Component.onDestruction: {
DgopService.removeRef(["diskmounts"])
DgopService.removeRef(["diskmounts"]);
}
DankFlickable {
@@ -61,7 +59,7 @@ Rectangle {
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
text: DgopService.dgopAvailable ? "No disk data available" : "dgop not available"
text: DgopService.dgopAvailable ? I18n.tr("No disk data available") : I18n.tr("dgop not available")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
horizontalAlignment: Text.AlignHCenter
@@ -96,20 +94,22 @@ Rectangle {
name: "storage"
size: Theme.iconSize
color: {
const percentStr = modelData.percent?.replace("%", "") || "0"
const percent = parseFloat(percentStr) || 0
if (percent > 90) return Theme.error
if (percent > 75) return Theme.warning
return modelData.mount === currentMountPath ? Theme.primary : Theme.surfaceText
const percentStr = modelData.percent?.replace("%", "") || "0";
const percent = parseFloat(percentStr) || 0;
if (percent > 90)
return Theme.error;
if (percent > 75)
return Theme.warning;
return modelData.mount === currentMountPath ? Theme.primary : Theme.surfaceText;
}
anchors.horizontalCenter: parent.horizontalCenter
}
StyledText {
text: {
const percentStr = modelData.percent?.replace("%", "") || "0"
const percent = parseFloat(percentStr) || 0
return percent.toFixed(0) + "%"
const percentStr = modelData.percent?.replace("%", "") || "0";
const percent = parseFloat(percentStr) || 0;
return percent.toFixed(0) + "%";
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
@@ -122,7 +122,7 @@ Rectangle {
width: parent.parent.width - parent.parent.anchors.leftMargin - parent.spacing - 50 - Theme.spacingM
StyledText {
text: modelData.mount === "/" ? "Root Filesystem" : modelData.mount
text: modelData.mount === "/" ? I18n.tr("Root Filesystem") : modelData.mount
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: modelData.mount === currentMountPath ? Font.Medium : Font.Normal
@@ -154,11 +154,10 @@ Rectangle {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
currentMountPath = modelData.mount
mountPathChanged(modelData.mount)
currentMountPath = modelData.mount;
mountPathChanged(modelData.mount);
}
}
}
}
}

View File

@@ -118,7 +118,7 @@ Rectangle {
buttonHeight: 28
textSize: Theme.fontSizeSmall
model: ["Ethernet", "WiFi"]
model: [I18n.tr("Ethernet"), I18n.tr("WiFi")]
currentIndex: currentPreferenceIndex
selectionMode: "single"
onSelectionChanged: (index, selected) => {
@@ -173,7 +173,7 @@ Rectangle {
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
text: NetworkService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
text: NetworkService.wifiEnabled ? I18n.tr("Disabling WiFi...") : I18n.tr("Enabling WiFi...")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
horizontalAlignment: Text.AlignHCenter
@@ -303,7 +303,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.id || "Unknown Config"
text: modelData.id || I18n.tr("Unknown Config")
font.pixelSize: Theme.fontSizeMedium
color: modelData.isActive ? Theme.primary : Theme.surfaceText
font.weight: modelData.isActive ? Font.Medium : Font.Normal
@@ -549,7 +549,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.ssid || "Unknown Network"
text: modelData.ssid || I18n.tr("Unknown Network")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: modelData.ssid === NetworkService.currentWifiSSID ? Font.Medium : Font.Normal
@@ -561,13 +561,13 @@ Rectangle {
spacing: Theme.spacingXS
StyledText {
text: modelData.ssid === NetworkService.currentWifiSSID ? "Connected •" : (modelData.secured ? "Secured •" : "Open •")
text: modelData.ssid === NetworkService.currentWifiSSID ? I18n.tr("Connected") + " •" : (modelData.secured ? I18n.tr("Secured") + " •" : I18n.tr("Open") + " •")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: modelData.saved ? "Saved" : ""
text: modelData.saved ? I18n.tr("Saved") : ""
font.pixelSize: Theme.fontSizeSmall
color: Theme.primary
visible: text.length > 0
@@ -635,7 +635,7 @@ Rectangle {
StyledText {
text: {
const isThisNetworkPinned = (SettingsData.wifiNetworkPins || {})["preferredWifi"] === modelData.ssid;
return isThisNetworkPinned ? "Pinned" : "Pin";
return isThisNetworkPinned ? I18n.tr("Pinned") : I18n.tr("Pin");
}
font.pixelSize: Theme.fontSizeSmall
color: {
@@ -714,7 +714,7 @@ Rectangle {
}
MenuItem {
text: networkContextMenu.currentConnected ? "Disconnect" : "Connect"
text: networkContextMenu.currentConnected ? I18n.tr("Disconnect") : I18n.tr("Connect")
height: 32
contentItem: StyledText {

View File

@@ -65,141 +65,141 @@ QtObject {
readonly property var coreWidgetDefinitions: [
{
"id": "nightMode",
"text": "Night Mode",
"description": "Blue light filter",
"text": I18n.tr("Night Mode"),
"description": I18n.tr("Blue light filter"),
"icon": "nightlight",
"type": "toggle",
"enabled": DisplayService.automationAvailable,
"warning": !DisplayService.automationAvailable ? "Requires night mode support" : undefined
"warning": !DisplayService.automationAvailable ? I18n.tr("Requires night mode support") : undefined
},
{
"id": "darkMode",
"text": "Dark Mode",
"description": "System theme toggle",
"text": I18n.tr("Dark Mode"),
"description": I18n.tr("System theme toggle"),
"icon": "contrast",
"type": "toggle",
"enabled": true
},
{
"id": "doNotDisturb",
"text": "Do Not Disturb",
"description": "Block notifications",
"text": I18n.tr("Do Not Disturb"),
"description": I18n.tr("Block notifications"),
"icon": "do_not_disturb_on",
"type": "toggle",
"enabled": true
},
{
"id": "idleInhibitor",
"text": "Keep Awake",
"description": "Prevent screen timeout",
"text": I18n.tr("Keep Awake"),
"description": I18n.tr("Prevent screen timeout"),
"icon": "motion_sensor_active",
"type": "toggle",
"enabled": true
},
{
"id": "wifi",
"text": "Network",
"description": "Wi-Fi and Ethernet connection",
"text": I18n.tr("Network"),
"description": I18n.tr("Wi-Fi and Ethernet connection"),
"icon": "wifi",
"type": "connection",
"enabled": NetworkService.wifiAvailable,
"warning": !NetworkService.wifiAvailable ? "Wi-Fi not available" : undefined
"warning": !NetworkService.wifiAvailable ? I18n.tr("Wi-Fi not available") : undefined
},
{
"id": "bluetooth",
"text": "Bluetooth",
"description": "Device connections",
"text": I18n.tr("Bluetooth"),
"description": I18n.tr("Device connections"),
"icon": "bluetooth",
"type": "connection",
"enabled": BluetoothService.available,
"warning": !BluetoothService.available ? "Bluetooth not available" : undefined
"warning": !BluetoothService.available ? I18n.tr("Bluetooth not available") : undefined
},
{
"id": "audioOutput",
"text": "Audio Output",
"description": "Speaker settings",
"text": I18n.tr("Audio Output"),
"description": I18n.tr("Speaker settings"),
"icon": "volume_up",
"type": "connection",
"enabled": true
},
{
"id": "audioInput",
"text": "Audio Input",
"description": "Microphone settings",
"text": I18n.tr("Audio Input"),
"description": I18n.tr("Microphone settings"),
"icon": "mic",
"type": "connection",
"enabled": true
},
{
"id": "volumeSlider",
"text": "Volume Slider",
"description": "Audio volume control",
"text": I18n.tr("Volume Slider"),
"description": I18n.tr("Audio volume control"),
"icon": "volume_up",
"type": "slider",
"enabled": true
},
{
"id": "brightnessSlider",
"text": "Brightness Slider",
"description": "Display brightness control",
"text": I18n.tr("Brightness Slider"),
"description": I18n.tr("Display brightness control"),
"icon": "brightness_6",
"type": "slider",
"enabled": DisplayService.brightnessAvailable,
"warning": !DisplayService.brightnessAvailable ? "Brightness control not available" : undefined,
"warning": !DisplayService.brightnessAvailable ? I18n.tr("Brightness control not available") : undefined,
"allowMultiple": true
},
{
"id": "inputVolumeSlider",
"text": "Input Volume Slider",
"description": "Microphone volume control",
"text": I18n.tr("Input Volume Slider"),
"description": I18n.tr("Microphone volume control"),
"icon": "mic",
"type": "slider",
"enabled": true
},
{
"id": "battery",
"text": "Battery",
"description": "Battery and power management",
"text": I18n.tr("Battery"),
"description": I18n.tr("Battery and power management"),
"icon": "battery_std",
"type": "action",
"enabled": true
},
{
"id": "diskUsage",
"text": "Disk Usage",
"description": "Filesystem usage monitoring",
"text": I18n.tr("Disk Usage"),
"description": I18n.tr("Filesystem usage monitoring"),
"icon": "storage",
"type": "action",
"enabled": DgopService.dgopAvailable,
"warning": !DgopService.dgopAvailable ? "Requires 'dgop' tool" : undefined,
"warning": !DgopService.dgopAvailable ? I18n.tr("Requires 'dgop' tool") : undefined,
"allowMultiple": true
},
{
"id": "colorPicker",
"text": "Color Picker",
"description": "Choose colors from palette",
"text": I18n.tr("Color Picker"),
"description": I18n.tr("Choose colors from palette"),
"icon": "palette",
"type": "action",
"enabled": true
},
{
"id": "builtin_vpn",
"text": "VPN",
"description": "VPN connections",
"text": I18n.tr("VPN"),
"description": I18n.tr("VPN connections"),
"icon": "vpn_key",
"type": "builtin_plugin",
"enabled": DMSNetworkService.available,
"warning": !DMSNetworkService.available ? "VPN not available" : undefined,
"warning": !DMSNetworkService.available ? I18n.tr("VPN not available") : undefined,
"isBuiltinPlugin": true
},
{
"id": "builtin_cups",
"text": "Printers",
"description": "Print Server Management",
"text": I18n.tr("Printers"),
"description": I18n.tr("Print Server Management"),
"icon": "Print",
"type": "builtin_plugin",
"enabled": CupsService.available,
"warning": !CupsService.available ? "CUPS not available" : undefined,
"warning": !CupsService.available ? I18n.tr("CUPS not available") : undefined,
"isBuiltinPlugin": true
}
]
@@ -235,7 +235,7 @@ QtObject {
plugins.push({
"id": "plugin_" + plugin.id,
"pluginId": plugin.id,
"text": plugin.name || "Plugin",
"text": plugin.name || I18n.tr("Plugin"),
"description": plugin.description || "",
"icon": plugin.icon || "extension",
"type": "plugin",

View File

@@ -1,8 +1,6 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.ControlCenter.Widgets
CompoundPill {
@@ -14,35 +12,35 @@ CompoundPill {
primaryText: {
if (!BatteryService.batteryAvailable) {
return "No battery"
return I18n.tr("No battery");
}
return "Battery"
return I18n.tr("Battery");
}
secondaryText: {
if (!BatteryService.batteryAvailable) {
return "Not available"
return I18n.tr("Not available");
}
if (BatteryService.isCharging) {
return `${BatteryService.batteryLevel}% Charging`
return `${BatteryService.batteryLevel}% ` + I18n.tr("Charging");
}
if (BatteryService.isPluggedIn) {
return `${BatteryService.batteryLevel}% Plugged in`
return `${BatteryService.batteryLevel}% ` + I18n.tr("Plugged in");
}
return `${BatteryService.batteryLevel}%`
return `${BatteryService.batteryLevel}%`;
}
iconColor: {
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
return Theme.error
return Theme.error;
}
if (BatteryService.isCharging || BatteryService.isPluggedIn) {
return Theme.primary
return Theme.primary;
}
return Theme.surfaceText
return Theme.surfaceText;
}
onToggled: {
expandClicked()
expandClicked();
}
}

View File

@@ -1,9 +1,5 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.ControlCenter.Widgets
CompoundPill {
@@ -14,20 +10,20 @@ CompoundPill {
isActive: true
iconName: "palette"
iconColor: Theme.primary
primaryText: "Color Picker"
secondaryText: "Choose a color"
primaryText: I18n.tr("Color Picker")
secondaryText: I18n.tr("Choose a color")
onToggled: {
console.log("ColorPickerPill toggled, modal:", colorPickerModal)
console.log("ColorPickerPill toggled, modal:", colorPickerModal);
if (colorPickerModal) {
colorPickerModal.show()
colorPickerModal.show();
}
}
onExpandClicked: {
console.log("ColorPickerPill expandClicked, modal:", colorPickerModal)
console.log("ColorPickerPill expandClicked, modal:", colorPickerModal);
if (colorPickerModal) {
colorPickerModal.show()
colorPickerModal.show();
}
}
}

View File

@@ -1,8 +1,6 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.ControlCenter.Widgets
CompoundPill {
@@ -15,64 +13,64 @@ CompoundPill {
property var selectedMount: {
if (!DgopService.diskMounts || DgopService.diskMounts.length === 0) {
return null
return null;
}
const targetMount = DgopService.diskMounts.find(mount => mount.mount === mountPath)
return targetMount || DgopService.diskMounts.find(mount => mount.mount === "/") || DgopService.diskMounts[0]
const targetMount = DgopService.diskMounts.find(mount => mount.mount === mountPath);
return targetMount || DgopService.diskMounts.find(mount => mount.mount === "/") || DgopService.diskMounts[0];
}
property real usagePercent: {
if (!selectedMount || !selectedMount.percent) {
return 0
return 0;
}
const percentStr = selectedMount.percent.replace("%", "")
return parseFloat(percentStr) || 0
const percentStr = selectedMount.percent.replace("%", "");
return parseFloat(percentStr) || 0;
}
isActive: DgopService.dgopAvailable && selectedMount !== null
primaryText: {
if (!DgopService.dgopAvailable) {
return "Disk Usage"
return I18n.tr("Disk Usage");
}
if (!selectedMount) {
return "No disk data"
return I18n.tr("No disk data");
}
return selectedMount.mount
return selectedMount.mount;
}
secondaryText: {
if (!DgopService.dgopAvailable) {
return "dgop not available"
return I18n.tr("dgop not available");
}
if (!selectedMount) {
return "No disk data available"
return I18n.tr("No disk data available");
}
return `${selectedMount.used} / ${selectedMount.size} (${usagePercent.toFixed(0)}%)`
return `${selectedMount.used} / ${selectedMount.size} (${usagePercent.toFixed(0)}%)`;
}
iconColor: {
if (!DgopService.dgopAvailable || !selectedMount) {
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5);
}
if (usagePercent > 90) {
return Theme.error
return Theme.error;
}
if (usagePercent > 75) {
return Theme.warning
return Theme.warning;
}
return Theme.surfaceText
return Theme.surfaceText;
}
Component.onCompleted: {
DgopService.addRef(["diskmounts"])
DgopService.addRef(["diskmounts"]);
}
Component.onDestruction: {
DgopService.removeRef(["diskmounts"])
DgopService.removeRef(["diskmounts"]);
}
onToggled: {
expandClicked()
expandClicked();
}
}