Commit graph

493 commits

Author SHA1 Message Date
Steven Allen
f14bd2a110 Set the current buffer before handling key events
There's no guarantee that the global current buffer matches the selected
window's buffer. For example, the following  will output "*Messages*" regardless
of the actual current buffer:

  (progn
    (run-at "1 sec" nil (lambda ()
                          (with-current-buffer (get-buffer "*Messages*")
                            (sit-for 5))))
    (run-at "2 sec" nil (lambda () (message (buffer-name)))))

* exwm-input.el (exwm-input--on-KeyPress): Set the current buffer to selected
window's current buffer.
2019-10-06 08:28:03 +09:00
Chris Feng
1e9be0de38 Fix detection of `exwm-workspace--window-y-offset'
* exwm-workspace.el (exwm-workspace--update-offsets): Explicitly
request the geometry of the container for the first workspace as it
may not align with the top of the root X window.
2019-10-02 00:00:00 +00:00
Chris Feng
9eed52ee2b Avoid calling `x-focus-frame' on non-graphical frames
* exwm-workspace.el (exwm-workspace--client-p): Also account for
non-graphical frames.
* exwm-input.el (exwm-input--on-minibuffer-setup)
(exwm-input--on-minibuffer-exit): Exclude emacsclient frames.
2019-10-02 00:00:00 +00:00
Chris Feng
7778766af8 Allow customizing undetectable commands
* exwm-input.el (exwm-input-pre-post-command-blacklist): List of
commands undetectable with `post-command-hook'.
(exwm-input--on-pre-command): Use it.
2019-10-02 00:00:00 +00:00
Chris Feng
9bea3c9bcd Make input focus continue to work after EXWM exits
* exwm-input.el (exwm-input--exit): Set input focus 'revert-to' to
'PointerRoot' so that user can set input focus to X windows with
pointer after EXWM exits (and there's no other WM).
2019-09-22 00:00:00 +00:00
Chris Feng
2005fa5c5d Make _NET_ACTIVE_WINDOW working for floating X windows
* exwm.el (exwm--on-ClientMessage): Select floating frames for
floating X windows on receiving _NET_ACTIVE_WINDOW.
2019-09-22 00:00:00 +00:00
Chris Feng
9c85f172e5 Skip global keys unavailable in X server
* exwm-input.el (exwm-input--grab-global-prefix-keys): Some global
keys might not be available in X server (perhaps due to
misconfiguration).
2019-09-22 00:00:00 +00:00
Chris Feng
988f983233 Fix `exwm-layout-enlarge-window' for floating X windows
* exwm-layout.el (exwm-layout-enlarge-window): Correct the height of
outer frame.
2019-09-15 00:00:00 +00:00
Chris Feng
16d643dd3b Fix timestamp for debug logs
* exwm-core.el (exwm-debug-log-time-function): Moved to `exwm-debug'
group and set `xcb-debug:log-time-function' automatically.
(exwm-debug-log-uptime, exwm-debug-log-time): Reuse the definition
from XELB.
2019-09-15 00:00:00 +00:00
Chris Feng
559e56f473 Bump version to 0.23 2019-09-14 00:00:00 +00:00
Chris Feng
10766e232b Support starting EXWM from Emacs server not in daemon mode
* exwm.el (exwm-enable): Start EXWM from `window-setup-hook' or
`after-make-frame-functions', whichever comes first.
2019-09-14 00:00:00 +00:00
Chris Feng
f167bc979c Replace `frame-geometry'
* exwm-workspace.el (exwm-workspace--frame-y-offset)
exwm-workspace--window-y-offset, exwm-workspace--update-offsets): New
variables & function for the calculation of Emacs frame offsets, as
`frame-geometry' is not available in Emacs 24.
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--do-moveresize):
* exwm-layout.el (exwm-layout--show):
* exwm-systemtray.el (exwm-systemtray--on-workspace-switch)
(exwm-systemtray--on-randr-refresh, exwm-systemtray--init): Use them.

