Function: modifier-bar-mode
modifier-bar-mode is an interactive and byte-compiled function defined
in tool-bar.el.gz.
Signature
(modifier-bar-mode &optional ARG)
Documentation
Toggle display of the key-modifier tool bar.
When enabled, a small tool bar will be displayed in addition to the regular tool bar, containing buttons for key modifiers such as Ctrl, Shift, Alt, etc. This is useful on terminals whose keyboard has no keys for these modifiers, such as smartphones and other devices with small keyboards.
This is a global minor mode. If called interactively, toggle the
Modifier-Bar mode mode. If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate (default-value \=modifier-bar-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
Probably introduced at or before Emacs version 30.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/tool-bar.el.gz
(define-minor-mode modifier-bar-mode
"Toggle display of the key-modifier tool bar.
When enabled, a small tool bar will be displayed in addition to the
regular tool bar, containing buttons for key modifiers such as
Ctrl, Shift, Alt, etc. This is useful on terminals whose keyboard
has no keys for these modifiers, such as smartphones and other
devices with small keyboards."
:init-value nil
:global t
:group 'tool-bar
(if modifier-bar-mode
(progn
(setq secondary-tool-bar-map
;; The commands specified in the menu items here are not
;; used. Instead, Emacs relies on each of the tool bar
;; events being specified in `input-decode-map'.
`(keymap (control menu-item "Control Key"
event-apply-control-modifier
:help "Add Control modifier to the following event"
:image ,(tool-bar--image-expression "ctrl")
:enable (modifier-bar-available-p 'control))
(shift menu-item "Shift Key"
event-apply-shift-modifier
:help "Add Shift modifier to the following event"
:image ,(tool-bar--image-expression "shift")
:enable (modifier-bar-available-p 'shift))
(meta menu-item "Meta Key"
event-apply-meta-modifier
:help "Add Meta modifier to the following event"
:image ,(tool-bar--image-expression "meta")
:enable (modifier-bar-available-p 'meta))
(alt menu-item "Alt Key"
event-apply-alt-modifier
:help "Add Alt modifier to the following event"
:image ,(tool-bar--image-expression "alt")
:enable (modifier-bar-available-p 'alt))
(super menu-item "Super Key"
event-apply-super-modifier
:help "Add Super modifier to the following event"
:image ,(tool-bar--image-expression "super")
:enable (modifier-bar-available-p 'super))
(hyper menu-item "Hyper Key"
event-apply-hyper-modifier
:help "Add Hyper modifier to the following event"
:image ,(tool-bar--image-expression "hyper")
:enable (modifier-bar-available-p 'hyper))))
(define-key input-decode-map [tool-bar control]
#'tool-bar-event-apply-control-modifier)
(define-key input-decode-map [tool-bar shift]
#'tool-bar-event-apply-shift-modifier)
(define-key input-decode-map [tool-bar meta]
#'tool-bar-event-apply-meta-modifier)
(define-key input-decode-map [tool-bar alt]
#'tool-bar-event-apply-alt-modifier)
(define-key input-decode-map [tool-bar super]
#'tool-bar-event-apply-super-modifier)
(define-key input-decode-map [tool-bar hyper]
#'tool-bar-event-apply-hyper-modifier))
(setq secondary-tool-bar-map nil))
;; Update the mode line now.
(force-mode-line-update t))