Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
konqueror: web search for "selected" (clipboard)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
aplesch
n00b
n00b


Joined: 26 Feb 2004
Posts: 70

PostPosted: Wed Mar 31, 2004 11:59 pm    Post subject: konqueror: web search for "selected" (clipboard) Reply with quote

konqueror: web search for "selected text" (clipboard)

Apologies for the big bold title but this is the recommended style for this forum. Firefox/mozilla has the context menu function Web Search for "selected text" which I find extremely useful and therefore missed much using konqueror. Luckily there is a simple solution !
The solution is to define an action for khotkeys and assign the action to an unused keyboard shortcut. This has the additional benefit of making this search function available to all (!) X window applications under KDE (try xedit).

    1) Open the Configure - KHotkeys window.
    2) Choose "New Action"
    3) Fill out tabs:

      a) General:

        Action name:searchwww
        Action type: Keyboard Shortcut -> Command/URL (simple)
        Comment: search google for clipboard contents

      b) Keyboard Shortcut: pick one (eg. Alt+Ctrl+G)
      c) Command/URL to execute:
      Code:
      konqueror "gg:`dcop klipper klipper getClipboardContents`"


    4) Click Apply, OK
    5) Done

This requires klipper to run in the task panel (which is the default) and gg: to be configured as a web shortcut (which is also the default). Doing this will create/append a file
~/.kde/share/config/khotkeysrc
which should look like this:
Code:
[Data]
DataCount=1

[Data_1]
Comment=search google for clipboard
Enabled=true
Name=searchgoogleaction
Type=COMMAND_URL_SHORTCUT_ACTION_DATA

[Data_1Actions]
ActionsCount=1

[Data_1Actions0]
CommandURL=konqueror "gg:`dcop klipper klipper getClipboardContents`"
Type=COMMAND_URL

[Data_1Conditions]
Comment=
ConditionsCount=0

[Data_1Triggers]
Comment=Simple_action
TriggersCount=1

[Data_1Triggers0]
Key=Alt+Ctrl+G
Type=SHORTCUT

[Gestures]
Disabled=false
MouseButton=2
Timeout=1000

[Main]
Autostart=true
Disabled=false
Version=2

So, instead of going through the graphical dialog one could just copy this file over. Similarly, one could also create a context menu entry (called service menu), see http://developer.kde.org/documentation/tutorials/dot/servicemenus.html
enjoy,
_________________
Andreas
Back to top
View user's profile Send private message
aplesch
n00b
n00b


Joined: 26 Feb 2004
Posts: 70

PostPosted: Fri Apr 02, 2004 5:25 pm    Post subject: as right click Reply with quote

It turns out that adding this functionality as a servicemenu entry (=context menu) is not quite so straightforward as one would hope. Here is a recipe which works:
Create a simple shell script:
Code:
#!/bin/sh
konqueror "gg:$(dcop klipper klipper getClipboardContents)"

chmod 755 it and put it in, say, /usr/local/bin/.
Then, following http://developer.kde.org/documentation/tutorials/dot/servicemenus.html, create file searchgg.desktop
Code:
[Desktop Entry]
Encoding=UTF-8
ServiceTypes=all/all
Actions=searchgg
[Desktop Action searchgg]
Name=Search for selected with gg
Icon=search
Exec=/usr/local/bin/dosearchgg.sh %u

and put it in ~/.kde/share/apps/konqueror/servicemenus/.
Restart Konqueror and the "Search for selected with gg" line should be listed in the Actions submenu in the context menu.
It is not possible to put the explicit command in the Exec= line because of quotation/escape issues. The Exec= line does not "like" double (and single) quotes. It also requires that a %parameter is used (even if it is not used in the script at all). The absolute path is also required.
_________________
Andreas
Back to top
View user's profile Send private message
anil_et
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jul 2002
Posts: 98

PostPosted: Sat Apr 03, 2004 12:20 pm    Post subject: Already in cvs... Reply with quote

I have this functionality in the konqui already here with kde-cvs. Highlight the text and middle click, popup a window asking wheather to search the web or not
Anil
Back to top
View user's profile Send private message
aplesch
n00b
n00b


Joined: 26 Feb 2004
Posts: 70

PostPosted: Sat Apr 03, 2004 7:10 pm    Post subject: Reply with quote

Thanks, I did not look at kde-cvs but this is certainly a good addition. I think the context menu solution (right click) is a bit smoother. Na, I could get probably get used to middle click as well :)
_________________
Andreas
Back to top
View user's profile Send private message
aplesch
n00b
n00b


Joined: 26 Feb 2004
Posts: 70

PostPosted: Wed Sep 28, 2005 1:42 pm    Post subject: bump Reply with quote

I just intalled gentoo on a nice shiny new dual opteron, and found that the global keyboard short cut to search anything hilited on google is still a good trick. Bump.
_________________
Andreas
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum