From 9b7147f126cc06ca47540d39055eaee46af54136 Mon Sep 17 00:00:00 2001 From: Lemmy Date: Mon, 9 Feb 2026 22:07:06 -0500 Subject: [PATCH] compositor: added scrollwm support. --- .../Settings/Tabs/About/VersionSubTab.qml | 2 +- Scripts/bash/template-apply.sh | 29 ++++++++++++++++++- Services/Compositor/CompositorService.qml | 5 ++++ Services/Compositor/SwayService.qml | 15 ++++++---- Services/Noctalia/TelemetryService.qml | 2 ++ Services/Theming/TemplateRegistry.qml | 12 ++++++++ 6 files changed, 57 insertions(+), 8 deletions(-) diff --git a/Modules/Panels/Settings/Tabs/About/VersionSubTab.qml b/Modules/Panels/Settings/Tabs/About/VersionSubTab.qml index fa45534e6..b36849e45 100644 --- a/Modules/Panels/Settings/Tabs/About/VersionSubTab.qml +++ b/Modules/Panels/Settings/Tabs/About/VersionSubTab.qml @@ -94,7 +94,7 @@ ColumnLayout { return { instanceId: TelemetryService.getInstanceId(), version: UpdateService.currentVersion, - compositor: CompositorService.isHyprland ? "Hyprland" : CompositorService.isNiri ? "Niri" : CompositorService.isSway ? "Sway" : CompositorService.isMango ? "MangoWC" : CompositorService.isLabwc ? "LabWC" : "Unknown", + compositor: TelemetryService.getCompositorType(), os: HostService.osPretty || "Unknown", ramGb: Math.round((root.getModule("Memory")?.result?.total || 0) / root.giga), monitors: monitors, diff --git a/Scripts/bash/template-apply.sh b/Scripts/bash/template-apply.sh index 3e30cecac..3c7be3303 100755 --- a/Scripts/bash/template-apply.sh +++ b/Scripts/bash/template-apply.sh @@ -4,7 +4,7 @@ if [ "$#" -lt 1 ]; then # Print usage information to standard error. echo "Error: No application specified." >&2 - echo "Usage: $0 {kitty|ghostty|foot|alacritty|wezterm|fuzzel|walker|pywalfox|cava|yazi|niri|hyprland|sway|mango|btop|zathura} [dark|light]" >&2 + echo "Usage: $0 {kitty|ghostty|foot|alacritty|wezterm|fuzzel|walker|pywalfox|cava|yazi|niri|hyprland|sway|scroll|mango|btop|zathura} [dark|light]" >&2 exit 1 fi @@ -369,6 +369,33 @@ sway) swaymsg reload ;; +scroll) + echo "Applying 'noctalia' theme to Scroll..." + CONFIG_DIR="$HOME/.config/scroll" + CONFIG_FILE="$CONFIG_DIR/config" + INCLUDE_LINE='include ~/.config/scroll/noctalia' + + # Check if the config file exists. + if [ ! -f "$CONFIG_FILE" ]; then + echo "Config file not found, creating $CONFIG_FILE..." + mkdir -p "$(dirname "$CONFIG_FILE")" + echo -e "\n$INCLUDE_LINE\n" >"$CONFIG_FILE" + echo "Created new config file with noctalia theme." + else + # Check if noctalia include already exists (flexible matching) + if grep -qE 'include\s+.*noctalia' "$CONFIG_FILE"; then + echo "Theme already included, skipping modification." + else + # Add the include line to the end of the file + echo -e "\n$INCLUDE_LINE\n" >>"$CONFIG_FILE" + echo "Added noctalia theme include to config." + fi + fi + + # Reload scroll + scrollmsg reload + ;; + mango) CONFIG_DIR="$HOME/.config/mango" MAIN_CONFIG="$CONFIG_DIR/config.conf" diff --git a/Services/Compositor/CompositorService.qml b/Services/Compositor/CompositorService.qml index 8f05fa9d2..5fd627cfe 100644 --- a/Services/Compositor/CompositorService.qml +++ b/Services/Compositor/CompositorService.qml @@ -16,6 +16,7 @@ Singleton { property bool isSway: false property bool isMango: false property bool isLabwc: false + property bool isScroll: false // Generic workspace and window data property ListModel workspaces: ListModel {} @@ -105,6 +106,7 @@ Singleton { isSway = true; isMango = false; isLabwc = false; + isScroll = currentDesktop && currentDesktop.toLowerCase().includes("scroll"); backendLoader.sourceComponent = swayComponent; } else { // Always fallback to Niri @@ -121,6 +123,9 @@ Singleton { id: backendLoader onLoaded: { if (item) { + if (isScroll) { + item.msgCommand = "scrollmsg"; + } root.backend = item; setupBackendConnections(); backend.initialize(); diff --git a/Services/Compositor/SwayService.qml b/Services/Compositor/SwayService.qml index 2db23dcb6..25af31c5b 100644 --- a/Services/Compositor/SwayService.qml +++ b/Services/Compositor/SwayService.qml @@ -9,6 +9,9 @@ import qs.Services.Keyboard Item { id: root + // Configurable IPC command name (overridden to "scrollmsg" for Scroll) + property string msgCommand: "swaymsg" + // Properties that match the facade interface property ListModel workspaces: ListModel {} property var windows: [] @@ -66,7 +69,7 @@ Item { Process { id: swayTreeProcess running: false - command: ["swaymsg", "-t", "get_tree", "-r"] + command: [msgCommand, "-t", "get_tree", "-r"] property string accumulatedOutput: "" @@ -181,7 +184,7 @@ Item { Process { id: swayOutputsProcess running: false - command: ["swaymsg", "-t", "get_outputs", "-r"] + command: [msgCommand, "-t", "get_outputs", "-r"] property string accumulatedOutput: "" @@ -249,7 +252,7 @@ Item { Process { id: swayInputsProcess running: false - command: ["swaymsg", "-t", "get_inputs", "-r"] + command: [msgCommand, "-t", "get_inputs", "-r"] property string accumulatedOutput: "" @@ -543,7 +546,7 @@ Item { function logout() { try { - Quickshell.execDetached(["swaymsg", "exit"]); + Quickshell.execDetached([msgCommand, "exit"]); } catch (e) { Logger.e("SwayService", "Failed to logout:", e); } @@ -551,7 +554,7 @@ Item { function cycleKeyboardLayout() { try { - Quickshell.execDetached(["swaymsg", "input", "type:keyboard", "xkb_switch_layout", "next"]); + Quickshell.execDetached([msgCommand, "input", "type:keyboard", "xkb_switch_layout", "next"]); } catch (e) { Logger.e("SwayService", "Failed to cycle keyboard layout:", e); } @@ -575,7 +578,7 @@ Item { function spawn(command) { try { - Quickshell.execDetached(["swaymsg", "exec", "--"].concat(command)); + Quickshell.execDetached([msgCommand, "exec", "--"].concat(command)); } catch (e) { Logger.e("SwayService", "Failed to spawn command:", e); } diff --git a/Services/Noctalia/TelemetryService.qml b/Services/Noctalia/TelemetryService.qml index d6506281a..a4ad11920 100644 --- a/Services/Noctalia/TelemetryService.qml +++ b/Services/Noctalia/TelemetryService.qml @@ -141,6 +141,8 @@ Singleton { return "Hyprland"; if (CompositorService.isNiri) return "Niri"; + if (CompositorService.isScroll) + return "Scroll"; if (CompositorService.isSway) return "Sway"; if (CompositorService.isMango) diff --git a/Services/Theming/TemplateRegistry.qml b/Services/Theming/TemplateRegistry.qml index bb0ffa21f..849b113dc 100644 --- a/Services/Theming/TemplateRegistry.qml +++ b/Services/Theming/TemplateRegistry.qml @@ -326,6 +326,18 @@ Singleton { ], "postProcess": () => `${templateApplyScript} sway` }, + { + "id": "scroll", + "name": "Scroll", + "category": "compositor", + "input": "sway", + "outputs": [ + { + "path": "~/.config/scroll/noctalia" + } + ], + "postProcess": () => `${templateApplyScript} scroll` + }, { "id": "hyprland", "name": "Hyprland",