dnkl/foot
41
2.0k
Fork
You've already forked foot
243

When using nnn file manager, foot will not show a title when nnn is first launched (other terminals do work correctly) #1783

Closed
opened 2024年07月27日 17:03:50 +02:00 by charbelnicolas · 11 comments

Foot Version

foot version: 1.17.2 +pgo +ime +graphemes -assertions

TERM environment variable

foot

Compositor Version

labwc 0.7.3-52-g750d37b1

Description of Bug and Steps to Reproduce

When using nnn file manager, foot will not show a title when nnn is first launched through a shortcut or through the terminal by typing foot nnn -x, foot -e nnn foot nnn or foot -e nnn -x. It is only when one navigates to a different directory that the title will show up. I tried the same with kitty, xterm and alacritty and they all work.

The only way this works is if I open foot first and then just launch nnn in the already open terminal.

Relevant logs, stacktraces, etc.

No response

### Foot Version foot version: 1.17.2 +pgo +ime +graphemes -assertions ### TERM environment variable foot ### Compositor Version labwc 0.7.3-52-g750d37b1 ### Description of Bug and Steps to Reproduce When using `nnn` file manager, foot will not show a title when nnn is first launched through a shortcut or through the terminal by typing `foot nnn -x`, `foot -e nnn` `foot nnn` or `foot -e nnn -x`. It is only when one navigates to a different directory that the title will show up. I tried the same with `kitty`, `xterm` and `alacritty` and they all work. The only way this works is if I open foot first and then just launch `nnn` in the already open terminal. ### Relevant logs, stacktraces, etc. _No response_
Owner
Copy link

I'm going to guess a bit here, but I believe the issue is that nnn isn't setting the initial title by itself.

The other terminals are most likely setting the initial title based on the command line. Foot doesn't, it sets the title to whatever you've configured in your foot.ini (defaulting to foot/footclient).

Then, I believe nnn does set the title when you change directory.

The reason it works when you start nnn from within an already running terminal instance is most likely that the shell sets the title.

I'm going to guess a bit here, but I believe the issue is that nnn isn't setting the initial title by itself. The other terminals are most likely setting the initial title based on the command line. Foot doesn't, it sets the title to whatever you've configured in your foot.ini (defaulting to foot/footclient). Then, I believe nnn **does** set the title when you change directory. The reason it works when you start nnn from within an already running terminal instance is most likely that the shell sets the title.

nnn does set the initial title by itself, please check the video below:

https://drive.google.com/file/d/1sk_Cll6hVXdp717AlIpoTZqOJuZ4aepb/view?usp=sharing

I actually had a small discussion about it on nnn's github but quickly realized it was foot who was at fault:

https://github.com/jarun/nnn/discussions/1918

nnn does set the initial title by itself, please check the video below: [https://drive.google.com/file/d/1sk_Cll6hVXdp717AlIpoTZqOJuZ4aepb/view?usp=sharing](https://drive.google.com/file/d/1sk_Cll6hVXdp717AlIpoTZqOJuZ4aepb/view?usp=sharing) I actually had a small discussion about it on nnn's github but quickly realized it was foot who was at fault: [https://github.com/jarun/nnn/discussions/1918](https://github.com/jarun/nnn/discussions/1918)
Owner
Copy link

Here's the log output from a slightly instrumented foot build:

1360: PUSH TITLE
 err: csi.c:1360: PUSH TITLE
 dbg: osc.c:1293: resized OSC buffer: 4096
 dbg: osc.c:911: OSC: 7;file://mini.la.casa/home/daniel/src/foot/bld/debug (param = 7)
 dbg: osc.c:441: PWD: URI: file://mini.la.casa/home/daniel/src/foot/bld/debug
 dbg: osc.c:450: OSC7: pwd: /home/daniel/src/foot/bld/debug
 dbg: osc.c:911: OSC: 2;~/src/foot/bld/debug (param = 2)
 err: csi.c:1371: POP TITLE
 err: csi.c:1360: PUSH TITLE
 dbg: osc.c:911: OSC: 104 (param = 104)
 dbg: osc.c:1113: resetting all colors
 err: csi.c:1371: POP TITLE
 err: csi.c:1360: PUSH TITLE
 dbg: osc.c:911: OSC: 104 (param = 104)
 dbg: osc.c:1113: resetting all colors

Yes, it sets the title (that's the OSC: 2). But after that it pops the title it saved before changing the title.

Here's the log output from a slightly instrumented foot build: ``` 1360: PUSH TITLE err: csi.c:1360: PUSH TITLE dbg: osc.c:1293: resized OSC buffer: 4096 dbg: osc.c:911: OSC: 7;file://mini.la.casa/home/daniel/src/foot/bld/debug (param = 7) dbg: osc.c:441: PWD: URI: file://mini.la.casa/home/daniel/src/foot/bld/debug dbg: osc.c:450: OSC7: pwd: /home/daniel/src/foot/bld/debug dbg: osc.c:911: OSC: 2;~/src/foot/bld/debug (param = 2) err: csi.c:1371: POP TITLE err: csi.c:1360: PUSH TITLE dbg: osc.c:911: OSC: 104 (param = 104) dbg: osc.c:1113: resetting all colors err: csi.c:1371: POP TITLE err: csi.c:1360: PUSH TITLE dbg: osc.c:911: OSC: 104 (param = 104) dbg: osc.c:1113: resetting all colors ``` Yes, it sets the title (that's the OSC: 2). But **after** that it pops the title it saved **before** changing the title.
Owner
Copy link

Trying XTerm, the title is set to nnn, not a directory. As I explained before, that's the terminal that sets the title based on the command line; foot doesn't it sets the title to what you've configured in foot.ini. If you want a workaround for this, see: https://codeberg.org/dnkl/foot/wiki#foot-e-cmd-does-not-set-the-window-title-to-cmd

Trying XTerm, the title is set to `nnn`, not a directory. As I explained before, that's the terminal that sets the title based on the command line; foot doesn't it sets the title to what you've configured in foot.ini. If you want a workaround for this, see: https://codeberg.org/dnkl/foot/wiki#foot-e-cmd-does-not-set-the-window-title-to-cmd
dnkl 2024年07月27日 18:28:26 +02:00

Did you at least watch the video? How come every other terminal in wayland and x11 show the initial folder as a the title correctly but foot doesn't?

If you don't want to fix it that's fine but to me this looks like a bug.

Did you at least watch the video? How come every other terminal in wayland and x11 show the initial folder as a the title correctly but foot doesn't? If you don't want to fix it that's fine but to me this looks like a bug.
Owner
Copy link

When I tested Xterm it did not show the directory as title, it showed nnn. As I wrote in my previous reply.

Other terminals probably don't implement the title push/pop escapes.

When I tested Xterm it did **not** show the directory as title, it showed nnn. As I wrote in my previous reply. Other terminals probably don't implement the title push/pop escapes.

When I tested Xterm it did not show the directory as title, it showed nnn. As I wrote in my previous reply.

Other terminals probably don't implement the title push/pop escapes.

That's because you did not use the -x flag.

xterm -e nnn -x

> When I tested Xterm it did **not** show the directory as title, it showed nnn. As I wrote in my previous reply. > > Other terminals probably don't implement the title push/pop escapes. That's because you did not use the -x flag. `xterm -e nnn -x`

And I assume you didn't watch the video based on your response, sigh.

And I assume you didn't watch the video based on your response, sigh.
Owner
Copy link

I ran xterm -e nnn -x. Just as I used -x when testing in foot. That's why you see the osc-2 in the log output.

Xterm still sets the title to nnn. I guess you have a different xterm than I do.

I'm done here. The sequence of escapes sent by nnn are clear; the title is saved, then set to a directory, then popped. There's nothing to fix.

I ran `xterm -e nnn -x`. Just as I used -x when testing in foot. That's why you see the osc-2 in the log output. Xterm still sets the title to nnn. I guess you have a different xterm than I do. I'm done here. The sequence of escapes sent by nnn are clear; the title is saved, then set to a directory, then popped. There's nothing to fix.
Owner
Copy link

Hint: terminfo matters. Some terminfos have capabilities that contain escapes to push/pop the title.

Maybe nnn are emitting those.

Hint: terminfo matters. Some terminfos have capabilities that contain escapes to push/pop the title. Maybe nnn are emitting those.

But after that it pops the title it saved before changing the title.

Interesting... Thanks for the log. nnn codebase is a bit hard to get around but from some cursory grepping, only places where we explicitly emit these are at init (line ~9001):

	if (cfg.x11 && !g_state.picker) {
		/* Save terminal window title */
		printf("033円[22;0t");

During the main loop (xterm_cfg(), line ~1390):

		printf("033円]2;%s007円", r ? &path[homelen - 1] : path);

And at exit (cleanup(), line ~8532):

	if (cfg.x11 && !g_state.picker) {
		printf("033円[23;0t"); /* reset terminal window title */

I don't see where the pop request is coming from, it should only occur at exit. Maybe it's being emitted indirectly (through ncurses?). I'll try to investigate it a bit more later and figure out what's going on.

> But after that it pops the title it saved before changing the title. Interesting... Thanks for the log. `nnn` codebase is a bit hard to get around but from some cursory grepping, only places where we *explicitly* emit these are at init (line ~9001): ```c if (cfg.x11 && !g_state.picker) { /* Save terminal window title */ printf("033円[22;0t"); ``` During the main loop (`xterm_cfg()`, line ~1390): ```c printf("033円]2;%s007円", r ? &path[homelen - 1] : path); ``` And at exit (`cleanup()`, line ~8532): ```c if (cfg.x11 && !g_state.picker) { printf("033円[23;0t"); /* reset terminal window title */ ``` I don't see where the pop request is coming from, it should only occur at exit. Maybe it's being emitted indirectly (through `ncurses`?). I'll try to investigate it a bit more later and figure out what's going on.
Sign in to join this conversation.
No Branch/Tag specified
master
osc-5522
sixel-heap-buffer-overflow
releases/1.27
releases/1.26
releases/1.25
releases/1.24
multi-cursor
releases/1.23
pixman-16f-2
releases/1.22
releases/1.21
releases/1.20
releases/1.19
releases/1.18
releases/1.17
releases/1.16
releases/1.15
releases/1.14
releases/1.13
releases/1.12
releases/1.11
releases/1.10
releases/1.9
releases/1.8
releases/1.7
releases/1.6
releases/1.5
releases/1.4
releases/1.3
releases/1.2
releases/1.1
releases/1.0
1.27.0
1.26.1
1.26.0
1.25.0
1.24.0
1.23.1
1.23.0
1.22.3
1.22.2
1.22.1
1.22.0
1.21.0
1.20.2
1.20.1
1.20.0
1.19.0
1.18.1
1.18.0
1.17.2
1.17.1
1.17.0
1.16.2
1.16.1
1.16.0
1.15.3
1.15.2
1.15.1
1.15.0
1.14.0
1.13.1
1.13.0
1.12.1
1.12.0
1.11.0
1.10.3
1.10.2
1.10.1
1.10.0
1.9.2
1.9.1
1.9.0
1.8.2
1.8.1
1.8.0
1.7.2
1.7.1
1.7.0
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.3
1.2.2
1.2.1
1.2.0
1.1.0
1.0.0
0.9.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/foot#1783
Reference in a new issue
dnkl/foot
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?