Add sounds for notifications & screenshot/screenrec.

This commit is contained in:
Dmitry Voronin 2024-11-11 02:40:11 +03:00
parent 8ef31a06b7
commit e75cd9fa4d
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
5 changed files with 18 additions and 5 deletions

View file

@ -1,6 +1,7 @@
{ {
pkgs, __findFile,
config, config,
pkgs,
... ...
}: let }: let
alpha = config.module.style.opacity.hex; alpha = config.module.style.opacity.hex;
@ -16,6 +17,7 @@ in {
height = 120; height = 120;
icons = 0; icons = 0;
margin = 32; margin = 32;
on-notify = "exec ${pkgs.pipewire}/bin/pw-cat -p ${<static/Notification.ogg>}";
text-color = "#${config.module.style.color.bg.dark}"; text-color = "#${config.module.style.color.bg.dark}";
width = 480; width = 480;
}; };

View file

@ -1,4 +1,5 @@
{ {
__findFile,
config, config,
lib, lib,
pkgs, pkgs,
@ -15,6 +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>} &";
notifyEnd = "${pkgs.pipewire}/bin/pw-cat -p ${<static/Screenshot.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";
@ -106,12 +109,14 @@ in {
${getSelection} ${getSelection}
${getTransform} ${getTransform}
${vidPrepFile} ${vidPrepFile}
${notifyStart}
${updateWaybar} ${updateWaybar}
${vidStart} ${vidSelected} ${vidStart} ${vidSelected}
${notifyEnd}
${updateWaybar}
${vidMuxAudio} ${vidMuxAudio}
${vidTransform} ${vidTransform}
${vidRefLatestFile} ${vidRefLatestFile}
${updateWaybar}
}; };
''); '');
@ -119,26 +124,32 @@ in {
${vidStop} || { ${vidStop} || {
${getTransform} ${getTransform}
${vidPrepFile} ${vidPrepFile}
${notifyStart}
${updateWaybar} ${updateWaybar}
${vidStart} ${vidFull} ${vidStart} ${vidFull}
${notifyEnd}
${updateWaybar}
${vidMuxAudio} ${vidMuxAudio}
${vidTransform} ${vidTransform}
${vidRefLatestFile} ${vidRefLatestFile}
${updateWaybar}
}; };
''); '');
FullscreenScreenshot = pkgs.writeShellScriptBin "FullscreenScreenshot" (util.trimTabs '' FullscreenScreenshot = pkgs.writeShellScriptBin "FullscreenScreenshot" (util.trimTabs ''
${notifyEnd}
${picPrepFile} ${picPrepFile}
${screenshot} ${picFull} | ${picToFile} | ${picToBuffer} && ${picRefLatestFile} ${screenshot} ${picFull} | ${picToFile} | ${picToBuffer} || exit
${picRefLatestFile}
''); '');
SelectScreenshot = pkgs.writeShellScriptBin "SelectScreenshot" (util.trimTabs '' SelectScreenshot = pkgs.writeShellScriptBin "SelectScreenshot" (util.trimTabs ''
${getSelection} ${getSelection}
${notifyEnd}
${picPrepFile} ${picPrepFile}
${screenshot} ${picSelected} | ${picEdit} | ${picToFile} | ${picToBuffer} && ${picRefLatestFile} ${screenshot} ${picSelected} | ${picEdit} | ${picToFile} | ${picToBuffer} || exit
${picRefLatestFile}
''); '');
in '' in ''
bindsym --to-code $mod+y exec ${lib.getExe FullscreenScreenshot} bindsym --to-code $mod+y exec ${lib.getExe FullscreenScreenshot}

BIN
static/Notification.ogg Normal file

Binary file not shown.

BIN
static/Screenrec.ogg Normal file

Binary file not shown.

BIN
static/Screenshot.ogg Normal file

Binary file not shown.