From: Michael D. Lowis Date: Thu, 8 Jul 2021 17:28:22 +0000 (-0400) Subject: added X11 visual and change background color for frames X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=5289c42a1478f4eb641242ed33f0ec3591d4d1ad;p=proto%2Fanvil.git added X11 visual and change background color for frames --- diff --git a/anvil.c b/anvil.c index 53e3296..d039546 100644 --- a/anvil.c +++ b/anvil.c @@ -261,9 +261,12 @@ int main(void) X.mode = M_INIT; X.root = DefaultRootWindow(X.disp); X.screen = DefaultScreen(X.disp); - X.clr_bg = 0x00FFFFEA; + X.clr_bg = 0x00C0C0C0; X.clr_bdr = 0x00000000; X.clr_urgent = 0x00FF7700; + XWindowAttributes wa; + XGetWindowAttributes(X.disp, X.root, &wa); + X.visual = wa.visual; /* initialize all the things */ check_for_wm(); diff --git a/anvil.h b/anvil.h index 4527ca2..2e38de5 100644 --- a/anvil.h +++ b/anvil.h @@ -46,6 +46,7 @@ typedef struct { Cursor csr_root, csr_point, csr_move; XFontSet font; XFontSetExtents *font_ext; + Visual* visual; void (*eventfns[LASTEvent])(XEvent*); } XConf; @@ -67,6 +68,8 @@ typedef struct Client { int flags, x, y, w, h; long hint_flags, wm_flags; XSizeHints hints; + Pixmap pixmap; + Visual visual; } Client; typedef struct Column { diff --git a/keys.c b/keys.c index 068b11f..5c21ebb 100644 --- a/keys.c +++ b/keys.c @@ -1,6 +1,26 @@ #include "anvil.h" #include +static char* wmcmd[] = { "anvil", NULL }; +static char* pickexec[] = { "pickexec", NULL }; +static char* terminal[] = { "st", NULL }; +static char* locker[] = { "slock", NULL }; +static char* new_note[] = { "j", "note", NULL }; +static char* new_task[] = { "j", "task", NULL }; +static char* new_journal[] = { "j", "journal", NULL }; +static char* fetchsel[] = { "fetch", NULL, NULL }; + +static void restart(Arg* arg) +{ + (void)arg; + if (X.disp) + { + XCloseDisplay(X.disp); + } + setsid(); + exit(execvp(arg->cmd[0], arg->cmd)); +} + static void quit(Arg* arg) { (void)arg; @@ -22,7 +42,7 @@ static void runcmd(Arg *arg) if (fork() == 0) { if (X.disp) { - close(ConnectionNumber(X.disp)); + close(ConnectionNumber(X.disp)); } setsid(); exit(execvp(arg->cmd[0], arg->cmd)); @@ -60,15 +80,8 @@ static void togfloat(Arg *arg) } } -static char* pickexec[] = { "pickexec", NULL }; -static char* terminal[] = { "st", NULL }; -static char* locker[] = { "slock", NULL }; -static char* new_note[] = { "j", "note", NULL }; -static char* new_task[] = { "j", "task", NULL }; -static char* new_journal[] = { "j", "journal", NULL }; -static char* fetchsel[] = { "fetch", NULL, NULL }; - static Key keys[] = { + { MODKEY|ShiftMask, XK_r, restart, { .cmd = wmcmd } }, { MODKEY, XK_p, runcmd, { .cmd = pickexec } }, { MODKEY, XK_minus, coljoin, { 0 } }, { MODKEY, XK_equal, colsplit, { 0 } },