Home RSS icon Posts RSS icon Microblog

Scratching an itch feels good

Yesterday afternoon I had a real itch to scratch, the nichest of niches of itches.

When I sit down to start recording a live coding video for my YouTube channel, after opening OBS Studio, I normally hit a button on my Elgato Stream Deck to fire off a script that does the following:

This is what my obs-start-rec.sh script looked like:

#!/usr/bin/env bash

pidof obs &>/dev/null
if [ $? -gt 0 ]
then
        echo "OBS isn't running."
        exit 1
fi

notify-send -u low "Starting recording..."
obs-cmd scene switch "Background"
sleep 1
obs-cmd recording start
obs-cmd scene switch "Intro"
sleep 4
dunstctl set-paused true; pkill -SIGRTMIN+10 i3blocks
obs-cmd scene switch "Desktop+Me-Right"

This has worked well for me for years, however, I recently switched all my machines one by one to Solus, including my desktop PC which I use for recording videos on.

And then I switched to Solus

My YouTube Channel

I use the Budgie Desktop version of Solus, which is awesome by the way, but of course, that means the penultimate line in the above script that tells the dunst notifications daemon to pause notifications, and then refresh the i3blocks display (so I can see the notifications bell icon has changed status) no longer works. dunst and i3blocks are what I used previously when using the i3 window manager on NixOS, with Budgie Desktop neither of those applications are needed.

Budgie Desktop has a nice notifications system, which you can control from the Raven sidebar area, including turning on "Do Not Disturb". There's also a notifications bell icon in the system tray, clicking it opens Raven so you can see the notifications.

Unfortunately, I was unable to find a way to programmatically turn on Budgie Desktop's Do Not Disturb setting, or even set a keyboard shortcut. I asked in the Solus forums too, but there was no response.

Do not disturb keyboard shortcut in Budgie? (Solus Forums)

So yesterday afternoon, I had a little poke around in the DBus services using D-Spy to see if there was anything related to notifications in there, and sure enough, there I found an org.budgie_desktop.Notifications object, with a very interesting org.buddiesofbudgie.budgie.Dispatcher interface.

That org.buddiesofbudgie.budgie.Dispatcher interface has a single NotificationsPaused property, a few signals, but most handy for me, two methods, GetDoNotDisturb and ToggleDoNotDisturb.

Having already built a DBus service server and clients for Snippet Expander, it wasn't too daunting for me to consider whipping up a little CLI application in Go that would allow me to toggle the Do Not Disturb setting in Budgie Desktop. So I did.

https://git.sr.ht/~ianmjones/budgie-do-not-disturb-status

As I started to look into creating budgie-do-not-disturb-status, and my mind turned to what I should call the application while setting things up for development, I did check with the BuddiesOfBudgie developers via their Matrix channel to make sure the name was ok to use. I got the ok from Joshua Strobal, which was very kind.

That was a pleasant afternoon of development, and now my obs-start-rec.sh script looks like the following:

#!/usr/bin/env bash

pidof obs &>/dev/null
if [ $? -gt 0 ]
then
        echo "OBS isn't running."
        exit 1
fi

notify-send -u low "Starting recording..."
obs-cmd scene switch "Background"
sleep 1
obs-cmd recording start
obs-cmd scene switch "Intro"
sleep 4
budgie-do-not-disturb-status on
obs-cmd scene switch "Desktop+Me-Right"

Naturally, I have an obs-stop-rec.sh script too:

#!/usr/bin/env bash

pidof obs &>/dev/null
if [ $? -gt 0 ]
then
        echo "OBS isn't running."
        exit 1
fi

obs-cmd scene switch "Outro"
sleep 1
budgie-do-not-disturb-status off
notify-send -u low "Stopping recording..."
sleep 9.5
obs-cmd recording stop
notify-send -u low "Stopped recording."

I've also added a custom "Toggle Do Not Disturb" keyboard shortcut activated with Shift+Super+N that runs the following command:

budgie-do-not-disturb-status toggle

It's quite handy to have that shortcut.

Solus Packaging

I've submitted a Solus package request for budgie-do-not-disturb-status in the hope that I can then submit the package that I've already got created and am using on my machines.

https://github.com/getsolus/packages/issues/3607

https://github.com/ianmjones/packages/tree/budgie-do-not-disturb-status-1.0.1/packages/b/budgie-do-not-disturb-status

I've already put in a few other Solus package requests for some utilities I use all the time. For each one I've indicated that I'm happy to be the maintainer too, and have already got a package spec ready. Packaging an application for Solus is very straight forward compared to some other distros and package formats, and the documentation is top notch.

Creating a New Package (Solus Help Center)

Someone had already submitted a package request for the Gleam language that was accepted, so I was able to get a package created for that, submit the PR, and after a couple of fixups (great learning experience), the PR was merged and now the Gleam language is available in Solus.

https://discuss.getsol.us/d/10848-sync-updates-for-week-33-2024

Once a couple of my package requests have hopefully been accepted, and I've been able to get the packages into the Solus packages repo, I should be in a position to do the same for Snippet Expander, which has a dependency on a couple of those packages, and plenty others already in Solus, so will be a bit more of a meaty package to create.

I already have Snippet Expander built and installed manually on my Solus machines, it's working very well, I just need to create the package for it, which will be another itch scratched.

---

"Scratching an itch feels good" was published on August 18, 2024.

~/