keyBoArd Shortcut mApping pLaTform
Create hotkeys to launch programs or scripts that perform a range of different tasks.
Run cargo build --release
to create a binary of the program.
The configuration file where the keymaps are defined must be saved at
$HOME/.config/basalt/key.map
The file ignores #
as comments. You can set shortcuts as KeyCode-KeyCode = [ command, argument ]
. You can find example scripts and a key.map
here. Malformatted lines will be ignored. You can find the keycodes to use here.
If new shortcuts are added, Basalt needs to be restarted for them to take effect. Here's an example of how to run Basalt in the background while still saving its PID to kill its process if needed:
#!/bin/bash
if ! pgrep "basalt" > /dev/null ; then
"/PATH/TO/BASALT/basalt/target/release/basalt" &
sleep_pid=$!
echo $sleep_pid > "$HOME/.config/basalt/basalt.pid"
else
echo "Basalt is already running"
fi
If this is added to a bash file and executed, it will launch Basalt in the background and save the process ID in 'basalt.pid'.
A possible bash script to stop basalt would then be:
#!/bin/bash
basalt_pid=$(cat "$HOME/.config/basalt/basalt.pid")
if pgrep "basalt" > /dev/null ; then
kill $basalt_pid
else
echo "Basalt is not running"
fi
Tested on macOS Sonoma and Ubuntu 22.04