dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

rundmc (3297B)


      1 #!/usr/bin/zsh
      2 
      3 #DM_CMD=$(dmenu -m 0 -fn trigon:pixelsize=15 -i -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -l 10)
      4 
      5 dm_bin() {
      6 	bin_arr=()
      7 	while IFS= read -r line; do
      8 		bin_arr+=( "$line" )
      9 	done < <( find $HOME/bin )
     10 
     11 	choice=$(printf '%s\n' "${bin_arr[@]}" | awk -F/ '{print $NF}' | dmenu -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'bin: ')
     12 	
     13 	if [ "$choice" ] ; then
     14 		#cmd="printf '%s\n' "${bin_arr[@]}" | grep $HOME/bin/$choice | head -n1" 
     15 		cmd="$HOME/bin/${choice} $@"
     16 		urxvt -geometry 1x1+3000+1920 -e zsh -c "$cmd"
     17 	fi
     18 }
     19 
     20 dm_func() {
     21 	func_arr=()
     22 	while IFS= read -r line; do
     23 		func_arr+=( "$line" )
     24 	done < <( find $HOME/.zsh/functions )
     25 
     26 	choice=$(printf '%s\n' "${func_arr[@]}" | awk -F/ '{print $NF}' | dmenu -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'functions: ')
     27 	
     28 	if [ "$choice" ] ; then
     29 		#cmd="printf '%s\n' "${func_arr[@]}" | grep $HOME/bin/$choice | head -n1" 
     30 		cmd="$HOME/.zsh/functions/${choice} $@"
     31 		urxvt -geometry 1x1+3000+1920 -e zsh -c "$cmd"
     32 	fi
     33 }
     34 
     35 dm_aliases() {
     36 	source $HOME/.zsh/aliases.zsh
     37 	alias_arr=()
     38 	while IFS= read -r line; do
     39 		alias_arr+=( "$line" )
     40 	done < <( alias )
     41 
     42 	choice=$(printf '%s\n' "${alias_arr[@]}" | awk -F= '{print $1}' | dmenu -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'submenu: ')
     43 	
     44 	if [ "$choice" ] ; then
     45 		cmd=$(printf '%s\n' "${alias_arr[@]}" | grep ^$choice | head -n1 | sed 's/=/%/' | awk -F% '{ print $NF }' | tr -d "'")
     46 		urxvt -e zsh -c "$cmd"
     47 		#echo $cmd
     48 	fi
     49 }
     50 
     51 dm_hidden() {
     52 	hide_arr=()
     53 	while IFS= read -r line; do
     54 		hide_arr+=( "$line" )
     55 	done < <(hidden -c)
     56 
     57 	choice=$(printf '%s\n' "${hide_arr[@]}" | awk -F: '{print $1}' | tr -d "'" | dmenu -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'submenu: ')
     58 	
     59 	if [ "$choice" ] ; then
     60 		cmd=$(printf '%s\n' "${hide_arr[@]}" | grep "^'$choice'" | awk -F: '{ print $NF }' | tr -d "'")
     61 		urxvt -e zsh -c "$cmd"
     62 		#echo $cmd
     63 	fi
     64 }
     65 
     66 dm_man() {
     67 	man_arr=()
     68 	while IFS= read -r line; do
     69 		man_arr+=( "$line" )
     70 	done < <(man -k .)
     71 
     72 	choice=$(printf '%s\n' "${man_arr[@]}" | dmenu -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'manpage: ')
     73 	
     74 	if [ "$choice" ] ; then
     75 		cmd=$(printf '%s\n' "${man_arr[@]}" | grep ^$choice | awk '{print $1}')
     76 		urxvt -e zsh -c "source $HOME/.zsh/colored-man-pages.zsh ; man ${cmd}"
     77 	fi
     78 }
     79 
     80 dm_pom() {
     81 	sleep 1500
     82 	/usr/bin/notify-send -u 'low' "time's up"
     83 }
     84 
     85 select_arr=("run" "bin" "functions" "aliases" "hidden" "man" "pom" "scratch" "clipmenu")
     86 submenu=$(printf '%s\n' "${select_arr[@]}" | dmenu -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'submenu: ')
     87 
     88 case $submenu in
     89 	run) dmenu_run -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'rundmc: ' ;;
     90 	bin) dm_bin ;;
     91 	functions) dm_func ;;
     92 	aliases) dm_aliases ;;
     93 	hidden) dm_hidden ;;
     94 	man) dm_man ;;
     95 	pom) dm_pom ;;
     96 	scratch) urxvtc -e zsh -c "less $HOME/.vimrc" ;;
     97 	clipmenu) clipmenu -i -l 10 -m 0 -fn trigon:pixelsize=15 -nb '#1f1d1b' -nf '#d3cab3' -sb '#454545' -sf '#dab733' -p 'clipmenu: ' ;;
     98 	*) exit ;;
     99 esac