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 const int showbar = 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_gray2[] = "#3a3a3a";
static const char col_gray3[] = "#a0a0a0";
@ -33,7 +33,7 @@ static const unsigned int alphas[][3] = {
};
/* 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 Rule rules[] = {
@ -42,11 +42,14 @@ static const Rule rules[] = {
* WM_NAME(STRING) = title
*/
/* 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 },
{ "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 },
{ "Alacritty", NULL, NULL, 0, 0, 1, 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 },
};
@ -64,9 +67,7 @@ static const int spawnmaster = 0;
static const Layout layouts[] = {
/* symbol reverse function */
{ "", "", tile },
{ "[/]", "[\\]", dwindle},
{ "[M]", "[M]", monocle },
{ "><>", "<><", NULL },
};
/* key definitions */
@ -98,10 +99,8 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_n, setmfact, {.f = -0.05} },
{ MODKEY, XK_m, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_n, incnmaster, {.i = -1} },
{ MODKEY|ShiftMask, XK_m, incnmaster, {.i = +1} },
{ MODKEY|ShiftMask, XK_n, setmfact, {.f = -0.05} },
{ MODKEY|ShiftMask, XK_m, setmfact, {.f = +0.05} },
{ MODKEY, XK_c, zoom, {0} },
{ MODKEY, XK_q, killclient, {0} },
@ -117,30 +116,32 @@ static const Key keys[] = {
// apps
{ MODKEY, XK_w, spawn, SHCMD("firefox") },
{ MODKEY|ShiftMask, XK_w, spawn, SHCMD("chromium") },
{ MODKEY, XK_t, spawn, SHCMD("telegram-desktop") },
{ MODKEY, XK_x, spawn, SHCMD("win") },
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("flameshot", "gui") },
{ MODKEY|ShiftMask, XK_r, spawn, SHCMD("xr") },
{ MODKEY|ShiftMask|ControlMask, XK_s, spawn, SHCMD("systemctl", "suspend")},
// dunst
{ MODKEY, XK_i, spawn, SHCMD("dunstctl", "history-pop") },
{ MODKEY, XK_o, spawn, SHCMD("dunstctl", "close") },
{ MODKEY|ControlMask, XK_i, spawn, SHCMD("dunstctl", "set-paused", "false") },
{ MODKEY|ControlMask, XK_o, spawn, SHCMD("dunstctl", "set-paused", "true") },
{ MODKEY|ShiftMask, XK_i, spawn, SHCMD("dunstctl", "context") },
{ MODKEY|ShiftMask, XK_o, spawn, SHCMD("dunstctl", "action") },
{ MODKEY|ShiftMask, XK_i, spawn, SHCMD("dunstctl", "set-paused", "false") },
{ MODKEY|ShiftMask, XK_o, spawn, SHCMD("dunstctl", "set-paused", "true") },
{ MODKEY|ControlMask, XK_i, spawn, SHCMD("dunstctl", "context") },
{ MODKEY|ControlMask, XK_o, spawn, SHCMD("dunstctl", "action") },
// vpn
{ MODKEY, XK_v, spawn, SHCMD("vpn", "msk") },
{ MODKEY|ControlMask, XK_v, spawn, SHCMD("vpn", "-d") },
{ MODKEY|ShiftMask, XK_v, spawn, SHCMD("vpn") },
{ MODKEY|AltMask, XK_v, spawn, SHCMD("vpn", "-d", "msk") },
{ MODKEY, XK_v, spawn, SHCMD("vpn") },
{ MODKEY|ShiftMask, XK_v, spawn, SHCMD("vpn", "msk") },
// volume
{ MODKEY|ShiftMask, XK_Up, spawn, SHCMD("volume", "+1") },
{ MODKEY|ShiftMask, XK_Down, spawn, SHCMD("volume", "-1") },
{ MODKEY, XK_Up, spawn, SHCMD("volume", "+5") },
{ MODKEY, XK_Down, spawn, SHCMD("volume", "-5") },
{ MODKEY, XK_y, setlayout, {.v = &layouts[0]} },
{ MODKEY|ShiftMask, XK_y, setlayout, {.v = &layouts[2]} },
{ MODKEY|ShiftMask, XK_y, setlayout, {.v = &layouts[1]} },
// tags
TAGKEYS( XK_1, 0)

53
dwm.c
View file

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

View file

@ -455,7 +455,7 @@ deck(Monitor *m)
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
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++)
if (i < m->nmaster) {