Can you make this shell script minimal and to have few SLOC lines of code with utmost…
- User
Can you make this shell script minimal and to have few SLOC lines of code with utmost minimal design possible?
#!/usr/bin/env sh
source d-var.conf
Get link from user input or dmenu
feed="{1:-(printf "%s" | D_MENU -i -p 'Paste URL or file path')}" echo "feed" | wl-copy -n
aria_tor () { curl http://localhost:6800/jsonrpc -d '{"jsonrcp":"2.0","id":"someID","method":"aria2.addUri","params":["token:ariatest",["'${feed}'"]]}' }
Define programs to choose from
programs=( "echo '{feed}'" "setsid -f firefox '{feed}' >/dev/null 2>&1" "d-bookmark '{feed}'" "setsid librewolf '{feed}'" "aria_tor" )
- Assistant
There are many alternatives to rofi, such as dmenu, fzf, bemenu, wofi, and many more. You can easily replace rofi with any of these alternatives by modifying the script to use the desired program. For example, if you want to use dmenu instead of rofi, you can replace this line:
selected_program="{program_names[@]}" | rofi -dmenu -i)"
with this line:
selected_program="{program_names[@]}" | dmenu -i)"