* exwm-systemtray.el (exwm-systemtray--refresh-all): Renamed from
`exwm-systemtray--on-randr-refresh'.
(exwm-systemtray--init, exwm-systemtray--exit): Use it.

* exwm-floating.el (exwm-floating--stop-moveresize): Send a
ConfigureNotify event to floating frame to update its position (seems
required by Emacs 24).
2019-09-14 00:00:00 +00:00
Chris Feng
eb49e57f76 Fix hiding floating X windows
* exwm-layout.el (exwm-layout--floating-hidden-position): A place far
enough from the origin to actually hide floating X window containers.
(exwm-layout--show, exwm-layout--hide): Use it.
2019-09-13 00:00:00 +00:00
Chris Feng
48b15e25ad Improve user options
* exwm-floating.el (exwm-floating-border-color)
(exwm-floating-border-width): Make changes take effect w/o restart.
(exwm-floating--init-border): Refactored out from
`exwm-floating--init'.

* exwm-workspace.el (exwm-workspace-minibuffer-position): Clarify
a restart is required.
2019-09-13 00:00:00 +00:00
Chris Feng
cb9607814f ; Autoload `exwm-enable' 2019-09-08 00:00:00 +00:00
Chris Feng
5fbf20ba16 ; Improve messages for automatically created workspaces 2019-09-08 00:00:00 +00:00
Chris Feng
ccc4cce0e0 Fix floating X window size with menu-bar/tool-bar enabled
* exwm-floating.el (exwm-floating--set-floating)
exwm-floating--do-moveresize)
exwm-layout.el (exwm-layout--show): Take menu-bar/tool-bar into
consideration.
2019-09-08 00:00:00 +00:00
Chris Feng
323e919876 ; Improve the docstring of `exwm-manage-configurations' 2019-09-08 00:00:00 +00:00
Chris Feng
6593236366 Handle and skip problematic per-application configurations
* exwm-manage.el (exwm-manage--get-configurations): Select the first
usable configuration.
2019-09-08 00:00:00 +00:00
Chris Feng
2d36241a10 Add timestamps to `exwm-debug' logs
* exwm-core.el (exwm-debug-log-time-function): New user option for
choosing the style of timestamps in debug logs.
(exwm-debug-log-uptime, exwm-debug-log-time): Possible candidates for
it.
(exwm--log): Use it.
2019-09-08 00:00:00 +00:00
Chris Feng
f303517c29 * exwm-core.el (exwm-mode-menu): Clarify simulation keys in menu. 2019-08-25 00:00:00 +00:00
Chris Feng
d63dc6a82a Ignore non-exwm-mode' buffers in exwm-workspace-move-window'
* exwm-workspace.el (exwm-workspace-move-window): Ignore
non-`exwm-mode' buffers.
2019-08-25 00:00:00 +00:00
Chris Feng
ddc22f2fed Clear echo area for input methods
* exwm-xim.el (exwm-xim--handle-forward-event-request): exwm-xim
enforces `input-method-use-echo-area' but this breaks some input
methods.  This change clear garbage printed by such input methods.
2019-08-25 00:00:00 +00:00
Chris Feng
5505cff826 Fix a lock issue with _NET_CLOSE_WINDOW and WM_DELETE_WINDOW
* exwm.el (exwm--on-ClientMessage): Calling `kill-buffer' directly
from an event context won't work since the DestroyNotify event for a
WM_DELETE_WINDOW request won't be handled until the current event
context terminates.

