mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-11-05 14:35:49 +00:00
Update kblayout to 0.7
This commit is contained in:
parent
d36c11db0c
commit
8b1f9fbdb2
@ -21,7 +21,8 @@ implementation happens to share some code. If you don't need
|
|||||||
any of these features, just disable it in `config.h`.
|
any of these features, just disable it in `config.h`.
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [2024-06-01](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/kblayout/kblayout.patch)
|
- [git branch](https://codeberg.org/nikitaivanov/dwl/src/branch/kblayout)
|
||||||
|
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/kblayout/kblayout.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [ForzCross](https://codeberg.org/ForzCross)
|
- [ForzCross](https://codeberg.org/ForzCross)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
From 9e70c5145981d9ae91cf9907b485bb4fdfc1ab04 Mon Sep 17 00:00:00 2001
|
From ad18a8b8e9de138c3d89246ac0e25c0467ff5971 Mon Sep 17 00:00:00 2001
|
||||||
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||||
Date: Sun, 7 Apr 2024 22:03:49 +0200
|
Date: Fri, 11 Oct 2024 10:50:14 +0200
|
||||||
Subject: [PATCH] Add per client keyboard layout and status bar info
|
Subject: [PATCH] Add per client keyboard layout and status bar info
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -9,7 +9,7 @@ Subject: [PATCH] Add per client keyboard layout and status bar info
|
|||||||
2 files changed, 72 insertions(+), 1 deletion(-)
|
2 files changed, 72 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index 8f498d2..484e522 100644
|
index 22d2171..862c104 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -13,6 +13,9 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
@@ -13,6 +13,9 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
@ -17,24 +17,24 @@ index 8f498d2..484e522 100644
|
|||||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
/* 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 */
|
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||||
+/* keyboard layout change notification for status bar */
|
+/* keyboard layout change notification for status bar */
|
||||||
+static const char kblayout_file[] = "/tmp/dwl-kblayout";
|
+static const char kblayout_file[] = "/tmp/dwl-keymap";
|
||||||
+static const char *kblayout_cmd[] = {"pkill", "-RTMIN+1", "someblocks", NULL};
|
+static const char *kblayout_cmd[] = {"pkill", "-RTMIN+3", "someblocks", NULL};
|
||||||
|
|
||||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
#define TAGCOUNT (9)
|
#define TAGCOUNT (9)
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index bf763df..1aad21e 100644
|
index a2711f6..95ca3d3 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -13,6 +13,7 @@
|
@@ -14,6 +14,7 @@
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
#include <wlr/backend/libinput.h>
|
#include <wlr/backend/libinput.h>
|
||||||
+#include <wlr/interfaces/wlr_keyboard.h>
|
+#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include <wlr/render/allocator.h>
|
#include <wlr/render/allocator.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||||
@@ -139,6 +140,7 @@ typedef struct {
|
@@ -141,6 +142,7 @@ typedef struct {
|
||||||
uint32_t tags;
|
uint32_t tags;
|
||||||
int isfloating, isurgent, isfullscreen;
|
int isfloating, isurgent, isfullscreen;
|
||||||
uint32_t resize; /* configure serial of a pending resize */
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
@ -42,7 +42,7 @@ index bf763df..1aad21e 100644
|
|||||||
} Client;
|
} Client;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -286,6 +288,7 @@ static void fullscreennotify(struct wl_listener *listener, void *data);
|
@@ -294,6 +296,7 @@ static void gpureset(struct wl_listener *listener, void *data);
|
||||||
static void handlesig(int signo);
|
static void handlesig(int signo);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void inputdevice(struct wl_listener *listener, void *data);
|
static void inputdevice(struct wl_listener *listener, void *data);
|
||||||
@ -50,7 +50,7 @@ index bf763df..1aad21e 100644
|
|||||||
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
||||||
static void keypress(struct wl_listener *listener, void *data);
|
static void keypress(struct wl_listener *listener, void *data);
|
||||||
static void keypressmod(struct wl_listener *listener, void *data);
|
static void keypressmod(struct wl_listener *listener, void *data);
|
||||||
@@ -405,6 +408,8 @@ static struct wlr_box sgeom;
|
@@ -413,6 +416,8 @@ static struct wlr_box sgeom;
|
||||||
static struct wl_list mons;
|
static struct wl_list mons;
|
||||||
static Monitor *selmon;
|
static Monitor *selmon;
|
||||||
|
|
||||||
@ -59,32 +59,30 @@ index bf763df..1aad21e 100644
|
|||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
static void activatex11(struct wl_listener *listener, void *data);
|
static void activatex11(struct wl_listener *listener, void *data);
|
||||||
static void associatex11(struct wl_listener *listener, void *data);
|
static void associatex11(struct wl_listener *listener, void *data);
|
||||||
@@ -795,6 +800,8 @@ createkeyboard(struct wlr_keyboard *keyboard)
|
@@ -879,6 +884,8 @@ createkeyboard(struct wlr_keyboard *keyboard)
|
||||||
|
|
||||||
/* Add the new keyboard to the group */
|
/* Add the new keyboard to the group */
|
||||||
wlr_keyboard_group_add_keyboard(kb_group.wlr_group, keyboard);
|
wlr_keyboard_group_add_keyboard(kb_group->wlr_group, keyboard);
|
||||||
+
|
+
|
||||||
+ kblayout(&kb_group);
|
+ kblayout(kb_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
KeyboardGroup *
|
||||||
@@ -951,6 +958,7 @@ createnotify(struct wl_listener *listener, void *data)
|
@@ -1056,11 +1063,13 @@ createnotify(struct wl_listener *listener, void *data)
|
||||||
struct wlr_xdg_surface *xdg_surface = data;
|
/* This event is raised when a client creates a new toplevel (application window). */
|
||||||
|
struct wlr_xdg_toplevel *toplevel = data;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
LayerSurface *l = NULL;
|
|
||||||
+ struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
|
+ struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
|
||||||
|
|
||||||
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
/* Allocate a Client for this surface */
|
||||||
struct wlr_xdg_popup *popup = xdg_surface->popup;
|
c = toplevel->base->data = ecalloc(1, sizeof(*c));
|
||||||
@@ -973,6 +981,7 @@ createnotify(struct wl_listener *listener, void *data)
|
c->surface.xdg = toplevel->base;
|
||||||
c = xdg_surface->data = ecalloc(1, sizeof(*c));
|
|
||||||
c->surface.xdg = xdg_surface;
|
|
||||||
c->bw = borderpx;
|
c->bw = borderpx;
|
||||||
+ c->kblayout_idx = kb ? kb->modifiers.group : 0;
|
+ c->kblayout_idx = kb ? kb->modifiers.group : 0;
|
||||||
|
|
||||||
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
|
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
|
||||||
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
|
||||||
@@ -1236,10 +1245,24 @@ dirtomon(enum wlr_direction dir)
|
@@ -1339,10 +1348,24 @@ dirtomon(enum wlr_direction dir)
|
||||||
void
|
void
|
||||||
focusclient(Client *c, int lift)
|
focusclient(Client *c, int lift)
|
||||||
{
|
{
|
||||||
@ -109,7 +107,7 @@ index bf763df..1aad21e 100644
|
|||||||
|
|
||||||
if (locked)
|
if (locked)
|
||||||
return;
|
return;
|
||||||
@@ -1292,6 +1315,19 @@ focusclient(Client *c, int lift)
|
@@ -1395,6 +1418,19 @@ focusclient(Client *c, int lift)
|
||||||
}
|
}
|
||||||
printstatus();
|
printstatus();
|
||||||
|
|
||||||
@ -129,7 +127,7 @@ index bf763df..1aad21e 100644
|
|||||||
if (!c) {
|
if (!c) {
|
||||||
/* With no client, all we have left is to clear focus */
|
/* With no client, all we have left is to clear focus */
|
||||||
wlr_seat_keyboard_notify_clear_focus(seat);
|
wlr_seat_keyboard_notify_clear_focus(seat);
|
||||||
@@ -1302,7 +1338,7 @@ focusclient(Client *c, int lift)
|
@@ -1405,7 +1441,7 @@ focusclient(Client *c, int lift)
|
||||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
|
|
||||||
/* Have a client, so focus its top-level wlr_surface */
|
/* Have a client, so focus its top-level wlr_surface */
|
||||||
@ -138,7 +136,7 @@ index bf763df..1aad21e 100644
|
|||||||
|
|
||||||
/* Activate the new client */
|
/* Activate the new client */
|
||||||
client_activate_surface(client_surface(c), 1);
|
client_activate_surface(client_surface(c), 1);
|
||||||
@@ -1427,6 +1463,36 @@ inputdevice(struct wl_listener *listener, void *data)
|
@@ -1554,6 +1590,36 @@ inputdevice(struct wl_listener *listener, void *data)
|
||||||
wlr_seat_set_capabilities(seat, caps);
|
wlr_seat_set_capabilities(seat, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +173,7 @@ index bf763df..1aad21e 100644
|
|||||||
int
|
int
|
||||||
keybinding(uint32_t mods, xkb_keysym_t sym)
|
keybinding(uint32_t mods, xkb_keysym_t sym)
|
||||||
{
|
{
|
||||||
@@ -1504,6 +1570,8 @@ keypressmod(struct wl_listener *listener, void *data)
|
@@ -1631,6 +1697,8 @@ keypressmod(struct wl_listener *listener, void *data)
|
||||||
/* Send modifiers to the client. */
|
/* Send modifiers to the client. */
|
||||||
wlr_seat_keyboard_notify_modifiers(seat,
|
wlr_seat_keyboard_notify_modifiers(seat,
|
||||||
&group->wlr_group->keyboard.modifiers);
|
&group->wlr_group->keyboard.modifiers);
|
||||||
@ -185,5 +183,5 @@ index bf763df..1aad21e 100644
|
|||||||
|
|
||||||
int
|
int
|
||||||
--
|
--
|
||||||
2.45.1
|
2.46.2
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user