Commit graph

571 commits

Author SHA1 Message Date
Adrián Medraño Calvo
b100eb74c5 Merge branch 'nbarrientos.github.com/ib_exwm_conn_nil' into externals/exwm 2023-06-14 00:00:00 +00:00
Adrián Medraño Calvo
a417f0d45e Merge branch 'nbarrientos.github.com/post-command-hook' into externals/exwm 2023-06-09 00:00:00 +00:00
Adrián Medraño Calvo
7318f857f2 Observe connection status on deinitialization
* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Add optional argument quit.

* exwm-background.el (exwm-background--exit):
* exwm-input.el (exwm-input--exit):
* exwm-manage.el (exwm-manage--unmanage-window):
* exwm-systemtray.el (exwm-systemtray--exit):
* exwm-workspace.el (exwm-workspace--exit-minibuffer-frame)
(exwm-workspace--exit):
* exwm-xim.el (exwm-xim--exit): Observe connection status when
deinitializing in order to support deinitializing when the
connection breaks.
2023-06-09 00:00:00 +00:00
Nacho Barrientos
4d5b0e81cd Make sure the buffer that generates the event is current
* exwm-input.el (exwm-input--on-ButtonPress): Set current buffer
when running pre- and post-command hooks.
2023-06-09 00:00:00 +00:00
Nacho Barrientos
cff02333e2 Don't assume that exwm--connection is non-nil
`exwm-input--exit` could be called (via `exwm-exit`) from `exwm-init`
in case of error when initialising EXWM. It could happen that the bit
that failed when exwm-init is executed was the call to `xcb:connect`,
hence `exwm--connection` would be nil when errors are handled (and
`exwm-exit` is called).

