summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h6
-rw-r--r--dwl.c24
2 files changed, 22 insertions, 8 deletions
diff --git a/config.def.h b/config.def.h
index 04c0e41..1782f12 100644
--- a/config.def.h
+++ b/config.def.h
@@ -192,6 +192,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_m, XKB_KEY_v, spawn, SHCMD("menu-video") },
{ MODKEY, XKB_KEY_m, XKB_KEY_w, spawn, SHCMD("menu-weather") },
{ MODKEY, XKB_KEY_m, XKB_KEY_s, spawn, SHCMD("menu-symbols") },
+ { MODKEY, XKB_KEY_m, XKB_KEY_m, spawn, SHCMD("menu-mpvhist") },
/* Media */
{ MODKEY|CTRL, -1, XKB_KEY_v, spawn, {.v = volume_mute } },
@@ -203,8 +204,8 @@ static const Key keys[] = {
{ 0, -1, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = volume_raise } },
{ 0, -1, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = volume_lower } },
{ 0, -1, XKB_KEY_XF86AudioMicMute, spawn, SHCMD("mic mute") },
- { 0, -1, XKB_KEY_XF86RotateWindows, spawn, SHCMD("warrelroll flip") },
- { 0, -1, XKB_KEY_XF86TaskPane, spawn, SHCMD("warrelroll rotate") },
+ { 0, -1, XKB_KEY_XF86RotateWindows, spawn, SHCMD("warrelroll flip"), 1, 0, 0 },
+ { 0, -1, XKB_KEY_XF86TaskPane, spawn, SHCMD("warrelroll rotate"), 1, 0, 0 },
{ 0, -1, XKB_KEY_XF86ScreenSaver, spawn, SHCMD("lock") },
{ 0, -1, XKB_KEY_XF86MonBrightnessUp, spawn, SHCMD("lampe raise") },
{ 0, -1, XKB_KEY_XF86MonBrightnessDown, spawn, SHCMD("lampe lower") },
@@ -213,6 +214,7 @@ static const Key keys[] = {
{ 0, -1, XKB_KEY_XF86AudioMedia, spawn, SHCMD("playerctl play-pause") },
{ 0, -1, XKB_KEY_XF86AudioPlay, spawn, SHCMD("playerctl play-pause") },
{ 0, -1, XKB_KEY_XF86AudioPause, spawn, SHCMD("playerctl play-pause") },
+ { 0, -1, XKB_KEY_XF86AudioStop, spawn, SHCMD("playerctl pause") },
{ 0, -1, XKB_KEY_XF86AudioPrev, spawn, SHCMD("playerctl previous") },
{ 0, -1, XKB_KEY_XF86AudioNext, spawn, SHCMD("playerctl next") },
diff --git a/dwl.c b/dwl.c
index f8e9fef..75453a5 100644
--- a/dwl.c
+++ b/dwl.c
@@ -160,6 +160,10 @@ typedef struct {
xkb_keysym_t keysym;
void (*func)(const Arg *);
const Arg arg;
+
+ int on_press;
+ int on_repeat;
+ int on_release;
} Key;
typedef struct {
@@ -315,7 +319,7 @@ static int hidecursor(void *data);
static void handlesig(int signo);
static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data);
-static int keybinding(uint32_t mods, xkb_keysym_t sym);
+static int keybinding(uint32_t mods, xkb_keysym_t sym, int on_press, int on_repeat, int on_release);
static void keypress(struct wl_listener *listener, void *data);
static void keypressmod(struct wl_listener *listener, void *data);
static int keyrepeat(void *data);
@@ -1710,7 +1714,7 @@ inputdevice(struct wl_listener *listener, void *data)
}
int
-keybinding(uint32_t mods, xkb_keysym_t sym)
+keybinding(uint32_t mods, xkb_keysym_t sym, int on_press, int on_repeat, int on_release)
{
/*
* Here we handle compositor keybindings. This is when the compositor is
@@ -1724,8 +1728,14 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
&& chainkey == -1
&& k->chain == -1
&& k->func) {
- k->func(&k->arg);
- return 1;
+ if ((k->on_press == 0 && k->on_repeat == 0 && k->on_release == 0) ||
+ (on_press && k->on_press) ||
+ (on_repeat && k->on_repeat) ||
+ (on_release && k->on_release)
+ ) {
+ k->func(&k->arg);
+ return 1;
+ }
}
else if (sym == k->keysym
&& chainkey != -1
@@ -1771,7 +1781,8 @@ keypress(struct wl_listener *listener, void *data)
* attempt to process a compositor keybinding. */
if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
for (i = 0; i < nsyms; i++)
- handled = keybinding(mods, syms[i]) || handled;
+ handled = keybinding(mods, syms[i], event->state == WL_KEYBOARD_KEY_STATE_PRESSED, 0, event->state == WL_KEYBOARD_KEY_STATE_RELEASED) || handled;
+
}
if (handled && group->wlr_group->keyboard.repeat_info.delay > 0) {
@@ -1819,7 +1830,8 @@ keyrepeat(void *data)
1000 / group->wlr_group->keyboard.repeat_info.rate);
for (i = 0; i < group->nsyms; i++)
- keybinding(group->mods, group->keysyms[i]);
+ keybinding(group->mods, group->keysyms[i], 0, 1, 0);
+
return 0;
}