Fix flash before terminal spawns
This commit is contained in:
		
							parent
							
								
									8364a3b9b9
								
							
						
					
					
						commit
						eeb47e9dc1
					
				
					 4 changed files with 55 additions and 11 deletions
				
			
		
							
								
								
									
										26
									
								
								modules/user/modules/quickshell/shell/HyprlandIpc.qml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								modules/user/modules/quickshell/shell/HyprlandIpc.qml
									
										
									
									
									
										Normal 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;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue