From 2608e1b5475f3619ff7873e5194cd2b597e7e8e6 Mon Sep 17 00:00:00 2001 From: Sweetbread Date: Mon, 2 Nov 2026 23:15:26 +0300 Subject: [PATCH] fixup! fixup! fixup! fixup! Install lucid --- modules/user/hyprland.nix | 6 ++ modules/user/lucid-shell.qml | 85 ++++++++++++++++++++++++++++ user/sweetbread/modules/hyprland.nix | 3 - user/sweetbread/modules/lucid.nix | 5 +- 4 files changed, 94 insertions(+), 5 deletions(-) diff --git a/modules/user/hyprland.nix b/modules/user/hyprland.nix index 7358103..5712afd 100644 --- a/modules/user/hyprland.nix +++ b/modules/user/hyprland.nix @@ -32,6 +32,7 @@ in { ghostty pamixer clipse + cliphist wl-clipboard wl-clip-persist xclip @@ -152,6 +153,11 @@ in { bind = [ (bind "SUPER + V" (exec "ghostty --title=clipse -e clipse")) + (bind "SUPER + SHIFT + V" (exec "qs ipc call launcher clipboard")) + (bind "Print" (exec "qs ipc call snap toggle")) + (bind "SUPER + Print" (exec "qs ipc call screenshot full")) + (bind "CTRL + Print" (exec "qs ipc call snap region")) + (bind "ALT + Print" (exec "qs ipc call snap window")) (bind "SUPER + RETURN" (exec "ghostty")) (bind "SUPER + Q" "hl.dsp.window.close()") (bind "SUPER + M" "hl.dsp.exit()") diff --git a/modules/user/lucid-shell.qml b/modules/user/lucid-shell.qml index 57f4170..b3508c5 100644 --- a/modules/user/lucid-shell.qml +++ b/modules/user/lucid-shell.qml @@ -2,12 +2,97 @@ import "./luciddocks" import "./lucidedit" import "./lucidosd" import "./lucidprefs" +import "./lucidshot" import "./lucidwidgets" import QtQuick import Quickshell import qs ShellRoot { + id: root + + Component.onCompleted: { + void Clip.probed; + void Capture.state; + } + + function announceShot(entry) { + if (Prefs.shotPreview === "preview") { + shotCards.show(entry); + return; + } + if (Prefs.shotPreview !== "notify") + return; + const where = String(entry.file).replace(Quickshell.env("HOME"), "~"); + if (entry.kind === "video") + Quickshell.execDetached(["notify-send", "-a", "LucidShot", "-i", "media-record", "Recording saved", where]); + else + Quickshell.execDetached(["sh", "-c", "a=$(notify-send -a LucidShot -i \"$1\" -A 'edit=Mark up' -A 'open=Open' --wait \"$2\" \"$3\"); case \"$a\" in edit) qs ipc call snap edit \"$1\" ;; open) xdg-open \"$1\" ;; esac; true", "sh", entry.file, entry.temp ? "Screenshot copied" : "Screenshot saved", entry.temp ? "It is on the clipboard only" : where]); + } + + ShotEngine { + id: shotEngine + cards: shotCards + onReady: (entry) => { + if (entry.owner === "overlay") { + shotCards.update(entry); + return; + } + if (entry.owner === "pin") + return; + root.announceShot(entry); + } + onFailed: (id, why) => toastMod.popup("warning", why, true) + onTextRead: (r) => { + if (!shotEngine.claim(r.id)) + return; + if (r.status === "ok") { + if (Prefs.shotPreview === "preview") + shotCards.show({ "id": r.id, "kind": "text", "text": r.text, "codes": r.codes, "screen": Monitors.focusedScreen ? Monitors.focusedScreen.name : "" }); + else + toastMod.popup("copy", "Text copied", false); + } else if (r.status === "notool") { + toastMod.popup("alert", "Install tesseract to copy text", true); + } else { + toastMod.popup("alert", "No text found", true); + } + } + } + + ShotOverlay { + id: shotOverlay + engine: shotEngine + cards: shotCards + pins: shotPins + onNotify: (icon, text, warn) => toastMod.popup(icon, text, warn) + onSwatch: (hex, text) => toastMod.popupSwatch(hex, text) + onFreezeFailed: (why) => toastMod.popup("alert", "Couldn't capture the screen", true) + } + + ShotCards { + id: shotCards + engine: shotEngine + pins: shotPins + overlay: shotOverlay + } + + PinBoard { + id: shotPins + engine: shotEngine + } + + RecordHud {} + + Connections { + target: Capture + function onSaved(file, seconds) { + root.announceShot({ "id": "rec-" + Date.now(), "kind": "video", "file": file, "duration": seconds, "screen": Capture.output }); + } + function onFailed(why) { + toastMod.popup("warning", why, true); + } + } + LucidBar { id: barRoot dock: dockRoot diff --git a/user/sweetbread/modules/hyprland.nix b/user/sweetbread/modules/hyprland.nix index e117603..b4bcb88 100644 --- a/user/sweetbread/modules/hyprland.nix +++ b/user/sweetbread/modules/hyprland.nix @@ -199,9 +199,6 @@ ]; bind = [ - (hyprLua.bind "Print" (hyprLua.exec "${lib.getExe pkgs.hyprshot} -z -o ~/Screenshots -m active -m output")) - (hyprLua.bind "CTRL + Print" (hyprLua.exec "${lib.getExe pkgs.hyprshot} -z -o ~/Screenshots -m region")) - (hyprLua.bind "ALT + Print" (hyprLua.exec "${lib.getExe pkgs.hyprshot} -z -o ~/Screenshots -m active -m window")) (hyprLua.bind "SUPER + W" (hyprLua.exec "qs ipc call launcher wallpaper")) (hyprLua.bind "SUPER + SHIFT + W" (hyprLua.exec "${lib.getExe wallpaper_changer}")) ]; diff --git a/user/sweetbread/modules/lucid.nix b/user/sweetbread/modules/lucid.nix index 6af02fa..a700d85 100644 --- a/user/sweetbread/modules/lucid.nix +++ b/user/sweetbread/modules/lucid.nix @@ -90,10 +90,11 @@ PY exec "$HOME/.config/lucid/apply-theme-upstream.sh" --shell-only "$@" ''; qmlPackages = with pkgs.qt6; [ qt5compat qtmultimedia ]; + tesseract = pkgs.tesseract4.override { enableLanguages = [ "eng" "rus" ]; }; lucid = pkgs.writeShellScript "lucid" '' export NIXPKGS_QT6_QML_IMPORT_PATH="${lib.makeSearchPath "lib/qt-6/qml" qmlPackages}:''${NIXPKGS_QT6_QML_IMPORT_PATH:-}" export QT_PLUGIN_PATH="${lib.makeSearchPath "lib/qt-6/plugins" qmlPackages}:''${QT_PLUGIN_PATH:-}" - export PATH="${lib.makeBinPath (with pkgs; [ bash coreutils curl jq pulseaudio python3 xdg-utils ])}:$PATH" + export PATH="${lib.makeBinPath (with pkgs; [ bash cliphist coreutils curl ffmpeg grim imagemagick jq libnotify pulseaudio python3 wf-recorder wl-clipboard xdg-utils ])}:${tesseract}/bin:$PATH" exec ${pkgs.quickshell}/bin/qs --no-duplicate --path "${config.home.homeDirectory}/.config/quickshell" ''; startWallpaper = pkgs.writeShellScript "lucid-wallpaper-start" '' @@ -116,7 +117,7 @@ PY in { programs.waybar.enable = lib.mkForce false; services.mako.enable = lib.mkForce false; - home.packages = with pkgs; [ ffmpeg imagemagick ]; + home.packages = with pkgs; [ cliphist ffmpeg grim imagemagick libnotify wf-recorder tesseract ]; home.activation.installLucid = lib.hm.dag.entryAfter [ "writeBoundary" ] '' target="${config.home.homeDirectory}/.config/quickshell"