Web lists-archives.com

Re: Options to right click and open to view some how.




On 03/14/2017 02:06 PM, John_82 wrote:
If I am having problems and need to start poking about in system files that don't have an association I have to scroll through all of the alternatives to get to say kwrite.

That has been driving me nuts for years at times. I had to use windows at work and it's easy to add things to a right click there that will always be present what ever is clicked on.

Is there anything that I can edit to add options to a right click in kde 5.26 ? Associations aren't on as some have no suffix.

John
-


I'm no expert, so some of the following may be silly/unnecessary, but nonetheless it works.

This will add a right-click menu item under Actions to view the selected file with `less`. I find it very handy. Adjust as needed:

=====
Add file:  /home/<user>/.local/share/kservices5/lessThisFile.desktop
Contents:
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=application/octet-stream;
Actions=lessThisFile;
X-KDE-AuthorizeAction=shell_access

[Desktop Action lessThisFile]
TryExec=konsole
Exec=konsole -e ~/scripts/LessHelper.sh %f
Icon=utilities-terminal
Name=View File with less


=====
I put the script in my ~/scripts/ directory. Adjust to suit.

Add file: /home/<user>/scripts/LessHelper.sh
Contents:
#!/bin/bash
# Custom action to get lesspipe goodness into
#   "View with 'less'"

export LESS='--LONG-PROMPT --tabs=4 --RAW-CONTROL-CHARS'
export LESSOPEN="|/usr/local/bin/lesspipe.sh %s"
/usr/bin/less "$@"


=====
You don't need `lesspipe` for this to work; it's just an add-on to colorize the output of `less`. lesspipe can be found at:
  https://sourceforge.net/projects/lesspipe/

You can remove the LESSOPEN line if needed.


HTH,
-Dave