startx
directly, and .xinitrc
runs sbcl with a short file that just loads and starts stumpwm. It seems starting the swank server there, before (stumpwm:stumpwm)
is giving me better results than in my stump config file (which is run after). Does that make sense there would be a difference? I don't think I've changed anything else but was handling some errors better (related to multimonitor)
restart-*
from slime will run into not finding the tag :top-level
, so somehow this is not being caught
run-in-main-thread
to call the restart. I don't have the code handy to find out what the actual name of the function is.
(defun media-window-toggle ()
(let ((num-orig (window-number (current-window))))
(act-on-matching-windows
(win) (title-re-p win ".*(Watch|YouTube).*")
(progn (select-window-by-number (window-number win))
;; middle click, so that the fullscreen is not triggered
(center-click))
;; Restore window and pointer
(select-window-by-number num-orig)
(banish)
(echo "Toggled "))))
(defcommand center-content-do () () (media-window-toggle))
(define-key *top-map* (kbd "<your-desired-binding>") "center-content-do")
(defun center-click ()
(let ((scre (window-screen (current-window)))
(wwid2 (round (window-width (current-window)) 2))
(whid2 (round (window-height (current-window)) 2))
(geom (multiple-value-list (geometry-hints
(current-window)))))
(let* ((wx (nth 0 geom)) (wy (nth 1 geom))
(sx (+ wx wwid2)) (sy (+ wy whid2)))
(warp-pointer scre sx sy)
(ratclick 1))))
@mtekman
It is working.
One weird thing though.
Although the num-orig
window seems to be selected back, the keys still act on the other window.
Toy example,
;; win0 = emacs
;; win1 = firefox
;; current window number is 0
(select-window-by-number 1)
(select-window-by-number 0)
After execute the above code, my emacs does not correspond to any key although the word Current Frame
is written on emacs frame by stumpwm. The keystroke seems to be sent to firefox window.
Hello,
Can someone show an example of binding a key to a CL function, defined with (defun)
or a stump command, defined with (defcommand)
?
I have defined functions to manage the brightness of the screen on my laptop, but I face an exception, linked to calling said function.
I would, also, like to bind the special "laptop" keys for cycling between the embedded screen of the laptop and an external screen. I suppose, xrandr or gui like lxrandr are my friends, hier?
For brightness I have this horrible function I defined:
(defun brightness (up step)
(let ((direction (if up "-inc" "-dec")))
(run-shell-command (format nil "xbacklight ~A ~D" direction step))
(let ((bright
(run-shell-command
"xbacklight -get | awk -F'.' '{printf \"Brightness: \"$1\"%\"}'"
t))
(cbright-file "~/.config/current-user-brightness.txt"))
(if (< 10 (length bright))
(message bright)
;; Otherwise use xrandr -- slow though!
(let ((outdevice
(string-trim
'(#\Space #\Tab #\Newline)
(run-shell-command
"xrandr | grep \" connected\" | cut -d' ' -f 1" t)))
(next-brightN nil))
(with-open-file (str cbright-file
:direction :IO
:if-exists :OVERWRITE
:if-does-not-exist :CREATE)
(let* ((file-bright (read-line str nil))
(file-brightN (if file-bright
(parse-integer file-bright)
50))
(increment (if up step (- step))))
(setq next-brightN (+ file-brightN increment)))
(file-position str 0)
(write-line (format nil "~D" next-brightN) str))
(run-shell-command
(format nil
"xrandr --output ~A --brightness ~1,2F"
outdevice
(/ next-brightN 100))))))))
called by
(defcommand brightness-up () () (brightness t 5))
(defcommand brightness-down () () (brightness nil 5))
and bound to
(define-key *top-map* (kbd "H-M-,") "brightness-down")
(define-key *top-map* (kbd "H-M-.") "brightness-up")
(define-key *top-map* (kbd "XF86AudioPrev") "exec mpc prev")
(thought I had light bound in stumpwm but don't see it right now)
XF86MonBrightnessUp
with exec light -A 5
On a different note, I am fighting with stumpwm and the ttf-fonts module on a fedora 33 system. stumpwm and all the modules were installed using the guix package manager. Currently, when I try to set the font, stumpwm tells me that it is not able to find it. However, the font files are installed in $HOME/.fonts
, I have executed fc-cache -f -v
and below is my configuration:
(load-module "ttf-fonts")
;; Next line to be used when fonts gets updated
(setf xft:*font-dirs* (list (concat (getenv "HOME") "/.guix-profile/share/fonts/")
(concat (getenv "HOME") "/.fonts/")))
(setf clx-truetype:+font-cache-filename+ (concat (getenv "HOME") "/.fonts/font-cache.sexp"))
;; (xft:cache-fonts)
;; (message xft:*font-dirs*)
(set-font (make-instance 'xft:font :family "DejaVu Sans Mono" :subfamily "Book" :size 14))
If I uncomment (xft:cache-fonts)
, the system wants, sometimes, to write into a subdirectory of a guix package in the guix store. This fails as the store is write protected.
I want to install the Nerd font version of DejaVu Sans Mono
.
On my laptop, StumpWM is installed from source and I didn't find much difficulties to load the fond except for finding the right value for the parameter :family
.
Anyone have experience with the installation of StumpWM using the the Guix package manager to install and configure StumpWM and the contribs?