Autoformatting + converted a bunch console.log to logger, hiding some extra logging

This commit is contained in:
LemmyCook 2025-08-24 08:48:39 -04:00
parent c3515ddcc0
commit a7b7c03877
11 changed files with 341 additions and 329 deletions

View file

@ -65,9 +65,12 @@ Variants {
sourceComponent: widgetLoader.getWidgetComponent(modelData)
active: true
visible: {
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled) return false
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled) return false
if (modelData === "Battery" && !shouldShowBattery()) return false
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled)
return false
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled)
return false
if (modelData === "Battery" && !shouldShowBattery())
return false
return true
}
anchors.verticalCenter: parent.verticalCenter
@ -98,9 +101,12 @@ Variants {
sourceComponent: widgetLoader.getWidgetComponent(modelData)
active: true
visible: {
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled) return false
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled) return false
if (modelData === "Battery" && !shouldShowBattery()) return false
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled)
return false
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled)
return false
if (modelData === "Battery" && !shouldShowBattery())
return false
return true
}
anchors.verticalCenter: parent.verticalCenter
@ -132,8 +138,10 @@ Variants {
sourceComponent: widgetLoader.getWidgetComponent(modelData)
active: true
visible: {
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled) return false
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled) return false
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled)
return false
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled)
return false
return true
}
anchors.verticalCenter: parent.verticalCenter

View file

@ -7,7 +7,6 @@ import qs.Commons
import qs.Services
import qs.Widgets
Row {
id: root
anchors.verticalCenter: parent.verticalCenter
@ -43,8 +42,7 @@ Row {
function getTitle() {
// Use the service's focusedWindowTitle property which is updated immediately
// when WindowOpenedOrChanged events are received
return CompositorService.focusedWindowTitle !== "(No active window)" ?
CompositorService.focusedWindowTitle : ""
return CompositorService.focusedWindowTitle !== "(No active window)" ? CompositorService.focusedWindowTitle : ""
}
function getAppIcon() {

View file

@ -25,10 +25,9 @@ Item {
tooltipText: "Keyboard Layout: " + currentLayout
onClicked: {
// You could open keyboard settings here if needed
// For now, just show the current layout
}
}
}

View file

@ -5,31 +5,30 @@ import qs.Services
Item {
id: root
IpcHandler {
target: "settings"
function toggle() {
settingsPanel.toggle(Quickshell.screens[0])
}
}
IpcHandler {
target: "notifications"
function toggleHistory() {
notificationHistoryPanel.toggle(Quickshell.screens[0])
}
function toggleDoNotDisturb() {
// TODO
function toggleDoNotDisturb() {// TODO
}
}
IpcHandler {
target: "idleInhibitor"
function toggle() {
return IdleInhibitorService.manualToggle()
}
}
IpcHandler {
target: "appLauncher"
function toggle() {
@ -39,18 +38,18 @@ Item {
launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set clipboard mode
Qt.callLater(() => {
launcherPanel.setSearchText(">clip ")
})
launcherPanel.setSearchText(">clip ")
})
}
function calculator() {
launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set calculator mode
Qt.callLater(() => {
launcherPanel.setSearchText(">calc ")
})
launcherPanel.setSearchText(">calc ")
})
}
}
IpcHandler {
target: "launcher"
function toggle() {
@ -60,18 +59,18 @@ Item {
launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set clipboard mode
Qt.callLater(() => {
launcherPanel.setSearchText(">clip ")
})
launcherPanel.setSearchText(">clip ")
})
}
function calculator() {
launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set calculator mode
Qt.callLater(() => {
launcherPanel.setSearchText(">calc ")
})
launcherPanel.setSearchText(">calc ")
})
}
}
IpcHandler {
target: "lockScreen"
function toggle() {
@ -82,7 +81,7 @@ Item {
}
}
}
IpcHandler {
target: "brightness"
function increase() {
@ -92,11 +91,11 @@ Item {
BrightnessService.decreaseBrightness()
}
}
IpcHandler {
target: "powerPanel"
function toggle() {
powerPanel.toggle(Quickshell.screens[0])
}
}
}
}

View file

