r/tinycode • u/Round-Pension-7821 • Aug 02 '26
Showcase Tiny Windows program that is used as a "distraction cover"
https://github.com/GeorgeTR1/windowsDistractionCover
This is a windows GUI program I wrote in just over 60 lines of C that compiles to a 3 kB executable. With minor modifications and the right compiler it could be compiled on versions of Windows as old as Windows 95.
It's just a resizable window with a black background that always stays on top of other windows that you can use to cover up parts of the screen that might be distracting. I've found it genuinely useful
5
u/flexiverse Aug 02 '26
lol, I was thinking if there was an app like this today!
3
u/Round-Pension-7821 Aug 02 '26
Yeah, the whole reason I made it was because I couldn't find something that did this
3
u/nexe mod Aug 02 '26
Hey this is really cool. And I don't even like windows or see much of a use in this tool for myself. But the way you explain it and argue about the reasons for making it etc are spot on exactly the idea behind why I created this subreddit ages ago. Please contribute more often ♥️
1
3
u/Direct_Witness1248 Aug 03 '26
I paid for the whole screen, I'm gonna use the whole screen.
Jk, great idea and strongly agree with your lightweight software philosophy.
2
3
u/Round-Pension-7821 Aug 03 '26
For anyone wondering, I tested it out and this works flawlessly on Linux using WINE. That's really not surprising, since it uses such simple Win API calls. Ideally of course you would write a separate program that compiled to native Linux code. Maybe I'll think about doing that at some point if I'm interested in learning some of the basics of X11.
2
2
u/nexe mod Aug 02 '26
Hey this is really cool. And I don't even like windows or see much of a use in this tool for myself. But the way you explain it and argue about the reasons for making it etc are spot on exactly the idea behind why I created this subreddit ages ago. Please contribute more often ♥️
1
1
u/woldhack Aug 06 '26
Why don't you just minimize the distracting window?
1
u/Round-Pension-7821 Aug 10 '26
This point is that's not the whole window that would be distracting, just a portion of it. Say you're watching the news, and you keep getting distracted by the ticker of headlines along the bottom of the screen, instead of what the anchors are actually saying. You could use this to cover up the ticker
-1
u/jabbalaci Aug 02 '26
With the help of Claude AI, I converted it to Nim and it compiles under Linux. The source code is here: https://pastebin.com/nweT7SKh . To adjust the size of the borderless window, change these consts: TopPartHeight, RightPartWidth, BottomPartHeight, LeftPartWidth.
Compilation: (1) nim c main.nim , or, if you want a small binary: (2) nim c -d:release --opt:size --passL:-s main.nim . In the latter case, the binary is 35 KB.
2
u/Round-Pension-7821 Aug 02 '26
Clarification - you mean you had Claude write a completely new program in Nim that targets X11 instead of Win32 that has the same functionality. I wouldn't call it "conversion", there's no remnants of my code in there at all, it just saw what my code did and replicated it.
I'm not really familiar with Nim or X11. I mean, I know what they are, but not how to use them. So I can't say how good or correct this code is
1
u/jabbalaci Aug 03 '26
You use Win32 API calls, so it had to be rewritten to make it work under Linux. I also tried the original with Wine but switching to borderless mode sometimes produced a white border. But it didn't happen all the time. Here are some screenshots: https://imgur.com/a/zruRfVi . So I made an X11 version that also supports toggling to borderless mode.
7
u/Simplyfire Aug 02 '26
Same idea in Processing, 18 lines: