1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 22:15:38 -05:00

switch hto monorepo structure

This commit is contained in:
bbedward
2025-11-12 17:18:45 -05:00
parent 6013c994a6
commit 24e800501a
768 changed files with 76284 additions and 221 deletions

View File

@@ -0,0 +1,56 @@
import QtQuick
import qs.Common
import qs.Widgets
import qs.Modules.Plugins
PluginSettings {
id: root
pluginId: "popoutControlExample"
StyledText {
width: parent.width
text: "Popout Control Settings"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
width: parent.width
text: "Choose which popout/modal will open when clicking the widget"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
}
SelectionSetting {
settingKey: "selectedPopout"
label: "Popout to Open"
description: "Select which popout or modal opens when you click the widget"
options: [
{label: "Control Center", value: "controlCenter"},
{label: "Notification Center", value: "notificationCenter"},
{label: "App Drawer", value: "appDrawer"},
{label: "Process List", value: "processList"},
{label: "DankDash", value: "dankDash"},
{label: "Battery Info", value: "battery"},
{label: "VPN", value: "vpn"},
{label: "System Update", value: "systemUpdate"},
{label: "Settings", value: "settings"},
{label: "Clipboard History", value: "clipboardHistory"},
{label: "Spotlight", value: "spotlight"},
{label: "Power Menu", value: "powerMenu"},
{label: "Color Picker", value: "colorPicker"},
{label: "Notepad", value: "notepad"}
]
defaultValue: "controlCenter"
}
StyledText {
width: parent.width
text: "💡 Tip: The widget displays the name of the selected popout and opens it when clicked!"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
}
}

View File

@@ -0,0 +1,95 @@
import QtQuick
import QtQuick.Layouts
import Quickshell
import qs.Common
import qs.Widgets
import qs.Modules.Plugins
PluginComponent {
id: root
property var popoutService: null
property string selectedPopout: pluginData.selectedPopout || "controlCenter"
property var popoutActions: ({
"controlCenter": (x, y, w, s, scr) => popoutService?.toggleControlCenter(x, y, w, s, scr),
"notificationCenter": (x, y, w, s, scr) => popoutService?.toggleNotificationCenter(x, y, w, s, scr),
"appDrawer": (x, y, w, s, scr) => popoutService?.toggleAppDrawer(x, y, w, s, scr),
"processList": (x, y, w, s, scr) => popoutService?.toggleProcessList(x, y, w, s, scr),
"dankDash": (x, y, w, s, scr) => popoutService?.toggleDankDash(0, x, y, w, s, scr),
"battery": (x, y, w, s, scr) => popoutService?.toggleBattery(x, y, w, s, scr),
"vpn": (x, y, w, s, scr) => popoutService?.toggleVpn(x, y, w, s, scr),
"systemUpdate": (x, y, w, s, scr) => popoutService?.toggleSystemUpdate(x, y, w, s, scr),
"settings": () => popoutService?.openSettings(),
"clipboardHistory": () => popoutService?.openClipboardHistory(),
"spotlight": () => popoutService?.openSpotlight(),
"powerMenu": () => popoutService?.togglePowerMenu(),
"colorPicker": () => popoutService?.showColorPicker(),
"notepad": () => popoutService?.toggleNotepad()
})
property var popoutNames: ({
"controlCenter": "Control Center",
"notificationCenter": "Notification Center",
"appDrawer": "App Drawer",
"processList": "Process List",
"dankDash": "DankDash",
"battery": "Battery Info",
"vpn": "VPN",
"systemUpdate": "System Update",
"settings": "Settings",
"clipboardHistory": "Clipboard",
"spotlight": "Spotlight",
"powerMenu": "Power Menu",
"colorPicker": "Color Picker",
"notepad": "Notepad"
})
pillClickAction: (x, y, width, section, screen) => {
if (popoutActions[selectedPopout]) {
popoutActions[selectedPopout](x, y, width, section, screen)
}
}
horizontalBarPill: Component {
Row {
spacing: Theme.spacingXS
DankIcon {
name: "widgets"
color: Theme.primary
font.pixelSize: Theme.iconSize - 6
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: popoutNames[selectedPopout] || "Popouts"
color: Theme.primary
font.pixelSize: Theme.fontSizeMedium
anchors.verticalCenter: parent.verticalCenter
}
}
}
verticalBarPill: Component {
Column {
spacing: Theme.spacingXS
DankIcon {
name: "widgets"
color: Theme.primary
font.pixelSize: Theme.iconSize - 6
anchors.horizontalCenter: parent.horizontalCenter
}
StyledText {
text: popoutNames[selectedPopout] || "Popouts"
color: Theme.primary
font.pixelSize: Theme.fontSizeSmall
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
}
}
}
}

View File

