stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [STUMP] A Simple Hack.


From: Manuel Giraud
Subject: Re: [STUMP] A Simple Hack.
Date: Fri, 16 Jul 2004 10:41:47 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Elliott <address@hidden> writes:

> Both functions work in my init file like you 
> mentioned, but unfortunatly the keybindings 
> still need to be added to user.lisp.  If 
> that wasn't so I'd entirely use the init 
> method ... it's less editing and patching :)
>

You can also put keybindings in the init file. Here's an example:

----8<--------------------------------------------
;; -*-lisp-*-
;; Stumpwm
(load #p"/home/giraud/.cmucl/stumpwm/stumpwm.asd")
(asdf:oos 'asdf:compile-op 'stumpwm-system::stumpwm)
(asdf:oos 'asdf:load-op 'stumpwm-system::stumpwm)

(in-package :stumpwm)

;; Web search (works for Google and Imdb)
(defun make-web-search (prompt prefix)
  #'(lambda (s)
      (let ((search (read-one-line s prompt)))
        (unless (null search)
          (run-command-string
           (concatenate 'string prefix
                        (substitute #\+ #\Space search)))))))
(set-key-binding #\g '() (make-web-search "Google search: " "mozilla 
http://www.google.fr/search?q=";))
(set-key-binding #\i '() (make-web-search "IMDB search: " "mozilla 
http://www.imdb.com/find?q=";))

;; Do start
(stumpwm "" :display 0)
----8<--------------------------------------------

Nota: To run this you need the split-sequence package and the following 
function:
(defun run-command-string (str)
  "Execute the given command string."
  (let* ((split (remove "" (split-sequence:split-sequence #\Space str) :test 
'string-equal))
         (prog (car split))
         (args (cdr split)))
    (port:run-prog prog :args args :wait nil)))

(I think I have already submitted this patch to this list but I think
Shawn didn't manage to get time to merge it)

-- 
Manuel Giraud

ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]