On Wednesday, 31 Aug 2022 at 11:39, David wrote: > Is it worth a PR on the main repo? I’d welcome merging it if so.
I don't know but I'm happy to share the code and let others decide and/or incorporate it as I'm sure it could be improved and brought in line with the main StumpWM code. I'm still very much a n00b when it comes to the variant of Lisp for StumpWM (having only Emacs Lisp experience these days although I did learn Lisp in the 70s... ;-)). Anyway, the code: --8<---------------cut here---------------start------------->8--- ;; function to move windows around using the keyboard as the above did ;; not (does not?) work. The esf-move-window function moves the ;; current window by the number of pixels given, for both x and y ;; directions. The function is invoked by the keystrokes in the ;; interactive keymap, esf-move, which is called up by invoking it as ;; a command. Finally, I map C-t M to esf-move. The function & ;; keymap could be improved by giving some visual feedback to indicate ;; that we are still in a move operation but I don't know how to do ;; that (yet). (defcommand (esf-move-window float-group) (dx dy) ((:number "dX = ") (:number "dY = ")) (let* ((window (current-window)) (parent (window-parent window)) ;; (width (xlib:drawable-width parent)) ;; (height (xlib:drawable-height parent)) (x (xlib:drawable-x parent)) (y (xlib:drawable-y parent))) (float-window-move-resize window :x (+ x dx) :y (+ y dy)))) ;; the interactive keymap allows specifying setup, exit, and abort ;; functions. I don't have anything to do at the moment in those ;; cases and maybe do not have to specify any but I specify one just ;; in case and to remember how to specify these (defun esf-move-setup ()) ;; the actual interactive keymap for moving the window. Default is 10 ;; pixels in either direction or 100 with Shift on the same keys. I ;; use arrow and vi movement keys. (define-interactive-keymap (esf-move float-group) (:on-enter #'esf-move-setup) ((kbd "Up") "esf-move-window 0 -10") ((kbd "S-Up") "esf-move-window 0 -100") ((kbd "k") "esf-move-window 0 -10") ((kbd "K") "esf-move-window 0 -100") ((kbd "Down") "esf-move-window 0 10") ((kbd "S-Down") "esf-move-window 0 100") ((kbd "j") "esf-move-window 0 10") ((kbd "J") "esf-move-window 0 100") ((kbd "Left") "esf-move-window -10 0") ((kbd "S-Left") "esf-move-window -100 0") ((kbd "h") "esf-move-window -10 0") ((kbd "H") "esf-move-window -100 0") ((kbd "Right") "esf-move-window 10 0") ((kbd "S-Right") "esf-move-window 100 0") ((kbd "l") "esf-move-window 10 0") ((kbd "L") "esf-move-window 100 0")) ;; bind the interactive keymap to a key in the float group (define-key stumpwm::*float-group-root-map* (kbd "M") "esf-move") --8<---------------cut here---------------end--------------->8--- -- Eric S Fraga via gnus (Emacs 29.0.50 2022-08-16) on Debian 11.4