Bar widgets: modular loading refactoring via BarWidgetRegistry+NWidgetLoader
- Hot reload is working again. - Should also be more memory efficient on multi monitors.
This commit is contained in:
parent
a110a0d636
commit
a10d55e7f5
36 changed files with 514 additions and 446 deletions
99
Services/BarWidgetRegistry.qml
Normal file
99
Services/BarWidgetRegistry.qml
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Modules.Bar.Widgets
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// Widget registry object mapping widget names to components
|
||||
property var widgets: ({
|
||||
"ActiveWindow": activeWindowComponent,
|
||||
"ArchUpdater": archUpdaterComponent,
|
||||
"Battery": batteryComponent,
|
||||
"Bluetooth": bluetoothComponent,
|
||||
"Brightness": brightnessComponent,
|
||||
"Clock": clockComponent,
|
||||
"KeyboardLayout": keyboardLayoutComponent,
|
||||
"MediaMini": mediaMiniComponent,
|
||||
"NotificationHistory": notificationHistoryComponent,
|
||||
"PowerProfile": powerProfileComponent,
|
||||
"ScreenRecorderIndicator": screenRecorderIndicatorComponent,
|
||||
"SidePanelToggle": sidePanelToggleComponent,
|
||||
"SystemMonitor": systemMonitorComponent,
|
||||
"Tray": trayComponent,
|
||||
"Volume": volumeComponent,
|
||||
"WiFi": wiFiComponent,
|
||||
"Workspace": workspaceComponent
|
||||
})
|
||||
|
||||
// Component definitions - these are loaded once at startup
|
||||
property Component activeWindowComponent: Component {
|
||||
ActiveWindow {}
|
||||
}
|
||||
property Component archUpdaterComponent: Component {
|
||||
ArchUpdater {}
|
||||
}
|
||||
property Component batteryComponent: Component {
|
||||
Battery {}
|
||||
}
|
||||
property Component bluetoothComponent: Component {
|
||||
Bluetooth {}
|
||||
}
|
||||
property Component brightnessComponent: Component {
|
||||
Brightness {}
|
||||
}
|
||||
property Component clockComponent: Component {
|
||||
Clock {}
|
||||
}
|
||||
property Component keyboardLayoutComponent: Component {
|
||||
KeyboardLayout {}
|
||||
}
|
||||
property Component mediaMiniComponent: Component {
|
||||
MediaMini {}
|
||||
}
|
||||
property Component notificationHistoryComponent: Component {
|
||||
NotificationHistory {}
|
||||
}
|
||||
property Component powerProfileComponent: Component {
|
||||
PowerProfile {}
|
||||
}
|
||||
property Component screenRecorderIndicatorComponent: Component {
|
||||
ScreenRecorderIndicator {}
|
||||
}
|
||||
property Component sidePanelToggleComponent: Component {
|
||||
SidePanelToggle {}
|
||||
}
|
||||
property Component systemMonitorComponent: Component {
|
||||
SystemMonitor {}
|
||||
}
|
||||
property Component trayComponent: Component {
|
||||
Tray {}
|
||||
}
|
||||
property Component volumeComponent: Component {
|
||||
Volume {}
|
||||
}
|
||||
property Component wiFiComponent: Component {
|
||||
WiFi {}
|
||||
}
|
||||
property Component workspaceComponent: Component {
|
||||
Workspace {}
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// Helper function to get widget component by name
|
||||
function getWidget(name) {
|
||||
return widgets[name] || null
|
||||
}
|
||||
|
||||
// Helper function to check if widget exists
|
||||
function hasWidget(name) {
|
||||
return name in widgets
|
||||
}
|
||||
|
||||
// Get list of available widget names
|
||||
function getAvailableWidgets() {
|
||||
return Object.keys(widgets)
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ Singleton {
|
|||
id: process
|
||||
stdinEnabled: true
|
||||
running: (Settings.data.audio.visualizerType !== "none")
|
||||
&& (PanelService.sidePanel.active || Settings.data.audio.showMiniplayerCava
|
||||
&& (PanelService.getPanel("sidePanel").active || Settings.data.audio.showMiniplayerCava
|
||||
|| (PanelService.lockScreen && PanelService.lockScreen.active))
|
||||
command: ["cava", "-p", "/dev/stdin"]
|
||||
onExited: {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Singleton {
|
|||
property ListModel workspaces: ListModel {}
|
||||
property var windows: []
|
||||
property int focusedWindowIndex: -1
|
||||
property string focusedWindowTitle: "(No active window)"
|
||||
property string focusedWindowTitle: "n/a"
|
||||
property bool inOverview: false
|
||||
|
||||
// Generic events
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
pragma Singleton
|
||||
|
||||
// GitHub API logic and caching
|
||||
Singleton {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
pragma Singleton
|
||||
|
||||
// Weather logic and caching
|
||||
Singleton {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import Quickshell.Services.Notifications
|
||||
pragma Singleton
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
|
|
|||
|
|
@ -1,23 +1,38 @@
|
|||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// A ref. to the sidePanel, so it's accessible from other services
|
||||
property var sidePanel: null
|
||||
|
||||
// A ref. to the lockScreen, so it's accessible from other services
|
||||
// A ref. to the lockScreen, so it's accessible from anywhere
|
||||
// This is not a panel...
|
||||
property var lockScreen: null
|
||||
|
||||
// A ref. to the updatePanel, so it's accessible from other services
|
||||
property var updatePanel: null
|
||||
|
||||
// Currently opened panel
|
||||
property var openedPanel: null
|
||||
|
||||
function registerOpen(panel) {
|
||||
property var registeredPanels: ({})
|
||||
|
||||
// Register this panel
|
||||
function registerPanel(panel) {
|
||||
registeredPanels[panel.objectName] = panel
|
||||
Logger.log("PanelService", "Registered:", panel.objectName)
|
||||
}
|
||||
|
||||
// Returns a panel
|
||||
function getPanel(name) {
|
||||
return registeredPanels[name] || null
|
||||
}
|
||||
|
||||
// Check if a panel exists
|
||||
function hasPanel(name) {
|
||||
return name in registeredPanels
|
||||
}
|
||||
|
||||
// Helper to keep only one panel open at any time
|
||||
function willOpenPanel(panel) {
|
||||
if (openedPanel && openedPanel != panel) {
|
||||
openedPanel.close()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ Singleton {
|
|||
//Logger.log("ScreenRecorder", command)
|
||||
Quickshell.execDetached(["sh", "-c", command])
|
||||
Logger.log("ScreenRecorder", "Started recording")
|
||||
//Logger.log("ScreenRecorder", command)
|
||||
}
|
||||
|
||||
// Stop recording using Quickshell.execDetached
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue