From 075a21a9db24969830fd6e0ff7b3c6d7a3495ebc Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 20 Oct 2025 22:00:08 +0200 Subject: [PATCH] make google lens tool use normal region selection by default --- dots/.config/hypr/hyprland/keybinds.conf | 2 +- .../quickshell/ii/modules/common/Config.qml | 7 +++++-- .../ii/modules/regionSelector/RegionSelection.qml | 8 ++++---- .../ii/modules/regionSelector/RegionSelector.qml | 6 +++++- .../ii/modules/settings/ServicesConfig.qml | 14 ++++++++++++++ 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/dots/.config/hypr/hyprland/keybinds.conf b/dots/.config/hypr/hyprland/keybinds.conf index 74343d85b..469555874 100644 --- a/dots/.config/hypr/hyprland/keybinds.conf +++ b/dots/.config/hypr/hyprland/keybinds.conf @@ -60,7 +60,7 @@ bindd = Super, V, Copy clipboard history entry, exec, qs -c $qsConfig ipc call T bindd = Super, Period, Copy an emoji, exec, qs -c $qsConfig ipc call TEST_ALIVE || pkill fuzzel || ~/.config/hypr/hyprland/scripts/fuzzel-emoji.sh copy # [hidden] Emoji >> clipboard (fallback) bind = Super+Shift, S, global, quickshell:regionScreenshot # Screen snip bind = Super+Shift, S, exec, qs -c $qsConfig ipc call TEST_ALIVE || pidof slurp || hyprshot --freeze --clipboard-only --mode region --silent # [hidden] Screen snip (fallback) -bind = Super+Shift, A, global, quickshell:regionSearch # Circle to Search +bind = Super+Shift, A, global, quickshell:regionSearch # Google Lens # OCR bindd = Super+Shift, T, Character recognition,exec,grim -g "$(slurp $SLURP_ARGS)" "tmp.png" && tesseract "tmp.png" - | wl-copy && rm "tmp.png" # [hidden] # Color picker diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index f93171584..8f18bd0f6 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -355,8 +355,6 @@ Singleton { property JsonObject search: JsonObject { property int nonAppResultDelay: 30 // This prevents lagging when typing property string engineBaseUrl: "https://www.google.com/search?q=" - property string imageSearchEngineBaseUrl: "https://lens.google.com/uploadbyurl?url=" - property string fileUploadApiEndpoint: "https://uguu.se/upload" property list excludedSites: ["quora.com", "facebook.com"] property bool sloppy: false // Uses levenshtein distance based scoring instead of fuzzy sort. Very weird. property JsonObject prefix: JsonObject { @@ -369,6 +367,11 @@ Singleton { property string shellCommand: "$" property string webSearch: "?" } + property JsonObject imageSearch: JsonObject { + property string imageSearchEngineBaseUrl: "https://lens.google.com/uploadbyurl?url=" + property string fileUploadApiEndpoint: "https://uguu.se/upload" + property bool useCircleSelection: false + } } property JsonObject sidebar: JsonObject { diff --git a/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml b/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml index 7f83c4e33..b22ce4a58 100644 --- a/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml +++ b/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml @@ -36,8 +36,8 @@ PanelWindow { signal dismiss() property string screenshotDir: Directories.screenshotTemp - property string imageSearchEngineBaseUrl: Config.options.search.imageSearchEngineBaseUrl - property string fileUploadApiEndpoint: Config.options.search.fileUploadApiEndpoint + property string imageSearchEngineBaseUrl: Config.options.search.imageSearch.imageSearchEngineBaseUrl + property string fileUploadApiEndpoint: Config.options.search.imageSearch.fileUploadApiEndpoint property color overlayColor: "#77111111" property color genericContentColor: Qt.alpha(root.overlayColor, 0.9) property color genericContentForeground: "#ddffffff" @@ -424,13 +424,13 @@ PanelWindow { iconSize: Appearance.font.pixelSize.larger text: switch(root.selectionMode) { case RegionSelection.SelectionMode.RectCorners: - return "crop_free" + return "activity_zone" break; case RegionSelection.SelectionMode.Circle: return "gesture" break; default: - return "crop_free" + return "activity_zone" } color: root.genericContentForeground } diff --git a/dots/.config/quickshell/ii/modules/regionSelector/RegionSelector.qml b/dots/.config/quickshell/ii/modules/regionSelector/RegionSelector.qml index 336c9fd6b..7cfd37349 100644 --- a/dots/.config/quickshell/ii/modules/regionSelector/RegionSelector.qml +++ b/dots/.config/quickshell/ii/modules/regionSelector/RegionSelector.qml @@ -48,7 +48,11 @@ Scope { function search() { root.action = RegionSelection.SnipAction.Search - root.selectionMode = RegionSelection.SelectionMode.Circle + if (Config.options.search.imageSearch.useCircleSelection) { + root.selectionMode = RegionSelection.SelectionMode.Circle + } else { + root.selectionMode = RegionSelection.SelectionMode.RectCorners + } GlobalStates.regionSelectorOpen = true } diff --git a/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml b/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml index fae5bf4de..8b6c1ff2a 100644 --- a/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml +++ b/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml @@ -147,5 +147,19 @@ ContentPage { } } } + ContentSubsection { + title: Translation.tr("Google Lens") + + ConfigSelectionArray { + currentValue: Config.options.search.imageSearch.useCircleSelection ? "circle" : "rectangles" + onSelected: newValue => { + Config.options.search.imageSearch.useCircleSelection = (newValue === "circle"); + } + options: [ + { icon: "activity_zone", value: "rectangles", displayName: Translation.tr("Rectangular selection") }, + { icon: "gesture", value: "circle", displayName: Translation.tr("Circle to Search") } + ] + } + } } }