dmenu-edit-configs.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. # ____ _____
  4. # | _ \_ _| Derek Taylor (DistroTube)
  5. # | | | || | http://www.youtube.com/c/DistroTube
  6. # | |_| || | http://www.gitlab.com/dwt1/
  7. # |____/ |_|
  8. #
  9. # Dmenu script for editing some of my more frequently edited config files.
  10. declare -a options=("alacritty"
  11. "awesome"
  12. "bash"
  13. "broot"
  14. "bspwm"
  15. "doom.d/config.el"
  16. "doom.d/init.el"
  17. "dunst"
  18. "dwm"
  19. "emacs.d/init.el"
  20. "herbstluftwm"
  21. "i3"
  22. "neovim"
  23. "picom"
  24. "polybar"
  25. "qtile"
  26. "quickmarks"
  27. "qutebrowser"
  28. "spectrwm"
  29. "st"
  30. "stumpwm"
  31. "surf"
  32. "sxhkd"
  33. "tabbed"
  34. "termite"
  35. "vifm"
  36. "vim"
  37. "vimb"
  38. "xmobar"
  39. "xmonad"
  40. "xresources"
  41. "zsh"
  42. "quit"
  43. )
  44. # The combination of echo and printf is done to add line breaks to the end of each
  45. # item in the array before it is piped into dmenu. Otherwise, all the items are listed
  46. # as one long line (one item).
  47. choice=$(echo "$(printf '%s\n' "${options[@]}")" | dmenu -p 'Edit config file: ')
  48. case "$choice" in
  49. quit)
  50. echo "Program terminated." && exit 1
  51. ;;
  52. alacritty)
  53. choice="$HOME/.config/alacritty/alacritty.yml"
  54. ;;
  55. awesome)
  56. choice="$HOME/.config/awesome/rc.lua"
  57. ;;
  58. bash)
  59. choice="$HOME/.bashrc"
  60. ;;
  61. broot)
  62. choice="$HOME/.config/broot/conf.toml"
  63. ;;
  64. bspwm)
  65. choice="$HOME/.config/bspwm/bspwmrc"
  66. ;;
  67. doom.d/config.el)
  68. choice="$HOME/.doom.d/config.el"
  69. ;;
  70. doom.d/init.el)
  71. choice="$HOME/.doom.d/init.el"
  72. ;;
  73. dunst)
  74. choice="$HOME/.config/dunst/dunstrc"
  75. ;;
  76. dwm)
  77. choice="$HOME/dwm-distrotube/config.h"
  78. ;;
  79. emacs.d/init.el)
  80. choice="$HOME/.emacs.d/init.el"
  81. ;;
  82. herbstluftwm)
  83. choice="$HOME/.config/herbstluftwm/autostart"
  84. ;;
  85. i3)
  86. choice="$HOME/.config/i3/config"
  87. ;;
  88. neovim)
  89. choice="$HOME/.config/nvim/init.vim"
  90. ;;
  91. picom)
  92. choice="$HOME/.config/picom/picom.conf"
  93. ;;
  94. polybar)
  95. choice="$HOME/.config/polybar/config"
  96. ;;
  97. qtile)
  98. choice="$HOME/.config/qtile/config.py"
  99. ;;
  100. quickmarks)
  101. choice="$HOME/.config/qutebrowser/quickmarks"
  102. ;;
  103. qutebrowser)
  104. choice="$HOME/.config/qutebrowser/autoconfig.yml"
  105. ;;
  106. spectrwm)
  107. choice="$HOME/.spectrwm.conf"
  108. ;;
  109. st)
  110. choice="$HOME/st-distrotube/config.h"
  111. ;;
  112. stumpwm)
  113. choice="$HOME/.config/stumpwm/config"
  114. ;;
  115. surf)
  116. choice="$HOME/surf-distrotube/config.h"
  117. ;;
  118. sxhkd)
  119. choice="$HOME/.config/sxhkd/sxhkdrc"
  120. ;;
  121. tabbed)
  122. choice="$HOME/tabbed-distrotube/config.h"
  123. ;;
  124. termite)
  125. choice="$HOME/.config/termite/config"
  126. ;;
  127. vifm)
  128. choice="$HOME/.config/vifm/vifmrc"
  129. ;;
  130. vim)
  131. choice="$HOME/.vimrc"
  132. ;;
  133. vimb)
  134. choice="$HOME/.config/vimb/config"
  135. ;;
  136. xmobar)
  137. choice="$HOME/.config/xmobar/xmobarrc2"
  138. ;;
  139. xmonad)
  140. choice="$HOME/.xmonad/xmonad.hs"
  141. ;;
  142. xresources)
  143. choice="$HOME/.Xresources"
  144. ;;
  145. zsh)
  146. choice="$HOME/.zshrc"
  147. ;;
  148. *)
  149. exit 1
  150. ;;
  151. esac
  152. # Ultimately, what do want to do with our choice? Open in our editor!
  153. nvim-qt "$choice"
  154. # alacritty -e nvim "$choice"
  155. # emacsclient -c -a emacs "$choice"