Searching We Love Privacy Club

Twts matching #sleep
Sort by: Newest, Oldest, Most Relevant

Hurray, I can now press gg instead of g to go to the top in tt. Much better! :-) Other multi-key combinations are also easily possible now.

I should probably write a real article about this at some point, but here we go. The only downside with my new key binding system is that it breaks tview’s established pattern. You’ve got an InputHandler(), that is implemented using WrapInputHandler(…). It typically then directly implements the switching logic depending on the key press. Something like this:

func (w *Widget) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
    // WrapInputHandler allows for intercepting key events with SetInputCapture(…)
    // from the outside for customization. This handles the default key bindings.
    return t.WrapInputHandler(func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
        switch event.Key() {
        case tcell.KeyRune:
            if event.Modifiers() == tcell.ModNone {
                switch event.Rune() {
                case 'k':
                    w.scrollUp()
                    return // we already handled the event, stop processing

                case 'j':
                    w.scrollDown()
                    return
                }
            }
        }

        // We didn't handle the key event. Maybe the parent
        // widget knows what to do with it.
        if handler := w.parent.InputHandler(); handler != nil {
            handler(event, setFocus)
        }
    })
}

From the outside, you can intercept and either stop or continue the widget’s original key handling with a potentially rewritten key event using SetInputCapture(…):

w := NewWidget()
// customized or additional key bindings
w.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
    switch event.Key() {
    case tcell.KeyUp:
        // Rewrite the event, so the "cursor up" key is an alias
        // for the vim key binding "k", that is handled by the
        // wrapped input handler above. (I know, I know, this is a
        // completely unrealistic example, why would anyone use
        // cursor keys when there are vim key bindings available?!)
        return tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone)

    case tcell.KeyRune:
        if event.Modifiers() == tcell.ModNone {
            switch event.Rune() {
                case 'q':
                    app.Stop()
                    // we already handled the event, do not pass it
                    // to the wrapped input handler above
                    return nil

                case 'r':
                    toggleMessageReadStatus()
                    return nil
            }
        }
    }

    // we didn't handle the event, pass it to the wrapped
    // input handler above
    return event
}

Since they all expect a single key, I’ve noticed that using multiple dedicated KeyBindings of mine on these different levels kinda breaks multi-key handling with common prefixes. The outer-most KeyBinding captures the prefix, but it can’t transfer it to the inner one if not handled by the outer one. At least not without some more (potentially ugly) changes. So, I now have to work with just a single KeyBindings object for the entire widget chain (if it consists of multiple other widgets or the regular input handler and input capture are in the game). The outside needs to register all its key bind customizations or extensions at the same level that the original widget handles its default ones. Doable by exposing the widget’s KeyBindings instance, but not pretty. You always have to keep this in mind.

With the KeyBindings, it will look like that:

type Widget struct {
    parent tview.Primitive

    // make it available to children or the outside either by
    // direct field access or by providing a getter method
    KeyBindings *bind.KeyBindings
}

func NewWidget() *Widget {
    w := &Widget{KeyBindings: &bind.KeyBindings{}}
    w.KeyBindings. // default key bindings
        Bind0(bind.KeySequence('k', w.scrollUp).
        Bind0(bind.KeySequence('j', w.scrollDown)
    return w
}

func (w *Widget) InputHandler() InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
    return t.WrapInputHandler(func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
        // also note the missing support for focus transfer at the moment
        event = w.KeyBindings.Capture(event)
        if event == nil {
            return
        }

        if handler := w.parent.InputHandler(); handler != nil {
            handler(event, setFocus)
        }
    }
}

And then from the outside, or in a child widget:

w := NewWidget()
w.KeyBindings. // additional or customized key bindings
    Bind1(bind.KeySequence(tcell.KeyUp), func(*tcell.EventKey) *tcell.EventKey {
        return tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone)
    }).
    Bind0(bind.KeySequence('q'), app.Stop).
    Bind0(bind.KeySequence('r'), toggleMessageReadStatus)

When directly working with tview primitives that are not part of custom widget implementations, the following works well so far:

textView := tview.NewTextView().
    SetWordWrap(true).
    SetText("…")
    SetScrollable(true)
textView.SetInputCapture((&bind.KeyBindings{}).
    Bind0(bind.KeySequence('q'), app.Stop).
    Bind1(bind.KeySequence('g', 'g'), func(*tcell.EventKey) *tcell.EventKey {
        return tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone)
    }).
    Capture)

I need to sleep on this some more.

Also, writing very long messages like this one is really not all that fun in tt’s editor. I should absolutely provide a way to shell out to vim.

(Took me about one and a half hours to compose, holy crap. But not only because of not using vim. Although, that might have saved me a quarter hour or so for sure. Proof-reading this message also uncovered quite a few bugs in my real documentation. So, that’s a big win!) Good night!

⤋ Read More
In-reply-to » We slept in the forest. It was really great except of my mate's fucking terror dog who was barking and snarling the entire night to each and every sound. I had maybe half an hour of sleep in total. Despite that, it was pleasantly warm. Well, the night, that is. The heat was brutal during the days. Literally streams of sweat were running down on us on the way there in the evening and back in the morning.

@prologic@twtxt.net Well, 15 shows the site. On the left, I had a roll mat on a tarp. I borrowed some “NVA tarps” from the scouts for this trip. The scouts got them from the National People’s Army, the German Democratic Republic’s armed forces after Germany was reunited. They’re 1.75m x 1.75m in size and weigh 1.3kg, quite heavy, but super awesome. One tarp on the bottom, another one to cover up the clothes, shoes and sleeping bag in order to protect against the thaw. Finally, a mosquito net over all that, hung from a rope between two trees.

My mate just used a hammock with a mozzie net on the right hand side. The third tarp served as the luxurious bedside carpet. :-)

We sat on my second tarp to chill and enjoy the sunset and surroundings. It was nice to notice birds etc. die down. It took a really long time for the last light to fade away. Since we have a very high risk of forest fires, we of course couldn’t have a camp fire. But after all the exhaustion, I didn’t even miss it for one second.

Since we had dinner at home before leaving, all we brought were two lye rolls, two grain rolls, two brezels, some sausage and chocolate biscuits for breakfast. From the 2.5l of water, I ended up using 2l. It’s always good to have a little extra, despite the unnecessary weight. We had brekkie a few kilometers further on a bench in the shade. The first bench was already in direct sun.

Our camp site was maybe 30m to the side and a few meters down of a summit path hidden behind some trees and bushes. We were quite lucky, the other side of the hill got quite a bit of a breeze at night. We could hear the leaved treetops making much more noise behind us.

@movq@www.uninformativ.de Yes, these kind of dogs should really be strictly forbidden!

It’s not illegal if you own the forest or ask the owner. :-)

@david@daiwei.me Yeah, no clue. But my mate said the dog is disqualified from such adventures in the future. :-)

The temps were supposed to hit 14°C just before sunrise. Since we didn’t bring a thermometer, I can’t tell for sure. I was rather hot in my sleeping bag, so I had to pull out my arms every now and then. My mate’s sleeping bag was a little lighter and, unfortunately, the zipper jammed up. Since it didn’t close all the way, it felt quite a bit cold I was told in the morning. When we got up at 6ish (we said, we don’t care about time at all), it was probably already 16°C if not more. I brought a jumper, but a t-shirt was already nice enough to wear. The jumper just served as my pillow. The mercury raised by the minute then.

Yeah, I circled the spot with a biro to keep an eye on it. Until now, there’s absolutely nothing to see. Looks like I got lucky.

⤋ Read More

We slept in the forest. It was really great except of my mate’s fucking terror dog who was barking and snarling the entire night to each and every sound. I had maybe half an hour of sleep in total. Despite that, it was pleasantly warm. Well, the night, that is. The heat was brutal during the days. Literally streams of sweat were running down on us on the way there in the evening and back in the morning.

Surprisingly, there weren’t any mozzies around at night, I would have lost all safe bets. On the way there, my mate convinced me to take a shortcut through the taller and taller growing grass. It’s been some time that somebody traveled on this track, so we had to search around a bit for the overgrown path where we could cross the mostly dried up creek. In the beginning I said that this will be a bad idea. Lo and behold, I discovered a tick on my inner upper leg the next morning. Luckily, I got it out with my tick hook on the first attempt.

https://lyse.isobeef.org/walduebernachtung-2026-07-09-10/

⤋ Read More
In-reply-to » We’re at 39.5 °C now. Are we going to hit 40? https://movq.de/v/43544d5385/2026-06-27--14-12.webp

@movq@www.uninformativ.de Oh my! :-O We reached 38°C. It’s now down one degree.

I just got up from my two, three hours siesta. And I tell you, that was bloody amazing. Layed in bed in undies, no blanket, just some power metal in my headphones and I was sleeping like a baby. Normally, I NEED a blanket, no matter what. But this summer, it’s already the second time that I actually manage to drop off without one.

⤋ Read More

Just finished watching They Live (1988) again, one of my favorite movies, and one that has (sadly) remained relevant for nearly 40 years (some might even argue it’s more relevant today than ever).

Obey. Consume. No independent thought. Honor apathy. Do not question authority.

They live, we sleep.

⤋ Read More

Rachel Judge: When sleeping on the job is not enough to justify dismissal
With the Fifa World Cup kicking off today, some fans will have a busy viewing schedule to fit in around working hours. With a few early morning starts, staying awake for the rest of the day may become tricky. Where does that leave you if you fall asleep on the job? Recent case law shows that justifying dismissal in this situation is harder than you may think.

A Sydney security gu … ⌘ Read more

⤋ Read More

As I said, I’m on vacation, and for about a week now, I did basically nothing but sleep. Day or night.

I can’t tell if this actually is a vacation or just therapy for burnout. 🤔

⤋ Read More

