Commit graph

87 commits

Author SHA1 Message Date
Chris Feng
b409d873b6 Merge branch 'medranocalvo/dynamic-workspaces' into externals/exwm 2016-07-19 11:01:19 +08:00
Chris Feng
2ebeec1257 Adapt dynamic workspace for RandR module
* exwm-workspace.el (exwm-workspace-list-change-hook):
New hook run when the workspace list is modified.
* exwm-randr.el (exwm-randr--init, exwm-randr--exit):
* exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move)
(exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace):
Use it.
2016-07-19 10:34:38 +08:00
Chris Feng
4c9afc25b3 Adapt dynamic workspace for floating module
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace):
Fix the checking criteria of floating frames; Copy RandR frame
parameters from the first workspace frame (rather than the selected one
which can be a floating frame).

* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Check frame type first.
2016-07-19 10:33:11 +08:00
Chris Feng
622618ac6e Improve the handling of workspaces
* exwm-workspace.el (exwm-workspace--prompt-for-workspace):
Add an optional argument to modify prompt.
(exwm-workspace-switch, exwm-workspace-swap)
(exwm-workspace-move, exwm-workspace-move-window): Use it.

* exwm-workspace.el (exwm-workspace-number): Re-introduce the variable
(now it stands for the initial workspace number).
(exwm-workspace--init): Create remaining initial workspaces.

* exwm-workspace.el (exwm-workspace-add, exwm-workspace-delete):
New commands for adding/deleting workspaces.
(exwm-workspace--switch-map): Add "+"/"-" to increase/descrease
workspace number.

* exwm-workspace.el (exwm-workspace-switch): Automatically add missing
workspaces.

* exwm.el (exwm--on-ClientMessage): Support _NET_NUMBER_OF_DESKTOPS
client message for adjusting workspace number.
2016-07-19 10:30:21 +08:00
Chris Feng
73d890aad4 Fix various minor issues
; Coding style fixes

* exwm-core.el (exwm-mode-menu exwm-mode-map):
Use `exwm-workspace--count'.
* exwm-workspace.el (exwm-workspace--set-fullscreen)
(exwm-workspace--on-focus-in, exwm-workspace--set-desktop):
Use `exwm-workspace--position'.

* exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move):
Renamed from `exwm-workspace-swap-workspace' and
`exwm-workspace-move-workspace'.

* exwm-workspace.el (exwm-workspace--update-ewmh-props):
Update comments.

* exwm-workspace.el (exwm-workspace--switch-map-nth-prefix):
Fix a calculation.

* exwm-workspace.el (exwm-workspace-switch): Fix a potential timer
problem.

* exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move)
(exwm-workspace--remove-frame-as-workspace): Update workspace and
clients involved.

* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Remove workspace first.
2016-07-19 10:24:23 +08:00
Chris Feng
c22f35620f Fix 2 dock-related issues
* exwm-floating.el (exwm-floating--set-floating): Add a workaround to
prevent accidental move of Emacs frame when struts are set.

* exwm-workspace.el (exwm-workspace--update-workareas): Make legacy
docks working.
2016-07-18 12:55:27 +08:00
Chris Feng
1a716d3939 * exwm-workspace.el (exwm-workspace--init): Rebalance parentheses. 2016-07-18 01:46:46 +08:00
Adrián Medraño Calvo
d0797d03de Remove `exwm-worspace-number'
No longer fill initial workspace list, nor limit the number of
workspaces to `exwm-worspace-number'.

Users are free to create as many as they like by hitting 'C-x 5 2' or
running `make-frame'.

The initial workspace list can be set up by creating frames in a
configuration file.  For example, to start up with 4 workspaces:

    (dolist (i 3)
      (make-frame))

The interactive workspace switcher is improved to support selecting
workspaces with a many-digits position.

	* exwm-workspace.el (exwm-workspace-number): Remove variable, as
	we no longer have a fixed number of workspaces.
	(exwm-workspace--switch-map)
	(exwm-workspace--switch-map-nth-prefix)
	(exwm-workspace--switch-map-select-nth): Improve support for
	selecting workspaces with multiple-digit positions (e.g. workspace
	number 12).
	(exwm-workspace--add-frame-as-workspace, exwm-workspace--init):
	Remove limit on number of workspaces.
	(exwm-workspace--init): Stop creating workspaces at startup.
	* exwm-config.el (exwm-config-default): Bind keys to namespaces
	0-9 in the default configuration.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
0fbc725de1 Support adding and removing workspaces
Frames created via `make-frame' are added to the workspace list;
`delete-frame' removes them from the list.  Floating frames,
non-graphical frames, as well as those associated to different
displays are ignored.

When deleting a workspace, care is taken to reparent that all X clients
another workspace.

	* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
	(exwm-workspace--remove-frame-as-workspace): New functions that
	intercept created and deleted frames and configure them as EXWM
	workspaces.
	(exwm-workspace--update-ewmh-props): New function to update
	desktop-related EWMH properties after workspace changes.
	(exwm-workspace--init): Use
	`exwm-workspace--add-frame-as-workspace' to create the initial
	workspaces.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
