home tags events about rss login

Things happen.

horia bonked 25 Apr 2025 07:26 -0700
original: tedu@flak.tedunangst.com

windows experience goes to 11

windows experience goes to 11

I haven’t had much use for Windows for a while, but I like to keep abreast of whatever fuckery Redmond has in store for everyone else. I picked up a new laptop with the dreaded Copilot key, and thus had to figure out how to make it useful. And along the way, found a bunch of other settings to adjust. The plan is that I won’t need any of this knowledge until it becomes obsolete, but the only way to ensure that outcome is to write it all down; thus by being available it will never be necessary.

copilot key

First up we have the Copilot key which has eaten the right control key. Turns out I use the right control key a lot. Actually, having the key taken away led me to observe my typing habits more closely. I use opposite side shift keys (left shift and L, right shift and A) but same side control (left control A and right control L). Thank you keyboard for affording me this opportunity for self reflection, but now I’d like control back.

The obvious thing to do is to search the internet. Unfortunately, we’re in a war against Big Basilisk and conscientious objectors have flooded the forums with resistance. (I’m trying to put a positive spin on things.) Do not believe the lies about using PowerToys to remap the key. It doesn’t work. Also, the next version of Windows will not include a setting to change it either, at least not to anything useful.

What does work is installing PowerToys and creating a new keyboard shortcut. This is actually pretty straightforward once you know the possibilty exists and to not waste time on a keymap. It comes with some caveats, though.

Sometimes PowerToys crashes and then the shortcut disappears. Quality. In more than twenty years of using xmodmap to map the windows key to something useful, it has not once ever forgotten its mapping.

Apparently because the Copilot key is some weird ctrl shift F23 hybrid, the shortcut doesn’t always play nice if you also press shift. This primarily seems to affect WSL. Pressing copilot tab would advance tabs in my terminal. Pressing shift copilot tab to move back would return to the previous tab, but also leave the shift key stuck down, CAPSLOCK style. It was weeks of frustration until I figured out it depends on the precise order I chord the keys. If I lift copilot first, then lifting shift generates the proper event. If I lift shift first, somehow the key up event gets lost.

wsl

To make the system a little more useful, I installed WSL. Find a buntu in the store, click install, click run. This creates a little terminal window that says it needs to install WSL. Okay, let that go. But the ubuntu window still says it can’t run. Whatever the WSL installer does, it doesn’t actually install the WSL Windows feature. You still have to go into control panel to add Windows features, and check WSL. It’s literally one line of powershell, but the installer can’t run it.

At some point since I last used WSL, I believe they changed the virtual framebuffer size. It’s only half the resolution of my screen, and scaled up with blocky pixel doubling. Apparently, somebody ran their linux app and it was too tiny, so instead of telling them to fix their config, the WSL team just force scaled the framebuffer. So now I, who know how to set an appropriate scale for applications, am forced to look at grotesque aliasing until I get frustrated enough to find the secret WSL settings.

[system-distro-env]
WESTON_RDP_HI_DPI_SCALING=false
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=false
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100

That goes into a %HOME%/.wslgconfig. Note that the filename has an extra G; it is not the .wslconfig file that already exists. (Also make sure you don’t accidentally create a .wslgconfig.txt file.)

Drawing to the front buffer in an OpenGL program doesn’t work. To avoid unnecessary buffer swapping, I will draw to just the front buffer. The WSL virtgl or whatever doesn’t appear to notice this and fails to update the display. Have to use full double buffering for everything.

I think vsync is broken. If you want a serene frame rate, you have to insert your own pauses.

I could not figure out how to set the keyboard repeat rate. Nothing I changed would slow it down. I like to set it just right for me to hold j and scroll through a file while reading. Fortunately, I own the terminal and was able to insert my own key repeat rate limiter.

edge

Figured I should use edge and bing while we’re here to see what’s what.

Go to Settings > System > Show tabs from apps if you want alt tab to be useful.

The setting to disable saving passwords is buried in the wallet settings.

Need to disable elastic overscroll in edge flags or pages bounce around wildly. I’m fortunate to have fairly good fine motor control, but I still can’t execute a two finger vertical scroll with zero horizontal movement. Somebody on the edge team decided to interpret this to mean I want the content to vibrate back and forth as well. No thanks. There are remnants of forum posts talking about scrolling personality, but that option has been removed.

Edge has a feature called efficiency mode. The help says the settings are balanced or maximum, but the status indicators says it’s currently moderate.

misc

Pleased to report sticky keys appears off by default, and I’m no longer hounded by beeps after tapping the shift key a few times.

Pleased to report there is finally a setting to reverse mouse wheel scroll direction without installing a vendor app per mouse.

Failed search: how to disable wifi when sleeping. Microsoft may have figured out how to do low power always connected not really sleeping mode without draining the laptop battery, but it’s murder on my phone battery. They’ve finally invented an iPhone killer that works. The only way to get it to disconnect is to disable tethering on the phone.

Touchpad settings: Three finger gesture: tap -> middle click. Four fingers -> nothing or it opens notifications. Took me a week of the notifications panel popping open randomly before I was able to figure this out.

If the weather app is wide enough to display three panels, it shows a bunch of ads, but they are hidden if it’s only two panels wide.

Turn off all audio enhancements in system > sound > speakers. Sounds like constant crackling static. This only affects some programs, so I’m speculating it has something to do with buffer sizes and consuming data faster than the program expects. No idea really.

Now that we’ve installed PowerToys, turn off the mouse finder or it will draw weird circles when you press control.

Stopping OneDrive backup ate my endless legend saves. Dozens of hours of progress lost, like tears in the rain. I read the prompt pretty carefully, and I was fairly sure that I was only turning off backups, but apparently doing so causes the system to delete everything in the documents folder. So make sure you get to that early, before you have anything to lose.

Find Windows compatibility telemetry in task manager. Kill it before it kills your CPU.

Renaming something pinned in the start menu is not at all obvious. The right click open file location takes you to the folder in the start menu hierarchy, where you can rename the shortcut. I didn’t click it at first because I thought it would open the application folder.

Window now has an attention feature, where it’s always watching and will lock the screen if you walk away. I guess this could be useful if you struggle to press win L. The implementation isn’t great. In particular, the option to dim the screen when you look away doesn’t restore the screen when you look back. I’m always looking around, so this was pretty annoying.

Unboxing a new computer still requires hours of updates and reboots. And this is after the hour long first time setup. The initial setup took forever because whatever it was downloading stalled many times. I can see on my router that no packets were flowing, then it would download a little more, then stall, then trickle in some more.

The worst part is I turn on performance mode so that the never ending updates will finish before I turn into a pumpkin, and then Windows hounds me with popups about wasting electricity. The cherry on top is the little notice that Windows Update is dedicated to reducing carbon footprint by using green power. Maybe we could try just using less power? I’m pretty sure half the power consumption of this system has come from installing updates.

I was typing up the first draft of these notes in OneNote. At some point I installed Visual Studio and the color scheme in OneNote changed. Great.

Copilot itself

Figured since they’ve gone to all the trouble to take over my keyboard, I should at least try out this miracle software. I gave it a very serious business task of helping me OCR a sign I saw at a business. This is real work, right?

Without prompting, it offers up its own commentary on the sign. Then when I ask what the sign says, copilot has forgotten how to read. How can something this dumb help you with your job? What is your job?

Can’t wait until I get the Recall update.

