Compare commits
No commits in common. "0d3cf443d907fa672e21286e9aaba6f54790c1bb" and "5d2fdd0da93744c1ad4309ec7023a9d5b95162a0" have entirely different histories.
0d3cf443d9
...
5d2fdd0da9
11
config.h
11
config.h
@ -1,12 +1,10 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/* appearance */
|
||||
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 borderpx = 3; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const unsigned int gappih = 15; /* horiz 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 =
|
||||
10; /* horiz outer gap between windows and screen edge */
|
||||
static const unsigned int gappov =
|
||||
@ -19,7 +17,7 @@ static int smartgaps =
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {
|
||||
"SauceCodePro Nerd Font:size=12:antialias=true:autohint=true"};
|
||||
"FiraCode Nerd Font:size=11:antialias=true:autohint=true"};
|
||||
static const char dmenufont[] =
|
||||
"SauceCodePro Nerd Font:size=10:antialias=true:autohint=true";
|
||||
static const char col_gray1[] = "#191919";
|
||||
@ -32,12 +30,12 @@ static const char col_red[] = "#de6e76";
|
||||
static const char col_yellow[] = "#d68c67";
|
||||
static const char col_teal[] = "#8ec07c";
|
||||
static const char col_purple[] = "#b16286";
|
||||
static const unsigned int baralpha = OPAQUE;
|
||||
static const unsigned int baralpha = 175;
|
||||
static const unsigned int borderalpha = OPAQUE;
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = {col_gray3, col_gray1, col_gray1},
|
||||
[SchemeSel] = {col_gray3, col_cyan, col_gray3},
|
||||
[SchemeSel] = {col_gray3, col_cyan, col_cyan},
|
||||
[SchemeStatus] = {col_gray3, col_gray1, col_gray1},
|
||||
[SchemeTagsSel] = {col_gray3, col_gray1, col_gray1},
|
||||
// Tagbar left unselected {text,background,not used but cannot be empty}
|
||||
@ -79,7 +77,6 @@ static const Rule rules[] = {
|
||||
{"Sxiv", 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 2", 0, 1, 0, 1, -1},
|
||||
{NULL, NULL, "Figure 3", 0, 1, 0, 1, -1},
|
||||
|
65
dwm.c
65
dwm.c
@ -51,7 +51,6 @@
|
||||
#include "util.h"
|
||||
|
||||
/* macros */
|
||||
#define MAX_LINE_LENGTH 1024
|
||||
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
||||
#define CLEANMASK(mask) \
|
||||
(mask & ~(numlockmask | LockMask) & \
|
||||
@ -199,7 +198,6 @@ typedef struct {
|
||||
} Rule;
|
||||
|
||||
/* function declarations */
|
||||
char *exec_command_last_line(const char *command);
|
||||
static void applyrules(Client *c);
|
||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw,
|
||||
int interact);
|
||||
@ -901,20 +899,20 @@ void drawbar(Monitor *m) {
|
||||
}
|
||||
w = blw = TEXTW(m->ltsymbol);
|
||||
drw_setscheme(drw, scheme[SchemeTagsNorm]);
|
||||
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;
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
if ((w = m->ww - tw - x) > bh) {
|
||||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
|
||||
// drw_setscheme(drw, scheme[m == selmon ?
|
||||
// SchemeInfoSel : SchemeInfoNorm]);
|
||||
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 {
|
||||
drw_setscheme(drw, scheme[SchemeInfoNorm]);
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
|
||||
@ -1375,8 +1373,8 @@ void moveresize(const Arg *arg) {
|
||||
&wAbs, &h, &hAbs) != 8)
|
||||
return;
|
||||
|
||||
/* compute new window position; prevent window from be positioned outside
|
||||
* the current monitor */
|
||||
/* compute new window position; prevent window from be positioned outside the
|
||||
* current monitor */
|
||||
nw = c->w + w;
|
||||
if (wAbs == 'W')
|
||||
nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw;
|
||||
@ -1605,12 +1603,10 @@ void run(void) {
|
||||
XEvent ev;
|
||||
/* main event loop */
|
||||
XSync(dpy, False);
|
||||
int ticks = 0;
|
||||
while (running && !XNextEvent(dpy, &ev)) {
|
||||
while (running && !XNextEvent(dpy, &ev))
|
||||
if (handler[ev.type])
|
||||
handler[ev.type](&ev); /* call handler */
|
||||
}
|
||||
}
|
||||
|
||||
void scan(void) {
|
||||
unsigned int i, num;
|
||||
@ -1785,7 +1781,7 @@ void setup(void) {
|
||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h;
|
||||
bh = drw->fonts->h + vertpadbar;
|
||||
bh = drw->fonts->h + 2;
|
||||
updategeom();
|
||||
/* init atoms */
|
||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
@ -2605,38 +2601,3 @@ void runAutostart(void) {
|
||||
system("cd ~/.dwm; ./autostart_blocking.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