autumn's pagea digital garden2022-12-31T03:21:49Zhttps://autumns.pageautumnUsing caps lock as compose key on Hyprland2023-01-01T03:38:30Zhttps://autumns.page/posts/2022/12/hyprland-compose/literally why was it this hard<p>I've recently switched to the window manager <a href="https://hyprland.org/">Hyprland</a>, and I'm
absolutely loving it so far! I still need to give it a couple finishing
touches, but here's my light mode theme so far:</p>
<p><picture> <source type="image/png" srcset="https://autumns.page/assets/images/40737d62-1600.png 1600w, https://autumns.page/assets/images/40737d62-1600.png 1600w" sizes="90vw" /> <img class="" loading="lazy" src="https://autumns.page/assets/images/40737d62-1600.png" width="1600" height="900" alt="Desktop screenshot using the Hyprland window manager" title="Desktop screenshot using the Hyprland window manager" /></picture></p>
<p>I kept running into a problem getting my caps lock to work as a
<a href="https://en.wikipedia.org/wiki/Compose_key">compose key</a>, though. I use the compose key a lot for inputting
IPA symbols and stuff, so this was pretty annoying, coming from X, where I
used to just use xmodmap to set the key to do what I wanted, and all the online
resources pointed me to things like <code>setxkbmap</code> and stuff, which should have
worked, but all it did was make it work as both caps lock and compose, which
obviously made it hard to input things.</p>
<p>Turns out all I had to do was put this in my <code>.config/hypr/hyprland.conf</code>:</p>
<pre><code>input {
# ...
kb_options = compose:caps
# ...
}
</code></pre>
<p>et voila, I can use caps lock as my compose key. This took embarrassingly long
to figure out, so I'm putting it on my blog in hopes that the next person
searching for this will be able to find this page and get it fixed right away
instead of having to mess around with installing waybind or kbct or whatever
in a desperate attempt to get it to work like I did.</p>
<p>Sorry for the lack of actual posts, I couldn't honestly care less about keeping
an active blog. <a href="https://hanas.app/">Hanas</a> work is going good though!</p>
<p>Also the date on this post is straight up wrong but I don't care to fix it.
Too bad!</p>
The Importance of `import`s2021-09-09T02:43:30Zhttps://autumns.page/posts/2021/09/imports/... or, include considered harmful<p>I do a lot of web development. Out of all my projects that I care about,
basically all of them are on the web or in Javascript in some fashion. I wish
this wasn't really the case - mostly because low-level seems cool! - but I have
some points of friction with low-level languages that I wish I could easily solve.</p>
<p>I only really got around to trying out low-level through finding <a href="https://serenityos.org/">SerenityOS</a>,
a very cool project. However, C++ (or C, honestly) is most definitely not the
best language for readability or understanding: let's try to dive into the code
and try to figure out how Serenity works, for funsies! Firstly, we can clone
and build. On my T440p, this takes about half an hour or so from source. This,
to my knowledge, is largely building the toolchain itself, not the actual OS.</p>
<p>Not a huge problem, and this is probably not entirely solvable by a language, at
least not yet - compiling C and C++ is a popular problem, and lots of labor
and capital are being poured into the problem, so beating them in compilation
speed is a non-starter. This isn't really what I want to get at, but I've just
spent about a paragraph complaining about it, so it's got to be an issue I care
about.</p>
<p>Next, we run into the issue of C/C++ itself - header files. In Javascript, there
are a few standards for importing code - my personal favorite is ESM, which looks
like this:</p>
<pre class="language-js"><code class="language-js"><span class="token comment">// in bar.js</span><br /><span class="token keyword">export</span> <span class="token keyword">const</span> <span class="token function-variable function">foo</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">s</span><span class="token punctuation">)</span> <span class="token operator">=></span> s <span class="token operator">+</span> <span class="token number">5</span><br /><br /><span class="token comment">// in baz.js</span><br /><span class="token keyword">import</span> <span class="token punctuation">{</span> foo <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'./bar.js'</span><br /><span class="token keyword">const</span> <span class="token function-variable function">main</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span><br /> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">foo</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">)</span><br /><span class="token punctuation">}</span></code></pre>
<p>Which is very understandable, to my brain! If I want to learn about what <code>foo</code> is,
I can go dive into <code>bar.js</code> and quickly figure out where each symbol comes from.</p>
<p>Compare this to C or C++, which use a bodged system that boils down to "include
that file in this file and call it a day"<sup class="footnote-ref"><a href="https://autumns.page/posts/2021/09/imports/#fn1" id="fnref1">[1]</a></sup>:</p>
<pre class="language-c"><code class="language-c"><span class="token comment">// in bar.c</span><br /><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">"bar.h"</span></span><br /><br /><span class="token keyword">int</span> <span class="token function">foo</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token punctuation">)</span> <span class="token punctuation">{</span><br /> <span class="token keyword">return</span> x <span class="token operator">+</span> <span class="token number">5</span><span class="token punctuation">;</span><br /><span class="token punctuation">}</span><br /><br /><span class="token comment">// in bar.h</span><br /><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">ifndef</span> <span class="token expression">BAR_H_</span></span><br /><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token macro-name">BAR_H_</span></span><br /><br /><span class="token keyword">int</span> <span class="token function">foo</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token punctuation">)</span><span class="token punctuation">;</span><br /><br /><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">endif</span></span><br /><br /><span class="token comment">// in baz.c</span><br /><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">"bar.h"</span></span><br /><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string"><stdio.h></span></span><br /><br /><span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token keyword">int</span> argc<span class="token punctuation">,</span> <span class="token keyword">char</span> <span class="token operator">*</span>argv<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><br /> <span class="token keyword">int</span> baz <span class="token operator">=</span> <span class="token function">foo</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br /> <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"%d\n"</span><span class="token punctuation">,</span> baz<span class="token punctuation">)</span><span class="token punctuation">;</span><br /><span class="token punctuation">}</span></code></pre>
<p>(I haven't actually tried to compile this. Don't yell at me if I've gotten
something subtly wrong - actually, yell at C, since this should not
be something to easily get subtly wrong.)</p>
<p>There are at least 3 levels of kludginess here:</p>
<ol>
<li>I have to use "define guards". This should not be a thing. In what scenario
would I want this to be the more marked option?</li>
<li>I have to retype type definitions for all the functions/values I export
in the header files. I can sorta see reasons for this, but none of them are good.</li>
<li><strong>I have no clue what is being imported into scope when I include a header.</strong></li>
</ol>
<p>The last point is the one that makes it the hardest to understand things.
Yes, if I use a good IDE,<sup class="footnote-ref"><a href="https://autumns.page/posts/2021/09/imports/#fn2" id="fnref2">[2]</a></sup> I can hover over the symbol or something and
jump to definition. But I shouldn't have to! If I open a big C project in nano,
I have to search around externally, grepping for symbols and such to figure out
where things come from or how the program flows. If I open a big Javascript or
Typescript project in nano, I can get a much clearer picture of program flow
and where functions are declared.</p>
<p>One good piece of news in this space is that C++20 is introducing modules, which
looks <strong>really</strong> similar to Typescript:</p>
<pre class="language-cpp"><code class="language-cpp"><span class="token comment">// in foo.cc</span><br /><span class="token keyword">export</span> <span class="token keyword">module</span> <span class="token module">Foo</span><span class="token punctuation">;</span><br /><span class="token keyword">namespace</span> Bar <span class="token punctuation">{</span><br /> <span class="token keyword">export</span> <span class="token keyword">int</span> <span class="token function">f</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><br /> <span class="token keyword">return</span> <span class="token number">42</span><span class="token punctuation">;</span><br /> <span class="token punctuation">}</span><br /><span class="token punctuation">}</span><br /><br /><span class="token comment">// in main.cc</span><br /><span class="token keyword">import</span> <span class="token module">Foo</span><span class="token punctuation">;</span><br /><span class="token keyword">import</span> <span class="token module">std<span class="token punctuation">.</span>core</span><span class="token punctuation">;</span><br /><br /><span class="token keyword">using</span> <span class="token keyword">namespace</span> std<span class="token punctuation">;</span><br /><br /><span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><br /> cout <span class="token operator"><<</span> <span class="token class-name">Bar</span><span class="token double-colon punctuation">::</span><span class="token function">f</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator"><<</span> endl<span class="token punctuation">;</span><br /><span class="token punctuation">}</span></code></pre>
<p>This still suffers from the issue of "I have no clue what's now in scope", but
it gets rid of header files, which are the much worse part of the problem.
Additionally, modules seem... very unsupported. I looked at <a href="https://gcc.gnu.org/wiki/cxx-modules">GCC's page on the topic</a>,
and the state looks very unfinished so far.</p>
<p>I'd get more grumpy about random parts of programming languages that I don't like,
but this post would be a mile long and I wouldn't have finished it. So, in summary:
stop making languages with bare imports, take a page from ES6's book (but not too
many, JS is still a bit of a nightmare), and overthrow C(++).</p>
<hr class="footnotes-sep" />
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>Not that Javscript is really that different, but there is at least some
level of thought put in here. <a href="https://autumns.page/posts/2021/09/imports/#fnref1" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn2" class="footnote-item"><p>"Good" is very subjective here and sometimes very strange. I had to use
my university email to get a copy of CLion to even get symbols to start resolving,
and even then, things were still strangely broken. I hear QTCreator works well
with Serenity, but why do I have to use a special IDE just to write the code?
This should not be a consideration - if I open a big C project in nano,
I have to search around externally to figure out what's going on. If I open a
big JS/TS project in nano, I can generally get an idea of how the project works. <a href="https://autumns.page/posts/2021/09/imports/#fnref2" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>
Hello world!2021-08-14T05:34:00Zhttps://autumns.page/posts/2021/08/hello-world/My first post and an introduction<p>Hello, world! This is the first post I'm making on my own site, hosted on
Neocities.</p>
<p>I wasn't there for the small web - not the web Berners-Lee knew, not the web
90s kids knew, and just barely what it was in the earliest 10s - but I've seen
glimpses into the past, before the homogenization and centralization of the web,
and I'd much rather have a web like that than the one we have now.</p>
<p>There are a lot of projects trying to approximate this, and we'll probably never
truly escape Big Tech (TM), as some might like to call it, at least until some
sort of global revolution. Until then, I am perfectly happy to scratch out my
own corner of the nascent indie web.</p>
<p>Hopefully, I'll write more than I'm used to. A web without content is simply
infrastructure, and empty Debian servers are boring.</p>