Integrate upstream changes

This commit is contained in:
lemon-sh 2021-10-31 23:48:34 +01:00
parent 8df1a1db3b
commit 35ba40862e
16 changed files with 314 additions and 287 deletions

44
.config/alacritty.yml Normal file
View File

@ -0,0 +1,44 @@
# Colors (Nova)
colors:
# Default colors
primary:
background: '#000000'
foreground: '#C5D4DD'
cursor:
text: '#212121'
cursor: '#C0C5CE'
# Normal colors
normal:
black: '#3C4C55'
red: '#DF8C8C'
green: '#A8CE93'
yellow: '#DADA93'
blue: '#416691'
magenta: '#9A93E1'
cyan: '#7FC1CA'
white: '#b6c5cf'
# Bright colors
bright:
black: '#899BA6'
red: '#F2C38F'
green: '#A8CE93'
yellow: '#DADA93'
blue: '#517bad'
magenta: '#D18EC2'
cyan: '#7FC1CA'
white: '#E6EEF3'
font:
size: 9
normal:
family: Cozette
window:
padding:
x: 20
y: 20
background_opacity: 0.85

50
.config/picom.conf Normal file
View File

@ -0,0 +1,50 @@
#################################
# GLX backend
#################################
backend = "glx";
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
vsync = true;
xrender-sync-fence = "true";
glx-swap-method = -1;
unredir-if-possible = true;
#################################
# Shadows
#################################
shadow = true;
shadow-radius = 10;
shadow-offset-x = -10;
shadow-offset-y = -10;
shadow-opacity = 0.8;
shadow-ignore-shaped = false;
#################################
# Opacity
#################################
inactive-opacity = 0.9;
active-opacity = 1;
inactive-opacity-override = false;
blur-background = true;
blur-background-frame = true;
blur-background-fixed = true;
blur-background-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'"
];
blur-kern = "3x3box";
blur-method = "kernel";
blur-strength = 10;
#################################
# Fading
#################################
fading = false;
wintypes:
{
dock = { shadow = false; }
dnd = { shadow = false; }
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
}

View File

@ -5,5 +5,8 @@ setxkbmap pl &
dunst &
flameshot &
volctl &
urxvtd -q &
nvidia-settings -l &
picom --config ~/.config/picom.conf &
~/.dwm/bar/./bar.sh &
dwm

View File

@ -1,26 +0,0 @@
#!/bin/bash
cpu() {
echo -n "^c#7ec7a2^^c#abb2bf^ $(grep -o "^[^ ]*" /proc/loadavg)"
}
mem() {
echo -n "^c#c7957e^^c#abb2bf^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
}
clock() {
echo -n "^c#1e222a^^b#668ee3^  ^c#1e222a^^b#7aa2f7^ $(date '+%a | %x | %R') "
}
root() {
echo -n "^c#ad7ec7^^c#abb2bf^ $(df -h / | awk '{if ($1 != "Filesystem") print $4" free"}')"
}
spotify() {
echo -n "^c#42f59e^^c#abb2bf^ $(playerctl metadata | awk '{if ($2 == "xesam:title") {s = ""; for (i = 3; i <= NF; i++) s = s $i " "; print s}}')"
}
while true; do
xsetroot -name "^c#cdff59^ $(spotify) $(root) $(cpu) $(mem) $(clock)"
sleep 5
done

28
.dwm/bar/bar.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# TODO: Integrate color schemes
cpu() {
echo -n "^c#7ec7a2^ ^c#abb2bf^$(grep -o "^[^ ]*" /proc/loadavg)"
}
mem() {
echo -n "^c#c7957e^ ^c#abb2bf^$(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
}
clock() {
echo -n "^c#1e222a^^b#668ee3^  ^c#1e222a^^b#7aa2f7^ $(date '+%a | %x | %R') "
}
root() {
echo -n "^c#ad7ec7^ ^c#abb2bf^$(df -h / | awk '{if ($1 != "Filesystem") print $4" free"}')"
}
player() {
echo -n "^c#42f59e^ ^c#abb2bf^$(playerctl metadata | awk '{if ($2 == "xesam:title") {s = ""; for (i = 3; i <= NF; i++) s = s $i " "; print s}}')"
}
while true; do
xsetroot -name "^c#cdff59^ $(player) $(root) $(cpu) $(mem) $(clock)"
sleep 5
done

