(defun ctwm-restart (frame) (let ((pos (frame-position frame))) (when (and (not (eq (frame-parameter frame 'fullscreen) 'fullboth)) (< (car pos) 0) (< (cdr pos) 0) (>= (frame-outer-width frame) (display-pixel-width)) (>= (frame-outer-height frame) (display-pixel-height))) (set-frame-parameter frame 'fullscreen nil) (modify-frame-parameters frame `((width . ,(display-pixel-width)) (height . ,(display-pixel-height)))) (toggle-frame-fullscreen)))) (add-hook 'window-size-change-functions 'ctwm-restart)