SFX Command Binding #8346

Closed
opened 2026-01-31 01:27:04 +00:00 by claunia · 3 comments
Owner

Originally created by @timmkrause on GitHub (May 20, 2020).

Description of the new feature/enhancement

To improve gamification and making the use of (the) terminal(s) even more engaging, I'd like to propose a "SFX Command Binding" feature.

For me, it started with this tweet: https://twitter.com/timmkrause/status/1263009434231549952

A colleague wrote "Wait, I still need to push it." and I wrote back "You should play https://www.youtube.com/watch?v=vCadcBR95oU while pushing." and while writing I just thought how cool would it be, to let a small piece of audio be played when git push is being executed.

This should be configurable in a dynamic manner of course.

Maybe something like this:

{
    "profiles": [
      {
        "guid": "{guid}",
        "name": "PowerShell Core",
        "source": "Windows.Terminal.PowershellCore",
        "fontFace": "Cascadia Code PL",
        "sfxCommandBindings": [
            { "command": "git push", "soundEffect": "ms-appdata:///roaming/salt-n-pepa-push-it-short.mp3" }
        ]
      }
    ]
}

What do you think?? :)

Originally created by @timmkrause on GitHub (May 20, 2020). # Description of the new feature/enhancement To improve gamification and making the use of (the) terminal(s) even more engaging, I'd like to propose a "SFX Command Binding" feature. For me, it started with this tweet: https://twitter.com/timmkrause/status/1263009434231549952 A colleague wrote "Wait, I still need to push it." and I wrote back "You should play https://www.youtube.com/watch?v=vCadcBR95oU while pushing." and while writing I just thought how cool would it be, to let a small piece of audio be played when `git push` is being executed. This should be configurable in a dynamic manner of course. Maybe something like this: ``` { "profiles": [ { "guid": "{guid}", "name": "PowerShell Core", "source": "Windows.Terminal.PowershellCore", "fontFace": "Cascadia Code PL", "sfxCommandBindings": [ { "command": "git push", "soundEffect": "ms-appdata:///roaming/salt-n-pepa-push-it-short.mp3" } ] } ] } ``` What do you think?? :)
Author
Owner

@carlos-zamora commented on GitHub (May 20, 2020):

Architecturally, the actual text/command that is being run is the shell's job, not the terminal. So, we wouldn't be able to introduce something like "command": "git push".

That said, a workaround we've been thinking of is #3799. You can think of this like "paste X text" and define X in the keybinding for the settings.

This could be an extension to that, and I do love the thought of audio clips when I do a git push haha.

@carlos-zamora commented on GitHub (May 20, 2020): Architecturally, the actual text/command that is being run is the shell's job, not the terminal. So, we wouldn't be able to introduce something like `"command": "git push"`. That said, a workaround we've been thinking of is #3799. You can think of this like "paste X text" and define X in the keybinding for the settings. This _could_ be an extension to that, and I do _love_ the thought of audio clips when I do a git push haha.
Author
Owner

@DHowett commented on GitHub (Jun 10, 2020):

Thanks for the request!

Thinking about this more... I believe it would be best if the CLI application itself handled playing sounds. Here's why!

First, the terminal can't actually tell that you've run a command. When you type in "git push", all the terminal sees is g i t space p u s h coming off the keyboard. Now, that might be enough to conclusively identify that you're doing a git push, but you could also be using vim and running g (go to, nowhere), i (insert), t push ... Only the shell knows what those characters mean!

Second, if you write a script that runs git push and then plays a sound, you get a lot more control! Imagine you wanted to play a different sound if the push failed. Terminal has no way of knowing 😄 but your script absolutely does.

@DHowett commented on GitHub (Jun 10, 2020): Thanks for the request! Thinking about this more... I believe it would be best if the CLI application itself handled playing sounds. Here's why! First, the terminal can't actually tell that you've run a command. When you type in "git push", all the terminal sees is `g` `i` `t` `space` `p` `u` `s` `h` coming off the keyboard. Now, that might be enough to conclusively identify that you're doing a `git push`, but you could also be using vim and running `g` (go to, nowhere), `i` (insert), `t push` ... Only the shell knows what those characters mean! Second, if you write a script that runs `git push` and then plays a sound, you get a lot more control! Imagine you wanted to play a different sound if the push _failed_. Terminal has no way of knowing :smile: but your script absolutely does.
Author
Owner

@timmkrause commented on GitHub (Jun 10, 2020):

Sounds reasonable. Do you know a „global hook“ for PS Core to realize this?

@timmkrause commented on GitHub (Jun 10, 2020): Sounds reasonable. Do you know a „global hook“ for PS Core to realize this?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8346