Add CompositorService, make Logger look a bit nicer
This commit is contained in:
parent
c991ac85b4
commit
05f9acdc5d
9 changed files with 473 additions and 297 deletions
|
|
@ -7,10 +7,10 @@ import qs.Services
|
|||
import qs.Widgets
|
||||
|
||||
NLoader {
|
||||
active: WorkspacesService.isNiri
|
||||
active: CompositorService.isNiri
|
||||
|
||||
Component.onCompleted: {
|
||||
if (WorkspacesService.isNiri) {
|
||||
if (CompositorService.isNiri) {
|
||||
Logger.log("Overview", "Loading Overview component (Niri detected)")
|
||||
} else {
|
||||
Logger.log("Overview", "Skipping Overview component (Niri not detected)")
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ Row {
|
|||
|
||||
// Update text when window changes
|
||||
Connections {
|
||||
target: typeof NiriService !== "undefined" ? NiriService : null
|
||||
function onFocusedWindowIndexChanged() {
|
||||
target: CompositorService
|
||||
function onActiveWindowChanged() {
|
||||
// Check if window actually changed
|
||||
if (NiriService.focusedWindowIndex !== lastWindowIndex) {
|
||||
lastWindowIndex = NiriService.focusedWindowIndex
|
||||
if (CompositorService.focusedWindowIndex !== lastWindowIndex) {
|
||||
lastWindowIndex = CompositorService.focusedWindowIndex
|
||||
showingFullTitle = true
|
||||
fullTitleTimer.restart()
|
||||
}
|
||||
|
|
@ -39,11 +39,7 @@ Row {
|
|||
}
|
||||
|
||||
function getFocusedWindow() {
|
||||
if (typeof NiriService === "undefined" || NiriService.focusedWindowIndex < 0
|
||||
|| NiriService.focusedWindowIndex >= NiriService.windows.length) {
|
||||
return null
|
||||
}
|
||||
return NiriService.windows[NiriService.focusedWindowIndex]
|
||||
return CompositorService.getFocusedWindow()
|
||||
}
|
||||
|
||||
function getTitle() {
|
||||
|
|
|
|||
|
|
@ -348,13 +348,7 @@ NPanel {
|
|||
// ----------------------------------
|
||||
// System functions
|
||||
function logout() {
|
||||
if (WorkspacesService.isNiri) {
|
||||
logoutProcessNiri.running = true
|
||||
} else if (WorkspacesService.isHyprland) {
|
||||
logoutProcessHyprland.running = true
|
||||
} else {
|
||||
Logger.warn("PowerMenu", "No supported compositor detected for logout")
|
||||
}
|
||||
CompositorService.logout()
|
||||
}
|
||||
|
||||
function suspend() {
|
||||
|
|
@ -390,19 +384,7 @@ NPanel {
|
|||
running: false
|
||||
}
|
||||
|
||||
Process {
|
||||
id: logoutProcessNiri
|
||||
|
||||
command: ["niri", "msg", "action", "quit", "--skip-confirmation"]
|
||||
running: false
|
||||
}
|
||||
|
||||
Process {
|
||||
id: logoutProcessHyprland
|
||||
|
||||
command: ["hyprctl", "dispatch", "exit"]
|
||||
running: false
|
||||
}
|
||||
|
||||
Process {
|
||||
id: logoutProcess
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue