Progress Update: Context Pilot (Revamping)

I’ve had many iterations on this project that I’m going to talk about today, over the last 1.5-2 years. There are good and bad things about it. Good is that I’m persisting with completing it one day, bad is that I’ve not done it yet. In this blog, I’ll quickly touch upon why it has taken so much time and what’s happening behind the scenes. About the project: For a piece of code, this project is going to help you with questions like: ...

March 23, 2025 · 4 min · Kushashwa Ravi Shrimali

I started building an app using Rust and here is how it went...

Hi everyone!! I’ve an update, on what I’ve been up to - and I’m excited. It’s a rusty update 😉. As always, I would love to tell you a story (this will help set some context), but if you want to skip and go directly to the update, please scroll to: # THE Update section. The Story I’ve been through, possibly, the best and the worst time of my life. I use these contrasting words because everything went wrong - and that’s where you get an opportunity to shine. I think I fairly enjoyed resisting the pain and fighting through the odds, hopefully you’ll learn about it very soon on my blog (just need the courage to say it out loud :)). ...

December 12, 2022 · 10 min · Kushashwa Ravi Shrimali

Porting a Tiling Window Manager Extenstion to C++ (Bismuth): Part-2 (getting closest relative window)

Hi everyone! In this blog, I will be discussing the algorithm used in Bismuth to find the closest relative window to be focused for focusWindowByDirection event. If you haven’t read the previous blog, make sure to give it a read here. Recap from the previous blog Let’s start with a quick recap though, in the previous blog, we discussed: focusWindowByDirection requires the following information: direction (from the user) - can be one of: right, left, top/up, bottom/down. activeWindow (from the current session) - this is needed since focusWindowByDirection event is a relative event to your current focused window. Neighbor window candidates (neighborCandidates) to your current window (activeWindow) and the given direction (direction). // declaration std::vector<Window> Engine::getNeighborCandidates(const FocusDirection &direction, const Window &basisWindow); // use std::vector<Window> neighborCandidates = getNeighborCandidates(direction, basisWindow); From these neighbor candidates (neighborCandidates), we will now find the closest relative window corner. To me, it was tricky to understand at first, so we’ll be discussing this in detail over in the later sections. Once we know the closest relative window corner, we’ll try to find the window which satisfies the corner condition. If there were multiple found, we’ll return the first one based on the time-stamp (last used) Understanding the scenario I want to start off with a visual, took me some time to draw it, but in case it doesn’t look good, I’m sorry! My drawing teacher in the high school tried his best, but… ...

July 31, 2022 · 6 min · Kushashwa Ravi Shrimali

Porting a Tiling Window Manager Extenstion to C++ (Bismuth): Part-1

Hi everyone! I understand it’s been a long time, and I’m so excited to be writing this blog today. In today’s blog, I wanted to talk about my journey (so far) on contributing to Bismuth (a KDE’s Tiling Window Manager Extension), mainly how and why I started, and where I am right now. The Story: Why KDE Plasma and Why Bismuth? For the last few months (close to a year), I’ve been using Pop OS (a linux distribution by System 76) which had this amazing automatic tiling window extension called pop-shell, and it was close to what I always needed: ...

July 23, 2022 · 8 min · Kushashwa Ravi Shrimali

Common Collections (Vector and Strings) in Rust [Notes]

Chapter 8: Common Collections These are my notes from the chapter-8 of rust book. Please scroll down to the bottom (Note) section if you are curious about what this is. 8.1: Storing Lists of Values with Vectors Vec<T> collection type discussed, aka vector: * By default contiguous. * All values should be of same type. // Creation let v: Vec<i32> = Vec::new(); // vec! macro for convenience // default integer type is i32 let v = vec![1, 2, 3]; // Modifying let mut v = Vec::new(); // Rust infers the type from the elements pushed here v.push(5); v.push(6); // ... // Dropping // a vector is freed, when it goes out of scope { let v = vec![1, 2, 3, 4]; // ... } // <-- v goes out of scope here, and hence memory is freed as well // Reading Elements of Vectors let v = vec![1, 2, 3, 4, 5]; // First way: let third: &i32 = &v[2]; println!("The third element is: {}", third); // Second way: match v.get(2) { Some(num) => println!("The third element is: {}", num), None => println!("There is no third element."), } .get(&index) method allows you to handle out of range errors. ...

