2015-07-17 13:16:08 +02:00
|
|
|
|
;;; exwm-layout.el --- Layout Module for EXWM -*- lexical-binding: t -*-
|
|
|
|
|
|
2021-10-29 02:00:00 +02:00
|
|
|
|
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
|
|
|
|
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; This file is part of GNU Emacs.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This module is responsible for keeping X client window properly displayed.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
(require 'exwm-core)
|
|
|
|
|
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(defgroup exwm-layout nil
|
|
|
|
|
"Layout."
|
|
|
|
|
:version "25.3"
|
|
|
|
|
:group 'exwm)
|
|
|
|
|
|
2018-12-30 01:00:00 +01:00
|
|
|
|
(defcustom exwm-layout-auto-iconify t
|
|
|
|
|
"Non-nil to automatically iconify unused X windows when possible."
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(defcustom exwm-layout-show-all-buffers nil
|
|
|
|
|
"Non-nil to allow switching to buffers on other workspaces."
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2019-09-13 02:00:00 +02:00
|
|
|
|
(defconst exwm-layout--floating-hidden-position -101
|
|
|
|
|
"Where to place hidden floating X windows.")
|
|
|
|
|
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(defvar exwm-layout--other-buffer-exclude-buffers nil
|
|
|
|
|
"List of buffers that should not be selected by `other-buffer'.")
|
|
|
|
|
|
|
|
|
|
(defvar exwm-layout--other-buffer-exclude-exwm-mode-buffers nil
|
|
|
|
|
"When non-nil, prevent EXWM buffers from being selected by `other-buffer'.")
|
|
|
|
|
|
|
|
|
|
(defvar exwm-layout--timer nil "Timer used to track echo area changes.")
|
|
|
|
|
|
|
|
|
|
(defvar exwm-workspace--current)
|
2019-09-14 02:00:00 +02:00
|
|
|
|
(defvar exwm-workspace--frame-y-offset)
|
2018-05-20 10:14:01 +02:00
|
|
|
|
(declare-function exwm-input--release-keyboard "exwm-input.el")
|
|
|
|
|
(declare-function exwm-input--grab-keyboard "exwm-input.el")
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(declare-function exwm-input-grab-keyboard "exwm-input.el")
|
2018-08-05 02:00:00 +02:00
|
|
|
|
(declare-function exwm-workspace--active-p "exwm-workspace.el" (frame))
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
|
|
|
|
|
(declare-function exwm-workspace--workspace-p "exwm-workspace.el"
|
|
|
|
|
(workspace))
|
|
|
|
|
(declare-function exwm-workspace-move-window "exwm-workspace.el"
|
|
|
|
|
(frame-or-index &optional id))
|
2015-09-19 06:34:30 +02:00
|
|
|
|
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(defun exwm-layout--set-state (id state)
|
|
|
|
|
"Set WM_STATE."
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log "id=#x%x" id)
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:icccm:set-WM_STATE
|
|
|
|
|
:window id :state state :icon xcb:Window:None))
|
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
|
|
|
|
(setq exwm-state state)))
|
|
|
|
|
|
|
|
|
|
(defun exwm-layout--iconic-state-p (&optional id)
|
|
|
|
|
(= xcb:icccm:WM_STATE:IconicState
|
|
|
|
|
(if id
|
|
|
|
|
(buffer-local-value 'exwm-state (exwm--id->buffer id))
|
|
|
|
|
exwm-state)))
|
|
|
|
|
|
2020-03-29 01:00:00 +01:00
|
|
|
|
(defun exwm-layout--set-ewmh-state (xwin)
|
|
|
|
|
"Set _NET_WM_STATE."
|
|
|
|
|
(with-current-buffer (exwm--id->buffer xwin)
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ewmh:set-_NET_WM_STATE
|
|
|
|
|
:window exwm--id
|
|
|
|
|
:data exwm--ewmh-state))))
|
|
|
|
|
|
2018-03-04 05:23:37 +01:00
|
|
|
|
(defun exwm-layout--fullscreen-p ()
|
|
|
|
|
(when (derived-mode-p 'exwm-mode)
|
|
|
|
|
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)))
|
|
|
|
|
|
2018-12-30 01:00:00 +01:00
|
|
|
|
(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))))))))
|
|
|
|
|
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(defun exwm-layout--show (id &optional window)
|
|
|
|
|
"Show window ID exactly fit in the Emacs window WINDOW."
|
2015-08-07 14:22:12 +02:00
|
|
|
|
(exwm--log "Show #x%x in %s" id window)
|
2016-02-03 05:12:24 +01:00
|
|
|
|
(let* ((edges (window-inside-absolute-pixel-edges window))
|
2016-08-06 15:42:43 +02:00
|
|
|
|
(x (pop edges))
|
|
|
|
|
(y (pop edges))
|
|
|
|
|
(width (- (pop edges) x))
|
|
|
|
|
(height (- (pop edges) y))
|
2019-09-14 02:00:00 +02:00
|
|
|
|
frame-x frame-y frame-width frame-height)
|
2016-02-03 05:12:24 +01:00
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
2022-12-01 02:00:01 +01:00
|
|
|
|
(when tab-line-format
|
|
|
|
|
(setq y (+ y (window-tab-line-height window))))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(when exwm--floating-frame
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(setq frame-width (frame-pixel-width exwm--floating-frame)
|
2019-09-08 02:00:00 +02:00
|
|
|
|
frame-height (+ (frame-pixel-height exwm--floating-frame)
|
|
|
|
|
;; Use `frame-outer-height' in the future.
|
2019-09-14 02:00:00 +02:00
|
|
|
|
exwm-workspace--frame-y-offset))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(when exwm--floating-frame-position
|
|
|
|
|
(setq frame-x (elt exwm--floating-frame-position 0)
|
|
|
|
|
frame-y (elt exwm--floating-frame-position 1)
|
2019-09-13 02:00:00 +02:00
|
|
|
|
x (+ x frame-x (- exwm-layout--floating-hidden-position))
|
|
|
|
|
y (+ y frame-y (- exwm-layout--floating-hidden-position)))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(setq exwm--floating-frame-position nil))
|
|
|
|
|
(exwm--set-geometry (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container)
|
|
|
|
|
frame-x frame-y frame-width frame-height))
|
2018-03-04 05:23:37 +01:00
|
|
|
|
(when (exwm-layout--fullscreen-p)
|
|
|
|
|
(with-slots ((x* x)
|
|
|
|
|
(y* y)
|
|
|
|
|
(width* width)
|
|
|
|
|
(height* height))
|
|
|
|
|
(exwm-workspace--get-geometry exwm--frame)
|
|
|
|
|
(setq x x*
|
|
|
|
|
y y*
|
|
|
|
|
width width*
|
|
|
|
|
height height*)))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(exwm--set-geometry id x y width height)
|
2016-02-20 07:52:53 +01:00
|
|
|
|
(xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
|
2018-12-30 01:00:00 +01:00
|
|
|
|
(exwm-layout--set-state id xcb:icccm:WM_STATE:NormalState)
|
2020-03-29 01:00:00 +01:00
|
|
|
|
(setq exwm--ewmh-state
|
|
|
|
|
(delq xcb:Atom:_NET_WM_STATE_HIDDEN exwm--ewmh-state))
|
|
|
|
|
(exwm-layout--set-ewmh-state id)
|
2018-12-30 01:00:00 +01:00
|
|
|
|
(exwm-layout--auto-iconify)))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:flush exwm--connection))
|
|
|
|
|
|
|
|
|
|
(defun exwm-layout--hide (id)
|
|
|
|
|
"Hide window ID."
|
2016-02-26 11:18:34 +01:00
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
2018-02-19 15:34:03 +01:00
|
|
|
|
(unless (or (exwm-layout--iconic-state-p)
|
|
|
|
|
(and exwm--floating-frame
|
2018-04-15 23:52:39 +02:00
|
|
|
|
(eq 4294967295. exwm--desktop)))
|
2016-02-26 11:18:34 +01:00
|
|
|
|
(exwm--log "Hide #x%x" id)
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(when exwm--floating-frame
|
|
|
|
|
(let* ((container (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container))
|
|
|
|
|
(geometry (xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:GetGeometry
|
|
|
|
|
:drawable container))))
|
|
|
|
|
(setq exwm--floating-frame-position
|
|
|
|
|
(vector (slot-value geometry 'x) (slot-value geometry 'y)))
|
2019-09-13 02:00:00 +02:00
|
|
|
|
(exwm--set-geometry container exwm-layout--floating-hidden-position
|
|
|
|
|
exwm-layout--floating-hidden-position
|
|
|
|
|
1
|
|
|
|
|
1)))
|
2016-02-03 05:12:24 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
2016-02-26 11:18:34 +01:00
|
|
|
|
(make-instance 'xcb:ChangeWindowAttributes
|
|
|
|
|
:window id :value-mask xcb:CW:EventMask
|
|
|
|
|
:event-mask xcb:EventMask:NoEvent))
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:UnmapWindow :window id))
|
2016-02-26 11:18:34 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ChangeWindowAttributes
|
|
|
|
|
:window id :value-mask xcb:CW:EventMask
|
2019-03-17 01:00:00 +01:00
|
|
|
|
:event-mask (exwm--get-client-event-mask)))
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(exwm-layout--set-state id xcb:icccm:WM_STATE:IconicState)
|
2020-03-29 01:00:00 +01:00
|
|
|
|
(cl-pushnew xcb:Atom:_NET_WM_STATE_HIDDEN exwm--ewmh-state)
|
|
|
|
|
(exwm-layout--set-ewmh-state id)
|
2018-12-30 01:00:00 +01:00
|
|
|
|
(exwm-layout--auto-iconify)
|
2016-02-26 11:18:34 +01:00
|
|
|
|
(xcb:flush exwm--connection))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;;;###autoload
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(cl-defun exwm-layout-set-fullscreen (&optional id)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
"Make window ID fullscreen."
|
|
|
|
|
(interactive)
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log "id=#x%x" (or id 0))
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(unless (and (or id (derived-mode-p 'exwm-mode))
|
2018-03-04 05:23:37 +01:00
|
|
|
|
(not (exwm-layout--fullscreen-p)))
|
2018-03-10 10:28:43 +01:00
|
|
|
|
(cl-return-from exwm-layout-set-fullscreen))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(with-current-buffer (if id (exwm--id->buffer id) (window-buffer))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
;; Expand the X window to fill the whole screen.
|
2018-02-19 15:40:27 +01:00
|
|
|
|
(with-slots (x y width height) (exwm-workspace--get-geometry exwm--frame)
|
|
|
|
|
(exwm--set-geometry exwm--id x y width height))
|
2016-03-07 11:16:04 +01:00
|
|
|
|
;; Raise the X window.
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:window exwm--id
|
2016-09-23 12:41:43 +02:00
|
|
|
|
:value-mask (logior xcb:ConfigWindow:BorderWidth
|
|
|
|
|
xcb:ConfigWindow:StackMode)
|
|
|
|
|
:border-width 0
|
2016-03-07 11:16:04 +01:00
|
|
|
|
:stack-mode xcb:StackMode:Above))
|
2020-03-29 01:00:00 +01:00
|
|
|
|
(cl-pushnew xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)
|
2020-06-14 02:00:00 +02:00
|
|
|
|
(exwm-layout--set-ewmh-state exwm--id)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:flush exwm--connection)
|
2018-05-13 17:57:36 +02:00
|
|
|
|
(set-window-dedicated-p (get-buffer-window) t)
|
2018-04-01 17:38:48 +02:00
|
|
|
|
(exwm-input--release-keyboard exwm--id)))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2016-02-19 10:12:43 +01:00
|
|
|
|
;;;###autoload
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(cl-defun exwm-layout-unset-fullscreen (&optional id)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
"Restore window from fullscreen state."
|
|
|
|
|
(interactive)
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log "id=#x%x" (or id 0))
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(unless (and (or id (derived-mode-p 'exwm-mode))
|
2018-03-04 05:23:37 +01:00
|
|
|
|
(exwm-layout--fullscreen-p))
|
2018-03-10 10:28:43 +01:00
|
|
|
|
(cl-return-from exwm-layout-unset-fullscreen))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(with-current-buffer (if id (exwm--id->buffer id) (window-buffer))
|
2021-11-10 01:00:00 +01:00
|
|
|
|
;; `exwm-layout--show' relies on `exwm--ewmh-state' to decide whether to
|
|
|
|
|
;; fullscreen the window.
|
|
|
|
|
(setq exwm--ewmh-state
|
|
|
|
|
(delq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
|
|
|
|
(exwm-layout--set-ewmh-state exwm--id)
|
2016-03-07 11:16:04 +01:00
|
|
|
|
(if exwm--floating-frame
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(exwm-layout--show exwm--id (frame-root-window exwm--floating-frame))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:window exwm--id
|
2016-03-07 11:16:04 +01:00
|
|
|
|
:value-mask (logior xcb:ConfigWindow:Sibling
|
|
|
|
|
xcb:ConfigWindow:StackMode)
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:sibling exwm--guide-window
|
|
|
|
|
:stack-mode xcb:StackMode:Above))
|
|
|
|
|
(let ((window (get-buffer-window nil t)))
|
|
|
|
|
(when window
|
|
|
|
|
(exwm-layout--show exwm--id window))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:flush exwm--connection)
|
2018-05-13 17:57:36 +02:00
|
|
|
|
(set-window-dedicated-p (get-buffer-window) nil)
|
2018-10-21 14:00:00 +02:00
|
|
|
|
(when (eq 'line-mode exwm--selected-input-mode)
|
2018-04-01 17:38:48 +02:00
|
|
|
|
(exwm-input--grab-keyboard exwm--id))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2016-08-24 13:21:17 +02:00
|
|
|
|
;;;###autoload
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(cl-defun exwm-layout-toggle-fullscreen (&optional id)
|
2016-08-24 13:21:17 +02:00
|
|
|
|
"Toggle fullscreen mode."
|
|
|
|
|
(interactive (list (exwm--buffer->id (window-buffer))))
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log "id=#x%x" (or id 0))
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(unless (or id (derived-mode-p 'exwm-mode))
|
2018-03-10 10:28:43 +01:00
|
|
|
|
(cl-return-from exwm-layout-toggle-fullscreen))
|
2016-08-24 13:21:17 +02:00
|
|
|
|
(when id
|
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
2018-03-04 05:23:37 +01:00
|
|
|
|
(if (exwm-layout--fullscreen-p)
|
2018-04-01 17:38:48 +02:00
|
|
|
|
(exwm-layout-unset-fullscreen id)
|
2016-08-24 13:21:17 +02:00
|
|
|
|
(exwm-layout-set-fullscreen id)))))
|
|
|
|
|
|
2016-03-19 01:00:00 +01:00
|
|
|
|
(defun exwm-layout--other-buffer-predicate (buffer)
|
|
|
|
|
"Return non-nil when the BUFFER may be displayed in selected frame.
|
|
|
|
|
|
|
|
|
|
Prevents EXWM-mode buffers already being displayed on some other window from
|
|
|
|
|
being selected.
|
|
|
|
|
|
|
|
|
|
Should be set as `buffer-predicate' frame parameter for all
|
2016-03-19 01:00:00 +01:00
|
|
|
|
frames. Used by `other-buffer'.
|
|
|
|
|
|
|
|
|
|
When variable `exwm-layout--other-buffer-exclude-exwm-mode-buffers'
|
|
|
|
|
is t EXWM buffers are never selected by `other-buffer'.
|
|
|
|
|
|
|
|
|
|
When variable `exwm-layout--other-buffer-exclude-buffers' is a
|
|
|
|
|
list of buffers, EXWM buffers belonging to that list are never
|
|
|
|
|
selected by `other-buffer'."
|
2018-07-14 18:00:00 +02:00
|
|
|
|
(or (not (with-current-buffer buffer (derived-mode-p 'exwm-mode)))
|
2016-03-19 01:00:00 +01:00
|
|
|
|
(and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
|
|
|
|
|
(not (memq buffer exwm-layout--other-buffer-exclude-buffers))
|
|
|
|
|
;; Do not select if already shown in some window.
|
|
|
|
|
(not (get-buffer-window buffer t)))))
|
2016-03-19 01:00:00 +01:00
|
|
|
|
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(defun exwm-layout--set-client-list-stacking ()
|
|
|
|
|
"Set _NET_CLIENT_LIST_STACKING."
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(let (id clients-floating clients clients-iconic clients-other)
|
|
|
|
|
(dolist (pair exwm--id-buffer-alist)
|
|
|
|
|
(setq id (car pair))
|
|
|
|
|
(with-current-buffer (cdr pair)
|
|
|
|
|
(if (eq exwm--frame exwm-workspace--current)
|
|
|
|
|
(if exwm--floating-frame
|
|
|
|
|
;; A floating X window on the current workspace.
|
|
|
|
|
(setq clients-floating (cons id clients-floating))
|
|
|
|
|
(if (get-buffer-window (cdr pair) exwm-workspace--current)
|
|
|
|
|
;; A normal tilling X window on the current workspace.
|
|
|
|
|
(setq clients (cons id clients))
|
|
|
|
|
;; An iconic tilling X window on the current workspace.
|
|
|
|
|
(setq clients-iconic (cons id clients-iconic))))
|
|
|
|
|
;; X window on other workspaces.
|
|
|
|
|
(setq clients-other (cons id clients-other)))))
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST_STACKING
|
|
|
|
|
:window exwm--root
|
|
|
|
|
:data (vconcat (append clients-other clients-iconic
|
2016-07-19 04:24:23 +02:00
|
|
|
|
clients clients-floating))))))
|
2016-07-13 12:51:32 +02:00
|
|
|
|
|
2016-08-10 13:45:52 +02:00
|
|
|
|
(defun exwm-layout--refresh (&optional frame)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
"Refresh layout."
|
2016-08-10 13:45:52 +02:00
|
|
|
|
;; `window-size-change-functions' sets this argument while
|
|
|
|
|
;; `window-configuration-change-hook' makes the frame selected.
|
|
|
|
|
(unless frame
|
|
|
|
|
(setq frame (selected-frame)))
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log "frame=%s" frame)
|
2018-08-16 14:00:00 +02:00
|
|
|
|
(if (not (exwm-workspace--workspace-p frame))
|
|
|
|
|
(if (frame-parameter frame 'exwm-outer-id)
|
|
|
|
|
(exwm-layout--refresh-floating frame)
|
|
|
|
|
(exwm-layout--refresh-other frame))
|
|
|
|
|
(exwm-layout--refresh-workspace frame)))
|
|
|
|
|
|
|
|
|
|
(defun exwm-layout--refresh-floating (frame)
|
|
|
|
|
"Refresh floating frame FRAME."
|
|
|
|
|
(exwm--log "Refresh floating %s" frame)
|
|
|
|
|
(let ((window (frame-first-window frame)))
|
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
|
(when (and (derived-mode-p 'exwm-mode)
|
|
|
|
|
;; It may be a buffer waiting to be killed.
|
|
|
|
|
(exwm--id->buffer exwm--id))
|
|
|
|
|
(exwm--log "Refresh floating window #x%x" exwm--id)
|
|
|
|
|
(if (exwm-workspace--active-p exwm--frame)
|
|
|
|
|
(exwm-layout--show exwm--id window)
|
|
|
|
|
(exwm-layout--hide exwm--id))))))
|
|
|
|
|
|
|
|
|
|
(defun exwm-layout--refresh-other (frame)
|
|
|
|
|
"Refresh client or nox frame FRAME."
|
|
|
|
|
;; Other frames (e.g. terminal/graphical frame of emacsclient)
|
|
|
|
|
;; We shall bury all `exwm-mode' buffers in this case
|
|
|
|
|
(exwm--log "Refresh other %s" frame)
|
|
|
|
|
(let ((windows (window-list frame 'nomini)) ;exclude minibuffer
|
|
|
|
|
(exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
|
|
|
|
(dolist (window windows)
|
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
|
(when (derived-mode-p 'exwm-mode)
|
2018-11-04 01:00:00 +01:00
|
|
|
|
(if (window-prev-buffers window)
|
|
|
|
|
(switch-to-prev-buffer window)
|
|
|
|
|
(switch-to-next-buffer window)))))))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
|
|
|
|
|
(defun exwm-layout--refresh-workspace (frame)
|
|
|
|
|
"Refresh workspace frame FRAME."
|
|
|
|
|
(exwm--log "Refresh workspace %s" frame)
|
|
|
|
|
;; Workspaces other than the active one can also be refreshed (RandR)
|
2016-08-10 13:45:52 +02:00
|
|
|
|
(let (covered-buffers ;EXWM-buffers covered by a new X window.
|
2018-08-16 14:00:00 +02:00
|
|
|
|
vacated-windows) ;Windows previously displaying EXWM-buffers.
|
|
|
|
|
(dolist (pair exwm--id-buffer-alist)
|
|
|
|
|
(with-current-buffer (cdr pair)
|
|
|
|
|
(when (and (not exwm--floating-frame) ;exclude floating X windows
|
|
|
|
|
(or exwm-layout-show-all-buffers
|
|
|
|
|
;; Exclude X windows on other workspaces
|
|
|
|
|
(eq frame exwm--frame)))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
(let (;; List of windows in current frame displaying the `exwm-mode'
|
|
|
|
|
;; buffers.
|
|
|
|
|
(windows (get-buffer-window-list (current-buffer) 'nomini
|
|
|
|
|
frame)))
|
2015-08-10 04:55:28 +02:00
|
|
|
|
(if (not windows)
|
2018-08-12 02:00:00 +02:00
|
|
|
|
(when (eq frame exwm--frame)
|
2018-08-16 14:00:00 +02:00
|
|
|
|
;; Hide it if it was being shown in this workspace.
|
2018-08-12 02:00:00 +02:00
|
|
|
|
(exwm-layout--hide exwm--id))
|
2015-09-16 15:32:38 +02:00
|
|
|
|
(let ((window (car windows)))
|
2016-03-19 01:00:00 +01:00
|
|
|
|
(if (eq frame exwm--frame)
|
2018-08-30 14:00:00 +02:00
|
|
|
|
;; Show it if `frame' is active, hide otherwise.
|
|
|
|
|
(if (exwm-workspace--active-p frame)
|
|
|
|
|
(exwm-layout--show exwm--id window)
|
|
|
|
|
(exwm-layout--hide exwm--id))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
;; It was last shown in other workspace; move it here.
|
2016-07-17 14:00:00 +02:00
|
|
|
|
(exwm-workspace-move-window frame exwm--id))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
;; Vacate any other windows (in any workspace) showing this
|
|
|
|
|
;; `exwm-mode' buffer.
|
2016-03-19 01:00:00 +01:00
|
|
|
|
(setq vacated-windows
|
2018-08-16 14:00:00 +02:00
|
|
|
|
(append vacated-windows (remove
|
|
|
|
|
window
|
|
|
|
|
(get-buffer-window-list
|
|
|
|
|
(current-buffer) 'nomini t))))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
;; Note any `exwm-mode' buffer is being covered by another
|
|
|
|
|
;; `exwm-mode' buffer. We want to avoid that `exwm-mode'
|
|
|
|
|
;; buffer to be reappear in any of the vacated windows.
|
2016-03-19 01:00:00 +01:00
|
|
|
|
(let ((prev-buffer (car-safe
|
|
|
|
|
(car-safe (window-prev-buffers window)))))
|
|
|
|
|
(and
|
|
|
|
|
prev-buffer
|
2018-07-14 18:00:00 +02:00
|
|
|
|
(with-current-buffer prev-buffer
|
|
|
|
|
(derived-mode-p 'exwm-mode))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
(push prev-buffer covered-buffers)))))))))
|
|
|
|
|
;; Set some sensible buffer to vacated windows.
|
|
|
|
|
(let ((exwm-layout--other-buffer-exclude-buffers covered-buffers))
|
|
|
|
|
(dolist (window vacated-windows)
|
2018-11-04 01:00:00 +01:00
|
|
|
|
(if (window-prev-buffers window)
|
|
|
|
|
(switch-to-prev-buffer window)
|
|
|
|
|
(switch-to-next-buffer window))))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
;; Make sure windows floating / on other workspaces are excluded
|
|
|
|
|
(let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
|
|
|
|
(dolist (window (window-list frame 'nomini))
|
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
|
(when (and (derived-mode-p 'exwm-mode)
|
|
|
|
|
(or exwm--floating-frame (not (eq frame exwm--frame))))
|
2018-11-04 01:00:00 +01:00
|
|
|
|
(if (window-prev-buffers window)
|
|
|
|
|
(switch-to-prev-buffer window)
|
|
|
|
|
(switch-to-next-buffer window))))))
|
2018-08-16 14:00:00 +02:00
|
|
|
|
(exwm-layout--set-client-list-stacking)
|
|
|
|
|
(xcb:flush exwm--connection)))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2015-08-09 05:27:48 +02:00
|
|
|
|
(defun exwm-layout--on-minibuffer-setup ()
|
|
|
|
|
"Refresh layout when minibuffer grows."
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2022-11-22 01:00:00 +01:00
|
|
|
|
;; Only when active minibuffer's frame is an EXWM frame.
|
|
|
|
|
(let* ((mini-window (active-minibuffer-window))
|
|
|
|
|
(frame (window-frame mini-window)))
|
|
|
|
|
(when (exwm-workspace--workspace-p frame)
|
|
|
|
|
(exwm--defer 0 (lambda ()
|
|
|
|
|
(when (< 1 (window-height mini-window)))
|
|
|
|
|
(exwm-layout--refresh frame))))))
|
2016-02-06 05:59:33 +01:00
|
|
|
|
|
|
|
|
|
(defun exwm-layout--on-echo-area-change (&optional dirty)
|
|
|
|
|
"Run when message arrives or in `echo-area-clear-hook' to refresh layout."
|
2022-11-22 01:00:00 +01:00
|
|
|
|
(let ((frame (window-frame (active-minibuffer-window)))
|
2021-12-09 01:00:00 +01:00
|
|
|
|
(msg (current-message)))
|
|
|
|
|
;; Check whether the frame where current window's minibuffer resides (not
|
|
|
|
|
;; current window's frame for floating windows!) must be adjusted.
|
|
|
|
|
(when (and msg
|
2022-11-22 01:00:00 +01:00
|
|
|
|
(exwm-workspace--workspace-p frame)
|
2021-12-09 01:00:00 +01:00
|
|
|
|
(or (cl-position ?\n msg)
|
|
|
|
|
(> (length msg) (frame-width frame))))
|
|
|
|
|
(exwm--log)
|
|
|
|
|
(if dirty
|
|
|
|
|
(exwm-layout--refresh exwm-workspace--current)
|
|
|
|
|
(exwm--defer 0 #'exwm-layout--refresh exwm-workspace--current)))))
|
2015-08-09 05:27:48 +02:00
|
|
|
|
|
2016-02-19 10:12:43 +01:00
|
|
|
|
;;;###autoload
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(defun exwm-layout-enlarge-window (delta &optional horizontal)
|
|
|
|
|
"Make the selected window DELTA pixels taller.
|
|
|
|
|
|
|
|
|
|
If no argument is given, make the selected window one pixel taller. If the
|
|
|
|
|
optional argument HORIZONTAL is non-nil, make selected window DELTA pixels
|
|
|
|
|
wider. If DELTA is negative, shrink selected window by -DELTA pixels.
|
|
|
|
|
|
|
|
|
|
Normal hints are checked and regarded if the selected window is displaying an
|
|
|
|
|
`exwm-mode' buffer. However, this may violate the normal hints set on other X
|
|
|
|
|
windows."
|
|
|
|
|
(interactive "p")
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(cond
|
|
|
|
|
((zerop delta)) ;no operation
|
|
|
|
|
((window-minibuffer-p)) ;avoid resize minibuffer-window
|
2018-07-14 18:00:00 +02:00
|
|
|
|
((not (and (derived-mode-p 'exwm-mode) exwm--floating-frame))
|
2015-09-11 11:13:43 +02:00
|
|
|
|
;; Resize on tiling layout
|
|
|
|
|
(unless (= 0 (window-resizable nil delta horizontal nil t)) ;not resizable
|
|
|
|
|
(let ((window-resize-pixelwise t))
|
|
|
|
|
(window-resize nil delta horizontal nil t))))
|
|
|
|
|
;; Resize on floating layout
|
|
|
|
|
(exwm--fixed-size) ;fixed size
|
|
|
|
|
(horizontal
|
|
|
|
|
(let* ((width (frame-pixel-width))
|
|
|
|
|
(edges (window-inside-pixel-edges))
|
|
|
|
|
(inner-width (- (elt edges 2) (elt edges 0)))
|
|
|
|
|
(margin (- width inner-width)))
|
|
|
|
|
(if (> delta 0)
|
|
|
|
|
(if (not exwm--normal-hints-max-width)
|
|
|
|
|
(cl-incf width delta)
|
|
|
|
|
(if (>= inner-width exwm--normal-hints-max-width)
|
|
|
|
|
(setq width nil)
|
|
|
|
|
(setq width (min (+ exwm--normal-hints-max-width margin)
|
|
|
|
|
(+ width delta)))))
|
|
|
|
|
(if (not exwm--normal-hints-min-width)
|
|
|
|
|
(cl-incf width delta)
|
|
|
|
|
(if (<= inner-width exwm--normal-hints-min-width)
|
|
|
|
|
(setq width nil)
|
|
|
|
|
(setq width (max (+ exwm--normal-hints-min-width margin)
|
|
|
|
|
(+ width delta))))))
|
2018-02-04 15:38:02 +01:00
|
|
|
|
(when (and width (> width 0))
|
2016-09-23 12:36:09 +02:00
|
|
|
|
(setf (slot-value exwm--geometry 'width) width)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-outer-id)
|
|
|
|
|
:value-mask xcb:ConfigWindow:Width
|
|
|
|
|
:width width))
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container)
|
|
|
|
|
:value-mask xcb:ConfigWindow:Width
|
|
|
|
|
:width width))
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(xcb:flush exwm--connection))))
|
|
|
|
|
(t
|
2019-09-15 02:00:00 +02:00
|
|
|
|
(let* ((height (+ (frame-pixel-height) exwm-workspace--frame-y-offset))
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(edges (window-inside-pixel-edges))
|
|
|
|
|
(inner-height (- (elt edges 3) (elt edges 1)))
|
|
|
|
|
(margin (- height inner-height)))
|
|
|
|
|
(if (> delta 0)
|
|
|
|
|
(if (not exwm--normal-hints-max-height)
|
|
|
|
|
(cl-incf height delta)
|
|
|
|
|
(if (>= inner-height exwm--normal-hints-max-height)
|
|
|
|
|
(setq height nil)
|
|
|
|
|
(setq height (min (+ exwm--normal-hints-max-height margin)
|
|
|
|
|
(+ height delta)))))
|
|
|
|
|
(if (not exwm--normal-hints-min-height)
|
|
|
|
|
(cl-incf height delta)
|
|
|
|
|
(if (<= inner-height exwm--normal-hints-min-height)
|
|
|
|
|
(setq height nil)
|
|
|
|
|
(setq height (max (+ exwm--normal-hints-min-height margin)
|
|
|
|
|
(+ height delta))))))
|
2018-02-04 15:38:02 +01:00
|
|
|
|
(when (and height (> height 0))
|
2016-09-23 12:36:09 +02:00
|
|
|
|
(setf (slot-value exwm--geometry 'height) height)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-outer-id)
|
|
|
|
|
:value-mask xcb:ConfigWindow:Height
|
|
|
|
|
:height height))
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container)
|
|
|
|
|
:value-mask xcb:ConfigWindow:Height
|
|
|
|
|
:height height))
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(xcb:flush exwm--connection))))))
|
|
|
|
|
|
2016-02-19 10:12:43 +01:00
|
|
|
|
;;;###autoload
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(defun exwm-layout-enlarge-window-horizontally (delta)
|
|
|
|
|
"Make the selected window DELTA pixels wider.
|
|
|
|
|
|
|
|
|
|
See also `exwm-layout-enlarge-window'."
|
|
|
|
|
(interactive "p")
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log "%s" delta)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(exwm-layout-enlarge-window delta t))
|
|
|
|
|
|
2016-02-19 10:12:43 +01:00
|
|
|
|
;;;###autoload
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(defun exwm-layout-shrink-window (delta)
|
|
|
|
|
"Make the selected window DELTA pixels lower.
|
|
|
|
|
|
|
|
|
|
See also `exwm-layout-enlarge-window'."
|
|
|
|
|
(interactive "p")
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log "%s" delta)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(exwm-layout-enlarge-window (- delta)))
|
|
|
|
|
|
2016-02-19 10:12:43 +01:00
|
|
|
|
;;;###autoload
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(defun exwm-layout-shrink-window-horizontally (delta)
|
|
|
|
|
"Make the selected window DELTA pixels narrower.
|
|
|
|
|
|
|
|
|
|
See also `exwm-layout-enlarge-window'."
|
|
|
|
|
(interactive "p")
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log "%s" delta)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(exwm-layout-enlarge-window (- delta) t))
|
|
|
|
|
|
2016-02-19 10:12:43 +01:00
|
|
|
|
;;;###autoload
|
2016-02-07 03:45:59 +01:00
|
|
|
|
(defun exwm-layout-hide-mode-line ()
|
|
|
|
|
"Hide mode-line."
|
|
|
|
|
(interactive)
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2018-07-14 18:00:00 +02:00
|
|
|
|
(when (and (derived-mode-p 'exwm-mode) mode-line-format)
|
2016-02-18 12:56:01 +01:00
|
|
|
|
(let (mode-line-height)
|
|
|
|
|
(when exwm--floating-frame
|
|
|
|
|
(setq mode-line-height (window-mode-line-height
|
|
|
|
|
(frame-root-window exwm--floating-frame))))
|
|
|
|
|
(setq exwm--mode-line-format mode-line-format
|
|
|
|
|
mode-line-format nil)
|
|
|
|
|
(if (not exwm--floating-frame)
|
|
|
|
|
(exwm-layout--show exwm--id)
|
|
|
|
|
(set-frame-height exwm--floating-frame
|
|
|
|
|
(- (frame-pixel-height exwm--floating-frame)
|
|
|
|
|
mode-line-height)
|
|
|
|
|
nil t)))))
|
2016-02-07 03:45:59 +01:00
|
|
|
|
|
2016-02-19 10:12:43 +01:00
|
|
|
|
;;;###autoload
|
2016-02-07 03:45:59 +01:00
|
|
|
|
(defun exwm-layout-show-mode-line ()
|
|
|
|
|
"Show mode-line."
|
|
|
|
|
(interactive)
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2018-07-14 18:00:00 +02:00
|
|
|
|
(when (and (derived-mode-p 'exwm-mode) (not mode-line-format))
|
2016-02-07 03:45:59 +01:00
|
|
|
|
(setq mode-line-format exwm--mode-line-format
|
|
|
|
|
exwm--mode-line-format nil)
|
|
|
|
|
(if (not exwm--floating-frame)
|
|
|
|
|
(exwm-layout--show exwm--id)
|
2016-02-18 12:56:01 +01:00
|
|
|
|
(set-frame-height exwm--floating-frame
|
|
|
|
|
(+ (frame-pixel-height exwm--floating-frame)
|
|
|
|
|
(window-mode-line-height (frame-root-window
|
|
|
|
|
exwm--floating-frame)))
|
|
|
|
|
nil t)
|
2016-04-03 06:24:50 +02:00
|
|
|
|
(call-interactively #'exwm-input-grab-keyboard))
|
2016-02-26 02:24:15 +01:00
|
|
|
|
(force-mode-line-update)))
|
2016-02-07 03:45:59 +01:00
|
|
|
|
|
2016-02-07 04:40:14 +01:00
|
|
|
|
;;;###autoload
|
2016-02-07 03:45:59 +01:00
|
|
|
|
(defun exwm-layout-toggle-mode-line ()
|
|
|
|
|
"Toggle the display of mode-line."
|
|
|
|
|
(interactive)
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2018-07-14 18:00:00 +02:00
|
|
|
|
(when (derived-mode-p 'exwm-mode)
|
2016-02-07 03:45:59 +01:00
|
|
|
|
(if mode-line-format
|
|
|
|
|
(exwm-layout-hide-mode-line)
|
|
|
|
|
(exwm-layout-show-mode-line))))
|
|
|
|
|
|
2022-12-01 02:00:01 +01:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun exwm-layout-hide-tab-line ()
|
|
|
|
|
"Hide tab-line."
|
|
|
|
|
(interactive)
|
|
|
|
|
(exwm--log)
|
|
|
|
|
(when (and (derived-mode-p 'exwm-mode) tab-line-format)
|
|
|
|
|
(let (tab-line-height)
|
|
|
|
|
(when exwm--floating-frame
|
|
|
|
|
(setq tab-line-height (window-tab-line-height
|
|
|
|
|
(frame-root-window exwm--floating-frame))))
|
|
|
|
|
(setq exwm--tab-line-format tab-line-format
|
|
|
|
|
tab-line-format nil)
|
|
|
|
|
(if (not exwm--floating-frame)
|
|
|
|
|
(exwm-layout--show exwm--id)
|
|
|
|
|
(set-frame-height exwm--floating-frame
|
|
|
|
|
(- (frame-pixel-height exwm--floating-frame)
|
|
|
|
|
tab-line-height)
|
|
|
|
|
nil t)))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun exwm-layout-show-tab-line ()
|
|
|
|
|
"Show tab-line."
|
|
|
|
|
(interactive)
|
|
|
|
|
(exwm--log)
|
|
|
|
|
(when (and (derived-mode-p 'exwm-mode) (not tab-line-format))
|
|
|
|
|
(setq tab-line-format exwm--tab-line-format
|
|
|
|
|
exwm--tab-line-format nil)
|
|
|
|
|
(if (not exwm--floating-frame)
|
|
|
|
|
(exwm-layout--show exwm--id)
|
|
|
|
|
(set-frame-height exwm--floating-frame
|
|
|
|
|
(+ (frame-pixel-height exwm--floating-frame)
|
|
|
|
|
(window-tab-line-height (frame-root-window
|
|
|
|
|
exwm--floating-frame)))
|
|
|
|
|
nil t)
|
|
|
|
|
(call-interactively #'exwm-input-grab-keyboard))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun exwm-layout-toggle-tab-line ()
|
|
|
|
|
"Toggle the display of tab-line."
|
|
|
|
|
(interactive)
|
|
|
|
|
(exwm--log)
|
|
|
|
|
(when (derived-mode-p 'exwm-mode)
|
|
|
|
|
(if tab-line-format
|
|
|
|
|
(exwm-layout-hide-tab-line)
|
|
|
|
|
(exwm-layout-show-tab-line))))
|
|
|
|
|
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(defun exwm-layout--init ()
|
|
|
|
|
"Initialize layout module."
|
|
|
|
|
;; Auto refresh layout
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2015-09-04 03:09:59 +02:00
|
|
|
|
(add-hook 'window-configuration-change-hook #'exwm-layout--refresh)
|
2016-08-10 13:45:52 +02:00
|
|
|
|
;; The behavior of `window-configuration-change-hook' will be changed.
|
|
|
|
|
(when (fboundp 'window-pixel-width-before-size-change)
|
|
|
|
|
(add-hook 'window-size-change-functions #'exwm-layout--refresh))
|
2016-02-06 22:43:32 +01:00
|
|
|
|
(unless (exwm-workspace--minibuffer-own-frame-p)
|
2016-02-06 05:59:33 +01:00
|
|
|
|
;; Refresh when minibuffer grows
|
|
|
|
|
(add-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup t)
|
2016-05-23 13:13:42 +02:00
|
|
|
|
(setq exwm-layout--timer
|
|
|
|
|
(run-with-idle-timer 0 t #'exwm-layout--on-echo-area-change t))
|
2016-02-06 05:59:33 +01:00
|
|
|
|
(add-hook 'echo-area-clear-hook #'exwm-layout--on-echo-area-change)))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2016-05-23 13:13:42 +02:00
|
|
|
|
(defun exwm-layout--exit ()
|
|
|
|
|
"Exit the layout module."
|
2018-08-13 14:00:00 +02:00
|
|
|
|
(exwm--log)
|
2016-05-23 13:13:42 +02:00
|
|
|
|
(remove-hook 'window-configuration-change-hook #'exwm-layout--refresh)
|
2018-03-06 01:00:00 +01:00
|
|
|
|
(when (fboundp 'window-pixel-width-before-size-change)
|
|
|
|
|
(remove-hook 'window-size-change-functions #'exwm-layout--refresh))
|
2016-05-23 13:13:42 +02:00
|
|
|
|
(remove-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup)
|
|
|
|
|
(when exwm-layout--timer
|
|
|
|
|
(cancel-timer exwm-layout--timer)
|
|
|
|
|
(setq exwm-layout--timer nil))
|
|
|
|
|
(remove-hook 'echo-area-clear-hook #'exwm-layout--on-echo-area-change))
|
|
|
|
|
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(provide 'exwm-layout)
|
|
|
|
|
|
|
|
|
|
;;; exwm-layout.el ends here
|