Commit graph

70 commits

Author SHA1 Message Date
Adrián Medraño Calvo
1d0df9144e ; Upcase menu item 2020-05-06 00:00:00 +00:00
Chris Feng
36d2f0056e Refactor color-related code
* exwm-core.el (exwm--color->pixel): New function for converting color
to TrueColor pixel.
* exwm-floating.el (exwm-floating--border-pixel)
(exwm-floating--border-colormap, exwm-floating--init-border): Removed.
(exwm-floating-border-color, exwm-floating--set-floating): Use
`exwm--color->pixel' and only support TrueColor.
2020-02-02 00:00:00 +00:00
Chris Feng
27a884e947 Update copyright year to 2020 2020-02-02 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
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
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
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
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
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
0f7269c4ec Add input method support
; The code is basically refactored from
; https://github.com/ch11ng/exim to get better maintenance.

* exwm-xim.el: New module making Emacs's builtin input methods usable
for interacting with X windows.

* exwm-core.el (exwm--intern-atom): New function for intern X11 atoms.
* exwm-input.el (exwm-input--init):
* exwm-manage.el (exwm-manage--init): Use it.
2019-02-06 00:00:00 +00:00
Chris Feng
993ca8a13a Update copyright year to 2019 2019-02-01 00:00:00 +00:00
Adrián Medraño Calvo
eb91ee2c77 Restore keyboard grabbing after exiting fullscreen
Recover the difference between the input mode selected by the user and
actual one, which might be transient.  This was inadvertently removed in
recent changes.

* exwm-core.el (exwm--selected-input-mode): New variable.
* exwm-input.el (exwm-input-grab-keyboard)
(exwm-input-release-keyboard): Use it.
* exwm-layout.el (exwm-layout-unset-fullscreen): Return to the
selected input mode.
2018-10-21 12:00:00 +00:00
Adrián Medraño Calvo
dff1ef6a3c Simplify input handling
No functional change.

* exwm-input.el (exwm-input--current-input-mode): New function
indicating keyboard input mode.
(exwm-input--on-KeyPress, exwm-input--update-mode-line): Use
`exwm-input--current-input-mode'.
(exwm-input-grab-keyboard, exwm-input-release-keyboard)
(exwm-input--update-mode-line): Simplify.

* exwh-core.el (exwm--on-KeyPress): Remove variable, use
`exwm--keyboard-grabbed' and `exwm-input--current-input-mode'
instead.
2018-10-08 12:00:00 +00:00
Chris Feng
472f7cb82b Simplify debugging and fix dynamic-scoping `eval'
* exwm-core.el (exwm-debug): New global minor mode to replace
`exwm-debug-on' and `exwm-debug-toggle'.

