#!/usr/bin/env bash # @vicinae.schemaVersion 1 # @vicinae.title Search the web # @vicinae.mode silent # @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg # @vicinae.description Search from the launcher, with bang syntax, in the default browser. # @vicinae.keywords ["search", "web", "google", "bang", "find"] # @vicinae.argument1 { "type": "text", "placeholder": "search, or !bang to jump", "percentEncoded": true } # Search without leaving the launcher. # # Make this the fallback command -- "Manage fallback commands" in Vicinae -- and # anything typed that matches nothing else offers this at the bottom of the # results. That designation is per-machine state Vicinae keeps in its own # database, so it is one click rather than something Panama ships. # # The engine is a client-side bang redirector: it resolves DuckDuckGo-style # bangs in the browser rather than round-tripping through a search engine to be # redirected, and falls through to a normal search when there is no bang. So # `!yt tiling` reaches YouTube directly, and bang support costs nothing here -- # it is a property of where this points, not of the launcher. # # percentEncoded on the argument means Vicinae URL-encodes the query before it # arrives, which is what keeps `&`, `#` and spaces from truncating the search. # # xdg-open rather than a named browser: the default browser is already a setting # this desktop owns, on the Applications page, and naming one here would quietly # outrank it. The engine is the webSearchUrl preference (Applications page); # the shipped default asks DuckDuckGo, not somebody's personal redirector. search_url="$(jq -r '.webSearchUrl // empty' "${XDG_CONFIG_HOME:-$HOME/.config}/panama/settings.json" 2>/dev/null)" [ -n "$search_url" ] || search_url="https://duckduckgo.com/?q=" exec xdg-open "${search_url}$1"