January 9, 2022 · 8 min · Kushashwa Ravi Shrimali

Common Collections (Vector and Strings) in Rust [Notes]

Chapter 8: Common Collections (Hash Maps) In the previous blog, I shared my notes on strings and vectors in Rust, and in this post we’ll cover Hash Maps. I personally have found their use in competitive programming, a lot, but hopefully as we move on, we’ll see lots of use-cases in real-life problems. Hash Maps Hash Maps: HashMap<K, V> You can’t access using indices, but through keys. Hash Maps store data on heap. Hash Maps are homogenous (all keys must have same type, and all values must have same type). Use std::collections::HashMap to bring HashMap to scope. Creating a New Hash Map ...

January 9, 2022 · 5 min · Kushashwa Ravi Shrimali

Prefer const_iterators to iterators (Notes)

NOTE My notes on Chapter 3, Item 13 of Effective Modern C++ written by Scott Meyers. Some (or even all) of the text can be similar to what you see in the book, as these are notes: I’ve tried not to be unnecessarily creative with my words. :) In C++, iterators come handy to point at memory addresses of STL containers. For example, // C++11 std::vector<int> x {11, 9, 23, 6}; // begin() member function returns an iterator, which points to the first // memory address of the container x std::vector<int>::iterator it = x.begin(); While the general practice is to use const whenever possible, but programmers tend to use whenever it’s practical. const_iterators is particularly suggested when you want to use iterators, but you don’t need to modify what it points to. ...

September 26, 2021 · 5 min · Kushashwa Ravi Shrimali

Declaring Overriding Functions override (Notes)

NOTE My notes on Chapter 3, Item 12 of Effective Modern C++ written by Scott Meyers. Some (or even all) of the text can be similar to what you see in the book, as these are notes: I’ve tried not to be unnecessarily creative with my words. :) Overriding != Overloading Example of virtual function overriding: // Base class class Base { public: virtual void doWork(); // ... }; // Derived class from Base class Derived: public Base { public: // virtual is optional // this will "override" Base::doWork virtual void doWork(); // ... }; // This creates a "Base" class pointer to "Derived" class object std::unique_ptr<Base> upb = std::make_unique<Derived>(); // Derived doWork() function is invoked upb->doWork(); This is how virtual function overriding allows to invoke a “derived class function” from a base class interface. ...

September 25, 2021 · 4 min · Kushashwa Ravi Shrimali

Prefer Deleted Functions to Private Undefined Ones (Notes)

Prefer deleted functions to private undefined ones This item (11) in the chapter 3 focuses on: Why and How to prevent users calling particular functions? C++-98 and C++-11 approach What’s the difference between deleting a function vs declaring a member function private (and not defining them)? NOTE These are my notes on Chapter 3, Item 11 of Effective Modern C++ written by Scott Meyers. Some (or even all) of the text can be similar to what you see in the book, as these are notes: I’ve tried not to be unnecessarily creative with my words. :) ...

August 25, 2021 · 5 min · Kushashwa Ravi Shrimali

Prefer Scoped Enums over Unscoped Enums (Notes)

Scoped vs Unscoped Enums General rule: declaring a name inside curly braces is limited to that scope. Exception: C++-98 style Enums NOTE My notes on Chapter 3, Item 10 of Effective Modern C++ written by Scott Meyers. Some (or even all) of the text can be similar to what you see in the book, as these are notes: I’ve tried not to be unnecessarily creative with my words. :) ...

August 14, 2021 · 5 min · Kushashwa Ravi Shrimali