1

i3status-anyevent: Add left|right click cmd for clock plugin

This commit is contained in:
Sergei Fedosov
2021-02-24 17:50:35 +03:00
parent 27904b8d50
commit d1fcd2b8a4
2 changed files with 23 additions and 3 deletions

View File

@@ -233,7 +233,7 @@ sub add_events () {
}
if ($CONF->{clock}->{enabled}) {
push @{$OUTPUT}, { color => $CONF->{clock}->{color}, full_text => "<big>$wallclock</big>", markup => 'pango'};
push @{$OUTPUT}, { name => 'wallclock', color => $CONF->{clock}->{color}, full_text => "<big>$wallclock</big>", markup => 'pango'};
}
$output_string = eval { encode_json $OUTPUT };
@@ -274,7 +274,7 @@ sub add_events () {
if (defined $j) {
# left button click, without shift, ctrl, alt, etc
if (($j->{button} == 1) && ($#{$j->{modifiers}} < 0)){
if (($j->{button} == 1) && ($#{$j->{modifiers}} < 0)) {
foreach (@{$CONF->{apps}}) {
unless (defined $_->{name}) {
next;
@@ -290,6 +290,18 @@ sub add_events () {
}
}
}
if (($j->{name} eq 'wallclock') && ($CONF->{clock}->{enabled})) {
if ($CONF->{clock}->{left_click}->{enabled}) {
if (($j->{button} == 1) && ($#{$j->{modifiers}} < 0)) {
spawn ($CONF->{clock}->{left_click}->{cmd});
}
} elsif ($CONF->{clock}->{right_click}->{enabled}) {
if (($j->{button} == 2) && ($#{$j->{modifiers}} < 0)) {
spawn ($CONF->{clock}->{right_click}->{cmd});
}
}
}
}
}
}

View File

@@ -14,7 +14,15 @@
"clock": {
"enabled" : 1,
# html (actually, pango) color notation
"color" : "#000000"
"color" : "#000000",
"left_click" : {
"enabled" : 1,
"cmd" : "orage"
},
"right_click" : {
"enabled" : 0,
"cmd" : "true"
}
},
# Battery