refine screen logic

This commit is contained in:
lucy 2025-12-27 20:47:50 +01:00
parent d72adec2ef
commit b6ae60e97c
6 changed files with 37 additions and 14 deletions

View File

@ -2,6 +2,6 @@ pragma Singleton
import QtQuick import QtQuick
QtObject { QtObject {
readonly property string font: "Iosevka Nerd Font Propo" readonly property string font: "CommitMono Nerd Font Propo"
readonly property real fontSize: 14 readonly property real fontSize: 14
} }

View File

@ -2,12 +2,26 @@ pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Hyprland
import qs import qs
import "." import "."
import QtQuick.Layouts import QtQuick.Layouts
WlrLayershell { WlrLayershell {
id: root id: root
screen: {
// Iterate through all connected Quickshell screens
for (let i = 0; i < Quickshell.screens.length; i++) {
let screenCandidate = Quickshell.screens[i];
console.log(Quickshell.screens[i])
// Ask: "Is this screen the one Hyprland is currently focusing?"
if (Hyprland.monitorFor(screenCandidate) === Hyprland.focusedMonitor) {
return screenCandidate;
}
}
return null; // Fallback (should rarely happen)
}
// 1. Position: Top Right Corner, covering the full height // 1. Position: Top Right Corner, covering the full height
// We make it a fixed width (e.g., 400px) so it doesn't block the whole screen // We make it a fixed width (e.g., 400px) so it doesn't block the whole screen

View File

@ -5,6 +5,7 @@ import "../../"
import "." import "."
WlrLayershell { WlrLayershell {
required property var modelData
id: overlayRoot id: overlayRoot
// 1. Fill the entire screen // 1. Fill the entire screen

View File

@ -15,8 +15,7 @@ WlrLayershell {
} }
// We need to accept the screen from Variants // We need to accept the screen from Variants
property var screen required property var modelData
property var modelData
// 1. The StackView manages the images // 1. The StackView manages the images
StackView { StackView {

View File

@ -21,7 +21,7 @@ QtObject {
JsonAdapter { JsonAdapter {
id: adapter id: adapter
// This property corresponds to a key in your JSON file! // This property corresponds to a key in your JSON file!
property string lastWallpaper: "/home/lucy/.walls/frieren_river.jpg" property string lastWallpaper: "/home/lucy/.walls/mooon.png"
} }
} }

View File

@ -1,23 +1,32 @@
//@ pragma UseQApplication //@ pragma UseQApplication
//pragma ComponentBehavior: Bound
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import Quickshell import Quickshell
import "./modules/bar/" import "./modules/bar/"
import "./modules/wallpaper/" import "./modules/wallpaper/"
import "./modules/notifications/" import "./modules/notifications/"
Scope { ShellRoot {
WallSwitcher {} WallSwitcher {}
Variants {
id: wallVariants
model: Quickshell.screens
delegate: Wallpaper {}
}
Variants { Variants {
id: barVariants id: barVariants
model: Quickshell.screens model: Quickshell.screens
delegate: Bar {} delegate: Bar {
screen: modelData
}
} }
NotiPopup {} Variants {
Overlay {} id: overlayVariants
model: Quickshell.screens
delegate: Overlay {
screen: modelData
}
}
Variants {
model: Quickshell.screens
id: wallVariants
delegate: Wallpaper {
screen: modelData
}
}
NotiPopup { }
} }