Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Moom port to Emacs - Make your dominant hand FREE from your mouse

License

NotificationsYou must be signed in to change notification settings

takaxp/moom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://melpa.org/packages/moom-badge.svg

Make your dominant hand FREE from your mouse :)

Setup

After installingmoom.el andmoom-font.el (optional), activatemoom by(moom-mode 1) in yourinit.el. This module requiresGNU Emacs25.1 or later.

(with-eval-after-load"moom";; add settings here ...;; (setq moom-use-font-module nil)  (moom-mode1))

or

(when (require'moomnilt);; add settings here ...;; (setq moom-use-font-module nil)  (moom-mode1))

If you don’t want to change font size when resizing frame size, please configuremoom-use-font-module before activatingmoom-mode by(moom-mode 1).

Note

moom can display a command list supported bytransient.el. Seetransient.el support section.

A set of commands to control frame position and size by keyboard

https://github.com/takaxp/contents/blob/master/moom/demo1.gif

Note - This module has basically been tested on macOS High Sierra, Catalina, BigSur, andMonterey with combinations of two Full HD (1920x1080) monitors and one 4K monitor. Additionally, tested in Windows 10 and Linux (Ubuntu 20.04 with Emacs 26.3, CentOS 8.2, and openSUSE 15.1) with GTK, but they may still have some issues.

Move

  • moom-move-frame

Horizontal shift

  • moom-move-frame-left
  • moom-move-frame-right

Centering

  • moom-move-frame-to-center
  • moom-move-frame-to-vertical-center
  • moom-move-frame-to-horizontal-center

Fit

edge

  • moom-move-frame-to-edge-top
  • moom-move-frame-to-edge-left
  • moom-move-frame-to-edge-right
  • moom-move-frame-to-edge-bottom

center line

  • moom-move-frame-to-centerline-from-top
  • moom-move-frame-to-centerline-from-left
  • moom-move-frame-to-centerline-from-right
  • moom-move-frame-to-centerline-from-bottom

Expand

These functions will not change font size in a frame.

  • moom-change-frame-width-single
  • moom-change-frame-width-double
  • moom-change-frame-width-half-again
  • moom-change-frame-width
  • moom-change-frame-height
  • moom-cycle-frame-height
  • moom-change-frame-width-max (moom-fill-width)
  • moom-change-frame-height-max (moom-fill-height)

split and delete window

  • moom-split-window
  • moom-delete-windows

Fill screen

These functions normally change font size in a frame. But the behavior can be changed byM-x moom-toggle-font-module.

  • moom-fill-screen
  • moom-fill-band
  • moom-fill-top
  • moom-fill-bottom
  • moom-fill-left
  • moom-fill-right
  • moom-fill-top-left
  • moom-fill-top-right
  • moom-fill-bottom-left
  • moom-fill-bottom-right

Note - If you find any problems around font settings when resizing the Emacs frame, you can easily disable the feature inmoom-font.el. Just changemoom-use-font-module to nil in your init.el.M-x moom-toggle-font-module can also control if the font module is utilized or not.

(with-eval-after-load"moom"  (setq moom-use-font-modulenil))

Other functions

  • moom-reset
  • moom-undo
  • moom-update-height-steps
  • moom-check-user-margin
  • moom-update-user-margin
  • moom-identify-current-monitor
  • moom-print-monitors
  • moom-jump-to-monitor
  • moom-cycle-monitors
  • moom-restore-last-status
  • moom-toggle-font-module
  • moom-toggle-frame-maximized
  • moom-cycle-line-spacing
  • moom-reset-line-spacing
  • moom-generate-font-table
  • moom-print-status
  • moom-version

(obsoleted)

  • moom-screen-margin (was replaced with moom-check-user-margin)

How to setup screen margins

For macOS users, the default margin is(23 0 0 0). And for other system types, it is also automatically configured using combination offrame-monitor-geometry andframe-monitor-workarea whenmoom-mode is activated. But the actual work area is probably depends on user environment. Therefore,moom.el provides a capability that you can control the actual active region on your screen by settingmoom-user-margin in init.el.

(setq moom-user-margin '(50505050));; {top, bottom, left, right}(moom-mode1)

Each value means a margin from thetop,bottom,left, andright edge of your screen. If you want to test some combinations of the margins, thenM-x moom-check-user-margin could be helpful since it provides an interactive way to check the actual region on a screen and save the tested value for the Emacs session.

It is also useful to usemoom-update-user-margin directly by putting new margin or interactively. Note thatmoom-check-user-margin internally callsmoom-update-user-margin.

(moom-update-user-margin '(50505050));; {top, bottom, left, right}

Themoom-check-user-margin andmoom-update-user-margin will changemoom-user-margin in an Emacs session, however, the updated margins will NOT be saved as a permanent value, so please configure the margins in your init.el explicitly for the next session.

Extension to integrate font resizing

No need to loadmoom-font.el explicitly. If the package is installed in your system, then it will be activated automatically. The package is basically provided for the users who rely on Japanese fonts. And if you will never user the font module without deletingmoom-font.el, please configuremoom-use-font-module to nil before activatingmoom-mode by(moom-mode 1).

https://github.com/takaxp/contents/blob/master/moom/demo2.gif

Setting

Font names for ASCII and Japanese font are now automatically identified without user action whenmoom-mode is activated. Butmoom-font-ascii-scale andmoom-font-ja-scale should be configured still manually according to your environment. If you don’t satisfy the automatically configured setting for ASCII and Japanese font, then please set these parameters manually by functions ofmoom-font-ascii ormoom-font-ja.

The default values formoom-font-ascii-scale andmoom-font-ja-scale are1.0 and1.2 respectably. The scaling factors for each font are integrated intoface-font-rescale-alist properly.

If you don’t know which fonts are used in Emacs frame, you can easily check them byM-x moom-font-print-name-at-point orM-x describe-char on a character.

The following text is an example message when you typeM-x moom-font-print-name-at-point.

[moom-font] It’s "Menlo". Call ‘moom-font-ja’ or ‘moom-font-ascii’ with "Menlo".

After you identify the font names in a buffer, then please configure them as follows:

(with-eval-after-load"moom-font"  (setq moom-font-ascii-scale1.0)  (setq moom-font-ja-scale1.2)  (moom-font-ascii"Menlo");; Ricty Diminished, Inconsolata  (moom-font-ja"Migu 2M"));; Hiragino Maru Gothic Pro

Normally, ASCII and Japanese fonts will be updated when resizing fonts. But if you provide an optional argument tomoom-font-ascii ormoom-font-ja, the given font is immediately applied and reflected in each buffer. See the following example setting.

(with-eval-after-load"moom-font"  (moom-font-ascii"Menlo" '(:immediatet))  (moom-font-ja"Migu 2M" '(:immediatet)))

When you find the column exceeds 80 when the frame is maximized, then configuremoom-scaling-gradient properly. It depends on ASCII font type. For instance,1.66 (default) for Menlo, Monaco,2.0 for Inconsolata, MS Gothic, and TakaoGothic. Please see the following section.

Font table

You can also useM-x moom-generate-font-table to identify appropriate values ofmoom-scaling-gradient, and additionallymoom-font-table. After callingmoom-generate-font-table, the current buffer will be changed to the*moom-font* buffer. Please follow the instructions described in that buffer.

Here is an example.Monaco is used for ASCII font andMigu 2M is used for Japanese font in these images. The upper image shows a gap between strings in ASCII and Japanese at the first line, the font table is not defined in this case. On the other hand, the lower image shows no gap since the font table is utilized to identify the correct size of font. You can freely customize the font table in you init.el for your convenience.

https://github.com/takaxp/contents/blob/master/moom/monaco-13pt8px.png

https://github.com/takaxp/contents/blob/master/moom/monaco-14pt8px.png

Resize font

  • moom-font-increase
  • moom-font-decrease
  • moom-font-resize
  • moom-font-size-reset

Font setting

  • moom-font-ja
  • moom-font-ascii

Other functions

  • moom-font-print-name-at-point

User variables

moom.el

defaulttype
moom-move-frame-pixel-offset‘(0 . 0)sexp
moom-min-frame-height16integer
moom-init-line-spacingline-spacingfloat
moom-min-line-spacing0.1float
moom-max-line-spacing0.8float
moom-frame-width-single80integer
moom-frame-width-double163integer
moom-horizontal-shifts‘(200 200)choice
moom-fill-band-options’(:direction vertical :range 50.0)plist
moom-scaling-gradient1.66float
moom-moom-display-line-numbers-width6integer
moom-command-with-centering‘(split delete)list
moom-user-margin‘(0 0 0 0)list
moom-use-font-moduletboolean
moom-command-history-length100integer
moom-verbosenilboolean
moom-lighterMoomstring

moom-command-with-centering

The following commands will centerize the frame position in display ifmoom-command-with-centering includes the corresponding values. If you specifynil then no commands will centerize the frame.

ValueCommand
splitmoom-split-window
deletemoom-delete-windows
singlemoom-change-frame-width-single
doublemoom-change-frame-width-double
half-againmoom-change-frame-width-half-again

moom-font.el

defaulttype
moom-font-ja-scale1.2float
moom-font-ascii-scale1.0float
moom-font-tablenil(repeat (list integer integer))
moom-font-verbosenilboolean

Note -(breaking changes at v1.2.1)moom-font-init-size was hidden. The size is now automatically detected. If you want to use customized variable, please usemoom-font-ascii with:size option like(moom-font-ascii "Inconsolata" :size 14).

Note -(breaking changes at v1.2.0) Variables ofmoom-font-ascii andmoom-font-ja were hidden so that font settings could be controlled conveniently by utility functions. Please utilize each function of the same name to setup fonts.

moom-transient.el

defaulttype
moom-transient-dispatch-stickytboolean

Example keybindings

Overview

In general,Cmd-<TAB> is used to switch windows, which is not limited to Emacs.app. So it is natural to concentrate all keybindings associated to control frame position and size into the left side of your keyboard with pressingCmd. The following example keybindings are basically designed in that manner.

https://github.com/takaxp/contents/blob/master/moom/layout.png

You can usemoom-recommended-keybindings to set keybindings for each API in a bundle. The function require a list argument orall. The list can contain multiple API types. When the argument is(move fit expand fill font reset undo) , it is identical toall.

(with-eval-after-load"moom"  (moom-recommended-keybindings '(move fit expand fill font reset undo)));; 'all

Note: If you don’t want to rely on using function key to execute a moom command, then add awof option formoom-recommended-keybindings as follows:

(with-eval-after-load"moom"  (moom-recommended-keybindings '(all wof)));; wof: WithOut Function key
commandwithout wofwith wof
moom-move-frame-to-edge-leftM-<f1>C-c e l
moom-move-frame-to-edge-rightM-<f3>C-c e r
moom-move-frame-to-edge-top<f1>C-c e t
moom-move-frame-to-edge-bottomS-<f1>C-c e b
moom-cycle-frame-height<f2>C-2
moom-toggle-frame-maximizedM-<f2>C-c f f x

Move

https://github.com/takaxp/contents/blob/master/moom/shifts.gifhttps://github.com/takaxp/contents/blob/master/moom/move-right.gifhttps://github.com/takaxp/contents/blob/master/moom/center.gif

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"M-0")'moom-move-frame);; to top left corner  (define-key moom-mode-map (kbd"M-1")'moom-move-frame-left)  (define-key moom-mode-map (kbd"M-2")'moom-move-frame-to-center)  (define-key moom-mode-map (kbd"M-3")'moom-move-frame-right))

Fit

https://github.com/takaxp/contents/blob/master/moom/edges.gifhttps://github.com/takaxp/contents/blob/master/moom/corners.gif

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"M-<f1>")'moom-move-frame-to-edge-left)  (define-key moom-mode-map (kbd"M-<f3>")'moom-move-frame-to-edge-right)  (define-key moom-mode-map (kbd"<f1>")'moom-move-frame-to-edge-top)  (define-key moom-mode-map (kbd"S-<f1>")'moom-move-frame-to-edge-bottom))

Additionally, move onto the center line.

https://github.com/takaxp/contents/blob/master/moom/centerline.gif

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"C-c f c l")'moom-move-frame-to-centerline-from-left)  (define-key moom-mode-map (kbd"C-c f c r")'moom-move-frame-to-centerline-from-right)  (define-key moom-mode-map (kbd"C-c f c t")'moom-move-frame-to-centerline-from-top)  (define-key moom-mode-map (kbd"C-c f c b")'moom-move-frame-to-centerline-from-bottom))

