From 37a2725da41e363fcdca12d0374b192cd03905d0 Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Wed, 28 Jun 2023 21:24:59 +1200 Subject: feat: Added key chording Probably a hacky mess but oh well. Key chords can be done by seperating binds in string with ` `. You can set the quit bind with `quitkey`, default mod+g. (Chords also exited when pressing unbound keys). --- util.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'util.cpp') diff --git a/util.cpp b/util.cpp index dff3428..7fe5641 100644 --- a/util.cpp +++ b/util.cpp @@ -15,3 +15,10 @@ std::vector split (const string &s, char delim) { return result; } + +const string evNames[] = {"", "", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify", "GenericEvent", "LASTEvent"}; + +string getEventName(int e) +{ + return evNames[e]; +} -- cgit v1.2.3 From ea569d9c9c61eb26f7d325b41d8ac839dc470eec Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Tue, 15 Aug 2023 21:27:51 +1200 Subject: feat: Made the bind modes work Numlock still seems to mess with keybindings. Also switched from storing keybinds with KeySym to KeyCode --- util.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'util.cpp') diff --git a/util.cpp b/util.cpp index 7fe5641..58116d0 100644 --- a/util.cpp +++ b/util.cpp @@ -1,6 +1,7 @@ #include "util.h" #include +#include using std::string; @@ -22,3 +23,10 @@ string getEventName(int e) { return evNames[e]; } + +string lowercase(string s) +{ + string s2 = s; + std::transform(s2.begin(), s2.end(), s2.begin(), [](unsigned char c){ return std::tolower(c); }); + return s2; +} -- cgit v1.2.3