Commit graph

26 commits

Author SHA1 Message Date
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
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
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
983fd468dc Add missing declarations
* exwm-systemtray.el :
	* exwm-manage.el :
	* exwm-layout.el :
	* exwm-input.el :
	* exwm-floating.el :
	* exwm-core.el : Add missing function declarations.
2016-07-17 12:00:00 +00:00
Chris Feng
2195316821 Add major mode menu
* exwm-core.el (exwm--keyboard-grabbed): New buffer-local variable for
recoding grabbing state.
(exwm-mode-menu, exwm-mode-map): Add major mode menu.
* exwm-input.el (exwm-input-set-key): Update prefix keys when a global
binding is interactively set.
(exwm-input-grab-keyboard, exwm-input-release-keyboard): Update grabbing
state.
2016-07-17 12:46:19 +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
3dba5f156f Manage a certain type of undecorated X windows
* exwm-core.el (exwm--mwm-hints): Removed.
(exwm--mwm-hints-decorations): New buffer-local variable for
indicating whether the X window should have decorations.
* exwm-floating.el (exwm-floating--set-floating): Hide the mode-line
of undecorated floating X windows by default.
* exwm-manage.el (exwm-manage--update-mwm-hints):
Set exwm--mwm-hints-decorations;
(exwm-manage--manage-window): Manage an undecorated X window if its
input model is not 'No Input' or 'Globally Active'.
2016-05-24 12:30:53 +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
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
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
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
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
2d42fee327 Merge branch 'feat/virtual-root' 2016-02-03 13:30:14 +08:00
Chris Feng
9c95c03e18 Rework the X windows hierarchy model
This commit add workspace and X window containers support to avoid using
Emacs frames as the parents of X windows.  This should make it easier to
set input focus.

* exwm-core.el (exwm--container, exwm--floating-frame-position): New file
local variables.
(exwm--floating-frame-geometry): Removed file local variable.
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating--do-moveresize)
(exwm-floating-move): Use container.
(exwm-floating--fit-frame-to-window): No longer adjust stacking order.
(exwm-floating--fit-frame-to-window): The first member is changed to
buffer.
(exwm-floating--start-moveresize): Use container.  Correctly set input
focus.
* exwm-input.el (exwm-input--redirected, exwm-input--on-focus-in): Removed.
(exwm-input--on-buffer-list-update): Remove the restriction on floating
frames which is no longer valid.
(exwm-input--update-focus): Adjust stacking order.
(exwm-input--on-minibuffer-setup): New function for setting focus on the
Emacs frame when entering minibuffer.
(exwm-input--on-KeyPress-line-mode): No longer compensate FocusOut event.
(exwm-input--grab-keyboard, exwm-input--release-keyboard): Local keys are
now grabbed on the X window container.
(exwm-input--init): Add `exwm-input--on-minibuffer-setup' to
`minibuffer-setup-hook'.
* exwm-layout.el (exwm-layout--resize-container): New function to
resize/reposition both the X window and its container.
(exwm-layout--show, exwm-layout--hide): Use container.
(exwm-layout-set-fullscreen): Use container.  No longer save width and
height.
(exwm-layout-unset-fullscreen, exwm-layout--set-frame-fullscreen): Use
container.
(exwm-layout--refresh): Update a frame parameter.  Remove dead code.
* exwm-manage.el (exwm-manage--manage-window): Reparent unmanaged X windows
to the workspace.  Create X window container as the parent of the X window.
(exwm-manage--unmanage-window): Unmap/destroy container when appropriate.
Use the position of container.
(exwm-manage--unmanage-window): Destroy the container.
* exwm-randr.el (exwm-randr--refresh): Resize workspace using container.
* exwm-workspace.el (exwm-workspace-switch): Raise workspace.
Correctly set input focus.
(exwm-workspace--on-focus-in): Removed.
(exwm-workspace-move-window): Reparent to workspace container.
(exwm-workspace--init): Create workspace frames as visible.
Create workspace containers.
Remove exwm-workspace--on-focus-in from focus-in-hook.
Update _NET_VIRTUAL_ROOTS.
* exwm.el (exwm-init): No longer disable hourglass window.
Initialize workspace module before input.

* exwm-core.el (exwm--debug): New macro for setting debug forms.

* exwm-floating.el (exwm-floating--set-floating): No longer do `exwm--lock'
and `exwm--unlock' since `make-frame' is already adviced to take care of
everything.  Correctly set input focus to the newly created floating
X window.

