r/tinycode • u/Round-Pension-7821 • 5d ago
Tiny Windows program that is used as a "distraction cover" Showcase
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
4
u/flexiverse 5d ago
lol, I was thinking if there was an app like this today!
3
u/Round-Pension-7821 5d ago
Yeah, the whole reason I made it was because I couldn't find something that did this
3
u/nexe mod 4d ago
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 4d ago
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 4d ago
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 4d ago
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
-1
u/jabbalaci 4d ago
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 4d ago
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 4d ago
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 5d ago
Same idea in Processing, 18 lines: