Git Product home page Git Product logo

dispwatch's Introduction

MELPA

Emacs dispwatch

This package watches the current display configuration (name, pixel width and height, physical dimensions, and work area) and gives your hook a call if it changes. Intended use case is plugging/unplugging a monitor.

Usage

Require or use-package this. Make a hook function which takes one argument, a pair of pixel width and height, like (1024 . 768), then add your hook to dispwatch-display-change-hooks. You will get called when that changes, eg by removing or adding a monitor. Then call (dispwatch-mode 1) to get started and (dispwatch-mode -1) to stop. (dispwatch-mode) toggles.

Example

(defun my-display-changed-hook (disp)
  (message "rejiggering for %s" disp)
  (cond ((equal disp '(3840 . 1080))   ; laptop + ext monitor
         (setq font-size-pt 10))
        ((equal disp '(1920 . 1080))    ; just laptop
         (setq font-size-pt 11))
        (t (message "Unknown display size %sx%s" (car disp) (cdr disp)))))

(use-package dispwatch
  :config (and
      (add-hook 'dispwatch-display-change-hooks #'my-display-changed-hook)
      (dispwatch-mode 1)))

TODO

  • This could be included as part of ewmctrl, more generally saving and restoring different sets of window configurations as the geometry changes. I have an open issue with those guys to discuss. Alternatively, this package can also stand by itself and be used by a window saver/restorer.

dispwatch's People

Contributors

jcs090218 avatar mnp avatar zenspider avatar

Watchers

 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.