11
.dwm/bar/themes/gruvchad Executable file
View File

@ -0,0 +1,11 @@
#!/bin/dash
# colors
black=#222526
green=#89b482
white=#c7b89d
grey=#2b2e2f
blue=#6f8faf
red=#ec6b64
darkblue=#6080a0

11
.dwm/bar/themes/nord Executable file
View File

@ -0,0 +1,11 @@
#!/bin/dash
# colors
black=#2E3440
green=#A3BE8C
white=#D8DEE9
grey=#373d49
blue=#81A1C1
red=#BF616A
darkblue=#7292b2

11
.dwm/bar/themes/onedark Executable file
View File

@ -0,0 +1,11 @@
#!/bin/dash
# colors
black=#1e222a
green=#7eca9c
white=#abb2bf
grey=#282c34
blue=#7aa2f7
red=#d47d85
darkblue=#668ee3

View File

@ -1,19 +0,0 @@
#!/bin/sh
cat <<EOF | xmenu
[]= tile 0
[M] monocle 1
[@] spiral 2
[\\ dwindle 3
TTT bstack 4
H[] deck 5
=== bstackhoriz 6
HHH grid 7
GNG nrowgrid 8
--- horizgrid 9
::: gaplessgrid 10
|M| centeredmaster 11
>M> centeredfloatMaster 12
><> floating 13
EOF

View File

@ -1,40 +1,40 @@
/* See LICENSE file for copyright and license details. */
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int default_border = 1; // to switch back to default border after dynamic border resizing via keybinds
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int gappih = 5; /* horiz inner gap between windows */
static const unsigned int gappiv = 5; /* vert inner gap between windows */
static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 5; /* systray spacing */
static const int systraypinningfailfirst = 1; /* 1: if pinning fails,display systray on the 1st monitor,False: display systray on last monitor*/
static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
enum showtab_modes {
showtab_never, showtab_auto, showtab_nmodes, showtab_always
};
static const int showtab = showtab_auto;
static const int toptab = True;
static const int topbar = 1;
static const int horizpadbar = 10;
static const int vertpadbar = 10;
static const int vertpadtab = 33;
static const int horizpadtabi = 15;
static const int horizpadtabo = 15;
static const int scalepreview = 4;
// appearance
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int default_border = 0; /* to switch back to default border after dynamic border resizing via keybinds */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int gappih = 5; /* horiz inner gap between windows */
static const unsigned int gappiv = 5; /* vert inner gap between windows */
static const unsigned int gappoh = 15; /* horiz outer gap between windows and screen edge */
static const unsigned int gappov = 15; /* vert outer gap between windows and screen edge */
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 5; /* systray spacing */
static const int systraypinningfailfirst = 1; /* 1: if pinning fails,display systray on the 1st monitor,False: display systray on last monitor*/
static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always };
static const int showtab = showtab_auto;
static const int toptab = 1;
static const int topbar = 0; /* 0 means bottom bar */
static const int horizpadbar = 15;
static const int vertpadbar = 10;
static const int vertpadtab = 10;
static const int horizpadtabi = 15;
static const int horizpadtabo = 15;
static const int scalepreview = 4;
static int tag_preview = 1; /* 1 means enable, 0 is off */
static const int colorfultag = 1; /* 0 means use SchemeSel for selected non-vacant tag */
static const char *fonts[] = {"Cozette:style:medium:size=9"};
static const char dmenufont[] = "Cozette:style:medium:size=9";
static const int colorfultag = 1; /* 0 means use SchemeSel for selected non-vacant tag */
// theme
#include "themes/onedark.h"
#include "themes/reallydark.h"
static const char *colors[][3] = {
/* fg bg border */
/* fg, bg, border */
[SchemeNorm] = {gray3, black, gray2},
[SchemeSel] = {gray4, blue, blue},
[TabSel] = {blue, gray2, black},
@ -53,12 +53,11 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = {"a", "b", "c", "d", "e", "f", "g", "h"};
static const int tagschemes[] = {SchemeTag1, SchemeTag2, SchemeTag3, SchemeTag4,
SchemeTag5, SchemeTag4, SchemeTag2, SchemeTag3
};
static const unsigned int ulinepad = 5; /* horizontal padding bwetween the underline and tag */
static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
@ -72,31 +71,29 @@ static const int resizehints = 0; /* 1 means respect size hints in tiled resi
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
#define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */
#include "functions.h"
static const Layout layouts[] = {
/* symbol arrange function */
{"[]=", tile}, /* first entry is default */
{"[M]", monocle},
{"[@]", spiral},
{"[\\]", dwindle},
{"H[]", deck},
{"TTT", bstack},
{"===", bstackhoriz},
{"HHH", grid},
{"###", nrowgrid},
{"---", horizgrid},
{":::", gaplessgrid},
{"|M|", centeredmaster},
{">M>", centeredfloatingmaster},
{"|+|", tatami},
{"><>", NULL}, /* no layout function means floating behavior */
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "[M]", monocle },
{ "[@]", spiral },
{ "[\\]", dwindle },
{ "H[]", deck },
{ "TTT", bstack },
{ "===", bstackhoriz },
{ "HHH", grid },
{ "###", nrowgrid },
{ "---", horizgrid },
{ ":::", gaplessgrid },
{ "|M|", centeredmaster },
{ ">M>", centeredfloatingmaster },
{ "><>", NULL }, /* no layout function means floating behavior */
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY, TAG) \
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
@ -106,11 +103,10 @@ static const Layout layouts[] = {
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static char dmenumon[2] = "0";
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = {"dmenu_run", NULL};
static const char *termcmd[] = {"urxvtc", NULL}; // change this to your term
static const char *termcmd[] = {"alacritty", NULL}; // change this to your term
static const char *rofi[] = {"rofi", "-show", "drun", NULL};
static const char *layoutmenu_cmd = "/home/lemon/.dwm/layoutmenu.sh"; // change lemon to your username
// media commands
static const char *pctlplaycmd[] = { "playerctl", "play-pause", NULL };
@ -188,7 +184,6 @@ static Button buttons[] = {
/* click event mask button function argument */
{ClkLtSymbol, 0, Button1, setlayout, {0}},
{ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]}},
{ClkLtSymbol, 0, Button3, layoutmenu, {0}},
{ClkWinTitle, 0, Button2, zoom, {0}},
{ClkStatusText, 0, Button2, spawn, {.v = termcmd}},
{ClkClientWin, MODKEY, Button1, moveorplace, {.i = 0}},

View File

@ -259,7 +259,6 @@ static void hide(Client *c);
static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
static void killclient(const Arg *arg);
static void layoutmenu(const Arg *arg);
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
@ -428,7 +427,6 @@ struct Monitor {
#include "vanitygaps.c"
#include "movestack.c"
#include "tatami.c"
struct Pertag {
unsigned int curtag, prevtag; /* current and previous tag */
@ -1419,11 +1417,12 @@ void drawbar(Monitor *m) {
XFillRectangle(drw->dpy, drw->drawable, drw->gc, 0, 0, m->ww - m->gappov * 2, bh);
if (showsystray && m == systraytomon(m))
stw = getsystraywidth();
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
sw = mw - drawstatusbar(m, bh_n, stext);
}
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
sw = mw - drawstatusbar(m, bh_n, stext);
}
resizebarwin(m);
for (c = m->clients; c; c = c->next) {
@ -1475,7 +1474,6 @@ void drawbars(void) {
void
drawtabs(void) {
Monitor *m;
unsigned int i;
for(m = mons; m; m = m->next)
drawtab(m);
@ -1514,7 +1512,7 @@ drawtab(Monitor *m) {
m->ntabs = 0;
for(c = m->clients; c; c = c->next){
if(!ISVISIBLE(c)) continue;
m->tab_widths[m->ntabs] = TEXTW(c->name) - lrpad + horizpadtabi + horizpadtabo;
m->tab_widths[m->ntabs] = MIN(TEXTW(c->name) - lrpad + horizpadtabi + horizpadtabo, 250);
tot_width += m->tab_widths[m->ntabs];
++m->ntabs;
if(m->ntabs >= MAXTABS) break;
@ -1869,23 +1867,6 @@ void killclient(const Arg *arg) {
}
}
void layoutmenu(const Arg *arg) {
FILE *p;
char c[3], *s;
int i;
if (!(p = popen(layoutmenu_cmd, "r")))
return;
s = fgets(c, sizeof(c), p);
pclose(p);
if (!s || *s == '\0' || c == '\0')
return;
i = atoi(c);
setlayout(&((Arg){.v = &layouts[i]}));
}
void manage(Window w, XWindowAttributes *wa) {
Client *c, *t = NULL;
Window trans = None;
@ -2317,7 +2298,7 @@ void propertynotify(XEvent *e) {
}
void quit(const Arg *arg) {
if(arg->i == 0) system("killall bar");
if(arg->i == 0) system("killall bar.sh");
else if (arg->i)
restart = 1;
@ -2872,7 +2853,7 @@ void showhide(Client *c) {
void
showtagpreview(int tag)
{
if (!selmon->previewshow) {
if (!selmon->previewshow || !tag_preview ) {
XUnmapWindow(dpy, selmon->tagwin);
return;
}
@ -2932,7 +2913,7 @@ void switchtag(void) {
XFreePixmap(dpy, selmon->tagmap[i]);
selmon->tagmap[i] = 0;
}
if (occ & 1 << i) {
if (occ & 1 << i && tag_preview) {
image = imlib_create_image(sw, sh);
imlib_context_set_image(image);
imlib_context_set_display(dpy);
@ -3541,6 +3522,7 @@ void view(const Arg *arg) {
selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK) {
selmon->pertag->prevtag = selmon->pertag->curtag;
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
if (arg->ui == ~0)
selmon->pertag->curtag = 0;
@ -3562,7 +3544,6 @@ void view(const Arg *arg) {
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
togglebar(NULL);
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
focus(NULL);
arrange(selmon);
updatecurrentdesktop();

66
lemondwm/fibonacci.c Normal file
View File

@ -0,0 +1,66 @@
void
fibonacci(Monitor *mon, int s) {
unsigned int i, n, nx, ny, nw, nh;
Client *c;
for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++);
if(n == 0)
return;
nx = mon->wx;
ny = 0;
nw = mon->ww;
nh = mon->wh;
for(i = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) {
if((i % 2 && nh / 2 > 2 * c->bw)
|| (!(i % 2) && nw / 2 > 2 * c->bw)) {
if(i < n - 1) {
if(i % 2)
nh /= 2;
else
nw /= 2;
if((i % 4) == 2 && !s)
nx += nw;
else if((i % 4) == 3 && !s)
ny += nh;
}
if((i % 4) == 0) {
if(s)
ny += nh;
else
ny -= nh;
}
else if((i % 4) == 1)
nx += nw;
else if((i % 4) == 2)
ny += nh;
else if((i % 4) == 3) {
if(s)
nx += nw;
else
nx -= nw;
}
if(i == 0)
{
if(n != 1)
nw = mon->ww * mon->mfact;
ny = mon->wy;
}
else if(i == 1)
nw = mon->ww - nw;
i++;
}
resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False);
}
}
void
dwindle(Monitor *mon) {
fibonacci(mon, 1);
}
void
spiral(Monitor *mon) {
fibonacci(mon, 0);
}

View File

@ -1,13 +1,21 @@
/* Key binding functions */
static void defaultgaps(const Arg *arg);
static void incrgaps(const Arg *arg);
static void incrigaps(const Arg *arg);
static void incrogaps(const Arg *arg);
static void incrohgaps(const Arg *arg);
static void incrovgaps(const Arg *arg);
static void incrihgaps(const Arg *arg);
static void incrivgaps(const Arg *arg);
static void togglegaps(const Arg *arg);
/* Layouts */
/* Layouts (delete the ones you do not need) */
static void bstack(Monitor *m);
static void bstackhoriz(Monitor *m);
static void centeredmaster(Monitor *m);
static void centeredfloatingmaster(Monitor *m);
static void deck(Monitor *m);
static void dwindle(Monitor *m);
static void fibonacci(Monitor *m, int s);
static void gaplessgrid(Monitor *m);
static void grid(Monitor *m);
static void horizgrid(Monitor *m);
@ -20,4 +28,3 @@ static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int
static void setgaps(int oh, int ov, int ih, int iv);
static void movestack(const Arg *arg);
static void tatami(Monitor *m);

View File

@ -1,157 +0,0 @@
void
tatami(Monitor *m) {
unsigned int i, n, nx, ny, nw, nh,
mats, tc,
tnx, tny, tnw, tnh;
Client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n);
if(n == 0)
return;
nx = m->wx;
ny = 0;
nw = m->ww;
nh = m->wh;
c = nexttiled(m->clients);
if(n != 1) nw = m->ww * m->mfact;
ny = m->wy;
resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False);
c = nexttiled(c->next);
nx += nw;
nw = m->ww - nw;
if(n>1)
{
tc = n-1;
mats = tc/5;
nh/=(mats + (tc % 5 > 0));
for(i = 0; c && (i < (tc % 5)); c = nexttiled(c->next))
{
tnw=nw;
tnx=nx;
tnh=nh;
tny=ny;
switch(tc - (mats*5))
{
case 1://fill
break;
case 2://up and down
if((i % 5) == 0) //up
tnh/=2;
else if((i % 5) == 1) //down
{
tnh/=2;
tny += nh/2;
}
break;
case 3://bottom, up-left and up-right
if((i % 5) == 0) //up-left
{
tnw = nw/2;
tnh = (2*nh)/3;
}
else if((i % 5) == 1)//up-right
{
tnx += nw/2;
tnw = nw/2;
tnh = (2*nh)/3;
}
else if((i % 5) == 2)//bottom
{
tnh = nh/3;
tny += (2*nh)/3;
}
break;
case 4://bottom, left, right and top
if((i % 5) == 0) //top
{
tnh = (nh)/4;
}
else if((i % 5) == 1)//left
{
tnw = nw/2;
tny += nh/4;
tnh = (nh)/2;
}
else if((i % 5) == 2)//right
{
tnx += nw/2;
tnw = nw/2;
tny += nh/4;
tnh = (nh)/2;
}
else if((i % 5) == 3)//bottom
{
tny += (3*nh)/4;
tnh = (nh)/4;
}
break;
}
++i;
resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False);
}
++mats;
for(i = 0; c && (mats>0); c = nexttiled(c->next)) {
if((i%5)==0)
{
--mats;
if(((tc % 5) > 0)||(i>=5))
ny+=nh;
}
tnw=nw;
tnx=nx;
tnh=nh;
tny=ny;
switch(i % 5)
{
case 0: //top-left-vert
tnw = (nw)/3;
tnh = (nh*2)/3;
break;
case 1: //top-right-hor
tnx += (nw)/3;
tnw = (nw*2)/3;
tnh = (nh)/3;
break;
case 2: //center
tnx += (nw)/3;
tnw = (nw)/3;
tny += (nh)/3;
tnh = (nh)/3;
break;
case 3: //bottom-right-vert
tnx += (nw*2)/3;
tnw = (nw)/3;
tny += (nh)/3;
tnh = (nh*2)/3;
break;
case 4: //(oldest) bottom-left-hor
tnw = (2*nw)/3;
tny += (2*nh)/3;
tnh = (nh)/3;
break;
default:
break;
}
++i;
//i%=5;
resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False);
}
}
}

View File

@ -0,0 +1,11 @@
static const char black[] = "#222526";
static const char gray2[] = "#282b2c"; // unfocused window border
static const char gray3[] = "#5d6061";
static const char gray4[] = "#282b2c";
static const char blue[] = "#6f8faf"; // focused window border
static const char green[] = "#89b482";
static const char red[] = "#ec6b64";
static const char orange[] = "#d6b676";
static const char yellow[] = "#d1b171";
static const char pink[] = "#cc7f94";
static const char col_borderbar[] = "#222526"; // inner border

11
lemondwm/themes/nord.h Normal file
View File

@ -0,0 +1,11 @@
static const char black[] = "#2E3440";
static const char gray2[] = "#3B4252"; // unfocused window border
static const char gray3[] = "#606672";
static const char gray4[] = "#6d8dad";
static const char blue[] = "#81A1C1"; // focused window border
static const char green[] = "#89b482";
static const char red[] = "#BF616A";
static const char orange[] = "#caaa6a";
static const char yellow[] = "#EBCB8B";
static const char pink[] = "#B48EAD";
static const char col_borderbar[] = "#2E3440"; // inner border