Swayscript: Add audio notifications.
This commit is contained in:
parent
b13c8885d9
commit
3d7cacdf2b
|
@ -16,8 +16,8 @@
|
||||||
selection = "slurp -d -b ${color.bg.light}${opacity} -c ${color.fg.light} -w 0 -s 00000000";
|
selection = "slurp -d -b ${color.bg.light}${opacity} -c ${color.fg.light} -w 0 -s 00000000";
|
||||||
in {
|
in {
|
||||||
text = let
|
text = let
|
||||||
notifyStart = "${pkgs.pipewire}/bin/pw-cat -p ${<static/Screenrec.ogg>} &";
|
notifyStart = "${pkgs.pipewire}/bin/pw-cat -p ${<static/Short.ogg>} &";
|
||||||
notifyEnd = "${pkgs.pipewire}/bin/pw-cat -p ${<static/Screenshot.ogg>} &";
|
notifyEnd = "${pkgs.pipewire}/bin/pw-cat -p ${<static/Long.ogg>} &";
|
||||||
picEdit = ''swappy -f - -o -'';
|
picEdit = ''swappy -f - -o -'';
|
||||||
picFull = ''-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -'';
|
picFull = ''-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -'';
|
||||||
picPrepFile = prepFile "\${XDG_PICTURES_DIR[0]}" "png";
|
picPrepFile = prepFile "\${XDG_PICTURES_DIR[0]}" "png";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
text = ''
|
text = ''
|
||||||
function monitor() {
|
function monitor() {
|
||||||
|
_notify_short
|
||||||
toggle() {
|
toggle() {
|
||||||
local output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
|
local output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
|
||||||
local state=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .power')
|
local state=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .power')
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function gaming() {
|
function gaming() {
|
||||||
|
_notify_short
|
||||||
toggle() {
|
toggle() {
|
||||||
local output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
|
local output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
|
||||||
local state=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .adaptive_sync_status')
|
local state=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .adaptive_sync_status')
|
||||||
|
@ -43,6 +45,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function dnd() {
|
function dnd() {
|
||||||
|
_notify_short
|
||||||
toggle() {
|
toggle() {
|
||||||
local state=$(makoctl mode)
|
local state=$(makoctl mode)
|
||||||
|
|
||||||
|
@ -59,6 +62,7 @@
|
||||||
|
|
||||||
# Reset the state of everything.
|
# Reset the state of everything.
|
||||||
function displayreset() {
|
function displayreset() {
|
||||||
|
_notify_long
|
||||||
[[ "''$(monitorstate)" = "Y" ]] && monitorreset
|
[[ "''$(monitorstate)" = "Y" ]] && monitorreset
|
||||||
[[ "''$(gamingstate)" = "Y" ]] && gamingreset
|
[[ "''$(gamingstate)" = "Y" ]] && gamingreset
|
||||||
[[ "''$(recordingstate)" = "Y" ]] && pkill wf-recorder
|
[[ "''$(recordingstate)" = "Y" ]] && pkill wf-recorder
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
text = ''
|
text = ''
|
||||||
# Reload.
|
# Reload.
|
||||||
function reload() {
|
function reload() {
|
||||||
|
# _notify_long
|
||||||
re() {
|
re() {
|
||||||
# Sway.
|
# Sway.
|
||||||
swaymsg reload
|
swaymsg reload
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
text = ''
|
text = ''
|
||||||
function sound_output_cycle() {
|
function sound_output_cycle() {
|
||||||
|
_notify_short
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local current=$(pactl get-default-sink)
|
local current=$(pactl get-default-sink)
|
||||||
local all=($(pactl list short sinks | cut -f2))
|
local all=($(pactl list short sinks | cut -f2))
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{ ... }: {
|
{
|
||||||
|
__findFile,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
text = ''
|
text = ''
|
||||||
# Find currently active SWAYSOCK paths.
|
# Find currently active SWAYSOCK paths.
|
||||||
function _sway_find_sockets() {
|
function _sway_find_sockets() {
|
||||||
|
@ -11,5 +15,13 @@
|
||||||
SWAYSOCK="''${socket}" ''${1}
|
SWAYSOCK="''${socket}" ''${1}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _notify_short() {
|
||||||
|
${pkgs.pipewire}/bin/pw-cat -p ${<static/Short.ogg>} &
|
||||||
|
}
|
||||||
|
|
||||||
|
function _notify_long() {
|
||||||
|
${pkgs.pipewire}/bin/pw-cat -p ${<static/Long.ogg>} &
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
text = ''
|
text = ''
|
||||||
# Toggle vpn.
|
# Toggle vpn.
|
||||||
function vpn() {
|
function vpn() {
|
||||||
|
_notify_short
|
||||||
if [[ "$(_vpn)" = "on" ]]; then
|
if [[ "$(_vpn)" = "on" ]]; then
|
||||||
nmcli connection down vpn
|
nmcli connection down vpn
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue