stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] Configuration file ?


From: Matthew Kennedy
Subject: Re: [STUMP] Configuration file ?
Date: Sun, 03 Sep 2006 13:00:26 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Xavier Maillard <address@hidden> writes:

[...]

> I am asked to show my stumpwm setup file. And here is the question:
>
> do you have a stumpwmrc file lying around that you could share. I do
> not (I exlusively play with the REPL) so I can't show anything. I do
> not even know what I could put in this setup file.

I've attached mine.  I don't have a heavily customized stumpwm, but I
do have an example on how to use the new *focus-frame-hook* stuff.
The search stuff at the top is from the original .stumpwmrc included
with stumpwm.  I only modified it to escape strings for URLs.

The two-frames-* code at the end tailors stumpwm to my specific work
habits.  I use only two applications -- Emacs and Firefox.  I tend to
use them side by side in two frames.  I wanted to have the focused
frame resize to be a little wider than the unfocused frame, so I added
a hook to *focus-frame-hook* to do that.

;; -*-lisp-*-

(defpackage #:stumpwm-user
  (:use #:common-lisp
        #:stumpwm))

(in-package #:stumpwm)

(defmacro make-web-jump (name prefix)
  `(define-stumpwm-command ,name (screen (search :rest ,(concatenate 'string 
name " search: ")))
     (declare (ignore screen))
     (run-shell-command (concatenate 'string ,prefix 
(trivial-http:escape-url-query search)))))

(make-web-jump "google" "firefox http://www.google.com/search?q=";)
(make-web-jump "imdb" "firefox http://www.imdb.com/find?q=";)
(make-web-jump "yahoo" "firefox http://search.yahoo.com/search?p=";)

(set-prefix-key (kbd "C-`"))

(define-key *top-map* (kbd "F1") "help")
(define-key *top-map* (kbd "F10") "exec sh -c \"xlock -mode blank\"")

(sync-keys)

(set-fg-color "white")
(set-bg-color "blue3")
(set-border-color "blue1")

(setf *frame-number-map* "1234567890")

(defvar *two-frames-mode-split-ratio* 11/20)

(defun two-frames-1/2-delta (screen)
  (let* ((screen-width (screen-width screen)))
    (floor (- (* screen-width *two-frames-mode-split-ratio*)
              (/ screen-width 2)))))

(defun two-frames-resize (screen frame)
  (resize-frame screen
                frame
                (+ (/ (screen-width screen)
                      2)
                   (two-frames-1/2-delta screen)
                   (- (frame-width frame)))
                'width))

(defun two-frames (screen)
  (interactive-command "only" screen)
  (interactive-command "hsplit" screen)
  (two-frames-resize screen (screen-current-frame screen)))

(defun two-frames-hook (frame last-frame)
  (unless (eql frame last-frame)
    (let ((screen (current-screen)))
      (two-frames-resize screen frame))))

(define-stumpwm-command "two-frames" (screen)
  (two-frames screen)
  (echo-string screen "two-frames"))

(pushnew 'two-frames-hook *focus-frame-hook*)


Matt

-- 
Matthew Kennedy
Gentoo Linux Developer (Public Key 0x401903E0)

reply via email to

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