More WindowMaker hackery

ziggy on 2002-12-12T22:22:04

I've been using WindowMaker for years. Usually, I customize it by tinkering with dockapps (trivial) or hacking the Root menu (easy). Years ago, I used to have a process that would fetch the headlines from slashdot and a few other sites, and turn them into dynamic menus. That was back before RSS, and syndication meant parsing ultramode.txt

Today, I noticed that the most frequent use of my w3m menu entry was to view the URL in the X clipboard buffer. So why not add another menu entry to view the URL in the clipboard buffer? Easier said than done. Unfortunately, the %-escapes WindowMaker uses aren't very well documented. But they are documented.

Poking around the source distribution, I found some entries back from the 0.12.0 release that describes the %-escapes WindowMaker uses:

  *** Escape thingies for menu and dock commands:

  %w - substitute with current selected X window ID
  %s - substitute with current selection
  %d - substitute with last dropped object
  %a(some text) - opens a input box with "some text" as a title. Then,
  the text typed will be substituted there

  \r, \n - substitute with corresponding characters

That was easy. :-) Maybe I'll get around to adding root menu aliases for sites I frequently browse with w3m: google, new useperl journal entries, etc.


And the command-line ?

rafael on 2002-12-12T23:10:27

Great trick, the ideal complement to
mozilla -remote 'openurl(url,new-tab)'
But what would be even more useful is to have a simple command-line program that outputs the contents of the X clipboard to standard output. (Fortunately there's the * buffer on vim to handle this.)

Re:And the command-line ?

ziggy on 2002-12-12T23:28:03

The command line for this hack is a variant of the one I posted earlier:
rxvt -fn -fixed +sb -geometry 80x40 -e w3m -cookie %s

The X clipboard inspector widget is relatively simple. The tricky part is getting the quoting right. Here's the entry from my WMRootMenu:

  (
    "X Clipboard inspector",
    SHEXEC,
    "rxvt -fn -fixed +sb -e sh -c 'echo \"%s\";  read wait'"
  ),

(Just hit return to dismiss this window)

Re:And the command-line ?

waltman on 2002-12-13T03:39:14

But what would be even more useful is to have a simple command-line program that outputs the contents of the X clipboard to standard output.

Why do you need a separate tool, when shift-insert already does that? (Although not, annoying enough, in Mozilla's url box.)

Re:And the command-line ?

rafael on 2002-12-13T09:58:23

Window-manager-agnostic launch scripts. When I don't use WindowMaker, I use wmx, an ultra-light but very useable (and good-looking) WM. (I think of it as the "vi of window managers".)