f4b8cc47c7 Support moving workspaces
* exwm-workspace.el (exwm-workspace-move-workspace): New function
	to move a workspace to a certain position.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
e4911181d3 Support swapping workspaces
* exwm-workspace.el (exwm-workspace-swap-workspaces): New
	function to interchange the position of two workspaces.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
2de2d42586 Factor out prompt for workspace
* exwm-workspace.el (exwm-workspace--prompt-for-workspace): New
	function to interactively ask the user for a workspace.
	(exwm-workspace-switch, exwm-workspace-move-window): Use it.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
07120a0562 Work with workspace frames instead of indices
* exwm.el (exwm--on-ClientMessage):
	* exwm-workspace.el (exwm-workspace-switch)
	(exwm-workspace-move-window, exwm-workspace-switch-to-buffer):
	* exwm-layout.el (exwm-layout--refresh):
	* exwm-input.el (exwm-input--update-focus)
	(exwm-input--on-ButtonPress): Accept frame as well as workspace
	index as argument.
	* exwm-workspace.el
	(exwm-workspace--workspace-from-frame-or-index): New function.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
35e1655dc5 Move defvars to the top
* exwm-workspace.el (exwm-workspace--current)
	(exwm-workspace-current-index): Do it.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
9018545726 New function exwm-workspace--workspace-p
* exwm-workspace.el (exwm-workspace--workspace-p): New function.
	* exwm-input.el (exwm-input--on-ButtonPress):
	* exwm-workspace.el (exwm-workspace-switch):
	* exwm-layout.el (exwm-layout--refresh): Use it.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
8e2da00b6e Add helper for counting number of workspaces
* exwm-workspace.el (exwm-workspace--count): New function.
	* exwm-randr.el (exwm-randr--refresh):
	* exwm-workspace.el (exwm-workspace--switch-map)
	(exwm-workspace--update-switch-history, exwm-workspace-switch)
	(exwm-workspace-move-window, exwm-workspace--init)
	(exwm-workspace--post-init): Use it.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
ed6a18a697 Add `exwm-workspace--position' helper
* exwm-workspace.el (exwm-workspace--position): New function.
	* exwm-layout.el (exwm-layout--refresh):
	* exwm-input.el (exwm-input--on-ButtonPress):
	* exwm-workspace.el (exwm-workspace--update-switch-history):
	* exwm.el (exwm--on-ClientMessage, exwm-workspace--init): Use it.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
cd1372eaec Apply minibuffer in own frame configuration to created frames
* exwm-workspace.el
	(exwm-workspace--modify-all-x-frames-parameters): Helper function
	to non-destructively modify `window-system-default-frame-alist'.
	(exwm-workspace--init): Use above function to default all frames
	to the shared minibuffer when
	`exwm-workspace--minibuffer-own-frame-p' is true.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
18fc95def2 Minor cleanup
* exwm-workspace.el (exwm-workspace--update-workareas): Use
	`make-list' instead of looping.

2016-07-16  Adrián Medraño Calvo  <amcalvo@amclap>
2016-07-17 12:00:00 +00:00
Chris Feng
4ac71a7ddc Add RandR support for docks and reuse workareas
* exwm-workspace (exwm-workspace--update-struts): Add RandR support for
docks.

