]> git.mdlowis.com Git - proto/anvil.git/commitdiff
added X11 visual and change background color for frames
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 8 Jul 2021 17:28:22 +0000 (13:28 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 8 Jul 2021 17:28:22 +0000 (13:28 -0400)
anvil.c
anvil.h
keys.c

diff --git a/anvil.c b/anvil.c
index 53e3296b46e280092f6fe94c8443fe1cfec5d6f5..d0395469ec433d803bf16959e0d40f4f322bd518 100644 (file)
--- 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 4527ca298900747663be1779277feebb5f01781f..2e38de50e78605ed442e93521d4cb717d5d90d1e 100644 (file)
--- 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 068b11f8af462da2d5fa4bc10da8ee3c7cf853d2..5c21ebb40f5d52051a5c5895e450edc63aef7a60 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1,6 +1,26 @@
 #include "anvil.h"
 #include <unistd.h>
 
+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 } },