mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
meta cleanup and refactors
This commit is contained in:
@@ -24,11 +24,6 @@ PanelWindow {
|
||||
property int selectedIndex: 0
|
||||
|
||||
function updateFilteredModel() {
|
||||
if (!AppSearchService.ready) {
|
||||
filteredModel.clear();
|
||||
selectedIndex = 0;
|
||||
return ;
|
||||
}
|
||||
filteredModel.clear();
|
||||
selectedIndex = 0;
|
||||
var apps = [];
|
||||
@@ -118,7 +113,7 @@ PanelWindow {
|
||||
var selectedApp = filteredModel.get(selectedIndex);
|
||||
if (selectedApp.desktopEntry) {
|
||||
Prefs.addRecentApp(selectedApp.desktopEntry);
|
||||
AppSearchService.launchApp(selectedApp.desktopEntry);
|
||||
selectedApp.desktopEntry.execute();
|
||||
} else {
|
||||
launcher.launchApp(selectedApp.exec);
|
||||
}
|
||||
@@ -130,7 +125,7 @@ PanelWindow {
|
||||
// Try to find the desktop entry
|
||||
var app = AppSearchService.getAppByExec(exec);
|
||||
if (app) {
|
||||
AppSearchService.launchApp(app);
|
||||
app.execute();
|
||||
} else {
|
||||
// Fallback to direct execution
|
||||
var cleanExec = exec.replace(/%[fFuU]/g, "").trim();
|
||||
@@ -171,14 +166,12 @@ PanelWindow {
|
||||
visible: isVisible
|
||||
color: "transparent"
|
||||
Component.onCompleted: {
|
||||
if (AppSearchService.ready) {
|
||||
var allCategories = AppSearchService.getAllCategories();
|
||||
// Insert "Recents" after "All"
|
||||
categories = ["All", "Recents"].concat(allCategories.filter((cat) => {
|
||||
return cat !== "All";
|
||||
}));
|
||||
updateFilteredModel();
|
||||
}
|
||||
var allCategories = AppSearchService.getAllCategories();
|
||||
// Insert "Recents" after "All"
|
||||
categories = ["All", "Recents"].concat(allCategories.filter((cat) => {
|
||||
return cat !== "All";
|
||||
}));
|
||||
updateFilteredModel();
|
||||
recentApps = Prefs.getRecentApps(); // Load recent apps on startup
|
||||
}
|
||||
|
||||
@@ -194,7 +187,7 @@ PanelWindow {
|
||||
Timer {
|
||||
id: searchDebounceTimer
|
||||
|
||||
interval: 100
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: updateFilteredModel()
|
||||
}
|
||||
@@ -226,56 +219,21 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onReadyChanged() {
|
||||
if (AppSearchService.ready) {
|
||||
var allCategories = AppSearchService.getAllCategories();
|
||||
// Insert "Recents" after "All"
|
||||
categories = ["All", "Recents"].concat(allCategories.filter((cat) => {
|
||||
return cat !== "All";
|
||||
}));
|
||||
updateFilteredModel();
|
||||
}
|
||||
}
|
||||
|
||||
target: AppSearchService
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onApplicationsChanged() {
|
||||
console.log("AppLauncher: DesktopEntries.applicationsChanged signal received");
|
||||
// Update categories when applications change
|
||||
if (AppSearchService.ready) {
|
||||
console.log("AppLauncher: Updating categories and model due to applicationsChanged");
|
||||
var allCategories = AppSearchService.getAllCategories();
|
||||
categories = ["All", "Recents"].concat(allCategories.filter((cat) => {
|
||||
return cat !== "All";
|
||||
}));
|
||||
updateFilteredModel();
|
||||
} else {
|
||||
console.log("AppLauncher: AppSearchService not ready, skipping update");
|
||||
}
|
||||
console.log("AppLauncher: Updating categories and model due to applicationsChanged");
|
||||
var allCategories = AppSearchService.getAllCategories();
|
||||
categories = ["All", "Recents"].concat(allCategories.filter((cat) => {
|
||||
return cat !== "All";
|
||||
}));
|
||||
updateFilteredModel();
|
||||
}
|
||||
|
||||
target: DesktopEntries
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onShowAppLauncher() {
|
||||
launcher.show();
|
||||
}
|
||||
|
||||
function onHideAppLauncher() {
|
||||
launcher.hide();
|
||||
}
|
||||
|
||||
function onToggleAppLauncher() {
|
||||
launcher.toggle();
|
||||
}
|
||||
|
||||
target: LauncherService
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onRecentlyUsedAppsChanged() {
|
||||
recentApps = Prefs.getRecentApps();
|
||||
@@ -530,7 +488,7 @@ PanelWindow {
|
||||
var firstApp = filteredModel.get(0);
|
||||
if (firstApp.desktopEntry) {
|
||||
Prefs.addRecentApp(firstApp.desktopEntry);
|
||||
AppSearchService.launchApp(firstApp.desktopEntry);
|
||||
firstApp.desktopEntry.execute();
|
||||
} else {
|
||||
launcher.launchApp(firstApp.exec);
|
||||
}
|
||||
@@ -1033,7 +991,7 @@ PanelWindow {
|
||||
onClicked: {
|
||||
if (model.desktopEntry) {
|
||||
Prefs.addRecentApp(model.desktopEntry);
|
||||
AppSearchService.launchApp(model.desktopEntry);
|
||||
model.desktopEntry.execute();
|
||||
} else {
|
||||
launcher.launchApp(model.exec);
|
||||
}
|
||||
@@ -1107,7 +1065,7 @@ PanelWindow {
|
||||
onClicked: {
|
||||
if (model.desktopEntry) {
|
||||
Prefs.addRecentApp(model.desktopEntry);
|
||||
AppSearchService.launchApp(model.desktopEntry);
|
||||
model.desktopEntry.execute();
|
||||
} else {
|
||||
launcher.launchApp(model.exec);
|
||||
}
|
||||
|
||||
@@ -21,14 +21,12 @@ PanelWindow {
|
||||
|
||||
function setProfile(profile) {
|
||||
if (typeof PowerProfiles === "undefined") {
|
||||
errorToast.show();
|
||||
ToastService.showError("power-profiles-daemon not available");
|
||||
return ;
|
||||
}
|
||||
PowerProfiles.profile = profile;
|
||||
if (PowerProfiles.profile !== profile)
|
||||
errorToast.show();
|
||||
else
|
||||
console.log("Set power profile to: " + PowerProfile.toString(profile));
|
||||
ToastService.showError("Failed to set power profile");
|
||||
}
|
||||
|
||||
visible: batteryPopupVisible
|
||||
@@ -367,7 +365,7 @@ PanelWindow {
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Text {
|
||||
text: Theme.getPowerProfileIcon(PowerProfile.toString(modelData))
|
||||
text: Theme.getPowerProfileIcon(modelData)
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSize
|
||||
color: batteryControlPopup.isActiveProfile(modelData) ? Theme.primary : Theme.surfaceText
|
||||
@@ -379,14 +377,14 @@ PanelWindow {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Text {
|
||||
text: Theme.getPowerProfileLabel(PowerProfile.toString(modelData))
|
||||
text: Theme.getPowerProfileLabel(modelData)
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: batteryControlPopup.isActiveProfile(modelData) ? Theme.primary : Theme.surfaceText
|
||||
font.weight: batteryControlPopup.isActiveProfile(modelData) ? Font.Medium : Font.Normal
|
||||
}
|
||||
|
||||
Text {
|
||||
text: Theme.getPowerProfileDescription(PowerProfile.toString(modelData))
|
||||
text: Theme.getPowerProfileDescription(modelData)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
}
|
||||
@@ -483,40 +481,5 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Error toast
|
||||
Rectangle {
|
||||
id: errorToast
|
||||
|
||||
function show() {
|
||||
visible = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
|
||||
width: Math.min(300, parent.width - Theme.spacingL * 2)
|
||||
height: 50
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.error
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Theme.spacingL
|
||||
visible: false
|
||||
z: 1000
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "power-profiles-daemon not available"
|
||||
color: "white"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
|
||||
interval: 3000
|
||||
onTriggered: errorToast.visible = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,10 +31,6 @@ Column {
|
||||
loadEventsForMonth();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
console.log("CalendarWidget: Component completed, CalendarService available:", !!CalendarService);
|
||||
if (CalendarService)
|
||||
console.log("CalendarWidget: khal available:", CalendarService.khalAvailable);
|
||||
|
||||
loadEventsForMonth();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ PanelWindow {
|
||||
property bool calendarVisible: false
|
||||
|
||||
visible: calendarVisible
|
||||
onVisibleChanged: {
|
||||
if (visible && CalendarService) {
|
||||
CalendarService.loadCurrentMonth();
|
||||
}
|
||||
}
|
||||
implicitWidth: 480
|
||||
implicitHeight: 600
|
||||
WlrLayershell.layer: WlrLayershell.Overlay
|
||||
|
||||
@@ -23,9 +23,9 @@ Rectangle {
|
||||
|
||||
onActivePlayerChanged: {
|
||||
if (!activePlayer)
|
||||
clearCacheTimer.restart();
|
||||
updateTimer.start();
|
||||
else
|
||||
clearCacheTimer.stop();
|
||||
updateTimer.stop();
|
||||
}
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@@ -36,30 +36,28 @@ Rectangle {
|
||||
layer.enabled: true
|
||||
|
||||
Timer {
|
||||
id: clearCacheTimer
|
||||
id: updateTimer
|
||||
|
||||
interval: 2000
|
||||
running: {
|
||||
// Run when no active player (for cache clearing) OR when playing (for position updates)
|
||||
return (!activePlayer) ||
|
||||
(activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing &&
|
||||
activePlayer.length > 0 && !progressMouseArea.isSeeking);
|
||||
}
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (!activePlayer) {
|
||||
// Clear cache when no player
|
||||
lastValidTitle = "";
|
||||
lastValidArtist = "";
|
||||
lastValidAlbum = "";
|
||||
lastValidArtUrl = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updates progress bar every 2 seconds when playing
|
||||
Timer {
|
||||
id: positionTimer
|
||||
|
||||
interval: 2000
|
||||
running: activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing && activePlayer.length > 0 && !progressMouseArea.isSeeking
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing && !progressMouseArea.isSeeking)
|
||||
stop(); // Stop after clearing cache
|
||||
} else if (activePlayer.playbackState === MprisPlaybackState.Playing && !progressMouseArea.isSeeking) {
|
||||
// Update position when playing
|
||||
currentPosition = activePlayer.position;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
@@ -23,6 +24,10 @@ PanelWindow {
|
||||
if (!visible && BluetoothService.adapter && BluetoothService.adapter.discovering) {
|
||||
BluetoothService.adapter.discovering = false;
|
||||
}
|
||||
// Refresh uptime when opened
|
||||
if (visible && UserInfoService) {
|
||||
UserInfoService.getUptime();
|
||||
}
|
||||
}
|
||||
implicitWidth: 600
|
||||
implicitHeight: 500
|
||||
@@ -120,7 +125,7 @@ PanelWindow {
|
||||
}
|
||||
]
|
||||
|
||||
Column {
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
@@ -698,7 +703,7 @@ PanelWindow {
|
||||
// Tab content area
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: root.powerOptionsExpanded ? 240 : 300
|
||||
Layout.fillHeight: true
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, Theme.getContentBackgroundAlpha() * 0.1)
|
||||
|
||||
|
||||
@@ -11,6 +11,16 @@ ScrollView {
|
||||
id: displayTab
|
||||
|
||||
clip: true
|
||||
|
||||
property var brightnessDebounceTimer: Timer {
|
||||
interval: BrightnessService.ddcAvailable ? 500 : 50 // 500ms for slow DDC (i2c), 50ms for fast laptop backlight
|
||||
repeat: false
|
||||
property int pendingValue: 0
|
||||
onTriggered: {
|
||||
console.log("Debounce timer fired, setting brightness to:", pendingValue);
|
||||
BrightnessService.setBrightness(pendingValue);
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
@@ -36,8 +46,23 @@ ScrollView {
|
||||
rightIcon: "brightness_high"
|
||||
enabled: BrightnessService.brightnessAvailable
|
||||
onSliderValueChanged: function(newValue) {
|
||||
BrightnessService.setBrightness(newValue);
|
||||
console.log("Slider changed to:", newValue);
|
||||
brightnessDebounceTimer.pendingValue = newValue;
|
||||
brightnessDebounceTimer.restart();
|
||||
}
|
||||
onSliderDragFinished: function(finalValue) {
|
||||
console.log("Drag finished, immediate set:", finalValue);
|
||||
brightnessDebounceTimer.stop();
|
||||
BrightnessService.setBrightness(finalValue);
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "using ddc - changes may take a moment to apply"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
visible: BrightnessService.ddcAvailable && !BrightnessService.laptopBacklightAvailable
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
z: 10
|
||||
opacity: networkTab.changingNetworkPreference ? 0.6 : 1
|
||||
visible: networkTab.networkStatus !== "ethernet"
|
||||
visible: NetworkService.networkStatus !== "ethernet" && NetworkService.wifiAvailable && NetworkService.wifiEnabled
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
@@ -330,197 +330,215 @@ Item {
|
||||
id: wifiContent
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// WiFi toggle control (only show if WiFi hardware is available)
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 50
|
||||
radius: Theme.cornerRadius
|
||||
color: wifiToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)
|
||||
visible: NetworkService.wifiAvailable
|
||||
opacity: NetworkService.wifiToggling ? 0.6 : 1
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Text {
|
||||
id: wifiToggleIcon
|
||||
|
||||
text: NetworkService.wifiToggling ? "sync" : "power_settings_new"
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSize
|
||||
color: NetworkService.wifiEnabled ? Theme.primary : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
rotation: NetworkService.wifiToggling ? wifiToggleIcon.rotation : 0
|
||||
|
||||
RotationAnimation {
|
||||
target: wifiToggleIcon
|
||||
property: "rotation"
|
||||
running: NetworkService.wifiToggling
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
|
||||
Behavior on rotation {
|
||||
RotationAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Text {
|
||||
text: NetworkService.wifiToggling ? "Switching WiFi..." : (NetworkService.wifiEnabled ? "Turn WiFi Off" : "Turn WiFi On")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: wifiToggleArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
NetworkService.toggleWifiRadio();
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Current WiFi connection (if connected)
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 80
|
||||
height: 60
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.5)
|
||||
border.color: networkTab.networkStatus === "wifi" ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
border.width: networkTab.networkStatus === "wifi" ? 2 : 1
|
||||
visible: NetworkService.wifiAvailable && NetworkService.wifiEnabled
|
||||
border.color: NetworkService.networkStatus === "wifi" ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
border.width: NetworkService.networkStatus === "wifi" ? 2 : 1
|
||||
visible: NetworkService.wifiAvailable
|
||||
|
||||
Row {
|
||||
// WiFi icon
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingL
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingM
|
||||
text: {
|
||||
if (!NetworkService.wifiEnabled) {
|
||||
return "wifi_off";
|
||||
} else if (NetworkService.networkStatus === "wifi") {
|
||||
return WifiService.wifiSignalStrength === "excellent" ? "wifi" : WifiService.wifiSignalStrength === "good" ? "wifi_2_bar" : WifiService.wifiSignalStrength === "fair" ? "wifi_1_bar" : WifiService.wifiSignalStrength === "poor" ? "wifi_calling_3" : "wifi";
|
||||
} else {
|
||||
return "wifi";
|
||||
}
|
||||
}
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSize
|
||||
color: NetworkService.networkStatus === "wifi" ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
// WiFi info text
|
||||
Column {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingL + Theme.iconSize + Theme.spacingM
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingL + 48 + Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 4
|
||||
|
||||
Text {
|
||||
text: networkTab.networkStatus === "wifi" ? (WifiService.wifiSignalStrength === "excellent" ? "wifi" : WifiService.wifiSignalStrength === "good" ? "wifi_2_bar" : WifiService.wifiSignalStrength === "fair" ? "wifi_1_bar" : WifiService.wifiSignalStrength === "poor" ? "wifi_calling_3" : "wifi") : "wifi"
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSizeLarge
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.primary : Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: {
|
||||
if (!NetworkService.wifiEnabled) {
|
||||
return "WiFi is off";
|
||||
} else if (NetworkService.wifiEnabled && WifiService.currentWifiSSID) {
|
||||
return WifiService.currentWifiSSID || "Connected";
|
||||
} else {
|
||||
return "Not Connected";
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: NetworkService.networkStatus === "wifi" ? Theme.primary : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 4
|
||||
Text {
|
||||
text: {
|
||||
if (!NetworkService.wifiEnabled) {
|
||||
return "Turn on WiFi to see available networks";
|
||||
} else if (NetworkService.wifiEnabled && WifiService.currentWifiSSID) {
|
||||
return NetworkService.wifiIP || "Connected";
|
||||
} else {
|
||||
return "Select a network below";
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
}
|
||||
}
|
||||
|
||||
// WiFi toggle switch
|
||||
Rectangle {
|
||||
width: 48
|
||||
height: 24
|
||||
radius: 12
|
||||
color: NetworkService.wifiEnabled ? Theme.primary : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingL
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opacity: NetworkService.wifiToggling ? 0.6 : 1
|
||||
|
||||
Rectangle {
|
||||
id: toggleHandle
|
||||
width: 20
|
||||
height: 20
|
||||
radius: 10
|
||||
color: Theme.surface
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: NetworkService.wifiEnabled ? parent.width - width - 2 : 2
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
// Subtle shadow/glow effect
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width + 2
|
||||
height: parent.height + 2
|
||||
radius: (parent.width + 2) / 2
|
||||
color: "transparent"
|
||||
border.color: Qt.rgba(0, 0, 0, 0.1)
|
||||
border.width: 1
|
||||
z: -1
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: wifiToggleArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
NetworkService.toggleWifiRadio();
|
||||
// Refresh network status and WiFi info after toggle with delay
|
||||
refreshTimer.triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force WiFi preference button
|
||||
Rectangle {
|
||||
width: 150
|
||||
height: 30
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.primary : Theme.surface
|
||||
border.color: Theme.primary
|
||||
border.width: 1
|
||||
radius: 6
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingL + 48 + Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opacity: networkTab.changingNetworkPreference ? 0.6 : 1
|
||||
visible: NetworkService.networkStatus !== "wifi" && NetworkService.ethernetConnected && NetworkService.wifiEnabled
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Text {
|
||||
text: NetworkService.networkStatus === "wifi" ? (WifiService.currentWifiSSID || "Connected") : "Not Connected"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.primary : Theme.surfaceText
|
||||
id: wifiPreferenceIcon
|
||||
|
||||
text: networkTab.changingNetworkPreference ? "sync" : ""
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.background : Theme.primary
|
||||
visible: networkTab.changingNetworkPreference
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
rotation: networkTab.changingNetworkPreference ? wifiPreferenceIcon.rotation : 0
|
||||
|
||||
RotationAnimation {
|
||||
target: wifiPreferenceIcon
|
||||
property: "rotation"
|
||||
running: networkTab.changingNetworkPreference
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Text {
|
||||
text: NetworkService.changingNetworkPreference ? "Switching..." : "Prefer over Ethernet"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: NetworkService.networkStatus === "wifi" ? Theme.background : Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Text {
|
||||
text: NetworkService.networkStatus === "wifi" ? (NetworkService.wifiIP || "Connected") : "Select a network below"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Force WiFi preference button
|
||||
Rectangle {
|
||||
width: 150
|
||||
height: 30
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.primary : Theme.surface
|
||||
border.color: Theme.primary
|
||||
border.width: 1
|
||||
radius: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opacity: networkTab.changingNetworkPreference ? 0.6 : 1
|
||||
visible: networkTab.networkStatus !== "wifi"
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Text {
|
||||
id: wifiPreferenceIcon
|
||||
|
||||
text: networkTab.changingNetworkPreference ? "sync" : ""
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.background : Theme.primary
|
||||
visible: networkTab.changingNetworkPreference
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
rotation: networkTab.changingNetworkPreference ? wifiPreferenceIcon.rotation : 0
|
||||
|
||||
RotationAnimation {
|
||||
target: wifiPreferenceIcon
|
||||
property: "rotation"
|
||||
running: networkTab.changingNetworkPreference
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Text {
|
||||
text: NetworkService.changingNetworkPreference ? "Switching..." : (NetworkService.networkStatus === "wifi" ? "" : "Prefer over Ethernet")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: NetworkService.networkStatus === "wifi" ? Theme.background : Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
propagateComposedEvents: false
|
||||
enabled: !networkTab.changingNetworkPreference
|
||||
onClicked: {
|
||||
console.log("Force WiFi preference clicked");
|
||||
if (NetworkService.networkStatus !== "wifi")
|
||||
NetworkService.setNetworkPreference("wifi");
|
||||
else
|
||||
NetworkService.setNetworkPreference("auto");
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
propagateComposedEvents: false
|
||||
enabled: !networkTab.changingNetworkPreference
|
||||
onClicked: {
|
||||
console.log("Force WiFi preference clicked");
|
||||
if (NetworkService.networkStatus !== "wifi")
|
||||
NetworkService.setNetworkPreference("wifi");
|
||||
else
|
||||
NetworkService.setNetworkPreference("auto");
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
@@ -532,7 +550,7 @@ Item {
|
||||
// Available WiFi Networks
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
visible: NetworkService.wifiEnabled
|
||||
|
||||
Row {
|
||||
@@ -607,7 +625,7 @@ Item {
|
||||
// Connection status indicator
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 40
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
if (WifiService.connectionStatus === "connecting")
|
||||
@@ -733,7 +751,7 @@ Item {
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 50
|
||||
height: 42
|
||||
radius: Theme.cornerRadiusSmall
|
||||
color: networkArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : modelData.connected ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
border.color: modelData.connected ? Theme.primary : "transparent"
|
||||
@@ -741,7 +759,7 @@ Item {
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
anchors.margins: Theme.spacingS
|
||||
|
||||
// Signal strength icon
|
||||
Text {
|
||||
@@ -758,9 +776,9 @@ Item {
|
||||
// Network info
|
||||
Column {
|
||||
anchors.left: signalIcon.right
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.right: rightIcons.left
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
|
||||
@@ -916,4 +934,30 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
// Timer for refreshing network status after WiFi toggle
|
||||
Timer {
|
||||
id: refreshTimer
|
||||
interval: 2000
|
||||
running: networkTab.visible && refreshTimer.triggered
|
||||
property bool triggered: false
|
||||
onTriggered: {
|
||||
NetworkService.refreshNetworkStatus();
|
||||
if (NetworkService.wifiEnabled) {
|
||||
WifiService.scanWifi();
|
||||
}
|
||||
triggered = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-refresh when WiFi state changes
|
||||
Connections {
|
||||
target: NetworkService
|
||||
function onWifiEnabledChanged() {
|
||||
if (NetworkService.wifiEnabled && networkTab.visible) {
|
||||
// When WiFi is enabled, scan and update info (only if tab is visible)
|
||||
WifiService.scanWifi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ Item {
|
||||
signal sliderDragFinished(int finalValue)
|
||||
|
||||
height: 80
|
||||
|
||||
property bool isDragging: false
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
@@ -139,7 +141,8 @@ Item {
|
||||
preventStealing: true
|
||||
onPressed: (mouse) => {
|
||||
if (slider.enabled) {
|
||||
isDragging = true;
|
||||
slider.isDragging = true;
|
||||
sliderMouseArea.isDragging = true;
|
||||
let ratio = Math.max(0, Math.min(1, mouse.x / width));
|
||||
let newValue = Math.round(slider.minimum + ratio * (slider.maximum - slider.minimum));
|
||||
slider.value = newValue;
|
||||
@@ -148,12 +151,13 @@ Item {
|
||||
}
|
||||
onReleased: {
|
||||
if (slider.enabled) {
|
||||
isDragging = false;
|
||||
slider.isDragging = false;
|
||||
sliderMouseArea.isDragging = false;
|
||||
slider.sliderDragFinished(slider.value);
|
||||
}
|
||||
}
|
||||
onPositionChanged: (mouse) => {
|
||||
if (pressed && isDragging && slider.enabled) {
|
||||
if (pressed && slider.isDragging && slider.enabled) {
|
||||
let ratio = Math.max(0, Math.min(1, mouse.x / width));
|
||||
let newValue = Math.round(slider.minimum + ratio * (slider.maximum - slider.minimum));
|
||||
slider.value = newValue;
|
||||
@@ -161,7 +165,7 @@ Item {
|
||||
}
|
||||
}
|
||||
onClicked: (mouse) => {
|
||||
if (slider.enabled) {
|
||||
if (slider.enabled && !slider.isDragging) {
|
||||
let ratio = Math.max(0, Math.min(1, mouse.x / width));
|
||||
let newValue = Math.round(slider.minimum + ratio * (slider.maximum - slider.minimum));
|
||||
slider.value = newValue;
|
||||
@@ -175,11 +179,11 @@ Item {
|
||||
id: sliderGlobalMouseArea
|
||||
|
||||
anchors.fill: sliderContainer
|
||||
enabled: sliderMouseArea.isDragging
|
||||
enabled: slider.isDragging
|
||||
visible: false
|
||||
preventStealing: true
|
||||
onPositionChanged: (mouse) => {
|
||||
if (sliderMouseArea.isDragging && slider.enabled) {
|
||||
if (slider.isDragging && slider.enabled) {
|
||||
let globalPos = mapToItem(sliderTrack, mouse.x, mouse.y);
|
||||
let ratio = Math.max(0, Math.min(1, globalPos.x / sliderTrack.width));
|
||||
let newValue = Math.round(slider.minimum + ratio * (slider.maximum - slider.minimum));
|
||||
@@ -188,7 +192,8 @@ Item {
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
if (sliderMouseArea.isDragging && slider.enabled) {
|
||||
if (slider.isDragging && slider.enabled) {
|
||||
slider.isDragging = false;
|
||||
sliderMouseArea.isDragging = false;
|
||||
slider.sliderDragFinished(slider.value);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ PanelWindow {
|
||||
ProcessMonitorService.updateProcessList();
|
||||
SystemMonitorService.enableDetailedMonitoring(true);
|
||||
SystemMonitorService.updateSystemInfo();
|
||||
UserInfoService.getUptime();
|
||||
}
|
||||
|
||||
function hide() {
|
||||
@@ -1479,7 +1480,7 @@ PanelWindow {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: SystemMonitorService.uptime
|
||||
text: UserInfoService.uptime
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
|
||||
@@ -58,12 +58,6 @@ PanelWindow {
|
||||
}
|
||||
|
||||
function updateFilteredApps() {
|
||||
if (!AppSearchService.ready) {
|
||||
filteredApps = [];
|
||||
selectedIndex = 0;
|
||||
filteredModel.clear();
|
||||
return ;
|
||||
}
|
||||
filteredApps = [];
|
||||
selectedIndex = 0;
|
||||
var apps = [];
|
||||
@@ -149,7 +143,7 @@ PanelWindow {
|
||||
function launchApp(app) {
|
||||
Prefs.addRecentApp(app);
|
||||
if (app.desktopEntry) {
|
||||
AppSearchService.launchApp(app.desktopEntry);
|
||||
app.desktopEntry.execute();
|
||||
} else {
|
||||
var cleanExec = app.exec.replace(/%[fFuU]/g, "").trim();
|
||||
console.log("Spotlight: Launching app directly:", cleanExec);
|
||||
@@ -213,23 +207,21 @@ PanelWindow {
|
||||
color: "transparent"
|
||||
Component.onCompleted: {
|
||||
console.log("SpotlightLauncher: Component.onCompleted called - component loaded successfully!");
|
||||
if (AppSearchService.ready) {
|
||||
var allCategories = AppSearchService.getAllCategories().filter((cat) => {
|
||||
return cat !== "Education" && cat !== "Science";
|
||||
});
|
||||
// Insert "Recents" after "All"
|
||||
var result = ["All", "Recents"];
|
||||
categories = result.concat(allCategories.filter((cat) => {
|
||||
return cat !== "All";
|
||||
}));
|
||||
}
|
||||
var allCategories = AppSearchService.getAllCategories().filter((cat) => {
|
||||
return cat !== "Education" && cat !== "Science";
|
||||
});
|
||||
// Insert "Recents" after "All"
|
||||
var result = ["All", "Recents"];
|
||||
categories = result.concat(allCategories.filter((cat) => {
|
||||
return cat !== "All";
|
||||
}));
|
||||
}
|
||||
|
||||
// Search debouncing
|
||||
Timer {
|
||||
id: searchDebounceTimer
|
||||
|
||||
interval: 100
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: updateFilteredApps()
|
||||
}
|
||||
@@ -262,7 +254,7 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
target: AppSearchService
|
||||
target: DesktopEntries
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
||||
@@ -5,13 +5,17 @@ import qs.Services
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
signal clicked()
|
||||
|
||||
property bool isActive: false
|
||||
|
||||
readonly property bool nerdFontAvailable: Qt.fontFamilies()
|
||||
.indexOf("Symbols Nerd Font") !== -1
|
||||
|
||||
width: 40
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
color: launcherArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.12) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08)
|
||||
color: launcherArea.containsMouse || isActive ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.12) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08)
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
@@ -28,9 +32,7 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
LauncherService.toggleAppLauncher();
|
||||
}
|
||||
onClicked: root.clicked()
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
|
||||
@@ -67,7 +67,7 @@ Rectangle {
|
||||
trayItem.activate();
|
||||
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
if (trayItem.hasMenu)
|
||||
if (trayItem && trayItem.hasMenu)
|
||||
customTrayMenu.showMenu(mouse.x, mouse.y);
|
||||
|
||||
}
|
||||
|
||||
@@ -126,6 +126,10 @@ PanelWindow {
|
||||
|
||||
LauncherButton {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
isActive: launcher.isVisible
|
||||
onClicked: {
|
||||
appLauncher.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
WorkspaceSwitcher {
|
||||
|
||||
@@ -95,7 +95,7 @@ Rectangle {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", sequentialNumber.toString()]);
|
||||
Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", modelData.toString()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ PanelWindow {
|
||||
QsMenuOpener {
|
||||
id: menuOpener
|
||||
|
||||
menu: currentTrayItem ? currentTrayItem.menu : null
|
||||
menu: currentTrayItem && currentTrayItem.hasMenu ? currentTrayItem.menu : null
|
||||
}
|
||||
|
||||
// Custom menu styling using ListView
|
||||
@@ -93,12 +93,7 @@ PanelWindow {
|
||||
text: "M"
|
||||
}
|
||||
|
||||
model: ScriptModel {
|
||||
values: menuOpener.children ? [pe_unknown].filter((item) => {
|
||||
// Filter out empty items and separators
|
||||
return item && item.text && item.text.trim().length > 0 && !item.isSeparator;
|
||||
}) : []
|
||||
}
|
||||
model: menuOpener.children
|
||||
|
||||
delegate: Rectangle {
|
||||
width: ListView.view.width
|
||||
|
||||
Reference in New Issue
Block a user