Donald Trump’s NBA Finals ‘Nap’ Sparks Jimmy Kimmel’s Hysterical Reaction
Jimmy Kimmel, a vocal critic of Donald Trump, reacted to footage that appeared to show the President dozing off while attending the NBA Finals, where the New York Knicks faced the San Antonio Spurs. Trump’s appearance at the game had already generated discussion online due to heightened security measures. However, Kimmel focused primarily on the […]

The post [Donald Trump’s NBA Finals ‘Nap … ⌘ Read more

⤋ Read More

The CCTV images that helped sink a Sydney hostel’s rooftop visions
Residents of two high-end Sydney apartment blocks say they have spent years pleading for a decent night’s sleep. Now they’ve clocked up a significant victory. ⌘ Read more

⤋ Read More
In-reply-to » Just a couple of shots from our trip to Bald Rock—finally got reception so I can share them!

@prologic@twtxt.net Awwwwwwww! I love these stripes, very cool!

Oh, I bet these inclines are no joke. I also know one about 200 meters long terribly steep dirt path up a hill around here. Climbing that is super exhausting. I just looked it up on a map. And it’s just ~17° or ~30% incline. Okay, that’s absolutely nothing compared to your adventure. :-D

But you got your exercises for the day then. Which will make for an even greater sleep tonight. ;-)

⤋ Read More

2nd Van trip coming up this weekend, taking Friday off work. Gonna sleep in the Van tonight and see if I can fiddle with the town water supply (basically our outside tap near the Van haha 😆) and see if I can have a shower in the Van, brush my teeth and go to bed 🛌 – Basically I just want to figure out the rest of the plumbing 🪠

⤋ Read More
In-reply-to » Hello twtxt! I still exist. I have a baby now and put some pictures at https://photos.falsifian.org/ . Album HTML loosely inspried by @lyse

@falsifian@www.falsifian.org Congrats, mate, no sleep at night anymore! ;-D That’s a cool age measuring blanket. Haven’t seen something like that before.

Btw. the index.html includes an out of place </ul>. And I just wanna let you know that the full-size photos don’t load for me over here across the pond. They always run into a timeout after a few slooow percent. But no worries. :-)

⤋ Read More

What a beautiful, beautiful 0°C Sunday arvo and evening! The weather forecast delayed the snow by the minute. An hour or so after it finally started very, very lightly, I headed off for the woods to check out the lake again. Unfortunately, with the fresh snow layer, the crazy wild surface texture of the ice sheet wasn’t visible anymore. But it brought some other nice views and photo opportunities.

I initially thought that I just go for a quick turn. However, with the snowfall a wee bit increasing I was hooked and kept going. Visibility was poor, but the snow blankets just looked too stunning. The road surfaces were quite slippery, so I often just walked alongside the pathways. On downhill slopes I had some good fun sliding down the road on my feet. With varying success. Luckily, I managed not to fall.

On the summit of the mountain the twigs had those absolutely magnificently looking windblown crystal coverings. Awwwwwww! They never get old. It was already getting dark, so the camera was tired and wanted to sleep. The snow program then made use of the flash and I’m quite pleased with how these shots turned out.

Two deer crossed the road in front of me and ran into the woods, that was sight for sore eyes. Although I felt bad that they had to flee from me in this white terrain. By the time I got home, the snow had accumulated around eight centimeters in height, even in town down in the valley. Walking on this fresh snow is just amazing. And I love the sound it makes. Today, the snow consistency must have been just right, because the crushing sound was really loud.

I cannot recall that I had frozen hair and beard before, but today, there was a thick ice buildup. In case I had, it was definitely never this much. Felt really cool.

Enough of this preliminary skirmishing, there ya go: https://lyse.isobeef.org/waldspaziergang-2026-01-25/

⤋ Read More

Poor Sleep Quality Accelerates Brain Aging
A large-scale study tracking more than 27,500 middle-aged and elderly people over roughly nine years has found that poor sleep quality is associated with accelerated brain aging, and chronic inflammation appears to be one of the key mechanisms driving this effect.

Researchers at Sweden’s Karolinska Institute assessed participants’ sleep across five dimensions – chronotype, duration, i … ⌘ Read more

⤋ Read More

How worried should you be about spending too much time on your phone?
Screen time has been linked to all sorts of problems, from depression and obesity to poor sleep. But how worried should you really be? Jacob Aron sifts through the evidence ⌘ Read more

⤋ Read More

Zig Quits GitHub, Says Microsoft’s AI Obsession Has Ruined the Service
The Zig Software Foundation has quit GitHub after years of unresolved GitHub Actions bugs – including a “safe_sleep” script that could spin forever and cripple CI runners. Zig leadership puts the blame on Microsoft’s growing AI-first priorities and declining engineering quality. Other open-source developers are voicing similar frustrations. … ⌘ Read more

⤋ Read More

Smartphones At Age 12 Linked To Worse Health
A new study from the University of Pennsylvania finds that preteens who own smartphones by age 12 have significantly higher odds of depression, obesity, and poor sleep compared to their peers. Axios reports: Kids who owned a smartphone at age 12 were found to have about 31% higher odds of depression, 40% higher odds of obesity and 62% higher odds of insufficient sleep than their peers … ⌘ Read more

⤋ Read More