Heia Daniel, I had a small addendum to the code I sent you; specifically this will toggle the mode line on enabling the minor mode we defined so that it automatically switches to a floating mode line immediately.
``` lisp (defun %ensure-mode-line (sym obj) (declare (ignore sym)) (stumpwm::toggle-mode-line (stumpwm:group-screen obj) (stumpwm::group-current-head obj)) (xlib:display-finish-output stumpwm::*display*)) (defun ensure-mode-line (sym obj) (declare (ignore sym)) (let ((ml (stumpwm::head-mode-line (stumpwm:group-current-head obj)))) (when (and ml (not (eql (stumpwm::mode-line-mode ml) :hidden))) (stumpwm::toggle-mode-line (stumpwm:group-screen obj) (stumpwm::group-current-head obj)) (xlib:display-finish-output stumpwm::*display*) (stumpwm::toggle-mode-line (stumpwm:group-screen obj) (stumpwm::group-current-head obj)) (xlib:display-finish-output stumpwm::*display*)))) (stumpwm:add-hook *floating-mode-line-group-enable-hook* 'ensure-mode-line) (stumpwm:add-hook *floating-mode-line-group-disable-hook* '%ensure-mode-line) ``` s...@posteo.net writes: > Hi Daniel, > >> Ill let you know what I find once I have some time on my hands. > > I found a way to have a semi-floating mode line. It probably isn't > exactly what you're looking for, but may give you some ideas to go off > of. The code is at the bottom of this email. > > The way this works is to define methods for calculating the display y > and height of a frame, and removing the height of the mode line from > those calculations. Then the make- and toggle-mode-line functions are > changed to place the mode line above other windows instead of below. > > I defined all of this in a minor mode so that its easy to enable/disable > the functionality. The minor mode is scoped to tile groups only, and is > global so it is enabled in all tile groups at once. I also bound super-m > to the mode-line command. > > Because this modifies functions, a patch may be in order to change the > functions make-mode-line and toggle-mode-line to either be generics so > we can specialise on our minor mode class, or providing a function to > compute whether they should be placed :above or :below other windows; > regardless because we are redefining functions any future changes to > those functions would need to be patched back into our code. > > Hopefully this is helpful > --LF > > ``` lisp > (uiop:define-package #:swm/floating-mode-line > (:use :cl)) > > (in-package #:swm/floating-mode-line) > > (stumpwm:define-minor-mode floating-mode-line-group () () > (:scope :tile-group) > (:global t) > (:expose-keymaps t) > (:lighter "FML") > (:interactive FLOAT-MODE-LINE-MODE) > (:make-hooks t) > (:top-map '(("s-m" . "mode-line")))) > > (defmethod stumpwm::frame-display-y ((group floating-mode-line-group) frame) > (let ((res (call-next-method)) > (h (stumpwm::frame-head group frame))) > (if (and (stumpwm::head-mode-line h) > (not (eql (stumpwm::head-mode-line h) :hidden)) > (eql (stumpwm::mode-line-position (stumpwm::head-mode-line h)) > :top)) > (- res (stumpwm::mode-line-height (stumpwm::head-mode-line h))) > res))) > > (defmethod stumpwm::frame-display-height ((group floating-mode-line-group) > frame) > (let* ((res (call-next-method)) > (h (stumpwm::frame-head group frame))) > (if h > (let ((ml (stumpwm::head-mode-line h))) > (if ml > (+ res (stumpwm::mode-line-height ml)) > res)) > res))) > > (defun mode-line-type () > (if (member 'SWM/FLOATING-MODE-LINE::FLOATING-MODE-LINE-GROUP > stumpwm::*active-global-minor-modes*) > :above > :below)) > > (in-package :stumpwm) > > (defun make-mode-line (screen head format) > (let* ((window (make-mode-line-window screen)) > (gc (make-mode-line-gc window screen)) > (cc (make-mode-line-cc window screen gc)) > (mode-line (%make-mode-line :window window > :screen screen > :head head > :format format > :position *mode-line-position* > :cc cc))) > (prog1 mode-line > (push mode-line *mode-lines*) > (update-mode-line-color-context mode-line) > (resize-mode-line mode-line) > (xlib:map-window window) > (setf (xlib:window-priority window) > (SWM/FLOATING-MODE-LINE::mode-line-type)) > (redraw-mode-line mode-line) > (dformat 3 "modeline: ~s~%" mode-line) > (turn-on-mode-line-timer) > (run-hook-with-args *new-mode-line-hook* mode-line)))) > > (defun toggle-mode-line (screen head > &optional (format '*screen-mode-line-format*)) > "Toggle the state of the mode line for the specified screen" > (check-type format (or symbol list string)) > (let ((ml (head-mode-line head))) > (if ml > (case (mode-line-mode ml) > (:visible > ;; Hide it. > (setf (mode-line-mode ml) :hidden) > (xlib:unmap-window (mode-line-window ml))) > (:hidden > ;; Show it. > (setf (mode-line-mode ml) :visible) > (xlib:map-window (mode-line-window ml)) > (setf (xlib:window-priority (mode-line-window ml)) > (SWM/FLOATING-MODE-LINE::mode-line-type))) > (:stump > ;; Delete it > (destroy-mode-line ml))) > (make-mode-line screen head format)) > (dolist (group (screen-groups screen)) > (group-sync-head group head)))) > ```