autostart_apps.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # vim:fileencoding=utf-8:foldmethod=marker:foldmarker={{{,}}}
  2. #!/bin/bash
  3. # {{{ Functions
  4. function Run_App_Once {
  5. if ! pgrep -f $1 ;
  6. then
  7. $@&
  8. fi
  9. }
  10. function Run_Sudo_Command {
  11. tempName=`/bin/bash -c "echo $@ | sed 's/\///g'"`
  12. #echo "pre test"
  13. #echo $tempName
  14. #echo `test -f /tmp/$tempName`
  15. if ! test -f /tmp/$tempName;
  16. then
  17. /bin/bash -c "touch /tmp/$tempName"
  18. #echo "test failed"
  19. #echo $tempName
  20. kitty --hold /bin/zsh -c "sudo $@"
  21. fi
  22. }
  23. # End functions }}}
  24. # {{{ Autostart apps arrays
  25. #startOnce_arr=("volctl" "nm-applet")
  26. #startOnce_arr=("nm-applet" "alacritty -e /home/sekhali/autostart_scripts/main.sh")
  27. startOnce_arr=("nm-applet")
  28. #startSudo_arr=("/home/sekhali/autostart_scripts/main.sh")
  29. # End autostart apps array }}}
  30. # {{{ Run apps once
  31. for startOnce in ${startOnce_arr[@]} ; do
  32. #notify-send $RunOnce
  33. Run_App_Once $startOnce
  34. #notify-send $?
  35. done
  36. # End run apps once}}}
  37. # {{{ Start with sudo
  38. #for startSudo in ${startSudo_arr[@]} ; do
  39. # Run_Sudo_Command $startSudo
  40. #done
  41. # End start with sudo}}}