Expand

https://github.com/takaxp/contents/blob/master/moom/cycle-height.gifhttps://github.com/takaxp/contents/blob/master/moom/expand.gif

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"<f2>")'moom-cycle-frame-height)  (define-key moom-mode-map (kbd"C-c f s")'moom-change-frame-width-single)  (define-key moom-mode-map (kbd"C-c f d")'moom-change-frame-width-double)  (define-key moom-mode-map (kbd"C-c f a")'moom-change-frame-width-half-again)  (define-key moom-mode-map (kbd"C-c f S")'moom-split-window)  (define-key moom-mode-map (kbd"C-c f D")'moom-delete-windows)  (define-key moom-mode-map (kbd"C-c f w")'moom-change-frame-width-max)  (define-key moom-mode-map (kbd"C-c f h")'moom-change-frame-height-max))

Fill

https://github.com/takaxp/contents/blob/master/moom/fill.gifhttps://github.com/takaxp/contents/blob/master/moom/quarters.gif

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"C-c f f t")'moom-fill-top)  (define-key moom-mode-map (kbd"C-c f f b")'moom-fill-bottom)  (define-key moom-mode-map (kbd"C-c f f l")'moom-fill-left)  (define-key moom-mode-map (kbd"C-c f f r")'moom-fill-right)  (define-key moom-mode-map (kbd"C-c f f 1")'moom-fill-top-left)  (define-key moom-mode-map (kbd"C-c f f 2")'moom-fill-top-right)  (define-key moom-mode-map (kbd"C-c f f 3")'moom-fill-bottom-left)  (define-key moom-mode-map (kbd"C-c f f 4")'moom-fill-bottom-right)  (define-key moom-mode-map (kbd"C-c f f m")'moom-fill-band);; (define-key moom-mode-map (kbd "C-c f f w") 'moom-fill-width);; (define-key moom-mode-map (kbd "C-c f f h") 'moom-fill-height))

Fill (screen by toggle)

https://github.com/takaxp/contents/blob/master/moom/fill-screen.gif

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"M-<f2>")'moom-toggle-frame-maximized))

