2026-11-02 20:29:19 +03:00
import "./luciddocks"
import "./lucidedit"
2026-11-02 21:07:47 +03:00
import "./lucidosd"
2026-11-02 20:29:19 +03:00
import "./lucidprefs"
2026-11-02 23:15:26 +03:00
import "./lucidshot"
2026-11-02 20:29:19 +03:00
import "./lucidwidgets"
import QtQuick
import Quickshell
import qs
ShellRoot {
2026-11-02 23:15:26 +03:00
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 );
}
}
2026-11-02 20:29:19 +03:00
LucidBar {
id: barRoot
dock: dockRoot
2026-11-02 21:07:47 +03:00
toastMod: toastMod
2026-11-02 20:29:19 +03:00
}
Dock {
id: dockRoot
}
2026-11-02 21:07:47 +03:00
Toast {
id: toastMod
}
2026-11-03 19:04:08 +03:00
Osd {
}
2026-11-02 21:07:47 +03:00
ToastEvents {
toast: toastMod
}
Binding {
target: toastMod
property: "screen"
value: Monitors . shellPlacement
when: Monitors . shellPlacement !== null
}
2026-11-02 20:29:19 +03:00
WidgetLayer {
}
WidgetIpc {
}
EditLayer {
}
SettingsHost {
}
Binding {
target: Monitors
property: "barWindows"
value: barRoot . instances
}
}