summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h13
-rw-r--r--config.h26
-rw-r--r--dwm.c36
3 files changed, 60 insertions, 15 deletions
diff --git a/config.def.h b/config.def.h
index 9157c0e..836d37d 100644
--- a/config.def.h
+++ b/config.def.h
@@ -36,7 +36,8 @@ static const char *colors[][3] = {
};
/* tagging */
-static const char *tags[] = { "1", "2", "3"};
+static const char *tags[] = { "1", "2", "3" };
+static const char *defaulttagapps[] = { "librewolf", "tabbed -c -r 2 st -w '' -e /usr/bin/zsh", "zathura" };
static const Rule rules[] = {
/* xprop(1):
@@ -45,7 +46,7 @@ static const Rule rules[] = {
*/
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
+ { "Librewolf", NULL, NULL, 1 << 8, 0, -1 },
};
/* layout(s) */
@@ -79,15 +80,15 @@ static const Layout layouts[] = {
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_black, "-nf", col_white, "-sb", col_green, "-sf", col_white, NULL };
static const char *termcmd[] = { "tabbed", "-c", "-r", "2", "st", "-w", "''", "-e", "/usr/bin/zsh", NULL };
-static const char *browsercmd[] = { "librewolf" };
static const char *mansplaincmd[] = { "mansplain" };
+static const char *launchcmd[] = { "launch" };
// static const char *termcmd[] = { "st", NULL };
static const Key keys[] = {
/* modifier key function argument */
- { MODKEY, XK_p, spawn, {.v = dmenucmd } },
- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
- { MODKEY, XK_u, spawn, {.v = browsercmd } },
+ { MODKEY, XK_p, spawn, {.v = launchcmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_u, spawndefault, {0} },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
diff --git a/config.h b/config.h
index 12763b9..836d37d 100644
--- a/config.h
+++ b/config.h
@@ -20,16 +20,24 @@ static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
+static const char col_black[] = "#101010";
+static const char col_white[] = "#ffffff";
static const char col_green[] = "#003300";
-static const char col_cyan[] = "#005577";
+static const char col_olive[] = "#0B1500";
static const char *colors[][3] = {
/* fg bg border */
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_green, col_green },
+ [SchemeStatus] = { col_white, col_olive, "#000000" }, // Statusbar right {text,background,not used but cannot be empty}
+ [SchemeTagsSel] = { col_white, col_green, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty}
+ [SchemeTagsNorm] = { col_white, col_olive, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty}
+ [SchemeInfoSel] = { col_white, col_green, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty}
+ [SchemeInfoNorm] = { col_white, col_green, "#000000" }, // infobar middle unselected {text,background,not used but cannot be empty}
};
/* tagging */
-static const char *tags[] = { "1", "2", "3"};
+static const char *tags[] = { "1", "2", "3" };
+static const char *defaulttagapps[] = { "librewolf", "tabbed -c -r 2 st -w '' -e /usr/bin/zsh", "zathura" };
static const Rule rules[] = {
/* xprop(1):
@@ -38,7 +46,7 @@ static const Rule rules[] = {
*/
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
+ { "Librewolf", NULL, NULL, 1 << 8, 0, -1 },
};
/* layout(s) */
@@ -70,17 +78,17 @@ static const Layout layouts[] = {
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
-static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_black, "-nf", col_white, "-sb", col_green, "-sf", col_white, NULL };
static const char *termcmd[] = { "tabbed", "-c", "-r", "2", "st", "-w", "''", "-e", "/usr/bin/zsh", NULL };
-static const char *browsercmd[] = { "librewolf" };
static const char *mansplaincmd[] = { "mansplain" };
+static const char *launchcmd[] = { "launch" };
// static const char *termcmd[] = { "st", NULL };
static const Key keys[] = {
/* modifier key function argument */
- { MODKEY, XK_p, spawn, {.v = dmenucmd } },
- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
- { MODKEY, XK_u, spawn, {.v = browsercmd } },
+ { MODKEY, XK_p, spawn, {.v = launchcmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_u, spawndefault, {0} },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
diff --git a/dwm.c b/dwm.c
index 12d0838..9599373 100644
--- a/dwm.c
+++ b/dwm.c
@@ -208,12 +208,14 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
+static void setlasttag(int tagbit);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
static void spawn(const Arg *arg);
+static void spawndefault();
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
@@ -280,6 +282,9 @@ static Drw *drw;
static Monitor *mons, *selmon;
static Window root, wmcheckwin;
+static int lastchosentag[8];
+static int previouschosentag[8];
+
/* configuration, allows nested code to access above variables */
#include "config.h"
@@ -1527,6 +1532,24 @@ setfullscreen(Client *c, int fullscreen)
}
void
+setlasttag(int tagbit) {
+ const int mon = selmon->num;
+ if (tagbit > 0) {
+ int i = 1, pos = 0;
+ while (!(i & tagbit)) {
+ i = i << 1;
+ ++pos;
+ }
+ previouschosentag[mon] = lastchosentag[mon];
+ lastchosentag[mon] = pos;
+ } else {
+ const int tempTag = lastchosentag[mon];
+ lastchosentag[mon] = previouschosentag[mon];
+ previouschosentag[mon] = tempTag;
+ }
+}
+
+void
setlayout(const Arg *arg)
{
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
@@ -1891,6 +1914,17 @@ altTabStart(const Arg *arg)
}
void
+spawndefault()
+{
+ const char *app = defaulttagapps[lastchosentag[selmon->num]];
+ if (app) {
+ const char *defaultcmd[] = {app, NULL};
+ Arg a = {.v = defaultcmd};
+ spawn(&a);
+ }
+}
+
+void
tag(const Arg *arg)
{
if (selmon->sel && arg->ui & TAGMASK) {
@@ -1990,6 +2024,7 @@ toggleview(const Arg *arg)
if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset;
+ setlasttag(newtagset);
focus(NULL);
arrange(selmon);
}
@@ -2288,6 +2323,7 @@ view(const Arg *arg)
{
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
+ setlasttag(arg->ui);
selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;