mirror of
https://github.com/thesleepingsage/hypr-lens.git
synced 2026-11-01 06:56:42 +01:00
Replace the manual monitorOrder config array (a debugging artifact from a temporarily rearranged setup) with automatic sorting by Hyprland layout position (ascending x, ties by y). The list is rebuilt on every overlay open, screen hotplug, and shortcut re-trigger, with refreshMonitors() and an unpopulated-monitor (lastIpcObject) fallback to ShellScreen position. Removes the regex JSONC parse path and the monitorOrder key from the config schema and defaults.
115 lines
5.5 KiB
QML
115 lines
5.5 KiB
QML
pragma Singleton
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
// Minimal Config for hypr-lens
|
|
Singleton {
|
|
id: root
|
|
property string filePath: Directories.shellConfigPath
|
|
property alias options: configOptions
|
|
property bool ready: false
|
|
|
|
Timer {
|
|
id: fileReloadTimer
|
|
interval: 50
|
|
repeat: false
|
|
onTriggered: configFileView.reload()
|
|
}
|
|
|
|
Timer {
|
|
id: fileWriteTimer
|
|
interval: 50
|
|
repeat: false
|
|
onTriggered: configFileView.writeAdapter()
|
|
}
|
|
|
|
FileView {
|
|
id: configFileView
|
|
path: root.filePath
|
|
watchChanges: true
|
|
onFileChanged: fileReloadTimer.restart()
|
|
onAdapterUpdated: fileWriteTimer.restart()
|
|
onLoaded: root.ready = true
|
|
onLoadFailed: error => {
|
|
if (error == FileViewError.FileNotFound) {
|
|
writeAdapter();
|
|
}
|
|
}
|
|
|
|
// Config schema - see CONFIG_README.md for full documentation
|
|
JsonAdapter {
|
|
id: configOptions
|
|
|
|
// ─── Appearance ───────────────────────────────────────────────
|
|
property JsonObject appearance: JsonObject {
|
|
property string matugenPath: "" // Custom matugen.json path (empty = default)
|
|
|
|
// Ripple: button click effect
|
|
property JsonObject ripple: JsonObject {
|
|
property bool usePrimaryColor: true // true = accent color, false = gray
|
|
property real colorMixRatio: 0.65 // 0.0 = bold, 1.0 = invisible
|
|
property real solidRadius: 0.45 // Solid color extent (0.0-1.0)
|
|
property real fadeRadius: 0.7 // Fade endpoint (0.0-1.0)
|
|
}
|
|
}
|
|
|
|
// ─── Screenshots ──────────────────────────────────────────────
|
|
property JsonObject screenSnip: JsonObject {
|
|
property string savePath: "" // Save location (empty = ~/Pictures/hypr-lens)
|
|
property bool copyAlsoSaves: false // true = Copy mode also saves to disk, false = clipboard only
|
|
}
|
|
|
|
// ─── Screen Recording ─────────────────────────────────────────
|
|
property JsonObject screenRecord: JsonObject {
|
|
property string savePath: "" // Save location (empty = ~/Videos/hypr-lens)
|
|
}
|
|
|
|
// ─── OCR ──────────────────────────────────────────────────────
|
|
property JsonObject ocr: JsonObject {
|
|
property bool useCircleSelection: false // true = circle tool, false = rectangle
|
|
}
|
|
|
|
// ─── Image Search ─────────────────────────────────────────────
|
|
property JsonObject search: JsonObject {
|
|
property JsonObject imageSearch: JsonObject {
|
|
property bool useCircleSelection: false // true = circle tool, false = rectangle
|
|
}
|
|
}
|
|
|
|
// ─── Region Selector ──────────────────────────────────────────
|
|
property JsonObject regionSelector: JsonObject {
|
|
property int dragThreshold: 6 // Click/drag dead-zone in px (0 = disabled)
|
|
// Auto-detection of clickable regions
|
|
property JsonObject targetRegions: JsonObject {
|
|
property bool windows: true // Detect window boundaries
|
|
property bool layers: false // Detect Hyprland layers
|
|
property bool content: true // OpenCV content detection
|
|
property bool showLabel: false // Show region labels
|
|
property real opacity: 0.3 // Highlight opacity (0.0-1.0)
|
|
property real contentRegionOpacity: 0.8
|
|
property int selectionPadding: 5 // Extra pixels around regions
|
|
}
|
|
// Rectangle selection tool
|
|
property JsonObject rect: JsonObject {
|
|
property bool showAimLines: true // Crosshair when drawing
|
|
}
|
|
// Circle selection tool
|
|
property JsonObject circle: JsonObject {
|
|
property int strokeWidth: 6 // Outline thickness
|
|
property int padding: 10 // Extra space around selection
|
|
}
|
|
// Annotation tool for the "edit" action
|
|
property JsonObject annotation: JsonObject {
|
|
property bool useSatty: true // true = satty (preferred), false = swappy. Falls back to swappy if satty isn't installed.
|
|
}
|
|
// Crop mode adjustable editor (toggled with the C key)
|
|
property JsonObject crop: JsonObject {
|
|
property int minSize: 20 // Minimum crop width/height in px
|
|
property int handleSize: 12 // Visual size of resize handles in px
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|