@ -33,7 +33,7 @@ QtObject {
}
} else {
// Fallback to basic evaluation
console.log("AdvancedMath not available, using basic eval")
Logger.warn("Calculator", "AdvancedMath not available, using basic eval")
// Basic preprocessing for common functions
var processed = expression.trim(

View file

@ -26,7 +26,7 @@ NPanel {
// Properties
property string searchText: ""
// Add function to set search text programmatically
function setSearchText(text) {
searchText = text
@ -521,4 +521,4 @@ NPanel {
}
}
}
}
}

View file

@ -167,7 +167,8 @@ Loader {
Item {
id: keyboardLayout
property string currentLayout: (typeof KeyboardLayoutService !== 'undefined' && KeyboardLayoutService.currentLayout) ? KeyboardLayoutService.currentLayout : "Unknown"
property string currentLayout: (typeof KeyboardLayoutService !== 'undefined'
&& KeyboardLayoutService.currentLayout) ? KeyboardLayoutService.currentLayout : "Unknown"
}
// Wallpaper image

View file

@ -202,13 +202,13 @@ ColumnLayout {
// Helper functions
function addWidgetToSection(widgetName, section) {
console.log("Adding widget", widgetName, "to section", section)
//Logger.log("BarTab", "Adding widget", widgetName, "to section", section)
var sectionArray = Settings.data.bar.widgets[section]
if (sectionArray) {
// Create a new array to avoid modifying the original
var newArray = sectionArray.slice()
newArray.push(widgetName)
console.log("Widget added. New array:", JSON.stringify(newArray))
//Logger.log("BarTab", "Widget added. New array:", JSON.stringify(newArray))
// Assign the new array
Settings.data.bar.widgets[section] = newArray
@ -216,34 +216,35 @@ ColumnLayout {
}
function removeWidgetFromSection(section, index) {
console.log("Removing widget from section", section, "at index", index)
// Logger.log("BarTab", "Removing widget from section", section, "at index", index)
var sectionArray = Settings.data.bar.widgets[section]
console.log("Current section array:", JSON.stringify(sectionArray))
//Logger.log("BarTab", "Current section array:", JSON.stringify(sectionArray))
if (sectionArray && index >= 0 && index < sectionArray.length) {
// Create a new array to avoid modifying the original
var newArray = sectionArray.slice()
newArray.splice(index, 1)
console.log("Widget removed. New array:", JSON.stringify(newArray))
//Logger.log("BarTab", "Widget removed. New array:", JSON.stringify(newArray))
// Assign the new array
Settings.data.bar.widgets[section] = newArray
// Force a settings save
console.log("Settings updated, triggering save...")
//Logger.log("BarTab", "Settings updated, triggering save...")
// Verify the change was applied
Qt.setTimeout(function() {
Qt.setTimeout(function () {
var updatedArray = Settings.data.bar.widgets[section]
console.log("Verification - updated section array:", JSON.stringify(updatedArray))
//Logger.log("BarTab", "Verification - updated section array:", JSON.stringify(updatedArray))
}, 100)
} else {
console.log("Invalid section or index:", section, index, "array length:", sectionArray ? sectionArray.length : "null")
//Logger.log("BarTab", "Invalid section or index:", section, index, "array length:",
// sectionArray ? sectionArray.length : "null")
}
}
function reorderWidgetInSection(section, fromIndex, toIndex) {
console.log("Reordering widget in section", section, "from", fromIndex, "to", toIndex)
//Logger.log("BarTab", "Reordering widget in section", section, "from", fromIndex, "to", toIndex)
var sectionArray = Settings.data.bar.widgets[section]
if (sectionArray && fromIndex >= 0 && fromIndex < sectionArray.length && toIndex >= 0
&& toIndex < sectionArray.length) {
@ -253,7 +254,7 @@ ColumnLayout {
var item = newArray[fromIndex]
newArray.splice(fromIndex, 1)
newArray.splice(toIndex, 0, item)
console.log("Widget reordered. New array:", JSON.stringify(newArray))
Logger.log("BarTab", "Widget reordered. New array:", JSON.stringify(newArray))
// Assign the new array
Settings.data.bar.widgets[section] = newArray