Switched to qmlformat.

This commit is contained in:
ItsLemmy
2025-11-16 17:07:03 -05:00
parent 32905224b9
commit 3ff5b7639f
223 changed files with 9970 additions and 9658 deletions
+18 -18
View File
@@ -12,60 +12,60 @@ Singleton {
Connections {
target: Settings.data.colorSchemes
function onDarkModeChanged() {
executeDarkModeHook(Settings.data.colorSchemes.darkMode)
executeDarkModeHook(Settings.data.colorSchemes.darkMode);
}
}
Connections {
target: WallpaperService
function onWallpaperChanged(screenName, path) {
executeWallpaperHook(path, screenName)
executeWallpaperHook(path, screenName);
}
}
// Execute wallpaper change hook
function executeWallpaperHook(wallpaperPath, screenName) {
if (!Settings.data.hooks?.enabled) {
return
return;
}
const script = Settings.data.hooks?.wallpaperChange
const script = Settings.data.hooks?.wallpaperChange;
if (!script || script === "") {
return
return;
}
try {
let command = script.replace(/\$1/g, wallpaperPath)
command = command.replace(/\$2/g, screenName || "")
Quickshell.execDetached(["sh", "-c", command])
Logger.d("HooksService", `Executed wallpaper hook: ${command}`)
let command = script.replace(/\$1/g, wallpaperPath);
command = command.replace(/\$2/g, screenName || "");
Quickshell.execDetached(["sh", "-c", command]);
Logger.d("HooksService", `Executed wallpaper hook: ${command}`);
} catch (e) {
Logger.e("HooksService", `Failed to execute wallpaper hook: ${e}`)
Logger.e("HooksService", `Failed to execute wallpaper hook: ${e}`);
}
}
// Execute dark mode change hook
function executeDarkModeHook(isDarkMode) {
if (!Settings.data.hooks?.enabled) {
return
return;
}
const script = Settings.data.hooks?.darkModeChange
const script = Settings.data.hooks?.darkModeChange;
if (!script || script === "") {
return
return;
}
try {
const command = script.replace(/\$1/g, isDarkMode ? "true" : "false")
Quickshell.execDetached(["sh", "-c", command])
Logger.d("HooksService", `Executed dark mode hook: ${command}`)
const command = script.replace(/\$1/g, isDarkMode ? "true" : "false");
Quickshell.execDetached(["sh", "-c", command]);
Logger.d("HooksService", `Executed dark mode hook: ${command}`);
} catch (e) {
Logger.e("HooksService", `Failed to execute dark mode hook: ${e}`)
Logger.e("HooksService", `Failed to execute dark mode hook: ${e}`);
}
}
// Initialize the service
function init() {
Logger.i("HooksService", "Service started")
Logger.i("HooksService", "Service started");
}
}
+109 -110
View File
@@ -19,7 +19,7 @@ Item {
IpcHandler {
target: "bar"
function toggle() {
BarService.isVisible = !BarService.isVisible
BarService.isVisible = !BarService.isVisible;
}
}
@@ -27,7 +27,7 @@ Item {
target: "screenRecorder"
function toggle() {
if (ScreenRecorderService.isAvailable) {
ScreenRecorderService.toggleRecording()
ScreenRecorderService.toggleRecording();
}
}
}
@@ -36,9 +36,9 @@ Item {
target: "settings"
function toggle() {
root.withTargetScreen(screen => {
var settingsPanel = PanelService.getPanel("settingsPanel", screen)
settingsPanel?.toggle()
})
var settingsPanel = PanelService.getPanel("settingsPanel", screen);
settingsPanel?.toggle();
});
}
}
@@ -46,9 +46,9 @@ Item {
target: "calendar"
function toggle() {
root.withTargetScreen(screen => {
var calendarPanel = PanelService.getPanel("calendarPanel", screen)
calendarPanel?.toggle(null, "Clock")
})
var calendarPanel = PanelService.getPanel("calendarPanel", screen);
calendarPanel?.toggle(null, "Clock");
});
}
}
@@ -57,36 +57,36 @@ Item {
function toggleHistory() {
// Will attempt to open the panel next to the bar button if any.
root.withTargetScreen(screen => {
var notificationHistoryPanel = PanelService.getPanel("notificationHistoryPanel", screen)
notificationHistoryPanel.toggle(null, "NotificationHistory")
})
var notificationHistoryPanel = PanelService.getPanel("notificationHistoryPanel", screen);
notificationHistoryPanel.toggle(null, "NotificationHistory");
});
}
function toggleDND() {
NotificationService.doNotDisturb = !NotificationService.doNotDisturb
NotificationService.doNotDisturb = !NotificationService.doNotDisturb;
}
function enableDND() {
NotificationService.doNotDisturb = true
NotificationService.doNotDisturb = true;
}
function disableDND() {
NotificationService.doNotDisturb = false
NotificationService.doNotDisturb = false;
}
function clear() {
NotificationService.clearHistory()
NotificationService.clearHistory();
}
function dismissOldest() {
NotificationService.dismissOldestActive()
NotificationService.dismissOldestActive();
}
function dismissAll() {
NotificationService.dismissAllActive()
NotificationService.dismissAllActive();
}
}
IpcHandler {
target: "idleInhibitor"
function toggle() {
return IdleInhibitorService.manualToggle()
return IdleInhibitorService.manualToggle();
}
}
@@ -94,23 +94,23 @@ Item {
target: "launcher"
function toggle() {
root.withTargetScreen(screen => {
var launcherPanel = PanelService.getPanel("launcherPanel", screen)
launcherPanel?.toggle()
})
var launcherPanel = PanelService.getPanel("launcherPanel", screen);
launcherPanel?.toggle();
});
}
function clipboard() {
root.withTargetScreen(screen => {
var launcherPanel = PanelService.getPanel("launcherPanel", screen)
launcherPanel?.setSearchText(">clip ")
launcherPanel?.toggle()
})
var launcherPanel = PanelService.getPanel("launcherPanel", screen);
launcherPanel?.setSearchText(">clip ");
launcherPanel?.toggle();
});
}
function calculator() {
root.withTargetScreen(screen => {
var launcherPanel = PanelService.getPanel("launcherPanel", screen)
launcherPanel?.setSearchText(">calc ")
launcherPanel?.toggle()
})
var launcherPanel = PanelService.getPanel("launcherPanel", screen);
launcherPanel?.setSearchText(">calc ");
launcherPanel?.toggle();
});
}
}
@@ -122,22 +122,22 @@ Item {
// Only lock if not already locked (prevents the red screen issue)
// Note: No unlock via IPC for security reasons
if (!lockScreen.active) {
lockScreen.triggeredViaDeprecatedCall = false
lockScreen.active = true
lockScreen.triggeredViaDeprecatedCall = false;
lockScreen.active = true;
}
}
// Deprecated: Use 'lockScreen lock' instead
function toggle() {
// Mark as triggered via deprecated call - warning will show in lock screen
lockScreen.triggeredViaDeprecatedCall = true
lockScreen.triggeredViaDeprecatedCall = true;
// Log deprecation warning for users checking logs
Logger.w("IPC", "The 'lockScreen toggle' IPC call is deprecated. Use 'lockScreen lock' instead.")
Logger.w("IPC", "The 'lockScreen toggle' IPC call is deprecated. Use 'lockScreen lock' instead.");
// Still functional for backward compatibility
if (!lockScreen.active) {
lockScreen.active = true
lockScreen.active = true;
}
}
}
@@ -145,52 +145,52 @@ Item {
IpcHandler {
target: "brightness"
function increase() {
BrightnessService.increaseBrightness()
BrightnessService.increaseBrightness();
}
function decrease() {
BrightnessService.decreaseBrightness()
BrightnessService.decreaseBrightness();
}
}
IpcHandler {
target: "darkMode"
function toggle() {
Settings.data.colorSchemes.darkMode = !Settings.data.colorSchemes.darkMode
Settings.data.colorSchemes.darkMode = !Settings.data.colorSchemes.darkMode;
}
function setDark() {
Settings.data.colorSchemes.darkMode = true
Settings.data.colorSchemes.darkMode = true;
}
function setLight() {
Settings.data.colorSchemes.darkMode = false
Settings.data.colorSchemes.darkMode = false;
}
}
IpcHandler {
target: "colorScheme"
function set(schemeName: string) {
ColorSchemeService.setPredefinedScheme(schemeName)
ColorSchemeService.setPredefinedScheme(schemeName);
}
}
IpcHandler {
target: "volume"
function increase() {
AudioService.increaseVolume()
AudioService.increaseVolume();
}
function decrease() {
AudioService.decreaseVolume()
AudioService.decreaseVolume();
}
function muteOutput() {
AudioService.setOutputMuted(!AudioService.muted)
AudioService.setOutputMuted(!AudioService.muted);
}
function increaseInput() {
AudioService.increaseInputVolume()
AudioService.increaseInputVolume();
}
function decreaseInput() {
AudioService.decreaseInputVolume()
AudioService.decreaseInputVolume();
}
function muteInput() {
AudioService.setInputMuted(!AudioService.inputMuted)
AudioService.setInputMuted(!AudioService.inputMuted);
}
}
@@ -198,13 +198,13 @@ Item {
target: "sessionMenu"
function toggle() {
root.withTargetScreen(screen => {
var sessionMenuPanel = PanelService.getPanel("sessionMenuPanel", screen)
sessionMenuPanel?.toggle()
})
var sessionMenuPanel = PanelService.getPanel("sessionMenuPanel", screen);
sessionMenuPanel?.toggle();
});
}
function lockAndSuspend() {
CompositorService.lockAndSuspend()
CompositorService.lockAndSuspend();
}
}
@@ -212,14 +212,14 @@ Item {
target: "controlCenter"
function toggle() {
root.withTargetScreen(screen => {
var controlCenterPanel = PanelService.getPanel("controlCenterPanel", screen)
var controlCenterPanel = PanelService.getPanel("controlCenterPanel", screen);
if (Settings.data.controlCenter.position === "close_to_bar_button") {
// Will attempt to open the panel next to the bar button if any.
controlCenterPanel?.toggle(null, "ControlCenter")
controlCenterPanel?.toggle(null, "ControlCenter");
} else {
controlCenterPanel?.toggle()
controlCenterPanel?.toggle();
}
})
});
}
}
@@ -229,33 +229,33 @@ Item {
function toggle() {
if (Settings.data.wallpaper.enabled) {
root.withTargetScreen(screen => {
var wallpaperPanel = PanelService.getPanel("wallpaperPanel", screen)
wallpaperPanel?.toggle()
})
var wallpaperPanel = PanelService.getPanel("wallpaperPanel", screen);
wallpaperPanel?.toggle();
});
}
}
function random() {
if (Settings.data.wallpaper.enabled) {
WallpaperService.setRandomWallpaper()
WallpaperService.setRandomWallpaper();
}
}
function set(path: string, screen: string) {
if (screen === "all" || screen === "") {
screen = undefined
screen = undefined;
}
WallpaperService.changeWallpaper(path, screen)
WallpaperService.changeWallpaper(path, screen);
}
function toggleAutomation() {
Settings.data.wallpaper.randomEnabled = !Settings.data.wallpaper.randomEnabled
Settings.data.wallpaper.randomEnabled = !Settings.data.wallpaper.randomEnabled;
}
function disableAutomation() {
Settings.data.wallpaper.randomEnabled = false
Settings.data.wallpaper.randomEnabled = false;
}
function enableAutomation() {
Settings.data.wallpaper.randomEnabled = true
Settings.data.wallpaper.randomEnabled = true;
}
}
@@ -263,20 +263,20 @@ Item {
target: "batteryManager"
function cycle() {
BatteryService.cycleModes()
BatteryService.cycleModes();
}
function set(mode: string) {
switch (mode) {
case "full":
BatteryService.setChargingMode(BatteryService.ChargingMode.Full)
break
BatteryService.setChargingMode(BatteryService.ChargingMode.Full);
break;
case "balanced":
BatteryService.setChargingMode(BatteryService.ChargingMode.Balanced)
break
BatteryService.setChargingMode(BatteryService.ChargingMode.Balanced);
break;
case "lifespan":
BatteryService.setChargingMode(BatteryService.ChargingMode.Lifespan)
break
BatteryService.setChargingMode(BatteryService.ChargingMode.Lifespan);
break;
}
}
}
@@ -284,103 +284,102 @@ Item {
IpcHandler {
target: "powerProfile"
function cycle() {
PowerProfileService.cycleProfile()
PowerProfileService.cycleProfile();
}
function set(mode: string) {
switch (mode) {
case "performance":
PowerProfileService.setProfile(2)
break
PowerProfileService.setProfile(2);
break;
case "balanced":
PowerProfileService.setProfile(1)
break
PowerProfileService.setProfile(1);
break;
case "powersaver":
PowerProfileService.setProfile(0)
break
PowerProfileService.setProfile(0);
break;
}
}
function toggleNoctaliaPerformance() {
PowerProfileService.toggleNoctaliaPerformance()
PowerProfileService.toggleNoctaliaPerformance();
}
function enableNoctaliaPerformance() {
PowerProfileService.setNoctaliaPerformance(true)
PowerProfileService.setNoctaliaPerformance(true);
}
function disableNoctaliaPerformance() {
PowerProfileService.setNoctaliaPerformance(false)
PowerProfileService.setNoctaliaPerformance(false);
}
}
IpcHandler {
target: "media"
function playPause() {
MediaService.playPause()
MediaService.playPause();
}
function play() {
MediaService.play()
MediaService.play();
}
function stop() {
MediaService.stop()
MediaService.stop();
}
function pause() {
MediaService.pause()
MediaService.pause();
}
function next() {
MediaService.next()
MediaService.next();
}
function previous() {
MediaService.previous()
MediaService.previous();
}
function seekRelative(offset: string) {
var offsetVal = parseFloat(offset)
var offsetVal = parseFloat(offset);
if (Number.isNaN(offsetVal)) {
Logger.w("Media", "Argument to ipc call 'media seekRelative' must be a number")
return
Logger.w("Media", "Argument to ipc call 'media seekRelative' must be a number");
return;
}
MediaService.seekRelative(offsetVal)
MediaService.seekRelative(offsetVal);
}
function seekByRatio(position: string) {
var positionVal = parseFloat(position)
var positionVal = parseFloat(position);
if (Number.isNaN(positionVal)) {
Logger.w("Media", "Argument to ipc call 'media seekByRatio' must be a number")
return
Logger.w("Media", "Argument to ipc call 'media seekByRatio' must be a number");
return;
}
MediaService.seekByRatio(positionVal)
MediaService.seekByRatio(positionVal);
}
}
// Queue an IPC panel operation - will execute when screen is detected
function withTargetScreen(callback) {
if (pendingCallback) {
Logger.w("IPC", "Another IPC call is pending, ignoring new call")
return
Logger.w("IPC", "Another IPC call is pending, ignoring new call");
return;
}
// Single monitor setup can execute immediately
if (Quickshell.screens.length === 1) {
callback(Quickshell.screens[0])
callback(Quickshell.screens[0]);
} else {
// Multi-monitors setup needs to start async detection
detectedScreen = null
pendingCallback = callback
screenDetectorLoader.active = true
detectedScreen = null;
pendingCallback = callback;
screenDetectorLoader.active = true;
}
}
/**
* For IPC calls on multi-monitors setup that will open panels on screen,
* we need to open a QS PanelWindow and wait for it's "screen" property to stabilize.
* For IPC calls on multi-monitors setup that will open panels on screen,
* we need to open a QS PanelWindow and wait for it's "screen" property to stabilize.
*/
property ShellScreen detectedScreen: null
property var pendingCallback: null
@@ -390,17 +389,17 @@ Item {
running: false
interval: 20
onTriggered: {
Logger.d("IPC", "Screen debounced to:", detectedScreen?.name || "null")
Logger.d("IPC", "Screen debounced to:", detectedScreen?.name || "null");
// Execute pending callback if any
if (pendingCallback) {
Logger.d("IPC", "Executing pending IPC callback on screen:", detectedScreen.name)
pendingCallback(detectedScreen)
pendingCallback = null
Logger.d("IPC", "Executing pending IPC callback on screen:", detectedScreen.name);
pendingCallback(detectedScreen);
pendingCallback = null;
}
// Clean up
screenDetectorLoader.active = false
screenDetectorLoader.active = false;
}
}
@@ -417,8 +416,8 @@ Item {
mask: Region {}
onScreenChanged: {
detectedScreen = screen
screenDetectorDebounce.restart()
detectedScreen = screen;
screenDetectorDebounce.restart();
}
}
}