Random Linux nuggets - 1

I am a bit obsessed to my working environment on the desktop. Since considerable amount of my time is spent on here, I’d like everything to work as I wish. With respect to xkcd’s “is it worth the time?” chart, I optimize my stuff slowly but continously on the side.

So I decided to share some details about “how I roll” with blog posts called “nuggets”. I hope you find them useful. Of course, being a sysadminᵒʳ ˢᶦᵐᶦˡᵃʳ, I’ll throw some random linux stuff in these like a nerdy diary 😺

Read more nuggets: here.


Viewing git diff’s with delta

I was using delta for a while, but I wasn’t happy with the way it was displaying diffs (not sure why though, maybe after seeing some screenshots on the web?). My diff screen seemed lacking simplicity, so I opened documentation to paint it a little better.

Currently it looks a lot better (at least to my eyes):

 


 

You can find the theme here. A theme is just a stylized section (a.k.a. “feature") of the delta config block which you can refer to.


Fixing monitor chaos with a new tool

I was getting annoyed with the display device configuration under Linux, thanks to the “flexible desks” at my work, which gives me random desk depending on the congestion at the office. That means random monitor setup every time I wanted to work there.

Current tools like autorandr and grobi were not quite doing the job for me since

  • a) you have to be precise (so if you plug a monitor on different port, they act like “I’ve never seen this monitor in my life! Let me call you DP-1 this time!")
  • b) they were occasionally unstable (unplug your laptop and you have no display now, surprise debugging session before your meeting 🤗)

So I decided to write my own tool. It was pretty painful to do what I thought, but at last I can solve the issues as I see (which I did not, for a while 🚀)!

Now I can declare my preferred setup in a vague way and it figures out the rest. If I don’t like the setup, I can just “rotate” to the next one 🔃!


Auto-format all the code!

I was checking out stuff like black from time to time, but not warming up to the idea of a tool formatting my code with its pesky newlines and indentation. Then, I guess I got older, and now I am using autoformatters for multiple languages:

  • black
  • isort
  • fixjson
  • puppet-lint
  • stylua
  • alejandra (nix)

Probably most of them will be replaced by ruff eventually, considering its crazy development.

(If you’re a neovim user, check out conform to set it up, it’s crazy helpful.)


Some low-level terminal stuff

A rust-dev I follow, Orhun, wrote a blog post about “why stderr is slower than stdout”. If your life is spent on console like me and like to dig into details, I can suggest a nice read: link


Rofi is comfy 🛋️

More I want to optimize my workflow on desktop, more I find myself using rofi. Even though the methods are a bit weird, its extensibility is amazing. Let me try to list what I use it for:

  • application launcher
  • pinentry interface, so I can unlock my yubikey etc. (link)
  • calculator for everything, including currency 🤯 (link)
  • pass interface (link)
  • sub/superscript converter (I wrote something hacky)
  • emoji picker (link)

And there are many more that I need to check out.