Comments (5)
For shells, I'd provide a hook but not enable it by default. It'll have trouble, with, e.g., SSH and would conflict with "better" ways to set the default directory.
Makes sense. In a shell with ssh one may even want to change the default-directory to a Tramp path.
I currently try out the following function based on your code. I've added it to the manage finish hook. So far it works well.
(defun +exwm-update-default-directory ()
"Set `default-directory' to the current working directory of the X window process."
(setq default-directory
(if-let ((id (exwm--buffer->id (current-buffer)))
(response (xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:ewmh:get-_NET_WM_PID :window id)))
(pid (slot-value response 'value))
(cwd (file-chase-links (format "/proc/%d/cwd" pid) 1))
((file-accessible-directory-p cwd)))
(file-name-as-directory cwd)
(expand-file-name "~/"))))
from exwm.
I've configured EXWM to set the default directory of an X window to the processes default directory and I'm wondering if others would find this behavior useful/desirable.
Sounds like a good idea. Right now I set the default directory to ~/ in all my EXWM buffers, but that's far from ideal.
Of course, this won't keep the default-directory in-sync with the X window, but that usually only matters for shells.
Shells often update the title of the window, so maybe it would work if we refresh the default directory in an exwm-update-title-hook?
How do you suggest to enable this behavior? Install the hooks by default or optionally?
from exwm.
Shells often update the title of the window, so maybe it would work if we refresh the default directory in an exwm-update-title-hook?
How do you suggest to enable this behavior? Install the hooks by default or optionally?
For shells, I'd provide a hook but not enable it by default. It'll have trouble, with, e.g., SSH and would conflict with "better" ways to set the default directory.
As for the initial default directory, I'd set that in manage before calling any hooks. That way the user can easily override it but they get a sane default.
from exwm.
It looks like the following can be used to get the CWD on macOS.
(let ((output (process-lines-ignore-status "lsof" "-p" pid "-a" "-d" "cwd" "-Fn")))
(when output
(substring (nth 2 output) 1)))
I wonder whether running this process upon exwm-manage--manage-window
is sensible.
from exwm.
@medranocalvo Yes, we could do that as a fallback. I don't see a problem, except maybe the efficiency. Starting a process is a bit more expensive than reading a symlink from /proc. Otoh we can also keep things as is. Then the default-directory in exwm-mode buffers on BSD is consistently set to ~/, which is also not that bad.
from exwm.
Related Issues (20)
- improve debugging HOT 2
- Make minor-modes idempotent
- Fullscreen windows can hide minibuffer
- Transfer open issues from previous github issue tracker HOT 4
- Follow up on FSF copyright assignment for open pull request HOT 1
- Add exwm-minor-mode HOT 14
- exwm-workspace vs tab-bar-mode HOT 6
- Deprecate exwm-config HOT 1
- wrong-type-argument listp rect HOT 5
- Handle startup-notifications
- exwm-layout-toggle-fullscreen does not work unless called interactively
- grab emacs frame with OBS
- Floating Emacs buffers
- Corfu, posframe, etc prevent workspace deletion
- Notification server? HOT 3
- Can the buffer listing of exwm-workspace-switch-to-buffer be extended to include the workspace?
- Support highlight bordor color of the focused floating window
- Warning (emacs): [EXWM] EXWM fails to start (void-function: (length<)) HOT 1
- New release 0.31 HOT 2
- `exwm-workspace--update-workareas` Wrong type argument HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exwm.