1
0
Fork 0

new shortcuts, moved some stuff around

This commit is contained in:
Arthur K. 2025-06-18 05:16:41 +03:00
parent daa1283e7c
commit 5430b7d415
Signed by: wzray
GPG key ID: B97F30FDC4636357
3 changed files with 172 additions and 158 deletions

View file

@ -11,7 +11,7 @@ static const unsigned int gappov = 10;
static int smartgaps = 1; static int smartgaps = 1;
static const int showbar = 1; static const int showbar = 1;
static const int topbar = 1; static const int topbar = 1;
static const char *fonts[] = { "Mononoki Nerd Font Propo:size=12", "Noto Color Emoji:size=11" }; static const char *fonts[] = { "Mononoki Nerd Font Propo:size=12", "Apple Color Emoji:size=11" };
static const char col_gray1[] = "#232323"; static const char col_gray1[] = "#232323";
static const char col_gray2[] = "#3a3a3a"; static const char col_gray2[] = "#3a3a3a";
static const char col_gray3[] = "#a0a0a0"; static const char col_gray3[] = "#a0a0a0";
@ -33,7 +33,7 @@ static const unsigned int alphas[][3] = {
}; };
/* tagging */ /* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "", "" }; static const char *tags[] = { "", "", "3", "4", "5", "6", "7", "", "" };
static const char *metaworkspaces[] = { "", "", "", "", "󰢚" }; static const char *metaworkspaces[] = { "", "", "", "", "󰢚" };
static const Rule rules[] = { static const Rule rules[] = {
@ -42,11 +42,14 @@ static const Rule rules[] = {
* WM_NAME(STRING) = title * WM_NAME(STRING) = title
*/ */
/* class instance title tags_mask isfloating isterminal noswallow monitor mwpin*/ /* class instance title tags_mask isfloating isterminal noswallow monitor mwpin*/
/* WM_CLASS[2] WM_CLASS[1] WM_NAME tags_mask isfloating isterminal noswallow monitor mwpin*/
{ "firefox-nightly", "Toolkit", "Picture-in-Picture", 511, 1, 0, 1, -1, 1 }, { "firefox-nightly", "Toolkit", "Picture-in-Picture", 511, 1, 0, 1, -1, 1 },
{ "TelegramDesktop", "telegram-desktop", "TelegramDesktop", 511, 1, 0, 1, -1, 1 },
{ "", NULL, "Picture in picture", 511, 1, 0, 1, -1, 1 },
{ "copyq", NULL, NULL, 0, 1, 0, 0, -1, 0 }, { "copyq", NULL, NULL, 0, 1, 0, 0, -1, 0 },
{ "Alacritty", NULL, NULL, 0, 0, 1, 0, -1, 0 }, { "Alacritty", NULL, NULL, 0, 0, 1, 0, -1, 0 },
{ "floating", NULL, NULL, 0, 1, 0, 0, -1, 0 }, { "floating", NULL, NULL, 0, 1, 0, 0, -1, 0 },
{ "Spotify", "spotify", NULL, 128, 0, 0, 0, 0, 1 }, { "feishin", "feishin", NULL, 128, 0, 0, 0, 0, 1 },
{ "TelegramDesktop", "telegram-desktop", NULL, 256, 0, 0, 0, 0, 1 }, { "TelegramDesktop", "telegram-desktop", NULL, 256, 0, 0, 0, 0, 1 },
}; };
@ -64,9 +67,7 @@ static const int spawnmaster = 0;
static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol reverse function */ /* symbol reverse function */
{ "", "", tile }, { "", "", tile },
{ "[/]", "[\\]", dwindle},
{ "[M]", "[M]", monocle }, { "[M]", "[M]", monocle },
{ "><>", "<><", NULL },
}; };
/* key definitions */ /* key definitions */
@ -98,10 +99,8 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_b, togglebar, {0} }, { MODKEY|ShiftMask, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_n, setmfact, {.f = -0.05} }, { MODKEY|ShiftMask, XK_n, setmfact, {.f = -0.05} },
{ MODKEY, XK_m, setmfact, {.f = +0.05} }, { MODKEY|ShiftMask, XK_m, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_n, incnmaster, {.i = -1} },
{ MODKEY|ShiftMask, XK_m, incnmaster, {.i = +1} },
{ MODKEY, XK_c, zoom, {0} }, { MODKEY, XK_c, zoom, {0} },
{ MODKEY, XK_q, killclient, {0} }, { MODKEY, XK_q, killclient, {0} },
@ -117,30 +116,32 @@ static const Key keys[] = {
// apps // apps
{ MODKEY, XK_w, spawn, SHCMD("firefox") }, { MODKEY, XK_w, spawn, SHCMD("firefox") },
{ MODKEY|ShiftMask, XK_w, spawn, SHCMD("chromium") },
{ MODKEY, XK_t, spawn, SHCMD("telegram-desktop") }, { MODKEY, XK_t, spawn, SHCMD("telegram-desktop") },
{ MODKEY, XK_x, spawn, SHCMD("win") },
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("flameshot", "gui") }, { MODKEY|ShiftMask, XK_s, spawn, SHCMD("flameshot", "gui") },
{ MODKEY|ShiftMask, XK_r, spawn, SHCMD("xr") }, { MODKEY|ShiftMask, XK_r, spawn, SHCMD("xr") },
{ MODKEY|ShiftMask|ControlMask, XK_s, spawn, SHCMD("systemctl", "suspend")},
// dunst // dunst
{ MODKEY, XK_i, spawn, SHCMD("dunstctl", "history-pop") }, { MODKEY, XK_i, spawn, SHCMD("dunstctl", "history-pop") },
{ MODKEY, XK_o, spawn, SHCMD("dunstctl", "close") }, { MODKEY, XK_o, spawn, SHCMD("dunstctl", "close") },
{ MODKEY|ControlMask, XK_i, spawn, SHCMD("dunstctl", "set-paused", "false") }, { MODKEY|ShiftMask, XK_i, spawn, SHCMD("dunstctl", "set-paused", "false") },
{ MODKEY|ControlMask, XK_o, spawn, SHCMD("dunstctl", "set-paused", "true") }, { MODKEY|ShiftMask, XK_o, spawn, SHCMD("dunstctl", "set-paused", "true") },
{ MODKEY|ShiftMask, XK_i, spawn, SHCMD("dunstctl", "context") }, { MODKEY|ControlMask, XK_i, spawn, SHCMD("dunstctl", "context") },
{ MODKEY|ShiftMask, XK_o, spawn, SHCMD("dunstctl", "action") }, { MODKEY|ControlMask, XK_o, spawn, SHCMD("dunstctl", "action") },
// vpn // vpn
{ MODKEY, XK_v, spawn, SHCMD("vpn", "msk") }, { MODKEY, XK_v, spawn, SHCMD("vpn") },
{ MODKEY|ControlMask, XK_v, spawn, SHCMD("vpn", "-d") }, { MODKEY|ShiftMask, XK_v, spawn, SHCMD("vpn", "msk") },
{ MODKEY|ShiftMask, XK_v, spawn, SHCMD("vpn") },
{ MODKEY|AltMask, XK_v, spawn, SHCMD("vpn", "-d", "msk") },
// volume // volume
{ MODKEY|ShiftMask, XK_Up, spawn, SHCMD("volume", "+1") }, { MODKEY|ShiftMask, XK_Up, spawn, SHCMD("volume", "+1") },
{ MODKEY|ShiftMask, XK_Down, spawn, SHCMD("volume", "-1") }, { MODKEY|ShiftMask, XK_Down, spawn, SHCMD("volume", "-1") },
{ MODKEY, XK_Up, spawn, SHCMD("volume", "+5") }, { MODKEY, XK_Up, spawn, SHCMD("volume", "+5") },
{ MODKEY, XK_Down, spawn, SHCMD("volume", "-5") }, { MODKEY, XK_Down, spawn, SHCMD("volume", "-5") },
{ MODKEY, XK_y, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_y, setlayout, {.v = &layouts[0]} },
{ MODKEY|ShiftMask, XK_y, setlayout, {.v = &layouts[2]} }, { MODKEY|ShiftMask, XK_y, setlayout, {.v = &layouts[1]} },
// tags // tags
TAGKEYS( XK_1, 0) TAGKEYS( XK_1, 0)

53
dwm.c
View file

@ -21,6 +21,7 @@
* To understand everything else, start reading main(). * To understand everything else, start reading main().
*/ */
#define focus(c) _focus(__func__, c)
#include <locale.h> #include <locale.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
@ -187,7 +188,7 @@ static void drawbar(Monitor *m);
static void drawbars(void); static void drawbars(void);
static void enternotify(XEvent *e); static void enternotify(XEvent *e);
static void expose(XEvent *e); static void expose(XEvent *e);
static void focus(Client *c); static void _focus(const char* fname, Client *c);
static void focusin(XEvent *e); static void focusin(XEvent *e);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
@ -916,15 +917,20 @@ enternotify(XEvent *e)
Monitor *m; Monitor *m;
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) // notify("enternotify called, ev.mode: %d, ev.detail: %d, ev.window == root: %d", ev->mode, ev->detail, ev->window == root);
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) {
// notify("en return 1");
return; return;
}
c = wintoclient(ev->window); c = wintoclient(ev->window);
m = c ? c->mon : wintomon(ev->window); m = c ? c->mon : wintomon(ev->window);
if (m != selmon) { if (m != selmon) {
unfocus(selmon->sel, 1); unfocus(selmon->sel, 1);
selmon = m; selmon = m;
} else if (!c || c == selmon->sel) } else if (!c || c == selmon->sel) {
// notify("en return 2");
return; return;
}
focus(c); focus(c);
} }
@ -938,9 +944,11 @@ expose(XEvent *e)
drawbar(m); drawbar(m);
} }
void void
focus(Client *c) _focus(const char *fname, Client *c)
{ {
// notify("focus called from %s", fname);
if (!c || !ISVISIBLE(c)) { if (!c || !ISVISIBLE(c)) {
for (c = selmon->stack; c && (!ISVISIBLE(c) || (!c->isfullscreen && c->isfloating)); c = c->snext); for (c = selmon->stack; c && (!ISVISIBLE(c) || (!c->isfullscreen && c->isfloating)); c = c->snext);
if (!c) for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); if (!c) for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
@ -948,6 +956,7 @@ focus(Client *c)
if (selmon->sel && selmon->sel != c) if (selmon->sel && selmon->sel != c)
unfocus(selmon->sel, 0); unfocus(selmon->sel, 0);
if (c) { if (c) {
if (c->mon != selmon) if (c->mon != selmon)
selmon = c->mon; selmon = c->mon;
@ -1417,7 +1426,7 @@ movemouse(const Arg *arg)
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
sendmon(c, m); sendmon(c, m);
selmon = m; selmon = m;
focus(NULL); focus(c);
} }
} }
@ -1658,21 +1667,19 @@ scan(void)
void void
sendmon(Client *c, Monitor *m) sendmon(Client *c, Monitor *m)
{ {
int i = 0; int i;
if (c->mon == m) if (c->mon == m)
return; return;
if (c->is_mwpinned) if (c->is_mwpinned)
c->is_mwpinned = 0; c->is_mwpinned = 0;
unfocus(c, 1);
detach(c); detach(c);
unfocus(c, 1);
detachstack(c); detachstack(c);
Client *pc = selmon->stack;
c->mon = m; c->mon = m;
for (; i < LENGTH(metaworkspaces); ++i) c->tags[i] = 0;
for (i = 0; i < LENGTH(metaworkspaces); ++i) c->tags[i] = 0;
c->tags[metaws] = m->tagset[metaws][m->seltags[metaws]]; /* assign tags of target monitor */ c->tags[metaws] = m->tagset[metaws][m->seltags[metaws]]; /* assign tags of target monitor */
if (m->spawnmaster) if (m->spawnmaster)
@ -1681,11 +1688,10 @@ sendmon(Client *c, Monitor *m)
attachbottom(c); attachbottom(c);
attachstack(c); attachstack(c);
// notify("focus from sendmon");
focus(pc); focus(NULL);
// notify("focus after sendmon");
arrange(m); arrange(NULL);
arrange(selmon);
} }
void void
@ -2031,19 +2037,24 @@ tagviewmetaws(const Arg *arg)
viewmetaws(arg); viewmetaws(arg);
} }
void void
tagmon(const Arg *arg) tagmon(const Arg *arg)
{ {
Monitor *m;
Client *c;
int restore;
if (!selmon->sel || !mons->next) if (!selmon->sel || !mons->next)
return; return;
Monitor *m = dirtomon(arg->i); m = dirtomon(arg->i);
if ((m->sel && m->sel->isfullscreen)) if (m->sel && m->sel->isfullscreen)
return; return;
Client *c = selmon->sel; c = selmon->sel;
int restore = c->isfullscreen; restore = c->isfullscreen;
if (restore) if (restore)
setfullscreen(c, 0); setfullscreen(c, 0);
@ -2729,3 +2740,5 @@ main(int argc, char *argv[])
XCloseDisplay(dpy); XCloseDisplay(dpy);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// vim: tabstop=4

View file

@ -455,7 +455,7 @@ deck(Monitor *m)
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest); getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
if (n - m->nmaster > 0) /* override layout symbol */ if (n - m->nmaster > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster); snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) { if (i < m->nmaster) {