Skip to content

Commit

Permalink
Support for XF86AudioMicMute (Raymo111#273)
Browse files Browse the repository at this point in the history
* Feature: Add XF86AudioMicMute to passed media keys
* Feature: Add shell command option for XF86AudioMicMute
  • Loading branch information
kwesthaus authored Mar 31, 2023
1 parent aeb9982 commit f1903bd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions i3lock-bash
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ _i3lock() {
"--cmd-audio-mute"
"--cmd-volume-up"
"--cmd-volume-down"
"--cmd-mic-mute"
"--cmd-power-down"
"--cmd-power-off"
"--cmd-power-sleep"
Expand Down
1 change: 1 addition & 0 deletions i3lock-zsh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ _i3lock() {
"--cmd-volume-up[Command for XF86AudioRaiseVolume]"
"--cmd-volume-down[Command for XF86AudioLowerVolume]"
"--cmd-power-down[Command for XF86PowerDown] "
"--cmd-mic-mute[Command for XF86AudioMicMute]"
"--cmd-power-off[Command for XF86PowerOff]"
"--cmd-power-sleep[Command for XF86Sleep]"
# Bar mode
Expand Down
5 changes: 4 additions & 1 deletion i3lock.1
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ passing them through:
.RS
.IP \[bu] 2
media - XF86AudioPlay, XF86AudioPause, XF86AudioStop, XF86AudioPrev,
XF86AudioNext, XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume
XF86AudioNext, XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume,
XF86AudioMicMute
.IP \[bu]
screen - XF86MonBrightnessUp, XF86MonBrightnessDown
.IP \[bu]
Expand Down Expand Up @@ -422,6 +423,8 @@ volume\-up - XF86AudioRaiseVolume
.IP \[bu]
volume\-down - XF86AudioLowerVolume
.IP \[bu]
mic\-mute - XF86AudioMicMute
.IP \[bu]
power\-down - XF86PowerDown
.IP \[bu]
power\-off - XF86PowerOff
Expand Down
12 changes: 12 additions & 0 deletions i3lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ char* cmd_media_prev = NULL;
char* cmd_audio_mute = NULL;
char* cmd_volume_up = NULL;
char* cmd_volume_down = NULL;
char* cmd_mic_mute = NULL;

char* cmd_power_down = NULL;
char* cmd_power_off = NULL;
Expand Down Expand Up @@ -784,6 +785,12 @@ static void handle_key_press(xcb_key_press_event_t *event) {
return;
}
break;
case XKB_KEY_XF86AudioMicMute:
if (cmd_mic_mute) {
system(cmd_mic_mute);
return;
}
break;
case XKB_KEY_XF86PowerDown:
if (cmd_power_down) {
system(cmd_power_down);
Expand Down Expand Up @@ -816,6 +823,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
case XKB_KEY_XF86AudioMute:
case XKB_KEY_XF86AudioLowerVolume:
case XKB_KEY_XF86AudioRaiseVolume:
case XKB_KEY_XF86AudioMicMute:
xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event);
return;
}
Expand Down Expand Up @@ -1674,6 +1682,7 @@ int main(int argc, char *argv[]) {
{"cmd-audio-mute", required_argument, NULL, 640},
{"cmd-volume-up", required_argument, NULL, 641},
{"cmd-volume-down", required_argument, NULL, 642},
{"cmd-mic-mute", required_argument, NULL, 643},

{"cmd-power-down", required_argument, NULL, 650},
{"cmd-power-off", required_argument, NULL, 651},
Expand Down Expand Up @@ -2276,6 +2285,9 @@ int main(int argc, char *argv[]) {
case 642:
cmd_volume_down = optarg;
break;
case 643:
cmd_mic_mute = optarg;
break;

case 650:
cmd_power_down = optarg;
Expand Down

0 comments on commit f1903bd

Please sign in to comment.