Note: When maximizing a frame,moom-fill-screen is called internally.

Reset, resize, and undo

Reset Frame size, position, and font size

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"C-c C-0")'moom-reset))

Undo command history

moom stores command history. The maximum numbers of the history is limited bymoom-command-history-length. The default value is 1000.

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"C-c C-/")'moom-undo))

Font size (require moom-font.el)

(with-eval-after-load"moom"  (define-key moom-mode-map (kbd"C--")'moom-font-decrease)  (define-key moom-mode-map (kbd"C-=")'moom-font-increase)  (define-key moom-mode-map (kbd"C-0")'moom-font-size-reset)  (define-key moom-mode-map (kbd"C-_")'text-scale-decrease);; built-in for ascii  (define-key moom-mode-map (kbd"C-+")'text-scale-increase);; built-in for ascii;; Recommended for stable presentation during font size increasing  (add-hook'moom-font-after-resize-hook#'moom-move-frame-to-edge-top))

transient.el support

moom-transient.el provides a dispatcher to select a moom command listed in a popup menu. To usemoom-transient.el, please put the following code (below the figure) to your init.el. The keybind(C-c o) should be changed for your environment. The module depends ontransient.el, so please install it first.

https://github.com/takaxp/contents/blob/master/moom/transient.png

(with-eval-after-load"moom"  (when (require'moom-transientnilt)    (moom-transient-hide-cursor);; if needed    (define-key moom-mode-map (kbd"C-c o")#'moom-transient-dispatch)))

The dispatcher (moom-transient-dispatch) keeps the menu window after a command is executed as default. If you like to hide the dispatcher each time, then please configuremoom-transient-dispatch-sticky.

Collaboration with other packages

Org mode (org-agenda)

Expand the frame width temporarily during org-agenda is active.

https://github.com/takaxp/contents/blob/master/moom/org-agenda.gif

(with-eval-after-load"moom"  (with-eval-after-load"org"    (add-hook'org-agenda-mode-hook#'moom-change-frame-width-half-again)    (defunadvice:org-agenda--quit (&optional_bury)      (moom-change-frame-width))    (advice-add'org-agenda--quit:after#'advice:org-agenda--quit)))

Org mode (org-tree-slide)

Entering quickly to the frame maximized presentation withorg-tree-slide.el. No additional settings are required except activating moom-mode by(moom-mode 1). JustM-x moom-toggle-frame-maximized. The font is automatically scaled to be maintained the frame width at 80 even if you use Japanese font.

https://github.com/takaxp/contents/blob/master/moom/org-tree-slide.gif

Org mode

Note -Under consideration, but you can try.

Runorg-redisplay-inline-images after font resizing to synchronize the image width and font size automatically.

(with-eval-after-load"moom"  (with-eval-after-load"org"    (add-hook'moom-font-after-resize-hook#'org-redisplay-inline-images)))

Hooks

  • moom-before-fill-screen-hook
  • moom-after-fill-screen-hook
  • moom-resize-frame-height-hook
  • moom-split-window-hook
  • moom-delete-window-hook
  • moom-before-setup-hook
  • moom-after-select-monitor-hook
  • moom-font-before-resize-hook (in moom-font.el)
  • moom-font-after-resize-hook (in moom-font.el)

Acknowledgment

This package is highly inspired from“Moom” released byMany Tricks. Moom stands for “Mo”ve and zo”om”. Cool!

If you like and need the capabilities of changing window position and size by keyboard at the OS level, buyMoom now!

Keycastr

For writing README,keycastr was utilized to capture keystrokes of each command. Thanks! butShift+F1 was recorded as?. Haha… :p

Related packages

  1. frame-cmds.el
    • This package provides many fundamental APIs to control frame and window. If you want to control them more specifically and precisely, you may want to try this nice package. But the license is not open and not distributed through MELPA.
  2. presentation.el
    • It is highly recommended to try this vital package to scale and restore text size easily for nice viewing when you present your source code rendered in the Emacs buffers. Find more details at the above repository.

About

A Moom port to Emacs - Make your dominant hand FREE from your mouse

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp