From 0a1041044141ddbda0c67602e70fe8894e7430fd Mon Sep 17 00:00:00 2001 From: Nicholas Date: Sun, 7 Nov 2021 11:43:28 -0800 Subject: config changes for laptop --- bin/status | 22 +++++++++++----------- bin/updatedirs | 3 +-- rules.mk | 6 ++++-- sys/cmd/dwm/config.h | 4 ++-- sys/cmd/menu/config.h | 2 +- sys/cmd/menu/menu.c | 19 ++++++++++++++++--- sys/cmd/term/config.h | 6 +++--- sys/cmd/term/hb.c | 2 +- sys/cmd/term/rules.mk | 2 +- sys/cmd/term/term.c | 40 +++++++++++++++++++++------------------- sys/cmd/term/term.h | 2 +- sys/cmd/term/x.c | 16 ++++++++++++++-- vendor/sync | 2 +- 13 files changed, 77 insertions(+), 49 deletions(-) diff --git a/bin/status b/bin/status index bca791a..67c0ff6 100755 --- a/bin/status +++ b/bin/status @@ -7,7 +7,7 @@ cpu() { } mail() { - NEWMAIL=$(expr $(ls -1 ~/mail/*/INBOX/new | wc -l) - 7) + NEWMAIL=$(expr $(ls -1 ~/mail/*/INBOX/new | wc -l) - 5) if [ "${NEWMAIL%% *}" -eq 0 ]; then printf " (%s)" "${NEWMAIL%% *}" @@ -17,8 +17,8 @@ mail() { } battery() { - CHARGE=$(cat /sys/class/power_supply/BAT0/capacity) - STATUS=$(cat /sys/class/power_supply/BAT0/status) + CHARGE=$(cat /sys/class/power_supply/BAT1/capacity) + STATUS=$(cat /sys/class/power_supply/BAT1/status) if [ "$STATUS" = "Charging" ]; then printf " %s%%" "$CHARGE" else @@ -35,16 +35,17 @@ battery() { } volume() { - VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/") + VOL=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}') + VOL=${VOL::-1} if [ "$VOL" -eq 0 ]; then - printf "🔇" + printf "" elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then - printf "🔈%s%%" "$VOL" + printf "%s%%" "$VOL" elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then - printf "🔉%s%%" "$VOL" + printf "%s%%" "$VOL" else - printf "🔊%s%%" "$VOL" + printf "%s%%" "$VOL" fi } @@ -71,8 +72,7 @@ ipaddr() { dostatus() { # xsetroot -name "$VOL│$MEM│$IP│$CPU│$NML│$WTR│$TIM" - xsetroot -name "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM" - # echo "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM" + exec xsetroot -name "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM" } # signal handlers @@ -146,6 +146,6 @@ do refresh_cpu refresh_mail refresh_time - dostatus + dostatus & sleep 1m & wait $! done diff --git a/bin/updatedirs b/bin/updatedirs index 1ec2e25..cde7a6b 100755 --- a/bin/updatedirs +++ b/bin/updatedirs @@ -1,8 +1,7 @@ #!/bin/python - import os -ROOT = "/home/nolln/root" +ROOT = "/home/nolln/u" SRCS = ["src", "sys"] BUILD = ".build" TEST = ".test" diff --git a/rules.mk b/rules.mk index 23ae5b7..d4c7bf9 100644 --- a/rules.mk +++ b/rules.mk @@ -69,12 +69,14 @@ clean: install: targets @echo installing executables @if [ -n $$BINS ]; then\ - cp $(BINS) $(BIN_DIR); \ + install $(BINS) $(BIN_DIR); \ fi @echo installing libraries @if [ -n $$LIBS ]; then\ - cp $(LIBS) $(LIB_DIR); \ + install $(LIBS) $(LIB_DIR); \ fi + @echo installing terminfo + @tic -sx sys/cmd/term/term.info database: compiledb make -j4 diff --git a/sys/cmd/dwm/config.h b/sys/cmd/dwm/config.h index a24bcc7..1f82b1f 100644 --- a/sys/cmd/dwm/config.h +++ b/sys/cmd/dwm/config.h @@ -2,13 +2,13 @@ #define VERSION "1" /* appearance */ -static uint borderpx = 1; /* border pixel of windows */ +static uint borderpx = 2; /* border pixel of windows */ static uint gapx = 4; /* gaps between windows */ static uint snap = 32; /* snap pixel */ static int swallowfloating = 0; /* 1 will swallow floating by default */ static int showbar = 1; /* 0 means no bar */ static int topbar = 1; /* 0 means bottom bar */ -static char *fonts[] = { "consolas:size=12" }; +static char *fonts[] = { "consolas:size=16" }; static char col_gray1[] = "#504945"; static char col_gray2[] = "#282828"; static char col_gray3[] = "#fbf1c7"; diff --git a/sys/cmd/menu/config.h b/sys/cmd/menu/config.h index fb1614d..9bfd5b3 100644 --- a/sys/cmd/menu/config.h +++ b/sys/cmd/menu/config.h @@ -5,7 +5,7 @@ static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { - "consolas:size=12" + "consolas:size=16" }; static const char *prompt = "cmds"; /* -p option; prompt to the left of input field */ diff --git a/sys/cmd/menu/menu.c b/sys/cmd/menu/menu.c index f0d1276..e6e4bb2 100644 --- a/sys/cmd/menu/menu.c +++ b/sys/cmd/menu/menu.c @@ -3,7 +3,7 @@ static char text[BUFSIZ] = ""; static char *embed; static int bh, mw, mh; -static int inputw = 0, promptw; +static int inputw = 0, promptw, passwd = 0; static int lrpad; /* sum of left and right padding */ static size_t cursor; static struct item *items = nil; @@ -104,6 +104,7 @@ drawmenu(void) uint curpos; struct item *item; int x = 0, y = 0, w; + char *censort; drw_setscheme(drw, scheme[SchemeNorm]); drw_rect(drw, 0, 0, mw, mh, 1, 1); @@ -116,6 +117,12 @@ drawmenu(void) w = (lines > 0 || !matches) ? mw - x : inputw; drw_setscheme(drw, scheme[SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); + if(passwd){ + censort = ecalloc(1, sizeof(text)); + memset(censort, '.', strlen(text)); + drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0); + free(censort); + } curpos = TEXTW(text) - TEXTW(&text[cursor]); if ((curpos += lrpad / 2 - 1) < w) { @@ -498,13 +505,17 @@ paste(void) drawmenu(); } -static +static void readstdin(void) { char buf[sizeof text], *p; size_t i, imax = 0, size = 0; uint tmpmax = 0; + if(passwd){ + inputw = lines = 0; + return; + } /* read each line from stdin and add it to the item list */ for (i = 0; fgets(buf, sizeof buf, stdin); i++) { @@ -670,7 +681,7 @@ static void usage(void) { - fputs("usage: menu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" + fputs("usage: menu [-bfivP] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); exit(1); } @@ -693,6 +704,8 @@ main(int argc, char *argv[]) else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ fstrncmp = strncasecmp; fstrstr = cistrstr; + } else if (!strcmp(argv[i], "-P")) { + passwd = 1; } else if (i + 1 == argc) usage(); /* these options take one argument */ diff --git a/sys/cmd/term/config.h b/sys/cmd/term/config.h index 40bc759..a740ecf 100644 --- a/sys/cmd/term/config.h +++ b/sys/cmd/term/config.h @@ -6,7 +6,7 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "consolas:pixelsize=16:antialias=true"; +static char *font = "consolas:size=16"; static int borderpx = 2; /* @@ -154,8 +154,8 @@ static uint rows = 24; * Default colour and shape of the mouse cursor */ static uint mouseshape = XC_left_ptr; -static uint mousefg = 7; -static uint mousebg = 0; +static uint mousefg = 0; +static uint mousebg = 7; /* * Color used to display font attributes when fontconfig selected a font which diff --git a/sys/cmd/term/hb.c b/sys/cmd/term/hb.c index 4aed59b..4b6b42d 100644 --- a/sys/cmd/term/hb.c +++ b/sys/cmd/term/hb.c @@ -1,7 +1,7 @@ #include "term.h" #include -#include +#include #define FEATURE(c1,c2,c3,c4) { .tag = HB_TAG(c1,c2,c3,c4), .value = 1, .start = HB_FEATURE_GLOBAL_START, .end = HB_FEATURE_GLOBAL_END } diff --git a/sys/cmd/term/rules.mk b/sys/cmd/term/rules.mk index ef307c1..3d25464 100644 --- a/sys/cmd/term/rules.mk +++ b/sys/cmd/term/rules.mk @@ -16,7 +16,7 @@ $(BINS_$(d)): TCFLAGS = \ $(BINS_$(d)): TCLIBS = \ `$(PKG) --libs fontconfig` \ `$(PKG) --libs freetype2` \ - -lm -lrt -lX11 -lutil -lXft -lXrender -lharfbuzz + -lm -lrt -lX11 -lutil -lXft -lXrender #-lharfbuzz $(BINS_$(d)): $(OBJS_$(d)) $(OBJ_DIR)/sys/libunicode/libunicode.a $(OBJ_DIR)/sys/base/base.a $(COMPLINK) diff --git a/sys/cmd/term/term.c b/sys/cmd/term/term.c index f92db28..3cd99c3 100644 --- a/sys/cmd/term/term.c +++ b/sys/cmd/term/term.c @@ -289,11 +289,11 @@ selnormalize(void) int selected(int x, int y) { - if (sel.mode == SelEmpty || sel.ob.x == -1 || + if(sel.mode == SelEmpty || sel.ob.x == -1 || sel.alt != IS_SET(Taltscreen)) return 0; - if (sel.type == SelRectangular) + if(sel.type == SelRectangular) return BETWEEN(y, sel.nb.y, sel.ne.y) && BETWEEN(x, sel.nb.x, sel.ne.x); @@ -389,16 +389,16 @@ getsel(void) ptr = str = xmalloc(bufsize); /* append every set & selected glyph to the selection */ - for (y = sel.nb.y; y <= sel.ne.y; y++) { - if ((linelen = tlinelen(y)) == 0) { + for(y = sel.nb.y; y <= sel.ne.y; y++) { + if((linelen = tlinelen(y)) == 0) { *ptr++ = '\n'; continue; } - if (sel.type == SelRectangular) { + if(sel.type == SelRectangular) { gp = &term.line[y][sel.nb.x]; lastx = sel.ne.x; - } else { + }else{ gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; } @@ -1016,9 +1016,9 @@ tclearregion(int x1, int y1, int x2, int y2) int x, y, temp; Letter *gp; - if (x1 > x2) + if(x1 > x2) temp = x1, x1 = x2, x2 = temp; - if (y1 > y2) + if(y1 > y2) temp = y1, y1 = y2, y2 = temp; LIMIT(x1, 0, term.col-1); @@ -1026,11 +1026,11 @@ tclearregion(int x1, int y1, int x2, int y2) LIMIT(y1, 0, term.row-1); LIMIT(y2, 0, term.row-1); - for (y = y1; y <= y2; y++) { + for(y = y1; y <= y2; y++) { term.dirty[y] = 1; - for (x = x1; x <= x2; x++) { + for(x = x1; x <= x2; x++) { gp = &term.line[y][x]; - if (selected(x, y)) + if(selected(x, y)) selclear(); gp->fg = term.c.attr.fg; gp->bg = term.c.attr.bg; @@ -2104,9 +2104,11 @@ tputc(rune u) else return; +#if 0 if(!hb_unicode_compose(hb_unicode_funcs_get_default(),gp->u, u, &nu)) { return; } +#endif gp->u = nu; return; @@ -2134,7 +2136,7 @@ tputc(rune u) goto check_control_code; } - if (IS_SET(Tsixel)) { + if(IS_SET(Tsixel)) { /* TODO: implement sixel mode */ return; } @@ -2155,7 +2157,7 @@ tputc(rune u) * term.esc = 0; * strhandle(); */ - if (strescseq.siz > (SIZE_MAX - UTFmax) / 2) + if(strescseq.siz > (SIZE_MAX - UTFmax) / 2) return; strescseq.siz *= 2; strescseq.buf = xrealloc(strescseq.buf, strescseq.siz); @@ -2210,20 +2212,20 @@ check_control_code: return; } - if (selected(term.c.x, term.c.y)) + if(selected(term.c.x, term.c.y)) selclear(); gp = &term.line[term.c.y][term.c.x]; - if (IS_SET(Twrap) && (term.c.state & CursorWrap)) { + if(IS_SET(Twrap) && (term.c.state & CursorWrap)) { gp->mode |= Gwrap; tnewline(1); gp = &term.line[term.c.y][term.c.x]; } - if (IS_SET(Tinsert) && term.c.x+width < term.col) + if(IS_SET(Tinsert) && term.c.x+width < term.col) memmove(gp+width, gp, (term.col - term.c.x - width) * sizeof(Letter)); - if (term.c.x+width > term.col) { + if(term.c.x+width > term.col) { tnewline(1); gp = &term.line[term.c.y][term.c.x]; } @@ -2238,9 +2240,9 @@ check_control_code: gp[1].mode = Gwdummy; } } - if (term.c.x+width < term.col) { + if(term.c.x+width < term.col) { tmoveto(term.c.x+width, term.c.y); - } else { + }else{ term.c.state |= CursorWrap; } } diff --git a/sys/cmd/term/term.h b/sys/cmd/term/term.h index 3ff2852..4cd8b4b 100644 --- a/sys/cmd/term/term.h +++ b/sys/cmd/term/term.h @@ -11,7 +11,7 @@ #include #include -#include +#include // ----------------------------------------------------------------------- // macros diff --git a/sys/cmd/term/x.c b/sys/cmd/term/x.c index ea64bff..27a2e7a 100644 --- a/sys/cmd/term/x.c +++ b/sys/cmd/term/x.c @@ -12,8 +12,10 @@ #include /* harfbuzz additions */ +#if 0 void hbunloadfonts(); void hbtransform(XftGlyphFontSpec *, const Letter*, size_t, int, int); +#endif /* types used in config.h */ typedef struct Shortcut Shortcut; @@ -1025,7 +1027,9 @@ xunloadfont(Font *f) void xunloadfonts(void) { +#if 0 hbunloadfonts(); +#endif /* Free the loaded fonts in the font cache. */ while (frclen > 0) @@ -1235,11 +1239,14 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, Letter *glyphs, int len, int x, int mode = glyphs[i].mode; /* Skip dummy wide-character spacing. */ +#if 0 if(mode & Gwdummy) +#endif + if(mode == Gwdummy) continue; /* Determine font for glyph if different from previous glyph. */ - if(prevmode != mode) { + if(prevmode != mode){ prevmode = mode; font = &dc.font; frcflags = FRC_NORMAL; @@ -1259,7 +1266,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, Letter *glyphs, int len, int x, int /* lookup character index with default font. */ glyphidx = XftCharIndex(xw.dpy, font->match, r); - if(glyphidx) { + if(glyphidx){ specs[numspecs].font = font->match; specs[numspecs].glyph = glyphidx; specs[numspecs].x = (short)xp; @@ -1342,7 +1349,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, Letter *glyphs, int len, int x, int numspecs++; } +#if 0 hbtransform(specs, glyphs, len, x, y); +#endif return numspecs; } @@ -1489,7 +1498,10 @@ xdrawcursor(int cx, int cy, Letter g, int ox, int oy, Letter og, Letter *line, i /* remove the old cursor */ if(selected(ox, oy)) og.mode ^= Greverse; + xdrawglyph(og, ox, oy); +#if 0 xdrawline(line, 0, oy, len); +#endif if(IS_SET(Whide)) return; diff --git a/vendor/sync b/vendor/sync index 44d751e..5daf751 100755 --- a/vendor/sync +++ b/vendor/sync @@ -2,7 +2,7 @@ # globals -ROOT=~/root +ROOT=~/u VENDOR=$ROOT/vendor # ------------------------------------------------------------------------ -- cgit v1.2.1