Add gestures

This commit is contained in:
2023-08-30 12:57:53 +02:00
parent 374dae2d54
commit 7a4afd1ecb
6 changed files with 139 additions and 31 deletions
+79
View File
@@ -0,0 +1,79 @@
From 9dbdc4269c8db1b9580a153d99165aaa9cf14ad7 Mon Sep 17 00:00:00 2001
From: korei999 <ju7t1xe@gmail.com>
Date: Mon, 17 Jul 2023 01:02:22 +0300
Subject: [PATCH] This patch provides the ability to rotate the tagset left /
right. It implements a new function rotatetags which modifies the current
tagset. Same as original dwm patch. Also adds ability to "shift" focused
client to left / right tag.
---
config.def.h | 6 +++++-
dwl.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/dwl.c b/dwl.c
index 93f66efe6..3928c2b9b 100644
--- a/dwl.c
+++ b/dwl.c
@@ -318,6 +318,8 @@ static Monitor *xytomon(double x, double y);
static struct wlr_scene_node *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);
+static void clientshift(const Arg *arg);
/* variables */
static const char broken[] = "broken";
@@ -2687,6 +2689,52 @@ zoom(const Arg *arg)
arrange(selmon);
}
+static void
+rotatetags(const Arg *arg)
+{
+ Arg a;
+ size_t ntags = tagcount;
+ int i = arg->i;
+ int nextseltags, curseltags = selmon->tagset[selmon->seltags];
+
+ if (i > 0) // left circular shift
+ nextseltags = (curseltags << 1) | (curseltags >> (ntags - 1));
+ else // right circular shift
+ nextseltags = curseltags >> 1 | (curseltags << (ntags - 1));
+
+ i += arg->i;
+
+ a.i = nextseltags;
+ view(&a);
+}
+
+static void
+clientshift(const Arg *arg)
+{
+ Client *sel = focustop(selmon);
+
+ Arg a;
+ size_t ntags = tagcount;
+ int i = arg->i;
+ int nextseltags, curseltags = selmon->tagset[selmon->seltags];
+
+ if (i > 0) // left circular shift
+ nextseltags = (curseltags << 1) | (curseltags >> (ntags - 1));
+ else // right circular shift
+ nextseltags = curseltags >> 1 | (curseltags << (ntags - 1));
+
+ i += arg->i;
+
+ a.i = nextseltags;
+
+ if (sel && a.i) {
+ sel->tags = a.i;
+ focusclient(focustop(selmon), 1);
+ arrange(selmon);
+ }
+ printstatus();
+}
+
#ifdef XWAYLAND
void
activatex11(struct wl_listener *listener, void *data)
+6 -1
View File
@@ -23,6 +23,7 @@ static const bool cursor_warp = true;
static const char *const autostart[] = {
"dwlstartup", NULL,
"wallpaper", NULL,
"ydotoold", NULL,
"wl-paste", "--watch", "cliphist", "store", NULL,
"discord", NULL,
"youtube-music", NULL,
@@ -38,7 +39,7 @@ static const Rule rules[] = {
{ "Gimp", NULL, 0, 1, -1 },
*/
{ "discord", NULL, 1 << 2, 0, -1 },
{ "YouTube Music", NULL, 1 << 0, 0, -1 },
{ "YouTube Music", NULL, 1 << 1, 0, -1 },
};
/* layout(s) */
@@ -156,6 +157,10 @@ static const Key keys[] = {
{ 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_Left, rotatetags, {.i = -1} },
{ MODKEY, XKB_KEY_Right, rotatetags, {.i = +1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, clientshift, {.i = -1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, clientshift, {.i = +1} },
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
+2
View File
@@ -4,3 +4,5 @@ dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
# Stop any services that are running, so that they receive the new env var when they restart.
systemctl --user stop pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk
systemctl --user start wireplumber
fusuma -c ~/.config/fusuma/config.yaml
+22 -14
View File
@@ -11,10 +11,11 @@
name = "covercolors";
dontUnpack = true;
propagatedBuildInputs = [
(pkgs.python3.withPackages (pyPkgs: with pyPkgs; [
material-color-utilities
pillow
]))
(pkgs.python3.withPackages (pyPkgs:
with pyPkgs; [
material-color-utilities
pillow
]))
];
installPhase = "install -Dm755 ${./ags/covercolors.py} $out/bin/covercolors";
};
@@ -41,6 +42,8 @@ in {
slurp
cliphist
covercolors
ydotool
fusuma
];
xdg.systemDirs.data = [
@@ -48,19 +51,24 @@ in {
"${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}"
];
xdg.configFile."ags" = {
source = ./ags;
recursive = true;
};
home.pointerCursor = {
name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme;
size = 24;
x11 = {
enable = true;
defaultCursor = "Adwaita";
};
};
xdg.configFile."fusuma/config.yaml".text = "
swipe:
3:
right:
command: 'ydotool key 125:1 105:1 105:0 125:0'
left:
command: 'ydotool key 125:1 106:1 106:0 125:0'
up:
command: 'ydotool key 125:1 4:1 4:0 125:0'
down:
command: 'ydotool key 125:1 4:1 4:0 125:0'
hold:
3:
command: 'ydotool key 125:1 3:1 3:0 125:0'
";
}
+29 -16
View File
@@ -1,22 +1,35 @@
{ config, pkgs, ... }:
rec {
gtk = {
enable = true;
theme = {
name = pkgs.adw-gtk3.pname;
package = pkgs.adw-gtk3;
};
{
config,
pkgs,
...
}: rec {
gtk = {
enable = true;
theme = {
name = pkgs.adw-gtk3.pname;
package = pkgs.adw-gtk3;
};
};
services.xsettingsd = {
enable = true;
settings = {
"Net/ThemeName" = "${gtk.theme.name}";
};
services.xsettingsd = {
enable = true;
settings = {
"Net/ThemeName" = "${gtk.theme.name}";
};
};
qt = {
qt = {
enable = true;
platformTheme = "gtk";
};
home.pointerCursor = {
name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme;
size = 24;
x11 = {
enable = true;
platformTheme = "gtk";
defaultCursor = "Adwaita";
};
}
};
}
+1
View File
@@ -36,6 +36,7 @@ in {
../dwl_patches/montagset.patch
../dwl_patches/movestack.patch
../dwl_patches/gdk_monitors_status.patch
../dwl_patches/rotatetags.patch
];
});