diff --git a/modules/hyprland/hyprland.conf b/modules/hyprland/hyprland.conf index 2da6323..da4212c 100644 --- a/modules/hyprland/hyprland.conf +++ b/modules/hyprland/hyprland.conf @@ -101,6 +101,7 @@ layerrule = noanim, ^(selection)$ layerrule = blur, termspawner layerrule = ignorezero, termspawner +layerrule = noanim, termspawner windowrulev2 = float, class:^(opensnitch_ui)$ windowrulev2 = dimaround, class:^(opensnitch_ui)$ diff --git a/modules/user/modules/quickshell/shell/HyprlandIpc.qml b/modules/user/modules/quickshell/shell/HyprlandIpc.qml new file mode 100644 index 0000000..55aa941 --- /dev/null +++ b/modules/user/modules/quickshell/shell/HyprlandIpc.qml @@ -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; + } + } + } + } +} diff --git a/modules/user/modules/quickshell/shell/SelectionLayer.qml b/modules/user/modules/quickshell/shell/SelectionLayer.qml index 541b16d..2ad6b51 100644 --- a/modules/user/modules/quickshell/shell/SelectionLayer.qml +++ b/modules/user/modules/quickshell/shell/SelectionLayer.qml @@ -28,7 +28,7 @@ WlrLayershell { property real endX: 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.width: 1 @@ -36,10 +36,10 @@ WlrLayershell { 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 + x: Math.min(startX, endX) - border.width + y: Math.min(startY, endY) - border.width + width: Math.max(startX, endX) - x + border.width * 2 + height: Math.max(startY, endY) - y + border.width * 2 function startSelection() { initializing = true @@ -53,11 +53,12 @@ WlrLayershell { function endSelection() { const wasSelecting = selecting; - selecting = false; initializing = false; 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.endX = mouseX; - area.endY = mouseY; + if (selectionArea.selecting) { + area.endX = mouseX; + area.endY = mouseY; + } } } } diff --git a/modules/user/modules/quickshell/shell/shell.qml b/modules/user/modules/quickshell/shell/shell.qml index b67461f..82cc55b 100644 --- a/modules/user/modules/quickshell/shell/shell.qml +++ b/modules/user/modules/quickshell/shell/shell.qml @@ -51,14 +51,18 @@ ShellRoot { property real width; 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 { target: ShellIpc function onTermSelectChanged() { - if (ShellIpc.termSelect) { selectionLayer.selectionArea.startSelection(); } else { @@ -66,6 +70,16 @@ ShellRoot { } } } + + Connections { + target: HyprlandIpc + + function onWindowOpened(_, _, klass, _) { + if (klass == "AlacrittyTermselect") { + selectionLayer.selectionArea.selecting = false + } + } + } } SelectionArea {