mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-02 10:32:07 -04:00
Compare commits
8 Commits
6238e065f2
...
8271d8423d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8271d8423d | ||
|
|
c76e29c457 | ||
|
|
4750a7553b | ||
|
|
60786921a9 | ||
|
|
751bbcc127 | ||
|
|
58e8dd5456 | ||
|
|
1586c25847 | ||
|
|
cded5a7948 |
@@ -624,7 +624,7 @@ PanelWindow {
|
||||
Item {
|
||||
id: topBarCore
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
layer.enabled: false
|
||||
|
||||
property bool autoHide: barConfig?.autoHide ?? false
|
||||
property bool revealSticky: false
|
||||
|
||||
@@ -29,12 +29,21 @@ Loader {
|
||||
|
||||
readonly property bool orientationMatches: (axis?.isVertical ?? false) === isInColumn
|
||||
|
||||
readonly property bool widgetEnabled: widgetData?.enabled !== false
|
||||
|
||||
active: orientationMatches && getWidgetVisible(widgetId, DgopService.dgopAvailable) && (widgetId !== "music" || MprisController.activePlayer !== null)
|
||||
sourceComponent: getWidgetComponent(widgetId, components)
|
||||
opacity: getWidgetEnabled(widgetData?.enabled) ? 1 : 0
|
||||
|
||||
signal contentItemReady(var item)
|
||||
|
||||
Binding {
|
||||
target: root.item
|
||||
when: root.item && !root.widgetEnabled
|
||||
property: "visible"
|
||||
value: false
|
||||
restoreMode: Binding.RestoreBinding
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: root.item
|
||||
when: root.item && "parentScreen" in root.item
|
||||
@@ -269,8 +278,4 @@ Loader {
|
||||
|
||||
return widgetVisibility[widgetId] ?? true;
|
||||
}
|
||||
|
||||
function getWidgetEnabled(enabled) {
|
||||
return enabled !== false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ BasePill {
|
||||
|
||||
property var widgetData: null
|
||||
property string mountPath: (widgetData && widgetData.mountPath !== undefined) ? widgetData.mountPath : "/"
|
||||
property int diskUsageMode: (widgetData && widgetData.diskUsageMode !== undefined) ? widgetData.diskUsageMode : 0
|
||||
property bool isHovered: mouseArea.containsMouse
|
||||
property bool isAutoHideBar: false
|
||||
|
||||
@@ -130,7 +131,13 @@ BasePill {
|
||||
if (root.diskUsagePercent === undefined || root.diskUsagePercent === null || root.diskUsagePercent === 0) {
|
||||
return "--";
|
||||
}
|
||||
return root.diskUsagePercent.toFixed(0);
|
||||
if (!root.selectedMount) return "--";
|
||||
switch (root.diskUsageMode) {
|
||||
case 1: return root.selectedMount.size || "--";
|
||||
case 2: return root.selectedMount.avail || "--";
|
||||
case 3: return (root.selectedMount.avail || "--") + " / " + (root.selectedMount.size || "--");
|
||||
default: return root.diskUsagePercent.toFixed(0);
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
@@ -178,7 +185,13 @@ BasePill {
|
||||
if (root.diskUsagePercent === undefined || root.diskUsagePercent === null || root.diskUsagePercent === 0) {
|
||||
return "--%";
|
||||
}
|
||||
return root.diskUsagePercent.toFixed(0) + "%";
|
||||
if (!root.selectedMount) return "--%";
|
||||
switch (root.diskUsageMode) {
|
||||
case 1: return root.selectedMount.size || "--";
|
||||
case 2: return root.selectedMount.avail || "--";
|
||||
case 3: return (root.selectedMount.avail || "--") + " / " + (root.selectedMount.size || "--");
|
||||
default: return root.diskUsagePercent.toFixed(0) + "%";
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
@@ -189,7 +202,14 @@ BasePill {
|
||||
StyledTextMetrics {
|
||||
id: diskBaseline
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
text: "100%"
|
||||
text: {
|
||||
switch (root.diskUsageMode) {
|
||||
case 3: return "888.8G / 888.8G";
|
||||
case 1:
|
||||
case 2: return "888.8G";
|
||||
default: return "100%";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
width: Math.max(diskBaseline.width, paintedWidth)
|
||||
|
||||
@@ -14,6 +14,7 @@ BasePill {
|
||||
property var widgetData: null
|
||||
property bool minimumWidth: (widgetData && widgetData.minimumWidth !== undefined) ? widgetData.minimumWidth : true
|
||||
property bool showSwap: (widgetData && widgetData.showSwap !== undefined) ? widgetData.showSwap : false
|
||||
property bool showInGb: (widgetData && widgetData.showInGb !== undefined) ? widgetData.showInGb : false
|
||||
readonly property real swapUsage: DgopService.totalSwapKB > 0 ? (DgopService.usedSwapKB / DgopService.totalSwapKB) * 100 : 0
|
||||
|
||||
signal ramClicked
|
||||
@@ -59,6 +60,10 @@ BasePill {
|
||||
return "--";
|
||||
}
|
||||
|
||||
if (root.showInGb) {
|
||||
return (DgopService.usedMemoryMB / 1024).toFixed(1);
|
||||
}
|
||||
|
||||
return DgopService.memoryUsage.toFixed(0);
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
@@ -113,13 +118,14 @@ BasePill {
|
||||
id: ramBaseline
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
text: {
|
||||
let baseText = root.showInGb ? "88.8 GB" : "88%";
|
||||
if (!root.showSwap) {
|
||||
return "88%";
|
||||
return baseText;
|
||||
}
|
||||
if (root.swapUsage < 10) {
|
||||
return "88% · 0%";
|
||||
return baseText + " · 0%";
|
||||
}
|
||||
return "88% · 88%";
|
||||
return baseText + " · 88%";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +133,16 @@ BasePill {
|
||||
id: ramText
|
||||
text: {
|
||||
if (DgopService.memoryUsage === undefined || DgopService.memoryUsage === null || DgopService.memoryUsage === 0) {
|
||||
return "--%";
|
||||
return root.showInGb ? "-- GB" : "--%";
|
||||
}
|
||||
|
||||
let ramText = "";
|
||||
if (root.showInGb) {
|
||||
ramText = (DgopService.usedMemoryMB / 1024).toFixed(1) + " GB";
|
||||
} else {
|
||||
ramText = DgopService.memoryUsage.toFixed(0) + "%";
|
||||
}
|
||||
|
||||
let ramText = DgopService.memoryUsage.toFixed(0) + "%";
|
||||
if (root.showSwap && DgopService.totalSwapKB > 0) {
|
||||
return ramText + " · " + root.swapUsage.toFixed(0) + "%";
|
||||
}
|
||||
|
||||
@@ -41,6 +41,11 @@ Singleton {
|
||||
property string lockDateFormat: ""
|
||||
property bool lockScreenShowPowerActions: true
|
||||
property bool lockScreenShowProfileImage: true
|
||||
property bool powerActionConfirm: true
|
||||
property real powerActionHoldDuration: 0.5
|
||||
property var powerMenuActions: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"]
|
||||
property string powerMenuDefaultAction: "logout"
|
||||
property bool powerMenuGridLayout: false
|
||||
property var screenPreferences: ({})
|
||||
property int animationSpeed: 2
|
||||
property string wallpaperFillMode: "Fill"
|
||||
@@ -75,6 +80,11 @@ Singleton {
|
||||
lockDateFormat = settings.lockDateFormat !== undefined ? settings.lockDateFormat : "";
|
||||
lockScreenShowPowerActions = settings.lockScreenShowPowerActions !== undefined ? settings.lockScreenShowPowerActions : true;
|
||||
lockScreenShowProfileImage = settings.lockScreenShowProfileImage !== undefined ? settings.lockScreenShowProfileImage : true;
|
||||
powerActionConfirm = settings.powerActionConfirm !== undefined ? settings.powerActionConfirm : true;
|
||||
powerActionHoldDuration = settings.powerActionHoldDuration !== undefined ? settings.powerActionHoldDuration : 0.5;
|
||||
powerMenuActions = settings.powerMenuActions !== undefined ? settings.powerMenuActions : ["reboot", "logout", "poweroff", "lock", "suspend", "restart"];
|
||||
powerMenuDefaultAction = settings.powerMenuDefaultAction !== undefined ? settings.powerMenuDefaultAction : "logout";
|
||||
powerMenuGridLayout = settings.powerMenuGridLayout !== undefined ? settings.powerMenuGridLayout : false;
|
||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({});
|
||||
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : 2;
|
||||
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill";
|
||||
|
||||
@@ -1231,6 +1231,12 @@ Item {
|
||||
LockPowerMenu {
|
||||
id: powerMenu
|
||||
showLogout: false
|
||||
powerActionConfirmOverride: GreetdSettings.powerActionConfirm
|
||||
powerActionHoldDurationOverride: GreetdSettings.powerActionHoldDuration
|
||||
powerMenuActionsOverride: GreetdSettings.powerMenuActions
|
||||
powerMenuDefaultActionOverride: GreetdSettings.powerMenuDefaultAction
|
||||
powerMenuGridLayoutOverride: GreetdSettings.powerMenuGridLayout
|
||||
requiredActions: ["poweroff"]
|
||||
onClosed: {
|
||||
if (isPrimaryScreen && inputField && inputField.forceActiveFocus) {
|
||||
Qt.callLater(() => inputField.forceActiveFocus());
|
||||
|
||||
@@ -24,13 +24,20 @@ Rectangle {
|
||||
property real holdProgress: 0
|
||||
property bool showHoldHint: false
|
||||
|
||||
readonly property bool needsConfirmation: SettingsData.powerActionConfirm
|
||||
readonly property int holdDurationMs: SettingsData.powerActionHoldDuration * 1000
|
||||
property var powerActionConfirmOverride: undefined
|
||||
property var powerActionHoldDurationOverride: undefined
|
||||
property var powerMenuActionsOverride: undefined
|
||||
property var powerMenuDefaultActionOverride: undefined
|
||||
property var powerMenuGridLayoutOverride: undefined
|
||||
property var requiredActions: []
|
||||
|
||||
readonly property bool needsConfirmation: powerActionConfirmOverride !== undefined ? powerActionConfirmOverride : SettingsData.powerActionConfirm
|
||||
readonly property int holdDurationMs: (powerActionHoldDurationOverride !== undefined ? powerActionHoldDurationOverride : SettingsData.powerActionHoldDuration) * 1000
|
||||
|
||||
signal closed
|
||||
|
||||
function updateVisibleActions() {
|
||||
const allActions = (typeof SettingsData !== "undefined" && SettingsData.powerMenuActions) ? SettingsData.powerMenuActions : ["logout", "suspend", "hibernate", "reboot", "poweroff"];
|
||||
const allActions = powerMenuActionsOverride !== undefined ? powerMenuActionsOverride : ((typeof SettingsData !== "undefined" && SettingsData.powerMenuActions) ? SettingsData.powerMenuActions : ["logout", "suspend", "hibernate", "reboot", "poweroff"]);
|
||||
const hibernateSupported = (typeof SessionService !== "undefined" && SessionService.hibernateSupported) || false;
|
||||
let filtered = allActions.filter(action => {
|
||||
if (action === "hibernate" && !hibernateSupported)
|
||||
@@ -44,9 +51,14 @@ Rectangle {
|
||||
return true;
|
||||
});
|
||||
|
||||
for (const action of requiredActions) {
|
||||
if (!filtered.includes(action))
|
||||
filtered.push(action);
|
||||
}
|
||||
|
||||
visibleActions = filtered;
|
||||
|
||||
useGridLayout = (typeof SettingsData !== "undefined" && SettingsData.powerMenuGridLayout !== undefined) ? SettingsData.powerMenuGridLayout : false;
|
||||
useGridLayout = powerMenuGridLayoutOverride !== undefined ? powerMenuGridLayoutOverride : ((typeof SettingsData !== "undefined" && SettingsData.powerMenuGridLayout !== undefined) ? SettingsData.powerMenuGridLayout : false);
|
||||
if (!useGridLayout)
|
||||
return;
|
||||
const count = visibleActions.length;
|
||||
@@ -73,7 +85,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function getDefaultActionIndex() {
|
||||
const defaultAction = (typeof SettingsData !== "undefined" && SettingsData.powerMenuDefaultAction) ? SettingsData.powerMenuDefaultAction : "suspend";
|
||||
const defaultAction = powerMenuDefaultActionOverride !== undefined ? powerMenuDefaultActionOverride : ((typeof SettingsData !== "undefined" && SettingsData.powerMenuDefaultAction) ? SettingsData.powerMenuDefaultAction : "suspend");
|
||||
const index = visibleActions.indexOf(defaultAction);
|
||||
return index >= 0 ? index : 0;
|
||||
}
|
||||
@@ -780,8 +792,9 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
readonly property real totalMs: SettingsData.powerActionHoldDuration * 1000
|
||||
readonly property real totalMs: root.holdDurationMs
|
||||
readonly property int remainingMs: Math.ceil(totalMs * (1 - root.holdProgress))
|
||||
readonly property real durationSec: root.holdDurationMs / 1000
|
||||
text: {
|
||||
if (root.showHoldHint)
|
||||
return I18n.tr("Hold longer to confirm");
|
||||
@@ -792,7 +805,7 @@ Rectangle {
|
||||
}
|
||||
if (totalMs < 1000)
|
||||
return I18n.tr("Hold to confirm (%1 ms)").arg(totalMs);
|
||||
return I18n.tr("Hold to confirm (%1s)").arg(SettingsData.powerActionHoldDuration);
|
||||
return I18n.tr("Hold to confirm (%1s)").arg(durationSec);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: root.showHoldHint ? Theme.warning : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
|
||||
|
||||
@@ -351,6 +351,7 @@ Item {
|
||||
Loader {
|
||||
id: contentLoader
|
||||
anchors.fill: parent
|
||||
active: root.widgetEnabled && root.activeComponent !== null
|
||||
sourceComponent: root.activeComponent
|
||||
|
||||
function reloadComponent() {
|
||||
|
||||
@@ -216,6 +216,15 @@ Rectangle {
|
||||
onToggled: checked => root.updateConfig("showMemoryGraph", checked)
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
x: Theme.spacingM
|
||||
text: I18n.tr("Show Memory in GB")
|
||||
visible: root.cfg.showMemory
|
||||
checked: root.cfg.showInGb ?? false
|
||||
onToggled: checked => root.updateConfig("showInGb", checked)
|
||||
}
|
||||
|
||||
SettingsDivider {}
|
||||
|
||||
DankToggle {
|
||||
|
||||
@@ -398,10 +398,14 @@ Item {
|
||||
widgetObj.runningAppsCurrentWorkspace = SettingsData.runningAppsCurrentWorkspace;
|
||||
widgetObj.runningAppsCurrentMonitor = false;
|
||||
}
|
||||
if (widgetId === "diskUsage")
|
||||
if (widgetId === "diskUsage") {
|
||||
widgetObj.mountPath = "/";
|
||||
widgetObj.diskUsageMode = 0;
|
||||
}
|
||||
if (widgetId === "cpuUsage" || widgetId === "memUsage" || widgetId === "cpuTemp" || widgetId === "gpuTemp")
|
||||
widgetObj.minimumWidth = true;
|
||||
if (widgetId === "memUsage")
|
||||
widgetObj.showInGb = false;
|
||||
|
||||
var widgets = getWidgetsForSection(targetSection).slice();
|
||||
widgets.push(widgetObj);
|
||||
@@ -425,7 +429,7 @@ Item {
|
||||
"id": widget.id,
|
||||
"enabled": widget.enabled
|
||||
};
|
||||
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "minimumWidth", "showSwap", "mediaSize", "clockCompactMode", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge"];
|
||||
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge"];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (widget[keys[i]] !== undefined)
|
||||
result[keys[i]] = widget[keys[i]];
|
||||
@@ -536,6 +540,30 @@ Item {
|
||||
setWidgetsForSection(sectionId, widgets);
|
||||
}
|
||||
|
||||
function handleShowInGbChanged(sectionId, widgetIndex, enabled) {
|
||||
var widgets = getWidgetsForSection(sectionId).slice();
|
||||
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||
setWidgetsForSection(sectionId, widgets);
|
||||
return;
|
||||
}
|
||||
var newWidget = cloneWidgetData(widgets[widgetIndex]);
|
||||
newWidget.showInGb = enabled;
|
||||
widgets[widgetIndex] = newWidget;
|
||||
setWidgetsForSection(sectionId, widgets);
|
||||
}
|
||||
|
||||
function handleDiskUsageModeChanged(sectionId, widgetIndex, mode) {
|
||||
var widgets = getWidgetsForSection(sectionId).slice();
|
||||
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||
setWidgetsForSection(sectionId, widgets);
|
||||
return;
|
||||
}
|
||||
var newWidget = cloneWidgetData(widgets[widgetIndex]);
|
||||
newWidget.diskUsageMode = mode;
|
||||
widgets[widgetIndex] = newWidget;
|
||||
setWidgetsForSection(sectionId, widgets);
|
||||
}
|
||||
|
||||
function handleOverflowSettingChanged(sectionId, widgetIndex, settingName, value) {
|
||||
var widgets = getWidgetsForSection(sectionId).slice();
|
||||
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||
@@ -601,6 +629,8 @@ Item {
|
||||
item.pciId = widget.pciId;
|
||||
if (widget.mountPath !== undefined)
|
||||
item.mountPath = widget.mountPath;
|
||||
if (widget.diskUsageMode !== undefined)
|
||||
item.diskUsageMode = widget.diskUsageMode;
|
||||
if (widget.showNetworkIcon !== undefined)
|
||||
item.showNetworkIcon = widget.showNetworkIcon;
|
||||
if (widget.showBluetoothIcon !== undefined)
|
||||
@@ -629,6 +659,8 @@ Item {
|
||||
item.minimumWidth = widget.minimumWidth;
|
||||
if (widget.showSwap !== undefined)
|
||||
item.showSwap = widget.showSwap;
|
||||
if (widget.showInGb !== undefined)
|
||||
item.showInGb = widget.showInGb;
|
||||
if (widget.mediaSize !== undefined)
|
||||
item.mediaSize = widget.mediaSize;
|
||||
if (widget.clockCompactMode !== undefined)
|
||||
@@ -925,6 +957,12 @@ Item {
|
||||
onShowSwapChanged: (sectionId, index, enabled) => {
|
||||
widgetsTab.handleShowSwapChanged(sectionId, index, enabled);
|
||||
}
|
||||
onShowInGbChanged: (sectionId, index, enabled) => {
|
||||
widgetsTab.handleShowInGbChanged(sectionId, index, enabled);
|
||||
}
|
||||
onDiskUsageModeChanged: (sectionId, widgetIndex, mode) => {
|
||||
widgetsTab.handleDiskUsageModeChanged(sectionId, widgetIndex, mode);
|
||||
}
|
||||
onCompactModeChanged: (widgetId, value) => {
|
||||
widgetsTab.handleCompactModeChanged(sectionId, widgetId, value);
|
||||
}
|
||||
@@ -983,6 +1021,12 @@ Item {
|
||||
onShowSwapChanged: (sectionId, index, enabled) => {
|
||||
widgetsTab.handleShowSwapChanged(sectionId, index, enabled);
|
||||
}
|
||||
onShowInGbChanged: (sectionId, index, enabled) => {
|
||||
widgetsTab.handleShowInGbChanged(sectionId, index, enabled);
|
||||
}
|
||||
onDiskUsageModeChanged: (sectionId, widgetIndex, mode) => {
|
||||
widgetsTab.handleDiskUsageModeChanged(sectionId, widgetIndex, mode);
|
||||
}
|
||||
onCompactModeChanged: (widgetId, value) => {
|
||||
widgetsTab.handleCompactModeChanged(sectionId, widgetId, value);
|
||||
}
|
||||
@@ -1041,6 +1085,12 @@ Item {
|
||||
onShowSwapChanged: (sectionId, index, enabled) => {
|
||||
widgetsTab.handleShowSwapChanged(sectionId, index, enabled);
|
||||
}
|
||||
onShowInGbChanged: (sectionId, index, enabled) => {
|
||||
widgetsTab.handleShowInGbChanged(sectionId, index, enabled);
|
||||
}
|
||||
onDiskUsageModeChanged: (sectionId, widgetIndex, mode) => {
|
||||
widgetsTab.handleDiskUsageModeChanged(sectionId, widgetIndex, mode);
|
||||
}
|
||||
onCompactModeChanged: (widgetId, value) => {
|
||||
widgetsTab.handleCompactModeChanged(sectionId, widgetId, value);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ Column {
|
||||
signal privacySettingChanged(string sectionId, int widgetIndex, string settingName, bool value)
|
||||
signal minimumWidthChanged(string sectionId, int widgetIndex, bool enabled)
|
||||
signal showSwapChanged(string sectionId, int widgetIndex, bool enabled)
|
||||
signal showInGbChanged(string sectionId, int widgetIndex, bool enabled)
|
||||
signal diskUsageModeChanged(string sectionId, int widgetIndex, int mode)
|
||||
signal overflowSettingChanged(string sectionId, int widgetIndex, string settingName, var value)
|
||||
|
||||
function cloneWidgetData(widget) {
|
||||
@@ -37,7 +39,7 @@ Column {
|
||||
"id": widget.id,
|
||||
"enabled": widget.enabled
|
||||
};
|
||||
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "minimumWidth", "showSwap", "mediaSize", "clockCompactMode", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge"];
|
||||
var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showPrinterIcon", "showScreenSharingIcon", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge"];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (widget[keys[i]] !== undefined)
|
||||
result[keys[i]] = widget[keys[i]];
|
||||
@@ -67,53 +69,6 @@ Column {
|
||||
color: Theme.surfaceText
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
height: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: Theme.spacingXS
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: root.sectionId === "center"
|
||||
|
||||
DankActionButton {
|
||||
id: indexCenterButton
|
||||
buttonSize: 28
|
||||
iconName: "format_list_numbered"
|
||||
iconSize: 16
|
||||
iconColor: SettingsData.centeringMode === "index" ? Theme.primary : Theme.outline
|
||||
onClicked: {
|
||||
console.log("Centering mode changed to: index");
|
||||
SettingsData.set("centeringMode", "index");
|
||||
}
|
||||
onEntered: {
|
||||
sharedTooltip.show("Index Centering", indexCenterButton, 0, 0, "bottom");
|
||||
}
|
||||
onExited: {
|
||||
sharedTooltip.hide();
|
||||
}
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
id: geometricCenterButton
|
||||
buttonSize: 28
|
||||
iconName: "center_focus_weak"
|
||||
iconSize: 16
|
||||
iconColor: SettingsData.centeringMode === "geometric" ? Theme.primary : Theme.outline
|
||||
onClicked: {
|
||||
console.log("Centering mode changed to: geometric");
|
||||
SettingsData.set("centeringMode", "geometric");
|
||||
}
|
||||
onEntered: {
|
||||
sharedTooltip.show("Geometric Centering", geometricCenterButton, 0, 0, "bottom");
|
||||
}
|
||||
onExited: {
|
||||
sharedTooltip.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -135,6 +90,7 @@ Column {
|
||||
height: 70
|
||||
z: held ? 2 : 1
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: itemBackground
|
||||
|
||||
@@ -275,6 +231,34 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
id: diskMenuButton
|
||||
visible: modelData.id === "diskUsage"
|
||||
buttonSize: 32
|
||||
iconName: "more_vert"
|
||||
iconSize: 18
|
||||
iconColor: Theme.outline
|
||||
onClicked: {
|
||||
diskUsageContextMenu.widgetData = modelData;
|
||||
diskUsageContextMenu.sectionId = root.sectionId;
|
||||
diskUsageContextMenu.widgetIndex = index;
|
||||
|
||||
var buttonPos = diskMenuButton.mapToItem(root, 0, 0);
|
||||
var xPos = buttonPos.x - diskUsageContextMenu.width - Theme.spacingS;
|
||||
if (xPos < 0)
|
||||
xPos = buttonPos.x + diskMenuButton.width + Theme.spacingS;
|
||||
var yPos = buttonPos.y - diskUsageContextMenu.height / 2 + diskMenuButton.height / 2;
|
||||
if (yPos < 0)
|
||||
yPos = Theme.spacingS;
|
||||
else if (yPos + diskUsageContextMenu.height > root.height)
|
||||
yPos = root.height - diskUsageContextMenu.height - Theme.spacingS;
|
||||
|
||||
diskUsageContextMenu.x = xPos;
|
||||
diskUsageContextMenu.y = yPos;
|
||||
diskUsageContextMenu.open();
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 32
|
||||
height: 32
|
||||
@@ -354,23 +338,36 @@ Column {
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
id: showSwapButton
|
||||
buttonSize: 28
|
||||
id: memMenuButton
|
||||
visible: modelData.id === "memUsage"
|
||||
iconName: "swap_horiz"
|
||||
iconSize: 16
|
||||
iconColor: (modelData.showSwap !== undefined ? modelData.showSwap : false) ? Theme.primary : Theme.outline
|
||||
buttonSize: 32
|
||||
iconName: "more_vert"
|
||||
iconSize: 18
|
||||
iconColor: Theme.outline
|
||||
onClicked: {
|
||||
var currentEnabled = modelData.showSwap !== undefined ? modelData.showSwap : false;
|
||||
root.showSwapChanged(root.sectionId, index, !currentEnabled);
|
||||
}
|
||||
onEntered: {
|
||||
var currentEnabled = modelData.showSwap !== undefined ? modelData.showSwap : false;
|
||||
const tooltipText = currentEnabled ? "Hide Swap" : "Show Swap";
|
||||
sharedTooltip.show(tooltipText, showSwapButton, 0, 0, "bottom");
|
||||
}
|
||||
onExited: {
|
||||
sharedTooltip.hide();
|
||||
memUsageContextMenu.widgetData = modelData;
|
||||
memUsageContextMenu.sectionId = root.sectionId;
|
||||
memUsageContextMenu.widgetIndex = index;
|
||||
|
||||
var buttonPos = memMenuButton.mapToItem(root, 0, 0);
|
||||
var popupWidth = memUsageContextMenu.width;
|
||||
var popupHeight = memUsageContextMenu.height;
|
||||
|
||||
var xPos = buttonPos.x - popupWidth - Theme.spacingS;
|
||||
if (xPos < 0) {
|
||||
xPos = buttonPos.x + memMenuButton.width + Theme.spacingS;
|
||||
}
|
||||
|
||||
var yPos = buttonPos.y - popupHeight / 2 + memMenuButton.height / 2;
|
||||
if (yPos < 0) {
|
||||
yPos = Theme.spacingS;
|
||||
} else if (yPos + popupHeight > root.height) {
|
||||
yPos = root.height - popupHeight - Theme.spacingS;
|
||||
}
|
||||
|
||||
memUsageContextMenu.x = xPos;
|
||||
memUsageContextMenu.y = yPos;
|
||||
memUsageContextMenu.open();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,6 +796,257 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
Popup {
|
||||
id: memUsageContextMenu
|
||||
|
||||
property var widgetData: null
|
||||
property string sectionId: ""
|
||||
property int widgetIndex: -1
|
||||
|
||||
width: 200
|
||||
height: 80
|
||||
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 {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
spacing: 2
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: swapToggleArea.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: "swap_horiz"
|
||||
size: 16
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Show Swap")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: swapToggle
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 40
|
||||
height: 20
|
||||
checked: memUsageContextMenu.widgetData?.showSwap ?? false
|
||||
onToggled: {
|
||||
root.showSwapChanged(memUsageContextMenu.sectionId, memUsageContextMenu.widgetIndex, toggled);
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: swapToggleArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
swapToggle.checked = !swapToggle.checked;
|
||||
root.showSwapChanged(memUsageContextMenu.sectionId, memUsageContextMenu.widgetIndex, swapToggle.checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: gbToggleArea.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: "straighten"
|
||||
size: 16
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Show in GB")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: gbToggle
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 40
|
||||
height: 20
|
||||
checked: memUsageContextMenu.widgetData?.showInGb ?? false
|
||||
onToggled: {
|
||||
root.showInGbChanged(memUsageContextMenu.sectionId, memUsageContextMenu.widgetIndex, toggled);
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: gbToggleArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
gbToggle.checked = !gbToggle.checked;
|
||||
root.showInGbChanged(memUsageContextMenu.sectionId, memUsageContextMenu.widgetIndex, gbToggle.checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Popup {
|
||||
id: diskUsageContextMenu
|
||||
|
||||
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: 240
|
||||
height: diskMenuColumn.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: diskMenuColumn
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
spacing: 2
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
|
||||
StyledText {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: I18n.tr("Disk Usage Display")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: [
|
||||
{ label: I18n.tr("Percentage"), mode: 0, icon: "percent" },
|
||||
{ label: I18n.tr("Total"), mode: 1, icon: "storage" },
|
||||
{ label: I18n.tr("Remaining"), mode: 2, icon: "hourglass_empty" },
|
||||
{ label: I18n.tr("Remaining / Total"), mode: 3, icon: "pie_chart" }
|
||||
]
|
||||
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
required property int index
|
||||
|
||||
width: diskMenuColumn.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: diskOptionArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
|
||||
function isSelected() {
|
||||
return (diskUsageContextMenu.currentWidgetData?.diskUsageMode ?? 0) === modelData.mode;
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: modelData.icon
|
||||
size: 16
|
||||
color: isSelected() ? Theme.primary : Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData.label
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: isSelected() ? Theme.primary : Theme.surfaceText
|
||||
font.weight: isSelected() ? Font.Medium : Font.Normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: "check"
|
||||
size: 16
|
||||
color: Theme.primary
|
||||
visible: isSelected()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: diskOptionArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.diskUsageModeChanged(diskUsageContextMenu.sectionId, diskUsageContextMenu.widgetIndex, modelData.mode);
|
||||
diskUsageContextMenu.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Popup {
|
||||
id: controlCenterContextMenu
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ Item {
|
||||
visible: false
|
||||
color: "transparent"
|
||||
Component.onCompleted: {
|
||||
if (typeof updatesEnabled !== "undefined")
|
||||
if (typeof updatesEnabled !== "undefined" && !root.overlayContent)
|
||||
updatesEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ return {
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require('base16-colorscheme').setup({
|
||||
base00 = '{{dank16.color0.default.hex}}',
|
||||
base01 = '{{dank16.color0.default.hex}}',
|
||||
base02 = '{{dank16.color8.default.hex}}',
|
||||
base03 = '{{dank16.color8.default.hex}}',
|
||||
|
||||
base00 = '{{colors.background.dark.hex}}',
|
||||
base01 = '{{colors.surface_container_low.dark.hex}}',
|
||||
base02 = '{{colors.surface_container.dark.hex}}',
|
||||
base03 = '{{dank16.color8.dark.hex}}',
|
||||
base0B = '{{dank16.color3.dark.hex}}',
|
||||
base04 = '{{dank16.color7.default.hex}}',
|
||||
base05 = '{{dank16.color15.default.hex}}',
|
||||
base06 = '{{dank16.color15.default.hex}}',
|
||||
@@ -15,65 +17,12 @@ return {
|
||||
base08 = '{{dank16.color9.default.hex}}',
|
||||
base09 = '{{dank16.color9.default.hex}}',
|
||||
base0A = '{{dank16.color12.default.hex}}',
|
||||
base0B = '{{dank16.color10.default.hex}}',
|
||||
base0C = '{{dank16.color14.default.hex}}',
|
||||
base0D = '{{dank16.color12.default.hex}}',
|
||||
base0E = '{{dank16.color13.default.hex}}',
|
||||
base0F = '{{dank16.color13.default.hex}}',
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, 'Visual', {
|
||||
bg = '{{dank16.color8.default.hex}}',
|
||||
fg = '{{dank16.color15.default.hex}}',
|
||||
bold = true
|
||||
})
|
||||
vim.api.nvim_set_hl(0, 'Statusline', {
|
||||
bg = '{{dank16.color12.default.hex}}',
|
||||
fg = '{{dank16.color0.default.hex}}',
|
||||
})
|
||||
vim.api.nvim_set_hl(0, 'LineNr', { fg = '{{dank16.color8.default.hex}}' })
|
||||
vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = '{{dank16.color14.default.hex}}', bold = true })
|
||||
|
||||
vim.api.nvim_set_hl(0, 'Statement', {
|
||||
fg = '{{dank16.color13.default.hex}}',
|
||||
bold = true
|
||||
})
|
||||
vim.api.nvim_set_hl(0, 'Keyword', { link = 'Statement' })
|
||||
vim.api.nvim_set_hl(0, 'Repeat', { link = 'Statement' })
|
||||
vim.api.nvim_set_hl(0, 'Conditional', { link = 'Statement' })
|
||||
|
||||
vim.api.nvim_set_hl(0, 'Function', {
|
||||
fg = '{{dank16.color12.default.hex}}',
|
||||
bold = true
|
||||
})
|
||||
vim.api.nvim_set_hl(0, 'Macro', {
|
||||
fg = '{{dank16.color12.default.hex}}',
|
||||
italic = true
|
||||
})
|
||||
vim.api.nvim_set_hl(0, '@function.macro', { link = 'Macro' })
|
||||
|
||||
vim.api.nvim_set_hl(0, 'Type', {
|
||||
fg = '{{dank16.color14.default.hex}}',
|
||||
bold = true,
|
||||
italic = true
|
||||
})
|
||||
vim.api.nvim_set_hl(0, 'Structure', { link = 'Type' })
|
||||
|
||||
vim.api.nvim_set_hl(0, 'String', {
|
||||
fg = '{{dank16.color10.default.hex}}',
|
||||
italic = true
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, 'Operator', { fg = '{{dank16.color7.default.hex}}' })
|
||||
vim.api.nvim_set_hl(0, 'Delimiter', { fg = '{{dank16.color7.default.hex}}' })
|
||||
vim.api.nvim_set_hl(0, '@punctuation.bracket', { link = 'Delimiter' })
|
||||
vim.api.nvim_set_hl(0, '@punctuation.delimiter', { link = 'Delimiter' })
|
||||
|
||||
vim.api.nvim_set_hl(0, 'Comment', {
|
||||
fg = '{{dank16.color8.default.hex}}',
|
||||
italic = true
|
||||
})
|
||||
|
||||
local current_file_path = vim.fn.stdpath("config") .. "/lua/plugins/dankcolors.lua"
|
||||
if not _G._matugen_theme_watcher then
|
||||
local uv = vim.uv or vim.loop
|
||||
|
||||
Reference in New Issue
Block a user