Add overlay and oneshot crosshair
This commit is contained in:
38
Boateye.qml
38
Boateye.qml
@@ -6,9 +6,17 @@ import Quickshell.Io
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
PanelWindow {
|
||||
Item {
|
||||
id: root
|
||||
visible: false
|
||||
property bool open: false
|
||||
IpcHandler {
|
||||
target: "boateye"
|
||||
function open() {root.open = true}
|
||||
function close() {root.open = false}
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
visible: root.open
|
||||
anchors {
|
||||
left: true
|
||||
bottom: true
|
||||
@@ -18,12 +26,6 @@ PanelWindow {
|
||||
implicitWidth: 540
|
||||
color: "transparent"
|
||||
|
||||
IpcHandler {
|
||||
target: "boateye"
|
||||
function open() {root.visible = true}
|
||||
function close() {root.visible = false}
|
||||
}
|
||||
|
||||
RectangularShadow {
|
||||
anchors.fill: wrapper
|
||||
radius: wrapper.radius
|
||||
@@ -50,14 +52,16 @@ PanelWindow {
|
||||
height: Quickshell.screens[0].height
|
||||
live: true
|
||||
captureSource: Quickshell.screens[0]
|
||||
x: -1292
|
||||
y: -450
|
||||
x: -1544
|
||||
y: -693
|
||||
}
|
||||
transform: Scale {
|
||||
origin {
|
||||
x: width/2
|
||||
y: height/2
|
||||
}
|
||||
// xScale: 15
|
||||
// yScale: 10
|
||||
xScale: 15
|
||||
yScale: 10
|
||||
}
|
||||
@@ -68,3 +72,17 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
PanelWindow {
|
||||
visible: root.open
|
||||
anchors {
|
||||
right: true
|
||||
}
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
margins {
|
||||
right: 998
|
||||
}
|
||||
implicitWidth: 8
|
||||
implicitHeight: 8
|
||||
}
|
||||
}
|
||||
|
||||
68
Keystrokes.qml
Normal file
68
Keystrokes.qml
Normal file
@@ -0,0 +1,68 @@
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: keystrokes
|
||||
|
||||
PanelWindow {
|
||||
anchors {
|
||||
bottom: true
|
||||
left: true
|
||||
}
|
||||
margins {
|
||||
left: 8
|
||||
bottom: 8
|
||||
}
|
||||
implicitWidth: 208
|
||||
implicitHeight: 60
|
||||
color: "transparent"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
height: 50
|
||||
width: 100
|
||||
color: apr.pressed ? "white" : "black"
|
||||
radius: 12
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
color: apr.pressed ? "black" : "white"
|
||||
text: "A"
|
||||
font.pixelSize: 40
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
}
|
||||
height: 50
|
||||
width: 100
|
||||
color: spr.pressed ? "white" : "black"
|
||||
radius: 12
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
color: spr.pressed ? "black" : "white"
|
||||
text: "S"
|
||||
font.pixelSize: 40
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
id: apr
|
||||
name: "apressed"
|
||||
appid: "chlorostroke"
|
||||
}
|
||||
GlobalShortcut {
|
||||
id: spr
|
||||
name: "spressed"
|
||||
appid: "chlorostroke"
|
||||
}
|
||||
}
|
||||
56
Overlay.qml
Normal file
56
Overlay.qml
Normal file
@@ -0,0 +1,56 @@
|
||||
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
|
||||
}
|
||||
22
discord.frag
Normal file
22
discord.frag
Normal file
@@ -0,0 +1,22 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
vec4 bgcol;
|
||||
};
|
||||
layout(binding = 1) uniform sampler2D source;
|
||||
void main() {
|
||||
vec4 p = texture(source, qt_TexCoord0);
|
||||
if (
|
||||
p.r == bgcol.r &&
|
||||
p.g == bgcol.g &&
|
||||
p.b == bgcol.b
|
||||
) {
|
||||
fragColor = vec4(0, 0, 0, 0);
|
||||
}
|
||||
else {
|
||||
fragColor = p;
|
||||
}
|
||||
}
|
||||
BIN
discord.frag.qsb
Normal file
BIN
discord.frag.qsb
Normal file
Binary file not shown.
Reference in New Issue
Block a user