Compare commits
2 Commits
5d2fdd0da9
...
0d3cf443d9
Author | SHA1 | Date | |
---|---|---|---|
0d3cf443d9 | |||
56ddeea9aa |
11
config.h
11
config.h
@ -1,10 +1,12 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 3; /* border pixel of windows */
|
static const char center_command[] = "/home/aselimov/bin/title_text.sh";
|
||||||
|
static const unsigned int borderpx = 2; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const unsigned int gappih = 15; /* horiz inner gap between windows */
|
static const unsigned int gappih = 15; /* horiz inner gap between windows */
|
||||||
static const unsigned int gappiv = 15; /* vert inner gap between windows */
|
static const unsigned int gappiv = 15; /* vert inner gap between windows */
|
||||||
|
static const int vertpadbar = 5; /* vertical padding for statusbar */
|
||||||
static const unsigned int gappoh =
|
static const unsigned int gappoh =
|
||||||
10; /* horiz outer gap between windows and screen edge */
|
10; /* horiz outer gap between windows and screen edge */
|
||||||
static const unsigned int gappov =
|
static const unsigned int gappov =
|
||||||
@ -17,7 +19,7 @@ static int smartgaps =
|
|||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char *fonts[] = {
|
static const char *fonts[] = {
|
||||||
"FiraCode Nerd Font:size=11:antialias=true:autohint=true"};
|
"SauceCodePro Nerd Font:size=12:antialias=true:autohint=true"};
|
||||||
static const char dmenufont[] =
|
static const char dmenufont[] =
|
||||||
"SauceCodePro Nerd Font:size=10:antialias=true:autohint=true";
|
"SauceCodePro Nerd Font:size=10:antialias=true:autohint=true";
|
||||||
static const char col_gray1[] = "#191919";
|
static const char col_gray1[] = "#191919";
|
||||||
@ -30,12 +32,12 @@ static const char col_red[] = "#de6e76";
|
|||||||
static const char col_yellow[] = "#d68c67";
|
static const char col_yellow[] = "#d68c67";
|
||||||
static const char col_teal[] = "#8ec07c";
|
static const char col_teal[] = "#8ec07c";
|
||||||
static const char col_purple[] = "#b16286";
|
static const char col_purple[] = "#b16286";
|
||||||
static const unsigned int baralpha = 175;
|
static const unsigned int baralpha = OPAQUE;
|
||||||
static const unsigned int borderalpha = OPAQUE;
|
static const unsigned int borderalpha = OPAQUE;
|
||||||
static const char *colors[][3] = {
|
static const char *colors[][3] = {
|
||||||
/* fg bg border */
|
/* fg bg border */
|
||||||
[SchemeNorm] = {col_gray3, col_gray1, col_gray1},
|
[SchemeNorm] = {col_gray3, col_gray1, col_gray1},
|
||||||
[SchemeSel] = {col_gray3, col_cyan, col_cyan},
|
[SchemeSel] = {col_gray3, col_cyan, col_gray3},
|
||||||
[SchemeStatus] = {col_gray3, col_gray1, col_gray1},
|
[SchemeStatus] = {col_gray3, col_gray1, col_gray1},
|
||||||
[SchemeTagsSel] = {col_gray3, col_gray1, col_gray1},
|
[SchemeTagsSel] = {col_gray3, col_gray1, col_gray1},
|
||||||
// Tagbar left unselected {text,background,not used but cannot be empty}
|
// Tagbar left unselected {text,background,not used but cannot be empty}
|
||||||
@ -77,6 +79,7 @@ static const Rule rules[] = {
|
|||||||
{"Sxiv", NULL, NULL, 0, 1, 0, 1, -1},
|
{"Sxiv", NULL, NULL, 0, 1, 0, 1, -1},
|
||||||
{"matplotlib", NULL, NULL, 0, 1, 0, 1, -1},
|
{"matplotlib", NULL, NULL, 0, 1, 0, 1, -1},
|
||||||
{"Matplotlib", NULL, NULL, 0, 1, 0, 1, -1},
|
{"Matplotlib", NULL, NULL, 0, 1, 0, 1, -1},
|
||||||
|
{"xcom2.exe", NULL, NULL, 0, 1, 0, 1, -1},
|
||||||
{NULL, NULL, "Figure 1", 0, 1, 0, 1, -1},
|
{NULL, NULL, "Figure 1", 0, 1, 0, 1, -1},
|
||||||
{NULL, NULL, "Figure 2", 0, 1, 0, 1, -1},
|
{NULL, NULL, "Figure 2", 0, 1, 0, 1, -1},
|
||||||
{NULL, NULL, "Figure 3", 0, 1, 0, 1, -1},
|
{NULL, NULL, "Figure 3", 0, 1, 0, 1, -1},
|
||||||
|
65
dwm.c
65
dwm.c
@ -51,6 +51,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/* macros */
|
/* macros */
|
||||||
|
#define MAX_LINE_LENGTH 1024
|
||||||
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
||||||
#define CLEANMASK(mask) \
|
#define CLEANMASK(mask) \
|
||||||
(mask & ~(numlockmask | LockMask) & \
|
(mask & ~(numlockmask | LockMask) & \
|
||||||
@ -198,6 +199,7 @@ typedef struct {
|
|||||||
} Rule;
|
} Rule;
|
||||||
|
|
||||||
/* function declarations */
|
/* function declarations */
|
||||||
|
char *exec_command_last_line(const char *command);
|
||||||
static void applyrules(Client *c);
|
static void applyrules(Client *c);
|
||||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw,
|
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw,
|
||||||
int interact);
|
int interact);
|
||||||
@ -899,20 +901,20 @@ void drawbar(Monitor *m) {
|
|||||||
}
|
}
|
||||||
w = blw = TEXTW(m->ltsymbol);
|
w = blw = TEXTW(m->ltsymbol);
|
||||||
drw_setscheme(drw, scheme[SchemeTagsNorm]);
|
drw_setscheme(drw, scheme[SchemeTagsNorm]);
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
static char text[MAX_LINE_LENGTH];
|
||||||
|
strcpy(text, exec_command_last_line(center_command));
|
||||||
|
int center_length = TEXTW(text);
|
||||||
|
int center_x = (m->ww - center_length) / 2;
|
||||||
|
x = drw_text(drw, x, 0, center_x - x, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
x = center_x;
|
||||||
if ((w = m->ww - tw - x) > bh) {
|
if ((w = m->ww - tw - x) > bh) {
|
||||||
if (m->sel) {
|
if (m->sel) {
|
||||||
// drw_setscheme(drw, scheme[m == selmon ?
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
// SchemeInfoSel : SchemeInfoNorm]);
|
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, " ", 0);
|
|
||||||
if (m->sel->isfloating)
|
|
||||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
|
||||||
} else {
|
} else {
|
||||||
drw_setscheme(drw, scheme[SchemeInfoNorm]);
|
|
||||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,8 +1375,8 @@ void moveresize(const Arg *arg) {
|
|||||||
&wAbs, &h, &hAbs) != 8)
|
&wAbs, &h, &hAbs) != 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* compute new window position; prevent window from be positioned outside the
|
/* compute new window position; prevent window from be positioned outside
|
||||||
* current monitor */
|
* the current monitor */
|
||||||
nw = c->w + w;
|
nw = c->w + w;
|
||||||
if (wAbs == 'W')
|
if (wAbs == 'W')
|
||||||
nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw;
|
nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw;
|
||||||
@ -1603,10 +1605,12 @@ void run(void) {
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
/* main event loop */
|
/* main event loop */
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while (running && !XNextEvent(dpy, &ev))
|
int ticks = 0;
|
||||||
|
while (running && !XNextEvent(dpy, &ev)) {
|
||||||
if (handler[ev.type])
|
if (handler[ev.type])
|
||||||
handler[ev.type](&ev); /* call handler */
|
handler[ev.type](&ev); /* call handler */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void scan(void) {
|
void scan(void) {
|
||||||
unsigned int i, num;
|
unsigned int i, num;
|
||||||
@ -1781,7 +1785,7 @@ void setup(void) {
|
|||||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||||
die("no fonts could be loaded.");
|
die("no fonts could be loaded.");
|
||||||
lrpad = drw->fonts->h;
|
lrpad = drw->fonts->h;
|
||||||
bh = drw->fonts->h + 2;
|
bh = drw->fonts->h + vertpadbar;
|
||||||
updategeom();
|
updategeom();
|
||||||
/* init atoms */
|
/* init atoms */
|
||||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||||
@ -2601,3 +2605,38 @@ void runAutostart(void) {
|
|||||||
system("cd ~/.dwm; ./autostart_blocking.sh");
|
system("cd ~/.dwm; ./autostart_blocking.sh");
|
||||||
system("cd ~/.dwm; ./autostart.sh &");
|
system("cd ~/.dwm; ./autostart.sh &");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *exec_command_last_line(const char *command) {
|
||||||
|
static char last_line[MAX_LINE_LENGTH];
|
||||||
|
|
||||||
|
if (!command) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *pipe = popen(command, "r");
|
||||||
|
if (!pipe) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[MAX_LINE_LENGTH];
|
||||||
|
int found_line = 0;
|
||||||
|
|
||||||
|
// Read all lines and keep track of the last non-empty one
|
||||||
|
while (fgets(buffer, sizeof(buffer), pipe) != NULL) {
|
||||||
|
// Remove trailing newline if present
|
||||||
|
size_t len = strlen(buffer);
|
||||||
|
if (len > 0 && buffer[len - 1] == '\n') {
|
||||||
|
buffer[len - 1] = '\0';
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip empty lines
|
||||||
|
if (len > 0) {
|
||||||
|
strcpy(last_line, buffer);
|
||||||
|
found_line = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose(pipe);
|
||||||
|
return found_line ? last_line : NULL;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user