scripts.nix 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. { pkgs, lib, ... }:
  2. {
  3. home = {
  4. file = {
  5. mic-mute = {
  6. target = ".config/waybar/mic-mute.sh";
  7. text = ''
  8. #!/usr/bin/env bash
  9. # Toggle mute
  10. amixer set 'Capture' toggle
  11. # Check new state
  12. if amixer get Capture | grep -q '\[off\]'; then
  13. notify-send "Microphone Muted" "Your mic has been muted." -i microphone-sensitivity-muted-symbolic
  14. else
  15. notify-send "Microphone Unmuted" "Your mic is live." -i microphone-sensitivity-high-symbolic
  16. fi
  17. '';
  18. executable = true;
  19. };
  20. output-mute = {
  21. target = ".config/waybar/output-mute.sh";
  22. text = ''
  23. #!/usr/bin/env bash
  24. # Toggle mute
  25. amixer set 'Master' toggle
  26. # Check new state
  27. if amixer get Master | grep -q '\[off\]'; then
  28. notify-send "Master Muted" "You may no longer hear." -i audio-volume-muted-symbolic
  29. else
  30. notify-send "Master Unmuted" "You may hear now." -i audio-volume-high-symbolic
  31. fi
  32. '';
  33. executable = true;
  34. };
  35. screenshot = {
  36. target = "Scripts/ss.sh";
  37. text = ''
  38. FILE=~/Pictures/Screenshots/$(date +%F_%T).png
  39. grim -g "$(slurp)" "$FILE"
  40. wl-copy < "$FILE"
  41. swappy -f "$FILE"
  42. '';
  43. executable = true;
  44. };
  45. };
  46. };
  47. }