Re: [dwm] stupid problem with key bindings

From: Karl. <kmw1_AT_free.net.nz>
Date: Sun, 30 Dec 2007 08:59:14 +1300

On Sat, Dec 29, 2007 at 05:24:15PM +0100, Giorgio Lando wrote:
> The command should open in firefox the contents of the X selection
> buffer. So xsel gives me the buffer. In the interactive shell, the
> following command works when the buffer consists in an URL:
>
> firefox `xsel`
>
> Now I have tried the following line in config.h:
>
> { MODKEY, XK_o, spawn, "exec firefox `xsel`" },

You might be able to make this work by squeezing it through bash so that
bash expands the backticks, something like this (untested):

   { MODKEY, XK_o, spawn, "exec bash -c firefox `xsel`" },

> ... and as a last resort I have created a shell script called
> firefoxterm:
>
> #! /bin/sh
> firefoxtab `xsel`
>
> It works from the command line, I am able to bind it with xbindkeys,
> but:
>
> { MODKEY, XK_o, spawn, "exec firefoxterm" },
>
> does nothing. The problem is not in the keybinding itself,
> because I am able to bind that combination to other commands without
> problems.

This approach works fine for me - my keybinding is:

   { MODKEY, XK_o, spawn, "exec browse CLIPBOARD" },

and my script is attached - note that it is calling opera (and
optionally iceweasel) instead of firefox - you want to change the
openlink function.

The script needs some tidying/commenting/improving, but it basically
does what I need, so I've not fiddled with it recently. The intention
is that (if called with argument 'CLIPBOARD') it should open all things
that look like URLs on the clipboard and ignore anything non-URL.
Otherwise it opens all URLs given on the command-line, or the current
dir if nothing specified (I use this if I am at a shell prompt and want
to open a browser on the current directory - I just use 'browse')

Karl.

-- 
http://mowson.org/karl

Received on Sat Dec 29 2007 - 20:59:24 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:14:29 UTC