dotfiles

Dotfiles for my OpenBSD environment.
Log | Files | Refs

commit 7a5ff93150b84afc2b7c5cdb4205f521aef722fb
parent 3134778022ceb17403016704b064f69160beeb64
Author: Matsuda Kenji <contact2655@matsudakenji.xyz>
Date:   Mon,  2 May 2022 15:49:04 +0900

some changes

Diffstat:
M.config/X11/xinitrc | 2+-
M.config/newsboat/urls | 13++-----------
Mbin/pass | 8++++----
Mbin/utc | 52+++++++++++++++++++++++++++++++++++++++++++---------
Mpasswords.gpg | 0
Msuckless/st/config.diff | 25++++++++++++-------------
Asuckless/st/st-font2-20190416-ba72400.diff | 167+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 229 insertions(+), 38 deletions(-)

diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc @@ -31,7 +31,7 @@ export LESSHISTFILE=- export BROWSER="firefox" export TERMINAL="st" export EDITOR=vim -export PATH="$PATH:$HOME/bin:$HOME/.local/src/kotoriotoko/BIN" +export PATH="$PATH:$HOME/bin:/usr/local/heirloom-doctools/bin:$HOME/.local/src/kotoriotoko/BIN" export LC_CTYPE=en_US.UTF-8 setxkbmap -layout jp diff --git a/.config/newsboat/urls b/.config/newsboat/urls @@ -11,22 +11,13 @@ https://www.freebsd.org/events/feed.xml comuter https://blog.eniehack.net/atom.xml comuter https://jcs.org/rss comuter https://undeadly.org/cgi?action=rss comuter -https://beyondthecave.net/rss.xml comuter https://blog.plenz.com/atom.xml comuter https://vim-jp.org/rss.xml comuter https://tsutsui.hatenablog.com/rss comuter https://codemadness.org/rss_content.xml -https://photograpark.net/rss camera -https://bluelines.hatenablog.com/rss camera -https://mypace.hatenablog.com/rss camera -https://wonodas.hatenadiary.com/rss camera - -https://aka6dfb.exblog.jp/index.xml water_color -https://harusuisai.exblog.jp/index.xml water_color -http://kazenohen.mokuren.ne.jp/dkg18317/rss water_color -https://dahlia18fl.exblog.jp/index.xml water_color - +https://www.youtube.com/feeds/videos.xml?channel_id=UChhdZKmT0uNdOxHPgkSelmA +https://www.youtube.com/feeds/videos.xml?channel_id=UCoC47do520os_4DBMEFGg4A https://www.youtube.com/feeds/videos.xml?channel_id=UC7YOGHUfC1Tb6E4pudI9STA https://www.youtube.com/feeds/videos.xml?channel_id=UCntL6bw6PoFR0r67cMYXLkg https://www.youtube.com/feeds/videos.xml?channel_id=UC5gLmcFuvdGbajs4VL-WU3g diff --git a/bin/pass b/bin/pass @@ -2,10 +2,10 @@ passwords=~/.local/dotfiles/passwords.gpg -p=$(gpg -d $passwords) +p=$(gpg -d "$passwords") item=$(echo "$p" | awk '{print $1, $3}' | dmenu -i -l 5 ) [ -n "$item" ] || exit -echo $item | awk '{print $2}' -name=$(echo $item | awk '{print $1}') -id=$(echo $item | awk '{print $2}') +echo "$item" | awk '{print $2}' +name=$(echo "$item" | awk '{print $1}') +id=$(echo "$item" | awk '{print $2}') echo "$p" | awk -v name=$name -v id=$id '$1==name&&$3==id' | sed 's/.* //' | xclip -r diff --git a/bin/utc b/bin/utc @@ -1,18 +1,52 @@ #!/bin/sh -# can this task be done by strftime(3)? -# unix time converter -# USAGE: utc [datetime] -# utc -r [unixtime] +# convert input date time string to YYYYMMDDHHMMSS +# USAGE: utc +format [datetime] +# utc -r +format [datetime] # format: -# %a: day of week in 3-letter style -# %b: month in 3-letter style -# %e: day from 1 to 31 # %d: day from 01 to 31 # %H: hour from 00 to 23 # %m: month number from 01 to 12 # %M: minite from 00 to 59 # %S: second from 00 to 60 (leap second?) -# %Z: time zon in 3-letter style # %Y: year in 4-letter style -# at this time format is fixed to +%d/%m/%Y:%H:%M:%S +# default value is "+%d/%m/%Y:%H:%M:%S" +# +conv(){ + mat='s/%Y/([0-9]{4})/;s/%./([0-9]{2})/g' + + pat=$(echo "$format" | + sed "$mat" | + sed 's/^\+//' | + sed 's/^/^.*[^0-9]?/' | + sed 's/$/.*$/' | + sed 's/!/\\!/g' + ) + sub=$(echo "$format" | + sed -E 's/[^%]*%(.)/\1 /g' | + awk '{ + for(i=1;i<=NF;i++){ + printf "%s=\\%d;", $i, i + } + printf "printf \"%%04d%%02d%%02d%%02d%%02d%%02d\\\\\\\\n\" \ + \"$Y\" \"$m\" \"$d\" \"$H\" \"$M\" \"$S\"\n" + }') + sed -E 's!'"$pat"'!'"$sub"'!' | sh -s +} + +conv_r(){ + sub=$(echo "$format" | + sed 's/!/\\!/g' | + sed 's/^+//;s/%Y/\\1/;s/%m/\\2/;s/%d/\\3/;s/%H/\\4/;s/%M/\\5/;s/%S/\\6/') + sed -E 's!(....)(..)(..)(..)(..)(..)!'"$sub"'!' +} + +format="+%d/%m/%Y:%H:%M:%S" + +if [ "$1" = "-r" ]; then + [ -n "$2" ] && format=$2 + conv_r +else + [ -n "$1" ] && format=$1 + conv +fi diff --git a/passwords.gpg b/passwords.gpg Binary files differ. diff --git a/suckless/st/config.diff b/suckless/st/config.diff @@ -1,14 +1,13 @@ ---- config.def.h 2021-06-18 14:18:33.714179000 +0900 -+++ config.h 2021-06-18 16:00:01.721759000 +0900 -@@ -5,7 +5,10 @@ - * - * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html - */ --static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; -+/* -+ * static char *font = "monospace:pixelsize=20:antialias=true:autohint=true"; -+ */ -+static char *font = "monospace:pixelsize=15:antialias=true:autohint=true"; - static int borderpx = 2; +--- config.def.h Mon May 2 15:31:46 2022 ++++ config.h Mon May 2 15:44:15 2022 +@@ -8,8 +8,8 @@ + static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; + /* Spare fonts */ + static char *font2[] = { +-/* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */ +-/* "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true", */ ++ "Noto Color Emoji:pixelsize=14:antialias=true:autohint=true", ++ "Noto Serif CJK JP:pixelsize=14:antialias=true:autohint=true", + }; - /* + static int borderpx = 2; diff --git a/suckless/st/st-font2-20190416-ba72400.diff b/suckless/st/st-font2-20190416-ba72400.diff @@ -0,0 +1,167 @@ +From ba724004c6a368e452114f7dc147a9978fe0f3b4 Mon Sep 17 00:00:00 2001 +From: Kirill Bugaev <kirill.bugaev87@gmail.com> +Date: Tue, 16 Apr 2019 04:31:30 +0800 +Subject: [PATCH] This patch allows to add spare font besides default. Some + glyphs can be not present in default font. For this glyphs st uses + font-config and try to find them in font cache first. This patch append fonts + defined in font2 variable to the beginning of font cache. So they will be + used first for glyphs that absent in default font. + +--- + config.def.h | 6 +++ + x.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 107 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 482901e..676719e 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -6,6 +6,12 @@ + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ + static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; ++/* Spare fonts */ ++static char *font2[] = { ++/* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */ ++/* "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true", */ ++}; ++ + static int borderpx = 2; + + /* +diff --git a/x.c b/x.c +index 5828a3b..d37e59d 100644 +--- a/x.c ++++ b/x.c +@@ -149,6 +149,8 @@ static void xhints(void); + static int xloadcolor(int, const char *, Color *); + static int xloadfont(Font *, FcPattern *); + static void xloadfonts(char *, double); ++static int xloadsparefont(FcPattern *, int); ++static void xloadsparefonts(void); + static void xunloadfont(Font *); + static void xunloadfonts(void); + static void xsetenv(void); +@@ -296,6 +298,7 @@ zoomabs(const Arg *arg) + { + xunloadfonts(); + xloadfonts(usedfont, arg->f); ++ xloadsparefonts(); + cresize(0, 0); + redraw(); + xhints(); +@@ -977,6 +980,101 @@ xloadfonts(char *fontstr, double fontsize) + FcPatternDestroy(pattern); + } + ++int ++xloadsparefont(FcPattern *pattern, int flags) ++{ ++ FcPattern *match; ++ FcResult result; ++ ++ match = FcFontMatch(NULL, pattern, &result); ++ if (!match) { ++ return 1; ++ } ++ ++ if (!(frc[frclen].font = XftFontOpenPattern(xw.dpy, match))) { ++ FcPatternDestroy(match); ++ return 1; ++ } ++ ++ frc[frclen].flags = flags; ++ /* Believe U+0000 glyph will present in each default font */ ++ frc[frclen].unicodep = 0; ++ frclen++; ++ ++ return 0; ++} ++ ++void ++xloadsparefonts(void) ++{ ++ FcPattern *pattern; ++ double sizeshift, fontval; ++ int fc; ++ char **fp; ++ ++ if (frclen != 0) ++ die("can't embed spare fonts. cache isn't empty"); ++ ++ /* Calculate count of spare fonts */ ++ fc = sizeof(font2) / sizeof(*font2); ++ if (fc == 0) ++ return; ++ ++ /* Allocate memory for cache entries. */ ++ if (frccap < 4 * fc) { ++ frccap += 4 * fc - frccap; ++ frc = xrealloc(frc, frccap * sizeof(Fontcache)); ++ } ++ ++ for (fp = font2; fp - font2 < fc; ++fp) { ++ ++ if (**fp == '-') ++ pattern = XftXlfdParse(*fp, False, False); ++ else ++ pattern = FcNameParse((FcChar8 *)*fp); ++ ++ if (!pattern) ++ die("can't open spare font %s\n", *fp); ++ ++ if (defaultfontsize > 0) { ++ sizeshift = usedfontsize - defaultfontsize; ++ if (sizeshift != 0 && ++ FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) == ++ FcResultMatch) { ++ fontval += sizeshift; ++ FcPatternDel(pattern, FC_PIXEL_SIZE); ++ FcPatternDel(pattern, FC_SIZE); ++ FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval); ++ } ++ } ++ ++ FcPatternAddBool(pattern, FC_SCALABLE, 1); ++ ++ FcConfigSubstitute(NULL, pattern, FcMatchPattern); ++ XftDefaultSubstitute(xw.dpy, xw.scr, pattern); ++ ++ if (xloadsparefont(pattern, FRC_NORMAL)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDel(pattern, FC_SLANT); ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); ++ if (xloadsparefont(pattern, FRC_ITALIC)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDel(pattern, FC_WEIGHT); ++ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); ++ if (xloadsparefont(pattern, FRC_ITALICBOLD)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDel(pattern, FC_SLANT); ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); ++ if (xloadsparefont(pattern, FRC_BOLD)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDestroy(pattern); ++ } ++} ++ + void + xunloadfont(Font *f) + { +@@ -1057,6 +1155,9 @@ xinit(int cols, int rows) + usedfont = (opt_font == NULL)? font : opt_font; + xloadfonts(usedfont, 0); + ++ /* spare fonts */ ++ xloadsparefonts(); ++ + /* colors */ + xw.cmap = XDefaultColormap(xw.dpy, xw.scr); + xloadcols(); +-- +2.21.0 +