Commit graph

151 commits

Author SHA1 Message Date
Adrián Medraño Calvo
4d6b19aece Restore a sensible buffer when replacing EXWM buffers
* exwm-layout.el (exwm-layout--other-buffer-exclude-exwm-mode-buffers)
(exwm-layout--other-buffer-exclude-buffers): New variables.
(exwm-layout--other-buffer-predicate): Allow excluding EXWM
buffers or buffers from a given set.
(exwm-layout--refresh): Replace EXWM buffers with sensible buffers
depending on the situation.  When in non-workspace/non-floating
frames, with some non-EXWM buffer; when the EXWM buffer is
displayed elsewhere, some buffer previously displayed in that
window (making sure it has been recently covered).
2016-03-19 00:00:00 +00:00
Adrián Medraño Calvo
e4704479a8 Use `other-buffer' instead of "*scratch*"
* exwm-workspace.el (exwm-workspace-move-window): Display
`other-buffer' instead of "*scratch*" in the window whose buffer
has been made floating.
2016-03-19 00:00:00 +00:00
Adrián Medraño Calvo
3763195fe3 Use `buffer-predicate' frame parameter to prevent switching to visible EXWM buffers
* exwm-layout.el (exwm-layout--other-buffer-predicate): New
function to be set as `buffer-predicate' frame parameter.
* exwm-workspace.el (exwm-workspace--init): Use above function on
workspace frames.
2016-03-19 00:00:00 +00:00
Adrián Medraño Calvo
8a1c3761e4 Set the correct buffer before checking the `major-mode'
* exwm-layout.el (exwm-layout--refresh): Make sure we test the
`major-mode' of the first buffer of the floating frame.
2016-03-19 00:00:00 +00:00
Adrián Medraño Calvo
f6cd9503e6 Minor cleanup
* exwm-layout.el (exwm-layout--refresh): Reuse car.
2016-03-19 00:00:00 +00:00
Chris Feng
3cef44a6ca Exclude unmanaged floating X windows when refreshing
* exwm-layout.el (exwm-layout--refresh): Do not show unmanaged
floating X windows.
2016-03-16 12:34:38 +08:00
Chris Feng
c8c0bc7b60 Neglect trivial resizing requests
* exwm-manage.el (exwm-manage--on-ConfigureRequest): Neglect trivial
resizing requests since that cannot be done precisely.
2016-03-11 14:12:01 +08:00
Chris Feng
e217533642 Merge branch 'medranocalvo/fix-input-target' into externals/exwm 2016-03-08 13:03:00 +08:00
Chris Feng
ac3f8098c7 Use cl-case' instead of case' 2016-03-08 13:01:05 +08:00
Chris Feng
a50e6bd384 Restack fullscreen X windows
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen): Raise and lower fullscreen X windows
respectively.
2016-03-07 18:16:04 +08:00
Adrián Medraño Calvo
1342fe1789 Change input mode of window being clicked
When clicking a mode-line of other window to switch the EXWM input
mode, `window-buffer' does not return the window whose mode-line has
been clicked, but the current one.  This change ensures that the right
window has its input mode and mode-line updated.

* exwm-input.el (exwm-input--update-mode-line): Factor out setting
`mode-line-process'.
(exwm-input--grab-keyboard, exwm-input--release-keyboard)
(exwm-input-grab-keyboard, exwm-input-release-keyboard): Make sure
the buffer of the window being clicked has its input mode updated.
2016-03-07 00:00:00 +00:00
Chris Feng
f0a5425f4c Allow floating X windows to resize themselves
* exwm-manage.el (exwm-manage--on-ConfigureRequest):
Allow (non-fullscreen) floating X windows to resize themselves.
2016-03-06 14:28:42 +08:00
Chris Feng
6fe6fe52f6 Untabify 2016-03-06 13:45:13 +08:00
Chris Feng
8706e490fb Allow moving/resizing undecorated X windows
* exwm-manage.el (exwm-manage--manage-window): Do not manage
undecorated floating X windows (set in _MOTIF_WM_HINTS).

* exwm-floating.el (exwm-floating--start-moveresize)
(exwm-floating--stop-moveresize, exwm-floating--do-moveresize):
Allow moving/resizing undecorated X windows with _NET_WM_MOVERESIZE
client message.
2016-03-04 19:11:10 +08:00
Chris Feng
fe9be0b3ef Handle buffer change after a buffer is killed
* exwm-manage.el (exwm-manage--kill-buffer-query-function): Handle buffer
change.

* exwm-workspace.el (exwm-workspace--show-minibuffer): Revert the change
made in 93e42136 (the problem has not been fully resolved).
2016-03-03 19:34:17 +08:00
Chris Feng
93e42136e3 Avoid unnecessary input focus changes in line-mode
* exwm-input.el (exwm-input--grab-keyboard, exwm-input--release-keyboard):
Grab keys on X windows instead to prevent unexpected input focus changes.

* exwm-workspace.el (exwm-workspace--show-minibuffer): The workaround for
cursor flickering issue is no more needed.
2016-03-01 18:53:31 +08:00
Chris Feng
74555b25c2 Simplify `exwm-workspace--display-buffer'
* exwm-workspace.el (exwm-workspace--display-buffer): Make it simpler and
more reliable.
2016-02-28 20:03:56 +08:00
Chris Feng
74fba563b8 Do not wait for WM_STATE property events
* exwm-layout.el (exwm-layout--show, exwm-layout--hide): Save the state
directly.
2016-02-26 18:18:34 +08:00
Chris Feng
bc4aafec16 Minor fixes for layout and workspace
* exwm-layout.el (exwm-layout-show-mode-line): Force update mode-line.

* exwm-workspace.el (exwm-workspace--update-minibuffer): Treat nil as empty
string.
2016-02-26 09:24:15 +08:00
Chris Feng
84a9041b20 Fix exwm-workspace-switch-to-buffer
* exwm-workspace.el (exwm-workspace-switch-to-buffer): Select the floating
frame when switching to a floating X window buffer.
2016-02-25 18:36:54 +08:00
Chris Feng
b400ae6eba Bump version to 0.4 2016-02-25 12:42:25 +08:00
Chris Feng
5a39c5c2fa Allow user to hide floating X windows
* exwm-core.el (exwm-mode-map): Add a new key to hide floating X windows.
* exwm-floating.el (exwm-floating-hide): New command to hide a floating X
window.

* exwm-workspace.el: Fix a compile warning.
2016-02-25 12:41:35 +08:00
Chris Feng
db6d26c662 Refresh the workspace after creating a floating X window
* exwm-floating.el (exwm-floating--set-floating): Refresh the workspace
(since auto-refresh was disabled).
2016-02-24 21:27:23 +08:00
Chris Feng
84bdc1378a Fix issues with moving X windows between workspaces
* exwm-workspace.el (exwm-workspace-move-window): Select the moved floating
X window.  Update the 'exwm-selected-window' frame parameter.
(exwm-workspace-switch): Check 'exwm-selected-window' for dead windows.
(exwm-workspace-switch-to-buffer): Allow non-interactive call.
2016-02-24 21:21:36 +08:00
Chris Feng
4838f2b7fa Make input focus revert to pointer root
* exwm-input.el (exwm-input--set-focus): Input focus should not revert to
parent (which was the Emacs frame) any more.
2016-02-23 19:04:51 +08:00
Chris Feng
35493faca6 Bump version to 0.3 2016-02-22 12:41:21 +08:00
Chris Feng
55cec760ca Fix emacsclient related issues
* exwm-systemtray.el (exwm-systemtray-height): The value is not available
when emacsclient has just loaded the library (and it crashes emacsclient).

* exwm-workspace.el (exwm-workspace--init): Set `default-minibuffer-frame'
later to prevent it from being modified when using emacsclient.

* exwm-floating.el:
* exwm-randr.el:
* exwm-systemtray.el:
* exwm-workspace.el:
* exwm.el: Use `exwm-workspace--minibuffer-own-frame-p' instead of the raw
variable.
2016-02-21 20:19:45 +08:00
Chris Feng
7116b01b0c Various fixes for floating X windows
* exwm-floating.el (exwm-floating--set-floating): Always create floating X
windows on current workspace.

* exwm-workspace.el (exwm-workspace-switch): Restore selected floating
frames.

* exwm-workspace.el (exwm-workspace-move-window): Restore the position of
floating X windows.  Recreate floating frames when using fixed minibuffer.
Restack tiling X windows.
2016-02-21 16:39:34 +08:00
Chris Feng
734b401306 Fix the advice function for ido-buffer-window-other-frame
* exwm-config.el (exwm-config--ido-buffer-window-other-frame)
(exwm-config--fix/ido-buffer-window-other-frame): Do not use advice.
Fix issues when switching form/to floating frames.
2016-02-21 16:30:08 +08:00
Chris Feng
e3d33a4aad Prevent Emacs frames from restacking themselves
Putting Emacs frames (workspace frames, floating frames) into dedicated
containers greatly simplifies the stacking order management and totally
fixes relevant issues.

* exwm-floating.el (exwm-floating--set-floating): Create floating frame
container.  Remove redundant stacking order modification code.
(exwm-floating--unset-floating): Destroy the floating frame container.
No need to reparent the X window container.
(exwm-floating--do-moveresize): Resize the floating frame container.
* exwm-input.el (exwm-input--update-focus): No need to restack frames.
* exwm-layout.el (exwm-layout--show, exwm-layout--set-frame-fullscreen)
(exwm-layout-enlarge-window): Resize the floating frame container.
* exwm-manage.el (exwm-manage--on-ConfigureRequest): Re-enable stacking
order modification on ConfigureRequest.

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Reparent out all
frames on exit.  No need to remove selected events or created resources.
(exwm-workspace--init): Create workspace frame containers.

* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window): Remove a redundant call to
`xcb:flush'.

* exwm-manage.el (exwm-manage--unmanage-window): Force unmap the X window.
Unmap the floating frame before reparent it.
2016-02-20 21:52:07 +08:00
Chris Feng
1c79e1c238 Prevent/Reduce flickering issues with floating X windows
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating): Prevent flickering when creating/removing
a floating X window.
* exwm-layout.el (exwm-layout--show): Show X windows after resizing to
prevent flickering.
* exwm-manage.el (exwm-manage--unmanage-window): Reduce flickering by
hiding the container.
(exwm-manage--kill-buffer-query-function): Prevent flickering by hiding the
container (except that the X window destroys itself after receiving the
WM_DELETE_WINDOW client message).
2016-02-20 14:52:53 +08:00
Chris Feng
33254c37df Redefine mode-specific keys
* exwm-core.el (exwm-mode-map): Redefine mode-specific keys to comply with
the key binding conventions.
2016-02-20 10:02:11 +08:00
Chris Feng
fdfdabf95a Merge branch 'feat/systemtray' into externals/exwm
A simple system tray based on the X11 'System Tray' and XEmbed protocol.
2016-02-19 20:22:05 +08:00
Chris Feng
08bf970b16 Minor fixes for system tray
* exwm-systemtray.el (exwm-systemtray--embed): Default to visible if the
XEMBED_MAPPED flag is not set.
(exwm-systemtray--on-ClientMessage): Only embed new icons.  Ignore balloon
messages.
2016-02-19 20:18:29 +08:00
Chris Feng
fc589b899b Fix system tray issues after updating workspaces
* exwm-workspace.el (exwm-workspace-switch-hook): New hook run by
`exwm-workspace-switch'.
* exwm-randr.el (exwm-randr-refresh-hook): New hook run by
`exwm-randr--refresh'.
* exwm-systemtray.el (exwm-systemtray--on-randr-refresh)
(exwm-systemtray--on-workspace-switch, exwm-systemtray--init): Update the
system tray in `exwm-randr-refresh-hook' and `exwm-workspace-switch-hook'.

* exwm-layout.el (exwm-layout--set-frame-fullscreen):
* exwm-workspace.el (exwm-workspace--post-init): Wait until all workspace
frames are set fullscreen.

* exwm-workspace.el (exwm-workspace--current-width)
(exwm-workspace--current-height): New functions for retrieving the width
and height of the current workspace.
* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--manage-window)
(exwm-manage--on-ConfigureRequest):
* exwm-systemtray.el (exwm-systemtray--refresh, exwm-systemtray--init):
* exwm-workspace.le (exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Switch to
`exwm-workspace--current-width' and `exwm-workspace--current-height'.

* exwm-core.el:
* exwm-floating.el:
* exwm-floating.el:
* exwm-input.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-randr.el:
* exwm-systemtray.el:
* exwm-workspace.el:
* exwm.el:
Clean up loading file.  Set/Unset some functions as commands.

* README.md: Add intro to system tray.
2016-02-19 17:12:43 +08:00
Chris Feng
bfd43feb49 Add system tray support
* exwm-systemtray.el: New module adds a simple system tray (using the X11
System Tray protocol).

* exwm-workspace.el (exwm-workspace-switch-hook, exwm-workspace-switch):
New hook run after switching workspace.
2016-02-19 11:02:37 +08:00
Chris Feng
3f7722079c Fix floating X window bugs introduced by 9c95c03e
* exwm-floating.el (exwm-floating--set-floating): Make floating frames
invisible before resizing them.
(exwm-floating--fit-frame-to-window): Removed since unused.
* exwm-layout.el (exwm-layout-hide-mode-line, exwm-layout-show-mode-line):
Use set frame height instead of exwm-floating--fit-frame-to-window.

* exwm-core.el (exwm-mode): Replace `exwm-manage--close-window' with
`exwm-manage--kill-buffer-query-function'.
* exwm-floating.el (exwm-floating--unset-floating): Reparent out floating
frames.
* exwm-manage.el (exwm-manage--unmanage-window): Reparent out floating
frames.  Hide floating frames.
(exwm-manage--close-window, exwm-manage--kill-buffer-query-function):
Rename `exwm-manage--close-window' since it's only used in
`kill-buffer-query-functions'.  Reparent out floating frames.
2016-02-18 19:56:01 +08:00
Chris Feng
12e2d574c9 Bump version to 0.2 2016-02-12 14:12:33 +08:00
Chris Feng
ea027d424e Postpone making workspace frames fullscreen
* exwm-workspace.el (exwm-workspace--init, exwm-workspace--post-init): Move
work to postpone to the new function `exwm-workspace--post-init'.

* exwm.el (exwm-init): Call `exwm-workspace--post-init' after
`exwm--unlock`.
2016-02-12 14:10:11 +08:00
Chris Feng
35d04c3468 Fix bugs on managing/unmanaging X windows
* exwm-manage.el (exwm-manage--scan): Unmap X windows before managing them.

(exwm-manage--on-UnmapNotify): Do not ignore synthetic UnmapNotify events
(according to ICCCM).  Do not use the `from-configure' slot which was
mistakenly introduced due to the bug in `exwm-manage--scan'.

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Do more cleanups.
2016-02-09 13:26:48 +08:00
Chris Feng
fb9bfd2911 Eliminate compilation warnings 2016-02-07 11:40:14 +08:00
Chris Feng
15cdf8f589 Unmanage X windows on exit
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): New function
called on exit to unmanage X windows.
(exwm-workspace--init): Set `confirm-kill-emacs' to
`exwm-workspace--confirm-kill-emacs'.

