Add terminal spawning quickshell config
This commit is contained in:
parent
6a824b8a58
commit
8364a3b9b9
9 changed files with 308 additions and 72 deletions
87
modules/user/modules/quickshell/shell/SelectionLayer.qml
Normal file
87
modules/user/modules/quickshell/shell/SelectionLayer.qml
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
|
||||
WlrLayershell {
|
||||
signal selectionComplete(x: real, y: real, width: real, height: real)
|
||||
|
||||
color: "transparent"
|
||||
visible: selectionArea.selecting || selectionArea.initializing
|
||||
layer: WlrLayer.Overlay
|
||||
namespace: "termspawner"
|
||||
|
||||
anchors {
|
||||
left: true
|
||||
right: true
|
||||
top: true
|
||||
bottom: true
|
||||
}
|
||||
|
||||
property var selectionArea: area
|
||||
|
||||
Rectangle {
|
||||
id: area
|
||||
property bool selecting: false
|
||||
property bool initializing: false
|
||||
property real startX: 0
|
||||
property real startY: 0
|
||||
property real endX: 0
|
||||
property real endY: 0
|
||||
|
||||
readonly property bool bigEnough: width > 50 && height > 50
|
||||
|
||||
border.color: bigEnough ? "#ee33ccff" : "#aa595959"
|
||||
border.width: 1
|
||||
radius: 5
|
||||
color: "#66001017"
|
||||
visible: selecting
|
||||
|
||||
x: Math.min(startX, endX)
|
||||
y: Math.min(startY, endY)
|
||||
width: Math.max(startX, endX) - x
|
||||
height: Math.max(startY, endY) - y
|
||||
|
||||
function startSelection() {
|
||||
initializing = true
|
||||
if (selecting) {
|
||||
area.startX = mouseArea.mouseX;
|
||||
area.startY = mouseArea.mouseY;
|
||||
area.endX = mouseArea.mouseX;
|
||||
area.endY = mouseArea.mouseY;
|
||||
}
|
||||
}
|
||||
|
||||
function endSelection() {
|
||||
const wasSelecting = selecting;
|
||||
selecting = false;
|
||||
initializing = false;
|
||||
|
||||
if (wasSelecting && bigEnough) {
|
||||
selectionComplete(x, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
|
||||
hoverEnabled: true
|
||||
onPositionChanged: {
|
||||
if (area.initializing) {
|
||||
if (!containsMouse) {
|
||||
area.initializing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
area.startX = mouseX;
|
||||
area.startY = mouseY;
|
||||
area.initializing = false;
|
||||
area.selecting = true;
|
||||
}
|
||||
|
||||
area.endX = mouseX;
|
||||
area.endY = mouseY;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue