diff options
author | Vincent Ambo <tazjin@tvl.su> | 2024-02-06T07·03+0300 |
---|---|---|
committer | Vincent Ambo <tazjin@tvl.su> | 2024-02-06T07·52+0300 |
commit | 35e7b8a1a89c3f5c2670dabc603518bcbf82202c (patch) | |
tree | 2b4255a679698c30462d1e6c97576d723ab5734c /third_party/exwm/exwm-manage.el | |
parent | 2eafdbde321ae25b7cb9eeb3e20d8a45af393e1a (diff) | |
parent | a6e66f5e339473105d83dd4e7e3f3db9b1aa9f0f (diff) |
subtree(3p/exwm): update & hard reset to commit 'a6e66f5e33' r/7478
This contains a bunch of upstream changes after the new maintainers of EXWM took over, including proper mainlined versions of patches I've been carrying around here manually. Notably this undoes the Chromium focus fix patch, lets see how that goes. git-subtree-dir: third_party/exwm git-subtree-mainline: a756b46bc70a8a1dbb205d50283a3fe65282ed91 git-subtree-split: a6e66f5e339473105d83dd4e7e3f3db9b1aa9f0f Change-Id: Ibcaba379b56611b8f1918c3b60469492d64a3eb7
Diffstat (limited to 'third_party/exwm/exwm-manage.el')
-rw-r--r-- | third_party/exwm/exwm-manage.el | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/third_party/exwm/exwm-manage.el b/third_party/exwm/exwm-manage.el index 4771c3c088db..ab66e298ac8e 100644 --- a/third_party/exwm/exwm-manage.el +++ b/third_party/exwm/exwm-manage.el @@ -1,7 +1,7 @@ ;;; exwm-manage.el --- Window Management Module for -*- lexical-binding: t -*- ;;; EXWM -;; Copyright (C) 2015-2023 Free Software Foundation, Inc. +;; Copyright (C) 2015-2024 Free Software Foundation, Inc. ;; Author: Chris Feng <chris.w.feng@gmail.com> @@ -30,7 +30,6 @@ (defgroup exwm-manage nil "Manage." - :version "25.3" :group 'exwm) (defcustom exwm-manage-finish-hook nil @@ -235,6 +234,23 @@ Override current hinds if FORCE is non-nil." (elt value 2))) ;MotifWmHints.decorations (setq exwm--mwm-hints-decorations nil)))))))) +(defun exwm-manage--update-default-directory (id) + "Update the `default-directory' of X window ID. +Sets the `default-directory' of the EXWM buffer associated with X window to +match its current working directory. + +This only works when procfs is mounted, which may not be the case on some BSDs." + (with-current-buffer (exwm--id->buffer id) + (if-let* ((response (xcb:+request-unchecked+reply exwm--connection + (make-instance 'xcb:ewmh:get-_NET_WM_PID + :window id))) + (pid (slot-value response 'value)) + (cwd (file-symlink-p (format "/proc/%d/cwd" pid))) + ((file-accessible-directory-p cwd))) + (setq default-directory (file-name-as-directory cwd)) + (setq default-directory (expand-file-name "~/"))))) + + (defun exwm-manage--set-client-list () "Set _NET_CLIENT_LIST." (exwm--log) @@ -394,23 +410,20 @@ Override current hinds if FORCE is non-nil." (if (plist-get exwm--configurations 'char-mode) (exwm-input-release-keyboard id) (exwm-input-grab-keyboard id)) - (let ((simulation-keys (plist-get exwm--configurations 'simulation-keys)) - (prefix-keys (plist-get exwm--configurations 'prefix-keys))) - (with-current-buffer (exwm--id->buffer id) - (when simulation-keys - (exwm-input-set-local-simulation-keys simulation-keys)) - (when prefix-keys - (setq-local exwm-input-prefix-keys prefix-keys)))) + (when-let ((simulation-keys (plist-get exwm--configurations 'simulation-keys))) + (exwm-input-set-local-simulation-keys simulation-keys)) + (when-let ((prefix-keys (plist-get exwm--configurations 'prefix-keys))) + (setq-local exwm-input-prefix-keys prefix-keys)) (setq exwm-workspace--switch-history-outdated t) (exwm--update-desktop id) (exwm-manage--update-ewmh-state id) - (with-current-buffer (exwm--id->buffer id) - (when (or (plist-get exwm--configurations 'fullscreen) - (exwm-layout--fullscreen-p)) - (setq exwm--ewmh-state (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN - exwm--ewmh-state)) - (exwm-layout-set-fullscreen id)) - (run-hooks 'exwm-manage-finish-hook))))) + (exwm-manage--update-default-directory id) + (when (or (plist-get exwm--configurations 'fullscreen) + (exwm-layout--fullscreen-p)) + (setq exwm--ewmh-state (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN + exwm--ewmh-state)) + (exwm-layout-set-fullscreen id)) + (run-hooks 'exwm-manage-finish-hook)))) (defun exwm-manage--unmanage-window (id &optional withdraw-only) "Unmanage window ID. |