Coder Social home page Coder Social logo

exwm-outer-gaps's Introduction

EXWM-outer-gaps

Introduction

A lot of window managers provide a feature called “gaps”. It is useless, it is pretty but most importantly it is a feature. And therefore Emacs must have it. Sorry, I don’t make the rules.

This package provides a minor mode to have outer gaps around the workspaces, and some utility functions to control them.

It’s my first elisp package, and I wanted to try my hand at something rather easy. If the code sucks, don’t hesitate to open an issue and tell me why (in fact, please do !).

screenshot.png

Installation

I might go the extra mile and submit it to MELPA someday, but in the meantime I suggest using straight. I personally use Doom Emacs, which has its own package manager based on straight. I have the following in my configuration:

;; in packages.el
(package! exwm-outer-gaps
  :recipe
  (:host github
   :repo "lucasgruss/exwm-outer-gaps"))

;; in config.el
(use-package exwm-outer-gaps
  :after (exwm xelb)
  :config
  (exwm-outer-gaps-mode +1))

I also bind exwm-outer-gaps-mode to a keybinding in order to easily toggle the mode and change dimensions of the gaps.

;; in your config for exwm, you can adapt exwm-input-global-keys
(setq exwm-input-global-keys
      `( ;; ...
        ([?\s-O]  . exwm-outer-gaps-mode)
        ([?\s-p]  . exwm-outer-gaps-increment)
        ([?\s-y]  . exwm-outer-gaps-decrement)
        ;; ...
        ))

Each gap can be set/incremented individually. In my configuration, I also leverage hercules.el in order to create a “menu” that can be invoked to set each gap interactively.

(defvar exwm-outer-gaps-keymap nil
  "keymap to resize gaps")
(setq exwm-outer-gaps-keymap (make-sparse-keymap))

;; map! is a doom specific macro
(map! (:map exwm-outer-gaps-keymap
       :desc "Decrease left" "h" (lambda () (interactive) (exwm-outer-gaps-decrement 0))
       :desc "Increase left" "H" (lambda () (interactive) (exwm-outer-gaps-increment 0))
       :desc "Decrease right" "l" (lambda () (interactive) (exwm-outer-gaps-decrement 1))
       :desc "Increase right" "L" (lambda () (interactive) (exwm-outer-gaps-increment 1))
       :desc "Decrease top" "k" (lambda () (interactive) (exwm-outer-gaps-decrement 2))
       :desc "Increase top" "K" (lambda () (interactive) (exwm-outer-gaps-increment 2))
       :desc "Decrease bottom" "j" (lambda () (interactive) (exwm-outer-gaps-decrement 3))
       :desc "Increase bottom" "J" (lambda () (interactive) (exwm-outer-gaps-increment 3))))

(hercules-def
 :toggle-funs (defun lg/exwm-outer-gaps-menu () (interactive))
 :keymap 'exwm-outer-gaps-keymap
 :transient t)

How it works

There is nothing to write home about, exwm comes with all the facility to implement this. For each exwm workspace (i.e. non-floating frame), there is a workarea that sets its geometry. Usually, each workarea takes up the whole screen/monitor but exwm provides exwm-workspace--update-workareas-hooks that we can use to add gaps.

Since we only have control over the geometry of the frame, the gaps provided by this package are only “outer gaps”, which means that “inner gaps” (gaps between emacs windows) is out of scope for this package. I do intend to write a package for inner gaps in the future by leveraging window-divider-mode and xcb-shape from xelb.

Each side (left, right, top and bottom) has its own gap, so there is some level of granularity available.

There are three user-facing functions that are exwm-outer-gaps-increment, exwm-outer-gaps-decrement and exwm-outer-gaps-balance, which respectively increment all four gaps at the same time, decrement all four gaps and balance all four gaps to be the same width (in case gaps where changed to not be all equal).

exwm-outer-gaps's People

Contributors

walseb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.