Using a custom logger with colors and timestamp instead of console.xxx
This commit is contained in:
parent
4794477be3
commit
e800bc161d
34 changed files with 278 additions and 236 deletions
|
|
@ -95,11 +95,11 @@ Singleton {
|
|||
path: Settings.configDir + "colors.json"
|
||||
watchChanges: true
|
||||
onFileChanged: {
|
||||
console.log("[Colors] Reloading colors from disk")
|
||||
Logger.log("Colors", "Reloading colors from disk")
|
||||
reload()
|
||||
}
|
||||
onAdapterUpdated: {
|
||||
console.log("[Colors] Writing colors to disk")
|
||||
Logger.log("Colors", "Writing colors to disk")
|
||||
writeAdapter()
|
||||
}
|
||||
onLoadFailed: function (error) {
|
||||
|
|
|
|||
33
Commons/Logger.qml
Normal file
33
Commons/Logger.qml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
function _formatMessage(...args) {
|
||||
var t = Time.getFormattedTimestamp()
|
||||
if (args.length > 1) {
|
||||
var module = args.shift()
|
||||
return `\x1b[36m${t}\x1b[0m \x1b[35m[${module}]\x1b[0m ` + args.join(" ")
|
||||
} else {
|
||||
return `\x1b[36m${t}\x1b[0m ` + args.join(" ")
|
||||
}
|
||||
}
|
||||
|
||||
function log(...args) {
|
||||
var msg = _formatMessage(...args)
|
||||
console.log(msg)
|
||||
}
|
||||
|
||||
function warn(...args) {
|
||||
var msg = _formatMessage(...args)
|
||||
console.warn(msg)
|
||||
}
|
||||
|
||||
function error(...args) {
|
||||
var msg = _formatMessage(...args)
|
||||
console.error(msg)
|
||||
}
|
||||
}
|
||||
|
|
@ -49,11 +49,11 @@ Singleton {
|
|||
reload()
|
||||
}
|
||||
onLoaded: function () {
|
||||
console.log("[Settings] Loaded")
|
||||
Logger.log("Settings", "Loaded")
|
||||
Qt.callLater(function () {
|
||||
// Only set wallpaper on initial load, not on reloads
|
||||
if (isInitialLoad && adapter.wallpaper.current !== "") {
|
||||
console.log("[Settings] Set current wallpaper", adapter.wallpaper.current)
|
||||
Logger.log("Settings", "Set current wallpaper", adapter.wallpaper.current)
|
||||
WallpapersService.setCurrentWallpaper(adapter.wallpaper.current, true)
|
||||
}
|
||||
isInitialLoad = false
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Singleton {
|
|||
property string time: {
|
||||
let timeFormat = Settings.data.location.use12HourClock ? "h:mm AP" : "HH:mm"
|
||||
let timeString = Qt.formatDateTime(date, timeFormat)
|
||||
|
||||
|
||||
if (Settings.data.location.showDateWithClock) {
|
||||
let dayName = date.toLocaleDateString(Qt.locale(), "ddd")
|
||||
dayName = dayName.charAt(0).toUpperCase() + dayName.slice(1)
|
||||
|
|
@ -20,7 +20,7 @@ Singleton {
|
|||
let month = date.toLocaleDateString(Qt.locale(), "MMM")
|
||||
return timeString + " - " + dayName + ", " + day + " " + month
|
||||
}
|
||||
|
||||
|
||||
return timeString
|
||||
}
|
||||
readonly property string dateString: {
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ NLoader {
|
|||
property string searchText: ""
|
||||
property int selectedIndex: 0
|
||||
property var filteredEntries: {
|
||||
console.log("[AppLauncher] Total desktop entries:", desktopEntries ? desktopEntries.length : 0)
|
||||
Logger.log("AppLauncher", "Total desktop entries:", desktopEntries ? desktopEntries.length : 0)
|
||||
if (!desktopEntries || desktopEntries.length === 0) {
|
||||
console.log("[AppLauncher] No desktop entries available")
|
||||
Logger.log("AppLauncher", "No desktop entries available")
|
||||
return []
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ NLoader {
|
|||
return true
|
||||
})
|
||||
|
||||
console.log("[AppLauncher] Visible entries:", visibleEntries.length)
|
||||
Logger.log("AppLauncher", "Visible entries:", visibleEntries.length)
|
||||
|
||||
var query = searchText ? searchText.toLowerCase() : ""
|
||||
var results = []
|
||||
|
|
@ -225,16 +225,16 @@ NLoader {
|
|||
}))
|
||||
}
|
||||
|
||||
console.log("[AppLauncher] Filtered entries:", results.length)
|
||||
Logger.log("AppLauncher", "Filtered entries:", results.length)
|
||||
return results
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[AppLauncher] Component completed")
|
||||
console.log("[AppLauncher] DesktopEntries available:", typeof DesktopEntries !== 'undefined')
|
||||
Logger.log("AppLauncher", "Component completed")
|
||||
Logger.log("AppLauncher", "DesktopEntries available:", typeof DesktopEntries !== 'undefined')
|
||||
if (typeof DesktopEntries !== 'undefined') {
|
||||
console.log("[AppLauncher] DesktopEntries.entries:",
|
||||
DesktopEntries.entries ? DesktopEntries.entries.length : 'undefined')
|
||||
Logger.log("AppLauncher", "DesktopEntries.entries:",
|
||||
DesktopEntries.entries ? DesktopEntries.entries.length : 'undefined')
|
||||
}
|
||||
// Start clipboard refresh immediately on open
|
||||
updateClipboardHistory()
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ NLoader {
|
|||
|
||||
Component.onCompleted: {
|
||||
if (WorkspacesService.isNiri) {
|
||||
console.log("[Overview] Loading Overview component (Niri detected)")
|
||||
Logger.log("Overview", "Loading Overview component (Niri detected)")
|
||||
} else {
|
||||
console.log("[Overview] Skipping Overview component (Niri not detected)")
|
||||
Logger.log("Overview", "Skipping Overview component (Niri not detected)")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ NIconButton {
|
|||
sizeMultiplier: 0.8
|
||||
showBorder: false
|
||||
visible: bluetoothEnabled
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[Bluetooth] Component loaded, bluetoothEnabled:", bluetoothEnabled)
|
||||
console.log("[Bluetooth] BluetoothService available:", typeof BluetoothService !== 'undefined')
|
||||
Logger.log("Bluetooth", "Component loaded, bluetoothEnabled:", bluetoothEnabled)
|
||||
Logger.log("Bluetooth", "BluetoothService available:", typeof BluetoothService !== 'undefined')
|
||||
if (typeof BluetoothService !== 'undefined') {
|
||||
console.log("[Bluetooth] Connected devices:", BluetoothService.connectedDevices.length)
|
||||
Logger.log("Bluetooth", "Connected devices:", BluetoothService.connectedDevices.length)
|
||||
}
|
||||
}
|
||||
icon: {
|
||||
|
|
@ -55,4 +55,4 @@ NIconButton {
|
|||
BluetoothMenu {
|
||||
id: bluetoothMenuLoader
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,34 +214,34 @@ NLoader {
|
|||
// Combine all devices into a single list for the ListView
|
||||
property var allDevices: {
|
||||
const devices = []
|
||||
|
||||
|
||||
// Add connected devices first
|
||||
for (const device of BluetoothService.connectedDevices) {
|
||||
devices.push({
|
||||
device: device,
|
||||
type: 'connected',
|
||||
section: 'Connected Devices'
|
||||
})
|
||||
"device": device,
|
||||
"type": 'connected',
|
||||
"section": 'Connected Devices'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// Add paired devices
|
||||
for (const device of BluetoothService.pairedDevices) {
|
||||
devices.push({
|
||||
device: device,
|
||||
type: 'paired',
|
||||
section: 'Paired Devices'
|
||||
})
|
||||
"device": device,
|
||||
"type": 'paired',
|
||||
"section": 'Paired Devices'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// Add available devices
|
||||
for (const device of BluetoothService.availableDevices) {
|
||||
devices.push({
|
||||
device: device,
|
||||
type: 'available',
|
||||
section: 'Available Devices'
|
||||
})
|
||||
"device": device,
|
||||
"type": 'available',
|
||||
"section": 'Available Devices'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return devices
|
||||
}
|
||||
|
||||
|
|
@ -362,9 +362,8 @@ NLoader {
|
|||
// Empty state when no devices found
|
||||
ColumnLayout {
|
||||
anchors.centerIn: parent
|
||||
visible: Settings.data.network.bluetoothEnabled &&
|
||||
!BluetoothService.isDiscovering &&
|
||||
deviceList.count === 0
|
||||
visible: Settings.data.network.bluetoothEnabled && !BluetoothService.isDiscovering
|
||||
&& deviceList.count === 0
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
|
|
@ -394,4 +393,4 @@ NLoader {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ Item {
|
|||
trayPanel.show()
|
||||
} else {
|
||||
|
||||
console.log("[Tray] no menu available for", modelData.id, "or trayMenu not set")
|
||||
Logger.log("Tray", "No menu available for", modelData.id, "or trayMenu not set")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ PopupWindow {
|
|||
|
||||
function showAt(item, x, y) {
|
||||
if (!item) {
|
||||
console.warn("CustomTrayMenu: anchorItem is undefined, won't show menu.")
|
||||
Logger.warn("TrayMenu", "anchorItem is undefined, won't show menu.")
|
||||
return
|
||||
}
|
||||
anchorItem = item
|
||||
|
|
@ -267,7 +267,7 @@ PopupWindow {
|
|||
|
||||
function showAt(item, x, y) {
|
||||
if (!item) {
|
||||
console.warn("subMenuComponent: anchorItem is undefined, not showing menu.")
|
||||
Logger.warn("TrayMenu", "SubComponent anchorItem is undefined, not showing menu.")
|
||||
return
|
||||
}
|
||||
anchorItem = item
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Item {
|
|||
Connections {
|
||||
target: AudioService.sink?.audio ? AudioService.sink?.audio : null
|
||||
function onVolumeChanged() {
|
||||
// console.log("[Bar:Volume] onVolumeChanged")
|
||||
// Logger.log("Bar:Volume", "onVolumeChanged")
|
||||
if (!firstVolumeReceived) {
|
||||
// Ignore the first volume change
|
||||
firstVolumeReceived = true
|
||||
|
|
|
|||
|
|
@ -145,8 +145,6 @@ NLoader {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
|
||||
|
||||
NIconButton {
|
||||
icon: "refresh"
|
||||
tooltipText: "Refresh Networks"
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ NLoader {
|
|||
label: "Label"
|
||||
description: "Description"
|
||||
onToggled: checked => {
|
||||
console.log("[DemoPanel] NToggle:", checked)
|
||||
Logger.log("DemoPanel", "NToggle:", checked)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ NLoader {
|
|||
}
|
||||
currentKey: "dog"
|
||||
onSelected: function (key) {
|
||||
console.log("[DemoPanel] NComboBox: selected ", key)
|
||||
Logger.log("DemoPanel", "NComboBox: selected ", key)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ NLoader {
|
|||
color: appButton.hovered ? Colors.mSurfaceVariant : "transparent"
|
||||
radius: parent.radius
|
||||
opacity: appButton.hovered ? 0.8 : 0
|
||||
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Style.animationFast
|
||||
|
|
@ -218,9 +218,9 @@ NLoader {
|
|||
mipmap: false
|
||||
antialiasing: false
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
|
||||
scale: appButton.hovered ? 1.1 : 1.0
|
||||
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Style.animationFast
|
||||
|
|
@ -237,9 +237,9 @@ NLoader {
|
|||
font.family: "Material Symbols Rounded"
|
||||
font.pointSize: iconSize * 0.7 * scaling
|
||||
color: appButton.isActive ? Colors.mPrimary : Colors.mOnSurfaceVariant
|
||||
|
||||
|
||||
scale: appButton.hovered ? 1.1 : 1.0
|
||||
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Style.animationFast
|
||||
|
|
|
|||
|
|
@ -24,39 +24,39 @@ WlSessionLock {
|
|||
locked: false
|
||||
|
||||
function unlockAttempt() {
|
||||
console.log("Unlock attempt started")
|
||||
Logger.log("LockScreen", "Unlock attempt started")
|
||||
|
||||
// Real PAM authentication
|
||||
if (!pamAvailable) {
|
||||
lock.errorMessage = "PAM authentication not available."
|
||||
console.log("PAM not available")
|
||||
Logger.log("LockScreen", "PAM not available")
|
||||
return
|
||||
}
|
||||
if (!lock.password) {
|
||||
lock.errorMessage = "Password required."
|
||||
console.log("No password entered")
|
||||
Logger.log("LockScreen", "No password entered")
|
||||
return
|
||||
}
|
||||
console.log("Starting PAM authentication...")
|
||||
Logger.log("LockScreen", "Starting PAM authentication")
|
||||
lock.authenticating = true
|
||||
lock.errorMessage = ""
|
||||
|
||||
console.log("[LockScreen] About to create PAM context with userName:", Quickshell.env("USER"))
|
||||
Logger.log("LockScreen", "About to create PAM context with userName:", Quickshell.env("USER"))
|
||||
var pam = Qt.createQmlObject(
|
||||
'import Quickshell.Services.Pam; PamContext { config: "login"; user: "' + Quickshell.env("USER") + '" }',
|
||||
lock)
|
||||
console.log("PamContext created", pam)
|
||||
Logger.log("LockScreen", "PamContext created", pam)
|
||||
|
||||
pam.onCompleted.connect(function (result) {
|
||||
console.log("PAM completed with result:", result)
|
||||
Logger.log("LockScreen", "PAM completed with result:", result)
|
||||
lock.authenticating = false
|
||||
if (result === PamResult.Success) {
|
||||
console.log("Authentication successful, unlocking...")
|
||||
Logger.log("LockScreen", "Authentication successful, unlocking")
|
||||
lock.locked = false
|
||||
lock.password = ""
|
||||
lock.errorMessage = ""
|
||||
} else {
|
||||
console.log("Authentication failed")
|
||||
Logger.log("LockScreen", "Authentication failed")
|
||||
lock.errorMessage = "Authentication failed."
|
||||
lock.password = ""
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ WlSessionLock {
|
|||
})
|
||||
|
||||
pam.onError.connect(function (error) {
|
||||
console.log("PAM error:", error)
|
||||
Logger.log("LockScreen", "PAM error:", error)
|
||||
lock.authenticating = false
|
||||
lock.errorMessage = pam.message || "Authentication error."
|
||||
lock.password = ""
|
||||
|
|
@ -72,22 +72,22 @@ WlSessionLock {
|
|||
})
|
||||
|
||||
pam.onPamMessage.connect(function () {
|
||||
console.log("PAM message:", pam.message, "isError:", pam.messageIsError)
|
||||
Logger.log("LockScreen", "PAM message:", pam.message, "isError:", pam.messageIsError)
|
||||
if (pam.messageIsError) {
|
||||
lock.errorMessage = pam.message
|
||||
}
|
||||
})
|
||||
|
||||
pam.onResponseRequiredChanged.connect(function () {
|
||||
console.log("PAM response required:", pam.responseRequired)
|
||||
Logger.log("LockScreen", "PAM response required:", pam.responseRequired)
|
||||
if (pam.responseRequired && lock.authenticating) {
|
||||
console.log("Responding to PAM with password")
|
||||
Logger.log("LockScreen", "Responding to PAM with password")
|
||||
pam.respond(lock.password)
|
||||
}
|
||||
})
|
||||
|
||||
var started = pam.start()
|
||||
console.log("PAM start result:", started)
|
||||
Logger.log("LockScreen", "PAM start result:", started)
|
||||
}
|
||||
|
||||
WlSessionLockSurface {
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ NLoader {
|
|||
sizeMultiplier: 0.7
|
||||
|
||||
onClicked: {
|
||||
console.log("[NotificationHistory] Removing notification:", summary)
|
||||
Logger.log("NotificationHistory", "Removing notification:", summary)
|
||||
NotificationService.historyModel.remove(index)
|
||||
NotificationService.saveHistory()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ Item {
|
|||
description: "Display the brightness control icon in the top bar"
|
||||
checked: !Settings.data.bar.hideBrightness
|
||||
onToggled: checked => {
|
||||
Settings.data.bar.hideBrightness = !checked
|
||||
}
|
||||
Settings.data.bar.hideBrightness = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +168,9 @@ Item {
|
|||
color: Colors.mSecondary
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NText {
|
||||
text: BrightnessService.currentMethod === "ddcutil" ? "External (DDC)" : "Internal"
|
||||
|
|
@ -228,7 +230,9 @@ Item {
|
|||
Layout.alignment: Qt.AlignLeft
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NText {
|
||||
text: BrightnessService.available ? "Available" : "Unavailable"
|
||||
|
|
@ -247,4 +251,4 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ ColumnLayout {
|
|||
var jsonData = JSON.parse(text())
|
||||
root.schemeLoaded(schemeName, jsonData)
|
||||
} catch (e) {
|
||||
console.warn("Failed to parse JSON for scheme:", schemeName, e)
|
||||
Logger.warn("Failed to parse JSON for scheme:", schemeName, e)
|
||||
root.schemeLoaded(schemeName, null) // Load defaults on parse error
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ NBox {
|
|||
// Height can be overridden by parent layout (SidePanel binds it to stats card)
|
||||
//implicitHeight: content.implicitHeight + Style.marginLarge * 2 * scaling
|
||||
// Component.onCompleted: {
|
||||
// console.log(MediaService.trackArtUrl)
|
||||
// Logger.logMediaService.trackArtUrl)
|
||||
// }
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ NPanel {
|
|||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
console.log("Lock screen requested")
|
||||
Logger.log("PowerMenu", "Lock screen requested")
|
||||
// Lock the screen
|
||||
lockScreen.locked = true
|
||||
powerMenu.visible = false
|
||||
|
|
@ -353,7 +353,7 @@ NPanel {
|
|||
} else if (WorkspacesService.isHyprland) {
|
||||
logoutProcessHyprland.running = true
|
||||
} else {
|
||||
console.warn("No supported compositor detected for logout")
|
||||
Logger.warn("PowerMenu", "No supported compositor detected for logout")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ Singleton {
|
|||
|
||||
function onMutedChanged() {
|
||||
root._muted = (sink?.audio.muted ?? true)
|
||||
console.log("[AudioService] onMuteChanged:", root._muted)
|
||||
Logger.log("AudioService", "OnMuteChanged:", root._muted)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,9 +70,9 @@ Singleton {
|
|||
// Clamp it accordingly
|
||||
sink.audio.muted = false
|
||||
sink.audio.volume = Math.max(0, Math.min(1, newVolume))
|
||||
//console.log("[AudioService] setVolume", sink.audio.volume);
|
||||
//Logger.log("AudioService", "SetVolume", sink.audio.volume);
|
||||
} else {
|
||||
console.warn("[AudioService] No sink available")
|
||||
Logger.warn("AudioService", "No sink available")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ Singleton {
|
|||
if (sink?.ready && sink?.audio) {
|
||||
sink.audio.muted = muted
|
||||
} else {
|
||||
console.warn("[AudioService] No sink available")
|
||||
Logger.warn("AudioService", "No sink available")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,21 +28,21 @@ Singleton {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[Bluetooth] Service started")
|
||||
|
||||
Logger.log("Bluetooth", "Service started")
|
||||
|
||||
if (isEnabled && Bluetooth.defaultAdapter) {
|
||||
// Ensure adapter is enabled
|
||||
if (!Bluetooth.defaultAdapter.enabled) {
|
||||
Bluetooth.defaultAdapter.enabled = true
|
||||
}
|
||||
|
||||
|
||||
// Start discovery to find devices
|
||||
if (!Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = true
|
||||
}
|
||||
|
||||
|
||||
// Refresh devices after a short delay to allow discovery to start
|
||||
Qt.callLater(function() {
|
||||
Qt.callLater(function () {
|
||||
refreshDevices()
|
||||
})
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ Singleton {
|
|||
|
||||
// Function to enable/disable Bluetooth
|
||||
function setBluetoothEnabled(enabled) {
|
||||
|
||||
|
||||
if (enabled) {
|
||||
// Store the currently connected devices before enabling
|
||||
for (const device of connectedDevices) {
|
||||
|
|
@ -59,20 +59,20 @@ Singleton {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Enable Bluetooth
|
||||
if (Bluetooth.defaultAdapter) {
|
||||
Bluetooth.defaultAdapter.enabled = true
|
||||
|
||||
|
||||
// Start discovery to find devices
|
||||
if (!Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = true
|
||||
}
|
||||
|
||||
|
||||
// Refresh devices after enabling
|
||||
Qt.callLater(refreshDevices)
|
||||
} else {
|
||||
console.warn("[Bluetooth] No Bluetooth adapter found!")
|
||||
Logger.warn("Bluetooth", "No adapter found")
|
||||
}
|
||||
} else {
|
||||
// Disconnect from current devices before disabling
|
||||
|
|
@ -81,14 +81,14 @@ Singleton {
|
|||
device.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Disable Bluetooth
|
||||
if (Bluetooth.defaultAdapter) {
|
||||
console.log("[Bluetooth] Disabling Bluetooth adapter")
|
||||
Logger.log("Bluetooth", "Disabling adapter")
|
||||
Bluetooth.defaultAdapter.enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Settings.data.network.bluetoothEnabled = enabled
|
||||
isEnabled = enabled
|
||||
}
|
||||
|
|
@ -101,25 +101,24 @@ Singleton {
|
|||
availableDevices = []
|
||||
return
|
||||
}
|
||||
|
||||
// Remove duplicate check since we already did it above
|
||||
|
||||
// Remove duplicate check since we already did it above
|
||||
const connected = []
|
||||
const paired = []
|
||||
const available = []
|
||||
|
||||
let devices = null
|
||||
|
||||
|
||||
// Try adapter devices first
|
||||
if (Bluetooth.defaultAdapter.enabled && Bluetooth.defaultAdapter.devices) {
|
||||
devices = Bluetooth.defaultAdapter.devices
|
||||
}
|
||||
|
||||
|
||||
// Fallback to global devices list
|
||||
if (!devices && Bluetooth.devices) {
|
||||
devices = Bluetooth.devices
|
||||
}
|
||||
|
||||
|
||||
if (!devices) {
|
||||
connectedDevices = []
|
||||
pairedDevices = []
|
||||
|
|
@ -129,19 +128,20 @@ Singleton {
|
|||
|
||||
// Use Qt model methods to iterate through the ObjectModel
|
||||
let deviceFound = false
|
||||
|
||||
|
||||
try {
|
||||
// Get the row count using the Qt model method
|
||||
const rowCount = devices.rowCount()
|
||||
|
||||
|
||||
if (rowCount > 0) {
|
||||
// Iterate through each row using the Qt model data() method
|
||||
for (let i = 0; i < rowCount; i++) {
|
||||
for (var i = 0; i < rowCount; i++) {
|
||||
try {
|
||||
// Create a model index for this row
|
||||
const modelIndex = devices.index(i, 0)
|
||||
if (!modelIndex.valid) continue
|
||||
|
||||
if (!modelIndex.valid)
|
||||
continue
|
||||
|
||||
// Get the device object using the Qt.UserRole (typically 256)
|
||||
const device = devices.data(modelIndex, 256) // Qt.UserRole
|
||||
if (!device) {
|
||||
|
|
@ -153,9 +153,9 @@ Singleton {
|
|||
continue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
deviceFound = true
|
||||
|
||||
|
||||
if (device.connected) {
|
||||
connected.push(device)
|
||||
} else if (device.paired) {
|
||||
|
|
@ -163,13 +163,13 @@ Singleton {
|
|||
} else {
|
||||
available.push(device)
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
||||
// Silent error handling
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Alternative method: try the values property if available
|
||||
if (!deviceFound && devices.values) {
|
||||
try {
|
||||
|
|
@ -177,7 +177,7 @@ Singleton {
|
|||
if (values && typeof values === 'object') {
|
||||
// Try to iterate through values if it's iterable
|
||||
if (values.length !== undefined) {
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
const device = values[i]
|
||||
if (device) {
|
||||
deviceFound = true
|
||||
|
|
@ -193,18 +193,18 @@ Singleton {
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
// Silent error handling
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.warn("[Bluetooth] Error accessing device model:", e)
|
||||
Logger.warn("Bluetooth", "Error accessing device model:", e)
|
||||
}
|
||||
|
||||
if (!deviceFound) {
|
||||
console.log("[Bluetooth] No devices found")
|
||||
Logger.log("Bluetooth", "No device found")
|
||||
}
|
||||
|
||||
|
||||
connectedDevices = connected
|
||||
pairedDevices = paired
|
||||
availableDevices = available
|
||||
|
|
@ -212,39 +212,42 @@ Singleton {
|
|||
|
||||
// Function to start discovery
|
||||
function startDiscovery() {
|
||||
if (!isEnabled || !Bluetooth.defaultAdapter) return
|
||||
|
||||
if (!isEnabled || !Bluetooth.defaultAdapter)
|
||||
return
|
||||
|
||||
isDiscovering = true
|
||||
Bluetooth.defaultAdapter.discovering = true
|
||||
}
|
||||
|
||||
// Function to stop discovery
|
||||
function stopDiscovery() {
|
||||
if (!Bluetooth.defaultAdapter) return
|
||||
|
||||
if (!Bluetooth.defaultAdapter)
|
||||
return
|
||||
|
||||
isDiscovering = false
|
||||
Bluetooth.defaultAdapter.discovering = false
|
||||
}
|
||||
|
||||
// Function to connect to a device
|
||||
function connectDevice(device) {
|
||||
if (!device) return
|
||||
|
||||
if (!device)
|
||||
return
|
||||
|
||||
// Check if device is still valid (not stale from previous session)
|
||||
if (!device.connect || typeof device.connect !== 'function') {
|
||||
console.warn("[Bluetooth] Device object is stale, refreshing devices")
|
||||
Logger.warn("Bluetooth", "Device object is stale, refreshing devices")
|
||||
refreshDevices()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
connectStatus = "connecting"
|
||||
connectStatusDevice = device.name || device.deviceName
|
||||
connectError = ""
|
||||
|
||||
|
||||
try {
|
||||
device.connect()
|
||||
} catch (error) {
|
||||
console.error("[Bluetooth] Error connecting to device:", error)
|
||||
Logger.error("Bluetooth", "Error connecting to device:", error)
|
||||
connectStatus = "error"
|
||||
connectError = error.toString()
|
||||
Qt.callLater(refreshDevices)
|
||||
|
|
@ -253,15 +256,16 @@ Singleton {
|
|||
|
||||
// Function to disconnect from a device
|
||||
function disconnectDevice(device) {
|
||||
if (!device) return
|
||||
|
||||
if (!device)
|
||||
return
|
||||
|
||||
// Check if device is still valid (not stale from previous session)
|
||||
if (!device.disconnect || typeof device.disconnect !== 'function') {
|
||||
console.warn("[Bluetooth] Device object is stale, refreshing devices")
|
||||
Logger.warn("Bluetooth", "Device object is stale, refreshing devices")
|
||||
refreshDevices()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
device.disconnect()
|
||||
// Clear connection status
|
||||
|
|
@ -269,72 +273,74 @@ Singleton {
|
|||
connectStatusDevice = ""
|
||||
connectError = ""
|
||||
} catch (error) {
|
||||
console.warn("[Bluetooth] Error disconnecting device:", error)
|
||||
Logger.warn("Bluetooth", "Error disconnecting device:", error)
|
||||
Qt.callLater(refreshDevices)
|
||||
}
|
||||
}
|
||||
|
||||
// Function to pair with a device
|
||||
function pairDevice(device) {
|
||||
if (!device) return
|
||||
|
||||
if (!device)
|
||||
return
|
||||
|
||||
// Check if device is still valid (not stale from previous session)
|
||||
if (!device.pair || typeof device.pair !== 'function') {
|
||||
console.warn("[Bluetooth] Device object is stale, refreshing devices")
|
||||
Logger.warn("Bluetooth", "Device object is stale, refreshing devices")
|
||||
refreshDevices()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
device.pair()
|
||||
} catch (error) {
|
||||
console.warn("[Bluetooth] Error pairing device:", error)
|
||||
Logger.warn("Bluetooth", "Error pairing device:", error)
|
||||
Qt.callLater(refreshDevices)
|
||||
}
|
||||
}
|
||||
|
||||
// Function to forget a device
|
||||
function forgetDevice(device) {
|
||||
if (!device) return
|
||||
|
||||
if (!device)
|
||||
return
|
||||
|
||||
// Check if device is still valid (not stale from previous session)
|
||||
if (!device.forget || typeof device.forget !== 'function') {
|
||||
console.warn("[Bluetooth] Device object is stale, refreshing devices")
|
||||
Logger.warn("Bluetooth", "Device object is stale, refreshing devices")
|
||||
refreshDevices()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// Store device info before forgetting (in case device object becomes invalid)
|
||||
const deviceName = device.name || device.deviceName || "Unknown Device"
|
||||
|
||||
|
||||
try {
|
||||
device.forget()
|
||||
|
||||
|
||||
// Clear any connection status that might be related to this device
|
||||
if (connectStatusDevice === deviceName) {
|
||||
connectStatus = ""
|
||||
connectStatusDevice = ""
|
||||
connectError = ""
|
||||
}
|
||||
|
||||
|
||||
// Refresh devices after a delay to ensure the forget operation is complete
|
||||
Qt.callLater(refreshDevices, 1000)
|
||||
|
||||
} catch (error) {
|
||||
console.warn("[Bluetooth] Error forgetting device:", error)
|
||||
Logger.warn("Bluetooth", "Error forgetting device:", error)
|
||||
Qt.callLater(refreshDevices, 500)
|
||||
}
|
||||
}
|
||||
|
||||
// Function to get device icon
|
||||
function getDeviceIcon(device) {
|
||||
if (!device) return "bluetooth"
|
||||
|
||||
if (!device)
|
||||
return "bluetooth"
|
||||
|
||||
// Use device icon if available, otherwise fall back to device type
|
||||
if (device.icon) {
|
||||
return device.icon
|
||||
}
|
||||
|
||||
|
||||
// Fallback icons based on common device types
|
||||
const name = (device.name || device.deviceName || "").toLowerCase()
|
||||
if (name.includes("headphone") || name.includes("earbud") || name.includes("airpods")) {
|
||||
|
|
@ -350,14 +356,15 @@ Singleton {
|
|||
} else if (name.includes("laptop") || name.includes("computer")) {
|
||||
return "laptop"
|
||||
}
|
||||
|
||||
|
||||
return "bluetooth"
|
||||
}
|
||||
|
||||
// Function to get device status text
|
||||
function getDeviceStatus(device) {
|
||||
if (!device) return ""
|
||||
|
||||
if (!device)
|
||||
return ""
|
||||
|
||||
if (device.connected) {
|
||||
return "Connected"
|
||||
} else if (device.pairing) {
|
||||
|
|
@ -371,8 +378,9 @@ Singleton {
|
|||
|
||||
// Function to get battery level text
|
||||
function getBatteryText(device) {
|
||||
if (!device || !device.batteryAvailable) return ""
|
||||
|
||||
if (!device || !device.batteryAvailable)
|
||||
return ""
|
||||
|
||||
const percentage = Math.round(device.battery * 100)
|
||||
return `${percentage}%`
|
||||
}
|
||||
|
|
@ -381,7 +389,7 @@ Singleton {
|
|||
Connections {
|
||||
target: Bluetooth.defaultAdapter
|
||||
ignoreUnknownSignals: true
|
||||
|
||||
|
||||
function onEnabledChanged() {
|
||||
root.isEnabled = Bluetooth.defaultAdapter.enabled
|
||||
Settings.data.network.bluetoothEnabled = root.isEnabled
|
||||
|
|
@ -393,20 +401,20 @@ Singleton {
|
|||
availableDevices = []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onDiscoveringChanged() {
|
||||
root.isDiscovering = Bluetooth.defaultAdapter.discovering
|
||||
if (Bluetooth.defaultAdapter.discovering) {
|
||||
Qt.callLater(refreshDevices)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onStateChanged() {
|
||||
if (Bluetooth.defaultAdapter.state >= 4) {
|
||||
Qt.callLater(refreshDevices)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onDevicesChanged() {
|
||||
Qt.callLater(refreshDevices)
|
||||
}
|
||||
|
|
@ -416,9 +424,9 @@ Singleton {
|
|||
Connections {
|
||||
target: Bluetooth
|
||||
ignoreUnknownSignals: true
|
||||
|
||||
|
||||
function onDevicesChanged() {
|
||||
Qt.callLater(refreshDevices)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,13 +156,13 @@ Singleton {
|
|||
readonly property Process initProc: Process {
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
console.log("[Brightness] Raw brightness data for", monitor.modelData.name + ":", text.trim())
|
||||
Logger.log("Brightness", "Raw brightness data for", monitor.modelData.name + ":", text.trim())
|
||||
|
||||
if (monitor.isAppleDisplay) {
|
||||
var val = parseInt(text.trim())
|
||||
if (!isNaN(val)) {
|
||||
monitor.brightness = val / 101
|
||||
console.log("[Brightness] Apple display brightness:", monitor.brightness)
|
||||
Logger.log("Brightness", "Apple display brightness:", monitor.brightness)
|
||||
}
|
||||
} else if (monitor.isDdc) {
|
||||
var parts = text.trim().split(" ")
|
||||
|
|
@ -171,7 +171,7 @@ Singleton {
|
|||
var max = parseInt(parts[1])
|
||||
if (!isNaN(current) && !isNaN(max) && max > 0) {
|
||||
monitor.brightness = current / max
|
||||
console.log("[Brightness] DDC brightness:", current + "/" + max + " =", monitor.brightness)
|
||||
Logger.log("Brightness", "DDC brightness:", current + "/" + max + " =", monitor.brightness)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -182,7 +182,7 @@ Singleton {
|
|||
var max = parseInt(parts[1])
|
||||
if (!isNaN(current) && !isNaN(max) && max > 0) {
|
||||
monitor.brightness = current / max
|
||||
console.log("[Brightness] Internal brightness:", current + "/" + max + " =", monitor.brightness)
|
||||
Logger.log("Brightness", "Internal brightness:", current + "/" + max + " =", monitor.brightness)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Singleton {
|
|||
id: root
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[ColorSchemes] Service started")
|
||||
Logger.log("ColorSchemes", "Service started")
|
||||
loadColorSchemes()
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ Singleton {
|
|||
property string colorsJsonFilePath: Settings.configDir + "colors.json"
|
||||
|
||||
function loadColorSchemes() {
|
||||
console.log("[ColorSchemes] Load ColorSchemes")
|
||||
Logger.log("ColorSchemes", "Load ColorSchemes")
|
||||
scanning = true
|
||||
schemes = []
|
||||
// Unsetting, then setting the folder will re-trigger the parsing!
|
||||
|
|
@ -34,7 +34,7 @@ Singleton {
|
|||
|
||||
function changedWallpaper() {
|
||||
if (Settings.data.colorSchemes.useWallpaperColors) {
|
||||
console.log("[ColorSchemes] Starting color generation process")
|
||||
Logger.log("ColorSchemes", "Starting color generation from wallpaper")
|
||||
generateColorsProcess.running = true
|
||||
// Invalidate potential predefined scheme
|
||||
Settings.data.colorSchemes.predefinedScheme = ""
|
||||
|
|
@ -55,7 +55,7 @@ Singleton {
|
|||
}
|
||||
schemes = files
|
||||
scanning = false
|
||||
console.log("[ColorSchemes] Loaded", schemes.length, "schemes")
|
||||
Logger.log("ColorSchemes", "Loaded", schemes.length, "schemes")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,13 +67,13 @@ Singleton {
|
|||
running: false
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
console.log("[ColorSchemes] Generated colors from wallpaper")
|
||||
Logger.log("ColorSchemes", "Completed colors generation")
|
||||
}
|
||||
}
|
||||
stderr: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (this.text !== "") {
|
||||
console.error(this.text)
|
||||
Logger.error(this.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ Singleton {
|
|||
function loadFromCache() {
|
||||
const now = Time.timestamp
|
||||
if (!data.timestamp || (now >= data.timestamp + githubUpdateFrequency)) {
|
||||
console.log("[GitHub] Cache expired or missing, fetching new data")
|
||||
Logger.log("GitHub", "Cache expired or missing, fetching new data")
|
||||
fetchFromGitHub()
|
||||
return
|
||||
}
|
||||
console.log("[GitHub] Loading cached GitHub data (age:", Math.round((now - data.timestamp) / 60), "minutes)")
|
||||
Logger.log("GitHub", "Loading cached GitHub data (age:", Math.round((now - data.timestamp) / 60), "minutes)")
|
||||
|
||||
if (data.version) {
|
||||
root.latestVersion = data.version
|
||||
|
|
@ -69,7 +69,7 @@ Singleton {
|
|||
// --------------------------------
|
||||
function fetchFromGitHub() {
|
||||
if (isFetchingData) {
|
||||
console.warn("[GitHub] GitHub data is still fetching")
|
||||
Logger.warn("GitHub", "GitHub data is still fetching")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -81,8 +81,8 @@ Singleton {
|
|||
// --------------------------------
|
||||
function saveData() {
|
||||
data.timestamp = Time.timestamp
|
||||
console.log("[GitHub] Saving data to cache file:", githubDataFile)
|
||||
console.log("[GitHub] Data to save - version:", data.version, "contributors:", data.contributors.length)
|
||||
Logger.log("GitHub", "Saving data to cache file:", githubDataFile)
|
||||
Logger.log("GitHub", "Data to save - version:", data.version, "contributors:", data.contributors.length)
|
||||
|
||||
// Ensure cache directory exists
|
||||
Quickshell.execDetached(["mkdir", "-p", Settings.cacheDir])
|
||||
|
|
@ -90,7 +90,7 @@ Singleton {
|
|||
Qt.callLater(() => {
|
||||
// Use direct ID reference to the FileView
|
||||
githubDataFileView.writeAdapter()
|
||||
console.log("[GitHub] Cache file written successfully")
|
||||
Logger.log("GitHub", "Cache file written successfully")
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -119,15 +119,15 @@ Singleton {
|
|||
const version = data.tag_name
|
||||
root.data.version = version
|
||||
root.latestVersion = version
|
||||
console.log("[GitHub] Latest version fetched from GitHub:", version)
|
||||
Logger.log("GitHub", "Latest version fetched from GitHub:", version)
|
||||
} else {
|
||||
console.log("[GitHub] No tag_name in GitHub response")
|
||||
Logger.log("GitHub", "No tag_name in GitHub response")
|
||||
}
|
||||
} else {
|
||||
console.log("[GitHub] Empty response from GitHub API")
|
||||
Logger.log("GitHub", "Empty response from GitHub API")
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[GitHub] Failed to parse version:", e)
|
||||
Logger.error("GitHub", "Failed to parse version:", e)
|
||||
}
|
||||
|
||||
// Check if both processes are done
|
||||
|
|
@ -145,21 +145,21 @@ Singleton {
|
|||
onStreamFinished: {
|
||||
try {
|
||||
const response = text
|
||||
console.log("[GitHub] Raw contributors response length:", response ? response.length : 0)
|
||||
Logger.log("GitHub", "Raw contributors response length:", response ? response.length : 0)
|
||||
if (response && response.trim()) {
|
||||
const data = JSON.parse(response)
|
||||
console.log("[GitHub] Parsed contributors data type:", typeof data, "length:",
|
||||
Array.isArray(data) ? data.length : "not array")
|
||||
Logger.log("GitHub", "Parsed contributors data type:", typeof data, "length:",
|
||||
Array.isArray(data) ? data.length : "not array")
|
||||
root.data.contributors = data || []
|
||||
root.contributors = root.data.contributors
|
||||
console.log("[GitHub] Contributors fetched from GitHub:", root.contributors.length)
|
||||
Logger.log("GitHub", "Contributors fetched from GitHub:", root.contributors.length)
|
||||
} else {
|
||||
console.log("[GitHub] Empty response from GitHub API for contributors")
|
||||
Logger.log("GitHub", "Empty response from GitHub API for contributors")
|
||||
root.data.contributors = []
|
||||
root.contributors = []
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[GitHub] Failed to parse contributors:", e)
|
||||
Logger.error("GitHub", "Failed to parse contributors:", e)
|
||||
root.data.contributors = []
|
||||
root.contributors = []
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ Singleton {
|
|||
function init() {
|
||||
// does nothing but ensure the singleton is created
|
||||
// do not remove
|
||||
console.log("[Location] Service started")
|
||||
Logger.log("Location", "Service started")
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
function resetWeather() {
|
||||
console.log("[Location] Resetting weather data")
|
||||
Logger.log("Location", "Resetting weather data")
|
||||
|
||||
data.latitude = ""
|
||||
data.longitude = ""
|
||||
|
|
@ -70,12 +70,12 @@ Singleton {
|
|||
// --------------------------------
|
||||
function updateWeather() {
|
||||
if (isFetchingWeather) {
|
||||
console.warn("[Location] Weather is still fetching")
|
||||
Logger.warn("Location", "Weather is still fetching")
|
||||
return
|
||||
}
|
||||
|
||||
if (data.latitude === "") {
|
||||
console.warn("[Location] Why is my latitude empty")
|
||||
Logger.warn("Location", "Why is my latitude empty")
|
||||
}
|
||||
|
||||
if ((data.weatherLastFetch === "") || (data.weather === null) || (data.latitude === "") || (data.longitude === "")
|
||||
|
|
@ -91,7 +91,7 @@ Singleton {
|
|||
if ((data.latitude === "") || (data.longitude === "") || (data.name !== Settings.data.location.name)) {
|
||||
|
||||
_geocodeLocation(Settings.data.location.name, function (latitude, longitude) {
|
||||
console.log("[Location] Geocoded", Settings.data.location.name, "to:", latitude, "/", longitude)
|
||||
Logger.log("Location", " Geocoded", Settings.data.location.name, "to:", latitude, "/", longitude)
|
||||
|
||||
// Save location name
|
||||
data.name = Settings.data.location.name
|
||||
|
|
@ -109,7 +109,7 @@ Singleton {
|
|||
|
||||
// --------------------------------
|
||||
function _geocodeLocation(locationName, callback, errorCallback) {
|
||||
console.log("[Location] Geocoding from api.open-meteo.com")
|
||||
Logger.log("Location", "Geocoding from api.open-meteo.com")
|
||||
var geoUrl = "https://geocoding-api.open-meteo.com/v1/search?name=" + encodeURIComponent(
|
||||
locationName) + "&language=en&format=json"
|
||||
var xhr = new XMLHttpRequest()
|
||||
|
|
@ -118,17 +118,17 @@ Singleton {
|
|||
if (xhr.status === 200) {
|
||||
try {
|
||||
var geoData = JSON.parse(xhr.responseText)
|
||||
// console.log(JSON.stringify(geoData))
|
||||
// Logger.logJSON.stringify(geoData))
|
||||
if (geoData.results && geoData.results.length > 0) {
|
||||
callback(geoData.results[0].latitude, geoData.results[0].longitude)
|
||||
} else {
|
||||
errorCallback("[Location] could not resolve location name")
|
||||
errorCallback("Location", "could not resolve location name")
|
||||
}
|
||||
} catch (e) {
|
||||
errorCallback("[Location] Failed to parse geocoding data: " + e)
|
||||
errorCallback("Location", "Failed to parse geocoding data: " + e)
|
||||
}
|
||||
} else {
|
||||
errorCallback("[Location] Geocoding error: " + xhr.status)
|
||||
errorCallback("Location", "Geocoding error: " + xhr.status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ Singleton {
|
|||
|
||||
// --------------------------------
|
||||
function _fetchWeather(latitude, longitude, errorCallback) {
|
||||
console.log("[Location] Fetching weather from api.open-meteo.com")
|
||||
Logger.log("Location", "Fetching weather from api.open-meteo.com")
|
||||
var url = "https://api.open-meteo.com/v1/forecast?latitude=" + latitude + "&longitude=" + longitude
|
||||
+ "¤t_weather=true¤t=relativehumidity_2m,surface_pressure&daily=temperature_2m_max,temperature_2m_min,weathercode&timezone=auto"
|
||||
var xhr = new XMLHttpRequest()
|
||||
|
|
@ -155,12 +155,12 @@ Singleton {
|
|||
data.longitude = weatherData.longitude.toString()
|
||||
|
||||
isFetchingWeather = false
|
||||
console.log("[Location] Cached weather to disk")
|
||||
Logger.log("Location", "Cached weather to disk")
|
||||
} catch (e) {
|
||||
errorCallback("[Location] Failed to parse weather data")
|
||||
errorCallback("Location", "Failed to parse weather data")
|
||||
}
|
||||
} else {
|
||||
errorCallback("[Location] Weather fetch error: " + xhr.status)
|
||||
errorCallback("Location", "Weather fetch error: " + xhr.status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ Singleton {
|
|||
|
||||
// --------------------------------
|
||||
function errorCallback(message) {
|
||||
console.error(message)
|
||||
Logger.error(message)
|
||||
isFetchingWeather = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ Singleton {
|
|||
function findActivePlayer() {
|
||||
let availablePlayers = getAvailablePlayers()
|
||||
if (availablePlayers.length === 0) {
|
||||
console.log("[Media] No active player found")
|
||||
Logger.log("Media", "No active player found")
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ Singleton {
|
|||
if (newPlayer !== currentPlayer) {
|
||||
currentPlayer = newPlayer
|
||||
currentPosition = currentPlayer ? currentPlayer.position : 0
|
||||
console.log("[Media] Switching player")
|
||||
Logger.log("Media", "Switching player")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ Singleton {
|
|||
Connections {
|
||||
target: Mpris.players
|
||||
function onValuesChanged() {
|
||||
console.log("[Media] Players changed")
|
||||
Logger.log("Media", "Players changed")
|
||||
updateCurrentPlayer()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Singleton {
|
|||
property bool isLoading: false
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[Network] Service started")
|
||||
Logger.log("Network", "Service started")
|
||||
// Only refresh networks if WiFi is enabled
|
||||
if (Settings.data.network.wifiEnabled) {
|
||||
refreshNetworks()
|
||||
|
|
@ -165,7 +165,7 @@ Singleton {
|
|||
stderr: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (text.trim() !== "") {
|
||||
console.warn("Error enabling WiFi:", text)
|
||||
Logger.warn("Network", "Error enabling WiFi:", text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ Singleton {
|
|||
stderr: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (text.trim() !== "") {
|
||||
console.warn("Error disabling WiFi:", text)
|
||||
Logger.warn("Network", "Error disabling WiFi:", text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ Singleton {
|
|||
|
||||
const parts = line.split(":")
|
||||
if (parts.length < 2) {
|
||||
console.warn("Malformed nmcli output line:", line)
|
||||
Logger.warn("Network", "Malformed nmcli output line:", line)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ Singleton {
|
|||
|
||||
const parts = line.split(":")
|
||||
if (parts.length < 4) {
|
||||
console.warn("Malformed nmcli output line:", line)
|
||||
Logger.warn("Network", "Malformed nmcli output line:", line)
|
||||
continue
|
||||
}
|
||||
const ssid = parts[0]
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ Singleton {
|
|||
|
||||
root.workspaces = workspacesList
|
||||
} catch (e) {
|
||||
console.error("Failed to parse workspaces:", e, line)
|
||||
Logger.error("NiriService", "Failed to parse workspaces:", e, line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ Singleton {
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error parsing windows event:", e)
|
||||
Logger.error("NiriService", "Error parsing windows event:", e)
|
||||
}
|
||||
} else if (event.WorkspaceActivated) {
|
||||
workspaceProcess.running = true
|
||||
|
|
@ -120,17 +120,17 @@ Singleton {
|
|||
root.focusedWindowIndex = -1
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error parsing window focus event:", e)
|
||||
Logger.error("NiriService", "Error parsing window focus event:", e)
|
||||
}
|
||||
} else if (event.OverviewOpenedOrClosed) {
|
||||
try {
|
||||
root.inOverview = event.OverviewOpenedOrClosed.is_open === true
|
||||
} catch (e) {
|
||||
console.error("Error parsing overview state:", e)
|
||||
Logger.error("NiriService", "Error parsing overview state:", e)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error parsing event stream:", e, data)
|
||||
Logger.error("NiriService", "Error parsing event stream:", e, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ QtObject {
|
|||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[Notifications] Failed to load history:", e)
|
||||
Logger.error("Notifications", "Failed to load history:", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ QtObject {
|
|||
historyFileView.writeAdapter()
|
||||
})
|
||||
} catch (e) {
|
||||
console.error("[Notifications] Failed to save history:", e)
|
||||
Logger.error("Notifications", "Failed to save history:", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ Singleton {
|
|||
+ " -k " + settings.videoCodec + " -a " + settings.audioSource + " -q " + settings.quality
|
||||
+ " -cursor " + (settings.showCursor ? "yes" : "no") + " -cr " + settings.colorRange + " -o " + outputPath
|
||||
|
||||
//console.log("[ScreenRecorder]", command)
|
||||
//Logger.log("ScreenRecorder", command)
|
||||
Quickshell.execDetached(["sh", "-c", command])
|
||||
console.log("[ScreenRecorder] Started recording")
|
||||
Logger.log("ScreenRecorder", "Started recording")
|
||||
}
|
||||
|
||||
// Stop recording using Quickshell.execDetached
|
||||
|
|
@ -46,7 +46,7 @@ Singleton {
|
|||
}
|
||||
|
||||
Quickshell.execDetached(["sh", "-c", "pkill -SIGINT -f 'gpu-screen-recorder.*portal'"])
|
||||
console.log("[ScreenRecorder] Finished recording:", outputPath)
|
||||
Logger.log("ScreenRecorder", "Finished recording:", outputPath)
|
||||
|
||||
// Just in case, force kill after 3 seconds
|
||||
killTimer.running = true
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Singleton {
|
|||
id: root
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[Wallpapers] Service started")
|
||||
Logger.log("Wallpapers", "Service started")
|
||||
loadWallpapers()
|
||||
|
||||
// Wallpaper is set when the settings are loaded.
|
||||
|
|
@ -26,7 +26,7 @@ Singleton {
|
|||
property var randomChoices: ["simple", "fade", "left", "right", "top", "bottom", "wipe", "wave", "grow", "center", "any", "outer"]
|
||||
|
||||
function loadWallpapers() {
|
||||
console.log("[Wallpapers] Load Wallpapers")
|
||||
Logger.log("Wallpapers", "Load Wallpapers")
|
||||
scanning = true
|
||||
wallpaperList = []
|
||||
// Unsetting, then setting the folder will re-trigger the parsing!
|
||||
|
|
@ -35,7 +35,7 @@ Singleton {
|
|||
}
|
||||
|
||||
function changeWallpaper(path) {
|
||||
console.log("[Wallpapers] Changing to:", path)
|
||||
Logger.log("Wallpapers", "Changing to:", path)
|
||||
setCurrentWallpaper(path, false)
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ Singleton {
|
|||
} else {
|
||||
|
||||
// Fallback: update the settings directly for non-SWWW mode
|
||||
//console.log("[Wallpapers] Not using Swww, setting wallpaper directly")
|
||||
//Logger.log("Wallpapers", "Not using Swww, setting wallpaper directly")
|
||||
}
|
||||
|
||||
if (randomWallpaperTimer.running) {
|
||||
|
|
@ -98,7 +98,7 @@ Singleton {
|
|||
|
||||
function startSWWWDaemon() {
|
||||
if (Settings.data.wallpaper.swww.enabled) {
|
||||
console.log("[SWWW] Requesting swww-daemon")
|
||||
Logger.log("Swww", "Requesting swww-daemon")
|
||||
startDaemonProcess.running = true
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ Singleton {
|
|||
}
|
||||
wallpaperList = files
|
||||
scanning = false
|
||||
console.log("[Wallpapers] List refreshed, count:", wallpaperList.length)
|
||||
Logger.log("Wallpapers", "List refreshed, count:", wallpaperList.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -145,10 +145,10 @@ Singleton {
|
|||
}
|
||||
|
||||
onExited: function (exitCode, exitStatus) {
|
||||
console.log("[SWWW] Process finished with exit code:", exitCode, "status:", exitStatus)
|
||||
Logger.log("Swww", "Process finished with exit code:", exitCode, "status:", exitStatus)
|
||||
if (exitCode !== 0) {
|
||||
console.log("[SWWW] Process failed. Make sure swww-daemon is running with: swww-daemon")
|
||||
console.log("[SWWW] You can start it with: swww-daemon --format xrgb")
|
||||
Logger.log("Swww", "Process failed. Make sure swww-daemon is running with: swww-daemon")
|
||||
Logger.log("Swww", "You can start it with: swww-daemon --format xrgb")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -159,15 +159,15 @@ Singleton {
|
|||
running: false
|
||||
|
||||
onStarted: {
|
||||
console.log("[SWWW] Daemon start process initiated")
|
||||
Logger.log("Swww", "Daemon start process initiated")
|
||||
}
|
||||
|
||||
onExited: function (exitCode, exitStatus) {
|
||||
console.log("[SWWW] Daemon start process finished with exit code:", exitCode)
|
||||
Logger.log("Swww", "Daemon start process finished with exit code:", exitCode)
|
||||
if (exitCode === 0) {
|
||||
console.log("[SWWW] Daemon started successfully")
|
||||
Logger.log("Swww", "Daemon started successfully")
|
||||
} else {
|
||||
console.log("[SWWW] Failed to start daemon, may already be running")
|
||||
Logger.log("Swww", "Failed to start daemon, may already be running")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ Singleton {
|
|||
return
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[Workspaces] Error detecting compositor:", e)
|
||||
Logger.error("Workspaces", "Error detecting compositor:", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ Singleton {
|
|||
// updateHyprlandWorkspaces();
|
||||
return true
|
||||
} catch (e) {
|
||||
console.error("Error initializing Hyprland:", e)
|
||||
Logger.error("Error initializing Hyprland:", e)
|
||||
isHyprland = false
|
||||
return false
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ Singleton {
|
|||
}
|
||||
workspacesChanged()
|
||||
} catch (e) {
|
||||
console.error("[Workspaces] Error updating Hyprland workspaces:", e)
|
||||
Logger.error("Workspaces", "Error updating Hyprland workspaces:", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,16 +138,16 @@ Singleton {
|
|||
try {
|
||||
Hyprland.dispatch(`workspace ${workspaceId}`)
|
||||
} catch (e) {
|
||||
console.error("Error switching Hyprland workspace:", e)
|
||||
Logger.error("Error switching Hyprland workspace:", e)
|
||||
}
|
||||
} else if (isNiri) {
|
||||
try {
|
||||
Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()])
|
||||
} catch (e) {
|
||||
console.error("Error switching Niri workspace:", e)
|
||||
Logger.error("Error switching Niri workspace:", e)
|
||||
}
|
||||
} else {
|
||||
console.warn("No supported compositor detected for workspace switching")
|
||||
Logger.warn("No supported compositor detected for workspace switching")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Loader {
|
|||
sourceComponent: content
|
||||
|
||||
// onLoaded: {
|
||||
// console.log("[NLoader] onLoaded:", item.toString());
|
||||
// Logger.log("NLoader", "OnLoaded:", item.toString());
|
||||
// }
|
||||
onActiveChanged: {
|
||||
if (active && item && item.show) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue