Developing Sxitch
Context:
Sxitch is my first ever paid app, and this was my progress in developing it.
Its a modal app switcher. Its designed to be a better version of the CMD+TAB
keyboard shortcut.
On the tech side, its built in rust using the Iced GUI library
First footsteps:
The first thing to do was to find a way to:
- Get open apps
- Get their icons
- Be able to focus them
I tried directly storing the NSRunningApplication inside an App struct but
that turned out to be a bad move
struct App {
name: String,
icon_data: Handle,
app_handle: Retained<NSRunningApplication>
}
Here’s what it initially looked like. It was good but it honestly didn’t work
out really well since the NSRunningApplication was heavy and also the handle
had to be cloned (along with the App struct) many times, making it an extremely
inefficient data storage option.
Improvements
The way I improved it was to turn the Handle into an Arc, making it a
cheaper clone, and changing out the handle to open the app using the bundle
path. So the current App struct is:
struct App {
name: String,
icon_data: Arc<Handle>,
app_bundle: String,
}
This was much lighter, and is a stripped out way of how I reduced memory usage.
Doing the UI
Doing the UI was honestly much better since I structured the project much easier than my other iced app, Rustcast.
I put everything related to the GUI / Handling updates in a structure like this:
├── src
│ ├── app
│ │ ├── new.rs
│ │ ├── pages
│ │ │ ├── helpers.rs
│ │ │ ├── prelude.rs
│ │ │ └── settings.rs
│ │ ├── pages.rs
│ │ ├── subs.rs
│ │ ├── theme.rs
│ │ ├── update.rs
│ │ └── view.rs
Honestly this is a very clean structure, with everything organised pretty nicely, since everything regarding app UI, and interactions is in one place, while the core is seperated.
For a setup that doesn’t use cargo workspaces, this is an ideal setup imo.
Adding new features
Now that I had resolved the memory usage, and added sufficient UI, I had to mess around with more features.
I took inspiration from the pre-exisiting MacOS CMD TAB, which has the ability to quit and hide apps as well, but thats not easy to do since your fingers need to dance on the keyboard
And since I use neovim (btw) I decided to use a modal approach.
CMD Q is already reserved for quitting my app, so that was out of the option,
so I went with the next best, CTRL+Q and CTRL+H/M for quitting, and hiding /
minimising
Next steps
Now that the app has been mostly made, the next thing is to just market it.
So far I’ve marketted through:
- Product hunt
- Discord
I’ve gotten 5 sales so far and many people (I hope) are trying the app. I still need to come up with some form of metrics for app downloads.
Although even if I did, it would probably be mostly bot downloads