My scripts for startup, dmenu, and the command line
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

126 líneas
2.6 KiB

  1. #!/bin/sh
  2. launch() {
  3. app=$(printf "Notes
  4. Files
  5. Editor
  6. Terminal
  7. Multiplexer
  8. LBRY
  9. Chat
  10. Music
  11. Browser
  12. Email
  13. Processes" | tr '\t' |
  14. dmenu -i -p "Launcher")
  15. case $app in
  16. Notes) st -e vim "+cd ~/Notes/text" "+CtrlP";;
  17. Files) st -e nnn;;
  18. Editor) st -e vim;;
  19. Terminal) st;;
  20. Multiplexer) st -e tmux $*;;
  21. LBRY) lbry;;
  22. Chat) element-desktop;;
  23. Music) st -e ncmpcpp;;
  24. Browser) brave-browser;;
  25. Email) brave-browser mail.protonmail.com/login;;
  26. Processes) st -e htop;;
  27. esac
  28. }
  29. action() {
  30. action=$(printf "Play Music
  31. Pause Music
  32. Toggle Music
  33. Command
  34. Command to clipboard
  35. Select VPN
  36. Disable VPN
  37. Enable VPN
  38. VPN Status
  39. Rebind Keys
  40. Disable Bar
  41. Enable Bar" | tr -d '\t' |
  42. dmenu -i -p "Actions")
  43. case $action in
  44. 'Play Music') mpc play ;;
  45. 'Pause Music') mpc pause ;;
  46. 'Toggle Music') mpc toggle ;;
  47. 'Rebind Keys') setup-xbindkeys;;
  48. 'Disable Bar') tmux set -g status off;;
  49. 'Enable Bar') tmux set -g status on;;
  50. 'Command') cmd;;
  51. 'Command to clipboard') cmd_clip;;
  52. esac
  53. }
  54. screenshot() {
  55. method=$(printf "clipboard
  56. file
  57. both" |
  58. dmenu -i -p "Screenshot")
  59. if [ $method = "file" ]; then
  60. scrot --note "-f 'LiterationSans Nerd Font Book/11' -x 10 -y 20 -c 255,0,0,255 -t 'Hi'"\
  61. -s ~/Pictures/screenshots/screenshot-%Y-%m-%d_$wx$h.png
  62. fi
  63. if [ $method = "clipboard" ]; then
  64. scrot --note "-f 'LiterationSans Nerd Font Book/11' -x 10 -y 20 -c 255,0,0,255 -t 'Hi'"\
  65. -s ~/Pictures/screenshots/screenshot-%Y-%m-%d_$wx$h.png\
  66. -e "xclip $f; rm $f"
  67. fi
  68. if [ $method = "both" ]; then
  69. scrot --note "-f 'LiterationSans Nerd Font Book/11' -x 10 -y 20 -c 255,0,0,255 -t 'Hi'"\
  70. -s ~/Pictures/screenshots/screenshot-%Y-%m-%d_$wx$h.png\
  71. -e "xclip $f;"
  72. fi
  73. }
  74. ddg() {
  75. search_string="$(printf "" | dmenu -p 'ddg')"
  76. string_length=$(expr length "$search_string")
  77. char=''; new_string='';
  78. i=1
  79. while [ $i -le $string_length ]
  80. do
  81. char=$(expr substr "$search_string" $i 1)
  82. new_string="$new_string$(rawurlencode "$char")"
  83. # printf "this is newstring %s\n" "$new_string"
  84. i=$(expr $i + 1)
  85. done
  86. search="https://duckduckgo.com/?q=$new_string"
  87. brave-browser "$search"
  88. }
  89. rawurlencode() {
  90. case "$1" in
  91. [-_.~a-zA-Z0-9] ) result=$1; printf $result;;
  92. * ) result=$(printf '%%%02x' "'$1"); printf %$result;;
  93. esac
  94. }
  95. cmd() {
  96. sh -c "$(printf '' | dmenu -i -p 'cmd')"
  97. }
  98. cmd_clip() {
  99. value=$(cmd)
  100. show_value="$(expr substr "$value" 1 200)\n..."
  101. notify-send -u low -t 2000 "Items cliped" "$show_value"
  102. printf "%s" "$value" | xclip -selection clipboard
  103. }
  104. case $1 in
  105. launch) launch;;
  106. action) action;;
  107. cmd) action;;
  108. cmd_clip) cmd_clip;;
  109. ddg) ddg;;
  110. *) printf "Invalid argument";;
  111. esac