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 (
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
|
||||
@@ -21,31 +20,21 @@ func CheckCapability() bool {
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer registry.Destroy()
|
||||
|
||||
found := false
|
||||
var mu sync.Mutex
|
||||
done := make(chan struct{})
|
||||
|
||||
registry.SetGlobalHandler(func(e wlclient.RegistryGlobalEvent) {
|
||||
if e.Interface == ext_workspace.ExtWorkspaceManagerV1InterfaceName {
|
||||
mu.Lock()
|
||||
found = true
|
||||
mu.Unlock()
|
||||
}
|
||||
})
|
||||
|
||||
go func() {
|
||||
for i := 0; i < 10 && !found; i++ {
|
||||
if err := display.Context().Dispatch(); err != nil {
|
||||
break
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
registry.Destroy()
|
||||
close(done)
|
||||
}()
|
||||
// Roundtrip to ensure all registry events are processed
|
||||
if err := display.Roundtrip(); err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
<-done
|
||||
return found
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ Singleton {
|
||||
const hasExtWorkspace = DMSService.capabilities.includes("extworkspace")
|
||||
if (hasExtWorkspace && !extWorkspaceAvailable) {
|
||||
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) {
|
||||
console.info("ExtWorkspaceService: ext-workspace available but compositor has native support")
|
||||
extWorkspaceAvailable = false
|
||||
|
||||
Reference in New Issue
Block a user