mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
Feature/control center widget fix (#912)
* Add a widget to display the power menu * Update power button widget * Upate based on new settings * Rollback to DisplaysTab.qml
This commit is contained in:
@@ -302,7 +302,8 @@ Item {
|
|||||||
"vpn": vpnComponent,
|
"vpn": vpnComponent,
|
||||||
"notepadButton": notepadButtonComponent,
|
"notepadButton": notepadButtonComponent,
|
||||||
"colorPicker": colorPickerComponent,
|
"colorPicker": colorPickerComponent,
|
||||||
"systemUpdate": systemUpdateComponent
|
"systemUpdate": systemUpdateComponent,
|
||||||
|
"powerMenuButton": powerMenuButtonComponent
|
||||||
};
|
};
|
||||||
|
|
||||||
let pluginMap = PluginService.getWidgetComponents();
|
let pluginMap = PluginService.getWidgetComponents();
|
||||||
@@ -314,36 +315,37 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
readonly property var allComponents: ({
|
readonly property var allComponents: ({
|
||||||
"launcherButtonComponent": launcherButtonComponent,
|
"launcherButtonComponent": launcherButtonComponent,
|
||||||
"workspaceSwitcherComponent": workspaceSwitcherComponent,
|
"workspaceSwitcherComponent": workspaceSwitcherComponent,
|
||||||
"focusedWindowComponent": focusedWindowComponent,
|
"focusedWindowComponent": focusedWindowComponent,
|
||||||
"runningAppsComponent": runningAppsComponent,
|
"runningAppsComponent": runningAppsComponent,
|
||||||
"clockComponent": clockComponent,
|
"clockComponent": clockComponent,
|
||||||
"mediaComponent": mediaComponent,
|
"mediaComponent": mediaComponent,
|
||||||
"weatherComponent": weatherComponent,
|
"weatherComponent": weatherComponent,
|
||||||
"systemTrayComponent": systemTrayComponent,
|
"systemTrayComponent": systemTrayComponent,
|
||||||
"privacyIndicatorComponent": privacyIndicatorComponent,
|
"privacyIndicatorComponent": privacyIndicatorComponent,
|
||||||
"clipboardComponent": clipboardComponent,
|
"clipboardComponent": clipboardComponent,
|
||||||
"cpuUsageComponent": cpuUsageComponent,
|
"cpuUsageComponent": cpuUsageComponent,
|
||||||
"memUsageComponent": memUsageComponent,
|
"memUsageComponent": memUsageComponent,
|
||||||
"diskUsageComponent": diskUsageComponent,
|
"diskUsageComponent": diskUsageComponent,
|
||||||
"cpuTempComponent": cpuTempComponent,
|
"cpuTempComponent": cpuTempComponent,
|
||||||
"gpuTempComponent": gpuTempComponent,
|
"gpuTempComponent": gpuTempComponent,
|
||||||
"notificationButtonComponent": notificationButtonComponent,
|
"notificationButtonComponent": notificationButtonComponent,
|
||||||
"batteryComponent": batteryComponent,
|
"batteryComponent": batteryComponent,
|
||||||
"layoutComponent": layoutComponent,
|
"layoutComponent": layoutComponent,
|
||||||
"controlCenterButtonComponent": controlCenterButtonComponent,
|
"controlCenterButtonComponent": controlCenterButtonComponent,
|
||||||
"capsLockIndicatorComponent": capsLockIndicatorComponent,
|
"capsLockIndicatorComponent": capsLockIndicatorComponent,
|
||||||
"idleInhibitorComponent": idleInhibitorComponent,
|
"idleInhibitorComponent": idleInhibitorComponent,
|
||||||
"spacerComponent": spacerComponent,
|
"spacerComponent": spacerComponent,
|
||||||
"separatorComponent": separatorComponent,
|
"separatorComponent": separatorComponent,
|
||||||
"networkComponent": networkComponent,
|
"networkComponent": networkComponent,
|
||||||
"keyboardLayoutNameComponent": keyboardLayoutNameComponent,
|
"keyboardLayoutNameComponent": keyboardLayoutNameComponent,
|
||||||
"vpnComponent": vpnComponent,
|
"vpnComponent": vpnComponent,
|
||||||
"notepadButtonComponent": notepadButtonComponent,
|
"notepadButtonComponent": notepadButtonComponent,
|
||||||
"colorPickerComponent": colorPickerComponent,
|
"colorPickerComponent": colorPickerComponent,
|
||||||
"systemUpdateComponent": systemUpdateComponent
|
"systemUpdateComponent": systemUpdateComponent,
|
||||||
})
|
"powerMenuButtonComponent": powerMenuButtonComponent
|
||||||
|
})
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: stackContainer
|
id: stackContainer
|
||||||
@@ -532,7 +534,27 @@ Item {
|
|||||||
section: topBarContent.getWidgetSection(parent)
|
section: topBarContent.getWidgetSection(parent)
|
||||||
parentScreen: barWindow.screen
|
parentScreen: barWindow.screen
|
||||||
onClicked: {
|
onClicked: {
|
||||||
clipboardHistoryModalPopup.toggle();
|
clipboardHistoryModalPopup.toggle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: powerMenuButtonComponent
|
||||||
|
|
||||||
|
PowerMenuButton {
|
||||||
|
widgetThickness: barWindow.widgetThickness
|
||||||
|
barThickness: barWindow.effectiveBarThickness
|
||||||
|
axis: barWindow.axis
|
||||||
|
section: topBarContent.getWidgetSection(parent)
|
||||||
|
parentScreen: barWindow.screen
|
||||||
|
onClicked: {
|
||||||
|
if (powerMenuModalLoader) {
|
||||||
|
powerMenuModalLoader.active = true
|
||||||
|
if (powerMenuModalLoader.item) {
|
||||||
|
powerMenuModalLoader.item.openCentered()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,8 @@ Loader {
|
|||||||
"notepadButton": components.notepadButtonComponent,
|
"notepadButton": components.notepadButtonComponent,
|
||||||
"colorPicker": components.colorPickerComponent,
|
"colorPicker": components.colorPickerComponent,
|
||||||
"systemUpdate": components.systemUpdateComponent,
|
"systemUpdate": components.systemUpdateComponent,
|
||||||
"layout": components.layoutComponent
|
"layout": components.layoutComponent,
|
||||||
|
"powerMenuButton": components.powerMenuButtonComponent
|
||||||
};
|
};
|
||||||
|
|
||||||
if (componentMap[widgetId]) {
|
if (componentMap[widgetId]) {
|
||||||
|
|||||||
24
quickshell/Modules/DankBar/Widgets/PowerMenuButton.qml
Normal file
24
quickshell/Modules/DankBar/Widgets/PowerMenuButton.qml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import QtQuick
|
||||||
|
import qs.Common
|
||||||
|
import qs.Modules.Plugins
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
|
BasePill {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property bool isActive: false
|
||||||
|
|
||||||
|
content: Component {
|
||||||
|
Item {
|
||||||
|
implicitWidth: root.widgetThickness - root.horizontalPadding * 2
|
||||||
|
implicitHeight: root.widgetThickness - root.horizontalPadding * 2
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
name: "power_settings_new"
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: Theme.widgetIconColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -905,4 +905,4 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,14 @@ Item {
|
|||||||
"description": I18n.tr("Check for system updates"),
|
"description": I18n.tr("Check for system updates"),
|
||||||
"icon": "update",
|
"icon": "update",
|
||||||
"enabled": SystemUpdateService.distributionSupported
|
"enabled": SystemUpdateService.distributionSupported
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"id": "powerMenuButton",
|
||||||
|
"text": I18n.tr("Power"),
|
||||||
|
"description": I18n.tr("Display the power system menu"),
|
||||||
|
"icon": "power_settings_new",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
var allPluginVariants = PluginService.getAllPluginVariants();
|
var allPluginVariants = PluginService.getAllPluginVariants();
|
||||||
|
|||||||
Reference in New Issue
Block a user