My scripts for startup, dmenu, and the command line
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

110 lignes
2.2 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" |
  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. Select VPN
  34. Disable VPN
  35. Enable VPN
  36. VPN Status
  37. Rebind Keys
  38. Disable Bar
  39. Enable Bar" |
  40. dmenu -i -p "Actions")
  41. case $action in
  42. 'Play Music') mpc play ;;
  43. 'Pause Music') mpc pause ;;
  44. 'Toggle Music') mpc toggle ;;
  45. 'Rebind Keys') setup-xbindkeys;;
  46. 'Disable Bar') tmux set -g status off;;
  47. 'Enable Bar') tmux set -g status on;;
  48. esac
  49. }
  50. screenshot() {
  51. method=$(printf "clipboard
  52. file
  53. both" |
  54. dmenu -i -p "Screenshot")
  55. if [ $method = "file" ]; then
  56. scrot --note "-f 'LiterationSans Nerd Font Book/11' -x 10 -y 20 -c 255,0,0,255 -t 'Hi'"\
  57. -s ~/Pictures/screenshots/screenshot-%Y-%m-%d_$wx$h.png
  58. fi
  59. if [ $method = "clipboard" ]; 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. -e "xclip $f; rm $f"
  63. fi
  64. if [ $method = "both" ]; then
  65. scrot --note "-f 'LiterationSans Nerd Font Book/11' -x 10 -y 20 -c 255,0,0,255 -t 'Hi'"\
  66. -s ~/Pictures/screenshots/screenshot-%Y-%m-%d_$wx$h.png\
  67. -e "xclip $f;"
  68. fi
  69. }
  70. ddg() {
  71. search_string="$(printf "" | dmenu -p 'ddg')"
  72. string_length=$(expr length "$search_string")
  73. char=''; new_string='';
  74. i=1
  75. while [ $i -le $string_length ]
  76. do
  77. char=$(expr substr "$search_string" $i 1)
  78. new_string="$new_string$(rawurlencode "$char")"
  79. # printf "this is newstring %s\n" "$new_string"
  80. i=$(expr $i + 1)
  81. done
  82. search="https://duckduckgo.com/?q=$new_string"
  83. brave-browser "$search"
  84. }
  85. rawurlencode() {
  86. case "$1" in
  87. [-_.~a-zA-Z0-9] ) result=$1; printf $result;;
  88. * ) result=$(printf '%%%02x' "'$1"); printf %$result;;
  89. esac
  90. }
  91. case $1 in
  92. launch) launch;;
  93. action) action;;
  94. cmd) action;;
  95. ddg) ddg;;
  96. *) printf "Invalid argument";;
  97. esac