autostart 936 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. # Define a lock file
  3. LOCKFILE="/tmp/autostart.lock"
  4. # Check if the lock file exists
  5. if [ -e "$LOCKFILE" ]; then
  6. echo "Script autostart.sh is already running."
  7. exit 1
  8. fi
  9. # Create the lock file
  10. touch "$LOCKFILE"
  11. # Ensure the lock file is removed on exit
  12. trap 'rm -f "$LOCKFILE"' EXIT
  13. # Your script logic goes here
  14. echo "Running the script autostart.sh"
  15. dbus-daemon --session --address=unix:path=$XDG_CONFIG_HOME/bus &
  16. ## music player daemon-you might prefer it as a service though
  17. mpd &
  18. ## Set background
  19. wbg "$XDG_CONFIG_HOME/wallpaper/dwm.jpg" &
  20. ## Update contacts in Nextcloud
  21. while true; do
  22. vdirsyncer sync
  23. sleep 600s
  24. done &
  25. ## Check mail
  26. while true; do
  27. mailsync
  28. sleep 60s
  29. done &
  30. ## Clipboard manager
  31. wl-paste --type=text --watch cliphist store &
  32. ## Disable touchpad
  33. # thinkpad-touchpad
  34. ## Start terminal
  35. foot -e tmux attach || foot -e tmux &
  36. # The lock file will be removed automatically due to the trap