[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 404c945: Automatically iconify floating X windows
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 404c945: Automatically iconify floating X windows |
Date: |
Sun, 30 Dec 2018 02:24:46 -0500 (EST) |
branch: externals/exwm
commit 404c94568d581fb66fca5e2524c908d631883884
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
Automatically iconify floating X windows
* exwm-layout.el (exwm-layout-auto-iconify): New user option to
specify whether to automatically iconify X windows.
(exwm-layout--auto-iconify): Automatically iconify floating X windows
when its main X window (if any) is iconified.
(exwm-layout--show, exwm-layout--hide): Use it.
---
exwm-layout.el | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/exwm-layout.el b/exwm-layout.el
index 8b2fc2a..6c9f0ff 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -32,6 +32,10 @@
:version "25.3"
:group 'exwm)
+(defcustom exwm-layout-auto-iconify t
+ "Non-nil to automatically iconify unused X windows when possible."
+ :type 'boolean)
+
(defcustom exwm-layout-show-all-buffers nil
"Non-nil to allow switching to buffers on other workspaces."
:type 'boolean)
@@ -76,6 +80,20 @@
(when (derived-mode-p 'exwm-mode)
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)))
+(defun exwm-layout--auto-iconify ()
+ (when (and exwm-layout-auto-iconify
+ (not exwm-transient-for))
+ (let ((xwin exwm--id)
+ (state exwm-state))
+ (dolist (pair exwm--id-buffer-alist)
+ (with-current-buffer (cdr pair)
+ (when (and exwm--floating-frame
+ (eq exwm-transient-for xwin)
+ (not (eq exwm-state state)))
+ (if (eq state xcb:icccm:WM_STATE:NormalState)
+ (exwm-layout--refresh-floating exwm--floating-frame)
+ (exwm-layout--hide exwm--id))))))))
+
(defun exwm-layout--show (id &optional window)
"Show window ID exactly fit in the Emacs window WINDOW."
(exwm--log "Show #x%x in %s" id window)
@@ -111,7 +129,8 @@
height height*)))
(exwm--set-geometry id x y width height)
(xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
- (exwm-layout--set-state id xcb:icccm:WM_STATE:NormalState)))
+ (exwm-layout--set-state id xcb:icccm:WM_STATE:NormalState)
+ (exwm-layout--auto-iconify)))
(xcb:flush exwm--connection))
(defun exwm-layout--hide (id)
@@ -141,6 +160,7 @@
:window id :value-mask xcb:CW:EventMask
:event-mask exwm--client-event-mask))
(exwm-layout--set-state id xcb:icccm:WM_STATE:IconicState)
+ (exwm-layout--auto-iconify)
(xcb:flush exwm--connection))))
;;;###autoload
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/exwm 404c945: Automatically iconify floating X windows,
Chris Feng <=