moving to wayland

This commit is contained in:
DarthMooMancer
2025-10-12 22:50:29 -04:00
parent 7dad3ca9ee
commit 0796555d4e
27 changed files with 45 additions and 2414 deletions
-4
View File
@@ -1,4 +0,0 @@
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
-10
View File
@@ -1,10 +0,0 @@
if [[ $- != *i* ]] ; then
return
fi
export PATH="$HOME/.local/bin:$PATH"
myfetch.sh
alias ls="ls -a --color"
alias comp="make && doas make install && make clean"
alias update_world='doas emerge --ask --update --newuse --deep @world'
alias env="sh /home/andrew/personal/dotfiles/env.sh"
-294
View File
@@ -1,294 +0,0 @@
shadow = false;
frame-opacity = 1;
# frame-opacity-for-same-colors = true;
inner-border-width = 0
corner-radius = 0
blur-method = "dual_kawase"
blur-background = true
blur-background-frame = true
backend = "glx"
dithered-present = false;
detect-client-opacity = true;
detect-transient = true;
detect-client-leader = true
use-damage = true;
xrender-sync-fence = true
log-level = "warn";
rules = ({
match = "WM_TRANSIENT_FOR@";
animations = ({
triggers = ["open", "show"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = {
curve = "linear";
duration = 0.1;
delay = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
shadow-opacity = "opacity";
scale-y = {
curve = "cubic-bezier(0.24, 0.64, 0.79, 0.98)";
duration = 0.15;
start = 0.8;
end = 1;
};
offset-y = "(-window-height/2) + (window-height/2) * scale-y";
shadow-scale-y = "scale-y";
shadow-offset-y = "offset-y";
},{
triggers = ["close", "hide"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "0";
};
blur-opacity = 0;
shadow-opacity = "opacity";
scale-y = {
curve = "cubic-bezier(0.21, 0.02, 0.76, 0.36)";
duration = 0.15;
start = 1;
end = 0.7;
};
offset-y = "(-window-height/2) + (window-height/2) * scale-y";
shadow-scale-y = "scale-y";
shadow-offset-y = "offset-y";
});
}, {
match = "window_type = 'dropdown_menu' || window_type = 'popup_menu' || window_type = 'menu'";
animations = ({
triggers = ["open", "show"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = {
curve = "linear";
duration = 0.1;
delay = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
shadow-opacity = "opacity";
scale-y = {
curve = "cubic-bezier(0.24, 0.64, 0.79, 0.98)";
duration = 0.15;
start = 0.8;
end = 1;
};
shadow-scale-y = "scale-y";
},{
triggers = ["close", "hide"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "0";
};
blur-opacity = 0;
shadow-opacity = "opacity";
scale-y = {
curve = "cubic-bezier(0.21, 0.02, 0.76, 0.36)";
duration = 0.15;
start = 1;
end = 0.7;
};
shadow-scale-y = "scale-y";
});
}, {
match = "window_type = 'dropdown_menu' || window_type = 'popup_menu' || window_type = 'menu'";
opacity = 0.9;
}, {
match = "window_type = 'dock' || window_type = 'desktop'";
blur-background = false;
corner-radius = 0;
}, {
match = "class_g *= 'i3lock' || _NET_WM_STATE@[1] = '_NET_WM_STATE_FULLSCREEN' || _NET_WM_STATE@[2] = '_NET_WM_STATE_FULLSCREEN' || _NET_WM_STATE@[3] = '_NET_WM_STATE_FULLSCREEN' || _NET_WM_STATE@[4] = '_NET_WM_STATE_FULLSCREEN'";
shadow = false;
corner-radius = 0;
animations = ({
triggers = ["open", "show"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = {
curve = "linear";
duration = 0.1;
delay = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
shadow-opacity = "opacity";
},{
triggers = ["close", "hide"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "0";
};
blur-opacity = 0;
shadow-opacity = "opacity";
});
});
animations = ({
triggers = ["close", "hide"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = "0";
shadow-opacity = "opacity";
offset-x = "(1 - scale-x) / 2 * window-width";
offset-y = "(1 - scale-y) / 2 * window-height * 5";
scale-x = {
curve = "cubic-bezier(0.21, 0.02, 0.76, 0.36)";
duration = 0.15;
start = 1;
end = 0.9;
};
scale-y = "scale-x";
shadow-scale-x = "scale-x";
shadow-scale-y = "scale-y";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
}, {
triggers = ["open", "show"];
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = {
curve = "linear";
duration = 0.1;
delay = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
shadow-opacity = "opacity";
offset-x = "(1 - scale-x) / 2 * window-width";
offset-y = "(1 - scale-y) / 2 * window-height * 5";
scale-x = {
curve = "cubic-bezier(0.24, 0.64, 0.79, 0.98)";
duration = 0.15;
start = 0.95;
end = 1;
};
scale-y = "scale-x";
shadow-scale-x = "scale-x";
shadow-scale-y = "scale-y";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
},
# Half Window Size Desktop Switch
{
triggers = ["workspace-out"];
offset-y = {
curve = "cubic-bezier(0.21, 0.02, 0.76, 0.36)";
duration = 0.15;
start = "0";
end = "- window-height / 2";
};
shadow-offset-y = "offset-y";
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = "0";
shadow-opacity = "opacity";
}, {
triggers = ["workspace-out-inverse"];
offset-y = {
curve = "cubic-bezier(0.21, 0.02, 0.76, 0.36)";
duration = 0.15;
start = "0";
end = "window-height / 2";
};
shadow-offset-y = "offset-y";
opacity = {
curve = "linear";
duration = 0.15;
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = "0";
shadow-opacity = "opacity";
}, {
triggers = ["workspace-in"];
offset-y = {
curve = "cubic-bezier(0.24, 0.64, 0.79, 0.98)";
duration = 0.15;
start = "window-height / 2";
end = "0";
};
shadow-offset-y = "offset-y";
opacity = {
curve = "linear";
duration = 0.15;
start = "0";
end = "window-raw-opacity";
};
blur-opacity = {
curve = "linear";
duration = 0.1;
delay = 0.15;
start = "0";
end = "window-raw-opacity";
};
shadow-opacity = "opacity";
}, {
triggers = ["workspace-in-inverse"];
offset-y = {
curve = "cubic-bezier(0.24, 0.64, 0.79, 0.98)";
duration = 0.15;
start = "- window-height / 2";
end = "0";
};
shadow-offset-y = "offset-y";
opacity = {
curve = "linear";
duration = 0.15;
start = "0";
end = "window-raw-opacity";
};
blur-opacity = {
curve = "linear";
duration = 0.1;
delay = 0.15;
start = "0";
end = "window-raw-opacity";
};
shadow-opacity = "opacity";
}, {
triggers = [ "geometry" ];
preset = "geometry-change";
}
)
-25
View File
@@ -1,25 +0,0 @@
PREFIX = /usr/local
CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700L
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 ${CPPFLAGS}
LDFLAGS = -L/usr/X11R6/lib -lX11 -lfontconfig -lXft
SRC = drw.c dwm.c util.c
OBJ = ${SRC:.c=.o}
.c.o:
${CC} -c ${CFLAGS} $<
${OBJ}: config.h
dwm: ${OBJ}
gcc -o $@ ${OBJ} ${LDFLAGS}
clean:
rm -f dwm ${OBJ}
install: dwm
install -Dm755 dwm ${DESTDIR}${PREFIX}/bin/dwm
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 MiB

-41
View File
@@ -1,41 +0,0 @@
static const unsigned int borderpx = 0;
static const unsigned int gappx = 10;
static const int showbar = 0;
static const int topbar = 0;
static const char *fonts[] = { "Cascadia Mono:style=Bold:size=10:antialias=true:autohint=true" };
static const char *tags[] = { "1", "2", "3" };
static const Rule rules[] = {
{ "ghostty", NULL, NULL, 1, 0, -1 },
{ "librewolf", NULL, NULL, 1 << 1, 0, -1 },
{ "steam", NULL, NULL, 1 << 2, 0, -1 },
};
static const float mfact = 0.55;
static const int nmaster = 1;
static const int resizehints = 1;
static const int lockfullscreen = 1;
static const Layout layouts[] = {
{ "T", tile },
};
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
#include "X11/XF86keysym.h"
static const Key keys[] = {
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_Return, spawn, SHCMD("ghostty -e tmux a") },
{ MODKEY, XK_f, spawn, SHCMD("librewolf") },
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("steam") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +5%") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -5%") },
TAGKEYS(XK_1, 0) TAGKEYS(XK_2, 1) TAGKEYS(XK_3, 2)
};
-451
View File
@@ -1,451 +0,0 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
#include "drw.h"
#include "util.h"
#define UTF_INVALID 0xFFFD
#define UTF_SIZ 4
static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
static long
utf8decodebyte(const char c, size_t *i)
{
for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
return (unsigned char)c & ~utfmask[*i];
return 0;
}
static size_t
utf8validate(long *u, size_t i)
{
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
*u = UTF_INVALID;
for (i = 1; *u > utfmax[i]; ++i)
;
return i;
}
static size_t
utf8decode(const char *c, long *u, size_t clen)
{
size_t i, j, len, type;
long udecoded;
*u = UTF_INVALID;
if (!clen)
return 0;
udecoded = utf8decodebyte(c[0], &len);
if (!BETWEEN(len, 1, UTF_SIZ))
return 1;
for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
if (type)
return j;
}
if (j < len)
return 0;
*u = udecoded;
utf8validate(u, len);
return len;
}
Drw *
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
{
Drw *drw = ecalloc(1, sizeof(Drw));
drw->dpy = dpy;
drw->screen = screen;
drw->root = root;
drw->w = w;
drw->h = h;
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
drw->gc = XCreateGC(dpy, root, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
}
void
drw_resize(Drw *drw, unsigned int w, unsigned int h)
{
if (!drw)
return;
drw->w = w;
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
}
void
drw_free(Drw *drw)
{
XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc);
drw_fontset_free(drw->fonts);
free(drw);
}
/* This function is an implementation detail. Library users should use
* drw_fontset_create instead.
*/
static Fnt *
xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
{
Fnt *font;
XftFont *xfont = NULL;
FcPattern *pattern = NULL;
if (fontname) {
/* Using the pattern found at font->xfont->pattern does not yield the
* same substitution results as using the pattern returned by
* FcNameParse; using the latter results in the desired fallback
* behaviour whereas the former just results in missing-character
* rectangles being drawn, at least with some fonts. */
if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) {
fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname);
return NULL;
}
if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname);
XftFontClose(drw->dpy, xfont);
return NULL;
}
} else if (fontpattern) {
if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
fprintf(stderr, "error, cannot load font from pattern.\n");
return NULL;
}
} else {
die("no font specified.");
}
font = ecalloc(1, sizeof(Fnt));
font->xfont = xfont;
font->pattern = pattern;
font->h = xfont->ascent + xfont->descent;
font->dpy = drw->dpy;
return font;
}
static void
xfont_free(Fnt *font)
{
if (!font)
return;
if (font->pattern)
FcPatternDestroy(font->pattern);
XftFontClose(font->dpy, font->xfont);
free(font);
}
Fnt*
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
{
Fnt *cur, *ret = NULL;
size_t i;
if (!drw || !fonts)
return NULL;
for (i = 1; i <= fontcount; i++) {
if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
cur->next = ret;
ret = cur;
}
}
return (drw->fonts = ret);
}
void
drw_fontset_free(Fnt *font)
{
if (font) {
drw_fontset_free(font->next);
xfont_free(font);
}
}
void
drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
{
if (!drw || !dest || !clrname)
return;
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
dest->pixel |= 0xff << 24;
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
* returned color scheme when done using it. */
Clr *
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
{
size_t i;
Clr *ret;
/* need at least two colors for a scheme */
if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor))))
return NULL;
for (i = 0; i < clrcount; i++)
drw_clr_create(drw, &ret[i], clrnames[i]);
return ret;
}
void
drw_setfontset(Drw *drw, Fnt *set)
{
if (drw)
drw->fonts = set;
}
void
drw_setscheme(Drw *drw, Clr *scm)
{
if (drw)
drw->scheme = scm;
}
void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
{
if (!drw || !drw->scheme)
return;
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
if (filled)
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
else
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
}
int
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
{
int i, ty, ellipsis_x = 0;
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len;
XftDraw *d = NULL;
Fnt *usedfont, *curfont, *nextfont;
int utf8strlen, utf8charlen, render = x || y || w || h;
long utf8codepoint = 0;
const char *utf8str;
FcCharSet *fccharset;
FcPattern *fcpattern;
FcPattern *match;
XftResult result;
int charexists = 0, overflow = 0;
/* keep track of a couple codepoints for which we have no match. */
enum { nomatches_len = 64 };
static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches;
static unsigned int ellipsis_width = 0;
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
return 0;
if (!render) {
w = invert ? invert : ~invert;
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
x += lpad;
w -= lpad;
}
usedfont = drw->fonts;
if (!ellipsis_width && render)
ellipsis_width = drw_fontset_getwidth(drw, "...");
while (1) {
ew = ellipsis_len = utf8strlen = 0;
utf8str = text;
nextfont = NULL;
while (*text) {
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
if (charexists) {
drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
if (ew + ellipsis_width <= w) {
/* keep track where the ellipsis still fits */
ellipsis_x = x + ew;
ellipsis_w = w - ew;
ellipsis_len = utf8strlen;
}
if (ew + tmpw > w) {
overflow = 1;
/* called from drw_fontset_getwidth_clamp():
* it wants the width AFTER the overflow
*/
if (!render)
x += tmpw;
else
utf8strlen = ellipsis_len;
} else if (curfont == usedfont) {
utf8strlen += utf8charlen;
text += utf8charlen;
ew += tmpw;
} else {
nextfont = curfont;
}
break;
}
}
if (overflow || !charexists || nextfont)
break;
else
charexists = 0;
}
if (utf8strlen) {
if (render) {
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen);
}
x += ew;
w -= ew;
}
if (render && overflow)
drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert);
if (!*text || overflow) {
break;
} else if (nextfont) {
charexists = 0;
usedfont = nextfont;
} else {
/* Regardless of whether or not a fallback font is found, the
* character must be drawn. */
charexists = 1;
for (i = 0; i < nomatches_len; ++i) {
/* avoid calling XftFontMatch if we know we won't find a match */
if (utf8codepoint == nomatches.codepoint[i])
goto no_match;
}
fccharset = FcCharSetCreate();
FcCharSetAddChar(fccharset, utf8codepoint);
if (!drw->fonts->pattern) {
/* Refer to the comment in xfont_create for more information. */
die("the first font in the cache must be loaded from a font string.");
}
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
FcDefaultSubstitute(fcpattern);
match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
FcCharSetDestroy(fccharset);
FcPatternDestroy(fcpattern);
if (match) {
usedfont = xfont_create(drw, NULL, match);
if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) {
for (curfont = drw->fonts; curfont->next; curfont = curfont->next)
; /* NOP */
curfont->next = usedfont;
} else {
xfont_free(usedfont);
nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint;
no_match:
usedfont = drw->fonts;
}
}
}
}
if (d)
XftDrawDestroy(d);
return x + (render ? w : 0);
}
void
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
{
if (!drw)
return;
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
XSync(drw->dpy, False);
}
unsigned int
drw_fontset_getwidth(Drw *drw, const char *text)
{
if (!drw || !drw->fonts || !text)
return 0;
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
}
unsigned int
drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n)
{
unsigned int tmp = 0;
if (drw && drw->fonts && text && n)
tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n);
return MIN(n, tmp);
}
void
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
{
XGlyphInfo ext;
if (!font || !text)
return;
XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
if (w)
*w = ext.xOff;
if (h)
*h = font->h;
}
Cur *
drw_cur_create(Drw *drw, int shape)
{
Cur *cur;
if (!drw || !(cur = ecalloc(1, sizeof(Cur))))
return NULL;
cur->cursor = XCreateFontCursor(drw->dpy, shape);
return cur;
}
void
drw_cur_free(Drw *drw, Cur *cursor)
{
if (!cursor)
return;
XFreeCursor(drw->dpy, cursor->cursor);
free(cursor);
}
-58
View File
@@ -1,58 +0,0 @@
/* See LICENSE file for copyright and license details. */
typedef struct {
Cursor cursor;
} Cur;
typedef struct Fnt {
Display *dpy;
unsigned int h;
XftFont *xfont;
FcPattern *pattern;
struct Fnt *next;
} Fnt;
enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */
typedef XftColor Clr;
typedef struct {
unsigned int w, h;
Display *dpy;
int screen;
Window root;
Drawable drawable;
GC gc;
Clr *scheme;
Fnt *fonts;
} Drw;
/* Drawable abstraction */
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
/* Fnt abstraction */
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
void drw_fontset_free(Fnt* set);
unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
void drw_cur_free(Drw *drw, Cur *cursor);
/* Drawing context manipulation */
void drw_setfontset(Drw *drw, Fnt *set);
void drw_setscheme(Drw *drw, Clr *scm);
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
File diff suppressed because it is too large Load Diff
-26
View File
@@ -1,26 +0,0 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
fputc(' ', stderr);
perror(NULL);
} else fputc('\n', stderr);
exit(1);
}
void *ecalloc(size_t nmemb, size_t size) {
void *p;
if (!(p = calloc(nmemb, size))) die("calloc:");
return p;
}
-7
View File
@@ -1,7 +0,0 @@
#include <stddef.h>
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);
+39
View File
@@ -0,0 +1,39 @@
for_window [class="^.*"] border pixel 0
for_window [class="com.mitchellh.ghostty"] move container to workspace 1
for_window [class="librewolf"] move container to workspace 2
for_window [class="steam"] move container to workspace 3
font pango: Maple Mono SemiBold 10
gaps inner 5
gaps outer 2
exec_always gentoo-pipewire-launcher
exec_always sh -c 'if ! tmux has-session -t main 2>/dev/null; then tmux new-session -d -s main; fi'
exec_always sh -c 'pkill swaybg && img="$(find /home/andrew/.config/suckless/dwm/bgs -type f | shuf -n1)" && swaybg -m fill -i "$img" &'
output HDMI-A-1 resolution 1920x1080@144Hz position 0,0
input * xkb_options ctrl:nocaps
input "1133:50504:Logitech_USB_Receiver_Mouse" {
accel_profile "flat"
pointer_accel -0.1
}
set $mod Mod1
bindsym $mod+Return exec ghostty -e tmux a
bindsym $mod+Shift+s exec steam
bindsym $mod+f exec librewolf
bindsym $mod+q kill
bindsym $mod+Shift+c reload
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
include /etc/sway/config.d/*
-9
View File
@@ -1,9 +0,0 @@
gentoo-pipewire-launcher &
xrandr --output HDMI-A-0 --mode 1920x1080 --rate 144 &
picom -b &
setxkbmap -option ctrl:nocaps &
if ! tmux has-session -t main 2>/dev/null; then
tmux new-session -d -s main
fi
xwallpaper --zoom "$(find /home/andrew/.config/suckless/dwm/bgs -type f | shuf -n1)" &
exec dwm
+4
View File
@@ -1,3 +1,7 @@
if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
dbus-run-session sway
fi
HISTFILE=~/.zsh_history
HISTSIZE=100
SAVEHIST=200
+2 -11
View File
@@ -14,33 +14,24 @@ LOCAL="${HOME}.local/"
ORIGINAL_DOTS=(
"${DOTFILES_CONFIG}nvim/"
"${DOTFILES_CONFIG}sway/"
"${DOTFILES_CONFIG}tmux/"
"${DOTFILES_CONFIG}suckless/"
"${DOTFILES_CONFIG}ghostty/"
"${DOTFILES_CONFIG}picom.conf"
"${DOTFILES_CONFIG}starship.toml"
"${DOTFILES_LOCAL}share/fonts/"
"${DOTFILES_LOCAL}bin/"
"${DOTFILES_HOME}.xinitrc"
"${DOTFILES_HOME}.bashrc"
"${DOTFILES_HOME}.zshrc"
"${DOTFILES_HOME}.bash_profile"
)
COPY_DOTS=(
"${CONFIG}nvim/"
"${CONFIG}sway/"
"${CONFIG}tmux/"
"${CONFIG}suckless/"
"${CONFIG}ghostty/"
"${CONFIG}picom.conf"
"${CONFIG}starship.toml"
"${LOCAL}share/fonts/"
"${LOCAL}bin/"
"${HOME}.xinitrc"
"${HOME}.bashrc"
"${HOME}.zshrc"
"${HOME}.bash_profile"
)
for x in "${!ORIGINAL_DOTS[@]}"; do
src="${ORIGINAL_DOTS[$x]}"
dst="${COPY_DOTS[$x]}"