@@ -0,0 +1,207 @@
# Popout Control Example Plugin
This example plugin demonstrates:
- Using `PopoutService` to trigger positioned popouts and modals
- Using `pillClickAction` with position parameters
- Using `PluginSettings` with dropdown selection
- Dynamic widget text based on settings
The `pillClickAction` receives position parameters `(x, y, width, section, screen)` which are passed to PopoutService functions to properly position popouts relative to the widget.
## PopoutService API
The `PopoutService` is automatically injected into plugin widgets and daemons as `popoutService`. It provides access to all shell popouts and modals.
### Available Popouts
#### Control Center
```qml
popoutService.openControlCenter()
popoutService.closeControlCenter()
popoutService.toggleControlCenter()
```
#### Notification Center
```qml
popoutService.openNotificationCenter()
popoutService.closeNotificationCenter()
popoutService.toggleNotificationCenter()
```
#### App Drawer
```qml
popoutService.openAppDrawer()
popoutService.closeAppDrawer()
popoutService.toggleAppDrawer()
```
#### Process List (Popout)
```qml
popoutService.openProcessList()
popoutService.closeProcessList()
popoutService.toggleProcessList()
```
#### DankDash
```qml
popoutService.openDankDash(tabIndex) // tabIndex: 0=Calendar, 1=Media, 2=Weather
popoutService.closeDankDash()
popoutService.toggleDankDash(tabIndex)
```
#### Battery Popout
```qml
popoutService.openBattery()
popoutService.closeBattery()
popoutService.toggleBattery()
```
#### VPN Popout
```qml
popoutService.openVpn()
popoutService.closeVpn()
popoutService.toggleVpn()
```
#### System Update Popout
```qml
popoutService.openSystemUpdate()
popoutService.closeSystemUpdate()
popoutService.toggleSystemUpdate()
```
### Available Modals
#### Settings Modal
```qml
popoutService.openSettings()
popoutService.closeSettings()
```
#### Clipboard History Modal
```qml
popoutService.openClipboardHistory()
popoutService.closeClipboardHistory()
```
#### Spotlight Modal
```qml
popoutService.openSpotlight()
popoutService.closeSpotlight()
```
#### Power Menu Modal
```qml
popoutService.openPowerMenu()
popoutService.closePowerMenu()
popoutService.togglePowerMenu()
```
#### Process List Modal (fullscreen)
```qml
popoutService.showProcessListModal()
popoutService.hideProcessListModal()
popoutService.toggleProcessListModal()
```
#### Color Picker Modal
```qml
popoutService.showColorPicker()
popoutService.hideColorPicker()
```
#### Notification Modal
```qml
popoutService.showNotificationModal()
popoutService.hideNotificationModal()
```
#### WiFi Password Modal
```qml
popoutService.showWifiPasswordModal()
popoutService.hideWifiPasswordModal()
```
#### Network Info Modal
```qml
popoutService.showNetworkInfoModal()
popoutService.hideNetworkInfoModal()
```
#### Notepad Slideout
```qml
popoutService.openNotepad()
popoutService.closeNotepad()
popoutService.toggleNotepad()
```
## Usage in Plugins
### Widget Plugins
```qml
import QtQuick
import qs.Common
import qs.Widgets
Rectangle {
id: root
property var popoutService: null // REQUIRED: Must declare for injection
MouseArea {
anchors.fill: parent
onClicked: {
popoutService?.toggleControlCenter()
}
}
}
```
### Daemon Plugins
```qml
import QtQuick
import qs.Services
Item {
id: root
property var popoutService: null // REQUIRED: Must declare for injection
Connections {
target: NotificationService
function onNotificationReceived() {
popoutService?.openNotificationCenter()
}
}
}
```
**Important**: The `popoutService` property **must** be declared in your plugin component. Without it, you'll get errors like:
```
Error: Cannot assign to non-existent property "popoutService"
```
## Example Use Cases
1. **Custom Launcher**: Create a widget that opens the app drawer
2. **Quick Settings**: Toggle control center from a custom button
3. **Notification Manager**: Open notification center on new notifications
4. **System Monitor**: Open process list on high CPU usage
5. **Power Management**: Trigger power menu from a custom widget
## Installation
1. Copy the plugin directory to `~/.config/DankMaterialShell/plugins/`
2. Open Settings → Plugins
3. Click "Scan for Plugins"
4. Enable "Popout Control Example"
5. Add `popoutControlExample` to your DankBar widget list
## Notes
- The `popoutService` property is automatically injected - no manual setup required
- Always use optional chaining (`?.`) when calling methods to handle null cases
- Popouts are lazily loaded - first access may activate the loader
- Some popouts require specific system features to be available

View File

@@ -0,0 +1,13 @@
{
"id": "popoutControlExample",
"name": "Popout Control Example",
"description": "Example widget demonstrating PopoutService usage with pillClickAction",
"version": "1.0.0",
"author": "DankMaterialShell",
"type": "widget",
"capabilities": ["dankbar-widget"],
"component": "./PopoutControlWidget.qml",
"icon": "widgets",
"settings": "./PopoutControlSettings.qml",
"permissions": ["settings_read", "settings_write"]
}