SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-04-09 21:49:53

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Adding programs to the "Open With" options


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

Be excellent to each other!

#2 2013-04-10 05:03:02

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Adding programs to the "Open With" options

Are you using Thunar to open the files? If so, just go to the "Open with Other Application" right-click option, choose your script (you'll brobably have to enter the command manually at "use a custom command") and click "open". Only check the "Use as default" box if that's what you want. Next time, that choice should appear in the "open with" list. You might have to restart Thunar.

Offline

#3 2013-04-10 18:43:16

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options

I tried this... and I can use the custom command to run the script, but it's not opening the text file in the subsequent program.

I'm wondering how I can get Thunar to recognize the installed programs as text-editors in the first place, so it can pass on the 'open file' command to them, the same way it's doing it with Geany, Abiword, Emacs, (and DosBox for some reason).

I'm wondering if maybe the Sublime Text executable just doesn't have a method to pass along a specific file to open?


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#4 2013-04-10 22:19:39

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Adding programs to the "Open With" options

perhaps the secret is in

tail /usr/share/applications/geany.desktop | grep Mime

edit:

example /usr/share/applications/sublime.desktop (modify the Exec path);

[Desktop Entry]
Type=Application
Version=1.0
Name=Sublime
GenericName=Integrated Development Environment
Comment=fast and lightweight
Exec=/home/user/apps/Sublime/sublime_text %F
Icon=sublime
Terminal=false
Categories=GTK;Development;IDE;
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;
StartupNotify=true

logout/login, click around "open with" few times and some magic should happen.

Last edited by brontosaurusrex (2013-04-10 22:53:40)

Offline

#5 2013-04-11 11:36:05

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Adding programs to the "Open With" options

Offline

#6 2013-04-11 18:12:19

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options

#sublime text startup script

./Programs/Sublime\ Text\ 2/sublime_text "$@"

Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#7 2013-04-11 19:13:23

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Adding programs to the "Open With" options

and my solution is not working cos you are afraid of reptiles or some other reason?

Offline

#8 2013-04-11 20:18:33

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#9 2013-04-11 21:49:05

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Adding programs to the "Open With" options

exactly, no it doesn't matter where the sublime bin is, just make the "Exec=" part of that .desktop to point there.

Offline

#10 2013-04-12 04:21:19

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Adding programs to the "Open With" options

If brontosaurusrex's solution with a .desktop file works out you shouldn't need that startup script at all. smile

Last edited by johnraff (2013-04-12 04:22:55)

Offline

#11 2013-04-12 18:03:32

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options

That worked! Thanks, bronto!

It looks like if I want to run it in the terminal, I still need the script... but the open with functionality works perfect.

Even though my problem is solved, it does make me wonder. How would I also get terminal functionality at the same level? (Opening a file through sublime in the terminal.) I guess the script sort of does that, but it's a bit kludgy. Do I need to give the program executable special permissions or anything?


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#12 2013-04-12 19:38:06

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Adding programs to the "Open With" options

either,
a. add your sublime directory to PATH
(echo $PATH)
or
b. make alias in .bash_aliases like
alias edit='/some/place/sublime-text'
then just
edit myscript.txt (should open myscript.txt in sublime)

Offline

#13 2013-04-12 19:42:08

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options

Heck, I could do both!

I'll do a bit of research on the process for those options and come back when I've tried it!


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#14 2013-04-12 22:40:59

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#15 2013-04-13 05:18:56

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Adding programs to the "Open With" options

Defaulf on waldorf is ~/.bash_aliases which starts when bash is invoked via ~/.bashrc
(to restart bash you can use: exec bash -l)

Last edited by brontosaurusrex (2013-04-13 05:24:10)

Offline

#16 2013-04-13 16:25:56

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Adding programs to the "Open With" options

Offline

#17 2013-04-17 05:31:00

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#18 2013-04-17 05:37:23

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Adding programs to the "Open With" options

what does "cat .bashrc | grep bash_aliases" say?
i get:

# ~/.bash_aliases, instead of adding them here directly.
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

Offline

#19 2013-06-12 21:59:32

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options

Apologies for the long time away! Some of my other projects overtook my tech love for a while. But now I'm back!

Bronto, here's what I got from that command; I think it's the same as yours.

# ~/.bash_aliases, instead of adding them here directly.
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

Does this mean that it's not recognizing .bash_aliases as a command, maybe?

bash: .bash_aliases: command not found


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#20 2013-06-13 12:16:30

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Adding programs to the "Open With" options

The . is the command! It's the same as 'source'.  (.bash_aliases is a file.)
So I can't see why your code isn't working... have you got the 'fi' at the end? ie:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Offline

#21 2013-06-19 00:41:41

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Adding programs to the "Open With" options

Yep, I've got the 'fi' on the end there.

Here's a question... based on the syntax, is it looking for the file in the main user directory, or in root?

Last edited by typewriterjason (2013-06-19 01:42:50)


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#22 2013-09-04 01:57:17

OragamiOstrich
New Member
From: Oakdale, California
Registered: 2012-10-29
Posts: 7
Website

Re: Adding programs to the "Open With" options

if you can't get your alias to work try

sudo ln -s /Programs/Sublime\ Text\ 2/sublime_text /usr/local/bin/

That'll put a symbolic link (equivalent to a windows shortcut) to it in the PATH

Offline

#23 2013-09-05 17:03:34

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Adding programs to the "Open With" options

Offline

#24 2013-09-06 21:16:52

CBizgreat!
#! Die Hard
Registered: 2011-07-27
Posts: 1,865

Re: Adding programs to the "Open With" options

site:http://crunchbang.org/forums/ thunar custom actions

Last edited by CBizgreat! (2013-09-06 21:37:45)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo