Commit graph

158 commits

Author SHA1 Message Date
Chris Feng
01b0b54c04 Fix single workspace invisible problem with Xephyr
* exwm-workspace.el (exwm-workspace-switch): On startup EXWM switches
to workspace 0 by force so the rest code can not assume the frames
before and after a switch different.
2018-10-21 00:00:00 +00:00
Adrián Medraño Calvo
24287f2691 Reduce flicker when switching workspaces
* exwm-workspace.el (exwm-workspace-switch): Hide the old
workspace after having shown the new one when switching to avoid
flicker.
2018-10-08 12:00:00 +00:00
James Ferguson
dd57c5eebb Explicitly specify frame for cursor warping conditional 2018-09-02 16:18:06 +08:00
James Ferguson
2399a0bb22 Fix cursor warping conditional for cursor left of frame 2018-09-02 16:18:06 +08:00
Adrián Medraño Calvo
5f6b866cfe Refresh layout after activating/deactivating workspaces
* exwm-workspace.el (exwm-workspace--set-active): Refresh layout
after activating or deactivating workspaces.

* exwm-layout.el (exwm-layout--refresh-workspace): Hide X windows on
inactive workspaces.
2018-08-30 12:00:00 +00:00
Adrián Medraño Calvo
33dec8d1a3 Trace more functions 2018-08-13 12:00:00 +00:00
Chris Feng
4d43e3119a Avoid using `set-mouse-position' to warp pointer
* exwm-workspace.el (exwm-workspace-switch): Warp pointer with the
WarpPointer request.
2018-08-12 00:00:00 +00:00
Chris Feng
bc5f0b3ffa ; Use `derived-mode-p'. 2018-07-15 00:00:00 +08:00
Chris Feng
1364f80f09 Add support for automatic cursor warping
* exwm-workspace.el (exwm-workspace-warp-cursor): New user option.
(exwm-workspace-switch): Automatically warp cursor after workspace
switch.
2018-07-15 00:00:00 +08:00
Chris Feng
2f430db735 Minor fixes 2018-03-09 01:06:39 +08:00
Adrián Medraño Calvo
cf98e3d921 Name all helper windows created by EXWM
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
(exwm-workspace--init):
* exwm-input.el (exwm-input--init):
* exwm-floating.el (exwm-floating--set-floating): Name created
helper windows with prefix "EXWM".
2018-03-06 00:00:00 +00:00
Adrián Medraño Calvo
587a8cad1d Add interactive commands for starting and stopping EXWM
* exwm.el (exwm-reset): Remove autoload cookie.
(exwm-init, exwm-exit): Add autoload cookie and interactive
declaration.
2018-03-06 00:00:00 +00:00
Adrián Medraño Calvo
ce8af83ffb Disconnect on `exwm--exit'
* exwm.el (exwm-exit): Disconnect `exwm-connection'.
* exwm.el (exwm-init, exwm-exit, exwm--confirm-kill-emacs)
* exwm-workspace.el (exwm-workspace--set-desktop-geometry)
(exwm-workspace--init, exwm-workspace--exit): Move
`confirm-kill-emacs' to this exwm.el`.  Delegate disconnection of
`exwm--connection' to `exwm-exit'.
2018-03-06 00:00:00 +00:00
Adrián Medraño Calvo
a51be88c1e Cleanup exwm-workspace on exit
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Move
deinitialization to `exwm-workspace--exit'.
(exwm-workspace--exit): Reparent minibuffer frame to the root
window, turn workspace frames into regular frames, restore frame
parameters.
(exwm-workspace--init): Reset the fullscreen counter.
(exwm-workspace--remove-frame-as-workspace): Reset fullscreen
state.
(exwm-workspace--init-minibuffer-frame)
(exwm-workspace--exit-minibuffer-frame): New functions configuring
the minibuffer frame.
(exwm-workspace--init, exwm-workspace--exit): Use the above
functions to configure the minibuffer frame.
2018-03-06 00:00:00 +00:00
Adrián Medraño Calvo
33a1a28476 Dissociate frame creation and deletion handlers from the actual configuration of frames as workspaces
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Limit functionality
to the configuration of frames as workspaces.
(exwm-workspace--on-after-make-frame)
(exwm-workspace--on-delete-frame): Callbacks run on frame creation
and deletion that may use or stop them from being used as
workspaces.
2018-03-06 00:00:00 +00:00
Adrián Medraño Calvo
4660e040a0 Prevent duplicate keys in frameset-filter-alist
* exwm-workspace.el (exwm-workspace--init):
* exwm-randr.el (exwm-randr--init): Prevent duplicate keys in
frameset-filter-alist
2018-03-06 00:00:00 +00:00
Chris Feng
57328b439f Avoid switching buffer when moving an X window already in place
* exwm-workspace.el (exwm-workspace-move-window): This is required
when calling `exwm-workspace-move-window' from `exwm-layout--refresh'.
2018-03-04 21:59:19 +08:00
Chris Feng
46fe764634 Fix fullscreen mode after switching workspace and back
* exwm-layout.el (exwm-layout--show): Always set an X window in
fullscreen mode the size in fullscreen.
(exwm-layout-unset-fullscreen): Leave the fullscreen mode first.

* exwm-layout.el (exwm-layout--fullscreen-p): New function telling
whether the current buffer is in fullscreen mode.
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen)
(exwm-layout-toggle-fullscreen):
* exwm-manage.el (exwm-manage--manage-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 it.
2018-03-04 12:29:24 +08:00
Chris Feng
cc974555db Add prefix arguments support for various commands
* exwm-workspace.el (exwm-workspace-switch)
(exwm-workspace-switch-create, exwm-workspace-move)
(exwm-workspace-move-window): Add prefix arguments support.
2018-03-04 01:36:36 +08:00
Johan Johansson
0d1a323124 Fix EXWM buffers not being hidden on workspace switch
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace-move-window):
Use `equal' to compare RandR output names.
2018-03-03 00:55:36 +08:00
Chris Feng
1b6272e458 Hide blocked frames (they are visible with a compositor)
* exwm-workspace.el (exwm-workspace--set-active): New function for
setting the 'exwm-active' frame parameter and show/hide frames BTW.
(exwm-workspace--active-p): New function checking whether a frame is
active.
(exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window):
* exwm-randr.el (exwm-randr--refresh): Use them.

* exwm-workspace.el (exwm-workspace-attach-minibuffer)
(exwm-workspace--show-minibuffer, exwm-workspace--hide-minibuffer):
Show/Hide the minibuffer frame.
2018-02-22 22:21:54 +08:00
Chris Feng
32b88f4bd0 Mark active workspaces on each output
* exwm-randr.el (exwm-randr--refresh): Mark active workspaces.
* exwm-workspace.el (exwm-workspace-switch): Use the marks to
show/hide X windows when switching workspace; do not update timestamp.
(exwm-workspace-move-window): Use the marks to hide X windows after
moving them.
(exwm-workspace--init): Update `frameset-filter-alist'.
2018-02-22 00:31:57 +08:00
Chris Feng
c821f76dfe Use the 'exwm-randr-output' frame parameter to determine the output
* exwm-randr.el (exwm-randr--refresh): Always set the name of primary
output.

* exwm-workspace.el (exwm-workspace-switch)
(exwm-workspace-move-window): Use 'exwm-randr-output' frame parameter
to check if two frames are on the same output.
2018-02-20 22:17:22 +08:00
Chris Feng
5c5729c0d4 Fix various issues with multi-monitor support
* exwm-workspace.el (exwm-workspace-switch): Do not hide X windows
when switching to a workspace on another output; update the
timestamp (last switched to) of a workspace frame.
(exwm-workspace-move-window): Do not hide an X window when moving it
to an active workspace on another output.

* exwm-floating.el (exwm-floating--set-floating):
* 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):
Correct coordinate calculations.

* exwm-workspace.el (exwm-workspace--current-width): Removed since no
longer used.
2018-02-19 22:40:27 +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
76d6f608bc Update copyright year to 2018 2017-12-31 20:49:37 +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
7d967e7361 Allow customizing workspace indexes
* exwm-workspace.el (exwm-workspace-index-map): New variable for
customizing workspace indexes.
(exwm-workspace--update-switch-history): Use it.
2017-07-16 17:08:24 +08:00
Chris Feng
19515dc074 Allow switching to a workspace by selecting one X window on it
* exwm-workspace.el (exwm-workspace-switch-to-buffer): Only allows it
when `exwm-layout-show-all-buffers' is nil.
2017-05-31 00:12:22 +08:00
Chris Feng
851ed8c280 Fix X display name comparison
* exwm-workspace--add-frame-as-workspace
(exwm-workspace--add-frame-as-workspace): Manually compare X display
names as there's no built-in function handles this correctly.
2017-05-30 01:25:58 +08:00
Chris Feng
d4cfa564be Avoid comparing X display names
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): An X
display name set by XELB can be different from (but equivalent with)
the one set by Emacs.
2017-04-16 21:46:07 +08:00
Chris Feng
52dc261624 Manually run focus-in-hook' and focus-out-hook'
; Since X windows are managed by EXWM, the current Emacs frame should
always be considered focused logically.

* exwm-workspace.el (exwm-workspace-switch): Manually run
`focus-in-hook' and `focus-out-hook'.
(exwm-workspace--handle-focus-in, exwm-workspace--handle-focus-out):
New functions for overriding `handle-focus-in' and `handle-focus-out'.
(exwm-workspace--init, exwm-workspace--exit): Override
`handle-focus-in' and `handle-focus-out'
2017-03-05 01:10:43 +08:00
Chris Feng
f299ca5ed7 Fix systemtray position
* exwm-workspace.el (exwm-workspace--update-workareas-hook): New hook
run when workareas get updated.
(exwm-workspace--update-workareas): Run the hook.
* exwm-systemtray.el (exwm-systemtray--on-workspace-switch)
(exwm-systemtray--on-randr-refresh): Take struts into account when
calculating the position for systemtray.
(exwm-systemtray--on-struts-update): Alias of
`exwm-systemtray--on-randr-refresh'.
(exwm-systemtray--init, exwm-systemtray--exit): Manipulate
`exwm-workspace--update-workareas-hook'.
2017-02-24 23:13:52 +08:00
Chris Feng
f221f837cb Fix checkdoc warnings 2017-02-05 17:50:52 +08:00
Chris Feng
9926d87b65 Update copyright year to 2017 2017-02-05 17:49:42 +08:00
Chris Feng
4c043471c5 Prevent certain frame parameters from being saved/restored
* exwm-input.el (exwm-input--init):
* exwm-randr.el (exwm-randr--init):
* exwm-workspace.el (exwm-workspace--init):
Add certain frame parameters into `frameset-filter-alist' to prevent
them from being saved/restored which makes little sense and is
problematic.
2017-01-03 00:14:33 +08:00
Chris Feng
09b4f09158 Avoid updating input focus when renaming buffers
* exwm-workspace.el (exwm-workspace-switch-to-buffer)
(exwm-workspace-rename-buffer): Do not update input focus.
2016-10-06 13:04:30 +08:00
Felix Lange
7d732d78f5 Use read-buffer-to-switch in exwm-workspace-switch-to-buffer
read-buffer-to-switch elides the current buffer from the list of
completions and selects a sane default.
2016-09-30 13:34:37 +02:00
Chris Feng
6be75083c2 Use X window borders
; This commit replaces the internal borders of Emacs frames with X
; window borders.  This should make the flickering issue of floating X
; windows less serious.

* exwm-floating.el (exwm-floating--border-pixel)
(exwm-floating--border-colormap): New variables for storing border pixel
and its colormap.
(exwm-floating--set-floating): Do not set the internal border (and
background color) of floating frames; do not take
`exwm-floating-border-width' into account when calculating geometries;
set the border of floating X window containers.
(exwm-floating--unset-floating): No need to restore the position of X
windows any more; hide the border of floating X window containers.
(exwm-floating--init): Initialize the border pixel.
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen): Show/Hide container border respectively.
* exwm-manage.el (exwm-manage--manage-window): Set the border pixel and
colormap of X window containers.
* exwm-workspace.el (exwm-workspace-move-window): Do not set the
internal border and background color of floating frames.
* exwm.el (exwm--on-ClientMessage): Simplify the code for calculating
_NET_REQUEST_FRAME_EXTENTS.
2016-09-23 18:41:43 +08:00
Chris Feng
b4517fbfa0 Force using visible buffers in `other-buffer'
* exwm-floating.el (exwm-floating--set-floating):
* exwm-workspace.el (exwm-workspace-move-window):
Buffers visible on other frames should be treated as invisible.  One
side effect is visible buffers on the current frame is also taken into
account.
2016-08-31 19:18:42 +08:00
Ved Vyas
9105f23121 Improve exwm-workspace-move-window behavior in specific case
This is a small change that improves the behavior of
`exwm-workspace-move-window` in the following situation:

0. `exwm-workspace-show-all-buffers` and `exwm-layout-show-all-buffers`
are `nil`*.
1. On active workspace `i`, there is X window `a` in the selected Emacs
window.
2. On workspace `j`, there is X window `b` in the selected Emacs window
on that workspace frame.
3. While workspace `i` is active, use `exwm-workspace-move-window` to
move `a` to workspace `j`.
4. Switch to workspace `j` and use `exwm-workspace-move-window` to move
`a` back to workspace `i`.

Expected behavior: X window `a` is once again shown in the selected
Emacs window on workspace `i` and X window `b` is once again shown in
the selected Emacs window on workspace `j`.

What is observed: `a` is OK but the selected Emacs window on workspace
`j` does not show `b`. However, `b` is the first candidate when doing a
`switch-to-buffer` in that Emacs window on workspace `j`.

I'm not sure if this is the correct and complete change required, but it
is working well so far.

*The expected behavior is observed with EXWM 0.10 if
exwm-{workspace,layout}-show-all-buffers are non-nil.
2016-08-30 12:10:45 -04:00
Chris Feng
9ff99d6328 Do not set _NET_WORKAREA
* exwm-workspace.el (exwm-workspace--update-workareas): Do not set
_NET_WORKAREA.
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): Remove
_NET_WORKAREA from the supported list.
2016-08-15 18:42:35 +08:00
Chris Feng
108b3949c2 Fix _NET_DESKTOP_VIEWPORT
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_DESKTOP_VIEWPORT on startup since it's a constant.
2016-08-12 20:30:07 +08:00
Chris Feng
badf1c30a0 Raise all docks/panels when switching workspace
* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Always set the struts value, even it's nil.
* exwm-workspace.el (exwm-workspace--update-struts): Check for nil
struts values.
2016-08-12 20:28:05 +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
8a438c2c17 Always put the desktop at bottom
* exwm-manage.el (exwm-manage--desktop): New variable for recording the
desktop X window.
(exwm-manage--manage-window): Check for desktop.
* exwm-workspace.el (exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--hide-minibuffer): Put the minibuffer container above
desktop if any.
2016-08-12 19:22:18 +08:00
Chris Feng
db5128c1b9 Fix CreateWindow attributes
; Also fix various compile warnings.

* exwm-floating.el (exwm-floating--set-floating):
* exwm-manage.el (exwm-manage--manage-window):
* exwm-systemtray.el (exwm-systemtray--init):
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
(exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Explicitly specify the class (InputOutput or InputOnly) and for an
InputOutput X window the background pixmap when creating an X window.
2016-08-12 19:18:32 +08:00
Chris Feng
810b4716a1 Update timestamp for WM_TAKE_FOCUS ClientMessage
* exwm-input.el (exwm-input--timestamp-window)
(exwm-input--timestamp-atom, exwm-input--timestamp-callback): New
variables for updating timestamp.
(exwm-input--set-focus): Send WM_TAKE_FOCUS ClientMessage with updated
timestamp.
(exwm-input--update-timestamp): New utility function for fetching
timestamp.
(exwm-input--on-PropertyNotify): New function for handling
PropertyNotify event to extract the timestamp.
(exwm-input--init): Create resources for updating timestamp; attach the
event listener.
(exwm-input--on-ButtonPress, exwm-input--on-KeyPress):
* exwm.el (exwm--on-PropertyNotify): No longer update timestamp.

* exwm-input.el (exwm-input--set-focus): Avoid setting input focus on
already focused X windows, or when the input focus in not on a Emacs
frame if globally active model is in use.

* exwm-floating.el (exwm-floating--set-floating):
* exwm-workspace.el (exwm-workspace-move-window)
(exwm-workspace--add-frame-as-workspace, exwm-workspace--init):
Set 'exwm-id' frame parameter as the numerical (inner) frame X ID.
2016-08-09 13:34:29 +08:00