diff --git a/.gitignore b/.gitignore index a745c34..5c28541 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,4 @@ dwl *.o *-protocol.c *-protocol.h -*.orig -*.rej .ccls-cache diff --git a/README.md b/README.md index 43c22b3..12fd86c 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,9 @@ philosophy. Like dwm, dwl is: - [bar](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar) - [barheight](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/barheight) - [cursortheme](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/cursortheme) -- [en-keycodes](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/en-keycodes) - [genericgaps](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/genericgaps/) -- [hide_vacant_tags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/hide_vacant_tags) -- [inputdevicerules](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/inputdevicerules) -- [rotatetags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/rotatetags) - [setupenv](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/setupenv) - [sticky](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/sticky) -- [xkb-rules-switcher](https://codeberg.org/wochap/dwl/src/branch/v0.6-b/xkb-rules-switcher/xkb-rules-switcher.patch) ## Getting Started: diff --git a/config.def.h b/config.def.h index c0db1c8..9aae076 100644 --- a/config.def.h +++ b/config.def.h @@ -29,13 +29,6 @@ static uint32_t colors[][3] = { [SchemeUrg] = { 0, 0, 0x770000ff }, }; -enum { - VIEW_L = -1, - VIEW_R = 1, - SHIFT_L = -2, - SHIFT_R = 2, -} RotateTags; - /* tagging - TAGCOUNT must be no greater than 31 */ static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; @@ -87,28 +80,12 @@ static const MonitorRule monrules[] = { }; /* keyboard */ -static const struct xkb_rule_names xkb_rules[] = { - { - /* can specify fields: rules, model, layout, variant, options */ - .layout = "us", - .options = NULL, - }, - { - .layout = "us", - .options = "compose:ralt", - }, -}; - -/* input devices */ -static const InputRule inputrules[] = { - /* name kbcreate ptrcreate */ - /* ignore bad device - like a touchpad ;) */ - { "BAD DEVICE", NULL, NULL }, - /* ungroup ydotool device - fixes a bug */ - { "ydotoold virtual device", createungroupedkeyboard, createpointer }, - /* put your touchpad name here to enable toggle touchpad */ - { "Elan Touchpad", createkeyboard, createtogglepointer }, - { NULL, createkeyboard, createpointer }, +static const struct xkb_rule_names xkb_rules = { + /* can specify fields: rules, model, layout, variant, options */ + /* example: + .options = "ctrl:nocaps", + */ + .options = NULL, }; static const int repeat_rate = 25; @@ -182,11 +159,7 @@ static const Key keys[] = { { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_i, incnmaster, {.i = -1} }, - { MODKEY, XKB_KEY_a, rotatetags, {.i = VIEW_L} }, - { MODKEY, XKB_KEY_d, rotatetags, {.i = VIEW_R} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_a, rotatetags, {.i = SHIFT_L} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_d, rotatetags, {.i = SHIFT_R} }, + { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} }, { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } }, @@ -214,14 +187,12 @@ static const Key keys[] = { { MODKEY, XKB_KEY_space, setlayout, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} }, { MODKEY, XKB_KEY_e, togglefullscreen, {0} }, - { MODKEY, XKB_KEY_u, togglepointer, {0} }, { MODKEY, XKB_KEY_0, view, {.ui = ~0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} }, - { MODKEY, XKB_KEY_w, switchxkbrule, {0} }, TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0), TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1), TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2), diff --git a/config.h b/config.h index 2ea2c50..acdcbf2 100644 --- a/config.h +++ b/config.h @@ -10,24 +10,17 @@ static const unsigned int gappih = 4; /* horiz inner gap between windo static const unsigned int gappiv = 4; /* vert inner gap between windows */ static const unsigned int gappoh = 1; /* horiz outer gap between windows and screen edge */ static const unsigned int gappov = 1; /* vert outer gap between windows and screen edge */ -static const char *cursor_theme = "macOS"; -static const char cursor_size[] = "28"; /* Make sure it's a valid integer, otherwise things will break */ -static const int user_bh = 30; /* 0 means that dwl will calculate barheight, >= 1 means dwl will use user_bh as the bar height. */ +static const char *cursor_theme = "Adwaita"; +static const char cursor_size[] = "24"; /* Make sure it's a valid integer, otherwise things will break */ +static const int user_bh = 30; /* 0 means that dwl will calculate barheight, >= 1 means dwl will use user_bh as the bar height. */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const char *fonts[] = {"inconsolata:size=11"}; /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */ -enum { - VIEW_L = -1, - VIEW_R = 1, - SHIFT_L = -2, - SHIFT_R = 2, -} RotateTags; - /* tagging - TAGCOUNT must be no greater than 31 */ -static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8" }; +static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; /* logging */ static int log_level = WLR_ERROR; @@ -36,19 +29,22 @@ static int log_level = WLR_ERROR; static const Env envs[] = { /* variable value */ { "XDG_CURRENT_DESKTOP", "wlroots" }, + { "QT_QPA_PLATFORM", "wayland" }, + { "QT_QPA_PLATFORMTHEME", "qt6ct" }, }; /* Autostart */ static const char *const autostart[] = { - "/usr/lib/xdg-desktop-portal", "-r", NULL, - "/usr/lib/xdg-desktop-portal-wlr", "-r", NULL, - "wbg", WALLPAPER, NULL, - "foot", "--server", NULL, - "swayidle", NULL, - "mako", NULL, - NULL /* terminate */ + "wbg", "/home/amolinae/Pictures/Wallpapers/highsierra-grey.jpg", NULL, + "foot", "--server", NULL, + "swayidle", NULL, + "mako", NULL, + "gnome-keyring-daemon", "--start", "--components=secrets", NULL, + "/usr/bin/lxqt-policykit-agent", NULL, + NULL /* terminate */ }; + /* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */ static const Rule rules[] = { /* app_id title tags mask isfloating monitor */ @@ -81,28 +77,13 @@ static const MonitorRule monrules[] = { }; /* keyboard */ -static const struct xkb_rule_names xkb_rules[] = { - { - /* can specify fields: rules, model, layout, variant, options */ - .layout = "latam", - .options = NULL, - }, - { - .layout = "us", - .options = NULL, - }, -}; - -/* input devices */ -static const InputRule inputrules[] = { - /* name kbcreate ptrcreate */ - /* ignore bad device - like a touchpad ;) */ - { "BAD DEVICE", NULL, NULL }, - /* ungroup ydotool device - fixes a bug */ - { "ydotoold virtual device", createungroupedkeyboard, createpointer }, - /* put your touchpad name here to enable toggle touchpad */ - { "Elan Touchpad", createkeyboard, createtogglepointer }, - { NULL, createkeyboard, createpointer }, +static const struct xkb_rule_names xkb_rules = { + /* can specify fields: rules, model, layout, variant, options */ + /* example: + .options = "ctrl:nocaps", + */ + .layout = "latam", + .options = NULL, }; static const int repeat_rate = 25; @@ -165,14 +146,11 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA /* commands */ static const char *termcmd[] = { "footclient", NULL }; // Terminal -static const char *menucmd[] = { "tofi-drun", NULL }; // Application launcher -static const char *fmgrcmd[] = { "footclient", "--title", "lf", "lf", NULL }; // File manager -static const char *sptfcmd[] = { "footclient", "--title", "Spotify", "spotify_player", NULL }; // Spotify client -static const char *ncmxcmd[] = { "footclient", "--title", "ncpamixer", "ncpamixer", NULL }; // Volume control -static const char *blthcmd[] = { "footclient", "--title", "bluetui", "bluetui", NULL }; // Bluetooth manager -static const char *lockcmd[] = { "swaylock", NULL }; // Launch swaylock -static const char *pwmncmd[] = { "powermenu", NULL }; // Launch powermenu -static const char *emojcmd[] = { "tofiunicode", NULL }; // Launch emoji menu +static const char *menucmd[] = { "tofi-drun", NULL }; // Application launcher +static const char *fmgrcmd[] = { "pcmanfm-qt", NULL }; // File manager +static const char *lockcmd[] = { "swaylock", NULL }; // Launch swaylock +static const char *pwmncmd[] = { "powermenu", NULL }; // Launch powermenu +static const char *emojcmd[] = { "tofiunicode",NULL }; // Launch emoji menu static const Key keys[] = { /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */ @@ -180,13 +158,10 @@ static const Key keys[] = { { MODKEY, XKB_KEY_r, spawn, {.v = menucmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, { MODKEY, XKB_KEY_e, spawn, {.v = fmgrcmd} }, - { MODKEY, XKB_KEY_s, spawn, {.v = sptfcmd} }, - { MODKEY, XKB_KEY_b, spawn, {.v = blthcmd} }, - { MODKEY, XKB_KEY_v, spawn, {.v = ncmxcmd} }, { MODKEY, XKB_KEY_l, spawn, {.v = lockcmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_E, spawn, {.v = emojcmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, spawn, {.v = pwmncmd} }, - { 0, XKB_KEY_XF86AudioMicMute, spawn,SHCMD("setvol -m mute") }, + { 0, XKB_KEY_XF86AudioMicMute, spawn,SHCMD("setvol -m mute") }, { WLR_MODIFIER_SHIFT, XKB_KEY_XF86AudioLowerVolume, spawn,SHCMD("setvol -m down") }, { WLR_MODIFIER_SHIFT, XKB_KEY_XF86AudioRaiseVolume, spawn,SHCMD("setvol -m up") }, { 0, XKB_KEY_XF86AudioMute, spawn,SHCMD("setvol mute") }, @@ -194,19 +169,14 @@ static const Key keys[] = { { 0, XKB_KEY_XF86AudioRaiseVolume, spawn,SHCMD("setvol up") }, { 0, XKB_KEY_XF86MonBrightnessUp, spawn,SHCMD("setbrightness increase")}, { 0, XKB_KEY_XF86MonBrightnessDown,spawn,SHCMD("setbrightness decrease")}, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_B, togglebar, {0} }, + { MODKEY, XKB_KEY_b, togglebar, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_S, togglesticky, {0} }, { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_A, incnmaster, {.i = -1} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, incnmaster, {.i = +1} }, - { MODKEY, XKB_KEY_a, rotatetags, {.i = VIEW_L} }, - { MODKEY, XKB_KEY_d, rotatetags, {.i = VIEW_R} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_A, rotatetags, {.i = SHIFT_L} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, rotatetags, {.i = SHIFT_R} }, { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_a, setmfact, {.f = -0.05f} }, { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_d, setmfact, {.f = +0.05f} }, - { MODKEY, XKB_KEY_w, switchxkbrule, {0} }, /* { MODKEY, XKB_KEY_h, incgaps, {.i = +1 } }, { MODKEY, XKB_KEY_l, incgaps, {.i = -1 } }, @@ -237,9 +207,8 @@ static const Key keys[] = { { MODKEY, XKB_KEY_space, setlayout, {0} }, */ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_F, togglefullscreen, {0} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_U, togglepointer, {0} }, - /* + { MODKEY, XKB_KEY_e, togglefullscreen, {0} }, + /* { MODKEY, XKB_KEY_0, view, {.ui = ~0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, @@ -248,8 +217,8 @@ static const Key keys[] = { { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_colon, tagmon, {.i = WLR_DIRECTION_RIGHT} }, */ TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0), - TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1), - TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2), + TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1), + TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2), TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3), TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4), TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5), diff --git a/config.mk b/config.mk index e2f1816..c3f6317 100644 --- a/config.mk +++ b/config.mk @@ -24,11 +24,11 @@ WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19` # -I$(PWD)/wlroots/0.19/include/wlroots-0.19 #WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/0.19/lib64 -L$(PWD)/wlroots/0.19/lib64 -lwlroots-0.19 -XWAYLAND = -XLIBS = +#XWAYLAND = +#XLIBS = # Uncomment to build XWayland support -#XWAYLAND = -DXWAYLAND -#XLIBS = xcb xcb-icccm +XWAYLAND = -DXWAYLAND +XLIBS = xcb xcb-icccm # dwl itself only uses C99 features, but wlroots' headers use anonymous unions (C11). # To avoid warnings about them, we do not use -std=c99 and instead of using the diff --git a/dwl.c b/dwl.c index 922b921..b2c1361 100644 --- a/dwl.c +++ b/dwl.c @@ -152,12 +152,6 @@ typedef struct { uint32_t resize; /* configure serial of a pending resize */ } Client; -typedef struct { - const char *name; - void (*kbcreate)(struct wlr_keyboard *); - void (*ptrcreate)(struct wlr_pointer *); -} InputRule; - typedef struct { uint32_t mod; xkb_keysym_t keysym; @@ -318,8 +312,6 @@ static void createnotify(struct wl_listener *listener, void *data); static void createpointer(struct wlr_pointer *pointer); static void createpointerconstraint(struct wl_listener *listener, void *data); static void createpopup(struct wl_listener *listener, void *data); -static void createtogglepointer(struct wlr_pointer *pointer); -static void createungroupedkeyboard(struct wlr_keyboard *keyboard); static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint); static void cursorframe(struct wl_listener *listener, void *data); static void cursorwarptohint(void); @@ -397,7 +389,6 @@ static void setup(void); static void spawn(const Arg *arg); static void startdrag(struct wl_listener *listener, void *data); static int statusin(int fd, unsigned int mask, void *data); -static void switchxkbrule(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tile(Monitor *m); @@ -405,7 +396,6 @@ static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void togglesticky(const Arg *arg); static void togglefullscreen(const Arg *arg); -static void togglepointer(const Arg *arg); static void togglegaps(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); @@ -423,7 +413,6 @@ static Monitor *xytomon(double x, double y); static void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, LayerSurface **pl, double *nx, double *ny); static void zoom(const Arg *arg); -static void rotatetags(const Arg *arg); /* variables */ static pid_t child_pid = -1; @@ -472,7 +461,6 @@ static struct wl_listener lock_listener = {.notify = locksession}; static struct wlr_seat *seat; static KeyboardGroup *kb_group; static unsigned int cursor_mode; -static unsigned int xkb_rule_index = 0; static Client *grabc; static int grabcx, grabcy; /* client-relative */ @@ -493,14 +481,6 @@ static const struct wlr_buffer_impl buffer_impl = { static int enablegaps = 1; /* enables gaps, used by togglegaps */ static void (*resize)(Client *c, struct wlr_box geo, int interact) = resizeapply; -static const struct xkb_rule_names en_rules = {.layout = "us"}; -static struct xkb_context *en_context; -static struct xkb_keymap *en_keymap; -static struct xkb_state *en_state, *en_state_shift; -static xkb_mod_index_t en_shift; - -static struct libinput_device *togglepointerdevice = NULL; - #ifdef XWAYLAND static void activatex11(struct wl_listener *listener, void *data); static void associatex11(struct wl_listener *listener, void *data); @@ -823,7 +803,7 @@ bufrelease(struct wl_listener *listener, void *data) void buttonpress(struct wl_listener *listener, void *data) { - unsigned int i = 0, x = 0, occ = 0; + unsigned int i = 0, x = 0; double cx; unsigned int click; struct wlr_pointer_button_event *event = data; @@ -853,16 +833,9 @@ buttonpress(struct wl_listener *listener, void *data) (node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) && (buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) { cx = (cursor->x - selmon->m.x) * selmon->wlr_output->scale; - wl_list_for_each(c, &clients, link) { - if (c->mon != selmon) - continue; - occ |= c->tags == TAGMASK ? 0 : c->tags; - } - do { - if (!(occ & 1 << i || selmon->tagset[selmon->seltags] & 1 << i)) - continue; + do x += TEXTW(selmon, tags[i]); - } while (cx >= x && ++i < LENGTH(tags)); + while (cx >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; @@ -964,10 +937,6 @@ cleanup(void) wlr_backend_destroy(backend); wl_display_destroy(dpy); - xkb_state_unref(en_state); - xkb_state_unref(en_state_shift); - xkb_keymap_unref(en_keymap); - xkb_context_unref(en_context); /* Destroy after the wayland display (when the monitors are already destroyed) to avoid destroying them with an invalid scene output. */ wlr_scene_node_destroy(&scene->tree.node); @@ -1178,7 +1147,7 @@ createkeyboardgroup(void) /* Prepare an XKB keymap and assign it to the keyboard group. */ context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); - if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules[xkb_rule_index], + if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules, XKB_KEYMAP_COMPILE_NO_FLAGS))) die("failed to compile keymap"); @@ -1430,33 +1399,6 @@ createpopup(struct wl_listener *listener, void *data) LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup); } -void -createtogglepointer(struct wlr_pointer *pointer) -{ - struct libinput_device *device; - - createpointer(pointer); - - if (wlr_input_device_is_libinput(&pointer->base) - && (device = wlr_libinput_get_device_handle(&pointer->base))) { - togglepointerdevice = device; - } -} - -void -createungroupedkeyboard(struct wlr_keyboard *keyboard) -{ - /* for keyboards that need their own keyboard group */ - KeyboardGroup *group = createkeyboardgroup(); - - /* Set the keymap to match the group keymap */ - wlr_keyboard_set_keymap(keyboard, group->wlr_group->keyboard.keymap); - LISTEN(&keyboard->base.events.destroy, &group->destroy, destroykeyboardgroup); - - /* Add the new keyboard to the group */ - wlr_keyboard_group_add_keyboard(group->wlr_group, keyboard); -} - void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint) { @@ -1691,18 +1633,20 @@ drawbar(Monitor *m) wl_list_for_each(c, &clients, link) { if (c->mon != m) continue; - occ |= c->tags == TAGMASK ? 0 : c->tags; + occ |= c->tags; if (c->isurgent) urg |= c->tags; } x = 0; c = focustop(m); for (i = 0; i < LENGTH(tags); i++) { - if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) - continue; w = TEXTW(m, tags[i]); drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i); + if (occ & 1 << i) + drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, + m == selmon && c && c->tags & 1 << i, + urg & 1 << i); x += w; } w = TEXTW(m, m->ltsymbol); @@ -2021,27 +1965,13 @@ inputdevice(struct wl_listener *listener, void *data) * available. */ struct wlr_input_device *device = data; uint32_t caps; - const InputRule *r; switch (device->type) { case WLR_INPUT_DEVICE_KEYBOARD: - for (r = inputrules; r < END(inputrules); r++) { - if (!r->name || strstr(device->name, r->name)) { - if (r->kbcreate) - r->kbcreate(wlr_keyboard_from_input_device(device)); - break; - } - } - + createkeyboard(wlr_keyboard_from_input_device(device)); break; case WLR_INPUT_DEVICE_POINTER: - for (r = inputrules; r < END(inputrules); r++) { - if (!r->name || strstr(device->name, r->name)) { - if (r->ptrcreate) - r->ptrcreate(wlr_pointer_from_input_device(device)); - break; - } - } + createpointer(wlr_pointer_from_input_device(device)); break; default: /* TODO handle other input device types */ @@ -2089,10 +2019,8 @@ keypress(struct wl_listener *listener, void *data) uint32_t keycode = event->keycode + 8; /* Get a list of keysyms based on the keymap for this keyboard */ const xkb_keysym_t *syms; - int shift = xkb_state_mod_index_is_active( - group->wlr_group->keyboard.xkb_state, en_shift, XKB_STATE_MODS_EFFECTIVE); int nsyms = xkb_state_key_get_syms( - shift ? en_state_shift : en_state, keycode, &syms); + group->wlr_group->keyboard.xkb_state, keycode, &syms); int handled = 0; uint32_t mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard); @@ -3077,13 +3005,6 @@ setup(void) * pointer, touch, and drawing tablet device. We also rig up a listener to * let us know when new input devices are available on the backend. */ - en_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); - en_keymap = xkb_keymap_new_from_names(en_context, &en_rules, - XKB_KEYMAP_COMPILE_NO_FLAGS); - en_state = xkb_state_new(en_keymap); - en_state_shift = xkb_state_new(en_keymap); - en_shift = xkb_keymap_mod_get_index(en_keymap, XKB_MOD_NAME_SHIFT); - xkb_state_update_mask(en_state_shift, 1 << en_shift, 0, 0, 0, 0, 0); LISTEN_STATIC(&backend->events.new_input, inputdevice); virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy); LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard); @@ -3176,21 +3097,6 @@ statusin(int fd, unsigned int mask, void *data) return 0; } -void -switchxkbrule(const Arg *arg) -{ - struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); - struct xkb_keymap *keymap; - - xkb_rule_index = (xkb_rule_index + 1) % LENGTH(xkb_rules); - if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules[xkb_rule_index], - XKB_KEYMAP_COMPILE_NO_FLAGS))) - die("failed to compile keymap"); - wlr_keyboard_set_keymap(&kb_group->wlr_group->keyboard, keymap); - xkb_keymap_unref(keymap); - xkb_context_unref(context); -} - void tag(const Arg *arg) { @@ -3288,18 +3194,6 @@ togglesticky(const Arg *arg) setsticky(c, !c->issticky); } -void -togglepointer(const Arg *arg) -{ - if (!togglepointerdevice) - return; - - libinput_device_config_send_events_set_mode( - togglepointerdevice, - libinput_device_config_send_events_get_mode(togglepointerdevice) ^ LIBINPUT_CONFIG_SEND_EVENTS_DISABLED - ); -} - void toggletag(const Arg *arg) { @@ -3659,34 +3553,6 @@ zoom(const Arg *arg) arrange(selmon); } -static void -rotatetags(const Arg *arg) -{ - Arg newarg; - int i = arg->i; - int nextseltags = 0, curseltags = selmon->tagset[selmon->seltags]; - bool shift = false; - - switch(abs(i)) { - default: break; - case SHIFT_R: - shift = true; - break; - }; - - if (i > 0) - nextseltags = (curseltags << 1) | (curseltags >> (LENGTH(tags) - 1)); - else - nextseltags = (curseltags >> 1) | (curseltags << (LENGTH(tags) - 1)); - - newarg.i = nextseltags; - - if (shift) - tag(&newarg); - else - view(&newarg); -} - #ifdef XWAYLAND void activatex11(struct wl_listener *listener, void *data)