#!/bin/ksh # Firstly add a keybind in tmux # to split a window and run tmenu. # After tmenu exits, the pane is # killed automatically. # : bind F4 split -l 5 ~/bin/tmenu # The rest of this code is ~/bin/tmenu # Following is an interactive example # of several inputs and searching the # web. browser=links inp() { key=$( os=$(stty -g);stty raw -echo; dd if=/dev/tty bs=1 count=1 2>/dev/null; stty $os) } print "u)rl s)earch-ddg w)iki" inp clear case $key in u*) read url?"url: " tmux new-window "$browser $url" ;; s*) read search?"search: " search=$(print $search | sed 's/ /+/g') tmux new-window "$browser https://ddg.gg/lite/?q=$search" ;; w*) read wiki?"wiki: " wiki=$(print $wiki | sed 's/ /+/g') tmux new-window \ links "https://en.wikipedia.org/wiki\ /Special:Search?go=Go&search=\ $wiki&ns0=1#bodyContent" ;; esac return 0