mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
75 lines
2.1 KiB
QML
75 lines
2.1 KiB
QML
import qs
|
|
import qs.services
|
|
import qs.modules.common
|
|
import qs.modules.common.widgets
|
|
import qs.modules.common.functions
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import Quickshell.Wayland
|
|
import Quickshell.Hyprland
|
|
|
|
Scope {
|
|
id: root
|
|
|
|
Loader {
|
|
id: wallpaperSelectorLoader
|
|
active: GlobalStates.wallpaperSelectorOpen
|
|
|
|
sourceComponent: PanelWindow {
|
|
id: panelWindow
|
|
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(panelWindow.screen)
|
|
property bool monitorIsFocused: (Hyprland.focusedMonitor?.id == monitor?.id)
|
|
|
|
exclusionMode: ExclusionMode.Ignore
|
|
WlrLayershell.namespace: "quickshell:wallpaperSelector"
|
|
WlrLayershell.layer: WlrLayer.Overlay
|
|
color: "transparent"
|
|
|
|
anchors.top: true
|
|
margins {
|
|
top: Config?.options.bar.vertical ? Appearance.sizes.hyprlandGapsOut : Appearance.sizes.barHeight + Appearance.sizes.hyprlandGapsOut
|
|
}
|
|
|
|
mask: Region {
|
|
item: content
|
|
}
|
|
|
|
implicitHeight: Appearance.sizes.wallpaperSelectorHeight
|
|
implicitWidth: Appearance.sizes.wallpaperSelectorWidth
|
|
|
|
HyprlandFocusGrab { // Click outside to close
|
|
id: grab
|
|
windows: [ panelWindow ]
|
|
active: wallpaperSelectorLoader.active
|
|
onCleared: () => {
|
|
if (!active) GlobalStates.wallpaperSelectorOpen = false;
|
|
}
|
|
}
|
|
|
|
WallpaperSelectorContent {
|
|
id: content
|
|
anchors {
|
|
fill: parent
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
IpcHandler {
|
|
target: "wallpaperSelector"
|
|
|
|
function toggle(): void {
|
|
GlobalStates.wallpaperSelectorOpen = !GlobalStates.wallpaperSelectorOpen
|
|
}
|
|
}
|
|
|
|
GlobalShortcut {
|
|
name: "wallpaperSelectorToggle"
|
|
description: "Toggle wallpaper selector"
|
|
onPressed: {
|
|
GlobalStates.wallpaperSelectorOpen = !GlobalStates.wallpaperSelectorOpen;
|
|
}
|
|
}
|
|
}
|