Commit graph

190 commits

Author SHA1 Message Date
Adrián Medraño Calvo
ca7623349e Leave `client' frame parameter in place
EXWM removed the `client' frame parameter from workspace frames,
perhaps in order to lead Emacs to ask for confirmation before
quitting.  This change leaves the `client' frame parameter in
place.  Emacs no longer asks for confirmation when killing the
emacsclient session.  A followup commit will correct this.

* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
(exwm-workspace--init-minibuffer-frame, exwm-workspace--init)
(exwm-workspace--exit, exwm-workspace--post-init): Remove special
handling for `client' frames.  They become workspaces just like
any other frame.
2021-12-09 00:00:00 +00:00
Adrián Medraño Calvo
1aa4ca781d Support for killing the X terminal
Check whether frames are alive upon teardown, as it might not be
the case when the terminal is killed as
`delete-terminal-functions' might be invoked after the terminal is
deleted.

* exwm-core.el (exwm--terminal): New variable holding the terminal
EXWM runs under.
(exwm-init, exwm-exit): Set and unset it.

* exwm.el (exwm--on-delete-terminal): New function for exiting
EXWM when the terminal is deleted.
(exwm-init): Use it.

* exwm.el (exwm--confirm-kill-terminal, exwm-init): Ask for
confirmation before deleting terminal.

* exwm-workspace.el (exwm-workspace--fullscreen-workspace): New
function.  Ensure the frame is alive.
(exwm-workspace--add-frame-as-workspace): Use it.
(exwm-workspace--exit-minibuffer-frame): Cancel
`exwm-workspace--display-echo-area-timer'.
(exwm-workspace--exit-minibuffer-frame): Ensure the minibuffer
frame is alive.
(exwm-workspace--exit): Ignore dead workspace frames.
2021-12-09 00:00:00 +00:00
Adrián Medraño Calvo
a11bb099fb Refactor re-creation of last frame
* exwm-workspace.el (exwm-workspace--get-next-workspace): Return
nil when there's only one frame.
(exwm-workspace--on-delete-frame)
(exwm-workspace--remove-frame-as-workspace): Create a workspace
when removing the last one, for X windows to be moved to.
2021-12-09 00:00:00 +00:00
Adrián Medraño Calvo
62ffde76aa Refactor `exwm-workspace--get-remove-frame-next-workspace'
* exwm-workspace.el (exwm-workspace--prompt-delete)
(exwm-workspace--set-desktop): Stop explicitly moving X windows to
other workspace; dealt with by
`exwm-workspace--remove-frame-as-workspace'.
(exwm-workspace--get-remove-frame-next-workspace): Remove
function.  Refactored into `exwm-workspace--get-next-workspace'
and `exwm-workspace--remove-frame-as-workspace'.
(exwm-workspace--get-next-workspace): Add function.
(exwm-workspace--remove-frame-as-workspace): Move X windows to
next workspace.
2021-12-09 00:00:00 +00:00
Adrián Medraño Calvo
5098708c92 Correct wrong variable name
* exwm-workspace.el (exwm-workspace--on-delete-frame): Correct
misstyped name of variable `exwm-workspace--client-p-hash-table'.
2021-11-02 00:00:00 +00:00
Adrián Medraño Calvo
1bc66b6438 Merge branch 'mattbeshara.github.com/less-consy-workspace--client-p' into externals/exwm 2021-10-30 00:00:00 +00:00
Adrián Medraño Calvo
c1206ac665 Update copyright year to 2021 2021-10-29 00:00:00 +00:00
Matt Beshara
d0b0b38c87 Explicitly remove workspace frames from client-p cache when deleted
* exwm-workspace.el (exwm-workspace--on-delete-frame): Clean up
hash table entries upon removing a workspace.
2021-10-25 12:05:09 -04:00
Matt Beshara
8905e85d34 Rename variable using ‘exwm-workspace’ package prefix; add docstring
* exwm-workspace.el (exwm-workspace--client-p-hash-table): Rename
`exwm--client-p-hash-table'.
2021-10-25 12:05:09 -04:00
Matt Beshara
182ffbed6c Use a hash table to cache result of ‘exwm-workspace--client-p’
* exwm-workspace.el (exwm--client-p-hash-table): New variable.
(exwm-workspace--client-p): Use `exwm--client-p-hash-table' to
store which workspace frames are client frames instead of
frequently invoking `frame-parameter'.
2021-10-25 12:05:09 -04:00
Adrián Medraño Calvo
c7c42582b7 Prevent jumping back to previous workspace
* exwm-workspace.el (exwm-workspace-switch): Focus out old frame
	before switching to the new one to prevent jumping back to
	previous workspace.
2020-05-06 00:00:00 +00:00
Adrián Medraño Calvo
373eda99bd Stop aborting recursive edit upon switching workspaces.
* exwm-workspace.el (exwm-workspace-switch): Stop aborting
	recursive edit upon switching workspaces.  Users should handle it
	just like in regular Emacs (possibly customizing
	`enable-recursive-minibuffers').
2020-04-15 00:00:00 +00:00
Adrián Medraño Calvo
cddb3429d2 Abort recursive edit before switching workspaces
* exwm-workspace.el (exwm-workspace-switch): Abort recursive edit
	before switching to other workspace.  This avoids the usual
	`set-window-configuration' calls (e.g., by `eval-expression') to
	switch *us back to the previous workspace.