* exwm-workspace (exwm-workspace--workareas): New variable for storing
workareas.
(exwm-workspace--update-workareas): Update workareas and set
_NET_WORKAREA (replaces `exwm-workspace--set-workareas').
(exwm-workspace--set-fullscreen): Reuse workareas for
resizing and drop optional arguments.
(exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Reuse workareas for
resizing/reposition the (optional) dedicated minibuffer frame.

* exwm-layout.el (exwm-layout-set-fullscreen): Do not use
`exwm-workspace--set-fullscreen' here.

* exwm-manage.el (exwm-manage--unmanage-window):
* exwm-randr.el (exwm-randr--refresh):
* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Update workareas before resizing workspaces.

* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Remove the corresponding record on receiving invalid struts.

* exwm-workspace.el (exwm-workspace--get-geometry): New utility
function for retrieving workspace geometry.
2016-07-16 14:34:57 +08:00
Chris Feng
7f12d9fc7a Add multi-dock support and fix fullscreen issues with dock
* exwm.el (exwm--update-strut-legacy, exwm--update-strut-partial)
(exwm--update-strut): Rename (strut => struts).

* exwm-manage.el (exwm-manage--manage-window): Listen for
UnmapNotify/DestroyNotify events of docks to stop tracking them.
(exwm-manage--unmanage-window): Remove dock from tracking list when
it's unmapped/destroyed.
* exwm-workspace.el (exwm-workspace--id-struts-alist): New variable
for tracking docks.
(exwm-workspace--struts): Now it stores merged struts.
(exwm-workspace--update-struts): New function for doing the 'merge'.
* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Now update struts for multiple docks.

* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window):
Fix fullscreen mode with dock.
* exwm-workspace.el (exwm-workspace--set-fullscreen): Add optional
arguments for ignoring struts / resizing container only.
(exwm-workspace-switch): Restack workspace/docks appropriately.
2016-07-15 20:04:56 +08:00
Chris Feng
39dc328157 Fix various stability issues
* exwm-input.el (exwm-input--on-KeyPress-line-mode)
(exwm-input--on-KeyPress-char-mode): Append events at the tail.

* exwm-manage.el (exwm-manage--unmanage-window): Remove the
_NET_WM_DESKTOP property when an X window is withdrawn.

* exwm-systemtray.el (exwm-systemtray--init):
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs):
Issue warning rather than error when there's an existing tray running.

* exwm.el (exwm--on-ClientMessage): The buffer window can be on a
floating frame.
2016-07-14 22:08:27 +08:00
Chris Feng
6c8255bf39 Add/improve some ICCCM/EWMH features
* exwm-floating.el (exwm-floating--set-allowed-actions)
(exwm-floating--set-floating, exwm-floating--unset-floating):
Add _NET_WM_ALLOWED_ACTIONS support.

* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating): Support initial state hint.
* exwm.el (exwm--update-hints): Fetch initial state.
(exwm--update-state, exwm--on-PropertyNotify):
WM_STATE is not intended to be read.
* exwm-core.el (exwm-state):
* exwm-floating.el (exwm-floating-hide):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--set-state)
(exwm-layout--iconic-state-p, exwm-layout--show, exwm-layout--hide):
* exwm-manage.el (exwm-manage--on-MapRequest):
Improve WM_STATE support.

* exwm-input.el (exwm-input--set-focus):
* exwm-input.el (exwm-input--update-focus)
(exwm-input--set-active-window):
* exwm.el (exwm--on-ClientMessage): Add _NET_ACTIVE_WINDOW support.

* exwm-layout.el (exwm-layout--set-client-list-stacking):
Improve _NET_CLIENT_LIST_STACKING support.

* exwm-manage.el (exwm-manage--set-client-list)
(exwm-manage--manage-window, exwm-manage--unmanage-window):
Improve _NET_CLIENT_LIST support.

* exwm-manage.el (exwm-manage--manage-window):
* exwm-workspace.el (exwm-workspace--set-desktop)
(exwm-workspace-move-window):
* exwm.el (exwm--on-ClientMessage): Add _NET_WM_DESKTOP support.

* exwm-randr.el (exwm-randr--refresh):
* exwm-workspace.el (exwm-workspace--set-desktop-geometry)
(exwm-workspace--init): Add _NET_DESKTOP_GEOMETRY support.

