added ability to close window by right clicking

This commit is contained in:
Rachel Lambda Samuelsson 2021-02-04 21:14:22 +01:00
parent 33d532d670
commit 6ed073347e
2 changed files with 16 additions and 11 deletions

View File

@ -38,7 +38,7 @@ These options can also be configured in the enviorment variables `MPDART_DIR`, `
To make these changes persistent, export them in your `~/.profile`. To make these changes persistent, export them in your `~/.profile`.
Once mpdart is running you can press the window to toggle mpd's pause/play. Once mpdart is running you can left click the window to toggle mpd's pause/play or right click it to close it.
Contributing Contributing
------------ ------------

View File

@ -450,19 +450,24 @@ int main(int argc, char** argv) {
/* toggle pause on press */ /* toggle pause on press */
case ButtonPress: case ButtonPress:
if (ev.xbutton.button == Button1) { switch (ev.xbutton.button) {
case Button1:
DEBUG("Toggling pause\n");
DEBUG("Toggling pause\n"); mpd_run_noidle(connection);
mpd_check_error();
mpd_run_noidle(connection); /* deprecated but they provide nothing better so fuck them */
mpd_check_error(); mpd_run_toggle_pause(connection);
mpd_check_error();
/* deprecated but they provide nothing better so fuck them */ mpd_send_idle_mask(connection, MPD_IDLE_PLAYER);
mpd_run_toggle_pause(connection); mpd_check_error();
mpd_check_error(); break;
case Button3:
mpd_send_idle_mask(connection, MPD_IDLE_PLAYER); DEBUG("Exiting due to MB2 pree");
mpd_check_error(); exit(0);
break;
} }
break; break;