Add a script to search with duckduckgo

This commit is contained in:
Andreas Zweili 2023-11-26 15:01:55 +01:00
parent 41fb0875af
commit 8f94201019
2 changed files with 16 additions and 0 deletions

View File

@ -60,6 +60,7 @@ keys = [
Key([mod], "e", lazy.spawn("nautilus")),
Key([mod], "p", lazy.spawn("xrandr --auto")),
Key([mod], "r", lazy.spawn("rofi -matching-negate-char \\0 -show run")),
Key([mod], "s", lazy.spawn("rofi-search")),
Key([mod], "w", lazy.spawn("firefox")),
Key([mod], "Tab", lazy.spawn("rofi -show window")),
# Toggle between different layouts as defined below

View File

@ -1,6 +1,20 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.az-qtile;
rofi-search = pkgs.writeShellScriptBin "rofi-search" ''
# Use rofi to get user input
raw_user_input=$(echo "" | ${pkgs.rofi}/bin/rofi -dmenu -p "What do you want to search:")
user_input=$(${pkgs.jq}/bin/jq --raw-output --null-input --arg x "$raw_user_input" '$x|@uri')
# Check if user provided input
if [ -n "$user_input" ]; then
# Execute your command with the user input as an argument
# Replace 'your_command' with the actual command you want to run
$DEFAULT_BROWSER "https://duckduckgo.com/?q=$user_input"
else
echo "No input provided."
fi
'';
in
{
options = {
@ -19,6 +33,7 @@ in
home.file.".config/qtile/autostart.sh".source = ./autostart.sh;
home.packages = [
pkgs.pulseaudio # required for volume controls in qtile
rofi-search
];
};
};