* exwm-manage.el (exwm-manage--get-configurations): Use
lexical-scoping `eval'.
2018-09-16 00:00:00 +00:00
Chris Feng
72bba1176c ; Minor fixes for Calvo's patch set. 2018-09-09 00:00:00 +00:00
Adrián Medraño Calvo
ac1372eb11 Command for toggling debugging output
* exwm-core.el (exwm-debug-toggle): New function for toggling
debugging output.
(exwm-mode-map): Use it.
2018-09-04 12:00:00 +00:00
Adrián Medraño Calvo
3419337f52 Substitute overlapping keybindings
* exwm-core.el (exwm-mode-map): Change keybindings to avoid
overlap.
2018-09-04 12:00:00 +00:00
Adrián Medraño Calvo
74ef19ff44 Use XELB's debugging facilities
* exwm-debug.el: Move to XELB as `xcb-debug'.
* exwm-core.el (exwm--log): Use it.
(exwm--log): Support switching debugging output at runtime.
2018-09-04 12:00:00 +00:00
Chris Feng
b6a3b7b3ad ; Unimportant tweaks 2018-08-19 00:00:00 +00:00
Adrián Medraño Calvo
33dec8d1a3 Trace more functions 2018-08-13 12:00:00 +00:00
Adrián Medraño Calvo
ac600f0916 Commands for interacting with the log buffer remotely
* exwm-debug.el (exwm-debug--clear, exwm-debug--mark): New
functions.
2018-08-13 12:00:00 +00:00
Adrián Medraño Calvo
8d15a39c4d Print log output to an EXWM-specific messages buffer
Using `message' to log debugging information is cumbersome, as the output
appears constantly in the minibuffer, obscuring prompts and other information.
In the case of long messages, it might resize the minibuffer, which causes EXWM
to perform additional actions due to the log output.

This change reimplements EXWM debug logging using a separate
buffer (*EXWM-DEBUG*).  Basic functionality, like scrolling when point is at the
end of the buffer is maintained.

* exwm-core.el (exwm--log): Use `exwm-debug--message' instead of
`message'.  Prefix all messages with the name of the function.
Make FORMAT-STRING argument optional.

* exwm-debug.el: New file.
(exwm-debug-buffer): New variable holding the buffer where debug
messages are output to.
(exwm-debug--message): New function printing a message to
`exwm-debug-buffer'.
(exwm-debug--backtrace): New function printing a backtrace.
2018-08-13 12:00:00 +00:00
Chris Feng
f4aa8389fc Fix a compatibility issue with Emacs 24
* exwm-core.el (exwm--defer): `time-add' in Emacs 24 only accept lists.
2018-03-23 23:57:18 +08:00
Adrián Medraño Calvo
7aae6efdcd Support replacing and being replaced by other window managers
* exwm.el (exwm--on-SelectionClear, exwm--init-icccm-ewmh)
(exwm--exit-icccm-ewmh, exwm--wmsn-acquire, exwm--wmsn-release):
Get the window manager selection; die when it is cleared.
2018-03-06 00:00:00 +00:00
Adrián Medraño Calvo
dd0f10775a Support disabling default `exwm-mode-map' bindings
* exwm-input.el (exwm-input--on-KeyPress-line-mode): Use
`lookup-key' to check whether a the event is defined in the
`exwm-mode-map' keymap.
2018-03-06 00:04:36 +08:00
Chris Feng
dbc06b50ff Add initial support for per-application configurations
* exwm-core.el (exwm--configurations): New buffer-local variable
recording the configurations of an X window.
* exwm-manage.el (exwm-manage-configurations): New user option as the
per-application configurations.
(exwm-manage--get-configurations): New function for fetching the
configurations of this X window.
(exwm-manage--manage-window): Fetch the configurations and check if
the X window should be floating/tiling.
2018-03-02 00:52:03 +08:00
Chris Feng
a6cfe3f22d Forward keys defined in `exwm-mode-map' to Emacs by default
* exwm-input.el (exwm-input-prefix-keys): Remove ?\C-c.
(exwm-input--on-KeyPress-line-mode):
* exwm-core.el (): Detect keys in `exwm-mode-map' in line-mode.
2018-02-26 00:23:40 +08:00
Chris Feng
6200417697 Grab global keys on top-level X windows
* exwm-input.el (exwm-input--on-CreateNotify): New function for
grabbing global keys on newly created X windows.
(exwm-input--update-global-prefix-keys): Grab global keys on top-level
X windows instead of the root window.
(exwm-input--grab-global-prefix-keys): New function for grabbing
global keys on X windows.
(exwm-input--release-keyboard): Grab global keys in char-mode.
(exwm-input--init): Select CreateNotify events.

* exwm-core.el (exwm--unlock):
* exwm-input.el (exwm-input--on-FocusIn, exwm-input--init): Do not
handle FocusIn events on the root window.
2018-02-22 00:26:04 +08:00
Chris Feng
86f2215be3 Fix unexpected focus change after a global key binding is activated
* exwm-core.el (exwm--unlock): Select FocusChange events on the root
window.

* exwm-input.el (exwm-input--on-FocusIn): Input focus should stay on
the current workspace when the root window receives a FocusIn event.
2018-02-20 22:24:26 +08:00
Chris Feng
7d4c57a6ab Add Customize interface for simulation keys
* exwm-input.el (exwm-input-simulation-keys): New user option for
setting simulation keys.
(exwm-input--init): Initialize simulation keys from this variable.

