Image source: The Half-Life & Portal Encyclopedia
People can't seem to stop talking about AI (artificial intellience). And who am I to not jump on a good bandwagon? In all seriousness, I have been struggling with (1) the reality that much of the AI hype is a speculative financial bubble that will probably not end well and (2) the possibility that there is actual practical value in it that might still be relevant.
AI does indeed have some practical value, but up until this point, I haven't attempted to find that value. As a writer, I certainly don't need AI to write questionably-sourced content for me. I can handle that all on my own. I also don't need an AI art, music or any of the many other attempts to use it to replace human creativity with inferior creations.
No, I wanted something practical. I decided to think about some real problems I have and see if AI could solve them. One such problem is a hardware issue with my variable refresh rate monitor. When VRR (a.k.a. Freesync) is enabled and the monitor goes to sleep, upon waking, any fullscreen programs cause the screen to go black and then slowly alternate back and forth between black and actual content. This mainly affects games and videos, since most other programs don't go completely full screen.
There are a couple of workarounds. One is to completely power off the monitor and turn it back on. Another is to force the "sleep" mode to power off the monitor. It then requries me to physically push the button whenever I want to start working again. A third option is a software solution. In Linux, you can switch VT (virtual terminal) and then switch back, effectively resetting the refresh rate and VRR.
For the last option, I have written a Bash script that does this automatically. The script, however, assumes that the VT on which Wayland is running will always be the same. On my current OS, Bazzite (i.e. Fedora Silverblue for Gaming), however, that has not been the case. I needed to write a script to detect which VT is running Wayland and then do the switch and switch back. That's a little beyond my current expertise, so I could either spend the day learning how to do that or see if ChatGPT could write the Bash script for me.
Here are the results:
I was a bit impressed that it even told me I needed to make the script executable and explained how to run it considering I didn't ask for that information. I don't recommend doing this if you don't at least know enough to read the code and make sure it isn't going to "rm -r -f /" (i.e. erase all your data) or something else destructive. I reviewed it, and while I suspect it could probably be simplified, it seems to accomplish the task.
When I ran it and put it to the test, it did exactly what I wanted. Does that mean I'll start using AI in my daily life? Will it replace my work persona altogether so I can just spend all my time gaming? Probably not. But it is nice to know that a tool such as this has some practical value.
Update: After not being satisfied with the consistency of ChatGPT's script, I ended up doing my own investigation anyway. I found a much cleaner, more reliable workaround using kscreen-doctor. I can use it to change the refresh rate to one setting and then change it back, which resets the display in the same way that changing VT does. It also avoids the need for elevated privileges (root) like chvt requires. For example:
kscreen-doctor output.DP-2.mode.3440x1440@60
kscreen-doctor output.DP-2.mode.3440x1440@100
Update 2: I tried some more coding with ChatGPT just to see if it would get any better. In fact, it actually got worse. It started "hallucinating," as they call it. I prefer to call it making stuff up to make itself look good. It confirms what I've suspected from the beginning: that it's a bit like a kid writing a report and trying to impress the teacher even though the kid didn't actually read the material. They just use a lot of fancy words and try to cover up the fact that they're making it all up.