How to always open a *specific filename* with a program (not *specific type*)

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ThePhi
Level 1
Level 1
Posts: 21
Joined: Sat Sep 23, 2017 4:46 am

How to always open a *specific filename* with a program (not *specific type*)

Post by ThePhi »

Hi all! :)

I already know how to open a specific file type with always the same program.
What I'd like in fact in to do the same but restricted to a specific filename.

Concrete case:
I've got a text file. This file is in fact what the flowchart graphic program, "Draw.io", uses to store your project.
What I want is to always open the program "Draw.io" when I click on this file.
But I don't want that all the others text files have to be open with "Draw.io", but like "normal" text file (for example with vim).

Is it possible?
Thanks a lot in advance!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by Moonstone Man »

ThePhi wrote: Tue May 18, 2021 12:14 am Is it possible?
Maybe yes, maybe no.

Your post is missing some detail. Whether or not the file has its own extension, and if so, what it is, and if not, an example of the file name with extension, and details about what you've tried so far.
donalduck
Level 4
Level 4
Posts: 236
Joined: Mon Oct 07, 2013 1:43 pm
Location: there

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by donalduck »

interesting. we don't even know your desktop environment !!

one possible workaround in mate:
right-click your specific file, "open with" your application (and don't forget not to leave on "always open ...")

within a terminal note the exact command line ps -ef

then on the desktop right-click and choose to create a launcher, with this command line, example:
mate_launcher_2021-05-18.png
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by Flemur »

ThePhi wrote: Tue May 18, 2021 12:14 am I've got a text file. This file is in fact what the flowchart graphic program, "Draw.io", uses to store your project.
What I want is to always open the program "Draw.io" when I click on this file.
But I don't want that all the others text files have to be open with "Draw.io", but like "normal" text file (for example with vim).
Is it possible?
It's possible but a PITA because freedesktop glommed a bunch of extensions with very different uses into one file-type of "text".

An easy semi-solution is to rt-click-> Open with -> pick your program but don't set it as the default; you other text files will continue to open with the default programs but your program will be on the rt-click->'open with' list. (This might be the same as what donaldduck said...?)
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
AndyMH
Level 21
Level 21
Posts: 13736
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by AndyMH »

I'd do what donalduck suggested - stick a launcher on your desktop.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
ThePhi
Level 1
Level 1
Posts: 21
Joined: Sat Sep 23, 2017 4:46 am

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by ThePhi »

Kadaitcha Man wrote: Tue May 18, 2021 3:08 am
ThePhi wrote: Tue May 18, 2021 12:14 am Is it possible?
Maybe yes, maybe no.

Your post is missing some detail. Whether or not the file has its own extension, and if so, what it is, and if not, an example of the file name with extension, and details about what you've tried so far.
It can have extension, or not. the program doesn't care in fact since it looks inside the file directly, whatever the extension is.
I've tried nothing for the moment.
ThePhi
Level 1
Level 1
Posts: 21
Joined: Sat Sep 23, 2017 4:46 am

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by ThePhi »

donalduck wrote: Tue May 18, 2021 3:59 am interesting. we don't even know your desktop environment !!
The post is in "Cinnamon", so my Desktop environment is cinnamon.
donalduck wrote: Tue May 18, 2021 3:59 am one possible workaround in mate:
right-click your specific file, "open with" your application (and don't forget not to leave on "always open ...")

within a terminal note the exact command line ps -ef

then on the desktop right-click and choose to create a launcher, with this command line, example:
mate_launcher_2021-05-18.png
It opens the file with the chosen application, but only for one time. Next time I click, it opens it like a text file. I guess it's because "Always open..." wasn't checked. But if I check it, ALL the text files open with the chosen program (what I don't want).
ThePhi
Level 1
Level 1
Posts: 21
Joined: Sat Sep 23, 2017 4:46 am

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by ThePhi »

Flemur wrote: Tue May 18, 2021 9:18 am An easy semi-solution is to rt-click-> Open with -> pick your program but don't set it as the default; you other text files will continue to open with the default programs but your program will be on the rt-click->'open with' list. (This might be the same as what donaldduck said...?)
(as written above) It's a one-time solution: the next time I double click on the file, it opens with the usual program chosen for text file.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by Flemur »

ThePhi wrote: Tue May 18, 2021 11:41 pm
Flemur wrote: Tue May 18, 2021 9:18 am An easy semi-solution is to rt-click-> Open with -> pick your program but don't set it as the default; you other text files will continue to open with the default programs but your program will be on the rt-click->'open with' list. (This might be the same as what donaldduck said...?)
(as written above) It's a one-time solution: the next time I double click on the file, it opens with the usual program chosen for text file.
It's not a one-time solution; it puts your program in the the "open with" list of programs so it's easy to access...it's just not as easy as "Open". Some file-browsers might be friendlier about this than others.

Edit: Open a text file with "my-program":
my-program.jpg
my-program.jpg (8.14 KiB) Viewed 860 times
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
ThePhi
Level 1
Level 1
Posts: 21
Joined: Sat Sep 23, 2017 4:46 am

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by ThePhi »

Flemur wrote: Wed May 19, 2021 7:55 am It's not a one-time solution; it puts your program in the the "open with" list of programs so it's easy to access...it's just not as easy as "Open". Some file-browsers might be friendlier about this than others.

Edit: Open a text file with "my-program":
my-program.jpg
Ok, I get what you mean. It's better than nothing...
For a precision, here how it works:
I needed to select AT LEAST ONE TIME "always open with" my specific program for a file type. Then, I switch back to the normal program in "always open with".
Only at this condition does the specific program appears in the list.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by Flemur »

ThePhi wrote: Thu May 20, 2021 1:58 pm For a precision, here how it works:
I needed to select AT LEAST ONE TIME "always open with" my specific program for a file type. Then, I switch back to the normal program in "always open with".
Only at this condition does the specific program appears in the list.
You don't need to do that with thunar or pcmanfm; just the single "Open with" puts it on the list without changing the default.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
ThePhi
Level 1
Level 1
Posts: 21
Joined: Sat Sep 23, 2017 4:46 am

Re: How to always open a *specific filename* with a program (not *specific type*)

Post by ThePhi »

Ah? Okay, good to know. I'm on Dolphin, I guess it behaves differently (i have thunar installed also though but I prefer Dolphin)
Locked

Return to “Cinnamon”