Files
monoshell/Overlay.qml

57 lines
1.4 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import QtQuick.Effects
import Quickshell.Widgets
import Quickshell.Wayland
FloatingWindow {
id: overlay
visible: toplevel
color: "transparent"
property var toplevel: null
title: "monoverlay"
Process {
id: slurp
command: ['sh', '-c', "slurp -f %x,%y,%w,%h </dev/null"]
stdout: StdioCollector { onStreamFinished: {
let [x, y, w, h] = this.text.split(',')
const toplevel = Hyprland.activeToplevel
const {at, size} = toplevel.lastIpcObject
x -= at[0]
y -= at[1]
source.sourceRect = Qt.rect(x, y, w, h)
console.log(x, y, w, h, toplevel)
overlay.toplevel = toplevel.wayland
}}
}
IpcHandler {
target: "overlay"
function open() {slurp.running = true}
}
ScreencopyView {
id: view
visible: false
layer.enabled: true
width: sourceSize.width
height: sourceSize.height
// layer.effect: ShaderEffect {
// fragmentShader: "discord.frag.qsb"
// property color bgcol: "#111111"
// }
live: true
captureSource: overlay.toplevel
}
ShaderEffectSource {
id: source
anchors.fill: parent
sourceItem: view
}
onClosed: toplevel = null
}