* exwm-core.el (exwm--floating-edges): Removed file local variable.
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating):
* exwm-layout.el (exwm-layout--show, exwm-layout-enlarge-window):
* exwm-manage.el (exwm-manage--on-ConfigureRequest):
No longer use floating geometry.

* exwm-input.el (exwm-input--update-global-prefix-keys): Grab global keys
on workspaces containers instead of the root window (or input focus would
transfer to the workspace containing the pointer when the grab is active).
* exwm-workspace.el (exwm-workspace-switch): No longer move mouse.
2016-02-03 12:12:24 +08:00
Chris Feng
0db666b4fb Update copyright year to 2016 2016-02-02 22:33:58 +08:00
Chris Feng
b2ee102051 Improve robustness of killing buffers
* exwm-core.el (exwm-mode): Use the return value of
  exwm-manage--close-window.
* exwm-manage.el (exwm-manage--close-window): Kill empty buffers; Handle X
  windows that does not support _NET_WM_PING.
  (exwm-manage--kill-client): Kill X windows supporting _NET_WM_PID with
  both SIGKILL and KillClient.
2015-10-29 18:32:55 +08:00
Chris Feng
e8bc51280d Fix workspace switch issues
* exwm-core.el (exwm--make-emacs-idle-for): Removed.
* exwm-workspace.el (exwm-workspace--switch-count): New variable.
  (exwm-workspace-switch): Increase exwm-workspace--switch-count when
  necessary; Remove the call to exwm--make-emacs-idle-for.
  (exwm-workspace--on-focus-in): Consume exwm-workspace--switch-count.

* exwm-workspace.el (exwm-workspace--on-focus-in): Close active minibuffer.
2015-10-25 14:51:06 +08:00
Chris Feng
5184f0d7c1 Work around subrs that block EXWM; other minor fixes
Some subrs (e.g. x-file-dialog) create X windows and block the execution of
EXWM, so they won't work normally.  This commit partly fixes this issue by
invoking them in a subordinate Emacs instance and trying to fetch the
result back.

* exwm.el (exwm-blocking-subrs): New variable for specify such subrs.
* exwm.el (exwm-enable, exwm--server-name, exwm--server-stop)
  (exwm--server-eval-at): The implementation.

* exwm-core.el:
* exwm-floating.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-randr.el:
  Evaluate constants at compile-time.

* README.md: Renamed from README.org to make the 'Commentary:' section
  used by GNU ELPA instead.

* exwm.el: Depends on XELB version 0.3.
2015-09-27 19:43:06 +08:00
Chris Feng
b35430429e Check _MOTIF_WM_HINTS when attempting to manage an X window
* exwm-core.el: New buffer-local variable exwm--mwm-hints.
* exwm-manage.el: New variable exwm--atom-_MOTIF_WM_HINTS for holding the
  value of _MOTIF_WM_HINTS atom; new function exwm--update-mwm-hints for
  updating the _MOTIF_WM_HINTS property of an X window.
* exwm-manage.el (exwm-manage--init): Intern the _MOTIF_WM_HINTS atom.
* exwm-manage.el (exwm-manage--manage-window): Avoid managing windows
  without decoration (implied by _MOTIF_WM_HINTS).
2015-09-19 16:53:45 +08:00
Chris Feng
eafd031c55 Allow hide/show mode-line on floating frames
* exwm-core.el: new buffer-local variable exwm--floating-mode-line-format for
  saving mode-line-format when mode-line is hidden
* exwm-floating.el (exwm-floating--fit-frame-to-window)
  (exwm-floating-hide-mode-line, exwm-floating-show-mode-line): new functions
  for resizing frames, hiding/showing mode-line respectively;
  (exwm-floating--set-floating): use exwm-floating--fit-frame-to-window to
  resize frames
2015-09-07 17:33:22 +08:00
Chris Feng
6d63c71280 Prepare for GNU ELPA release
* Transfer copyright to Free Software Foundation
* Add packaging components (e.g. headers)
* Coding style fixes:
  + Quote functions with "#'"
  + Wrap long lines
  + Fix doc strings / comments
* Replace `string-to-int' with `string-to-number'
* Fix compiling errors / eliminate compiling warnings
  + Add exwm-core.el to hold common variables, functions and macros
* Remove the redundant COPYING file
* Add .gitignore
* Rename README to README.md
2015-09-04 09:15:20 +08:00