Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (28 sloc) 779 Bytes
# Add "URxvt*keysym.C-n: perl:notify-toggle" in your .Xresources
# to enable / disable notifications via Ctrl+n key binding
#
# on debian:
# apt-get install libnotify-bin
#!/usr/bin/perl
my $status = 1;
sub on_user_command {
my($term, $command) = @_;
if ($command eq "notify-toggle") {
$status = 1 - $status;
if ($status eq 1) {
system("notify-send", ("Notifications activées"))
} else {
system("notify-send", ("Notifications désactivées"))
}
}
}
sub on_osc_seq_perl {
my ($term, $osc, $resp) = @_;
if ($status eq 0) {
return;
}
if ($osc =~ /^notify;(\S+);(.*)$/) {
system("notify-send", ($1, $2));
}
}
# vim: set filetype=perl :