diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-01-21 16:09:02 -0500 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-01-22 21:05:39 -0500 |
commit | 0027e9422fa7205d0a50b995fbe172c35c9ce379 (patch) | |
tree | 6ace11eb26204dffe902bc722ee604ab94d7a67e /ponymix.cc | |
parent | 4aa7581f9dc97e3c8b01a9411cf665158895f4c0 (diff) | |
download | mirror-ponymix-0027e9422fa7205d0a50b995fbe172c35c9ce379.tar.gz mirror-ponymix-0027e9422fa7205d0a50b995fbe172c35c9ce379.tar.bz2 mirror-ponymix-0027e9422fa7205d0a50b995fbe172c35c9ce379.zip |
add support for libnotify based notifier
Diffstat (limited to 'ponymix.cc')
-rw-r--r-- | ponymix.cc | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -56,6 +56,7 @@ static bool opt_listrestrict; static const char* opt_action; static const char* opt_device; static const char* opt_card; +static bool opt_notify; static Color color; static const char* type_to_string(enum DeviceType t) { @@ -534,6 +535,7 @@ bool parse_options(int argc, char** argv) { { "card", required_argument, 0, 'c' }, { "device", required_argument, 0, 'd' }, { "help", no_argument, 0, 'h' }, + { "notify", no_argument, 0, 'N' }, { "type", required_argument, 0, 't' }, { "sink", no_argument, 0, 0x100 }, { "output", no_argument, 0, 0x101 }, @@ -545,7 +547,7 @@ bool parse_options(int argc, char** argv) { }; for (;;) { - int opt = getopt_long(argc, argv, "c:d:ht:", opts, nullptr); + int opt = getopt_long(argc, argv, "c:d:hNt:", opts, nullptr); if (opt == -1) break; @@ -559,6 +561,9 @@ bool parse_options(int argc, char** argv) { case 'h': usage(); break; + case 'N': + opt_notify = true; + break; case 't': opt_devtype = string_to_devtype_or_die(optarg); opt_listrestrict = true; @@ -605,7 +610,14 @@ int main(int argc, char* argv[]) { argv += optind; try { +#ifdef HAVE_NOTIFY + if (opt_notify) { + ponymix.EnableNotifications(new LibnotifyNotifier); + } else +#endif + { ponymix.EnableNotifications(new CommandLineNotifier); + } } catch (std::exception e) { fprintf(stderr, "failed to enable notifier\n"); } |