rlue/timer

Linux compatibility

Closed this issue · 3 comments

rlue commented

This script depends on sox for playback (afplay doesn't support playing from STDIN), and uses Mac-specific facilities for determining whether the system is muted.

The next priority is to loosen compatibility requirements so that it works on Linux systems, as well.

dvn0 commented

I would be happy to see this happen. It looks like a nice utility. :)

rlue commented

@dvn0 great to hear it! Unfortunately, I don't have a Linux system to test on. If you want to be my guinea pig, go ahead and download the script off of the feature/linux-support branch to try it out on your system:

$ curl -O https://raw.githubusercontent.com/rlue/timer/feature/linux-support/bin/timer && chmod 775 timer

With that, you ought to be able to run the program with ./timer. In particular, I'm interested to see that:

  • it plays the bell over your speakers when the volume is on, and
  • it flashes a visual bell when the volume is muted.

If those two things work, everything else should work as well.

Requirements

You'll need sox and bc.

Assumptions / Debugging

The rewrite assumes that:

  • you can use amixer get Master | grep off >/dev/null to detect whether the system is muted (I believe this should work on all Linux systems, but I'm not an expert),
  • uname -s will return "Linux", and
  • your terminal emulator supports flashing a visual bell in the first place (to confirm, mute your system audio and run printf "\a").

Please let me know how it works out!

rlue commented

Just tested 840ac4 on my Debian machine, and everything looks good. (Can't figure out how to test the visual bell, though — printf "\a" doesn't flash anything in my terminal emulator or the tty.)

Closing for now. Let me know if you have any trouble with it.