Twinner - streamlined terminal task launcher

twinner takes a CLI command and launches it in a new terminal window with some pre-defined behavior such as: window title or class, or notification or pause after the command exits.

In a typical use case, the command would be assigned to a hotkey, kept in a .desktop file, in history of your desktop command launcher or generated by another tool. (My own use cases most often involve dmenu fed by other tools and scripts.)

It could be anything from a common mid to long-running task (eg. flatpak update) to a custom script, or a TUI app such as htop or similar.

Few examples to get you started:

  • The classic “hello world”:

    twinner -p -c 'echo "Hello, world!'
    

    To set another emulator as default:

    export TWINNER_EMULATOR=alacritty
    twinner -p -c 'echo "Hello, world!'
    

    Note that simply adding the environment variable to .profile won’t affect your running desktop; you will need to use another method or wait until file-based configuration is implemented.

  • Run flatpak update in terminal emulator:

    twinner flatpak update
    
  • Run top but with a title that is GOAT:

    twinner -t GOAT top
    
  • Run top in alacritty (which already is GOAT):

    twinner -e alacritty top
    
  • Start Neovim in your project directory:

    twinner -C my/proj nvim
    
  • Show weather from wttr.in and waits 10 seconds:

    twinner -p -L 10 curl wttr.in
    
  • Have ls try to list a non-existent dir (examle of a failing command):

    twinner -c 'ls /nonexistent/dir'
    

    This should pause automatically, unless the directory acually exists, which would be ridiculous.

1 Like

None of this actually tells us what twinner does. It “helps with integrating commands” and “provides you with ways to streamline your workflow” are not concrete enough to make anyone want to check out your project.

There is more info on the web page and that makes it much clearer (it’s a tool for launching your terminal?), but you might want to explain why we would want to use or look at it here too.

3 Likes

Maybe I’ve chosen the wrong part of the README to quote here. Esp. the paragraph 2 and 3 do sound a bit too vague. I may try to fix it, but it’s a rabbit hole for me, because I’m really bad at marketing and I have no confidence in judging what’s going to work better or worse. (Heck—sorry if I’m oversharing—I only vaguely understand what you mean by “explain why we would want to use or look at it”; in my brain the idea of suggesting other people’s motivations (let alone explaining hypothetical ones) other than curiosity? But I’m not here to learn about marketing.)

I fell back on assumption that curiosity – specifically in the context of “what other people do with Zig” should be a good enough reason why.

I was also thinking of using examples closer to how I actually use this tool but it’s typically integrated with other tools, and it’s shaped by my own requirements of how I want my workflows to be: fast, no distactions, no whistles & bells.

For example for opening code files to work on, I have a dmenu-based tool that lists files in all of my active projects, feeds it into dmenu, and then takes the selected item and opens alacritty window with

  • the selected file open in nvim
  • chdir’d to the project directory (this helps tooling like LSP)
  • title set properly so that my ActivityWatch can chalk it up to the right project, and I can easily switch to the window later.

Another example is that I have a script that’s sort of like a “glorified sleep(1)”, which again. opens list of pre-defined and named time durations (eg. laundry, coffee brewing, etc.), then takes the selected item and waits for the specified time and then just issues a notification and quits. With twinner I can make sure that

  • window title is set to match my i3 rule that will move the window out of focus to a dedicated desktop
  • once the script is done, the window will keep open until I’m ready to “ack” the notification.

All of this is really tailored to my needs, though, and my own desktop experience, which I’m pretty sure is far from any generic standard.

So I got rid of the first 3 vague paragraphs and hopefully made it clearer.

Thank you for your feedack.