3

I want to auto-start all screenlets in unity environment only as it also auto-start in Gnome-shell too (as it is not working well in gnome-shell), i,e, i want to only edit one file not all screenlet items files startup aaplications
as i have a lot of sceenlets on my desktop My-Desktop
And i know how to auto-start an application from this site.

Black Block
  • 4,921
  • 18
  • 46
  • 68
  • What are you talking about.I know how to auto-start an application in a certain environment, but each screenlet item have an auto-start element so i want to control them all not every item alone.and i haven't tried any thing yet(because i don't know what to do, so i ask). – Black Block Nov 29 '11 at 22:43
  • ☹ seem impossible ☹ – Black Block Dec 01 '11 at 20:50

1 Answers1

4

I don't think its possible to edit just one file - you'll need to edit all the screenlet files - it seems all screenlets in the autostart folder are named [something]Screenlet.desktop

You could use a simple script such as this which would append OnlyShowIn=Unity to all screenlet files in the users autostart folder

To use, copy and paste the following into a file in your home folder called hidescreenlets

Then run the script using:

bash ~/hidescreenlets

If you add more screenlets, just rerun the script.

script:

#!/bin/bash

dir="$HOME/.config/autostart"

if  [ ! -d  $dir ] ; then
  echo "cannot find $dir"
  exit
fi

cd $dir

files=`find -name "*Screenlet.desktop"`
for file in $files ; do
  srch=`grep -i "OnlyShowIn=Unity" $file`
  #echo $file "$srch"
  if [ "$srch" == "" ] ; then
     echo "OnlyShowIn=Unity" >> $file
     #echo $file "$srch"
  fi
done

backing up

If you are feeling nervous... either use Nautilus to backup the ~/.config/autostart folder to another folder or you can achieve the same via the following:

mkdir ~/backupscreenlets
cp ~/.config/autostart/* ~/backupscreenlets

Look at the contents of ~/backupscreenlets - it will have the same files as ~/.config/autostart

If you then want your original files:

cp ~/backupscreenlets/* ~/.config/autostart
fossfreedom
  • 171,546
  • 47
  • 376
  • 404
  • Did you try it and works for you ???(i am afraid to make a mistake and make a failure in something) – Black Block Dec 03 '11 at 20:14
  • yes I did - I've added a backup instruction if you are feeling nervous... and you are quite right not to run random stuff written on the internet :). Follow the backup instruction - and you will be able to return to day 1 state anytime you want to. – fossfreedom Dec 03 '11 at 20:56