mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
hyprland: using toplevel for current screen detection
This commit is contained in:
@@ -135,10 +135,13 @@ Item {
|
||||
}
|
||||
|
||||
function getFocusedScreen() {
|
||||
const activeToplevel = ToplevelManager.activeToplevel;
|
||||
if (activeToplevel && activeToplevel.screens && activeToplevel.screens.length > 0) {
|
||||
return activeToplevel.screens[0];
|
||||
}
|
||||
// de-activated until proper testing
|
||||
return null;
|
||||
|
||||
// const activeToplevel = ToplevelManager.activeToplevel;
|
||||
// if (activeToplevel && activeToplevel.screens && activeToplevel.screens.length > 0) {
|
||||
// return activeToplevel.screens[0];
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,10 +679,13 @@ Item {
|
||||
}
|
||||
|
||||
function getFocusedScreen() {
|
||||
const activeToplevel = ToplevelManager.activeToplevel;
|
||||
if (activeToplevel && activeToplevel.screens && activeToplevel.screens.length > 0) {
|
||||
return activeToplevel.screens[0];
|
||||
}
|
||||
// de-activated until proper testing
|
||||
return null;
|
||||
|
||||
// const activeToplevel = ToplevelManager.activeToplevel;
|
||||
// if (activeToplevel && activeToplevel.screens && activeToplevel.screens.length > 0) {
|
||||
// return activeToplevel.screens[0];
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,10 +489,13 @@ Item {
|
||||
}
|
||||
|
||||
function getFocusedScreen() {
|
||||
const activeToplevel = ToplevelManager.activeToplevel;
|
||||
if (activeToplevel && activeToplevel.screens && activeToplevel.screens.length > 0) {
|
||||
return activeToplevel.screens[0];
|
||||
}
|
||||
// On niri the code below only works when you have an actual app selected on that screen.
|
||||
return null;
|
||||
|
||||
// const activeToplevel = ToplevelManager.activeToplevel;
|
||||
// if (activeToplevel && activeToplevel.screens && activeToplevel.screens.length > 0) {
|
||||
// return activeToplevel.screens[0];
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,15 +558,18 @@ Item {
|
||||
}
|
||||
|
||||
function getFocusedScreen() {
|
||||
const i3Mon = I3.focusedMonitor;
|
||||
if (i3Mon) {
|
||||
const monitorName = i3Mon.name;
|
||||
for (let i = 0; i < Quickshell.screens.length; i++) {
|
||||
if (Quickshell.screens[i].name === monitorName) {
|
||||
return Quickshell.screens[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
// de-activated until proper testing
|
||||
return null;
|
||||
|
||||
// const i3Mon = I3.focusedMonitor;
|
||||
// if (i3Mon) {
|
||||
// const monitorName = i3Mon.name;
|
||||
// for (let i = 0; i < Quickshell.screens.length; i++) {
|
||||
// if (Quickshell.screens[i].name === monitorName) {
|
||||
// return Quickshell.screens[i];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,7 @@ Item {
|
||||
}
|
||||
|
||||
// Try compositor-specific focused monitor detection first
|
||||
//let screen = CompositorService.getFocusedScreen();
|
||||
let screen = null;
|
||||
let screen = CompositorService.getFocusedScreen();
|
||||
|
||||
if (screen) {
|
||||
// Apply the bar check if configured
|
||||
|
||||
Reference in New Issue
Block a user