Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement "Set Touch Bar Key Labels" for iTerm2 #2549

Open
unxed opened this issue Dec 6, 2024 · 2 comments
Open

implement "Set Touch Bar Key Labels" for iTerm2 #2549

unxed opened this issue Dec 6, 2024 · 2 comments

Comments

@unxed
Copy link
Contributor

unxed commented Dec 6, 2024

https://iterm2.com/documentation-escape-codes.html

Set Touch Bar Key Labels

You can configure touch bar key labels for function keys and for the "status" button. The code used is:

OSC 1337 ; SetKeyLabel=[key]=[value] ST

Where [key] is one of F1, F2, ..., F24, to adjust a function key label; or it can be status to adjust the touch bar status button. You can also save and restore sets of key labels using a stack. To push the current key labels on the stack use:

OSC 1337 ; PushKeyLabels ST

To pop them:

OSC 1337 ; PopKeyLabels ST

You can optionally label the entry in the stack when you push so that pop will pop multiple sets of key labels if needed. This is useful if a program crashes or an ssh session exits unexpectedly. The corresponding codes with labels are:

OSC 1337 ; PushKeyLabels=[label] ST
OSC 1337 ; PopKeyLabels=[label] ST

Where [label] is an ASCII string that works best if it is unique in the stack.

@unxed
Copy link
Contributor Author

unxed commented Dec 15, 2024

See also: touch bar interaction in wx backend
https://github.com/elfmz/far2l/blob/master/WinPort/src/Backend/WX/Mac/touchbar.h

@unxed
Copy link
Contributor Author

unxed commented Dec 23, 2024

bool TTYBackend::OnConsoleSetFKeyTitles(const char **titles)
{
    if (!_far2l_tty) {
        const char* term_program = getenv("TERM_PROGRAM");
        if (term_program != NULL && strcmp(term_program, "iTerm") == 0) {
            // ask TTYOutput to send iTerm2 escape sequences
            return true;
        }
        return false;
    } else {
        // ... current code ...
    }

Not sure, iTerm or iTerm2, yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant