aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nnoll523@gmail.com>2020-07-19 09:28:46 -0700
committerNicholas Noll <nnoll523@gmail.com>2020-07-19 09:28:46 -0700
commita576520dce2a34424af67358e98d79a06e736911 (patch)
tree38ede99a3cc90544c9d119e2b49cc865b240391a
parentd4166afda314d3f3326e9f73659a0b4515f2ae65 (diff)
chore: update
-rwxr-xr-xbin/gentags28
-rwxr-xr-xinit57
-rw-r--r--sys/cmd/dwm/config.h3
-rw-r--r--sys/cmd/dwm/dwm.c8
-rw-r--r--sys/cmd/dwm/dwm.h2
-rw-r--r--sys/cmd/dwm/hook.c29
-rw-r--r--sys/cmd/term/x.c2
7 files changed, 56 insertions, 73 deletions
diff --git a/bin/gentags b/bin/gentags
index f398349..d9019c9 100755
--- a/bin/gentags
+++ b/bin/gentags
@@ -1,20 +1,18 @@
-#!/bin/bash
+#!/bin/sh
-CSCOPE_DIR="$PWD/.cscope"
+# TAGS=".tag-files"
-if [ ! -d "$CSCOPE_DIR" ]; then
-mkdir "$CSCOPE_DIR"
-fi
+# echo "finding files ..."
+# ROOT=/home/nolln/root
+# find $ROOT \
+# -path "$ROOT/sys/*.[chs]" -prune -o \
+# -path "$ROOT/vendor/musl/src/*.[chs]" -prune -o \
+# -path "$ROOT/include/*.h" \
+# -path "$ROOT/include/vendor/*.h" > "$TAGS"
-echo "finding files ..."
-ROOT=/home/nolln/root
-find $ROOT \
- -path "$ROOT/sys/*.[chs]" -prune -o \
- -path "$ROOT/vendor/musl/src/*.[chs]" -prune -o \
- -path "$ROOT/include/*.h" > "$CSCOPE_DIR/files"
+ctags -R -f .tags .
-echo "adding files to cscope db: $ROOT/cscope.db ..."
-cscope -b -k -I include/vendor/libc -I include/ -i "$CSCOPE_DIR/files"
+# cscope -b -k -I include/vendor/libc -I include/ -i "$CSCOPE_DIR/files"
-CSCOPE_DB="$ROOT/cscope.out"
-echo "exported CSCOPE_DB to: '$CSCOPE_DB'"
+# CSCOPE_DB="$ROOT/cscope.out"
+# echo "exported CSCOPE_DB to: '$CSCOPE_DB'"
diff --git a/init b/init
deleted file mode 100755
index 32b810d..0000000
--- a/init
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-# this script should only be run once per initialization of the repo
-# it's job is to pull in code external to the source tree
-# after it completes, simply run make
-
-# TODO: set up cross compiling directories
-
-inc=$PWD/include/vendor
-lib=$PWD/lib
-root=$PWD
-
-if [ -d vendor -a -z $1 ]; then
- echo already initialized, remove vendor directory or force argument to rerun
-else
- # setup directories
- mkdir -p vendor 1>&2 2>/dev/null
- mkdir -p $lib 1>&2 2>/dev/null
- mkdir -p $inc 1>&2 2>/dev/null
-
- # install musl
- # dependencies: nil
- if [ -d $inc/libc ]; then
- echo libc found, skipping
- else
- git clone git://git.musl-libc.org/musl vendor/musl
- cd vendor/musl && ./configure && make
-
- cp -r obj/include $inc/libc
- cp -r obj/crt $lib/crt
- cp -r lib/*.a $lib
- fi
-
- cd $root
-
- # install OpenBLAS
- # dependencies: gfortran
- # warning: this is a _monster_
- if [ -d $inc/blas ]; then
- echo blas found, skipping
- else
- git clone https://github.com/xianyi/OpenBLAS.git vendor/blas
- cd vendor/blas && make USE_THREAD=0 -j4
-
- cp libopenblas_*.a $lib/libblas.a
- mkdir -p $inc/blas
- cp cblas.h common*.h config.h param.h $inc/blas
-
- # install LAPACKE ...ugh...
- cd lapack-netlib && cp make.inc.example make.inc && make -j4
- cd LAPACKE && make && cd ..
- cp liblapack.a liblapacke.a $lib
- cp LAPACKE/include/lapack*.h $inc/blas
- fi
-
- cd $root
-fi
diff --git a/sys/cmd/dwm/config.h b/sys/cmd/dwm/config.h
index e0183b6..6866f80 100644
--- a/sys/cmd/dwm/config.h
+++ b/sys/cmd/dwm/config.h
@@ -60,6 +60,8 @@ static Layout layouts[] = {
static char *menucmd[] = { "menu_run", nil };
static char *termcmd[] = { "term", nil };
static char *webscmd[] = { "qutebrowser", nil };
+static char scratchname[] = "scratchpad";
+static char *scratchcmd[] = { "term", "-t", scratchname, "-g", "120x34", nil };
static char *upvolcmd[] = { "vol", "+5%", nil };
static char *lovolcmd[] = { "vol", "-5%", nil };
static char *novolcmd[] = { "vol", "mute", nil };
@@ -76,6 +78,7 @@ static Key keys[] = {
{ 0, XK_upvol, spawn, {.v = upvolcmd} },
{ 0, XK_lovol, spawn, {.v = lovolcmd} },
{ 0, XK_novol, spawn, {.v = novolcmd} },
+ { MODKEY, XK_s, togglescratch, {.v = scratchcmd} },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_f, togglefocus, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
diff --git a/sys/cmd/dwm/dwm.c b/sys/cmd/dwm/dwm.c
index 87613ec..a6d2bd2 100644
--- a/sys/cmd/dwm/dwm.c
+++ b/sys/cmd/dwm/dwm.c
@@ -536,6 +536,14 @@ manage(Window w, XWindowAttributes *wa)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
c->bw = borderpx;
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
+ if(!strcmp(c->name, scratchname)) {
+ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
+ c->isfloating = 1;
+ c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
+ c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
+ }
+
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
diff --git a/sys/cmd/dwm/dwm.h b/sys/cmd/dwm/dwm.h
index 3f2dd0e..6493093 100644
--- a/sys/cmd/dwm/dwm.h
+++ b/sys/cmd/dwm/dwm.h
@@ -220,6 +220,7 @@ extern int lrpad;
extern int (*xerrorxlib)(Display *, XErrorEvent *);
extern uint numlockmask;
extern void (*handler[LASTEvent]) (XEvent *);
+extern int scratchtag;
extern xcb_connection_t *xcon;
@@ -313,6 +314,7 @@ void tile(Monitor *);
void togglebar(Arg *arg);
void togglefocus(Arg *arg);
void togglefloating(Arg *arg);
+void togglescratch(Arg *arg);
void toggletag(Arg *arg);
void toggleview(Arg *arg);
void unfocus(Client *c, int setfocus);
diff --git a/sys/cmd/dwm/hook.c b/sys/cmd/dwm/hook.c
index 1ad45df..cc96ead 100644
--- a/sys/cmd/dwm/hook.c
+++ b/sys/cmd/dwm/hook.c
@@ -1,5 +1,7 @@
#include "dwm.h"
+int scratchtag = 1 << arrlen(tags);
+
void
focusmon(Arg *arg)
{
@@ -254,6 +256,8 @@ setmfact(Arg *arg)
void
spawn(Arg *arg)
{
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
+
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));
@@ -307,6 +311,31 @@ togglefloating(Arg *arg)
}
void
+togglescratch(Arg *arg)
+{
+ Client *c;
+ uint f = 0;
+
+ for(c = selmon->clients; c && !(f = (c->tags & scratchtag)); c = c->next)
+ ;
+
+ if(f) {
+ f = selmon->tagset[selmon->seltags] ^ scratchtag;
+ if(f) {
+ selmon->tagset[selmon->seltags] = f;
+ focus(nil);
+ arrange(selmon);
+ }
+ if(ISVISIBLE(c)) {
+ focus(c);
+ restack(selmon);
+ }
+ } else
+ spawn(arg);
+
+}
+
+void
toggletag(Arg *arg)
{
uint newtags;
diff --git a/sys/cmd/term/x.c b/sys/cmd/term/x.c
index 1da23cb..308478f 100644
--- a/sys/cmd/term/x.c
+++ b/sys/cmd/term/x.c
@@ -2031,7 +2031,7 @@ run:
opt_cmd = argv;
if (!opt_title)
- opt_title = (opt_line || !opt_cmd) ? "st" : opt_cmd[0];
+ opt_title = (opt_line || !opt_cmd) ? "term" : opt_cmd[0];
setlocale(LC_CTYPE, "");
XSetLocaleModifiers("");