use slightly nicer modifier names

This commit is contained in:
speedie 2023-04-29 23:03:42 +02:00
parent c3b9687e21
commit 844186af06
3 changed files with 72 additions and 125 deletions

View file

@ -1,106 +1,76 @@
/* These are all your keybinds.
/* These are all your hardcoded keybinds.
* It is recommended you set keybinds in ~/.config/spmenu/spmenu.conf instead.
*
* Types
*
* MODIFIER1 is what you defined below, default is Alt)
*
* SHIFT is unless changed going to be your Shift key.
* CONTROL is unless changed going to be your Control key.
* ALT unless changed is going to be your left Alt key.
* ALTR unless changed is going to be your right Alt key.
* SUPER unless changed is going to be your left Super (Windows/macOS Command) key.
* SUPERR unless changed is going to be your right Super (Windows/macOS Command) key.
*
* Example keybind:
*
* { -1, MODIFIER1, XK_1, myfunction, ${0} },
*
* Once you're done with your edits, run 'make clean install'.
* See https://spmenu.speedie.site/index.php/keybinds.h+documentation for more information.
*/
/* Modes
* -1: Any mode
* 0: Normal mode
* 1: Insert mode
*
* Switch mode by calling switchmode
*/
/* Modifier keys
* Mod4Mask | Super (Windows/command) key
* Mod1Mask | Alt key
*
* NOTE: You do NOT want this to be the same as your window manager modifier.
*/
#define MODIFIER1 Mod1Mask
static Key keys[] = {
/* mode modifier key function argument
/* mode modifier key function argument
*
* any mode
*/
{ -1, 0, XK_Return, selectitem, {.i = +1 } },
{ -1, SHIFT, XK_Return, selectitem, {0} },
{ -1, 0, XK_Tab, complete, {0} },
{ -1, CONTROL, XK_v, paste, {.i = 2 } },
{ -1, CONTROL|SHIFT, XK_v, paste, {.i = 1 } },
{ -1, 0, XK_BackSpace, backspace, {0} },
{ -1, CONTROL, XK_BackSpace, deleteword, {0} },
{ -1, CONTROL, XK_Left, moveword, {.i = -1 } },
{ -1, CONTROL, XK_Right, moveword, {.i = +1 } },
{ -1, 0, XK_Left, movecursor, {.i = -1 } },
{ -1, 0, XK_Right, movecursor, {.i = +1 } },
{ -1, CONTROL|SHIFT, XK_p, setprofile, {0} },
{ -1, 0, XK_Return, selectitem, {.i = +1 } },
{ -1, Shift, XK_Return, selectitem, {0} },
{ -1, 0, XK_Tab, complete, {0} },
{ -1, Ctrl, XK_v, paste, {.i = 2 } },
{ -1, Ctrl|Shift, XK_v, paste, {.i = 1 } },
{ -1, 0, XK_BackSpace, backspace, {0} },
{ -1, Ctrl, XK_BackSpace, deleteword, {0} },
{ -1, Ctrl, XK_Left, moveword, {.i = -1 } },
{ -1, Ctrl, XK_Right, moveword, {.i = +1 } },
{ -1, 0, XK_Left, movecursor, {.i = -1 } },
{ -1, 0, XK_Right, movecursor, {.i = +1 } },
{ -1, Ctrl|Shift, XK_p, setprofile, {0} },
/* normal mode */
{ 0, 0, XK_i, switchmode, {0} },
{ 0, 0, XK_slash, switchmode, {0} },
{ 0, CONTROL, XK_equal, setimgsize, {.i = +1 } },
{ 0, CONTROL, XK_minus, setimgsize, {.i = -1 } },
{ 0, 0, XK_equal, setimgsize, {.i = +10 } },
{ 0, 0, XK_minus, setimgsize, {.i = -10 } },
{ 0, SHIFT, XK_equal, setimgsize, {.i = +100 } },
{ 0, SHIFT, XK_minus, setimgsize, {.i = -100 } },
{ 0, SHIFT, XK_0, defaultimg, {0} },
{ 0, 0, XK_r, rotateimg, {0} },
{ 0, 0, XK_p, setimgpos, {.i = +1 } },
{ 0, CONTROL, XK_1, setimggaps, {.i = -1 } },
{ 0, CONTROL, XK_2, setimggaps, {.i = +1 } },
{ 0, 0, XK_1, setimggaps, {.i = -10 } },
{ 0, 0, XK_2, setimggaps, {.i = +10 } },
{ 0, SHIFT, XK_1, setimggaps, {.i = -100 } },
{ 0, SHIFT, XK_2, setimggaps, {.i = +100 } },
{ 0, 0, XK_t, toggleimg, {0} },
{ 0, 0, XK_h, flipimg, {.i = 1 } },
{ 0, 0, XK_v, flipimg, {.i = 0 } },
{ 0, 0, XK_k, moveup, {0} },
{ 0, 0, XK_j, movedown, {0} },
{ 0, 0, XK_h, moveleft, {0} },
{ 0, 0, XK_l, moveright, {0} },
{ 0, CONTROL, XK_u, moveup, {.i = 5 } },
{ 0, CONTROL, XK_d, movedown, {.i = 5 } },
{ 0, CONTROL, XK_k, setlines, {.i = +1 } },
{ 0, CONTROL, XK_j, setlines, {.i = -1 } },
{ 0, CONTROL|ALT|SHIFT, XK_k, setlines, {.i = +5 } },
{ 0, CONTROL|ALT|SHIFT, XK_j, setlines, {.i = -5 } },
{ 0, CONTROL, XK_h, setcolumns, {.i = +1 } },
{ 0, CONTROL, XK_l, setcolumns, {.i = -1 } },
{ 0, CONTROL|ALT|SHIFT, XK_h, setcolumns, {.i = +5 } },
{ 0, CONTROL|ALT|SHIFT, XK_l, setcolumns, {.i = -5 } },
{ 0, 0, XK_u, togglehighlight, {0} },
{ 0, CONTROL|SHIFT, XK_h, viewhist, {0} },
{ 0, 0, XK_d, clear, {0} },
{ 0, 0, XK_c, clearins, {0} },
{ 0, 0, XK_Escape, quit, {0} },
{ 0, 0, XK_Home, movestart, {0} },
{ 0, 0, XK_End, moveend, {0} },
{ 0, 0, XK_g, movestart, {0} },
{ 0, SHIFT, XK_g, moveend, {0} },
{ 0, 0, XK_Next, movenext, {0} },
{ 0, 0, XK_Prior, moveprev, {0} },
{ 0, MODIFIER1, XK_p, navhistory, {.i = -1 } },
{ 0, MODIFIER1, XK_n, navhistory, {.i = +1 } },
{ 0, 0, XK_i, switchmode, {0} },
{ 0, 0, XK_slash, switchmode, {0} },
{ 0, Ctrl, XK_equal, setimgsize, {.i = +1 } },
{ 0, Ctrl, XK_minus, setimgsize, {.i = -1 } },
{ 0, 0, XK_equal, setimgsize, {.i = +10 } },
{ 0, 0, XK_minus, setimgsize, {.i = -10 } },
{ 0, Shift, XK_equal, setimgsize, {.i = +100 } },
{ 0, Shift, XK_minus, setimgsize, {.i = -100 } },
{ 0, Shift, XK_0, defaultimg, {0} },
{ 0, 0, XK_r, rotateimg, {0} },
{ 0, 0, XK_p, setimgpos, {.i = +1 } },
{ 0, Ctrl, XK_1, setimggaps, {.i = -1 } },
{ 0, Ctrl, XK_2, setimggaps, {.i = +1 } },
{ 0, 0, XK_1, setimggaps, {.i = -10 } },
{ 0, 0, XK_2, setimggaps, {.i = +10 } },
{ 0, Shift, XK_1, setimggaps, {.i = -100 } },
{ 0, Shift, XK_2, setimggaps, {.i = +100 } },
{ 0, 0, XK_t, toggleimg, {0} },
{ 0, 0, XK_h, flipimg, {.i = 1 } },
{ 0, 0, XK_v, flipimg, {.i = 0 } },
{ 0, 0, XK_k, moveup, {0} },
{ 0, 0, XK_j, movedown, {0} },
{ 0, 0, XK_h, moveleft, {0} },
{ 0, 0, XK_l, moveright, {0} },
{ 0, Ctrl, XK_u, moveup, {.i = 5 } },
{ 0, Ctrl, XK_d, movedown, {.i = 5 } },
{ 0, Ctrl, XK_k, setlines, {.i = +1 } },
{ 0, Ctrl, XK_j, setlines, {.i = -1 } },
{ 0, Ctrl|Alt|Shift, XK_k, setlines, {.i = +5 } },
{ 0, Ctrl|Alt|Shift, XK_j, setlines, {.i = -5 } },
{ 0, Ctrl, XK_h, setcolumns, {.i = +1 } },
{ 0, Ctrl, XK_l, setcolumns, {.i = -1 } },
{ 0, Ctrl|Alt|Shift, XK_h, setcolumns, {.i = +5 } },
{ 0, Ctrl|Alt|Shift, XK_l, setcolumns, {.i = -5 } },
{ 0, 0, XK_u, togglehighlight, {0} },
{ 0, Ctrl|Shift, XK_h, viewhist, {0} },
{ 0, 0, XK_d, clear, {0} },
{ 0, 0, XK_c, clearins, {0} },
{ 0, 0, XK_Escape, quit, {0} },
{ 0, 0, XK_Home, movestart, {0} },
{ 0, 0, XK_End, moveend, {0} },
{ 0, 0, XK_g, movestart, {0} },
{ 0, Shift, XK_g, moveend, {0} },
{ 0, 0, XK_Next, movenext, {0} },
{ 0, 0, XK_Prior, moveprev, {0} },
{ 0, Alt, XK_p, navhistory, {.i = -1 } },
{ 0, Alt, XK_n, navhistory, {.i = +1 } },
/* insert mode */
{ 1, 0, XK_Escape, switchmode, {0} },
{ 1, 0, XK_Escape, switchmode, {0} },
};

