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