Results 1 to 7 of 7
I wanted to replace the default action of opening .txt file with gedit to opening them with a script (the script opens up Notepad++).
I looked in usr/share/applications/defaults.lst and i ...
- 01-13-2012 #1Just Joined!
- Join Date
- Oct 2011
- Posts
- 67
File associations and defaults.lst
I wanted to replace the default action of opening .txt file with gedit to opening them with a script (the script opens up Notepad++).
I looked in usr/share/applications/defaults.lst and i spotted the line
Now how can i make text/plain open up with a script called launch.sh ??Code:text/plain=gedit.desktop
Any suggestions ?? Is this even possible ??
- 01-14-2012 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
This is NOT a good idea. Notepad will put CR/LF for newlines, where Linux uses LF only for newlines. IE, it will break most Linux utilities, shell scripts, and such. I would suggest you use an editor such as nedit, which if it detects that you are using a DOS/Windows file, will adjust accordingly, or you can override the newline settings in the preferences.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 01-14-2012 #3Just Joined!
- Join Date
- Oct 2011
- Posts
- 67
Interesting point..
- 01-14-2012 #4Just Joined!
- Join Date
- Oct 2011
- Posts
- 67
so i started using nedit and i have to admit that although its not as good as notepadd++ but its better than gedit and ill stick to nedit for now. However out of curiosity how would we go about accomplishing the above task ??
- 01-14-2012 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You need to run the notepad++ tool directly. Find the exe in "~/.wine/drive_c", using the command "find ~/.wine -iname 'notepad*'", then use that path directly in your script. IE, if the file is ~/.wine/drive_c/notepad.exe, then the script should use that path directly. If it has a space in the path, such as "Program Files", then enclose the entire thing in double quotes, except for the target filename argument. Example:
Note that the argument / filename "$1" is also in double quotes. This is because it may be a path with spaces as well.Code:# use_notepad script "~/.wine/drive_c/Program Files/Notepad++/notepad++.exe" "$1"
I hope this helps. Alternatively, you can simple associate some file types, such as .txt files, with the notepad++ executable. I do that for some programs that I have to run in Wine, such as when I want to run WinRar (.rar files) or QuickPar (.par and .par2 files).Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 01-15-2012 #6Just Joined!
- Join Date
- Oct 2011
- Posts
- 67
Hi thanks for the great response. However I already have a script (sh) script that loads the notepad++.exe application. What i wanted to know was how to adjust the parameters in
defaults.lst
which is
am i just suppose to replace the gedit.desktop with that script ??? I am a bit confused with your response is that a shell script ??Code:text/plain=gedit.desktop
- 01-15-2012 #7Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
The .desktop files are what lay behind the icons on most of the desktop which you see. I have a link to a Wine application call Enterprise architect. Here is an image of its Properties window. If you right-click on your desktop, you can select "Create Launcher", which will create one of these icons on the desktop which you can then use to start your editor. You can also alter the properties of your files ending in .txt (for example) so that double-clicking on the file name in the explorer will launch the notepad++ application.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote