Bluetui – A TUI for managing Bluetooth on Linux

(github.com)

250 points | by birdculture 21 hours ago

18 comments

  • bfkwlfkjf 14 hours ago
    What a coincidence, I just discovered this tool yesterday. It made me really happy how a tool so simple makes such a huge difference in terms of how smooth it is to solve a problem, compared eg with using bluetoothctl.

    It also occurred to me that there's a real value to tuis vs guis which is that since they're simpler to build with the same developer effort you can build more tools. I remember the dwarf fortress guys saying this in their interview, that they had at some point a similar game to DF but in 3d, but at some point they realized that by not wasting effort building the graphics part of the game they saved time to focus on what mattered.

    If I have one tiny criticism about bluetui is the annoying fonts. I understand what they're trying to do: with more glyphs you can increase the density of information. But the thing is it's not really necessary in this case. Like someone else commented, there's plenty of white space. I know to some people it feels like eye candy, but to me the emojis sprinkled in the text are an eye sore.

    • pythops 13 hours ago
      bluetui author here.

      > It made me really happy how a tool so simple makes such a huge difference in terms of how smooth it is to solve a problem,

      Happy to hear that :)

      > if I have one tiny criticism about bluetui is the annoying fonts

      You suggest to get rid of the icons ? what if they can be disabled in the config, will that fix the issue for you ?

      > there's plenty of white space You can set the window width from the config file (width = positive integer) if you don't want the TUI to be responsive.

      • PostOnce 11 hours ago
        I think the icons are cool.

        Emoji in text is annoying, but this isn't a page of text, it's a UI element, and that can make something clear especially if you're connecting a device whose name is unknown, but you know it's a speaker, or whatever.

        So having the option to enable / disable is better than taking away the icons, in my opinion.

        • alias_neo 11 hours ago
          Absolutely this. Particularly when there might be a few unnamed devices, but you know your devices is a particular device class, you can guesstimate the correct device based on its class, and the icon is extremely useful for this!
      • jorvi 8 hours ago
        > You suggest to get rid of the icons ? what if they can be disabled in the config, will that fix the issue for you ?

        Yes.

        In general, its a good idea to not rely on someone having installed nerdfonts / fonts with glyphs. Or at the very least offer fallback.

        You can usually get pretty far by repurposing Unicode symbols.

        For example, from Bamum:

          𖦤 Headphone
          𖦥 IEM
          𖤣 Mic
          ꚰ Warning
          𖥉 Bluetooth (had to get a little creative)
        • dspillett 7 hours ago
          That method isn't entirely reliable either: all come out at “question mark in a box” (Chrome, Edge) or “codepoint hex in box” (FF) on the old Win10 box that I'm currently trying to retire. The come out find on a similarly default Win11 setup.

          While the issue here is Win10, it shows that the problem is client font sensitive so it might affect others too (perhaps those running old-but-still-supported Linux distro releases with default fonts).

          • e3bc54b2 4 hours ago
            > all come out at “question mark in a box” (Chrome, Edge) or “codepoint hex in box” (FF) on the old Win10 box that I'm currently trying to retire. The come out find on a similarly default Win11 setup.

            This is pretty funny to me, because on plain ol' Firefox on NixOS everything looks just fine!

            We've come pretty far from the days when things were randomly broken on Linux..

            • boromisp 3 hours ago
              Firefox on Fedora 43 here, no joy, and indeed, randomly broken on Linux (too).

              [edit] Okey, so installing the complete Google Noto Fonts family resolved this issue. But I still don't know if relying on a script with almost no font support is any better than what the OP did.

        • yjftsjthsd-h 6 hours ago
          > In general, its a good idea to not rely on someone having installed nerdfonts / fonts with glyphs. Or at the very least offer fallback.

          This bears emphasis; I sometimes use tools that try to use fancy fonts for icons, and it just gives me unreadable symbols because I don't have the font installed. And you might reasonably say, "just install the font package", but that only works if the font is packaged for my system, and I know what package it's in.

        • Ontonator 7 hours ago
          For Bluetooth, you could of course use one or both of the runes upon which the logo was based: ᛡᛒ
      • jxdxbx 10 hours ago
        Hi bluetui author. I just discovered your app last week, just wanted to say it is great.

        I truly like this new generation of command line utils (I have bat, eza, etc aliased to things like cat and ls) and TUIs like yours. TUIs in particular: having grown up with DOS apps, then graduating to using Pine for email on a shell account, they are nostalgic, but also just super fast and practical. And I like having an option in between the command line and config files and a full-blown GUI app (which, on Linux, might look like any old random thing anyway).

      • bfkwlfkjf 11 hours ago
        > what if they can be disabled in the config, will that fix the issue for you ?

        I mean if you're offering, I would love that.

        And thank you for releasing under GPL. <3

        • pythops 10 hours ago
          sure, feel free to open a github issue and I will do my best to implement it asap :)
  • ekjhgkejhgk 10 hours ago
    Of all the Rust stuff that I've seen on HN, this is the first one that makes me go "maybe I should learn Rust". Not for the performance aspect, but because it seems so neat to be able to compile to a binary. I went to the releases page, I downloaded bluetui-x86_64-linux-gnu, and it works.
    • jimangel2001 9 hours ago
      Why not C, C++, Go or any other compiled language? What made you want ot learn rust?
      • ekjhgkejhgk 8 hours ago
        If it's good enough for Linus Torvalds, it's good enough for me :-)

        I'm not a professional programmer, I just want to have more control over my computer. C seems like a full time job to learn and not shoot yourself in the foot.

    • SwiftyBug 10 hours ago
      From your comment, I'm assuming you're mostly familiar with interpreted languages. Chances are that you know JS/TS. If that's the case, I suggest that you give Go a go. The learning curve is way softer than Rust's and it's not too uncomfortable to someone who already knows TypeScript. And the advantage of Go over Rust is that the compile time is much, much shorter.
      • jamesponddotco 10 hours ago
        I went from Bash to Go as a system admin, and eventually built something with Rust too, so I can definitely confirm that the Go learning curve is softer than Rust.
      • ekjhgkejhgk 8 hours ago
        > From your comment, I'm assuming you're mostly familiar with interpreted languages.

        I'm proficient with Python and Julia, but I avoid Python as much as possible.

        > The learning curve is way softer than Rust's

        Ok, it might be easier, but then I'll have learned Go and not Rust :-)

      • me_vinayakakv 10 hours ago
        Agree. I immediately remembered k9s[1], a TUI to manage Kubernetes workloads.

        It is written in Go as well.

        [1]: https://github.com/derailed/k9s

      • pythops 9 hours ago
        I still think it's better to learn Rust

        https://www.youtube.com/watch?v=nOSxuaDgl3s

        • gabrielgio 9 hours ago
          I only watch the go part, and I'll say that in 3 years working with I might have had at most 3 times nil pointer crashes in prod, in which took about 30 min between getting fixed and deployed.

          There are linter which helps prevent most of if not all crashes (just keep in mind to run linting and compile the binary it would still be ages faster than anything rust I have ever compiled). His argument is weak, and not simple.

          I'll give that type system in golang is too simplistic sometimes, and a more complex could help to express better some use cases.

          Still go for a person coming from a interpreted language is a solid choice by being MUCH MUCH simpler.

          • pythops 6 hours ago
            I agree on the easiness of Go, but I don't think people should always choose the easy solution. The easiness of Go come at a cost.
            • gabrielgio 5 hours ago
              Agree, people should understand why they are picking a language. If it is to learn new language that is fast, compiles to a binary (also fast) and has a nice onboard experience for a person coming from a interpreted language (which is the topic of thread) go fits nicely.

              Rust is not always the answer just because it has "no nil exception". The correctness of Rust comes at a cost as well.

          • super_flanker 2 hours ago
            I agree with simplicity and ease of learning Go.

            > 3 years working with I might have had at most 3 times nil pointer crashes in prod

            I've been running a rust app for my personal trading app and a small service at a very large FAANG company for more than 3 years, and guess what I'm yet to see a nil crash.

    • WhyNotHugo 9 hours ago
      There's also a program in Go which does almost the same: https://github.com/bluetuith-org/bluetuith
      • nikoomilana 5 hours ago
        This is anecdotal but I've been using bluetuith for a year on my nix machine with several adapters then switched to bluetui recently, and my experience with bluetui has been amazing. I just ran into issues all the time with bluetuith and I assumed it was due to the OS or something. An example I can think of is trusted connections- my devices just never automatically connected once switched on, but now they do.
    • globular-toast 6 hours ago
      You can do it with any language that supports static linking, like C, C++, Go etc. You can also do it with things like Pyinstaller for Python. It's not that big of a deal tbh.
      • dymk 6 hours ago
        It absolutely is a big deal that you can run “cargo build” with no set up and things just work. Out of the languages you listed, Go is the other where it’s that easy.
  • rjzzleep 17 hours ago
    I don't usually comment on these things. But this is phenomenal. I really like that the person that did this thought about a simple space for connect and enter for disconnect. I use rofi based tool whenever I don't feel like using my mouse and frequently disconnect because I toggled something that was already connecting.

    The same happens when connecting or disconnecting from VPN using the nm applet. This is a simple but extremely useful way of separating two states.

    • pythops 13 hours ago
      Bluetui author here Happy to hear that :)
      • hsbauauvhabzb 12 hours ago
        Have you considered a network manager? Weirdly enough I have no trouble connecting to a Bluetooth device via bluetoothctl, I can never remember how to disable wifi, or set a static ip though
        • frumiousirc 9 hours ago
          > Have you considered a network manager?

          I've used "nmtui" on Linux for many years to do this. "nm" = "Network Manager".

          • bfkwlfkjf 1 hour ago
            Seconded nmtui.

            The bluetui author also has impala, which is a tui for the network manager. But in this case, nmtui is good enough.

          • hsbauauvhabzb 8 hours ago
            Thanks, this sounds like what I need ;)
        • pythops 5 hours ago
          that's why I don't like network manager and bloated software in general, they try to do everything and it always come problems

          You don't need network manager for bluetooth. just install bluetoothd and there you go and use bluetui or bluetoothctl for wifi, I recommend iwd, and then you can use impala, or iwctl pick up the right tool for right purpose

  • Zaloog 14 hours ago
    Nice work. Ive also build a TUI over blueutil (https://github.com/toy/blueutil) for MacOs:

    https://github.com/Zaloog/blueutil-tui

    Its written in python using the textual framework and displays the connections inline in your Terminal.

  • alator21 4 hours ago
    I vibe coded(mostly) a bt tui for linux as well. You can check it out here https://github.com/alator21/bt-tui.
  • hombre_fatal 17 hours ago
    Much better than bluetuith which has weirdly bad UI/keybindings.
  • snowstormsun 3 hours ago
    I am using this every day, such a useful little tool!
  • kachapopopow 16 hours ago
    I wonder why omarchy isn't using this yet.
    • SwiftyBug 10 hours ago
      Same. First thing I did was replace the action of the bluetooth icon in Waybar with bluetui.
    • kachapopopow 15 hours ago
      I found out: it used to be a lot less intuitive
    • udev4096 9 hours ago
      omarchy is a shitshow. Please stay away from it. It's a disaster waiting to happen. It's the most bloated install script I have ever seen. DHH is fucking liar and taking up all the credit for himself by ripping off of bunch of well established open source projects
      • moondev 7 hours ago
        I can't remember where I heard it, but somebody said all Linux distributions are essentially you inheriting someone(s) mess in a way.
      • UK-AL 5 hours ago
        Isn't that literally every distro? They're just curated pre installed packages.
  • nevon 16 hours ago
    Used this the other day when for whatever reason Gnome's built-in bluetooth GUI refused to connect to my headphones. Very nice and easy to use.
  • user3939382 4 hours ago
    Highly recommend on macos blueutil and aliasing these with your bluetooth devices IDs to bluetooth on+connect device in one command, bluetooth off. It’s more user friendly than any GUI workflow for repeat devices.
  • lazyfanatic42 9 hours ago
    What is with this wave of Text User Interface applications everywhere; and why does dev go through this type of cycle so often? Is it just new gen type behavior, so around 2030 we'll see a new wave of whatever and whatever?

    I refuse to be old man who yells at clouds, but I think just like the new gen can't help what comes, neither can I. I just feel so old sometimes because most of the "new ideas" aren't really at all; they just have a different language to describe the same thing.

    • WhyNotHugo 9 hours ago
      Lots of language have pretty good tools for making TUIs.

      There's a good ratio between the time it takes to implement a TUI and its usefulness.

      Writing a GUI with equivalent functionality would typically be a lot more work, with no gains at all. Er, except maybe touchscreen and touch-gesture support, none of which would add any value for this kind of tool.

      • globular-toast 6 hours ago
        > Writing a GUI with equivalent functionality would typically be a lot more work, with no gains at all.

        I disagree. Have you used something like tkinter? It's ridiculously easy to build GUIs. The trouble is if you build a GUI that way it will look kinda beige/crap whereas a TUI looks retro (but looks even worse to non-nerds).

    • crims0n 3 hours ago
      I personally love the trend. TUIs are a great way to make a cross platform tools without much friction, and they are a pleasure to use.
    • palata 8 hours ago
      TUI is my favourite on a computer (well, after CLI but... you know).

      I want a GUI when I don't have a keyboard, typically on my mobile phone.

    • udev4096 9 hours ago
      No one ever said TUIs are a new thing. It's been there since the beginning, when programs explicitly ran on terminals before WWW took off. It's the bloated web which ruined a lot of things
  • rokkamokka 10 hours ago
    I was at a TUI Blue vacation resort a while back, thought for a minute this was related to that!
    • pythops 5 hours ago
      hahah nice one :D
  • globular-toast 6 hours ago
    Is there something similar for wifi?
    • pythops 6 hours ago
      • refracture 4 hours ago
        This is great, thank you for making great TUI tools!
    • nekiwo 6 hours ago
      nmtui? it should be installed already if you have network manager
      • pythops 5 hours ago
        no everyone is using network manager. and personally I don't like as it is bloated tool trying to do everything and not being good at anything

        wifi => iwd => impala, iwctl, iwgtk blueooth => bluetoothd => bluetoothctl, bluetui ... vpn => coming soon ;)

  • imiric 13 hours ago
    This looks very nice!

    Is there a non-interactive CLI as well?

    I currently use `bluetoothctl` with a wrapper script and `expect` so that I can quickly fire off `bluetooth.sh <device name substring>`, and it does the tedium of ensuring that the connection is established regardless of my audio settings. I do still use `bluetoothctl` for manually scanning and pairing, but once a device is paired, I don't run it directly. So it would be great if I could solve both things with the same tool.

    I would only really need an interactive TUI for scanning and pairing. Maybe not even for that. E.g. if I run `bt pair <some device name>` then the tool could scan available devices and try to pair with one that fuzzily matches the provided name. And `scan` could work in a similar way. E.g. `bt scan --duration 10s` could show found devices within a specific time.

    I'm not a big fan of interactive UIs if the same can be accomplished non-interactively. This allows the tool to be scripted, and can be much quicker to do what you want.

    Does such a tool exist for Bluetooth? I'm tempted to whip something up myself, though I really have enough side projects as it is...

  • gbin 19 hours ago
    Yet another impressive rust/ratatui tool! I am really a fan of those projects (kudos to Orhun). At Copper Robotics we use it for our monitoring console, it is so easy to just ssh on a robot and get all your monitoring state in super snappy TUI screens instead of web stuff.
    • pythops 10 hours ago
      bluetui author here,

      Thanks, glad you like it. And yes Big kudos to Orhun !

  • imvetri 16 hours ago
    does TUI stand for terminal user interface ?
    • unwind 15 hours ago
      My understanding is T for text-based [1], the term is used about e.g. DOS programs too where the text interface is not historically called a terminal.

      [1]: https://en.wikipedia.org/wiki/Text-based_user_interface

    • caymanjim 15 hours ago
      Yes. The term has been around for at least a few decades, but only became somewhat more widely used in the past decade. Only really known by people who spend a lot of time on the command line.
      • EgregiousCube 15 hours ago
        Not to be confused with CLI, which is literally for people who spend a lot of time on the Command Line :)
  • general1465 13 hours ago
    I have tried to install it and got absolutely nowhere.

    1. sudo apt install cargo on latest ubuntu and on attempt to "cargo install bluetui" it will say something about edition 2024 error. Because ubuntu is installing rust from 2023 and nobody bothered to update it?

    2. Installing from https://rust-lang.org/tools/install/ will install rust only after removing existing version from 2023 (Why you won't just rewrite it?). Now I don't have cargo at all.

    3. On attempt to use rustup it will tell me that path was not found. I need separate installation?

    I am sorry but WTF is this garbage? Seems like whole rust ecosystem is broken...

    • calgoo 11 hours ago
      Just grab the latest build https://github.com/pythops/bluetui/releases

      Apt packages are managed by the OS so its normal they don't get overwritten by tools you download of the internet directly as that could break other apps installed with apt. As a general rule, don't use coding tools from apt as they are normally out of date, install them from other sources

      • yjftsjthsd-h 6 hours ago
        > Apt packages are managed by the OS so its normal they don't get overwritten by tools you download of the internet directly as that could break other apps installed with apt.

        I would, however, have expected it to shadow the OS version. That is, I would expect any installer running as your user to install eg. ~/.local/bin/rustc and ignore /usr/bin/rustc (and maybe print a message about making sure that ~/.local/bin takes precedence in your PATH).

    • skydhash 11 hours ago
      I had similar with just (a make replacement) and debian 12. It seems requiring the latest of everything is the latest trend of rust ecosystem.
      • haradion 10 hours ago
        For the compiler in particular, it's pretty common practice to depend on a recent version. The backward compatibility situation is generally excellent, so the only real challenge is getting the compiler installed. That's generally straightforward with rustup, and Debian/Ubuntu also package several versions (under different package names) that are more recent than the distro's default.
      • Narishma 4 hours ago
        That has always been the trend in the rust ecosystem. It's not a new thing.
    • sharperguy 9 hours ago
      This kind of thing is what drives advanced users from debian based distros to things like Arch and Nixos. With niche tools like this that don't have official packages, having a easy way for users to share build scripts, and have them managed by the package manager is a life saver.
    • baobun 11 hours ago
      You could use docker to build and then run the resulting binary without.
    • encom 6 hours ago
      Can't get this to work either. Downloaded the release because I'm not touching any Rust tools, but it doesn't run.

        $ ./bluetui-x86_64-linux-gnu
        Error: Error { kind: Internal(DBus("org.freedesktop.DBus.Error.TimedOut")), message: "Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)" }
      
      I have Bluez installed. Comes with Debian KDE by default I guess, because didn't install it myself.
    • udev4096 9 hours ago
      How long have you been using ubuntu? From my past unpleasant experience of using it, one thing I learned is never rely on apt for package updates. Most will just keep rotting and hardly get any updates. It's the same with debian. Either use install scripts from packages or switch to a much more serious distro like Arch, where packages are always updated
      • westmeal 5 hours ago
        No offense but this is the most 'i use arch btw' comment I've seen in a while.
    • imiric 13 hours ago
      Heh, my sympathies.

      Have you tried mise[1]? The last thing you probably want is to add another abstraction on top of this mess, but I've had good experiences with it, and it manages Rust, Go, Python, etc. environments very well.

      IME getting any modern toolchain setup on different distros can be problematic, especially if you mix in the often outdated distro packages. So using isolated environments with a tool specifically built for that works better.

      [1]: https://mise.jdx.dev/

  • userbinator 16 hours ago
    Why not show the device address? There's plenty of room for it and it's important when you have multiple devices with the same name. Or has the abominable trend of excess whitespace infected TUIs too?
    • dymk 14 hours ago
      There's probably nicer ways to express that criticism
      • userbinator 13 hours ago
        I've absolutely had it with shit "designer" UIs hiding useful information and leaving a sea of useless space instead. There's nothing "nicer" about making users go through more effort.
        • lysp 13 hours ago
          That has nothing to do with this author and everything to do with you.
          • userbinator 1 hour ago
            Zero attempt to answer my original question. Looks like I've stepped into another pit of toxic positivity here.
        • maeln 11 hours ago
          It's open source, you can fork it :)
        • spookie 12 hours ago
          Have you thought that you may want the window for this to be super small and that whitespace you see no longer exists?
          • userbinator 1 hour ago
            We've had scrollbars for several decades, before the same stupid "designers" destroyed them.
          • keyringlight 5 hours ago
            Adapt based on window size? Either hide/truncate less essential information when the width goes below a threshold, or make each entry multi-line if you require showing all of it. This is not exactly a new approach, I can resize my Foobar2000 window and the playlist columns will stay proportional to the window, and that seems to be using fairly standard windows components to the extent it wouldn't look out of place 30 years ago.
          • pythops 11 hours ago
            bluetui author there

            You can set a window with in the config file (with = positive integer) and TUI will be displayed with this width even in a large screen.

            https://github.com/pythops/bluetui?tab=readme-ov-file#custom...

        • anthk 12 hours ago
          It's a plague under TUI go software too made with Bubbletea. Also, with some mesh related interfaces written in Python. Both slow and with a shitty interface not properly working under an 80x24 terminal with 16 colours.

          I remember some hipster fauxretro player with just some playlist made of m3u links, written in Go. The visualization animations made it unusable under my n270 CPU based netbook. Meanwhile, the playlist URL's from the code played perfectly well under mocp with a really low CPU usage. Oh, you want bells and whistles? I think the Cava terminal visualizer can work with MPD and plug any CLI/TUI client you like.

          • skydhash 11 hours ago
            Hardcoding any color than base16 is usually a poor choice. It should be up to the user to use any other color.

            And colors should be semantic. If you don’t have any theming ability, just use reverse video to indicate selected state.

            My current pet peeve is cli tools using ansi codes for progress bar. And with very poor detection of terminals.

            • anthk 10 hours ago
              For curseradio under OpenBSD, I just replaced bold for reverse in the Python code for the selected and/or highlighted radio station. It works much better this way.
          • udev4096 9 hours ago
            The whole ecosystem of charm tools are well made. But most of them are extremely bloated and requires tons of dependencies to build a TUI