Add an indicator to FreeBSD for when recording is active.
This commit is contained in:
parent
019b4184ce
commit
8ea4ca15d8
@ -65,6 +65,7 @@ tooltip {
|
|||||||
#custom-clock,
|
#custom-clock,
|
||||||
#custom-sound,
|
#custom-sound,
|
||||||
#custom-temperature,
|
#custom-temperature,
|
||||||
|
#custom-recording_indicator,
|
||||||
#idle_inhibitor,
|
#idle_inhibitor,
|
||||||
#memory,
|
#memory,
|
||||||
#mode,
|
#mode,
|
||||||
@ -204,3 +205,7 @@ tooltip {
|
|||||||
border-color: #c9545d;
|
border-color: #c9545d;
|
||||||
color: #c9545d;
|
color: #c9545d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#custom-recording_indicator {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
// "height": 10, // Waybar height (to be removed for auto height)
|
// "height": 10, // Waybar height (to be removed for auto height)
|
||||||
"modules-left": ["sway/workspaces", "sway/mode"],
|
"modules-left": ["sway/workspaces", "sway/mode", "custom/recording_indicator"],
|
||||||
"modules-right": ["custom/temperature", "custom/sound", "custom/available_memory", "custom/battery", "idle_inhibitor", "custom/clock", "tray"],
|
"modules-right": ["custom/temperature", "custom/sound", "custom/available_memory", "custom/battery", "idle_inhibitor", "custom/clock", "tray"],
|
||||||
"sway/workspaces": {
|
"sway/workspaces": {
|
||||||
"disable-scroll": true
|
"disable-scroll": true
|
||||||
@ -43,5 +43,10 @@
|
|||||||
"exec": "waybar_custom_temperature",
|
"exec": "waybar_custom_temperature",
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"restart-interval": 30
|
"restart-interval": 30
|
||||||
|
},
|
||||||
|
"custom/recording_indicator": {
|
||||||
|
"exec": "waybar_custom_recording_indicator",
|
||||||
|
"return-type": "json",
|
||||||
|
"restart-interval": 30
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Report screen recording status in FreeBSD
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
SLEEP_INTERVAL=${SLEEP_INTERVAL:-10}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
local previous_reported="-1"
|
||||||
|
|
||||||
|
stream_key_binding_activations | while read -t "$SLEEP_INTERVAL" event; do
|
||||||
|
if pgrep -q wf-recorder; then
|
||||||
|
local is_running=1
|
||||||
|
else
|
||||||
|
local is_running=0
|
||||||
|
fi
|
||||||
|
if [ "$is_running" -ne "$previous_reported" ]; then
|
||||||
|
previous_reported="$is_running"
|
||||||
|
report "$is_running"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
sleep $SLEEP_INTERVAL
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function stream_key_binding_activations {
|
||||||
|
swaymsg --raw --monitor --type subscribe '[ "binding" ]'
|
||||||
|
}
|
||||||
|
|
||||||
|
function report {
|
||||||
|
is_running="$1"
|
||||||
|
if [ "$is_running" -eq 0 ]; then
|
||||||
|
jq --unbuffered --compact-output <<EOF
|
||||||
|
{
|
||||||
|
"text":"",
|
||||||
|
"tooltip":"Not recording",
|
||||||
|
"percentage":0,
|
||||||
|
"class":"hidden"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
jq --unbuffered --compact-output <<EOF
|
||||||
|
{
|
||||||
|
"text":"⏺",
|
||||||
|
"tooltip":"Recording",
|
||||||
|
"percentage":100,
|
||||||
|
"class":"visible"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "${@}"
|
@ -20,3 +20,5 @@
|
|||||||
dest: /usr/local/bin/waybar_custom_sound
|
dest: /usr/local/bin/waybar_custom_sound
|
||||||
- src: waybar_temperature_freebsd.bash
|
- src: waybar_temperature_freebsd.bash
|
||||||
dest: /usr/local/bin/waybar_custom_temperature
|
dest: /usr/local/bin/waybar_custom_temperature
|
||||||
|
- src: waybar_recording_indicator_freebsd.bash
|
||||||
|
dest: /usr/local/bin/waybar_custom_recording_indicator
|
||||||
|
Loading…
x
Reference in New Issue
Block a user