mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
Add DoNotDisturb & IdleInhibitor Indicators for the ControlCenterButton widget + Add optional icon to KeyboardLayoutName widget (#2513)
* feat(ControlCenterButton): add IdleInhibitor icon * feat(ControlCenterButton): add DoNotDisturb icon * fix(WidgetTabSection): adjust text width for the SystemTray Widget popup * feat(KeyboardLayoutName): add optional icon * refactor(KeyboardLayoutName): simplify icon visibility logic by using root.showIcon ---------
This commit is contained in:
@@ -315,6 +315,8 @@ Singleton {
|
|||||||
property bool controlCenterShowBatteryIcon: false
|
property bool controlCenterShowBatteryIcon: false
|
||||||
property bool controlCenterShowPrinterIcon: false
|
property bool controlCenterShowPrinterIcon: false
|
||||||
property bool controlCenterShowScreenSharingIcon: true
|
property bool controlCenterShowScreenSharingIcon: true
|
||||||
|
property bool controlCenterShowIdleInhibitorIcon: false
|
||||||
|
property bool controlCenterShowDoNotDisturbIcon: false
|
||||||
property bool showPrivacyButton: true
|
property bool showPrivacyButton: true
|
||||||
property bool privacyShowMicIcon: false
|
property bool privacyShowMicIcon: false
|
||||||
property bool privacyShowCameraIcon: false
|
property bool privacyShowCameraIcon: false
|
||||||
@@ -405,6 +407,7 @@ Singleton {
|
|||||||
property int appsDockEnlargePercentage: 125
|
property int appsDockEnlargePercentage: 125
|
||||||
property int appsDockIconSizePercentage: 100
|
property int appsDockIconSizePercentage: 100
|
||||||
property bool keyboardLayoutNameCompactMode: false
|
property bool keyboardLayoutNameCompactMode: false
|
||||||
|
property bool keyboardLayoutNameShowIcon: false
|
||||||
property bool runningAppsCurrentWorkspace: true
|
property bool runningAppsCurrentWorkspace: true
|
||||||
property bool runningAppsGroupByApp: false
|
property bool runningAppsGroupByApp: false
|
||||||
property bool runningAppsCurrentMonitor: false
|
property bool runningAppsCurrentMonitor: false
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ var SPEC = {
|
|||||||
controlCenterShowBatteryIcon: { def: false },
|
controlCenterShowBatteryIcon: { def: false },
|
||||||
controlCenterShowPrinterIcon: { def: false },
|
controlCenterShowPrinterIcon: { def: false },
|
||||||
controlCenterShowScreenSharingIcon: { def: true },
|
controlCenterShowScreenSharingIcon: { def: true },
|
||||||
|
controlCenterShowIdleInhibitorIcon: { def: false },
|
||||||
|
controlCenterShowDoNotDisturbIcon: { def: false },
|
||||||
|
|
||||||
showPrivacyButton: { def: true },
|
showPrivacyButton: { def: true },
|
||||||
privacyShowMicIcon: { def: false },
|
privacyShowMicIcon: { def: false },
|
||||||
@@ -165,6 +167,7 @@ var SPEC = {
|
|||||||
appsDockEnlargePercentage: { def: 125 },
|
appsDockEnlargePercentage: { def: 125 },
|
||||||
appsDockIconSizePercentage: { def: 100 },
|
appsDockIconSizePercentage: { def: 100 },
|
||||||
keyboardLayoutNameCompactMode: { def: false },
|
keyboardLayoutNameCompactMode: { def: false },
|
||||||
|
keyboardLayoutNameShowIcon: { def: false},
|
||||||
runningAppsCurrentWorkspace: { def: true },
|
runningAppsCurrentWorkspace: { def: true },
|
||||||
runningAppsGroupByApp: { def: false },
|
runningAppsGroupByApp: { def: false },
|
||||||
runningAppsCurrentMonitor: { def: false },
|
runningAppsCurrentMonitor: { def: false },
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ BasePill {
|
|||||||
property bool showBatteryIcon: widgetData?.showBatteryIcon !== undefined ? widgetData.showBatteryIcon : SettingsData.controlCenterShowBatteryIcon
|
property bool showBatteryIcon: widgetData?.showBatteryIcon !== undefined ? widgetData.showBatteryIcon : SettingsData.controlCenterShowBatteryIcon
|
||||||
property bool showPrinterIcon: widgetData?.showPrinterIcon !== undefined ? widgetData.showPrinterIcon : SettingsData.controlCenterShowPrinterIcon
|
property bool showPrinterIcon: widgetData?.showPrinterIcon !== undefined ? widgetData.showPrinterIcon : SettingsData.controlCenterShowPrinterIcon
|
||||||
property bool showScreenSharingIcon: widgetData?.showScreenSharingIcon !== undefined ? widgetData.showScreenSharingIcon : SettingsData.controlCenterShowScreenSharingIcon
|
property bool showScreenSharingIcon: widgetData?.showScreenSharingIcon !== undefined ? widgetData.showScreenSharingIcon : SettingsData.controlCenterShowScreenSharingIcon
|
||||||
|
property bool showIdleInhibitorIcon: widgetData?.showIdleInhibitorIcon !== undefined ? widgetData.showIdleInhibitorIcon : SettingsData.controlCenterShowIdleInhibitorIcon
|
||||||
|
property bool showDoNotDisturbIcon: widgetData?.showDoNotDisturbIcon !== undefined ? widgetData.showDoNotDisturbIcon : SettingsData.controlCenterShowDoNotDisturbIcon
|
||||||
property real touchpadThreshold: 100
|
property real touchpadThreshold: 100
|
||||||
property real micAccumulator: 0
|
property real micAccumulator: 0
|
||||||
property real volumeAccumulator: 0
|
property real volumeAccumulator: 0
|
||||||
@@ -40,7 +42,7 @@ BasePill {
|
|||||||
property var _vBrightness: null
|
property var _vBrightness: null
|
||||||
property var _vMic: null
|
property var _vMic: null
|
||||||
property var _interactionDelegates: []
|
property var _interactionDelegates: []
|
||||||
readonly property var defaultControlCenterGroupOrder: ["network", "vpn", "bluetooth", "audio", "microphone", "brightness", "battery", "printer", "screenSharing"]
|
readonly property var defaultControlCenterGroupOrder: ["network", "vpn", "bluetooth", "audio", "microphone", "brightness", "battery", "printer", "screenSharing", "idleInhibitor", "doNotDisturb"]
|
||||||
readonly property var effectiveControlCenterGroupOrder: getEffectiveControlCenterGroupOrder()
|
readonly property var effectiveControlCenterGroupOrder: getEffectiveControlCenterGroupOrder()
|
||||||
readonly property var controlCenterRenderModel: getControlCenterRenderModel()
|
readonly property var controlCenterRenderModel: getControlCenterRenderModel()
|
||||||
|
|
||||||
@@ -353,6 +355,10 @@ BasePill {
|
|||||||
return root.showBatteryIcon && BatteryService.batteryAvailable;
|
return root.showBatteryIcon && BatteryService.batteryAvailable;
|
||||||
case "printer":
|
case "printer":
|
||||||
return root.showPrinterIcon && CupsService.cupsAvailable && root.hasPrintJobs();
|
return root.showPrinterIcon && CupsService.cupsAvailable && root.hasPrintJobs();
|
||||||
|
case "idleInhibitor":
|
||||||
|
return root.showIdleInhibitorIcon && SessionService.idleInhibited;
|
||||||
|
case "doNotDisturb":
|
||||||
|
return root.showDoNotDisturbIcon && SessionData.doNotDisturb;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -512,6 +518,10 @@ BasePill {
|
|||||||
return Theme.getBatteryIcon(BatteryService.batteryLevel, BatteryService.isCharging, BatteryService.batteryAvailable);
|
return Theme.getBatteryIcon(BatteryService.batteryLevel, BatteryService.isCharging, BatteryService.batteryAvailable);
|
||||||
case "printer":
|
case "printer":
|
||||||
return "print";
|
return "print";
|
||||||
|
case "idleInhibitor":
|
||||||
|
return "motion_sensor_active";
|
||||||
|
case "doNotDisturb":
|
||||||
|
return "do_not_disturb_on";
|
||||||
default:
|
default:
|
||||||
return "settings";
|
return "settings";
|
||||||
}
|
}
|
||||||
@@ -531,6 +541,10 @@ BasePill {
|
|||||||
return root.getBatteryIconColor();
|
return root.getBatteryIconColor();
|
||||||
case "printer":
|
case "printer":
|
||||||
return Theme.primary;
|
return Theme.primary;
|
||||||
|
case "idleInhibitor":
|
||||||
|
return Theme.primary;
|
||||||
|
case "doNotDisturb":
|
||||||
|
return Theme.primary;
|
||||||
default:
|
default:
|
||||||
return Theme.widgetIconColor;
|
return Theme.widgetIconColor;
|
||||||
}
|
}
|
||||||
@@ -689,6 +703,10 @@ BasePill {
|
|||||||
return Theme.getBatteryIcon(BatteryService.batteryLevel, BatteryService.isCharging, BatteryService.batteryAvailable);
|
return Theme.getBatteryIcon(BatteryService.batteryLevel, BatteryService.isCharging, BatteryService.batteryAvailable);
|
||||||
case "printer":
|
case "printer":
|
||||||
return "print";
|
return "print";
|
||||||
|
case "idleInhibitor":
|
||||||
|
return "motion_sensor_active";
|
||||||
|
case "doNotDisturb":
|
||||||
|
return "do_not_disturb_on";
|
||||||
default:
|
default:
|
||||||
return "settings";
|
return "settings";
|
||||||
}
|
}
|
||||||
@@ -708,6 +726,10 @@ BasePill {
|
|||||||
return root.getBatteryIconColor();
|
return root.getBatteryIconColor();
|
||||||
case "printer":
|
case "printer":
|
||||||
return Theme.primary;
|
return Theme.primary;
|
||||||
|
case "idleInhibitor":
|
||||||
|
return Theme.primary;
|
||||||
|
case "doNotDisturb":
|
||||||
|
return Theme.primary;
|
||||||
default:
|
default:
|
||||||
return Theme.widgetIconColor;
|
return Theme.widgetIconColor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ BasePill {
|
|||||||
|
|
||||||
property var widgetData: null
|
property var widgetData: null
|
||||||
property bool compactMode: widgetData?.keyboardLayoutNameCompactMode !== undefined ? widgetData.keyboardLayoutNameCompactMode : SettingsData.keyboardLayoutNameCompactMode
|
property bool compactMode: widgetData?.keyboardLayoutNameCompactMode !== undefined ? widgetData.keyboardLayoutNameCompactMode : SettingsData.keyboardLayoutNameCompactMode
|
||||||
|
property bool showIcon: widgetData?.keyboardLayoutNameShowIcon !== undefined ? widgetData.keyboardLayoutNameShowIcon : SettingsData.keyboardLayoutNameShowIcon
|
||||||
readonly property var langCodes: ({
|
readonly property var langCodes: ({
|
||||||
"afrikaans": "af",
|
"afrikaans": "af",
|
||||||
"albanian": "sq",
|
"albanian": "sq",
|
||||||
@@ -134,6 +135,7 @@ BasePill {
|
|||||||
size: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale)
|
size: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale)
|
||||||
color: Theme.widgetTextColor
|
color: Theme.widgetTextColor
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
visible: root.showIcon
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -156,6 +158,14 @@ BasePill {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "keyboard"
|
||||||
|
size: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale)
|
||||||
|
color: Theme.widgetTextColor
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: root.showIcon
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (!root.currentLayout)
|
if (!root.currentLayout)
|
||||||
|
|||||||
@@ -392,7 +392,9 @@ Item {
|
|||||||
widgetObj.showBatteryIcon = SettingsData.controlCenterShowBatteryIcon;
|
widgetObj.showBatteryIcon = SettingsData.controlCenterShowBatteryIcon;
|
||||||
widgetObj.showPrinterIcon = SettingsData.controlCenterShowPrinterIcon;
|
widgetObj.showPrinterIcon = SettingsData.controlCenterShowPrinterIcon;
|
||||||
widgetObj.showScreenSharingIcon = SettingsData.controlCenterShowScreenSharingIcon;
|
widgetObj.showScreenSharingIcon = SettingsData.controlCenterShowScreenSharingIcon;
|
||||||
widgetObj.controlCenterGroupOrder = ["network", "vpn", "bluetooth", "audio", "microphone", "brightness", "battery", "printer", "screenSharing"];
|
widgetObj.showIdleInhibitorIcon = SettingsData.controlCenterShowIdleInhibitorIcon;
|
||||||
|
widgetObj.showDoNotDisturbIcon = SettingsData.controlCenterShowDoNotDisturbIcon;
|
||||||
|
widgetObj.controlCenterGroupOrder = ["network", "vpn", "bluetooth", "audio", "microphone", "brightness", "battery", "printer", "screenSharing", "idleInhibitor", "doNotDisturb"];
|
||||||
}
|
}
|
||||||
if (widgetId === "runningApps") {
|
if (widgetId === "runningApps") {
|
||||||
widgetObj.runningAppsCompactMode = SettingsData.runningAppsCompactMode;
|
widgetObj.runningAppsCompactMode = SettingsData.runningAppsCompactMode;
|
||||||
@@ -432,7 +434,7 @@ Item {
|
|||||||
"id": widget.id,
|
"id": widget.id,
|
||||||
"enabled": widget.enabled
|
"enabled": widget.enabled
|
||||||
};
|
};
|
||||||
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowSize", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "controlCenterGroupOrder", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge", "trayUseInlineExpansion", "hideWhenIdle"];
|
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowSize", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "keyboardLayoutNameShowIcon", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "showIdleInhibitorIcon", "showDoNotDisturbIcon", "controlCenterGroupOrder", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge", "trayUseInlineExpansion", "hideWhenIdle"];
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
if (widget[keys[i]] !== undefined)
|
if (widget[keys[i]] !== undefined)
|
||||||
result[keys[i]] = widget[keys[i]];
|
result[keys[i]] = widget[keys[i]];
|
||||||
@@ -545,6 +547,24 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleKeyboardLayoutNameSettingChanged(sectionId, widgetIndex, settingName, value) {
|
||||||
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
|
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var newWidget = cloneWidgetData(widgets[widgetIndex]);
|
||||||
|
|
||||||
|
switch (settingName) {
|
||||||
|
case "showIcon":
|
||||||
|
newWidget["keyboardLayoutNameShowIcon"] = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
widgets[widgetIndex] = newWidget;
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
}
|
||||||
|
|
||||||
function handleMinimumWidthChanged(sectionId, widgetIndex, enabled) {
|
function handleMinimumWidthChanged(sectionId, widgetIndex, enabled) {
|
||||||
var widgets = getWidgetsForSection(sectionId).slice();
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||||
@@ -717,6 +737,10 @@ Item {
|
|||||||
item.showPrinterIcon = widget.showPrinterIcon;
|
item.showPrinterIcon = widget.showPrinterIcon;
|
||||||
if (widget.showScreenSharingIcon !== undefined)
|
if (widget.showScreenSharingIcon !== undefined)
|
||||||
item.showScreenSharingIcon = widget.showScreenSharingIcon;
|
item.showScreenSharingIcon = widget.showScreenSharingIcon;
|
||||||
|
if (widget.showIdleInhibitorIcon !== undefined)
|
||||||
|
item.showIdleInhibitorIcon = widget.showIdleInhibitorIcon;
|
||||||
|
if (widget.showDoNotDisturbIcon !== undefined)
|
||||||
|
item.showDoNotDisturbIcon = widget.showDoNotDisturbIcon;
|
||||||
if (widget.controlCenterGroupOrder !== undefined)
|
if (widget.controlCenterGroupOrder !== undefined)
|
||||||
item.controlCenterGroupOrder = widget.controlCenterGroupOrder;
|
item.controlCenterGroupOrder = widget.controlCenterGroupOrder;
|
||||||
if (widget.minimumWidth !== undefined)
|
if (widget.minimumWidth !== undefined)
|
||||||
@@ -743,6 +767,8 @@ Item {
|
|||||||
item.runningAppsCurrentMonitor = widget.runningAppsCurrentMonitor;
|
item.runningAppsCurrentMonitor = widget.runningAppsCurrentMonitor;
|
||||||
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
||||||
item.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
item.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
||||||
|
if (widget.keyboardLayoutNameShowIcon !== undefined)
|
||||||
|
item.keyboardLayoutNameShowIcon = widget.keyboardLayoutNameShowIcon;
|
||||||
if (widget.barMaxVisibleApps !== undefined)
|
if (widget.barMaxVisibleApps !== undefined)
|
||||||
item.barMaxVisibleApps = widget.barMaxVisibleApps;
|
item.barMaxVisibleApps = widget.barMaxVisibleApps;
|
||||||
if (widget.barMaxVisibleRunningApps !== undefined)
|
if (widget.barMaxVisibleRunningApps !== undefined)
|
||||||
@@ -1024,6 +1050,9 @@ Item {
|
|||||||
onPrivacySettingChanged: (sectionId, index, setting, value) => {
|
onPrivacySettingChanged: (sectionId, index, setting, value) => {
|
||||||
widgetsTab.handlePrivacySettingChanged(sectionId, index, setting, value);
|
widgetsTab.handlePrivacySettingChanged(sectionId, index, setting, value);
|
||||||
}
|
}
|
||||||
|
onKeyboardLayoutNameSettingChanged: (sectionId, index, setting, value) => {
|
||||||
|
widgetsTab.handleKeyboardLayoutNameSettingChanged(sectionId, index, setting, value);
|
||||||
|
}
|
||||||
onMinimumWidthChanged: (sectionId, index, enabled) => {
|
onMinimumWidthChanged: (sectionId, index, enabled) => {
|
||||||
widgetsTab.handleMinimumWidthChanged(sectionId, index, enabled);
|
widgetsTab.handleMinimumWidthChanged(sectionId, index, enabled);
|
||||||
}
|
}
|
||||||
@@ -1097,6 +1126,9 @@ Item {
|
|||||||
onPrivacySettingChanged: (sectionId, index, setting, value) => {
|
onPrivacySettingChanged: (sectionId, index, setting, value) => {
|
||||||
widgetsTab.handlePrivacySettingChanged(sectionId, index, setting, value);
|
widgetsTab.handlePrivacySettingChanged(sectionId, index, setting, value);
|
||||||
}
|
}
|
||||||
|
onKeyboardLayoutNameSettingChanged: (sectionId, index, setting, value) => {
|
||||||
|
widgetsTab.handleKeyboardLayoutNameSettingChanged(sectionId, index, setting, value);
|
||||||
|
}
|
||||||
onMinimumWidthChanged: (sectionId, index, enabled) => {
|
onMinimumWidthChanged: (sectionId, index, enabled) => {
|
||||||
widgetsTab.handleMinimumWidthChanged(sectionId, index, enabled);
|
widgetsTab.handleMinimumWidthChanged(sectionId, index, enabled);
|
||||||
}
|
}
|
||||||
@@ -1170,6 +1202,9 @@ Item {
|
|||||||
onPrivacySettingChanged: (sectionId, index, setting, value) => {
|
onPrivacySettingChanged: (sectionId, index, setting, value) => {
|
||||||
widgetsTab.handlePrivacySettingChanged(sectionId, index, setting, value);
|
widgetsTab.handlePrivacySettingChanged(sectionId, index, setting, value);
|
||||||
}
|
}
|
||||||
|
onKeyboardLayoutNameSettingChanged: (sectionId, index, setting, value) => {
|
||||||
|
widgetsTab.handleKeyboardLayoutNameSettingChanged(sectionId, index, setting, value);
|
||||||
|
}
|
||||||
onMinimumWidthChanged: (sectionId, index, enabled) => {
|
onMinimumWidthChanged: (sectionId, index, enabled) => {
|
||||||
widgetsTab.handleMinimumWidthChanged(sectionId, index, enabled);
|
widgetsTab.handleMinimumWidthChanged(sectionId, index, enabled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Column {
|
|||||||
signal controlCenterSettingChanged(string sectionId, int widgetIndex, string settingName, bool value)
|
signal controlCenterSettingChanged(string sectionId, int widgetIndex, string settingName, bool value)
|
||||||
signal controlCenterGroupOrderChanged(string sectionId, int widgetIndex, var groupOrder)
|
signal controlCenterGroupOrderChanged(string sectionId, int widgetIndex, var groupOrder)
|
||||||
signal privacySettingChanged(string sectionId, int widgetIndex, string settingName, bool value)
|
signal privacySettingChanged(string sectionId, int widgetIndex, string settingName, bool value)
|
||||||
|
signal keyboardLayoutNameSettingChanged(string sectionId, int widgetIndex, string settingName, bool value)
|
||||||
signal minimumWidthChanged(string sectionId, int widgetIndex, bool enabled)
|
signal minimumWidthChanged(string sectionId, int widgetIndex, bool enabled)
|
||||||
signal showSwapChanged(string sectionId, int widgetIndex, bool enabled)
|
signal showSwapChanged(string sectionId, int widgetIndex, bool enabled)
|
||||||
signal showInGbChanged(string sectionId, int widgetIndex, bool enabled)
|
signal showInGbChanged(string sectionId, int widgetIndex, bool enabled)
|
||||||
@@ -42,7 +43,7 @@ Column {
|
|||||||
"id": widget.id,
|
"id": widget.id,
|
||||||
"enabled": widget.enabled
|
"enabled": widget.enabled
|
||||||
};
|
};
|
||||||
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "showMountPath", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowSize", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "controlCenterGroupOrder", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge", "trayUseInlineExpansion"];
|
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowSize", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "keyboardLayoutNameShowIcon", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "showIdleInhibitorIcon", "showDoNotDisturbIcon", "controlCenterGroupOrder", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge", "trayUseInlineExpansion"];
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
if (widget[keys[i]] !== undefined)
|
if (widget[keys[i]] !== undefined)
|
||||||
result[keys[i]] = widget[keys[i]];
|
result[keys[i]] = widget[keys[i]];
|
||||||
@@ -557,6 +558,40 @@ Column {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
id: kbdLayoutCtxMenuButton
|
||||||
|
buttonSize: 32
|
||||||
|
visible: modelData.id === "keyboard_layout_name"
|
||||||
|
iconName: "more_vert"
|
||||||
|
iconSize: 18
|
||||||
|
iconColor: Theme.outline
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
kbdLayoutCtxMenu.widgetData = modelData;
|
||||||
|
kbdLayoutCtxMenu.sectionId = root.sectionId;
|
||||||
|
kbdLayoutCtxMenu.widgetIndex = index;
|
||||||
|
|
||||||
|
var buttonPos = kbdLayoutCtxMenuButton.mapToItem(root, 0, 0);
|
||||||
|
var popupWidth = kbdLayoutCtxMenu.width;
|
||||||
|
var popupHeight = kbdLayoutCtxMenu.height;
|
||||||
|
|
||||||
|
var xPos = buttonPos.x - popupWidth - Theme.spacingS;
|
||||||
|
if (xPos < 0)
|
||||||
|
xPos = buttonPos.x + kbdLayoutCtxMenuButton.width + Theme.spacingS;
|
||||||
|
|
||||||
|
var yPos = buttonPos.y - popupHeight / 2 + kbdLayoutCtxMenuButton.height / 2;
|
||||||
|
if (yPos < 0) {
|
||||||
|
yPos = Theme.spacingS;
|
||||||
|
} else if (yPos + popupHeight > root.height) {
|
||||||
|
yPos = root.height - popupHeight - Theme.spacingS;
|
||||||
|
}
|
||||||
|
|
||||||
|
kbdLayoutCtxMenu.x = xPos;
|
||||||
|
kbdLayoutCtxMenu.y = yPos;
|
||||||
|
kbdLayoutCtxMenu.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
id: appsDockMenuButton
|
id: appsDockMenuButton
|
||||||
buttonSize: 32
|
buttonSize: 32
|
||||||
@@ -1019,7 +1054,7 @@ Column {
|
|||||||
property int widgetIndex: -1
|
property int widgetIndex: -1
|
||||||
readonly property var currentWidgetData: (widgetIndex >= 0 && widgetIndex < root.items.length) ? root.items[widgetIndex] : widgetData
|
readonly property var currentWidgetData: (widgetIndex >= 0 && widgetIndex < root.items.length) ? root.items[widgetIndex] : widgetData
|
||||||
|
|
||||||
width: 220
|
width: 280
|
||||||
height: contentColumn.implicitHeight + Theme.spacingS * 2
|
height: contentColumn.implicitHeight + Theme.spacingS * 2
|
||||||
padding: 0
|
padding: 0
|
||||||
modal: true
|
modal: true
|
||||||
@@ -1093,6 +1128,92 @@ Column {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Popup {
|
||||||
|
id: kbdLayoutCtxMenu
|
||||||
|
|
||||||
|
property var widgetData: null
|
||||||
|
property string sectionId: ""
|
||||||
|
property int widgetIndex: -1
|
||||||
|
readonly property var currentWidgetData: (widgetIndex >= 0 && widgetIndex < root.items.length) ? root.items[widgetIndex] : widgetData
|
||||||
|
|
||||||
|
width: 200
|
||||||
|
height: kbdLayoutCtxMenuColumn.implicitHeight + Theme.spacingS * 2
|
||||||
|
padding: 0
|
||||||
|
modal: true
|
||||||
|
focus: true
|
||||||
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: Theme.surfaceContainer
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||||
|
border.width: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Item {
|
||||||
|
Column {
|
||||||
|
id: kbdLayoutCtxMenuColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingS
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 32
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: kbdLayoutCtxMenuIconArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "visibility"
|
||||||
|
size: 16
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Show Icon")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Normal
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
id: kbdLayoutCtxMenuIconToggle
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 40
|
||||||
|
height: 20
|
||||||
|
checked: kbdLayoutCtxMenu.currentWidgetData?.keyboardLayoutNameShowIcon ?? SettingsData.keyboardLayoutNameShowIcon
|
||||||
|
onToggled: toggled => {
|
||||||
|
root.keyboardLayoutNameSettingChanged(kbdLayoutCtxMenu.sectionId, kbdLayoutCtxMenu.widgetIndex, "showIcon", toggled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: kbdLayoutCtxMenuIconArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
kbdLayoutCtxMenuIconToggle.checked = !kbdLayoutCtxMenuIconToggle.checked;
|
||||||
|
root.keyboardLayoutNameSettingChanged(kbdLayoutCtxMenu.sectionId, kbdLayoutCtxMenu.widgetIndex, "showIcon", kbdLayoutCtxMenuIconToggle.checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: focusedWindowContextMenu
|
id: focusedWindowContextMenu
|
||||||
|
|
||||||
@@ -1520,7 +1641,27 @@ Column {
|
|||||||
setting: "showScreenSharingIcon"
|
setting: "showScreenSharingIcon"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
id: "idleInhibitor",
|
||||||
|
rows: [
|
||||||
|
{
|
||||||
|
icon: "motion_sensor_active",
|
||||||
|
label: I18n.tr("Idle Inhibitor"),
|
||||||
|
setting: "showIdleInhibitorIcon"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "doNotDisturb",
|
||||||
|
rows: [
|
||||||
|
{
|
||||||
|
icon: "do_not_disturb_on",
|
||||||
|
label: I18n.tr("Do Not Disturb"),
|
||||||
|
setting: "showDoNotDisturbIcon"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
property var controlCenterGroups: defaultControlCenterGroups
|
property var controlCenterGroups: defaultControlCenterGroups
|
||||||
property int draggedControlCenterGroupIndex: -1
|
property int draggedControlCenterGroupIndex: -1
|
||||||
@@ -1660,7 +1801,7 @@ Column {
|
|||||||
id: longestControlCenterLabelMetrics
|
id: longestControlCenterLabelMetrics
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
text: {
|
text: {
|
||||||
const labels = [I18n.tr("Network"), I18n.tr("VPN"), I18n.tr("Bluetooth"), I18n.tr("Audio"), I18n.tr("Volume"), I18n.tr("Microphone"), I18n.tr("Microphone Volume"), I18n.tr("Brightness"), I18n.tr("Brightness Value"), I18n.tr("Battery"), I18n.tr("Printer"), I18n.tr("Screen Sharing")];
|
const labels = [I18n.tr("Network"), I18n.tr("VPN"), I18n.tr("Bluetooth"), I18n.tr("Audio"), I18n.tr("Volume"), I18n.tr("Microphone"), I18n.tr("Microphone Volume"), I18n.tr("Brightness"), I18n.tr("Brightness Value"), I18n.tr("Battery"), I18n.tr("Printer"), I18n.tr("Screen Sharing"), I18n.tr("Idle Inhibitor"), I18n.tr("Do Not Disturb")];
|
||||||
let longest = "";
|
let longest = "";
|
||||||
for (let i = 0; i < labels.length; i++) {
|
for (let i = 0; i < labels.length; i++) {
|
||||||
if (labels[i].length > longest.length)
|
if (labels[i].length > longest.length)
|
||||||
@@ -1707,6 +1848,10 @@ Column {
|
|||||||
return wd?.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
return wd?.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
case "showScreenSharingIcon":
|
case "showScreenSharingIcon":
|
||||||
return wd?.showScreenSharingIcon ?? SettingsData.controlCenterShowScreenSharingIcon;
|
return wd?.showScreenSharingIcon ?? SettingsData.controlCenterShowScreenSharingIcon;
|
||||||
|
case "showIdleInhibitorIcon":
|
||||||
|
return wd?.showIdleInhibitorIcon ?? SettingsData.controlCenterShowIdleInhibitorIcon;
|
||||||
|
case "showDoNotDisturbIcon":
|
||||||
|
return wd?.showDoNotDisturbIcon ?? SettingsData.controlCenterShowDoNotDisturbIcon;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user