mirror of
https://github.com/gotbletu/shownotes
synced 2024-11-10 19:10:36 +00:00
2.5 KiB
2.5 KiB
W3M Custom External Commands
w3m web browser can call external commands using the "extbrowser" options in the config file. Now we can use our own custom commands or scripts to execute commands on different links. Such as playing videos with mpv, download files, ripping audio, copying to clipboard, adding torrent.
install requirements
w3m mpv youtube-dl aria2 task-spooler xclip libnotify transmission-cli
configuration
vim ~/.w3m/config
extbrowser $BROWSER
extbrowser2 bash -c 'echo -n "$0" | xclip -selection clipboard && notify-send -t 5000 -i edit-copy "W3M URL Yank To Clipboard" "$0"'
extbrowser3 bash -c 'tsp mpv --ontop --no-border --force-window --autofit=500x280 --geometry=-15-50 "$0" && notify-send -t 5000 -i video-x-generic "MPV Queue" "$0"'
extbrowser4 bash -c 'TS_SOCKET=/tmp/w3m tsp youtube-dl -c --restrict-filenames -x --audio-format mp3 -o "~/Downloads/%(title)s.%(ext)s" "$0" && notify-send -t 5000 -i audio-x-generic "Youtube-DL: Ripping Audio" "$0"'
extbrowser5 bash -c 'transmission-remote -a "$0" && notify-send -t 5000 -i emblem-downloads "Adding Torrent" "$0"'
extbrowser6 bash -c 'TS_SOCKET=/tmp/w3m tsp aria2c -j 1 -c -d ~/Downloads "$0" && notify-send -t 5000 -i package-x-generic "Aria2c: Downloading" "$0"'
extbrowser7
extbrowser8
extbrowser9
keymap
vim ~/.w3m/keymap
######################
# My Custom Keybinding
######################
# open current url (default: Shift+M)
# e.g 2+Shift+M
keymap e EXTERN
# open url under cursor (default: Esc+Shift+M)
# e.g 2+Esc+Shift+M
keymap f EXTERN_LINK
references
contact
_ _ _ _
__ _ ___ | |_| |__ | | ___| |_ _ _
/ _` |/ _ \| __| '_ \| |/ _ \ __| | | |
| (_| | (_) | |_| |_) | | __/ |_| |_| |
\__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|___/