I’m trying to implement configurable key bindings in tt. Boy, is parsing the key names into tcell.EventKeys a horrible thing. This type consists of three information:

  1. maybe a predefined compound key sequence, like Ctrl+A
  2. maybe some modifiers, such as Shift, Ctrl, etc.
  3. maybe a rune if neither modifiers are present nor a predefined compound key exists

It’s hardcoded usage results in code like this:

func (t *TreeView[T]) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
    return t.WrapInputHandler(func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
        switch event.Key() {
        case tcell.KeyUp:
            t.moveUp()
        case tcell.KeyDown:
            t.moveDown()
        case tcell.KeyHome:
            t.moveTop()
        case tcell.KeyEnd:
            t.moveBottom()
        case tcell.KeyCtrlE:
            t.moveScrollOffsetDown()
        case tcell.KeyCtrlY:
            t.moveScrollOffsetUp()
        case tcell.KeyTab, tcell.KeyBacktab:
            if t.finished != nil {
                t.finished(event.Key())
            }
        case tcell.KeyRune:
            if event.Modifiers() == tcell.ModNone {
                switch event.Rune() {
                case 'k':
                    t.moveUp()
                case 'j':
                    t.moveDown()
                case 'g':
                    t.moveTop()
                case 'G':
                    t.moveBottom()
                }
            }
        }
    })
}

This data structure is just awful to handle and especially initialize in my opinion. Some compound tcell.Keys are mapped to human-readable names in tcell.KeyNames. However, these names always use - to join modifiers, e.g. resulting in Ctrl-A, whereas tcell.EventKey.Name() produces +-delimited strings, e.g. Ctrl+A. Gnaarf, why this asymmetry!? O_o

I just checked k9s and they’re extending tcell.KeyNames with their own tcell.Key definitions like crazy: https://github.com/derailed/k9s/blob/master/internal/ui/key.go Then, they convert an original tcell.EventKey to tcell.Key: https://github.com/derailed/k9s/blob/b53f3091ca2d9ab963913b0d5e59376aea3f3e51/internal/ui/app.go#L287 This must be used when actually handling keyboard input: https://github.com/derailed/k9s/blob/e55083ba271eed6fc4014674890f70c5ed6c70e0/internal/ui/tree.go#L101

This seems to be much nicer to use. However, I fear this will break eventually. And it’s more fragile in general, because it’s rather easy to forget the conversion or one can get confused whether a certain key at hand is now an original tcell.Key coming from the library or an “extended” one.

I will see if I can find some other programs that provide configurable tcell key bindings.

⤋ Read More
In-reply-to » @lyse

@movq Sorry, I meant the builtin module:

$ python3 -m pep8 file.py
/usr/lib/python3/dist-packages/pep8.py:2123: UserWarning: 

pep8 has been renamed to pycodestyle (GitHub issue #466)
Use of the pep8 tool will be removed in a future release.
Please install and use ```pycodestyle` instead.

  $ pip install pycodestyle
  $ pycodestyle ...

I can’t seem to remember the name pycodestyle for the life of me. Maybe that’s why I almost never use it.

⤋ Read More
In-reply-to » Since I used so much Rust during the holidays, I got totally used to rustfmt. I now use similar tools for Python (black and isort).

@movq @prologic That’s what I like about Go, too. However, every now and then I really dislike the result, e.g. when removing spaces from a column layout. Doesn’t happen often, but when it does, I hate it.

I think I should have a look at Python formatters, too. Pep8 is deprecated, I think, it’s been some time that I looked at it.

⤋ Read More

Since I used so much Rust during the holidays, I got totally used to rustfmt. I now use similar tools for Python (black and isort).

What have I been doing all these years?! I never want to format code manually again. 🤣😅

⤋ Read More

Okay, I had heard of “River” before but I was not aware of this:

https://codeberg.org/river/river

River defers all window management policy to a separate window manager implementing the river-window-management-v1 protocol. This includes window position/size, pointer/keyboard bindings, focus management, window decorations, desktop shell graphics, and more.

This sounds promising and it follows the old X11 model. River does all the nasty Wayland work and I can make just the WM? 🤔🤯

⤋ Read More

(#115871582264797211) #MaradoWeekly #WeeklyShirt Week 01

After an year of posting a #WeeklyRecord (2024) and another a #WeeklyPlant (2025), in 2026 I plan to post a weekly t-shirt: and encourage you to do the same!

Like with the records and the plants, these aren’t my favorite t-shirts or need to be important, or meaningful, and there aren’t there any rules. Why t-shirts? Well, as time passes a person collects t-shirts: sometimes we bought them for a reason (like this first one), others we got on conferences or festivals, maybe they are from a favorite band… in a way, many of this shirts end up telling a story. And I do have more t-shirts than an year has weeks, so I hope I won’t have to repeat any! 😇

Usually I keep my Weekly photos text-free or explanation free, with some insights on their alt text.

Image

⤋ Read More

It drizzled all morning when we picked up the old christmas trees in town with the scouts. Right after lunch the snow storm suddenly hit and dumped three centimeters of snow in just 15 minutes. I cycled home in these crazy conditions, freezing rain hammered my face. As soon as I arrived, it stopped. It’s now down to drizzling again.

All my soaked gear is now hung up to dry. The next 11 months, I’m going to find needles over needles in all kind of impossible places.

⤋ Read More
In-reply-to » @lyse Ah, the lower right corner is different on purpose: It’s where you can click and drag to resize the window. https://movq.de/v/cbfc575ca6/vid-1767977198.mp4 Not sure how to make this easier to recognize. 🤔 (It’s the only corner where you can drag, btw.)

@lyse It’s not super comfortable, that’s right.

But these mouse events come with a caveat anyway:

ncurses uses the XM terminfo entry to enable mouse events, but it looks like this entry does not enable motion events for most terminal emulators. Reporting motion events is supported by, say, XTerm, xiate, st, or urxvt, it just isn’t activated by XM. This makes all this dragging stuff useless.

For the moment, I edited the terminfo entry for my terminal to include motion events. That can’t be a proper solution. I’m not sure yet if I’m supposed to send the appropriate sequence manually …

And the terminfo entries for tmux or screen don’t include XM at all. tmux itself supports the mouse, but I’m not sure yet how to make it pass on the events to the programs running inside of it (maybe that’s just not supported).

To make things worse, on the Linux VT (outside of X11 or Wayland), the whole thing works differently: You have to use good old gpm to get mouse events (gpm has been around forever, I already used this on SuSE Linux). ncurses does support this, but this is a build flag and Arch Linux doesn’t set this flag. So, at the moment, I’m running a custom build of ncurses as a quick hack. 😅 And this doesn’t report motion events either! Just clicks. (I don’t know if gpm itself can report motion events, I never used the library directly.)

tl;dr: The whole thing will probably be “keyboard first” and then the mouse stuff is a gimmick on top. As much as I’d like to, this isn’t going to be like TUI applications on DOS. I’ll use “Windows” for popups or a multi-window view (with the “WindowManager” being a tiny little tiling WM).

⤋ Read More
In-reply-to » @lyse Ah, the lower right corner is different on purpose: It’s where you can click and drag to resize the window. https://movq.de/v/cbfc575ca6/vid-1767977198.mp4 Not sure how to make this easier to recognize. 🤔 (It’s the only corner where you can drag, btw.)

@movq Oh, I see. Unfortunately, there seems to be no box drawing character for a corner with a diagonal line. Indeed, this is probably the best you can do.

Is the single character enough to hit it comfortably with the mouse, though? Maybe one additional to the left and above could be something to think about. Not sure. Of course this complicates it a bit more. Personally, I like fullscreen windows, so I’m definitely the wrong guy to judge this or even comment on. :-)

⤋ Read More
In-reply-to » I think my widget toolkit will have an amber theme by default:

@lyse Ah, the lower right corner is different on purpose: It’s where you can click and drag to resize the window. https://movq.de/v/cbfc575ca6/vid-1767977198.mp4 Not sure how to make this easier to recognize. 🤔 (It’s the only corner where you can drag, btw.)

@bender Seriously, if I ever get a CRT monitor again, I want it to be an amber one and then hook it up to some 8086. 😅 Only problem is that this stuff is expensive as hell now …

⤋ Read More

@prologic

Shin'ya M. > grep bridge.twtxt.net /var/log/pleroma.log
14:01:33.937 path=/api/v1/accounts/B26ukWUhEh8kKl0oPw/follow user=shinyoukai [error] Follower/Following counter update for https://bridge.twtxt.net/users/c350a5e5fb9d9457 failed.
14:01:35.541 path=/users/shinyoukai [error] Could not decode user at fetch https://bridge.twtxt.net/keys/bridge, :not_found
14:01:38.286 path=/users/shinyoukai/outbox [error] Could not decode user at fetch https://bridge.twtxt.net/keys/bridge, :not_found

Targeting just Mastodon will get anyone nowhere

⤋ Read More

(#115861340124577669) #MusiQuinta com a pauta “músicas que viraram tatuagens de vocês, mas também valem músicas sobre tatuagem, que vocês planejem fazer tatuagem sobre, que conheçam alguém que tatuou a letra, que acha bonito ou que acha tatuável”:

Marilyn Manson - Tatooed in Reverse

I’m un-stabled, I’m not a show horse
I can’t be bridled, of course
I’m un-scabbed and un-regretted
I got tattooed in reverse
Woah, in reverse

https://marilynmanson.bandcamp.com/track/tattooed-in-reverse

⤋ Read More

implemented curl, grep, jq, head & tail in javascript for my website, zsh now knows the difference between hi;hi and "hi;hi", and a bunch of documentation has been written for all that, too! i do normal people things for fun :3

Image


Image

⤋ Read More
In-reply-to » I think my widget toolkit will have an amber theme by default:

@movq Very nice, it’s coming together!

Just in case you haven’t already noticed it, the right lower corner of the window in front was not updated when it received the focus. 8-) (In tt I also render focused text input fields with a doubly lined border, where unfocused ones have a single one.)

⤋ Read More
In-reply-to » I think my widget toolkit will have an amber theme by default:

(The background and the window shadow are not amber and it wouldn’t have looked like that on a real monitor, unless you cranked up the brightness way too high.)

⤋ Read More

I think my widget toolkit will have an amber theme by default:

https://movq.de/v/22662db9b2/amber.png

My first PC had a monochrome amber screen and I just love looking at this. 😃

(It looks even better with redshift enabled, but I can’t screenshot that.)

Only downside is that there aren’t that many amber shades in the standard 256 color palette. Or well, maybe that’s actually a good thing, as it probably helps to keep the theme more minimal and less cluttered/noisy. 🤔

⤋ Read More

Vacation: Doing crazy things like C on DOS, lots of Rust, bare-metal assembly code, everything is fine.

Back at work: How the fuck do I move an email in this web mail program? Am I stupid? 😮‍💨

⤋ Read More

(#115854671575931196) É verdade, hoje em dia só me ligo ao MOOsaico uma vez por ano,,, no seu aniversário. Hoje é o dia - parabéns #MOOsaico pelos teus 32 aninhos!

Para quem não sabe o que é ou quer espreitar, telnet moosaico.com 7777 ou https://c.moosaico.com/ leva-vos lá. O MOOsaico é a mais antiga comunidade Virtual Multilingue portuguesa em funcionamento (mas não a mais antiga Portuguesa, essa é a Selva Virtual, que não é multilingue e nasceu em 1992).

E é sempre bom ver que neste mundo de serviços que nascem, tornam-se gigantes e depois desaparessem, há serviços que nunca chegam à ribalta mas mantêm as suas comunidades, ano após ano, década após década…

Image

⤋ Read More