1

I know how to make certain processes open up at start up but I'd really like to get gedit to open a number of files by default every time as well. It sometimes takes me a couple of minutes to find/remember all of them and this would make it a lot faster. Is this possible?

2 Answers 2

2

Just add this to your startup applications:

gedit "~/file 1" "~/Documents/file 2" "~/Desktop/file 3"

It passes the file paths as arguments to GEdit which causes GEdit to open these files.

1
  • I actually forgot that we can use commands for the startup applications. This is a good solution, thanks.
    – LagarLagar
    Jan 1, 2017 at 20:45
0

You don't need a gedit default if all you need is to remember a file list. You can simply save a gedit file1 file2 file3 shortcut on the desktop.

As for your exact request, there's no such special gedit feature. I would just use a wrapper.

sudo mv /usr/bin/gedit /usr/bin/gedit.real
echo '#!/bin/bash' |sudo tee /usr/bin/gedit
echo '[ -d ~/.gedit_default ] && filelist=`ls ~/.gedit_default`' |sudo tee -a /usr/bin/gedit
echo 'gedit.real "$@" $filelist' |sudo tee -a /usr/bin/gedit
sudo chmod +x /usr/bin/gedit
mkdir -p ~/.gedit_default

Then I would add my desired default files to ~/.gedit_default as symlinks:

ln -s /path/to/myfile1 ~/.gedit_default
ln -s /path/to/myfile2 ~/.gedit_default
4
  • You probably want to read this: wiki.bash-hackers.org/syntax/redirection
    – UTF-8
    Jan 1, 2017 at 21:03
  • @UTF-8 You are aware of the redirection with sudo issue, aren't you?
    – argle
    Jan 1, 2017 at 21:09
  • Yes. But I that doesn't apply if you make the redirection part of the command you pass to sudo.
    – UTF-8
    Jan 2, 2017 at 8:32
  • Which is not the case above. Also, wiki.bash-hackers.org/syntax/redirection does not address any redirection-part-of-the-command case.
    – argle
    Jan 2, 2017 at 9:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .