How can I bring back Konqueror as my man page viewer?
Duncan
1i5t5.duncan at cox.net
Sun Aug 19 06:41:51 BST 2012
Nikos Chantziaras posted on Sat, 18 Aug 2012 18:12:59 +0300 as excerpted:
> In KDE, I'm very used to simply type "man:foo" and have the man page of
> "foo" pop up immediately in Konqueror without having to open a terminal
> or anything.
>
> However, since I installed Chromium and making it my default browser,
> now "man:" brings up Chromium instead. That doesn't work; instead of
> displaying the man page, it downloads the *.bz2 from the local file
> system :-/
>
> How can I set Konqueror to be the program that handles KDE's "man:"
> command?
AFAIK, there's not direct way to do it, for reasons I explain, but it
should be possible using the wrapper script method I demonstrate below.
This kde functionality is one of a number of "kioslaves", kde i/o-slaves,
that allow kde apps (mostly file and web browsers) to present various
types of information "virtually", not in its native format, but in a
"virtual" format made to appear as if it were part of the filesystem, or
in this case, present a different type of file as if it were a web page.
Try this to see the various kioslaves and see what they can do. This
will work best in dolphin, but will /sort/ /of/ work, to some degree or
other depending on how well the particular app can handle the chosen type
of data, in any kde app that lets you open a file dialog.
1) In the path line, switch to edit mode if necessary.
(kde4's file path lines have two modes, the traditional type-it-in aka
"edit" aka "edit-path" mode, and the newer "breakcrumbs" aka "navigate"
mode. You can switch between them by clicking the end of the address
line or by context/right clicking outside the textbox if in edit mode and
selecting edit or navigate from the resulting menu. In konqueror you'll
need to open a file-open dialog, as its address bar is designed for
internet address use.)
2) Once in edit-path mode, erase any existing path, including the /.
3) Immediately to the left of the textbox, you should now see "file",
with a down-arrow indicating a dropdown menu. Click it.
4) The resulting menu will have a bunch of entries in addition to "file",
depending on how many of the available kioslaves you or your distro has
chosen to install. Note especially the "other" at the bottom, with a
submenu where you should find the "man" listing.
5) Have fun browsing around.
In addition to dolphin and konqueror, you can try this in kwrite (from
the file-open dialog). Try it with the programs type, for instance.
As another example, if you have a cdrom, from dolphin/konqueror, the
audiocd type allows you to browse virtual directories on the cd
containing ogg/flac/mp3 virtual "files" (if your distro ships the
necessary libs, some don't ship mp3 especially, due to patent concerns,
etc), which you can copy elsewhere to have kde directly convert/encode to
the corresponding filetype on-the-fly as it's "copying". (The settings
for audiocd's encode quality, default cd device, etc, are in kde settings
under hardware, audio and video, audio cds.)
6) If you try browsing the "man" type/kioslave, you'll get a virtual
directory containing all manpages, but here presented as virtual HTML
documents, plus virtual subdirs for each type, a "User Commands" virtual
dir for man section 1, "File Formats" for man (5), etc. If you enter a
subdir, you get just the manpages-as-html-files corresponding to that
section.
This is where you can see the man kioslave actually doing its thing. If
you open any of the virtual files with kwrite, you'll see the html
"source code" that the kioslave generated.
Which is where the problem comes in. If you look at the filetype for any
of these man kioslave virtual files, you'll see them listed as HTML
Document. Of course you COULD switch the open-with association back to
konqueror as top priority, but that would switch it for ALL files of type
HTML Document...
FWIW, here, I have firefox set as my preferred browser, so they all open
in firefox. Firefox actually does a good job at displaying most of them,
but I did see that apparently due to some internal firefox setting, any
*.conf manpage (like xorg.conf, for instance), gets displayed as plain-
text, even tho kde's giving firefox the same sort of tempfile using the
file:// protocol as it does with the other manpages, so it /must/ be a
setting specific to *.conf files in firefox itself, that's forcing the
plain-text display.
So what the kde man kioslave is doing is generating the html code on the
fly, then passing it to whatever browser as a tempfile. The only way
you're going to change what browser gets the file, at least directly, is
to change kde's top-ranked open-with for HTML Documents... which will
unfortunately change it for all such documents.
And I really do NOT recommend konqueror as default browser, given kde's
clear treatment of it as a "toy", not for ordinary users to use as their
normal browser, including with secure websites, etc. (See the lack of
security certificate management for YEARS after declaring kde4 ready for
ordinary users with 4.2, and the double-form-submission bug introduced in
the "safe, bugfix only" 4.6.2 update that took TWO MONTHS to fix, despite
the fact that people using konqueror to make purchases, etc, might get
charged twice as a result of the double submission... as just two
examples. Either they simply DO NOT CARE about the security of those
"ordinary users" they claimed kde was ready for, or they consider
konqueror no more than a trivial toy that nobody would EVER use for such
"ordinary" tasks as online shopping and banking, etc. This is *NOT* a
browser to be trusted for anything more than "trivial toy" level tasks!)
Meanwhile, back in krunner, which is presumably where you were typing
this in, if you hit the configure icon, based on my testing it's the
"Locations" krunner applet that enables "man:xxxxx" functionality.
Unfortunately, here again you can't simply disable that, without
disabling a whole host of other desired functionality. =:^(
But you /can/ setup a wrapper script, and associate THAT with HTML
Document files. =:^)
FWIW, I run konsole enough I have it setup to launch with a hotkey, as I
use either the commandline directly, or the midnight commander (mc) "semi-
gui", for most of my file management, config-file editing, system
management, etc, so popping up a new konsole window and typing in "man
whatever" for my manpage lookups is just second nature. And I have bash
tab-completion setup for manpage lookup as well, so opening a konsole
window and typing in "man xor<tab>" to get the xorg.conf manpage is
faster than typing in the whole "man:xorg.conf" in krunner, too. =:^)
But hey, you stoked my creativity enough to write and test the below, so
now that I have it working, I might as well leave it. =:^)
1) Setup a little browser-wrapper bash script, something like this:
(Tested/works here, alter as needed, I use firefox so put that as
browser, you'll want to change that to chromium instead.)
------------------------------------------
#!/bin/bash
# Original script by "Duncan"
# as posted to the kde general mailing list
# License: Public Domain: Use/modify/distribute as desired
# preferred browser?
browser="firefox"
# semi-uniq string found in kde's man kioslave output
searchstring='<meta name="ROFF_Type" content="man">'
# was I passed a file that might be a manpage-as-html?
for param; do
# tempfile path and regular file?
[[ $param == */krun/* && -f $param ]] && {
# does it have our semi-uniq string
grep -q "$searchstring" "$param" && {
# yes, use konqueror
exec konqueror --mimetype text/html "$@"
}
}
done
# since the konqueror call was an exec we should
# only reach here if one of those tests failed.
# call our preferred browser
exec $browser "$@"
-------------------------------------------
Of course set it executable, etc...
2) In kde settings, under common appearance and behavior, file
associations, in the search box enter text/html . In the list, expand
the text entry and click on html. To the right under application
preference order, click add, and type in the path to the wrapper script.
Hit OK, make sure that entry is at the top in app preference order, and
apply.
Now test! =:^)
Observation: One who knows how to setup wrapper scripts can make their
computer do all sorts of fun and useful stuff the folks who designed the
invoking and/or wrapped applications never considered and thus didn't
directly allow for! =:^)
--
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
___________________________________________________
This message is from the kde mailing list.
Account management: https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.
More information about the kde
mailing list