aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--config.def.h73
l---------config.h1
-rw-r--r--dwm.13
-rw-r--r--dwm.c8
5 files changed, 74 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..095e840
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.o
+dwm
diff --git a/config.def.h b/config.def.h
index 9efa774..6c568db 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,21 +1,29 @@
/* See LICENSE file for copyright and license details. */
+#include <X11/XF86keysym.h>
+
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
-static const char *fonts[] = { "monospace:size=10" };
-static const char dmenufont[] = "monospace:size=10";
-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_cyan[] = "#005577";
+static const char *fonts[] = { "monospace:size=11" };
+static const char dmenufont[] = "monospace:size=11";
+
+/*
+ * Base16 dwm template by Daniel Mulford
+ * Tomorrow Night scheme by Chris Kempson (http://chriskempson.com)
+ */
+static const char col_base00[] = "#1d1f21";
+static const char col_base01[] = "#282a2e";
+static const char col_base02[] = "#373b41";
+static const char col_base04[] = "#b4b7b4";
+static const char col_base0C[] = "#8abeb7";
+static const char col_base0D[] = "#81a2be";
static const char *colors[][3] = {
- /* fg bg border */
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ /* fg bg border */
+ [SchemeNorm] = { col_base04, col_base01, col_base02 },
+ [SchemeSel] = { col_base00, col_base0D, col_base0C },
};
/* tagging */
@@ -28,7 +36,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 },
+ { "qBittorrent", NULL, NULL, 1 << 5, 0, -1 },
};
/* layout(s) */
@@ -57,8 +65,8 @@ 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 *termcmd[] = { "st", NULL };
+static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_base01, "-nf", col_base04, "-sb", col_base0D, "-sf", col_base00, NULL };
+static const char *termcmd[] = { "alacritty", NULL };
static const Key keys[] = {
/* modifier key function argument */
@@ -79,6 +87,7 @@ static const Key keys[] = {
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
@@ -95,6 +104,44 @@ static const Key keys[] = {
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
+ { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer set Master 5%-; kill -RTMIN+1 $(pidof -x sbar)") },
+ { 0, XF86XK_AudioMute, spawn, SHCMD("amixer set Master toggle; kill -RTMIN+1 $(pidof -x sbar)") },
+ { 0, XF86XK_AudioNext, spawn, SHCMD("playerctl next") },
+ { 0, XF86XK_AudioPlay, spawn, SHCMD("playerctl play-pause") },
+ { 0, XF86XK_AudioPrev, spawn, SHCMD("playerctl previous") },
+ { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer set Master 5%+; kill -RTMIN+1 $(pidof -x sbar)") },
+ { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("backlight -u") },
+ { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("backlight -d") },
+ // mod-shift-prtsc and mod-ctrl-prtsc does not work well, maybe because of sysrq? but mod-prtsc works well tho
+ { 0, XK_Print, spawn, SHCMD("ffmpeg -f x11grab -i \"$DISPLAY\" -vframes 1 \"$XDG_PICTURES_DIR/screenshots/$(time-uuid).jxl\" && notify-send 'Screenshot Finished'") },
+ { MODKEY, XF86XK_AudioMute, spawn, SHCMD("amixer set Capture toggle; kill -RTMIN $(pidof -x sbar)") },
+ { MODKEY, XK_z, spawn, SHCMD("0 \"$(xsel -op)\"") },
+ { MODKEY, XK_g, spawn, SHCMD("xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -f x11grab -s \"$1x$2\" -i \"$DISPLAY+$3,$4\" -vframes 1 \"$XDG_PICTURES_DIR/screenshots/$(time-uuid).jxl\"' shell && notify-send 'Screenshot Finished'") },
+ { MODKEY, XK_n, spawn, SHCMD("dunstctl close") },
+ // `xsel -cb` because there's a small delay before reading password into clipboard, so clear it beforehand to prevent pasting old clipboard
+ { MODKEY, XK_o, spawn, SHCMD("xsel -cb; pass otp sjsu.okta.com | tail -n1 | xsel -ibt 3000") },
+ // https://unix.stackexchange.com/a/568679/459013
+ // https://stackoverflow.com/q/8696751/9008720
+ // alternative: `sed 's/./& /g'` or sed 's/./& /g;s/ $//'`
+ // my benchmark shows in larger dataset, awk way is faster
+ { MODKEY, XK_r, spawn, SHCMD("xsel -ob | awk '{$1=$1}1' FS= | xsel -ib") },
+ // Use "$(xsel -op)" instead of "xsel -op | sdcv" (with sh -c?) because: the latter won't quit if found items similar and require user input. Not sure why.
+ // use env inside, to fix a bug: alacritty created by `alacritty msg create-window` will quit immediately if result is less than one page.
+ { MODKEY, XK_s, spawn, SHCMD("alacritty -e env LESS=\"$LESS-+F\" sdcv --color \"$(xsel -op)\"") },
+ // firefox Userjs toggle RFP
+ { MODKEY, XK_u, spawn, SHCMD("rfp") },
+ { MODKEY, XK_v, spawn, SHCMD("if nmcli -t --fields device,state device | grep -q '^wg0:connected$'; then nmcli connection down wg0; notify-send -u critical 'VPN disabled'; else nmcli connection up wg0; notify-send 'VPN enabled'; fi") },
+ { MODKEY, XK_w, spawn, SHCMD("\"$BROWSER\"") },
+ { MODKEY, XK_x, spawn, SHCMD("sleep 0.3; xcross") },
+ { MODKEY, XK_y, spawn, SHCMD("mpvy -s") },
+ { MODKEY|ControlMask, XK_y, spawn, SHCMD("tsp mpvy -A -u \"$(xsel -ob)\"") },
+ { MODKEY|ShiftMask, XK_g, spawn, SHCMD("reco") },
+ { MODKEY|ShiftMask, XK_n, spawn, SHCMD("alarm 12 'Boiling Water!'") },
+ { MODKEY|ShiftMask, XK_r, spawn, SHCMD("xsel -ob | rev | xsel -ib") },
+ { MODKEY|ShiftMask, XK_s, spawn, SHCMD("alacritty -e env LESS=\"$LESS-+F\" sdcv --color \"$(xsel -ob)\"") },
+ { MODKEY|ShiftMask, XK_w, spawn, SHCMD("\"$BROWSER\" \"youtu.be/$(xsel -op)\"") },
+ { MODKEY|ShiftMask, XK_y, spawn, SHCMD("mpvy -a") },
+ { MODKEY|ShiftMask, XK_z, spawn, SHCMD("0 \"$(xsel -ob)\"") },
};
/* button definitions */
diff --git a/config.h b/config.h
new file mode 120000
index 0000000..c6d6219
--- /dev/null
+++ b/config.h
@@ -0,0 +1 @@
+config.def.h \ No newline at end of file
diff --git a/dwm.1 b/dwm.1
index ddc8321..3d310ac 100644
--- a/dwm.1
+++ b/dwm.1
@@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only).
.B Mod1\-Shift\-c
Close focused window.
.TP
+.B Mod1\-Shift\-f
+Toggle fullscreen for focused window.
+.TP
.B Mod1\-Shift\-space
Toggle focused window between tiled and floating state.
.TP
diff --git a/dwm.c b/dwm.c
index f1d86b2..e940130 100644
--- a/dwm.c
+++ b/dwm.c
@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
+static void togglefullscr(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@@ -1736,6 +1737,13 @@ togglefloating(const Arg *arg)
}
void
+togglefullscr(const Arg *arg)
+{
+ if(selmon->sel)
+ setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
+}
+
+void
toggletag(const Arg *arg)
{
unsigned int newtags;