diff --git a/flake.lock b/flake.lock index 0814250..7b2150f 100644 --- a/flake.lock +++ b/flake.lock @@ -48,11 +48,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1710091554, - "narHash": "sha256-p4CFIo9dAIgL6KMp1woJxVISoqYKblPGjAgTPkzeOWI=", + "lastModified": 1710467097, + "narHash": "sha256-FjrUwzv3wt0W/ekgCgbAdjkShZNUdAEDx/+qLukQFkI=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "a230393bb7e2db667c63c3f5c279a6e26d8b1c5a", + "rev": "45dcc83490fe6befb6c1fd5bacf9ded14cdf0554", "type": "github" }, "original": { @@ -87,11 +87,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1709126324, - "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -132,11 +132,11 @@ ] }, "locked": { - "lastModified": 1710062421, - "narHash": "sha256-FiCNRfyUgJOLYIokLiFsfI7B+Zn9HDnOzFR3uVr5qsQ=", + "lastModified": 1710452332, + "narHash": "sha256-+lKOoQ89fD6iz6Ro7Adml4Sx6SqQcTWII4t1rvVtdjs=", "owner": "nix-community", "repo": "home-manager", - "rev": "36f873dfc8e2b6b89936ff3e2b74803d50447e0a", + "rev": "096d9c04b3e9438855aa65e24129b97a998bd3d9", "type": "github" }, "original": { @@ -184,11 +184,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1710100374, - "narHash": "sha256-n/BGSmaNw/Vsvsg7MX7LJImdTJ4xWOkK6ikxe5fzM44=", + "lastModified": 1710448953, + "narHash": "sha256-5OFDzw+LOYs4yoT1IRpJNa0SpvrMzgHq3J15Q4dh50E=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "981296f101cf79176a8da7a1aa64fa297b2976dc", + "rev": "045c3fbd854090b2b60ca025fedd3e62498ed1ec", "type": "github" }, "original": { @@ -312,11 +312,11 @@ ] }, "locked": { - "lastModified": 1710040110, - "narHash": "sha256-PNAV8VdZkNoSGQHGQWDefNarl0BtKjVMCCzu16+vsr4=", + "lastModified": 1710120787, + "narHash": "sha256-tlLuB73OCOKtU2j83bQzSYFyzjJo3rjpITZE5MoofG8=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "851fcfd130597c5c91071d46275111522d4fd595", + "rev": "e76ff2df6bfd2abe06abd8e7b9f217df941c1b07", "type": "github" }, "original": { @@ -349,11 +349,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1709961763, - "narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=", + "lastModified": 1710272261, + "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34", + "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", "type": "github" }, "original": { @@ -364,11 +364,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1710021367, - "narHash": "sha256-FuMVdWqXMT38u1lcySYyv93A7B8wU0EGzUr4t4jQu8g=", + "lastModified": 1710420202, + "narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b94a96839afcc56de3551aa7472b8d9a3e77e05d", + "rev": "878ef7d9721bee9f81f8a80819f9211ad1f993da", "type": "github" }, "original": { @@ -380,11 +380,11 @@ }, "nur": { "locked": { - "lastModified": 1710102312, - "narHash": "sha256-wQAzm91MkXgB64feGY9Nla4Bty4oHUJ/nqXWPtdl8bY=", + "lastModified": 1710454985, + "narHash": "sha256-7BjB5Bco+btNQA6fsZCoT+m04np1XJQtgrgY/dD0cBM=", "owner": "nix-community", "repo": "NUR", - "rev": "0fd53e800f0db12ac4ed8fb42f6c524417b2a4eb", + "rev": "25e2f6726e0bc6bd9c08a89453713abcba3459f1", "type": "github" }, "original": { @@ -400,11 +400,11 @@ ] }, "locked": { - "lastModified": 1710417716, - "narHash": "sha256-prul6TG6uCKedEq3X4MGErzjWTRRAWsTDnCuCgQtDNY=", + "lastModified": 1710923850, + "narHash": "sha256-RcUYOBX/tv8kYzdkCJi/SrWd7kyca6HVEHEXz/dL2xk=", "ref": "refs/heads/master", - "rev": "5731af562b0c576024790f099a489e8a25fba79a", - "revCount": 118, + "rev": "31264ac7d14d323eaff627d13b2d11501c3ee8a7", + "revCount": 123, "type": "git", "url": "https://git.outfoxxed.me/outfoxxed/quickshell" }, @@ -426,11 +426,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1709989290, - "narHash": "sha256-mBAxRpR1Qfy1EbZq9vc4X1x62O/5bAIxnCxJwLpCVL0=", + "lastModified": 1710329763, + "narHash": "sha256-mxtwIkNzKWZ6ssPzisY1mzDAWW+wiMEIHy4asjClT3A=", "ref": "refs/heads/master", - "rev": "d1e2e3b61e203ec223f5955b7f1b8d6f54be350d", - "revCount": 1735, + "rev": "54aacc96197a48b79fcc260f94312d824f5e0a34", + "revCount": 1767, "type": "git", "url": "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git" }, @@ -492,11 +492,11 @@ ] }, "locked": { - "lastModified": 1710036830, - "narHash": "sha256-pnV4gO3N/7/GzyRSKTRlSfS/19KJiPSvYcL4apnSkoQ=", + "lastModified": 1710382258, + "narHash": "sha256-2FW1q+o34VBweYQiEkRaSEkNMq3ecrn83VzETeGiVbY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d09dac6a63a2ac4b74ac2ecdc19acd8c46c2da2c", + "rev": "8ce81e71ab04a7e906fae62da086d6ee5d6cfc21", "type": "github" }, "original": { diff --git a/modules/hyprland/hyprland.conf b/modules/hyprland/hyprland.conf index 72662cc..2da6323 100644 --- a/modules/hyprland/hyprland.conf +++ b/modules/hyprland/hyprland.conf @@ -1,4 +1,4 @@ -exec-once = quickshell -c background +exec-once = quickshell -c shell exec = systemctl start --user emacs.service && emacsclient -e "(setenv \"HYPRLAND_INSTANCE_SIGNATURE\" \"$HYPRLAND_INSTANCE_SIGNATURE\")" @@ -33,10 +33,7 @@ decoration { brightness = 0.8 } - drop_shadow = yes - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) + drop_shadow = no } animations { @@ -102,6 +99,9 @@ layerrule = blur, wofi layerrule = ignorezero, wofi layerrule = noanim, ^(selection)$ +layerrule = blur, termspawner +layerrule = ignorezero, termspawner + windowrulev2 = float, class:^(opensnitch_ui)$ windowrulev2 = dimaround, class:^(opensnitch_ui)$ windowrulev2 = float, class:^(org.kde.polkit-kde-authentication-agent-1)$ @@ -125,6 +125,9 @@ bind = $mod+SHIFT, return, exec, alacritty --class AlacrittyFloating bind = $mod, grave, exec, $launcher bind = $mod+SHIFT, q, hy3:killactive +bind = $mod, c, exec, echo "termselect:start" | nc -w 0 -U /run/user/1000/quickshell.sock +bindr = $mod, c, exec, echo "termselect:stop" | nc -w 0 -U /run/user/1000/quickshell.sock + bind = $mod, f, fullscreen, 1 bind = $mod+SHIFT, f, fullscreen, 0 bind = $mod+SHIFT, tab, togglefloating diff --git a/modules/user/modules/quickshell/BackgroundImage.qml b/modules/user/modules/quickshell/BackgroundImage.qml index be84277..14b9790 100644 --- a/modules/user/modules/quickshell/BackgroundImage.qml +++ b/modules/user/modules/quickshell/BackgroundImage.qml @@ -4,4 +4,5 @@ import Quickshell Image { required property ShellScreen screen; source: Qt.resolvedUrl(screen.name == "DP-1" ? "5120x1440.png" : "1920x1080.png") + asynchronous: false } diff --git a/modules/user/modules/quickshell/background/shell.qml b/modules/user/modules/quickshell/background/shell.qml deleted file mode 100644 index 56e749c..0000000 --- a/modules/user/modules/quickshell/background/shell.qml +++ /dev/null @@ -1,31 +0,0 @@ -import Quickshell -import Quickshell.Wayland -import QtQuick -import ".." - -ShellRoot { - Variants { - model: Quickshell.screens - PanelWindow { - id: window - - property var modelData - screen: modelData - - WlrLayershell.layer: WlrLayer.Background - anchors { - top: true - bottom: true - left: true - right: true - } - - color: "#111111" - - BackgroundImage { - anchors.fill: parent - screen: window.screen - } - } - } -} diff --git a/modules/user/modules/quickshell/default.nix b/modules/user/modules/quickshell/default.nix index 222b71f..9b910fa 100644 --- a/modules/user/modules/quickshell/default.nix +++ b/modules/user/modules/quickshell/default.nix @@ -2,12 +2,13 @@ inherit (inputs) quickshell; in { home.packages = with pkgs; [ + qt6.qtimageformats # amog quickshell.packages.${system}.default pamtester # lockscreen ]; xdg.configFile."quickshell/manifest.conf".text = lib.generators.toKeyValue {} { - background = impurity.link ./background; + shell = impurity.link ./shell; lockscreen = impurity.link ./lockscreen; }; } diff --git a/modules/user/modules/quickshell/shell/SelectionArea.qml b/modules/user/modules/quickshell/shell/SelectionArea.qml new file mode 100644 index 0000000..2f3a44e --- /dev/null +++ b/modules/user/modules/quickshell/shell/SelectionArea.qml @@ -0,0 +1,27 @@ +import QtQuick + +Item { + id: root + required property var screen; + required property var selectionArea; + signal selectionComplete(x: real, y: real, width: real, height: real) + + MouseArea { + anchors.fill: parent + + onPressed: { + selectionArea.startX = mouseX; + selectionArea.startY = mouseY; + selectionArea.endX = mouseX; + selectionArea.endY = mouseY; + selectionArea.selecting = true; + } + + onPositionChanged: { + selectionArea.endX = mouseX; + selectionArea.endY = mouseY; + } + + onReleased: selectionArea.endSelection(); + } +} diff --git a/modules/user/modules/quickshell/shell/SelectionLayer.qml b/modules/user/modules/quickshell/shell/SelectionLayer.qml new file mode 100644 index 0000000..541b16d --- /dev/null +++ b/modules/user/modules/quickshell/shell/SelectionLayer.qml @@ -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; + } + } +} diff --git a/modules/user/modules/quickshell/shell/ShellIpc.qml b/modules/user/modules/quickshell/shell/ShellIpc.qml new file mode 100644 index 0000000..3e796a4 --- /dev/null +++ b/modules/user/modules/quickshell/shell/ShellIpc.qml @@ -0,0 +1,31 @@ +pragma Singleton + +import Quickshell +import Quickshell.Io + +Singleton { + property bool termSelect: false; + + SocketServer { + active: true + path: "/run/user/1000/quickshell.sock" + + handler: Socket { + parser: SplitParser { + onRead: message => { + console.log(message) + switch (message) { + case "termselect:start": + termSelect = true; + break; + case "termselect:stop": + termSelect = false; + break; + default: + console.log(`socket received unknown message: ${message}`) + } + } + } + } + } +} diff --git a/modules/user/modules/quickshell/shell/shell.qml b/modules/user/modules/quickshell/shell/shell.qml new file mode 100644 index 0000000..b67461f --- /dev/null +++ b/modules/user/modules/quickshell/shell/shell.qml @@ -0,0 +1,117 @@ +import Quickshell +import Quickshell.Io +import Quickshell.Wayland +import QtQuick +import QtQuick.Layouts +import ".." + +ShellRoot { + Variants { + model: Quickshell.screens + + Scope { + property var modelData + + PanelWindow { + id: window + + screen: modelData + WlrLayershell.layer: WlrLayer.Background + + anchors { + top: true + bottom: true + left: true + right: true + } + + color: "#111111" + + BackgroundImage { + anchors.fill: parent + screen: window.screen + } + + SelectionLayer { + id: selectionLayer + + onSelectionComplete: (x, y, width, height) => { + console.log(`selection complete: ${x} ${y} ${width} ${height}`) + termSpawner.x = x + termSpawner.y = y + termSpawner.width = width + termSpawner.height = height + termSpawner.running = true + } + + Process { + id: termSpawner + property real x; + property real y; + property real width; + property real height; + + command: ["hyprctl", "dispatch", "exec", `[float;; noanim; move ${x} ${y}; size ${width} ${height}] alacritty`] + } + + Connections { + target: ShellIpc + + function onTermSelectChanged() { + + if (ShellIpc.termSelect) { + selectionLayer.selectionArea.startSelection(); + } else { + selectionLayer.selectionArea.endSelection(); + } + } + } + } + + SelectionArea { + anchors.fill: parent + screen: window.screen + selectionArea: selectionLayer.selectionArea + + } + } + + PanelWindow { + screen: modelData + WlrLayershell.layer: WlrLayer.Overlay + + anchors { + right: true + bottom: true + } + + margins { + right: 50 + bottom: 50 + } + + width: content.width + height: content.height + + color: "transparent" + mask: Region {} + + ColumnLayout { + id: content + + Text { + text: "Activate Linux" + color: "#50ffffff" + font.pointSize: 22 + } + + Text { + text: "Go to Settings to activate Linux" + color: "#50ffffff" + font.pointSize: 14 + } + } + } + } + } +}