View file

@ -15,12 +15,9 @@
#define MAXITEMLENGTH 1024
// user friendly names for all the modifiers we're using, but there are many more
#define CONTROL ControlMask
#define SHIFT ShiftMask
#define ALT Mod1Mask
#define ALTR Mod3Mask
#define SUPER Mod4Mask
#define SUPERR Mod5Mask
// for running stuff
#define shell "/bin/sh"
#define Ctrl ControlMask
#define Shift ShiftMask
#define Alt Mod1Mask
#define AltGr Mod3Mask
#define Super Mod4Mask
#define ShiftGr Mod5Mask

24
mouse.h
View file

@ -1,26 +1,6 @@
/* Mouse bindings
*
* This header contains mouse binds.
* Change them or remove them if you prefer. You can also add more if you want.
*
* clickwindow: - spmenu window/client
* clickinput: - Input box
* clickprompt: - Prompt
* clicklarrow: - Left arrow
* clickitem: - Item
* clickselitem: - Item hovered over (function doesn't matter, this will always select the item)
* clickrarrow: - Right arrow
* clicknumber: - Match count
* clickmode: - Mode indicator
* clickcaps: - Caps lock indicator
*
* Button1 - Left click
* Button2 - Middle click
* Button3 - Right click
* Button4 - Scroll up
* Button5 - Scroll down
*
* Note that clicking on an item will select it, as of now it's hardcoded.
* These are all your hardcoded mouse bindings. It is recommended you set these in ~/.config/spmenu/spmenu.conf though.
* See https://spmenu.speedie.site/index.php/mouse.h+documentation for more information.
*/
static Mouse buttons[] = {