Re: Dolphin: add item to the context menu
- Date: Sat, 23 Jun 2018 02:58:55 +0000 (UTC)
- From: Duncan <1i5t5.duncan@xxxxxxx>
- Subject: Re: Dolphin: add item to the context menu
Bernd Nachtigall posted on Thu, 21 Jun 2018 10:33:52 +0200 as excerpted:
> in Dolphin it is possible to open a context menu at a file. (point to a
> file and click the secondary button of you pointing device)
> Dependend of the file type you get a few action options. (e.g. Burn the
> file with k3b if the file is an ISO)
> I want to add an entry to this context menu to get the checksum of the
> file. Is anybody here who can lead me thougth this process?
Assuming you already know how to do what you want to do (here, get a
checksum) manually, that is, what program to run, etc, and further
assuming that you're running dolphin on the kde-plasma desktop or at
least have the appropriate kde system settings applet installed, it's
easy enough. FWIW this also assumes a reasonably current kde/plasma5
desktop, not the old kde4, tho the steps there should be quite similar.
Of course it should be noted that the file properties dialog (accessible
from the context menu) has a checksums tab as well. So you could just
open the properties dialog and check the checksums from there, assuming
the appropriate apps it uses to get the checksums are already installed.
And this assumes you're /not/ using that method already, or are, but know
how to do it on the commandline as well, and want to add entries for
that, thus bypassing the fiddly properties dialog.
What you need to do is open up that applet and set a new association and
perhaps priority, and there's actually several ways to do that. Here's a
few of them:
1: From within dolpin itself:
a: In the same context menu you mentioned above you should see a
properties item (likely at the bottom of the menu). Activate that.
b: In the resulting properties dialog, on the general tab, you should see
a file type options button. Activate it.
c: In the resulting edit file type dialog, on the general tab, under
application preference order, activate the add button (you can of course
edit existing actions there too, if you like).
d: In the resulting choose application dialog, either choose the
appropriate application from the applications menu if it's listed, or
type or browse to the specific application.
e: You can either add the commandline options, etc, here (note the
terminal options at the bottom if you want to open it in a terminal
window), or simply set the executable here and then hit edit once you're
back to the edit file type dialog.
f: OK back out to the edit file type dialog. Move your new action up or
down the preference order as desired, keeping in mind that the top one
listed will normally be used to open the file by default.
Of course you can add or delete extensions associated with this file type
if appropriate as well.
Once you're done you can OK out, back to Dolphin.
The down side of doing it this way, however, is that you only see the one
file type. You don't get the big list of them, which makes it difficult
if you want to add an entry for a lot of different filetypes or if you
want to add one that applies to all (or nearly all) filetypes. The below
methods are better in that case.
2. In kde/plasma's system settings:
a: Open up kde systemsettings. Under personalization in the first
column, activate applications.
b: In the second column activate file associations.
c: In the third column, under known types, find the desired file type
(which can be seen from the properties dialog in dolphin). There's a
search box if you prefer to type it in rather than browsing to it.
d: Once you select the appropriate filetype the same edit filetype dialog
described above should open up as the forth column and you can follow the
instructions from 1c above.
If you want to add an action that should be available regardless of the
filetype, look under all.
Now some distros disable one or both of the all/all (which applies to
files /and/ folders/directories) and all/allfiles (which applies only to
files, not directories) types, but at least the all/allfiles entry should
be easy enough to add, should it be necessary. But I'll assume you have
those entries here.
For something like checksums, you probably only want the entry available
for files, not directories, so you'd add it to the all/allfiles type.
Note that while the all actions should appear in the context menu for all
files (and dirs if appropriate), the more specific file types actions
will normally be prioritized over them, so you shouldn't have to worry
about the top all or allfiles action overriding the normal open action
for a filetype, as long as the file /has/ a normal filetype. Only if it
doesn't have a normal filetype should the top allfiles action become the
default open action.
3: From krunner, plasma's open dialog:
In krunner you can search by keyword, so simply typing file or asso
should already list the file associations kcm (kcontrol module).
Activate that and you'll effectively get the third and forth column of
the kde system settings app and can proceed as from 2c above.
4: From konsole/terminal-window:
Of course you can run kde systemsettings from konsole and proceed as from
2 above, but there's another way as well.
a: (optional) Run kcmshell5 --list . This will give you a list of the
available individual kcontrol modules.
b: In this case, the filetypes module looks to be what we need, so run
kcmshell5 filetypes .
c: The result should be the same file associations dialog that krunner
would have opened. Indeed, krunner is basically just running the same
filetypes kcm that we run here, just behind the scenes, via the kcm's
*.desktop file. So as with krunner, proceed as from 2c above.
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman