Files
z-bar-qt/Helpers/AreaPicker.qml
Zacharias-Brohn 5b069bf4c2 screenshot utility
2025-11-18 13:47:12 +01:00

70 lines
1.6 KiB
QML

pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Wayland
import Quickshell.Io
import Quickshell.Hyprland
import ZShell
Scope {
LazyLoader {
id: root
property bool freeze
property bool closing
Variants {
model: Quickshell.screens
PanelWindow {
id: win
color: "transparent"
required property ShellScreen modelData
screen: modelData
WlrLayershell.namespace: "areapicker"
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: root.closing ? WlrKeyboardFocus.None : WlrKeyboardFocus.Exclusive
mask: root.closing ? empty : null
anchors {
top: true
bottom: true
left: true
right: true
}
Region {
id: empty
}
Picker {
loader: root
screen: win.modelData
}
}
}
}
GlobalShortcut {
name: "screenshot"
appid: "ZShell"
onPressed: {
root.freeze = false;
root.closing = false;
root.activeAsync = true;
}
}
GlobalShortcut {
name: "screenshotFreeze"
appid: "ZShell"
onPressed: {
root.freeze = true;
root.closing = false;
root.activeAsync = true;
}
}
}