;; vim: set ft=lisp :
;; -*-lisp-*-

(in-package :stumpwm)

(set-module-dir "~/.local/share/stumpwm/modules")

(setf *startup-message* nil)

(load "~/.config/stumpwm/lisp/fonts.lisp")
(load "~/.config/stumpwm/lisp/functions.lisp")
(load "~/.config/stumpwm/lisp/settings.lisp")
(load "~/.config/stumpwm/lisp/keymap.lisp")
(load "~/.config/stumpwm/lisp/autoload.lisp")

;;;; Web jump (works for DuckDuckGo and Imdb)
;;(defmacro make-web-jump (name prefix)
;;  `(defcommand ,(intern name) (search) ((:rest ,(concatenate 'string name " search: ")))
;;    (nsubstitute #\+ #\Space search)
;;    (run-shell-command (concatenate 'string ,prefix search))))
;;
;;(make-web-jump "duckduckgo" "firefox https://duckduckgo.com/?q=")
;;(make-web-jump "imdb" "firefox http://www.imdb.com/find?q=")
;;
;;;; C-t M-s is a terrble binding, but you get the idea.
;;(define-key *root-map* (kbd "M-s") "duckduckgo")
;;(define-key *root-map* (kbd "i") "imdb")

;;; Define window placement policy...
;; Clear rules
(clear-window-placement-rules)

;; Last rule to match takes precedence!
;; TIP: if the argument to :title or :role begins with an ellipsis, a substring
;; match is performed.
;; TIP: if the :create flag is set then a missing group will be created and
;; restored from *data-dir*/create file.
;; TIP: if the :restore flag is set then group dump is restored even for an
;; existing group using *data-dir*/restore file.
;;(define-frame-preference "Default"
;;  ;; frame raise lock (lock AND raise == jumpto)
;;  (0 t nil :class "Konqueror" :role "...konqueror-mainwindow")
;;  (1 t nil :class "XTerm"))
;;
;;(define-frame-preference "Ardour"
;;  (0 t   t   :instance "ardour_editor" :type :normal)
;;  (0 t   t   :title "Ardour - Session Control")
;;  (0 nil nil :class "XTerm")
;;  (1 t   nil :type :normal)
;;  (1 t   t   :instance "ardour_mixer")
;;  (2 t   t   :instance "jvmetro")
;;  (1 t   t   :instance "qjackctl")
;;  (3 t   t   :instance "qjackctl" :role "qjackctlMainForm"))
;;
;;(define-frame-preference "Shareland"
;;  (0 t   nil :class "XTerm")
;;  (1 nil t   :class "aMule"))
;;
;;(define-frame-preference "Emacs"
;;  (1 t t :restore "emacs-editing-dump" :title "...xdvi")
;;  (0 t t :create "emacs-dump" :class "Emacs"))

;; Slime
;; This is how we interact with StumpWM using emacs.
;; Load swank.
;; *prefix-key* ; swank will kick this off
;;(load "/path/to/slime/swank-loader.lisp")
;;(swank-loader:init)

;;(ql:quickload :swank)
;;(defcommand swank () ()
;;    (swank:create-server :port 4005
;;                       :style swank:*communication-style*
;;                       :dont-close t)
;;  (echo-string (current-screen) 
;;	       "Starting swank. M-x slime-connect RET RET, then (in-package stumpwm)."))
;;(swank)
