mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
extws: fix force option
This commit is contained in:
@@ -2,7 +2,6 @@ package extworkspace
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
|
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
|
||||||
@@ -21,31 +20,21 @@ func CheckCapability() bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
defer registry.Destroy()
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
var mu sync.Mutex
|
|
||||||
done := make(chan struct{})
|
|
||||||
|
|
||||||
registry.SetGlobalHandler(func(e wlclient.RegistryGlobalEvent) {
|
registry.SetGlobalHandler(func(e wlclient.RegistryGlobalEvent) {
|
||||||
if e.Interface == ext_workspace.ExtWorkspaceManagerV1InterfaceName {
|
if e.Interface == ext_workspace.ExtWorkspaceManagerV1InterfaceName {
|
||||||
mu.Lock()
|
|
||||||
found = true
|
found = true
|
||||||
mu.Unlock()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
go func() {
|
// Roundtrip to ensure all registry events are processed
|
||||||
for i := 0; i < 10 && !found; i++ {
|
if err := display.Roundtrip(); err != nil {
|
||||||
if err := display.Context().Dispatch(); err != nil {
|
return false
|
||||||
break
|
}
|
||||||
}
|
|
||||||
time.Sleep(10 * time.Millisecond)
|
|
||||||
}
|
|
||||||
registry.Destroy()
|
|
||||||
close(done)
|
|
||||||
}()
|
|
||||||
|
|
||||||
<-done
|
|
||||||
return found
|
return found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Singleton {
|
|||||||
const hasExtWorkspace = DMSService.capabilities.includes("extworkspace")
|
const hasExtWorkspace = DMSService.capabilities.includes("extworkspace")
|
||||||
if (hasExtWorkspace && !extWorkspaceAvailable) {
|
if (hasExtWorkspace && !extWorkspaceAvailable) {
|
||||||
if (typeof CompositorService !== "undefined") {
|
if (typeof CompositorService !== "undefined") {
|
||||||
const useExtWorkspace = !CompositorService.isNiri && !CompositorService.isHyprland && !CompositorService.isDwl && !CompositorService.isSway
|
const useExtWorkspace = DMSService.forceExtWorkspace || (!CompositorService.isNiri && !CompositorService.isHyprland && !CompositorService.isDwl && !CompositorService.isSway)
|
||||||
if (!useExtWorkspace) {
|
if (!useExtWorkspace) {
|
||||||
console.info("ExtWorkspaceService: ext-workspace available but compositor has native support")
|
console.info("ExtWorkspaceService: ext-workspace available but compositor has native support")
|
||||||
extWorkspaceAvailable = false
|
extWorkspaceAvailable = false
|
||||||
|
|||||||
Reference in New Issue
Block a user