* exwm-manage.el (exwm-manage--kill-buffer-query-function): Avoid
potential side effects with MapWindow.
2019-08-25 00:00:00 +00:00
Chris Feng
5b9f4b0851 Make it possible to answer questions from Emacs when in char-mode
* exwm-input.el (exwm-input--echo-area-timer): New variable storing
the timer used for detecting echo area messages.
(exwm-input--on-minibuffer-setup, exwm-input--on-minibuffer-exit)
(exwm-input--on-echo-area-dirty, exwm-input--on-echo-area-clear): New
functions for grabbing/releasing keyboard when minibuffer/echo becomes
active/inactive.
(exwm-input--init, exwm-input--exit): Register/Unregister them.
(exwm-input--grab-keyboard, exwm-input--release-keyboard): Validate
buffers.
2019-08-18 00:00:00 +00:00
Chris Feng
d78c562f9a Make `exwm-manage-configurations' more user friendly
* exwm-manage.el (exwm-manage-configurations): Specify type for each
configuration option.
2019-08-11 00:00:00 +00:00
Chris Feng
a1cf0d9b85 Avoid checking `*temp*' buffers
* exwm-input.el (exwm-input--on-buffer-list-update): The way of
detecting a switch from a `*temp*' buffer does not always work.
Disable it until we find a better way.
2019-08-11 00:00:00 +00:00
Chris Feng
1f2bd54c11 Fix a regression with systemtray
* exwm-systemtray.el (exwm-systemtray--on-workspace-switch)
(exwm-systemtray--on-randr-refresh): Instead of retrieving the real
frame height, manually calculate it with workarea height and
menu-bar/tool-bar size.
2019-08-11 00:00:00 +00:00
Chris Feng
dd6f5c36ed Inform user about making a frame a workspace
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Add a
message.
(exwm-workspace--init): Exclude initial workspaces.
2019-08-11 00:00:00 +00:00
Chris Feng
37098a4009 Fix detection of modifier keys in Emacs events
* exwm-input.el (exwm-input--grab-global-prefix-keys)
(exwm-input--fake-key):
* exwm-xim.el (exwm-xim--handle-forward-event-request): X11 allows
multiple combinations of KEYSYM-MODIFIERS to generate a same
KEYSYM, thus the result of an Emacs event to KEYSYM-MODIFIERS
conversion is not necessarily unique.  Previously the result of
`xcb:keysyms:event->keysym' is misused as the modifiers returned is
actually the ones should be consumed.
2019-08-05 00:00:00 +00:00
Chris Feng
2c0dcc46cd Remove hard-coded keys in menu
* exwm-core.el (exwm-mode-menu): Avoid hard-coding keys in
`exwm-mode-menu'.
2019-08-05 00:00:00 +00:00
Chris Feng
c579476536 Fix `after-focus-change-function' not working
* exwm-workspace.el (exwm-workspace--original-handle-focus-in)
(exwm-workspace--original-handle-focus-out): Store the original
`handle-focus-{in,out}'.
(exwm-workspace-switch): Now that `handle-focus-{in,out}' has been
updated to call other stuffs like `after-focus-change-function', we
can no longer run `focus-{in,out}-hook' only.
2019-07-28 00:00:00 +00:00
Sebastian Wålinder
0a3dde042a Added option to have a key that ends exwm-input-send-next-key
* exwm-input.el (exwm-input-send-next-key): Accept an optional end key.
2019-07-14 00:00:00 +00:00
Chris Feng
fe8ee3c578 Fix 'Attempt to delete a surrogate minibuffer frame' error
* exwm-workspace.el (exwm-workspace--get-remove-frame-next-workspace):
New function automatically moves X window elsewhere before removing a
workspace; also returns the destination workspace.
(exwm-workspace--prompt-delete, exwm-workspace-delete)
(exwm-workspace--remove-frame-as-workspace): Use it.
* exwm.el (exwm--on-ClientMessage): Use it.
2019-06-30 00:00:00 +00:00
Chris Feng
605b0a9575 Allow panel to hide floating X windows
* exwm.el (exwm--on-ClientMessage): Use `exwm-floating-hide' to hide X
windows on receiving `WM_CHANGE_STATE' events.
2019-06-16 00:00:00 +00:00
Chris Feng
aa92c7be8c Avoid workspace switch loop with `mouse-autoselect-window' enabled
* exwm-input.el (exwm-input--last-enter-notify-position): New variable
storing last mouse position.
(exwm-input--on-EnterNotify): Avoid switching workspace when mouse
position is not changed (the event is a result of a workspace switch).
2019-06-16 00:00:00 +00:00
Chris Feng
8a54504152 Handle (t . EVENT) format events in exwm-xim
* exwm-xim.el (exwm-xim--handle-forward-event-request): Ditto.
2019-06-09 00:00:00 +00:00
Chris Feng
75833e0c53 Fix character loss with exwm-xim
* exwm-xim.el (exwm-xim--handle-forward-event-request): Events unread
can either be reused by input methods or forwarded to X windows as is.
2019-06-09 00:00:00 +00:00
Chris Feng
672a5e2a23 Fix unreading 'return event
* exwm-xim.el (exwm-xim--event-pending): Drop unused variable.
(exwm-xim--handle-forward-event-request): Convert 'return back to ?\n
to avoid error.
2019-06-02 00:00:00 +00:00
Chris Feng
fe2336a11e Fix auto commit issue with input methods
* exwm-xim.el (exwm-xim--handle-forward-event-request): Factored out
from `exwm-xim--on-request' to make auto commit work.  With input
methods providing candidates the first candidate can be implicitly
selected if no further matching is possible.  The last event would be
stored in `unread-command-events' (at least for `quail-input-method')
and should be reused by the input method.
(exwm-xim--on-request): Use it.
2019-06-02 00:00:00 +00:00
Chris Feng
f70bdb5868 Add compatibility mode for legacy servers
* exwm-randr.el (exwm-randr--compatibility-mode): Indicating whether
RandR 1.5 is supported by the server.
(exwm-randr--init): Set it.
(exwm-randr--get-monitor-alias): Split out from
exwm-randr--get-monitors for reuse.
(exwm-randr--get-outputs): New function for retrieving RandR 1.2
outputs when RandR 1.5 is not supported.
(exwm-randr-refresh): Call `exwm-randr--get-outputs' in compatibility
mode.
2019-04-14 00:00:00 +00:00
Chris Feng
4ac0d6c1fd Clarify the usage of `exwm-manage-configurations' 2019-04-14 00:00:00 +00:00
Chris Feng
bd99d8cf7f Support monitor mirroring
* exwm-randr.el (exwm-randr--get-monitors): Also return an alist of
monitor name aliases.
(exwm-randr-refresh): Unify mirrored monitor names.
2019-03-24 00:00:00 +00:00
Chris Feng
73b4d6f966 ; Follows up 2019-03-24 00:00:00 +00:00
Stefan Monnier
81e52263a7 * exwm-workspace.el: Use closures rather than `(lambda ...) 2019-03-17 10:47:28 -04:00
Chris Feng
397ca5497e Remove loading order dependency on `mouse-autoselect-window'
* exwm-core.el (exwm--get-client-event-mask): Renamed from
`exwm--client-event-mask' and used as a function.
* exwm-floating.el (exwm-floating--unset-floating):
* exwm-layout.el (exwm-layout--hide):
* exwm-manage.el (exwm-manage--manage-window): Use it.
2019-03-17 00:00:00 +00:00
Chris Feng
dd96fffb52 Add extra keys for selecting workspace
* exwm-workspace.el (exwm-workspace--switch-map)
(exwm-workspace--init): Avoid initializing the keymap when loading.
(exwm-workspace--init-switch-map): Initialize
`exwm-workspace--switch-map' and also add extra keybindings when
`exwm-workspace-index-map' has been customized.
2019-03-17 00:00:00 +00:00
Chris Feng
b12c67de2e Make replacing existing WM optional
* exwm.el (exwm-replace): New user option for specifying whether to
replace existing WM.
(exwm-init): Use it.
(exwm--wmsn-acquire, exwm-init): Do not print warning message when
user gives up replacing.
* exwm-core.el (exwm--wmsn-replace): Remove dead code.
2019-03-10 00:00:00 +00:00
Chris Feng
88c690217a Bump version to 0.22.1 2019-02-16 00:00:00 +00:00
Chris Feng
2434bdb57d Fix compatibility issue with Emacs 25
* exwm-input.el (exwm-input--unread-event): `string-version-lessp' is
not available on Emacs 25.
2019-02-11 00:00:00 +00:00