Last active
October 30, 2015 07:06
-
-
Save ninjacato/435decaeb9af8b65d6c7 to your computer and use it in GitHub Desktop.
My dwm and surf configurations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config.h_old b/config.h | |
index 77ff358..98c1c65 100644 | |
--- a/config.h_old | |
+++ b/config.h | |
@@ -5,8 +5,8 @@ static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-* | |
static const char normbordercolor[] = "#444444"; | |
static const char normbgcolor[] = "#222222"; | |
static const char normfgcolor[] = "#bbbbbb"; | |
-static const char selbordercolor[] = "#005577"; | |
-static const char selbgcolor[] = "#005577"; | |
+static const char selbordercolor[] = "#f0e9dc"; | |
+static const char selbgcolor[] = "#3e3e3e"; | |
static const char selfgcolor[] = "#eeeeee"; | |
static const unsigned int borderpx = 1; /* border pixel of windows */ | |
static const unsigned int snap = 32; /* snap pixel */ | |
@@ -14,7 +14,7 @@ static const Bool showbar = True; /* False means no bar */ | |
static const Bool topbar = True; /* False means bottom bar */ | |
/* tagging */ | |
-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | |
+static const char *tags[] = { "dev", "test", "alt1", "alt2", "alt3", "priv", "media", "mail", "inet" }; | |
static const Rule rules[] = { | |
/* class instance title tags mask isfloating monitor */ | |
@@ -35,19 +35,21 @@ static const Layout layouts[] = { | |
}; | |
/* key definitions */ | |
-#define MODKEY Mod1Mask | |
+#define MODKEY Mod4Mask | |
#define TAGKEYS(KEY,TAG) \ | |
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ | |
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ | |
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ | |
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, | |
+#define XK_mute 0x1008ff12 | |
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ | |
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } | |
/* commands */ | |
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; | |
-static const char *termcmd[] = { "uxterm", NULL }; | |
+static const char *termcmd[] = { "uxterm", "-fa", "Monospace", "-fs", "10" }; | |
+static const char *mute[] = { "amixer", "-D", "pulse", "-q", "sset", "Master", "toggle" }; | |
static Key keys[] = { | |
/* modifier key function argument */ | |
@@ -84,6 +86,7 @@ static Key keys[] = { | |
TAGKEYS( XK_8, 7) | |
TAGKEYS( XK_9, 8) | |
{ MODKEY|ShiftMask, XK_q, quit, {0} }, | |
+ { MODKEY, XK_mute, spawn, {.v = mute } }, | |
}; | |
/* button definitions */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/dwmstatus.c b/dwmstatus.c | |
index 236bca6..63e9e04 100644 | |
--- a/dwmstatus.c | |
+++ b/dwmstatus.c | |
@@ -12,9 +12,8 @@ | |
#include <X11/Xlib.h> | |
-char *tzargentina = "America/Buenos_Aires"; | |
char *tzutc = "UTC"; | |
-char *tzberlin = "Europe/Berlin"; | |
+char *tzoslo = "Europe/Oslo"; | |
static Display *dpy; | |
@@ -79,27 +78,33 @@ setstatus(char *str) | |
XSync(dpy, False); | |
} | |
-char * | |
-loadavg(void) | |
+void | |
+getbat(char * batname, char ** out) | |
{ | |
- double avgs[3]; | |
+ char path[100]; | |
+ char info[10]; | |
+ sprintf(path, "acpitool | awk '/%s/{print $5}'", batname); | |
- if (getloadavg(avgs, 3) < 0) { | |
- perror("getloadavg"); | |
- exit(1); | |
- } | |
+ FILE * fd = popen(path, "r"); | |
+ | |
+ if(fd) { | |
+ while(fgets(info, sizeof(info), fd) != NULL) { | |
+ strtok(info, "\n"); | |
+ //strcpy(out, info); | |
+ *out = strdup(info); | |
+ } | |
- return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]); | |
+ pclose(fd); | |
+ } | |
} | |
int | |
main(void) | |
{ | |
char *status; | |
- char *avgs; | |
- char *tmar; | |
char *tmutc; | |
char *tmbln; | |
+ char * bat1 = NULL, * bat0 = NULL; | |
if (!(dpy = XOpenDisplay(NULL))) { | |
fprintf(stderr, "dwmstatus: cannot open display.\n"); | |
@@ -107,19 +112,18 @@ main(void) | |
} | |
for (;;sleep(90)) { | |
- avgs = loadavg(); | |
- tmar = mktimes("%H:%M", tzargentina); | |
tmutc = mktimes("%H:%M", tzutc); | |
- tmbln = mktimes("KW %W %a %d %b %H:%M %Z %Y", tzberlin); | |
+ tmbln = mktimes("%a %d %b %H:%M %Z %Y", tzoslo); | |
+ getbat("Battery #1", &bat0); | |
+ getbat("Battery #2", &bat1); | |
- status = smprintf("L:%s A:%s U:%s %s", | |
- avgs, tmar, tmutc, tmbln); | |
+ status = smprintf("BAT0: %s | BAT1: %s | UTC: %s | %s", bat0, bat1, tmutc, tmbln); | |
setstatus(status); | |
- free(avgs); | |
- free(tmar); | |
free(tmutc); | |
free(tmbln); | |
free(status); | |
+ free(bat1); | |
+ free(bat0); | |
} | |
XCloseDisplay(dpy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/../surf-0.6/config.def.h b/config.h | |
index a221c86..bd5c9c5 100644 | |
--- a/../surf-0.6/config.def.h | |
+++ b/config.h | |
@@ -43,7 +43,7 @@ static Bool hidebackground = FALSE; | |
} \ | |
} | |
-#define MODKEY GDK_CONTROL_MASK | |
+#define MODKEY GDK_MOD4_MASK | |
/* hotkeys */ | |
/* | |
diff --git a/../surf-0.6/surf.c b/surf.c | |
index cebd469..73e1f5f 100644 | |
--- a/../surf-0.6/surf.c | |
+++ b/surf.c | |
@@ -680,7 +680,11 @@ newclient(void) { | |
*/ | |
gtk_window_set_role(GTK_WINDOW(c->win), "Surf"); | |
} | |
- gtk_window_set_default_size(GTK_WINDOW(c->win), 800, 600); | |
+ gtk_window_set_default_size(GTK_WINDOW(c->win), 1050, 1200); | |
+ | |
+ c->fullscreen = 0; | |
+ gtk_window_set_position(GTK_WINDOW(c->win), GTK_WIN_POS_CENTER_ALWAYS); | |
+ | |
g_signal_connect(G_OBJECT(c->win), | |
"destroy", | |
G_CALLBACK(destroywin), c); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment