patch togglefloatingcenter and add sudo term

This commit is contained in:
2026-02-10 10:39:27 -05:00
parent 41a166e157
commit 7ad2fa4c2c
4 changed files with 2203 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ static const Rule rules[] = {
*/ */
/* class instance title tags mask isfloating monitor */ /* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 }, { "Gimp", NULL, NULL, 0, 1, -1 },
{ "sudoterm", NULL, NULL, 0, 1, -1 },
}; };
/* layout(s) */ /* layout(s) */
@@ -63,6 +64,7 @@ static const char *termcmd[] = { "st", NULL };
static const char *sobercmd[] = { "flatpak", "run", "org.vinegarhq.Sober", NULL }; static const char *sobercmd[] = { "flatpak", "run", "org.vinegarhq.Sober", NULL };
static const char *steamcmd[] = { "steam", NULL }; static const char *steamcmd[] = { "steam", NULL };
static const char *browsercmd[] = { "librewolf", NULL }; static const char *browsercmd[] = { "librewolf", NULL };
static const char *sudocmd[] = { "st", "-c", "sudoterm", "-e", "su", "-", NULL };
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
@@ -91,6 +93,7 @@ static const Key keys[] = {
{ MODKEY, XK_s, spawn, {.v = sobercmd } }, { MODKEY, XK_s, spawn, {.v = sobercmd } },
{ MODKEY, XK_g, spawn, {.v = steamcmd } }, { MODKEY, XK_g, spawn, {.v = steamcmd } },
{ MODKEY, XK_b, spawn, {.v = browsercmd } }, { MODKEY, XK_b, spawn, {.v = browsercmd } },
{ MODKEY, XK_t, spawn, {.v = sudocmd } },
{ 0, XF86XK_AudioMute, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -44") }, { 0, XF86XK_AudioMute, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -44") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 0%- && wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%+; kill -44") }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 0%- && wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%+; kill -44") },

4
dwm.c
View File

@@ -1732,6 +1732,10 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfloating) if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y, resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0); selmon->sel->w, selmon->sel->h, 0);
selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
arrange(selmon); arrange(selmon);
} }

2165
dwm.c.orig Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
From efa326b2c71f0df1d097fd52a17684f5ccc5df6c Mon Sep 17 00:00:00 2001
From: Rizqi Nur Assyaufi <bandithijo@gmail.com>
Date: Sat, 7 Aug 2021 00:24:01 +0800
Subject: [PATCH] [dwm][patch][togglefloatingcenter] centered togglefloating
window
Default behaviour when togglefloating() is floating from top-left corner.
This patch will allows you to toggle floating window client will be centered
position.
---
dwm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dwm.c b/dwm.c
index 5e4d494..cbedb09 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1719,6 +1719,10 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0);
+
+ selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
+ selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
+
arrange(selmon);
}
--
2.31.1