• 0 Posts
  • 342 Comments
Joined 3 years ago
cake
Cake day: June 30th, 2023

help-circle
  • BSP Tree (with custom nodes).

    With a vanilla BSP-tree you can accomplish your diagram. Simply reordering your splits can do it by making the footer and main content areas first. Better approach is to support splits on non-leaf nodes. In the example below just split the root where all its children go to the new top node and a new bottom bar leaf node is created.

    Root (split: vertical, ratio: 0.6)
    ├── Left child (Window A)
    └── Right child (split: horizontal, ratio: 0.5)
        ├── Top child (Window B)
        └── Bottom child (Window C)
    

    To access neighbors you’ll need your nodes to track their parents (double linked). Then you can traverse until all edges are found. Worst case its O(height+num neighbors that exist) if I am remembering.

    Depending on how efficient you want it to be, there are speed ups. It has been awhile, but I do remember keeping the tree as balanced as possible makes the search around log(n). Each split node keeping an index of all children in its sub-tree also reduces how much traversing is needed when you need all children after a split.

    Can get a little complicated but it is doable. That said, how many splits will a TUI have? This may be preemptive to do.

    Custom nodes is where you support some patterns that could use further optimizations. Tables that will always be a grid. Tab bars that are a 1xn grid could be a further specialized node.

    This is all about layout. Fixed/Dynamic width/height windows, padding and margins, borders, are all render processing and don’t effect the layout (unless you want reactivity). By that I mean you have windows that will split differently when the viewport is portrait or landscape and it dynamically adjusts to the window size. Sometimes with different “steps” like a square viewport may be different from both portrait or landscape or 4:3 could be treated different from 16:9.

    TUIs are not my day job but I’ve made a few in my day. Above are just my opinions from experiences. There is no “right” answer but hopefully some of this helps your journey.


    TypeScript is my day job and using a custom JSX Factory makes it pretty easy to define HTML-like interfaces for devs that can support mixing layout, render attributes, content, and app logic.

    Explicit BSP splits:

    <Split type="vertical" ratio={0.6}>
      <WidgetA />
      <Split type="horizontal" ratio={0.5}>
        <WidgetB />
        <WidgetC />
      </Split>
    </Split>
    

    Custom nodes:

    <Container>
      <TabBar>
        <Tab>Tab 1</Tab>
        <Tab>Tab 2</Tab>
      </TabBar>
      <StatusBar />
    </Container>
    

    Not sure your stack but throwing it out there as something I’ve used successfully.








  • If you knew how to start, you wouldn’t be learning anything. So, you are learning. What do you want to learn about as you learn how to architect and develop some software? Web, databases, 3d rendering, gaming, etc.

    Chances are you are going to need a framework, library, or many of both. You’ll be learning those too.

    Back to architecture. Once you have an idea of what you want to build, we want to get something running fast. Because whats going to happen is you are going to make bad decisions. Lot’s of them and that’s good! You want to fail so many times you learn what not to do, how to debug to keep things moving forward, etc.

    So start with a hello world. Serve a webpage. Connect to a database. Draw a square. Then add another and another.

    There is some quote out there that the difference between a beginner and master is the master spent X,000 hours failing. At the end of the day its just time spent learning.

    You may start over. You may switch tech stacks. You maybe give up when something more interesting comes along.

    90% of my personal projects never get completed. I’m usually learning a tool. If I’m reasonably able to use a new tool I’ve learned something. Become really good at learning. Learn to read code. Learn to read type signatures. Learn how the tools you learn work. Learn how to make them do things they were not meant to do. Learn your build system. Learn to setup linting, document your project, setup CI/CD, and so on.

    For reference I’m in my 40s. Started coding at 13. Work R&D and greenfield projects for the same fortune 100 for almost 2 decades. Done everything from web, data pipelines, network code, integrated firmware, etc. As you skill up it gets easier. My team usually picks up a new stack every project as I level them up just to expose them to different things.


  • Been using Nix for just over a year.

    Seconding to go with flakes. No idea wtf channels are or whatever the previous system was.

    Documentation can be confusing due to changes in paradigms. The bare “nix <scope>” seems to be the most modern oppose to “nix-<scope>” (e.g., nix store vs nix-store). That said, not every feature can be found in the newer variants.

    This can make following tutorials difficult if they aren’t using the same paradigm.

    Getting comfortable with the nix language will be helpful. Its a functional programming language, which is very different than languages like bash.

    Not everything has to be done the nix-way. My nvim files are in the same repo, but I just outOfStoreSymlink them instead of wrapping them in a derivation.

    Some useful packages I like not already shared.

    Disk partitioning: https://github.com/nix-community/disko

    Immutable: https://github.com/nix-community/impermanence - Pretty much resets the system to a new install every boot. Discourages manual tweaks via sudo as they get wiped out. You can still mark certain directories to be persistent (logs, personal documents, steam games, etc.).

    Nvfetcher: https://github.com/berberman/nvfetcher - Nix has a concept of overlays. You can pretty much override anything with .override (module args or inputs) and .overrideAttrs (module attribute set or outputs). Nvfetcher helps with checking different sources so you can override a packages src attribute. Why is this useful? So you can install any version you want and are not bound to nixpkgs. That doesn’t mean the install script in nixpkgs will always work on newer versions, but those can be overridden as well if needed.

    Note that disko, impermanence, and nvfetcher all have a flake.nix in the root of the repo. Those provide ready to go overlays so you don’t have to deal with writing your own which is really nice if you want to latest version without much work when available.




  • Toooo real. Its like companies have taken the worst of everything and just call it agile. List out every task and estimate them so we have timelines, but don’t actually architect anything as that’s waterfall. Fake waterfall, with fake dates, but fingers will be pointed like they were real commitments, and spend a month doing it for this executive power point instead of fucking off so devs can build the damn thing.






  • I ended up just building a box after looking for the perfect NAS and finding it didn’t exist. The software is usually just crap or the hardware is underwhelming. Got a Node 804 case to slap in plenty of HDD space. Running NixOS so I’m in control of the software. In retrospect I wish I had gotten a rackmount type case. Tossed in an Arc GPU for better transcoding shortly after the initial setup.



  • If half your employees aren’t acting the way they do in private, they’re putting on a mask and not being their true selves

    But you’re making this point in defense of someone aligning themselves with a group who targets trans, women, and whoever else they can bully not like them for being their true selves… Do you not see the hypocrisy of such a point given the context of the quote?


  • Major desktop environments are KDE as you mentioned and Gnome.

    Arch wiki is a good resource even if not running arch. You may want to look into their dotfiles page to back up your settings: https://wiki.archlinux.org/title/Dotfiles.

    NixOS ended up being my distro of choice for reproducible installs but it has a high learning curve and poor documentation so I wouldn’t recommend to start with. That said you can still use Nix on other distros with home manager to manage dotfiles and install non-system apps.

    Distros just pick the default things to install. You can always use the package manager to install something else like a better file manager.

    A lot of choices are simply subjective so its hard to recommend any one distro. Mint is close to windows, based on Ubuntu and uses Gnome. Ubuntu based on Debian I find to be user friendly. Not used a Fedora based distro in ages but there is also Silverblue I’ve heard mentioned positively.

    Distros like Arch and NixOS are more design your own system setups. Pick what you want. I used arch for a bit, but got annoyed at keeping all my systems in sync. Had a huge wiki of all the tweaks I made. Then scripts to automate some of it. I started looking at automation tooling like ansible when I found nix.