SHARE
TWEET

/bin/xdg_auotostart.sh

s243a Apr 26th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. #set -x
  4.  
  5. verify_not_running() {
  6.     while read j
  7.     do
  8.         case $j in "Name="*|"Exec="*)
  9.             name="${j#Name=}"
  10.             name="${name#Exec=}"
  11.             name="${name#sh -c }"
  12.             name="${name//\'/}"
  13.             name="${name//\"/}"
  14.             name="${name%% *}"
  15.             case $name in echo|sleep) #add more
  16.                 return 0
  17.                 break
  18.             esac
  19.             if pidof "$name" &>/dev/null ; then
  20.                 return 1
  21.                 break
  22.             fi
  23.             ;;
  24.         esac
  25.     done < "$1"
  26.     return 0
  27. }
  28.  
  29. #=================================================
  30.  
  31. for i in $HOME/.config/autostart/*.desktop
  32. do
  33.     if ! [ -f $i ] ; then
  34.         continue
  35.     fi
  36.     if ! verify_not_running $i ; then
  37.         continue
  38.     fi
  39.     xdg-open $i
  40. done
  41.  
  42. #=================================================
  43.  
  44. for i in /etc/xdg/autostart/*.desktop
  45. do
  46.     if ! [ -f $i ] ; then
  47.         continue
  48.     fi
  49.     if [ -f $HOME/.config/autostart/${i} ] ; then
  50.         continue
  51.     fi
  52.     if ! verify_not_running $i ; then
  53.         continue
  54.     fi
  55.     xdg-open $i
  56. done
  57.  
  58. ### END ###
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top