2020-04-15 00:00:00 +00:00
Chris Feng
27a884e947 Update copyright year to 2020 2020-02-02 00:00:00 +00:00
Chris Feng
8b05c2a30d Eliminate a compile warning
* exwm-workspace.el (exwm-workspace-move-window): Replace the
obsolete `run-window-configuration-change-hook'.
2019-12-08 00:00:00 +00:00
Chris Feng
1e9be0de38 Fix detection of `exwm-workspace--window-y-offset'
* exwm-workspace.el (exwm-workspace--update-offsets): Explicitly
request the geometry of the container for the first workspace as it
may not align with the top of the root X window.
2019-10-02 00:00:00 +00:00
Chris Feng
9eed52ee2b Avoid calling `x-focus-frame' on non-graphical frames
* exwm-workspace.el (exwm-workspace--client-p): Also account for
non-graphical frames.
* exwm-input.el (exwm-input--on-minibuffer-setup)
(exwm-input--on-minibuffer-exit): Exclude emacsclient frames.
2019-10-02 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
48b15e25ad Improve user options
* exwm-floating.el (exwm-floating-border-color)
(exwm-floating-border-width): Make changes take effect w/o restart.
(exwm-floating--init-border): Refactored out from
`exwm-floating--init'.

* exwm-workspace.el (exwm-workspace-minibuffer-position): Clarify
a restart is required.
2019-09-13 00:00:00 +00:00
Chris Feng
5fbf20ba16 ; Improve messages for automatically created workspaces 2019-09-08 00:00:00 +00:00
Chris Feng
d63dc6a82a Ignore non-exwm-mode' buffers in exwm-workspace-move-window'
* exwm-workspace.el (exwm-workspace-move-window): Ignore
non-`exwm-mode' buffers.
2019-08-25 00:00:00 +00:00
Chris Feng
dd6f5c36ed Inform user about making a frame a workspace
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Add a
message.
(exwm-workspace--init): Exclude initial workspaces.
2019-08-11 00:00:00 +00:00
Chris Feng
c579476536 Fix `after-focus-change-function' not working
* exwm-workspace.el (exwm-workspace--original-handle-focus-in)
(exwm-workspace--original-handle-focus-out): Store the original
`handle-focus-{in,out}'.
(exwm-workspace-switch): Now that `handle-focus-{in,out}' has been
updated to call other stuffs like `after-focus-change-function', we
can no longer run `focus-{in,out}-hook' only.
2019-07-28 00:00:00 +00:00
Chris Feng
fe8ee3c578 Fix 'Attempt to delete a surrogate minibuffer frame' error
* exwm-workspace.el (exwm-workspace--get-remove-frame-next-workspace):
New function automatically moves X window elsewhere before removing a
workspace; also returns the destination workspace.
(exwm-workspace--prompt-delete, exwm-workspace-delete)
(exwm-workspace--remove-frame-as-workspace): Use it.
* exwm.el (exwm--on-ClientMessage): Use it.
2019-06-30 00:00:00 +00:00
Stefan Monnier
81e52263a7 * exwm-workspace.el: Use closures rather than `(lambda ...) 2019-03-17 10:47:28 -04:00
Chris Feng
dd96fffb52 Add extra keys for selecting workspace
* exwm-workspace.el (exwm-workspace--switch-map)
(exwm-workspace--init): Avoid initializing the keymap when loading.
(exwm-workspace--init-switch-map): Initialize
`exwm-workspace--switch-map' and also add extra keybindings when
`exwm-workspace-index-map' has been customized.
2019-03-17 00:00:00 +00:00
Chris Feng
225c68d4ce Merge branch 'retain-echo-area-until-input' of https://github.com/medranocalvo/exwm into medranocalvo/retain-echo-area-until-input 2019-02-06 00:00:00 +00:00
Chris Feng
993ca8a13a Update copyright year to 2019 2019-02-01 00:00:00 +00:00
Chris Feng
58f7916619 ; Improve debug logs. 2018-12-02 00:00:00 +00:00
Chris Feng
e597ab4f78 Add support for RandR 1.5 monitor
* exwm-randr.el (exwm-randr-workspace-monitor-plist): New user option
for specifying which monitor each workspace should be displayed on.
(exwm-randr-workspace-monitor-plist): Made obsolete.
(exwm-randr--get-monitors): New function for fetching active monitors.
(exwm-randr--refresh): Adapted to use monitor.
(exwm-randr--init): Now requires RandR 1.5.

* exwm-randr.el:
* exwm-workspace.el: Rename `output' to `monitor'.
2018-11-04 00:00:00 +00:00
Adrián Medraño Calvo
cd7b32d1c2 Hide minibuffer upon receiving any event
* exwm-input.el (exwm-input--event-hook): New variable.
(exwm-input--on-ButtonPress, exwm-input--on-KeyPress): Run
`exwm-input--event-hook'.
* exwm-workspace.el (exwm-workspace--init, exwm-workspace--exit):
Hide minibuffer upon noticing an event.
2018-11-03 12:00:00 +00:00
Adrián Medraño Calvo
0dd909a11b Stop hiding the minibuffer when a message is being displayed
* exwm-workspace.el (exwm-workspace--echo-area-maybe-clear): New
function that postpones hiding the minibuffer when it's displaying
a message.
(exwm-workspace--on-echo-area-dirty): Use it.
2018-11-03 12:00:00 +00:00
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