(#software #windows)

horia bonked 25 Apr 2025 07:20 -0700
original: tedu@flak.tedunangst.com

trying out avif transcoding

trying out avif transcoding

In honor of YUV420 day, I thought it would be fun to transcode JPEG images to AVIF in honk, or anywhere. I got lost in the weeds a few times along the way, but eventually found all the eggs.

honk predates widespread AVIF support by a year or two, but after a look at browser support, I think it’s now worth evaluating the potential benefit and required effort.

convert

Started by running a quick test with convert. Without any options, it converted my 500k sample.jpg to a 200k sample.avif. It didn’t look noticeably different, but that’s a pretty healthy size savings. (Without much tuning of JPEG quality parameters.)

libavif

There’s sample code for an encoder included in libavif that does just what we need. It’s also easy to access via cgo. Hook it in, and... wait.

Unfortunately, this was taking about six seconds to transcode an image. Saving some bytes won’t be worth it if it takes longer to get them. Need to figure out what convert is doing.

I wasn’t sure what encoder convert was using, but took a guess it was rav1e. Converted my code to using rav1e, which wasn’t hard, but then I discovered that it only outputs the bitstream. Not the needed file header, so the image wasn’t recognized. Misunderstanding on my part of how the pieces fit together.

Went back to libavif for a look at what the header writing code did, and noticed that it can use rav1e itself, but the important discovery was the speed option to the encoder. Turn this up to 10. The output is a little larger, but now it’s fast enough. I think we’re good.

prod

Checked in some code and pushed it to my testing server, liveprod. Was about to brag to the world, hey, check out this 500k image that’s now only 200k, but when I looked again, the avif version was 2000k. Hyperinflation! A little more back and forth with some debug code, and the difference is the result of using a much older libavif. Well, okay, this is a me problem, and it’ll get fixed in due time. Different quantifier presets or defaults or whatever, not really worth investigating further. We’re still good, or will be.

integration

I don’t want the complications of linking with libavif (and its transitive dependencies) all the time, but that’s what dlopen is for. I wrapped this up in something called lazif, the lazy AVIF encoder. If libavif is available, we can use it, but if it’s not, no worries.

I don’t like web servers that change image formats based on the Accept header. I right click to save an image expecting one format, and then a different format lands, and now I can’t open this stupid webp. And it would require me to configure the Vary header correctly, which sounds like work. So we’re definitely not doing that.

I found the <picture> tag much nicer to work with. The <img> tag is still the original JPEG, but now there’s a <source> for the AVIF version. I named it filename.jpg.avif which is probably slightly triggering, but it makes it easy to find the original input, and it’s maybe a tiny bit informative that this is the second compression.

(#project #web)

horia bonked 25 Apr 2025 07:16 -0700
original: tedu@flak.tedunangst.com

anticrawl

anticrawl

It’s the internet, so there’s crawlers, and it’s the future, so they’re mindless wannabe chatbot scrapers, and it’s the cyberpunk world we always dreamed of, so the cool thing to do is to write your own force field to keep the bots out. Which I did.

For background, I have not actually noticed any load from bot scrapers (other than the google go cache, different story), but found them a different way. There’s a bug in humungus which I’m too lazy to fix that causes it to 500 error whenever a file revision that doesn’t exist is requested. There’s a second bug I’m too lazy to even look for that generates these links for the bots to find. But the punchline is I have a bunch of 500 errors in my log file. The robots file excludes these URLs because I know they’re useless for a crawler. I’m trying to help you, stupid bot, but some bots are beyond help, so we need a bigger hammer. Initially, I banned netblocks in pf, and after eliminating all of BabaWei’s IP blocks, we’re down to Brazilian ISPs, which I don’t want block at the network level.

anticrawl is a simple go http handler. Stick it in the affected service. Then configure a regex because I like problems. I don’t care if you scrape my README 700 times, that’s what it’s for, but leave the other junk alone. Also, I’d rather not bother humans, even a little bit, until they start clicking around deeper.

The challenge is super easy. If you have javascript, you have to find some 42s. (Why is it always zeroes we’re forced to search for?) If you don’t, you have to solve the riddle of the llama. Either way, it’s super trivial because the adversary isn’t exactly basilisk class AI. I was told cookies are evil, so the state is just stored server side. I’m thinking I might change the design so it’s even easier to bypass by starting at a normal entry point. So far, it appears very effective.

There’s also a standalone proxy server for people who can never run enough servers.

(#project)