i3 / i3

A tiling window manager for X11
https://i3wm.org/
BSD 3-Clause "New" or "Revised" License
9.5k stars 780 forks source link

"exec" appears unable to send literal double quotes. #4152

Open ghost opened 4 years ago

ghost commented 4 years ago

I'm submitting a…

[ ] Bug
[x] Feature Request
[x] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

It appears exec is unable to escape double quotes into a literal character, or that it it is not documented.

Desired Behavior

Exec should either have a way to pass literal double quotes, or have this if existing be documented clearly.

Environment

Output of i3 --moreversion 2>&-:

i3 version: Binary i3 version:  4.18.1 (2020-04-23) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.18.1 (2020-04-23) (pid 540) abort…)
Loaded i3 config: /home/barry/.config/i3/config (Last modified: Sat 04 Jul 2020 01:29:37, 469 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3
- Linux Distribution & Version: Arch Linux
- Are you using a compositor (e.g., xcompmgr or compton): picom
Airblader commented 4 years ago

Is this what you are looking for? https://i3wm.org/docs/userguide.html#exec_quoting

ghost commented 4 years ago

No, as when that is used, the shell it is passed to then parses the double quotes normally, so like this: emacsclient -c -e "(find-file "/home/barry")" Whereas in this case to make it work in the shell you would need to do it like this: emacsclient -c -e "(find-file \"/home/barry")" However, there appears to be no mechanism to do this in i3, as prefixing with a single backslash doesn't seem to work, and double backslashes send a un-escaped double quote, and triple just sends a backslash and a double quote.

ghost commented 4 years ago

Perhaps I should have used the phrasing "escaped double quotes".

stapelberg commented 3 years ago

This works in my i3 config file:

bindsym Mod4+g exec "emacsclient -c -e \\"(find-file \\\\"/tmp\\\\")\\""

In general I find it easier to use e.g. exec /home/michael/.bin/emacsclient.bash, so that I can work with the syntax I’m most familiar with and don’t need any quoting on the i3 level.