1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

feat: add scroll compositor support (#959)

* added scroll support

* import QuickShell.i3

* update scroll provider registration logic

* improve scroll support for workspace switcher

* update title for scroll keybinds

* add scroll to dms-greeter

* fix: formatting & sway keybind provider

* readme update

---------

Co-authored-by: bbedward <bbedward@gmail.com>
This commit is contained in:
Varshit
2025-12-09 21:57:46 +01:00
committed by GitHub
parent aeacf109eb
commit f94011cf05
18 changed files with 298 additions and 169 deletions

View File

@@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.I3
import Quickshell.Wayland
import Quickshell.Hyprland
import qs.Common
@@ -14,6 +15,7 @@ Singleton {
property bool isNiri: false
property bool isDwl: false
property bool isSway: false
property bool isScroll: false
property bool isLabwc: false
property string compositor: "unknown"
readonly property bool useHyprlandFocusGrab: isHyprland && Quickshell.env("DMS_HYPRLAND_EXCLUSIVE_FOCUS") !== "1"
@@ -21,6 +23,7 @@ Singleton {
readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
readonly property string niriSocket: Quickshell.env("NIRI_SOCKET")
readonly property string swaySocket: Quickshell.env("SWAYSOCK")
readonly property string scrollSocket: Quickshell.env("SWAYSOCK")
readonly property string labwcPid: Quickshell.env("LABWC_PID")
property bool useNiriSorting: isNiri && NiriService
@@ -71,7 +74,7 @@ Singleton {
screenName = Hyprland.focusedWorkspace.monitor.name;
else if (isNiri && NiriService.currentOutput)
screenName = NiriService.currentOutput;
else if (isSway) {
else if (isSway || isScroll) {
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
screenName = focusedWs?.monitor?.name || "";
} else if (isDwl && DwlService.activeOutput)
@@ -398,11 +401,12 @@ Singleton {
}
function detectCompositor() {
if (hyprlandSignature && hyprlandSignature.length > 0 && !niriSocket && !swaySocket && !labwcPid) {
if (hyprlandSignature && hyprlandSignature.length > 0 && !niriSocket && !swaySocket && !scrollSocket && !labwcPid) {
isHyprland = true;
isNiri = false;
isDwl = false;
isSway = false;
isScroll = false;
isLabwc = false;
compositor = "hyprland";
console.info("CompositorService: Detected Hyprland");
@@ -416,6 +420,7 @@ Singleton {
isHyprland = false;
isDwl = false;
isSway = false;
isScroll = false;
isLabwc = false;
compositor = "niri";
console.info("CompositorService: Detected Niri with socket:", niriSocket);
@@ -425,13 +430,14 @@ Singleton {
return;
}
if (swaySocket && swaySocket.length > 0) {
if (swaySocket && swaySocket.length > 0 && !scrollSocket && scrollSocket.length == 0) {
Proc.runCommand("swaySocketCheck", ["test", "-S", swaySocket], (output, exitCode) => {
if (exitCode === 0) {
isNiri = false;
isHyprland = false;
isDwl = false;
isSway = true;
isScroll = false;
isLabwc = false;
compositor = "sway";
console.info("CompositorService: Detected Sway with socket:", swaySocket);
@@ -440,11 +446,28 @@ Singleton {
return;
}
if (scrollSocket && scrollSocket.length > 0) {
Proc.runCommand("scrollSocketCheck", ["test", "-S", scrollSocket], (output, exitCode) => {
if (exitCode === 0) {
isNiri = false;
isHyprland = false;
isDwl = false;
isSway = false;
isScroll = true;
isLabwc = false;
compositor = "scroll";
console.info("CompositorService: Detected Scroll with socket:", scrollSocket);
}
}, 0);
return;
}
if (labwcPid && labwcPid.length > 0) {
isHyprland = false;
isNiri = false;
isDwl = false;
isSway = false;
isScroll = false;
isLabwc = true;
compositor = "labwc";
console.info("CompositorService: Detected LabWC with PID:", labwcPid);
@@ -458,6 +481,7 @@ Singleton {
isNiri = false;
isDwl = false;
isSway = false;
isScroll = false;
isLabwc = false;
compositor = "unknown";
console.warn("CompositorService: No compositor detected");
@@ -479,6 +503,7 @@ Singleton {
isNiri = false;
isDwl = true;
isSway = false;
isScroll = false;
isLabwc = false;
compositor = "dwl";
console.info("CompositorService: Detected DWL via DMS capability");
@@ -492,7 +517,7 @@ Singleton {
return Hyprland.dispatch("dpms off");
if (isDwl)
return _dwlPowerOffMonitors();
if (isSway) {
if (isSway || isScroll) {
try {
I3.dispatch("output * dpms off");
} catch (_) {}
@@ -511,7 +536,7 @@ Singleton {
return Hyprland.dispatch("dpms on");
if (isDwl)
return _dwlPowerOnMonitors();
if (isSway) {
if (isSway || isScroll) {
try {
I3.dispatch("output * dpms on");
} catch (_) {}