Skip to content

Commit

Permalink
Add mouse bindings for right third of status bar
Browse files Browse the repository at this point in the history
Default to play/volume.
  • Loading branch information
pgaskin committed Jul 16, 2023
1 parent afa2bdb commit 61296c8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 30 deletions.
61 changes: 32 additions & 29 deletions Doc/cmus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,35 +195,38 @@ commands in the COMMANDS section.

@h2 Common: Playback
@pre
b player-next
c player-pause
x player-play
z player-prev
v player-stop

B player-next-album
Z player-prev-album

] vol +0 +1%
[ vol +1% +0
+ vol +10%
= vol +10%
} vol -0 -1%
{ vol -1% -0
- vol -10%

, seek -1m
. seek +1m

h seek -5
l seek +5

left seek -5
right seek +5

mlb_click_bar player-pause
mouse_scroll_up_bar seek +5
mouse_scroll_down_bar seek -5
b player-next
c player-pause
x player-play
z player-prev
v player-stop

B player-next-album
Z player-prev-album

] vol +0 +1%
[ vol +1% +0
+ vol +10%
= vol +10%
} vol -0 -1%
{ vol -1% -0
- vol -10%

, seek -1m
. seek +1m

h seek -5
l seek +5

left seek -5
right seek +5

mlb_click_bar player-pause
mlb_click_bar_right player-pause
mouse_scroll_up_bar seek +5
mouse_scroll_down_bar seek -5
mouse_scroll_up_bar_right vol +1%
mouse_scroll_down_bar_right vol -1%
@endpre

@h2 Common: Setting Toggles
Expand Down
3 changes: 3 additions & 0 deletions data/rc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ bind common left seek -5
bind common right seek +5

bind common mlb_click_bar player-pause
bind common mlb_click_bar_right player-pause
bind common mouse_scroll_up_bar seek +5
bind common mouse_scroll_down_bar seek -5
bind common mouse_scroll_up_bar_right vol +1%
bind common mouse_scroll_down_bar_right vol -1%

# Setting toggles

Expand Down
13 changes: 12 additions & 1 deletion keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static const enum key_context view_to_context[] = {
#define KEY_M_TYPE_SEL (1<<3)
#define KEY_M_TYPE_BAR (2<<3)
#define KEY_M_TYPE_TIT (3<<3)
#define KEY_M_TYPE_BAR_R (4<<3)

#define KEY_MLB_CLICK 0
#define KEY_MRB_CLICK 1
Expand All @@ -71,6 +72,10 @@ static const enum key_context view_to_context[] = {
#define KEY_MRB_CLICK_BAR (KEY_MRB_CLICK|KEY_M_TYPE_BAR)
#define KEY_MSCRL_UP_BAR (KEY_MSCRL_UP|KEY_M_TYPE_BAR)
#define KEY_MSCRL_DOWN_BAR (KEY_MSCRL_DOWN|KEY_M_TYPE_BAR)
#define KEY_MLB_CLICK_BAR_R (KEY_MLB_CLICK|KEY_M_TYPE_BAR_R)
#define KEY_MRB_CLICK_BAR_R (KEY_MRB_CLICK|KEY_M_TYPE_BAR_R)
#define KEY_MSCRL_UP_BAR_R (KEY_MSCRL_UP|KEY_M_TYPE_BAR_R)
#define KEY_MSCRL_DOWN_BAR_R (KEY_MSCRL_DOWN|KEY_M_TYPE_BAR_R)
#define KEY_MLB_CLICK_TIT (KEY_MLB_CLICK|KEY_M_TYPE_TIT)
#define KEY_MRB_CLICK_TIT (KEY_MRB_CLICK|KEY_M_TYPE_TIT)
#define KEY_MSCRL_UP_TIT (KEY_MSCRL_UP|KEY_M_TYPE_TIT)
Expand Down Expand Up @@ -435,16 +440,20 @@ const struct key key_table[] = {
{ "mlb_click", KEY_MOUSE, KEY_MLB_CLICK },
{ "mlb_click_selected", KEY_MOUSE, KEY_MLB_CLICK_SEL },
{ "mlb_click_bar", KEY_MOUSE, KEY_MLB_CLICK_BAR },
{ "mlb_click_bar_right", KEY_MOUSE, KEY_MLB_CLICK_BAR_R },
{ "mlb_click_title", KEY_MOUSE, KEY_MLB_CLICK_TIT },
{ "mrb_click", KEY_MOUSE, KEY_MRB_CLICK },
{ "mrb_click_selected", KEY_MOUSE, KEY_MRB_CLICK_SEL },
{ "mrb_click_bar", KEY_MOUSE, KEY_MRB_CLICK_BAR },
{ "mrb_click_bar_right", KEY_MOUSE, KEY_MRB_CLICK_BAR_R },
{ "mrb_click_title", KEY_MOUSE, KEY_MRB_CLICK_TIT },
{ "mouse_scroll_up", KEY_MOUSE, KEY_MSCRL_UP },
{ "mouse_scroll_up_bar", KEY_MOUSE, KEY_MSCRL_UP_BAR },
{ "mouse_scroll_up_bar_right", KEY_MOUSE, KEY_MSCRL_UP_BAR_R },
{ "mouse_scroll_up_title", KEY_MOUSE, KEY_MSCRL_UP_TIT },
{ "mouse_scroll_down", KEY_MOUSE, KEY_MSCRL_DOWN },
{ "mouse_scroll_down_bar", KEY_MOUSE, KEY_MSCRL_DOWN_BAR },
{ "mouse_scroll_down_bar_right", KEY_MOUSE, KEY_MSCRL_DOWN_BAR_R },
{ "mouse_scroll_down_title", KEY_MOUSE, KEY_MSCRL_DOWN_TIT },
{ NULL, 0, 0 }
};
Expand Down Expand Up @@ -731,7 +740,9 @@ static const struct key *normal_mode_mouse_handle(MEVENT* event)
type = KEY_M_TYPE_TIT;
} else if (event->y == LINES - 2) {
need_sel = 0;
type = KEY_M_TYPE_BAR;
type = event->x >= (COLS - COLS/3)
? KEY_M_TYPE_BAR_R
: KEY_M_TYPE_BAR;
} else {
if (cur_view == TREE_VIEW) {
if (event->x >= track_win_x)
Expand Down

0 comments on commit 61296c8

Please sign in to comment.