Without this patch, in the case above, the user will see a crash as
there's no method allowing a nil XCB connection object:

  Debugger entered--Lisp error:
  (cl-no-applicable-method xcb:-+request nil #<xcb:SetInputFocus ...

even worse, not even giving the chance to the `warn` call in
`exwm-init`'s error handler to actually inform the user about the
actual problem ("[XELB] Connection timeout", for instance).

* exwm-input.el (exwm-input--exit): Check `exwm--connection' is
set before trying to send requests.
2023-06-09 00:00:00 +00:00
Adrián Medraño Calvo
b62d5e79b0 Use active-minibuffer-window' rather than minibuffer-window'
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use
`active-minibuffer-window`, instead of the minibuffer window of
selected frame, as there's no guarantee that the selected frame is
the frame containing the minibuffer.  Also make sure the frame is
an EXWM workspace.
2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
1c706daeb0 Merge branch 'drop-client-p' into externals/exwm 2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
6408a74312 Merge branch 'stebalien.github.com/fix/systemtray-height' into externals/exwm 2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
8e0c5ee327 Reduce logging verbosity
* exwm-input.el (exwm-input--on-echo-area-dirty)
(exwm-input--on-echo-area-clear): Reduce logging verbosity.
2022-11-22 00:00:00 +00:00
Steven Allen
cb0093411b Pick the correct line height for the systemtray
* exwm-systemtray.el (exwm-systemtray--init): Use the line-height
of the minibuffer-window, not that of the selected one.
2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
ac16b9a468 Merge branch 'stebalien.github.com/feat/background' into externals/exwm 2022-11-22 00:00:00 +00:00
Steven Allen
4e1bb33f37 Add a module for setting the X background
When enabled, EXWM will automatically set the background color either
the user-specified color, or theme's default background color. This will
even work with compositors such as picom.

* background.el: add it.
* exwm-core (exwm--intern-atom): optionally take a conn.
2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
e9cc0962cc Bump version to 0.27 2022-11-11 00:00:00 +00:00
Adrián Medraño Calvo
3fb1ebe58c Default exwm-systemtray color to `workspace-background'
* exwm-systemtray.el (exwm-systemtray-background-color): Change
default to `workspace-background', as it's supported in all
configurations.
2022-11-09 00:00:00 +00:00
Steven Allen
e95b9ebf1d Refresh the tray icon background when updating the background color
* exwm-systemtray.el (exwm-systemtray--refresh-background-color):
Add optional parameter REMAP to force redrawing of the background.
(exwm-systemtray--on-theme-change): Use it.
2022-11-09 00:00:00 +00:00
Steven Allen
b3766e52d6 * exwm-systemtray.el (exwm-systemtray--on-theme-change): Add missing parameter. 2022-11-09 00:00:00 +00:00
Adrián Medraño Calvo
f93bfb21f7 * exwm-systemtray.el (exwm-systemtray--init): Set EWMH window type to dock. 2022-11-09 00:00:00 +00:00
Adrián Medraño Calvo
07b9b2ccf8 Support setting system tray background color to current workspace's
* exwm-systemtray.el (exwm-systemtray-background-color): Add
support for using current workspace's background color as system
tray background color.
(exwm-systemtray--refresh-background-color): New function to set
the background color upon theme changes or workspace switches.
(exwm-systemtray--on-workspace-switch)
(exwm-systemtray--on-theme-change): Use it.
(exwm-systemtray--init): React to theme changes.
2022-11-09 00:00:00 +00:00
Adrián Medraño Calvo
b8d621041a Use default visual, depth and colormap in systray embedder window
We were using the Emacs' frame's depth, but not the visual nor colormap.
This failed with Emacs 29 and its support for 32-bit depths.

We now use the default screen's visual: using a non-default visual in
the system tray requires support for embedding icons with different
visuals, which is not implemented.  We restrict our limited transparency
support to Emacs frames with depth equal to the default visual's detph.

* exwm-core.el (exwm--get-visual-depth-colormap): New function.
* exwm-systemtray.el (exwm-systemtray--init): Use root window's
visual, depth and colormap. Reset all attributes that refer
(perhaps due to defaults) to the parent window, as it might have a
different visual, depth or colormap.
(exwm-systemtray--init): Set _NET_SYSTEM_TRAY_VISUAL.
(exwm-systemtray-background-color): Emit a warning when
transparency is selected but not supported.
(exwm-systemtray--set-background-color): New function to set
embedder window background.
(exwm-systemtray--embedder-window-depth): Add variable.
(exwm-systemtray--transparency-supported-p): New function to check
whether transparency is supported.
2022-11-04 00:00:00 +00:00
Adrián Medraño Calvo
e8e4a66094 Merge branch 'j4m3s-s.github.com/master' into externals/exwm 2022-10-29 00:00:00 +00:00
Adrián Medraño Calvo
feebdf827b Merge branch 'mgi.github.com/mgi/fix' into externals/exwm 2022-10-29 00:00:00 +00:00
James
0a2c03ed59 Fix logging order in exwm-workspace--set-active
* exwm-workspace.el (exwm-workspace--set-active): Swap logging
  arguments to match message.

Copyright-paperwork-exempt: yes
2022-10-29 00:00:00 +00:00
Adrián Medraño Calvo
4c0b9bb5c2 Merge branch 'stebalien.github.com/fix/hide-floating-tabs' into externals/exwm 2022-10-29 00:00:00 +00:00
Manuel Giraud
ce2191c444 Focus workspace frames upon _NET_ACTIVE_WINDOW
* exwm.el (exwm--on-ClientMessage): Take care of focusing
workspace frames when a _NET_ACTIVE_WINDOW message is received for
a workspace frame.  This is responsibility of the window manager
when it advertises _NET_ACTIVE_WINDOW support, which we do.
Emacs versions before 29 took care of setting the input focus to
the frame.

Thanks-to: Po Lu for the work on Emacs and assistance with this
           issue.
2022-10-29 00:00:00 +00:00
Steven Allen
e042832b2b
Hide tab-bar on floating windows
Floating windows are dedicated to a specific buffer anyways.

* exwm-floating.el (exwm-floating--set-floating): Hide the tab bar.
2022-07-26 07:39:37 -07:00
Adrián Medraño Calvo
e43bd78258 Use 32-bit visual for frame containers
* exwm-core.el (exwm--get-visual-depth-colormap): New function.
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Use
Emacs' frame's visual, depth and colormap. Reset all attributes
that refer (also by default) to the parent window (the root
window), as it might have a different visual, depth or colormap.

Special-thanks-to: Elijah Malaby <qwe12345678910@gmail.com> for figuring out the
  changes needed to suport 32-bit visuals and proposing the initial
  version of this improvement.
2022-03-24 00:00:00 +00:00
Elijah Malaby
563cba2abc Set WM_STATE on emacs frames
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Set
WM_STATE.

Copyright-paperwork-exempt: yes
2022-02-10 00:00:00 +00:00
Adrián Medraño Calvo
445e94189c Add license file
* LICENSE: Add file.
2022-02-10 00:00:00 +00:00
Adrián Medraño Calvo
d6f62ff55a Check EXWM terminal instead of client or graphical frames
* exwm-core.el (exwm--terminal-p): Add function.
* exwm.el (exwm--confirm-kill-terminal): Use it.
* exwm-input.el (exwm-input--on-buffer-list-update): Use it.
(exwm-input--on-minibuffer-setup)
(exwm-input--on-minibuffer-exit): Use it.
(exwm-input--on-minibuffer-exit): Use the minibuffer's selected
window's frame or selected frame instead of current workspace.
(exwm-input--on-echo-area-dirty): Removed test, as it's checked in
`exwm-input--on-minibuffer-setup'.
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use it.
(exwm-layout--on-echo-area-change): Refresh layout the
frame of selected window's minibuffer if it's an EXWM frame.
* exwm-workspace.el (exwm-workspace--update-minibuffer-height)
(exwm-workspace--on-minibuffer-setup)
(exwm-workspace--on-minibuffer-exit)
(exwm-workspace--on-echo-area-dirty)
(exwm-workspace--on-echo-area-clear)
(exwm-workspace--on-delete-frame): Use it.
* exwm-workspace.el (exwm-workspace--client-p-hash-table): Remove
variable.
(exwm-workspace--client-p): Remove function.
2022-02-01 00:00:00 +00:00
Adrián Medraño Calvo
d4a7d16676 Improve confirmation prompts
* exwm.el (exwm-restart, exwm--confirm-kill-emacs): Improve
confirmation prompts.
2021-12-09 00:00:00 +00:00
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
10bd12234e Bump version to 0.26 2021-11-10 00:00:00 +00:00
Adrián Medraño Calvo
08f20ea0b9 Fix previous commit "Remove duplicate code"
* exwm-layout.el (exwm-layout-unset-fullscreen):
`xcb:Atom:_NET_WM_STATE_FULLSCREEN' must be excised before
invoking `exwm-layout--show'.
2021-11-10 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
571ca227e7 Remove duplicate code
* exwm-layout.el (exwm-layout-unset-fullscreen): Remove double
removal of `xcb:Atom:_NET_WM_STATE_FULLSCREEN' from
`exwm--ewmh-state'.
2021-10-30 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
52a0b1c556 Merge branch 'tumashu.github.com/master' into externals/exwm 2021-10-30 00:00:00 +00:00
Adrián Medraño Calvo
deabe9c2df Bump version to 0.25 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
Adrián Medraño Calvo
835a7add7c New maintainer 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
1863361674 Merge branch 'tumashu.github.com/master' into externals/exwm 2021-10-25 11:51:15 -04:00
Feng Shu
3d648ef1c4 Add variable indicating XIM buffers
* exwm-xim.el (exwm-xim-buffer-p): New variable.
(exwm-xim--handle-forward-event-request): Add exwm-xim-buffer-p
2021-10-25 11:42:33 -04:00
Chris Feng
0368127976 Make button events working with winner-mode
* exwm-input.el (exwm-input--fake-last-command): Extracted for reuse.
(exwm-input--on-ButtonPress, exwm-input--on-KeyPress-line-mode): Use
it.
2020-07-12 00:00:00 +00:00
Chris Feng
edb930005b Fix fullscreen states
* exwm-layout.el (exwm-layout-set-fullscreen,
exwm-layout-unset-fullscreen): Use `exwm--id' for interactive use.
(exwm-layout-unset-fullscreen): Mandatorily clear fullscreen states.
2020-06-14 00:00:00 +00:00