;;; -*- lexical-binding: t; -*- ;;; Commentary: ;; modified version of https://github.com/lucasgruss/exwm-outer-gaps ;;; Code: (require 'exwm-workspace) (require 'exwm-core) (require 'exwm) (require 'xelb) (require 'xcb) (defgroup exwm-outer-gaps nil "Outer gaps for exwm." :group 'appearance :prefix "exwm-outer-gaps") (defcustom exwm-outer-gaps-width 15 "Width between the edge of the monitor and emacs frame for all sides.") (defcustom exwm-outer-gaps-increment-step 5 "Default increment/decrement value for gaps.") (defcustom exwm-outer-max-gaps-width (* exwm-outer-gaps-increment-step 20) "The maximum size of the gaps.") (defun exwm-outer-gaps-compute-gaps () "Hook to be ran after exwm-workspace--update-workareas-hook" (let (workareas frames) (dolist (w exwm-workspace--workareas) (setf (aref w 3) (+ (aref w 3) exwm-outer-gaps-width) (aref w 4) (+ (aref w 4) exwm-outer-gaps-width) (aref w 5) (- (aref w 5) (* 2 exwm-outer-gaps-width)) (aref w 6) (- (aref w 6) (* 2 exwm-outer-gaps-width)))))) (defun exwm-outer-gaps-apply () "Function used to apply gaps to the emacs frames." (exwm-workspace--update-workareas) (dolist (f exwm-workspace--list) (exwm-workspace--set-fullscreen f))) (defun exwm-outer-gaps-set (width) "Sets the gap width to WIDTH. Automatically clamps the size of the gaps from 0 to `exwm-outer-max-gaps-width'" (setq exwm-outer-gaps-width (max 0 (min width exwm-outer-max-gaps-width)))) (defun exwm-outer-gaps-increment () "Increment the outer gaps by exwm-outer-gaps-increment-step" (interactive) (when exwm-outer-gaps-mode (exwm-outer-gaps-set (+ exwm-outer-gaps-width exwm-outer-gaps-increment-step)) (exwm-outer-gaps-apply))) (defun exwm-outer-gaps-decrement () "Decrement the outer gaps by exwm-outer-gaps-increment-step" (interactive) (when exwm-outer-gaps-mode (exwm-outer-gaps-set (- exwm-outer-gaps-width exwm-outer-gaps-increment-step)) (exwm-outer-gaps-apply))) ;;;###autoload (define-minor-mode exwm-outer-gaps-mode "Add useless outer gaps to exwm." :global t (if exwm-outer-gaps-mode (add-hook 'exwm-workspace--update-workareas-hook #'exwm-outer-gaps-compute-gaps) (remove-hook 'exwm-workspace--update-workareas-hook #'exwm-outer-gaps-compute-gaps)) (exwm-outer-gaps-apply)) (provide 'exwm-outer-gaps)