Using a custom logger with colors and timestamp instead of console.xxx

This commit is contained in:
quadbyte 2025-08-16 19:31:22 -04:00
parent 4794477be3
commit e800bc161d
34 changed files with 278 additions and 236 deletions

View file

@ -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")
}
}

View file

@ -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)
}
}
}
}

View file

@ -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)
}
}
}

View file

@ -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)
}
}
}

View file

@ -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 = []
}

View file

@ -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
+ "&current_weather=true&current=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
}

View file

@ -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()
}
}

View file

@ -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]

View file

@ -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)
}
}
}

View file

@ -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)
}
}

View file

@ -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

View file

@ -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")
}
}
}

View file

@ -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")
}
}
}