slight cleanup

This commit is contained in:
speedie 2023-01-18 18:47:27 +01:00
parent f7e22401b1
commit a91882c32f
2 changed files with 20 additions and 20 deletions

View file

@ -1042,7 +1042,7 @@ struct client_ref_t* copy_clients(Client *clients)
for (Client *c = nexttiled(clients); c != NULL; c = nexttiled(c->next)) {
tail->next = (struct client_ref_t*) malloc(sizeof(struct client_ref_t));
tail = tail->next;
tail->next = NULL;
tail->c = c;
}
@ -1190,7 +1190,7 @@ s_recur_analyze(struct client_ref_t **clients, node_t *node)
for (; *clients != NULL && n != NULL; n = n->next )
{
x = s_recur_analyze(clients, n);
/* Attach the received tree to the tail of the previous element */
if (x.head != NULL) {
tail->next = x.head;
@ -1248,7 +1248,7 @@ s_recur_resize(node_t *node, struct frame_t frame)
frame.y += node->margin;
frame.w -= 2 * node->margin;
frame.h -= 2 * node->margin;
node_length(node->branch, &len, &wgt);
if (len != 0) {
delta = frame.h / len;
@ -1277,7 +1277,7 @@ s_recur_resize(node_t *node, struct frame_t frame)
frame.y += node->margin;
frame.w -= 2 * node->margin;
frame.h -= 2 * node->margin;
node_length(node->branch, &len, &wgt);
if (len != 0) {
delta = frame.w / len;
@ -1520,7 +1520,7 @@ node_t* parse_sexp(string_token_t **token)
t = t->next;
continue;
}
/* 'n' client */
unsigned long n = 0;
char *endp = NULL;
@ -1567,7 +1567,7 @@ node_t* parse_sexp(string_token_t **token)
}
/* margin */
if (((strcmp(t->token, "m:") == 0) || strcmp(t->token, ":m") == 0
if (((strcmp(t->token, "m:") == 0) || strcmp(t->token, ":m") == 0
|| strcmp(t->token, "margin:") == 0
|| strcmp(t->token, ":margin") == 0) && head != NULL) {
t = t->next;
@ -1636,24 +1636,29 @@ void set_s_layout(const Arg *arg)
char pathbuf[1024];
char *home = getenv("HOME");
int sortout = 0;
int histout = 0;
if (home != NULL) {
snprintf(pathbuf, 1023, "%s/" CUSTOM_HISTORY, home);
pathbuf[1023] = '\0';
// make sure the history file exists
hf = fopen(CUSTOM_HISTORY, "a"); fclose(hf);
system("sort " CUSTOM_HISTORY " | uniq > " CUSTOM_HISTORY "~");
system("mv " CUSTOM_HISTORY "~ " CUSTOM_HISTORY);
sortout = system("sort " CUSTOM_HISTORY " | uniq > " CUSTOM_HISTORY "~");
histout = system("mv " CUSTOM_HISTORY "~ " CUSTOM_HISTORY);
pp = popen("dmenu -i -l 10 -p 'Enter expression:' <" CUSTOM_HISTORY, "r");
} else {
pp = popen("dmenu -i -l 10 -p 'Enter expression:'", "r");
}
if (!pp) return;
if (sortout || !sortout || histout || !histout)
if (!pp) return;
char buf[1024 + 1];
buf[1024] = '\0';
fgets(buf, 1024, pp);
if (!fgets(buf, 1024, pp)) return;
fclose(pp);
if (buf[0] == '\0') return;

View file

@ -809,9 +809,6 @@ static pid_t winpid(Window w);
/* variables */
static const char notitle[] = ""; /* Title when none can be grabbed. */
#if USEMOUSE
static const char *layoutcmd = "speedwm-utils layout";
#endif
static Client *lastfocused = NULL;
static char stext[1024]; /* max character count */
static char rawstext[1024]; /* max character count */
@ -3131,7 +3128,6 @@ void
setbarheight(const Arg *arg)
{
bh += arg->i;
Monitor *m;
Bar *bar;
if (bh < drw->font->h)
@ -4590,8 +4586,6 @@ resizeclient(Client *c, int x, int y, int w, int h)
c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h;
int n;
if (c->beingmoved)
return;
@ -6524,11 +6518,12 @@ main(int argc, char *argv[])
XrmInitialize();
/* dotfiles */
system("[ -e $HOME/.speedwmrc ] && xrdb -override $HOME/.speedwmrc");
system("[ -e $HOME/.config/speedwm/speedwmrc ] && xrdb -override $HOME/.config/speedwm/speedwmrc");
int homexrdb = system("[ -e $HOME/.speedwmrc ] && xrdb -override $HOME/.speedwmrc");
int confxrdb = system("[ -e $HOME/.config/speedwm/speedwmrc ] && xrdb -override $HOME/.config/speedwm/speedwmrc");
/* autostart */
autostart_exec();
if (homexrdb || confxrdb || !homexrdb || !confxrdb)
autostart_exec();
/* load colors */
#if USEXRESOURCES