* exwm-manage.el (exwm-manage--on-UnmapNotify): Ignore UnmapNotify event
generated as a result of parent being resized.
2016-02-07 11:25:49 +08:00
Chris Feng
e2edf81271 Add some useful key bindings
* exwm-core.el (exwm--floating-mode-line-format, exwm--mode-line-format)
(exwm-mode-map):
* exwm-floating.el (exwm-floating-hide-mode-line)
(exwm-floating-show-mode-line):
* exwm-layout.el (exwm-layout-hide-mode-line, exwm-layout-show-mode-line)
(exwm-layout-toggle-mode-line):
Allow hide/show mode-line for all `exwm-mode' buffers with 'C-c M'.

* exwm-config.el (exwm-config-default): Add simulation keys for 'C-d' and
'C-k'.
2016-02-07 10:45:59 +08:00
Chris Feng
3d643fafbe Remove an assertion
* exwm-randr.el (exwm-randr--refresh): There can be no valid output
sometimes.
2016-02-07 10:22:33 +08:00
Chris Feng
e9e476c4de Merge branch 'fjl-fix-resize-minibuffer' 2016-02-07 10:18:45 +08:00
Felix Lange
0006523474 Resize minibuffer only when it's in its own frame
0e4055d339 introduced a few calls to exwm-workspace--resize-minibuffer
in various places. This function only works when the minibuffer is
displayed in its own frame but was called unconditionally in some cases.

Fix it by wrapping all calls in an appropriate conditional and add an
assertion. Also rename the function so it is clearer that it resizes a
frame, which might prevent calling it unconditionally in the future.
2016-02-06 22:43:32 +01:00
Chris Feng
97daba20ad Improve bc80eefe
* exwm-layout.el (exwm-layout--set-frame-fullscreen):
* exwm-randr.el (exwm-randr--refresh):
* exwm-workspace.el (exwm-workspace--resize-minibuffer):
(exwm-workspace-switch):
* exwm.el (exwm--on-ClientMessage):
Calling `exwm-workspace-switch' in bc80eefe does not work correctly
sometimes.  This commit improves it by directly specify the geometry info
rather than getting it from Emacs frame.
2016-02-06 20:33:56 +08:00
Chris Feng
bc80eefe3f Fix multi-monitor/fullscreen issues
* exwm-randr.el (exwm-randr--refresh): Correct the _NET_WORKAREA property.
Reconfigure the current workspace when screen changes.
(exwm-randr--init): Run `exwm-randr-screen-change-hook' to take into
account already attached monitor(s),

* exwm.el (exwm--on-ClientMessage): Reconfigure the current workspace when
it's fullscreen.
2016-02-06 16:47:30 +08:00
Chris Feng
0e4055d339 Add auto-hiding minibuffer support
* exwm-floating.el (exwm-floating--set-floating): Take auto-hiding
minibuffer into account when calculating available height.
(exwm-floating--unset-floating): Restack the container to avoid further
restacking.
* exwm-input.el (exwm-input--update-focus): Use more accurate restacking.
(exwm-input--on-minibuffer-setup): Replaced by
`exwm-layout--on-minibuffer-setup' and `exwm-workspace--on-minibuffer-setup'.
(exwm-input-command-whitelist, exwm-input--during-command)
(exwm-input--on-KeyPress-line-mode): The functionality of
`exwm-input-command-whitelist' is replaced by `exwm-input--during-command',
which can automatically tell whether functions like `read-event' are being
called.
(exwm-input--init): Add/remove corresponding hooks.
* exwm-layout.el (exwm-layout--on-minibuffer-setup): Also set input focus.
(exwm-layout--on-echo-area-change): New function for refreshing layout when
the size of echo area changes.
(exwm-layout--init): Track size changes for fixed minibuffer and echo area.
* exwm-manage.el (exwm-manage--on-ConfigureRequest): Never grant restacking
requests initiated by other clients.
* exwm-workspace.el (exwm-workspace--minibuffer): New variable for the
auto-hiding minibuffer.
(exwm-workspace-minibuffer-position): For setting the position of the
auto-hiding minibuffer.
(exwm-workspace-display-echo-area-timeout): Seconds before echo area
auto-hides.
(exwm-workspace--display-echo-area-timer): The corresponding timer.
(exwm-workspace-switch): Configure the auto-hiding minibuffer when
switching workspace.
(exwm-workspace--update-minibuffer): New function for adjusting the height
of the auto-hiding minibuffer.
(exwm-workspace--on-ConfigureNotify): New function for configuring the
container of the auto-hiding minibuffer.
(exwm-workspace--display-buffer): New function for forcing
`minibuffer-completion-help' to use the workspace frame.
(exwm-workspace--show-minibuffer, exwm-workspace--hide-minibuffer):
New functions for showing/hiding the auto-hiding minibuffer (container).
(exwm-workspace--on-minibuffer-setup, exwm-workspace--on-minibuffer-exit):
New functions called when the auto-hiding minibuffer entered/exists.
(exwm-workspace--on-echo-area-dirty, exwm-workspace--on-echo-area-clear):
New functions when the auto-hiding echo area is ready to show/hide.
(exwm-workspace--init): Set up the auto-hiding minibuffer and workspace
frames.  Track sizes changes for auto-hiding minibuffer and echo area.
No need to set OverrideRedirect on workspace frames.
* exwm.el (exwm--init-icccm-ewmh): Correct the value of _NET_WORKAREA.
2016-02-06 12:59:33 +08:00
Chris Feng
2d42fee327 Merge branch 'feat/virtual-root' 2016-02-03 13:30:14 +08:00