* exwm-workspace.el (exwm-workspace--set-desktop-geometry):
Renamed from `exwm-workspace--update-desktop-geometry'.
* exwm-randr.el (exwm-randr--refresh): Improve _NET_WORKAREA support.

* exwm-workspace.el (exwm-workspace--set-fullscreen):
Correct variables names.

* exwm-workspace.el (exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_NUMBER_OF_DESKTOPS in workspace module.

* exwm-workspace.el (exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_DESKTOP_VIEWPORT in workspace module.

* exwm.el (exwm--on-ClientMessage): Improve _NET_CURRENT_DESKTOP
support.

* exwm.el (exwm--on-ClientMessage): Add _NET_CLOSE_WINDOW support.

* exwm.el (exwm--on-ClientMessage): Add WM_CHANGE_STATE support.

* exwm.el (exwm--init-icccm-ewmh): Update supported atoms.
2016-07-13 19:36:50 +08:00
Chris Feng
650ed0013c Add initial support for dock (panel) applications
* exwm-layout.el (exwm-layout--fullscreen-frame-count)
(exwm-layout--set-frame-fullscreen): Moved to workspace module.
* exwm-workspace.el (exwm-workspace--fullscreen-frame-count)
(exwm-workspace--set-fullscreen):
Moved from layout module.

* exwm-manage.el (exwm-manage--manage-window):
Update struts for dock applications.
* exwm-workspace.el (exwm-workspace--strut)
(exwm-workspace--strut-is-partial): New variables for storing struts.
(exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Take struts into consideration.
* exwm.el (exwm--update-strut-legacy, exwm--update-strut-partial)
(exwm--update-strut): New functions for updating _NET_WM_STRUT
or _NET_WM_STRUT_PARTIAL.
(exwm--on-PropertyNotify): Update struts on corresponding event.
(exwm--init-icccm-ewmh): Declare _NET_WM_STRUT
and _NET_WM_STRUT_PARTIAL as supported.

* exwm-workspace.el (exwm-workspace--update-workareas):
Dedicated function for updating _NET_WORKAREA.
* exwm-randr.el (exwm-randr--refresh):
* exwm-workspace.el (exwm-workspace--init):
Use `exwm-workspace--update-workareas'.
* exwm.el (exwm--init-icccm-ewmh): Do not set _NET_WORKAREA here.
2016-07-12 18:35:51 +08:00
Chris Feng
0863f41490 * exwm-workspace.el (exwm-workspace--init): Remove possible
internal borders of workspace frames.
2016-07-12 12:14:36 +08:00
Chris Feng
1b2ae3749e Add cleanup codes for Emacs daemon
* exwm-floating.el (exwm-floating--exit):
* exwm-input.el (exwm-input--exit):
* exwm-layout.el (exwm-layout--exit):
* exwm-manage.el (exwm-manage--exit):
* exwm-randr.el (exwm-randr--exit):
* exwm-systemtray.el (exwm-systemtray--exit):
* exwm-workspace.el (exwm-workspace--exit):
New functions for cleanup each module.

* exwm-input.el (exwm-input--on-pre-command, exwm-input--on-post-command)
(exwm-input--init): Name lambda functions.

* exwm-layout.el (exwm-layout--timer, exwm-layout--init): Save timer.

* exwm-randr.el (exwm-randr-enable): Register the cleanup function.

* exwm-systemtray.el (exwm-systemtray--init): Force refresh atoms in XEMBED
and system tray protocols.
(exwm-systemtray-enable): Register the cleanup function.

* exwm-workspace.el (exwm-workspace--client): Save the server process.
(exwm-workspace--confirm-kill-emacs): Add emacsclient-specific
cleanup codes.
(exwm-workspace--timer): Save the timer.
(exwm-workspace--init): Save the server process and timer;
fix problems with emacsclient frames.

* exwm.el (exwm-init): Always select the newly created frame;
force refresh ICCCM & EWMH atoms.
(exwm-exit-hook): New hook for holding cleanup codes.
(exwm--exit): Run `exwm-exit-hook', execute cleanup codes for
each module and reset the environment.
2016-05-23 19:13:42 +08:00
Chris Feng
dc0c0f5131 Always add `exwm-workspace--on-focus-in'
* exwm-workspace.el (exwm-workspace--init):
`exwm-workspace--on-focus-in' should always be added to `focus-in-hook'.
2016-05-21 12:50:10 +08:00
Chris Feng
ddbbeda285 Fix 2 multi-monitor issues
* exwm-workspace.el (exwm-workspace--on-focus-in, exwm-workspace--init):
Handle unexpected frame switch in `focus-in-hook'.

* exwm-floating.el (exwm-floating--set-floating): If the absolute position
is (0, 0) then the relative position is also the same.
2016-04-07 21:03:42 +08:00
Chris Feng
fa204e1367 Fix emacsclient issues
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change):
* exwm-workspace.el (exwm-workspace--on-minibuffer-setup)
(exwm-workspace--on-minibuffer-exit, exwm-workspace--on-echo-area-dirty)
(exwm-workspace--on-echo-area-clear):
Exclude non-graphical frames.

* exwm.el (exwm--server-eval-at): Avoid using `x-dispaly-name'.
2016-03-25 13:57:42 +08: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
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
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
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
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
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
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
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
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
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
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