Fix flash before terminal spawns

This commit is contained in:
outfoxxed 2024-03-20 04:17:27 -07:00
parent 8364a3b9b9
commit eeb47e9dc1
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 55 additions and 11 deletions

View file

@ -101,6 +101,7 @@ layerrule = noanim, ^(selection)$
layerrule = blur, termspawner layerrule = blur, termspawner
layerrule = ignorezero, termspawner layerrule = ignorezero, termspawner
layerrule = noanim, termspawner
windowrulev2 = float, class:^(opensnitch_ui)$ windowrulev2 = float, class:^(opensnitch_ui)$
windowrulev2 = dimaround, class:^(opensnitch_ui)$ windowrulev2 = dimaround, class:^(opensnitch_ui)$

View file

@ -0,0 +1,26 @@
pragma Singleton
import Quickshell
import Quickshell.Io
Singleton {
signal windowOpened(address: string, workspace: string, klass: string, title: string);
Socket {
connected: true
path: `/tmp/hypr/${Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")}/.socket2.sock`
parser: SplitParser {
onRead: message => {
const [type, body] = message.split(">>");
const args = body.split(",");
switch (type) {
case "openwindow":
windowOpened(args[0], args[1], args[2], args[3])
break;
}
}
}
}
}

View file

@ -28,7 +28,7 @@ WlrLayershell {
property real endX: 0 property real endX: 0
property real endY: 0 property real endY: 0
readonly property bool bigEnough: width > 50 && height > 50 readonly property bool bigEnough: width > 300 && height > 150
border.color: bigEnough ? "#ee33ccff" : "#aa595959" border.color: bigEnough ? "#ee33ccff" : "#aa595959"
border.width: 1 border.width: 1
@ -36,10 +36,10 @@ WlrLayershell {
color: "#66001017" color: "#66001017"
visible: selecting visible: selecting
x: Math.min(startX, endX) x: Math.min(startX, endX) - border.width
y: Math.min(startY, endY) y: Math.min(startY, endY) - border.width
width: Math.max(startX, endX) - x width: Math.max(startX, endX) - x + border.width * 2
height: Math.max(startY, endY) - y height: Math.max(startY, endY) - y + border.width * 2
function startSelection() { function startSelection() {
initializing = true initializing = true
@ -53,11 +53,12 @@ WlrLayershell {
function endSelection() { function endSelection() {
const wasSelecting = selecting; const wasSelecting = selecting;
selecting = false;
initializing = false; initializing = false;
if (wasSelecting && bigEnough) { if (wasSelecting && bigEnough) {
selectionComplete(x, y, width, height); selectionComplete(x + 1, y + 1, width - 2, height - 2);
} else {
selecting = false;
} }
} }
} }
@ -80,8 +81,10 @@ WlrLayershell {
area.selecting = true; area.selecting = true;
} }
if (selectionArea.selecting) {
area.endX = mouseX; area.endX = mouseX;
area.endY = mouseY; area.endY = mouseY;
} }
} }
} }
}

View file

@ -51,14 +51,18 @@ ShellRoot {
property real width; property real width;
property real height; property real height;
command: ["hyprctl", "dispatch", "exec", `[float;; noanim; move ${x} ${y}; size ${width} ${height}] alacritty`] command: [
"hyprctl",
"dispatch",
"exec",
`[float;; noanim; move ${x} ${y}; size ${width} ${height}] alacritty --class AlacrittyTermselect`
]
} }
Connections { Connections {
target: ShellIpc target: ShellIpc
function onTermSelectChanged() { function onTermSelectChanged() {
if (ShellIpc.termSelect) { if (ShellIpc.termSelect) {
selectionLayer.selectionArea.startSelection(); selectionLayer.selectionArea.startSelection();
} else { } else {
@ -66,6 +70,16 @@ ShellRoot {
} }
} }
} }
Connections {
target: HyprlandIpc
function onWindowOpened(_, _, klass, _) {
if (klass == "AlacrittyTermselect") {
selectionLayer.selectionArea.selecting = false
}
}
}
} }
SelectionArea { SelectionArea {