nixcfg/homeManagerModules/desktop/wayland/helpers.nix
Aly Raffauf 6b1be071f6
home/desktop: reorg with wayland helpers (#58)
* home/sway: use wayland helpers

* home/sway: reorg

* home/sway: simplify string interpolation

* home/sway: fix faulty helpers

* home/sway: consolidate secondary modules

* home/sway: cleanup

* home/wayland: simplify screenshooter

* home/sway: better random wallpaper handling

* home/sway: move display configuration to hosts

* home/sway: move touch config to hosts

* hosts/petalburg: add sway bindings

* home/wayland/helpers: save screenshots to config.xdg.userDirs.pictures

* home/wayland/helpers: enable mako dnd while slurping

* nix fmt
2024-07-21 23:25:10 -04:00

57 lines
1.5 KiB
Nix

{
config,
lib,
pkgs,
...
}: {
brightness = rec {
bin = lib.getExe' pkgs.swayosd "swayosd-client";
up = "${bin} --brightness=raise";
down = "${bin} --brightness=lower";
};
media = rec {
bin = lib.getExe pkgs.playerctl;
play = "${bin} play-pause";
paus = "${bin} pause";
next = "${bin} next";
prev = "${bin} previous";
};
screenshot = rec {
bin = pkgs.writeShellScript "screenshooter" ''
FILENAME=${config.xdg.userDirs.pictures}/screenshots/$(date +'%Y-%m-%d-%H:%M:%S_grim.png')
MAKO_MODE=$(${lib.getExe' pkgs.mako "makoctl"} mode)
if echo "$MAKO_MODE" | grep -q "do-not-disturb"; then
DND=true
else
DND=false
${lib.getExe' pkgs.mako "makoctl"} mode -t do-not-disturb
fi
${lib.getExe pkgs.grim} -g "$(${lib.getExe pkgs.slurp} -o)" "$FILENAME"
if [ "$DND" = false ]; then
${lib.getExe' pkgs.mako "makoctl"} mode -t do-not-disturb
fi
if [ -e "$FILENAME" ]; then
${lib.getExe' pkgs.wl-clipboard-rs "wl-copy"} $FILENAME
${lib.getExe' pkgs.libnotify "notify-send"} "Screenshot saved" "$FILENAME" -i "$FILENAME"
fi
'';
region = "${bin}";
screen = "${bin}";
};
volume = rec {
bin = lib.getExe' pkgs.swayosd "swayosd-client";
up = "${bin} --output-volume=raise";
down = "${bin} --output-volume=lower";
mute = "${bin} --output-volume=mute-toggle";
micMute = "${bin} --input-volume=mute-toggle";
};
}