* exwm-input.el (exwm-input--simulation-prefix-keys)
(exwm-input--on-KeyPress-line-mode)
(exwm-input--update-simulation-prefix-keys)
(exwm-input-set-simulation-keys, exwm-input-set-local-simulation-keys)
(exwm-input-send-simulation-key): `exwm-input--simulation-keys' is now
a hash table storing both simulation keys and prefix keys.
(exwm-input--unset-simulation-keys): Clear the hash table.
(exwm-input--exit): Use `exwm-input--unset-simulation-keys'.
* exwm-core.el (exwm--kmacro-map, exwm-mode-menu): Adapt to the
change of `exwm-input--simulation-keys'.

* exwm-config.el (exwm-config-default): Update the example.
2018-02-20 21:57:49 +08:00
Chris Feng
b8ce20b4f3 Support displaying floating X windows on all workspaces
; Setting _NET_WM_DESKTOP to 0xffffffff makes an X windows appearing
; on all desktops (EWMH).  It's tricky to do it for tiling X windows
; so it's not implemented.

* exwm-core.el (exwm--desktop): New buffer-local variable recording
the value of _NET_WM_DESKTOP.
* exwm-layout.el (exwm-layout--hide): Do not hide X windows with this
property set to 0xffffffff.

* exwm.el (exwm--update-desktop): New function for fetching the value
of _NET_WM_DESKTOP and setting `exwm--desktop'.
* exwm-manage.el (exwm-manage--manage-window): Use it.

* exwm-workspace.el (exwm-workspace--set-desktop): Also update
`exwm--desktop'.
2018-02-19 22:34:03 +08:00
Chris Feng
d22e6740d7 Add customization settings
; Also fix documentations.
2018-02-19 00:04:27 +08:00
Chris Feng
7823eb988c Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window.  This is mainly to make EXWM compatible with third-party compositors.  Other issues like wrong absolute position should also get resolved by the way.  The workspace containers ("virtual roots") are also removed.  However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.

* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.

* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.

* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.

* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes.  As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded.  It remains to be seen if this change will raise input focus issues.

* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.

* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.

* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.

* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-18 01:04:04 +08:00
Chris Feng
dd0a62c405 Add support for `mouse-autoselect-window'
; This feature requires both `mouse-autoselect-window` and
; `focus-follows-mouse' being set.  Delaying autoselection is not
; supported yet.

* exwm-core.el (exwm--client-event-mask): Select the EnterNotify event
on each X window when `mouse-autoselect-window' is set.
* exwm-input.el (exwm-input--on-EnterNotify): New function for making
`mouse-autoselect-window' work on X windows.
(exwm-input--init): Listen to EnterNotify event when
`mouse-autoselect-window' is set.
2017-12-31 20:53:58 +08:00
Chris Feng
76d6f608bc Update copyright year to 2018 2017-12-31 20:49:37 +08:00
Chris Feng
dd6596b1f4 Another fix for input focus issues
* exwm-core.el (exwm--defer):
* exwm-input.el (exwm-input--update-focus-defer): Avoid unnecessarily
long delay.

* exwm-input.el (exwm-input--on-FocusIn): Filter out FocusIn events
generated as a result of grab/ungrab or when the keyboard is grabbed.
2017-11-24 22:47:42 +08:00
Chris Feng
71a39840b2 Fix various input focus issues
* exwm-input.el (exwm-input--on-buffer-list-update): Cancel the frame
redirection introduced by 421c0512f7.

* exwm-input.el (exwm-input--on-buffer-list-update): Only ignore temp
buffers just switched from.

* exwm-input.el (exwm-input--update-focus-commit): New function for
ensuring the input focus lock can always be released.
(exwm-input--update-focus-defer, exwm-input--update-focus): Use it.

* exwm-input.el (exwm-input--update-focus): No need to select frames;
only transfer X input focus.

* exwm-core.el (exwm--defer): New macro for correcting the use of
`run-with-idle-timer' by taking `current-idle-time' into account.
* exwm-input.el (exwm-input--update-focus-defer)
(exwm-input--update-focus):
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change):
* exwm-manage.el (exwm-manage--unmanage-window)
(exwm-workspace--prompt-delete):
* exwm-workspace.el (exwm-workspace-switch)
(exwm-workspace--add-frame-as-workspace):
Use it.
2017-11-19 14:51:45 +08:00
Chris Feng
d0e9895748 ; Expose `exwm-input-line-mode-passthrough' as a public interface. 2017-02-24 23:25:02 +08:00
Chris Feng
6723436052 Correct a renamed variable
* exwm-core.el (exwm--kmacro-map): Correct
`exwm-input--during-key-sequence' that was left out in 089afdc8.
2017-02-10 22:14:56 +08:00
Chris Feng
d69e7075ad Add a menu entry to `exwm-mode-map'
* exwm-core.el (exwm-mode-menu): Add a menu entry for closing X windows.
2017-02-05 17:51:43 +08:00
Chris Feng
9926d87b65 Update copyright year to 2017 2017-02-05 17:49:42 +08:00
Chris Feng
f96f565d54 Add support for keyboard macro
* exwm-core.el (exwm--kmacro-map): New keymap used when executing
keyboard macros.
(exwm-mode): Use `exwm--kmacro-map' to override the default keymap.
* exwm-input.el (exwm-input--on-KeyPress-line-mode): Send extra key
events when defining keyboard macros.
2016-09-22 19:10:38 +08:00
Chris Feng
a913621302 Add toggle commands
* exwm-input.el (exwm-input-toggle-keyboard): New command for toggling
keyboard mode.
* exwm-layout.el (exwm-layout-toggle-fullscreen): New command for
toggling fullscreen mode.
* exwm-core.el (exwm-mode-menu, exwm-mode-map): Use them.
2016-08-24 19:21:17 +08:00
Chris Feng
ebcc9591f3 Check for _NET_WM_STATE_FULLSCREEN on managing
* exwm-core.el (exwm--fullscreen): Removed.
(exwm--ewmh-state): New variable for recording the _NET_WM_STATE hint.
* exwm-core.el (exwm-mode-menu, exwm-mode-map):
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window)
(exwm-manage--on-ConfigureRequest):
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace-swap)
(exwm-workspace-move):
* exwm.el (exwm-reset, exwm--on-ClientMessage):
Use the new variable.
* exwm-manage.el (exwm-manage--update-ewmh-state): New function for
updating _NET_WM_STATE.
(exwm-manage--manage-window): Update _NET_WM_STATE and check for
_NET_WM_STATE_FULLSCREEN.
2016-08-12 19:27:26 +08:00
Chris Feng
719b825bc4 Sync with XELB
* exwm-input.el (exwm-input--update-global-prefix-keys)
(exwm-input--on-KeyPress-line-mode, exwm-input--on-KeyPress-char-mode)
(exwm-input--fake-key, exwm-input--init): Sync with XELB.

* exwm-input.el (exwm-input--on-KeyPress)
(exwm-input--on-KeyPress-line-mode): Resend XKB events with SendEvent
since AllowEvents in ReplayKeyboard mode doesn't seem to work.
2016-07-29 17:05:09 +08:00
Chris Feng
d86db3edd6 Add minibuffer toggle command
* exwm-workspace.el (exwm-workspace-toggle-minibuffer): Add minibuffer
toggle command.

* exwm-core.el (exwm-mode-menu, exwm-mode-map): Substitute minibuffer
attach/detach commands with minibuffer toggle command.

* exwm-workspace.el (exwm-workspace-toggle-minibuffer): Insert various
auto load cookies.
2016-07-22 12:26:29 +08:00
Chris Feng
f48b8eafb0 Minor fixes
* exwm-core.el (exwm-mode-menu, exwm-mode-map): Add workspace
attach/detach commands.

* exwm-workspace.el (exwm-workspace--add-frame-as-workspace):
Cleanup containers.

* exwm-workspace.el (exwm-workspace--update-ewmh-props): Create the
frame in size 1x1 (Lucid build does no support zero sized frames).

* exwm-workspace.el (exwm-workspace--post-init): Reset the 'fullscreen'
frame parameter for emacsclient.
2016-07-21 12:44:05 +08:00
Chris Feng
6571bb5761 Minor cleanups
; Eliminate compile warnings.
; Rename frame parameter 'exwm--urgency' to 'exwm-urgency'.
; Simplify expressions.
2016-07-21 12:41:51 +08:00
Chris Feng
b51f3e65f1 Mention dynamic workspace in various places
* README.md:
* exwm.el: Update README and comments.

* exwm-core.el (exwm-mode-menu exwm-mode-map): Add menu entries for
dynamic workspace feature.
2016-07-19 10:36:14 +08:00