grimm-nixos-laptop/custom/searchclip/package.nix
2024-05-11 22:55:59 +02:00

17 lines
371 B
Nix

{
writeShellScriptBin,
lib,
urlencode,
}:
let
inherit (lib) getExe;
in
writeShellScriptBin "searchclip" ''
xdg-open https://www.google.com/search?q=$(wl-paste -p | ${getExe urlencode})
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
if [[ -v SWAYSOCK ]]; then
sleep .1
swaymsg [app_id="$browser" urgent="newest"] focus
fi
''