From affee5f76f0cd83ec28179b30456f311b82ea450 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 29 Jan 2018 13:37:24 -0500 Subject: wmii: rbar_util (go): fix messages --- .config/wmii-hg/rbar_util/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/wmii-hg/rbar_util/main.go b/.config/wmii-hg/rbar_util/main.go index 5fccd7e..2358dca 100644 --- a/.config/wmii-hg/rbar_util/main.go +++ b/.config/wmii-hg/rbar_util/main.go @@ -19,7 +19,7 @@ type Impl struct { func gerror(status int, err error, format string, a ...interface{}) { msg := fmt.Sprintf(format, a...) if err == nil { - fmt.Fprintf(os.Stderr, "%s: %s", os.Args[0], msg) + fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], msg) } else { fmt.Fprintf(os.Stderr, "%s: %s: %v", os.Args[0], msg, err) } @@ -35,7 +35,7 @@ func errusage(fmt string, a ...interface{}) { } func usage(w io.Writer) { - fmt.Fprintf(w, "Usage: %[1]v NN_LABEL\n or: %[1]v BTN_ID\n or: %[1]v -h\n", os.Args[0]) + fmt.Fprintf(w, "Usage: %[1]v NN_LABEL\n or: %[1]v BTN_ID\n or: %[1]v -h\n", os.Args[0]) } func Main(impl Impl) { @@ -59,7 +59,7 @@ func Main(impl Impl) { fn = func() error { return impl.Update(arg) } } } else { - errusage("invalid argument: %s\n", os.Args[1]) + errusage("invalid argument: %s", os.Args[1]) } } if fn == nil { -- cgit v1.1-4-g5e80 From 7bf7d5aa5c1df452fd88f26026f129fd9b49fbe1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 29 Jan 2018 13:37:52 -0500 Subject: wmii: rbar_clock: re-implement in C --- .config/wmii-hg/Makefile | 5 +- .config/wmii-hg/rbar.h | 193 ++++++++++++++++++++++++++++++++++++++ .config/wmii-hg/rbar_clock.c | 56 +++++++++++ .config/wmii-hg/rbar_clock.go | 29 ------ .config/wmii-hg/rbar_util/main.go | 76 --------------- .config/wmii-hg/rbar_util/util.go | 49 ---------- 6 files changed, 251 insertions(+), 157 deletions(-) create mode 100644 .config/wmii-hg/rbar.h create mode 100644 .config/wmii-hg/rbar_clock.c delete mode 100644 .config/wmii-hg/rbar_clock.go delete mode 100644 .config/wmii-hg/rbar_util/main.go delete mode 100644 .config/wmii-hg/rbar_util/util.go diff --git a/.config/wmii-hg/Makefile b/.config/wmii-hg/Makefile index 4ba64a3..85c1ab1 100644 --- a/.config/wmii-hg/Makefile +++ b/.config/wmii-hg/Makefile @@ -1,10 +1,9 @@ all: rbar_clock .PHONY: all -%: %.go - go build -o $@ $< +CFLAGS += -std=c99 -Wall -Werror -Wextra -rbar_clock: rbar_util $(wildcard rbar_util/*) +rbar_clock: rbar.h .SECONDARY: .DELETE_ON_ERROR: diff --git a/.config/wmii-hg/rbar.h b/.config/wmii-hg/rbar.h new file mode 100644 index 0000000..843ac52 --- /dev/null +++ b/.config/wmii-hg/rbar.h @@ -0,0 +1,193 @@ +#define _GNU_SOURCE /* program_invocation_name */ +#include /* assert(3p) */ +#include /* program_invocation_name */ +#include /* error(3gnu) */ +#include /* O_* flags to open(3p) */ +#include /* glob(3p), globfree(3p), GLOB_* */ +#include /* sigaction(3p) */ +#include /* dprintf(3p) */ +#include /* exit(3p), malloc(3p) */ +#include /* strcmp(3p), strlen(3p), strcpy(3p) */ +#include /* open(3p) */ +#include /* unlink(3p) */ + +/* Main *************************************************************/ + +struct impl { + int (*left_click)(void); + int (*middle_click)(void); + int (*right_click)(void); + int (*scroll_up)(void); + int (*scroll_down)(void); + int (*update)(const char *tag); +} impl; + +#define errusage(...) do { \ + error(6, 0, __VA_ARGS__); \ + usage(2); \ + exit(2); \ +} while(0) + +void usage(int fd) { + dprintf(fd, + "Usage: %1$s NN_LABEL\n" + " or: %1$s BTN_ID\n" + " or: %1$s -h\n", + program_invocation_name); +} + +void sigexit(int sig) { + error(0, 0, "Cought signal: %d", sig); + exit(0); +} + +int main(int argc, char *argv[]) { + if (argc != 2) { + errusage("exactly 1 argument expected, got %d", argc-1); + } + const char *arg = argv[1]; + + if (strcmp(arg, "-h") == 0) { + usage(1); + exit(0); + } + + struct sigaction sa = { 0 }; + sa.sa_handler = sigexit; + sigaction(SIGHUP, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); + + if ('1' <= arg[0] && arg[0] <= '5' && arg[1] == '\0') { + int (*fn)(void) = NULL; + switch (arg[0]) { + case '1': fn = impl.left_click; break; + case '2': fn = impl.middle_click; break; + case '3': fn = impl.right_click; break; + case '4': fn = impl.scroll_up; break; + case '5': fn = impl.scroll_down; break; + } + char *xrd = getenv("XDG_RUNTIME_DIR"); + if (xrd == NULL || xrd[0] == '\0') { + error(6, 0, "XDG_RUNTIME_DIR isn't set"); + } + if (fn == NULL) { + exit(0); + } else { + exit(fn()); + } + } + + if ('0' <= arg[0] && arg[0] <= '9' && + '0' <= arg[1] && arg[1] <= '9' && + arg[2] == '_') { + char *xrd = getenv("XDG_RUNTIME_DIR"); + if (xrd == NULL || xrd[0] == '\0') { + error(6, 0, "XDG_RUNTIME_DIR isn't set"); + } + if (impl.update == NULL) { + exit(0); + } else { + exit(impl.update(arg)); + } + } + + errusage("invalid argument: %s", arg); +} + +/* Util *************************************************************/ + +#define RBAR_DIRGLOB "/wmii*/rbar" + +char *rbar_globescape(const char *lit) { + size_t len = 0; + for (const char *a = lit; *a != '\0'; a++) { + switch (*a) { + case '\\': case '*': case '?': case '[': + len++; /* fall through */ + default: + len++; + } + } + + char *glob = malloc(len+1); + if (!glob) + error(1, errno, "rbar_globescape: malloc"); + + // copy 'a' to 'b' + char *b = glob; + for (const char *a = lit; *a != '\0'; a++) { + switch (*a) { + case '\\': case '*': case '?': case '[': + *(b++) = '\\'; /* fall through */ + default: + *(b++) = *a; + } + } + *b = '\0'; + + return glob; +} + +/* returns 0 or GLOB_NOMATCH */ +int rbar_write(const char *filename, const char *msg) { + static const char *xrd = NULL; + static size_t xrdlen; + if (!xrd) { + xrd = rbar_globescape(getenv("XDG_RUNTIME_DIR")); + xrdlen = strlen(xrd); + } + + char *fullglob = alloca(xrdlen+(sizeof RBAR_DIRGLOB)); + strcpy(fullglob, xrd); + strcpy(&fullglob[xrdlen], RBAR_DIRGLOB); + + glob_t globbuf = { 0 }; + switch (glob(fullglob, GLOB_ONLYDIR|GLOB_NOSORT, NULL, &globbuf)) { + case GLOB_NOSPACE: + error(1, ENOMEM, "rbar_write"); assert(0); + case GLOB_ABORTED: + error(1, errno, "rbar_write: glob"); assert(0); + case GLOB_NOMATCH: + return GLOB_NOMATCH; + } + + const size_t filenamelen = strlen(filename); + const size_t msglen = strlen(msg); + for (size_t i = 0; i < globbuf.gl_pathc; i++) { + const char *dirname = globbuf.gl_pathv[i]; + const size_t dirnamelen = strlen(dirname); + char *fullname = alloca(dirnamelen+1+filenamelen+1); + strcpy(fullname, dirname); + fullname[dirnamelen] = '/'; + strcpy(&fullname[dirnamelen+1], filename); + + int fd = open(fullname, O_WRONLY|O_APPEND|O_CREAT, 0666); + if (fd < 0) + continue; + write(fd, msg, msglen); + } + return 0; +} + +void rbar_remove(const char *fileglob) { + static const char *xrd = NULL; + static size_t xrdlen; + if (!xrd) { + xrd = rbar_globescape(getenv("XDG_RUNTIME_DIR")); + xrdlen = strlen(xrd); + } + + char *fullglob = alloca(xrdlen+(sizeof RBAR_DIRGLOB)+strlen(fileglob)+1); + strcpy(fullglob, xrd); + strcpy(&fullglob[xrdlen], RBAR_DIRGLOB); + fullglob[xrdlen+(sizeof RBAR_DIRGLOB)-1] = '/'; + strcpy(&fullglob[xrdlen+(sizeof RBAR_DIRGLOB)], fileglob); + + glob_t globbuf = { 0 }; + if (glob(fullglob, GLOB_NOSORT, NULL, &globbuf) != 0) + return; + for (size_t i = 0; i < globbuf.gl_pathc; i++) { + unlink(globbuf.gl_pathv[i]); + } +} diff --git a/.config/wmii-hg/rbar_clock.c b/.config/wmii-hg/rbar_clock.c new file mode 100644 index 0000000..ab636c2 --- /dev/null +++ b/.config/wmii-hg/rbar_clock.c @@ -0,0 +1,56 @@ +#include "rbar.h" + +#include /* uint64_t */ +#include /* atexit(3p) */ +#include +#include /* glock_gettime, localtime, strftime */ + +const char *cleanup_id; + +void cleanup(void) { + rbar_remove(rbar_globescape(cleanup_id)); +} + +int update(const char *id) { + cleanup_id = id; + atexit(cleanup); + + int timer = timerfd_create(CLOCK_REALTIME, 0); + if (timer < 0) + error(1, errno, "timerfd_create"); + + struct timespec now; + if (clock_gettime(CLOCK_REALTIME, &now) < 0) + error(1, errno, "clock_gettime"); + + struct itimerspec spec = { + .it_interval = (struct timespec){.tv_sec = 1, .tv_nsec = 0}, + .it_value = (struct timespec){.tv_sec = now.tv_sec+1, .tv_nsec = 0}, + }; + + if (timerfd_settime(timer, TFD_TIMER_ABSTIME, &spec, NULL) < 0) + error(1, errno, "timerfd_settime"); + + for (;;) { + uint64_t count; + if (read(timer, &count, sizeof count) != sizeof count) + error(1, errno, "read"); + if (clock_gettime(CLOCK_REALTIME, &now) < 0) + error(1, errno, "clock_gettime"); + char str[80]; + if (strftime(str, sizeof str, + "label %a %F %T %Z(%z)", /* apparently %:::z" is supported by date(1gnu) but not strftime(3gnu) */ + localtime(&now.tv_sec)) <= 0) + error(1, 0, "strftime wanted a really long string"); + int err = rbar_write(id, str); + if (err != 0) { + if (err == GLOB_NOMATCH) + return 0; + return 1; + } + } +} + +struct impl impl = { + .update = update, +}; diff --git a/.config/wmii-hg/rbar_clock.go b/.config/wmii-hg/rbar_clock.go deleted file mode 100644 index 247dd3a..0000000 --- a/.config/wmii-hg/rbar_clock.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -import ( - "time" - - "./rbar_util" -) - -func main() { - rbar_util.Main(rbar_util.Impl{ - Update: func(id string) error { - defer rbar_util.Remove(rbar_util.GlobEscape(id)) - - now := time.Now() - start := now.Truncate(time.Second).Add(time.Second) - time.Sleep(start.Sub(now)) - - clock := time.NewTicker(1*time.Second) - defer clock.Stop() - for now := range clock.C { - err := rbar_util.Write(id, now.Format("label Mon 2006-01-02 15:04:05 MST(-07)")) - if err != nil { - return err - } - } - panic("not reached") - }, - }) -} diff --git a/.config/wmii-hg/rbar_util/main.go b/.config/wmii-hg/rbar_util/main.go deleted file mode 100644 index 2358dca..0000000 --- a/.config/wmii-hg/rbar_util/main.go +++ /dev/null @@ -1,76 +0,0 @@ -package rbar_util - -import ( - "os" - "io" - "fmt" -) - - -type Impl struct { - LeftClick func() error - MiddleClick func() error - RightClick func() error - ScrollUp func() error - ScrollDown func() error - Update func(tag string) error -} - -func gerror(status int, err error, format string, a ...interface{}) { - msg := fmt.Sprintf(format, a...) - if err == nil { - fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], msg) - } else { - fmt.Fprintf(os.Stderr, "%s: %s: %v", os.Args[0], msg, err) - } - if status != 0 { - os.Exit(status) - } -} - -func errusage(fmt string, a ...interface{}) { - gerror(0, nil, fmt, a...) - usage(os.Stderr) - os.Exit(2) -} - -func usage(w io.Writer) { - fmt.Fprintf(w, "Usage: %[1]v NN_LABEL\n or: %[1]v BTN_ID\n or: %[1]v -h\n", os.Args[0]) -} - -func Main(impl Impl) { - if len(os.Args) != 2 { - errusage("exactly 1 argument expected, got %d", len(os.Args)-1) - } - var fn func() error - switch os.Args[1] { - case "-h": - usage(os.Stdout) - os.Exit(0) - case "1": fn = impl.LeftClick; - case "2": fn = impl.MiddleClick; - case "3": fn = impl.RightClick; - case "4": fn = impl.ScrollUp; - case "5": fn = impl.ScrollDown; - default: - arg := os.Args[1] - if len(arg) > 3 && '0' <= arg[0] && arg[0] <= '9' && '0' <= arg[1] && arg[1] <= '9' && arg[2] == '_' { - if impl.Update != nil { - fn = func() error { return impl.Update(arg) } - } - } else { - errusage("invalid argument: %s", os.Args[1]) - } - } - if fn == nil { - fn = func() error { return nil } - } - if os.Getenv("XDG_RUNTIME_DIR") == "" { - gerror(6, nil, "XDG_RUNTIME_DIR isn't set") - } - err := fn() - if err != nil && err != NoRbar{ - gerror(1, err, "") - } - os.Exit(0) -} diff --git a/.config/wmii-hg/rbar_util/util.go b/.config/wmii-hg/rbar_util/util.go deleted file mode 100644 index 9e5d622..0000000 --- a/.config/wmii-hg/rbar_util/util.go +++ /dev/null @@ -1,49 +0,0 @@ -package rbar_util - -import ( - "os" - "io" - "path/filepath" - "strings" - "errors" - - "fmt" -) - -func GlobEscape(lit string) string { - glob := lit - glob = strings.Replace(glob, "\\", "\\\\", -1) - glob = strings.Replace(glob, "*", "\\*", -1) - glob = strings.Replace(glob, "?", "\\?", -1) - glob = strings.Replace(glob, "[", "\\[", -1) - return glob -} - -var NoRbar = errors.New("no WMII rbars found") - -func Write(filename string, msg string) error { - dirnames, _ := filepath.Glob(GlobEscape(os.Getenv("XDG_RUNTIME_DIR"))+"/wmii*/rbar") - if len(dirnames) == 0 { - return NoRbar - } - for _, dirname := range dirnames { - file, err := os.OpenFile(filepath.Join(dirname, filename), os.O_WRONLY| os.O_APPEND|os.O_CREATE, 0666) - if err != nil { - continue - } - io.WriteString(file, msg) - file.Close() - } - return nil -} - -func Remove(glob string) { - fmt.Println("remove", glob); - fullglob := GlobEscape(os.Getenv("XDG_RUNTIME_DIR"))+"/wmii*/rbar/"+glob - fmt.Println("glob", fullglob) - filenames, err := filepath.Glob(fullglob) - fmt.Println("globerr", err) - for _, filename := range filenames { - os.Remove(filename) - } -} -- cgit v1.1-4-g5e80 From bdaf7fc195a15b88b1c31184f21bdee955703a38 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 18 Mar 2018 21:49:01 -0400 Subject: emacs: ERC: Add C-c C-u to query a user --- .config/emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 7ce9d61..dbf4799 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -319,6 +319,10 @@ sh-script.el is broken." (add-hook 'sh-mode-hook '(lambda () (sh-electric-here-document-mode 0) + +(add-hook 'erc-mode-hook + '(lambda () + (define-key erc-mode-map (kbd "C-c C-u") 'erc-cmd-QUERY) )) (add-hook 'js-mode-hook -- cgit v1.1-4-g5e80 From 6b4df458d4f736826d702c28ad5002fd92798493 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 18 Mar 2018 21:49:37 -0400 Subject: emacs: add bats-mode --- .config/emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index dbf4799..df2c1e1 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -76,6 +76,7 @@ (use-package editorconfig :config (editorconfig-mode 1)) ;; Major modes (non-HTML-related) +(use-package bats-mode :mode "\\.bats\\'") (use-package bison-mode :mode (("\\.l\\'" . bison-mode) ("\\.y\\'" . bison-mode) -- cgit v1.1-4-g5e80 From d7a49a9495249775e7863018a451f14b52e7ccf7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 18 Mar 2018 21:49:54 -0400 Subject: emacs: add meson-mode --- .config/emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index df2c1e1..903303e 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -91,6 +91,7 @@ (set (make-local-variable 'graphviz-dot-auto-indent-on-semi) nil) ))) (use-package markdown-mode :mode ("\\.markdown\\'" "\\.md\\'" "\\.ronn\\'")) +(use-package meson-mode :mode "/meson\\(\\.build\\|_options\\.txt\\)\\'") (use-package nginx-mode :mode ("nginx\\.conf\\'" "/nginx/.+\\.conf\\'")) (use-package yaml-mode :mode "\\.\\(e?ya?\\|ra\\)ml\\'") ;; Major modes (HTML-related) -- cgit v1.1-4-g5e80 From 73ae5820b2f96c160a6bc561edb3f515a18a3bf1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 19 Mar 2018 12:52:02 -0400 Subject: abyss color-theme --- .config/X11/resources | 9 ++------- .config/dunst/dunstrc | 14 +++++++------- .config/emacs/custom.el | 9 --------- .config/emacs/init.el | 3 +++ .config/lxpanel/default/panels/panel | 2 +- .config/wmii-hg/config.sh | 2 +- .config/wmii-hg/theme-abyss | 28 ++++++++++++++++++++++++++++ 7 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 .config/wmii-hg/theme-abyss diff --git a/.config/X11/resources b/.config/X11/resources index bcc6c80..c85fdaf 100644 --- a/.config/X11/resources +++ b/.config/X11/resources @@ -1,13 +1,8 @@ ! -*- Mode: Conf-xdefaults -*- ! "native" colors -!URxvt.background: #000000 -!URxvt.foreground: #CCCCCC -! Tango-dark -URxvt.background: #2E3436 -URxvt.foreground: #EEEEEC -URxvt.color4: #729FCF -URxvt.color12: #729FCF +URxvt.background: #000000 +URxvt.foreground: #CCCCCC URxvt.scrollstyle: plain URxvt.scrollBar_floating: true diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index cf99d48..36d8ab9 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -45,7 +45,7 @@ [frame] width = 1 - color = "#eeeeec" + color = "#0d1000" [shortcuts] close = ctrl+space @@ -54,18 +54,18 @@ context = ctrl+shift+period [urgency_low] - background = "#2e3436" - foreground = "#babdb6" + background = "#0d1000" + foreground = "#cc79a7" timeout = 10 [urgency_normal] - background = "#555753" - foreground = "#eeeeec" + background = "#56b4e9" + foreground = "#0d1000" timeout = 10 [urgency_critical] - background = "#cc0000" - foreground = "#eeeeec" + background = "#dd5542" + foreground = "#fcfbe3" timeout = 0 diff --git a/.config/emacs/custom.el b/.config/emacs/custom.el index f5d9860..31da9e3 100644 --- a/.config/emacs/custom.el +++ b/.config/emacs/custom.el @@ -3,9 +3,6 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(ansi-color-names-vector - ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"]) - '(custom-enabled-themes (quote (tsdh-dark))) '(erc-nick "lukeshu") '(graphviz-dot-auto-indent-on-semi nil) '(org-latex-default-packages-alist @@ -51,9 +48,3 @@ (Nginx-indent-level . 8) (c-set-style . "K&R")))) '(use-package-verbose (quote debug))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(term-color-blue ((t (:background "#729fcf" :foreground "#729fcf"))))) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 903303e..3876b1d 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -61,6 +61,9 @@ (require 'use-package) (require 'bind-key) +;; Themes +(use-package abyss-theme + :config (load-theme 'abyss t)) ;; Minor modes (use-package dtrt-indent ;; Detect indent style for existing files :config (dtrt-indent-mode 1)) diff --git a/.config/lxpanel/default/panels/panel b/.config/lxpanel/default/panels/panel index ccde93c..d7e0ee7 100644 --- a/.config/lxpanel/default/panels/panel +++ b/.config/lxpanel/default/panels/panel @@ -11,7 +11,7 @@ Global { iconsize=16 transparent=1 - tintcolor=#555753 + tintcolor=#0d1000 alpha=255 loglevel=2 diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh index e56166e..dea6774 100644 --- a/.config/wmii-hg/config.sh +++ b/.config/wmii-hg/config.sh @@ -10,7 +10,7 @@ HIST="$XDG_CACHE_HOME/wmii/history" mkdir -p -- "${HIST%/*}" # Colors tuples: " " -. theme-tango-dark +. theme-abyss if [[ "$(uname -m)" = i686 ]]; then mount.9p() { diff --git a/.config/wmii-hg/theme-abyss b/.config/wmii-hg/theme-abyss new file mode 100644 index 0000000..e297faf --- /dev/null +++ b/.config/wmii-hg/theme-abyss @@ -0,0 +1,28 @@ +#!/hint/bash +# Abyss + +abyss_orange="#e69f00" +abyss_skyblue="#56b4e9" +abyss_bluegreen="#009e73" +abyss_yellow="#f8ec59" +abyss_vanilla_cream="#fcfbe3" +abyss_blue="#0072b2" +abyss_vermillion="#d55e00" +abyss_redpurple="#cc79a7" +abyss_scarlet="#FF1A00" +abyss_bluegray="#848ea9" +abyss_background="#050000" +abyss_background2="#0d1000" +abyss_foreground="#bbe0f0" +abyss_hl_line="#00f000" +abyss_magenta="#ff00ff" +abyss_hilite="#dd5542" +abyss_white="#ffffff" +abyss_green="#00ff00" + +WMII_BACKGROUND="${abyss_background}" + +# =" " +WMII_NORMCOLORS="${abyss_redpurple} ${abyss_background2} ${abyss_background2}" +WMII_FOCUSCOLORS="${abyss_background2} ${abyss_skyblue} ${abyss_bluegray}" +WMII_URGENTCOLORS="${abyss_vanilla_cream} ${abyss_skyblue} ${abyss_bluegray}" -- cgit v1.1-4-g5e80 From cc9ab193431766eb6fd613ead6558ec40e7e377c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 19 Mar 2018 12:52:13 -0400 Subject: emacs: distable dtrt for now --- .config/emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 3876b1d..b94b0d6 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -65,8 +65,8 @@ (use-package abyss-theme :config (load-theme 'abyss t)) ;; Minor modes -(use-package dtrt-indent ;; Detect indent style for existing files - :config (dtrt-indent-mode 1)) +;(use-package dtrt-indent ;; Detect indent style for existing files +; :config (dtrt-indent-mode 1)) (use-package page-break-lines ;; Display form-feeds pretty :init (advice-add 'page-break-lines-mode-maybe :override #'page-break-lines-mode) -- cgit v1.1-4-g5e80 From a476129b5eae782a269e3d6ae8c16fe1e332a0d9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:03:13 -0400 Subject: emacs: update custom.el --- .config/emacs/custom.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.config/emacs/custom.el b/.config/emacs/custom.el index 31da9e3..77c2819 100644 --- a/.config/emacs/custom.el +++ b/.config/emacs/custom.el @@ -4,6 +4,7 @@ ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(erc-nick "lukeshu") + '(global-whitespace-mode nil) '(graphviz-dot-auto-indent-on-semi nil) '(org-latex-default-packages-alist (quote @@ -27,7 +28,10 @@ ("xelatex -interaction nonstopmode -output-directory %o %f" "xelatex -interaction nonstopmode -output-directory %o %f" "xelatex -interaction nonstopmode -output-directory %o %f"))) '(safe-local-variable-values (quote - ((Fill-Column . 64) + ((sgml-basic-offset . 8) + (nxml-child-indent . 2) + (sentence-end-double-space nil) + (Fill-Column . 64) (eval c-set-offset (quote arglist-close) 0) @@ -48,3 +52,9 @@ (Nginx-indent-level . 8) (c-set-style . "K&R")))) '(use-package-verbose (quote debug))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) -- cgit v1.1-4-g5e80 From f7a980869dcd7bb5641e7fed2b67a6587190f1f1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:03:53 -0400 Subject: emacs: wanderlust: visible headers --- .config/emacs/wl.el | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/.config/emacs/wl.el b/.config/emacs/wl.el index 08d9ec3..deefef9 100644 --- a/.config/emacs/wl.el +++ b/.config/emacs/wl.el @@ -46,22 +46,30 @@ wl-folder-window-width 35 ;; wl-message-auto-reassemble-message/partial t ;; reasemble split messages - wl-message-ignored-field-list '("^.*:") ;; default to hiding all headers - wl-message-visible-field-list ;; but then display these - '("^\\(To\\|Cc\\):" - "^Subject:" - "^\\(From\\|Reply-To\\):" - "^Organization:" - "^Message-Id:" - "^\\(Posted\\|Date\\):" - "^List-ID:" - ) - wl-message-sort-field-list ;; in this order - '("^Date" - "^From" - "^Organization:" - "^X-Attribution:" - "^Subject" - "^To" - "^Cc") + wl-message-ignored-field-list '("^.*:") ;; default to hiding all headers + wl-message-visible-field-list (mapcar (lambda (str) ;; but then display these + (apply 'concat (mapcar (lambda (c) + (if (and (<= ?a c) (<= c ?z)) + (list ?[ c (upcase c) ?]) + (list c))) + str))) + '( + "^date:" + "^subject:" + + "^from:" + "^reply-to:" + "^organization:" + + "^to:" + "^cc:" + + "^message-id:" + "^list-id:" + "^mailing-list:" + + "^in-reply-to:" + "^references:" + )) + wl-message-sort-field-list wl-message-visible-field-list ;; in this order ) -- cgit v1.1-4-g5e80 From 73194066fafead4682cc209a86f85578120a1a16 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:04:01 -0400 Subject: git email --- .config/git/config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/git/config b/.config/git/config index 21efa65..242bada 100644 --- a/.config/git/config +++ b/.config/git/config @@ -1,6 +1,9 @@ [user] name = Luke Shumaker email = lukeshu@lukeshu.com +[sendemail] + # user.email is set to lukeshu@parabola.nu for some projects + from = Luke Shumaker [color] ui = auto [push] -- cgit v1.1-4-g5e80 From 587b1c0f9fef77dd52c9d7db5a483851e10aa7a1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:04:40 -0400 Subject: mail filters --- .config/maildirproc/default.rc | 46 +++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc index e264cc3..2b6e3c8 100644 --- a/.config/maildirproc/default.rc +++ b/.config/maildirproc/default.rc @@ -104,6 +104,17 @@ def is_to_or_from(mail, address): return any(match_glob(addr, address) for addr in all_addresses(mail)) def is_to_or_from_re(mail, address): return any(match_re(addr, address) for addr in all_addresses(mail)) + + +def is_me(address): + return any(match_glob(address, glob) for glob in ["@lukeshu.com", + "lukeshu@sbcglobal.net", + "lukeshu@parabola.nu", + "lukeshu@purdue.edu", + "shumakl@purdue.edu"]) +def is_to_me(mail): + return any(is_me(addr) for addr in destination_addresses(mail)) + # # bogofilter utilites @@ -142,6 +153,7 @@ def my_whitelist(mail): return ( False or is_to_or_from(mail, "opengroup.org") + or is_to_or_from(mail, "reproducible-builds.org") or is_to_or_from(mail, "purestorage.com") or is_to_or_from(mail, "sourceware.org") or is_to_or_from(mail, "vger.kernel.org") @@ -149,8 +161,13 @@ def my_whitelist(mail): or is_to_or_from(mail, "cacnedcomms@gmail.com") or is_to_or_from(mail, "fsf.org") or is_to_or_from(mail, "gnu.org") + or is_to_or_from(mail, "nongnu.org") or is_to_or_from(mail, "parabola.nu") or is_to_or_from(mail, "parabolagnulinux.org") + or is_from(mail, "schwab.com") + or is_from(mail, "redhat.com") + or is_from(mail, "linkedin.com") + or is_from(mail, "guru.com") or is_from(mail, "3174451635@mms.att.net") or is_from(mail, "MAILER-DAEMON@yahoo.com") or is_from(mail, "careereco.com") @@ -167,7 +184,6 @@ def my_whitelist(mail): or is_from(mail, "mail.scribd.com") or is_from(mail, "massdrop.com") or is_from(mail, "msdlt.k12.in.us") - or is_from(mail, "parabola.nu") or is_from(mail, "post.oreilly.com") or is_from(mail, "scouting.org") or is_from(mail, "solutionsinplastic.com") @@ -193,6 +209,10 @@ def my_filters(mail): if mail["From"].contains("Parabola Website Notification "): move_ham(mail, ".software.parabola.dev.web-notif") return + if is_to_me(mail) and mail["List-Id"] != "" and mail['Cc'] != "": + if not is_from(mail, "notifications@github.com") and not is_from(mail, "gerrit2@projects.savoirfairelinux.com"): + move_ham(mail, ".mailinglist-dup") + return # .software.POSIX (custom mlm, I think) if is_to_or_from(mail, "austin-group-l@opengroup.org"): @@ -203,6 +223,7 @@ def my_filters(mail): [ 'archlinux.org' , 'archlinux' ], # @sbcglobal.net and @lukeshu.com ; problems delivering to Yahoo! [ 'gnome.org' , 'gnome' ], # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@lukeshu.com [ 'gnu.org' , 'gnu' ], # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@lukeshu.com + [ 'listas.trisquel.info' , 'trisquel' ], [ 'lists.arthurdejong.org' , 'arthurdejong' ], [ 'lists.fedorahosted.org' , 'fedorahosted' ], [ 'lists.freedesktop.org' , 'freedesktop' ], # https://lists.freedesktop.org/mailman/options/systemd-devel/lukeshu@lukeshu.com @@ -210,8 +231,8 @@ def my_filters(mail): [ 'lists.reproducible-builds.org' , 'reproducible-builds' ], # https://lists.reproducible-builds.org/options/rb-general/lukeshu@lukeshu.com [ 'nongnu.org' , 'nongnu' ], # https://lists.nongnu.org/mailman/options/gnu-linux-libre/lukeshu@lukeshu.com [ 'redhat.com' , 'redhat' ], # https://www.redhat.com/mailman/options/pam-list/lukeshu@lukeshu.com - [ 'lists.stanford.edu' , 'stanford' ], - [ 'mailman.stanford.edu' , 'stanford' ], + [ 'lists.stanford.edu' , 'stanford' ], # https://mailman.stanford.edu/mailman/options/liberationtech-jobs/lukeshu@lukeshu.com + [ 'mailman.stanford.edu' , 'stanford' ], ]: list = mailman_domain(mail, pair[0]) @@ -239,17 +260,21 @@ def my_filters(mail): # .software.parabola if ( False + or is_to_or_from(mail, "1984.is") or is_to_or_from(mail, "ceata.org") - or is_to_or_from(mail, "kiwwwi.com.ar") or is_to_or_from(mail, "endefensadelsl.org") + or is_to_or_from(mail, "hyperbola.info") + or is_to_or_from(mail, "kiwwwi.com.ar") or is_to_or_from(mail, "parabola.nu") or is_to_or_from(mail, "parabolagnulinux.org") or is_to_or_from(mail, "xylon.me.uk") or False + or is_to_or_from(mail, "bill-auger@peers.community") + or is_to_or_from(mail, "eliotime3000@openmailbox.org") or is_to_or_from(mail, "g4jc@openmailbox.org") or is_to_or_from(mail, "jon@whiteheat.org.uk") + or is_to_or_from(mail, "parabola@openmailbox.org") or is_to_or_from(mail, "srw@openmailbox.org") - or is_to_or_from(mail, "eliotime3000@openmailbox.org") ): move_ham(mail, ".software.parabola") return @@ -274,8 +299,11 @@ def my_filters(mail): "gnu.org", "ietf.org", "kde.org", + "kernel.org", + "launchpad.net", "mozilla.org", "nongnu.org", + "savoirfairelinux.com", "sourceforge.com", "thyrsus.com", ]: @@ -448,6 +476,9 @@ def my_filters(mail): if is_from(mail, "ebay.com"): move_ham(mail, ".misc.ebay") return + if is_from(mail, "paypal.com"): + move_ham(mail, ".misc.paypal") + return if ( False or is_to_or_from(mail, "margieshu@sbcglobal.net") @@ -545,9 +576,10 @@ def handle_incoming_unknown(mail): processor.maildir_base = "~/Maildir" processor.auto_reload_rcfile = True handle_mapping = { - "REMOTES/ATT/Inbox": handle_incoming_unknown, - "REMOTES/ATT/Bulk Mail": handle_incoming_unknown, # fucking Yahoo! +# "REMOTES/ATT/Inbox": handle_incoming_unknown, +# "REMOTES/ATT/Bulk Mail": handle_incoming_unknown, # fucking Yahoo! "REMOTES/lukeshu/INBOX": handle_incoming_unknown, + "QUEUES/Unknown": handle_incoming_unknown, "QUEUES/Spam": handle_incoming_spam_training, "QUEUES/Ham": handle_incoming_ham_training, } -- cgit v1.1-4-g5e80 From 0133058a5dd86f7f821fd3d571fd5cef9d2e8b46 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:05:11 -0400 Subject: ssh: GNU hosts --- .config/ssh/config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/ssh/config b/.config/ssh/config index 0703fb2..b827df5 100644 --- a/.config/ssh/config +++ b/.config/ssh/config @@ -20,6 +20,12 @@ Host parabola.nu *.parabola.nu Port 1863 User lukeshu +# GNU ###################################################### + +Host gerrit-ring.savoirfairelinux.com + Port 29420 + User LukeShu + # Personal ################################################# Host lukeshu.com *.lukeshu.com -- cgit v1.1-4-g5e80 From 7dba2cf97a1b01cc4d4c3c346603af439d1ee0f6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:07:20 -0400 Subject: wmii: rbar_clock: clean up --- .config/wmii-hg/Makefile | 1 + .config/wmii-hg/rbar.h | 82 +++++++++++++++++++++++--------------------- .config/wmii-hg/rbar_clock.c | 15 ++++---- 3 files changed, 53 insertions(+), 45 deletions(-) diff --git a/.config/wmii-hg/Makefile b/.config/wmii-hg/Makefile index 85c1ab1..663653f 100644 --- a/.config/wmii-hg/Makefile +++ b/.config/wmii-hg/Makefile @@ -2,6 +2,7 @@ all: rbar_clock .PHONY: all CFLAGS += -std=c99 -Wall -Werror -Wextra +CFLAGS += -O2 -D_FORTIFY_SOURCE=2 rbar_clock: rbar.h diff --git a/.config/wmii-hg/rbar.h b/.config/wmii-hg/rbar.h index 843ac52..6500a76 100644 --- a/.config/wmii-hg/rbar.h +++ b/.config/wmii-hg/rbar.h @@ -5,12 +5,15 @@ #include /* O_* flags to open(3p) */ #include /* glob(3p), globfree(3p), GLOB_* */ #include /* sigaction(3p) */ +#include /* bool */ #include /* dprintf(3p) */ #include /* exit(3p), malloc(3p) */ #include /* strcmp(3p), strlen(3p), strcpy(3p) */ #include /* open(3p) */ #include /* unlink(3p) */ +char *rbar_globescape(const char *lit); + /* Main *************************************************************/ struct impl { @@ -37,10 +40,27 @@ void usage(int fd) { } void sigexit(int sig) { - error(0, 0, "Cought signal: %d", sig); + error(0, 0, "Caught signal: %d", sig); exit(0); } +char *xrd_glob; +size_t xrd_glob_len; + +void xrd_cleanup(void) { + free(xrd_glob); +} + +void xrd_setup(void) { + char *xrd = getenv("XDG_RUNTIME_DIR"); + if (xrd == NULL || xrd[0] == '\0') { + error(6, 0, "XDG_RUNTIME_DIR isn't set"); + } + xrd_glob = rbar_globescape(xrd); + xrd_glob_len = strlen(xrd_glob); + atexit(xrd_cleanup); +} + int main(int argc, char *argv[]) { if (argc != 2) { errusage("exactly 1 argument expected, got %d", argc-1); @@ -67,10 +87,7 @@ int main(int argc, char *argv[]) { case '4': fn = impl.scroll_up; break; case '5': fn = impl.scroll_down; break; } - char *xrd = getenv("XDG_RUNTIME_DIR"); - if (xrd == NULL || xrd[0] == '\0') { - error(6, 0, "XDG_RUNTIME_DIR isn't set"); - } + xrd_setup(); if (fn == NULL) { exit(0); } else { @@ -81,10 +98,7 @@ int main(int argc, char *argv[]) { if ('0' <= arg[0] && arg[0] <= '9' && '0' <= arg[1] && arg[1] <= '9' && arg[2] == '_') { - char *xrd = getenv("XDG_RUNTIME_DIR"); - if (xrd == NULL || xrd[0] == '\0') { - error(6, 0, "XDG_RUNTIME_DIR isn't set"); - } + xrd_setup(); if (impl.update == NULL) { exit(0); } else { @@ -130,26 +144,19 @@ char *rbar_globescape(const char *lit) { } /* returns 0 or GLOB_NOMATCH */ -int rbar_write(const char *filename, const char *msg) { - static const char *xrd = NULL; - static size_t xrdlen; - if (!xrd) { - xrd = rbar_globescape(getenv("XDG_RUNTIME_DIR")); - xrdlen = strlen(xrd); - } - - char *fullglob = alloca(xrdlen+(sizeof RBAR_DIRGLOB)); - strcpy(fullglob, xrd); - strcpy(&fullglob[xrdlen], RBAR_DIRGLOB); +bool rbar_write(const char *filename, const char *msg) { + char *fullglob = alloca(xrd_glob_len+(sizeof RBAR_DIRGLOB)); + strcpy(fullglob, xrd_glob); + strcpy(&fullglob[xrd_glob_len], RBAR_DIRGLOB); - glob_t globbuf = { 0 }; - switch (glob(fullglob, GLOB_ONLYDIR|GLOB_NOSORT, NULL, &globbuf)) { + glob_t __attribute__((__cleanup__(globfree))) globbuf = { 0 }; + switch (glob(fullglob, GLOB_ONLYDIR|GLOB_NOSORT|GLOB_ERR, NULL, &globbuf)) { case GLOB_NOSPACE: error(1, ENOMEM, "rbar_write"); assert(0); case GLOB_ABORTED: error(1, errno, "rbar_write: glob"); assert(0); case GLOB_NOMATCH: - return GLOB_NOMATCH; + return false; } const size_t filenamelen = strlen(filename); @@ -163,28 +170,25 @@ int rbar_write(const char *filename, const char *msg) { strcpy(&fullname[dirnamelen+1], filename); int fd = open(fullname, O_WRONLY|O_APPEND|O_CREAT, 0666); - if (fd < 0) + if (fd < 0) { + error(0, errno, "open: %s", fullname); continue; - write(fd, msg, msglen); + } + if (write(fd, msg, msglen) < (ssize_t)msglen) + error(0, errno, "write: %s", fullname); + close(fd); } - return 0; + return true; } void rbar_remove(const char *fileglob) { - static const char *xrd = NULL; - static size_t xrdlen; - if (!xrd) { - xrd = rbar_globescape(getenv("XDG_RUNTIME_DIR")); - xrdlen = strlen(xrd); - } - - char *fullglob = alloca(xrdlen+(sizeof RBAR_DIRGLOB)+strlen(fileglob)+1); - strcpy(fullglob, xrd); - strcpy(&fullglob[xrdlen], RBAR_DIRGLOB); - fullglob[xrdlen+(sizeof RBAR_DIRGLOB)-1] = '/'; - strcpy(&fullglob[xrdlen+(sizeof RBAR_DIRGLOB)], fileglob); + char *fullglob = alloca(xrd_glob_len+(sizeof RBAR_DIRGLOB)+strlen(fileglob)+1); + strcpy(fullglob, xrd_glob); + strcpy(&fullglob[xrd_glob_len], RBAR_DIRGLOB); + fullglob[xrd_glob_len+(sizeof RBAR_DIRGLOB)-1] = '/'; + strcpy(&fullglob[xrd_glob_len+(sizeof RBAR_DIRGLOB)], fileglob); - glob_t globbuf = { 0 }; + glob_t __attribute__((__cleanup__(globfree))) globbuf = { 0 }; if (glob(fullglob, GLOB_NOSORT, NULL, &globbuf) != 0) return; for (size_t i = 0; i < globbuf.gl_pathc; i++) { diff --git a/.config/wmii-hg/rbar_clock.c b/.config/wmii-hg/rbar_clock.c index ab636c2..79ddff3 100644 --- a/.config/wmii-hg/rbar_clock.c +++ b/.config/wmii-hg/rbar_clock.c @@ -7,8 +7,13 @@ const char *cleanup_id; +void strfree(char **strp) { + free(*strp); +} + void cleanup(void) { - rbar_remove(rbar_globescape(cleanup_id)); + char __attribute__((__cleanup__(strfree))) *glob_id = rbar_globescape(cleanup_id); + rbar_remove(glob_id); } int update(const char *id) { @@ -42,11 +47,9 @@ int update(const char *id) { "label %a %F %T %Z(%z)", /* apparently %:::z" is supported by date(1gnu) but not strftime(3gnu) */ localtime(&now.tv_sec)) <= 0) error(1, 0, "strftime wanted a really long string"); - int err = rbar_write(id, str); - if (err != 0) { - if (err == GLOB_NOMATCH) - return 0; - return 1; + if (!rbar_write(id, str)) { + error(0, errno, "all rbars have disappeared"); + return 0; } } } -- cgit v1.1-4-g5e80 From 34593c6f86a8f707394da8f937cca1819b7b7cca Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:21:39 -0400 Subject: wmii: move (u)mount.9p to util.sh, prefer 9pfuse --- .config/wmii-hg/config.sh | 17 ----------------- .config/wmii-hg/util.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh index dea6774..967d5de 100644 --- a/.config/wmii-hg/config.sh +++ b/.config/wmii-hg/config.sh @@ -12,23 +12,6 @@ mkdir -p -- "${HIST%/*}" # Colors tuples: " " . theme-abyss -if [[ "$(uname -m)" = i686 ]]; then - mount.9p() { - 9pfuse "$1" "$2" - while ! [[ -f "$2/event" ]]; do :; done - } - umount.9p() { - fusermount -u "$1" - } -else - mount.9p() { - 9mount -i "$1" "$2" - } - umount.9p() { - 9umount "$1" - } -fi - Event() { local event=$1; shift; case "$event" in diff --git a/.config/wmii-hg/util.sh b/.config/wmii-hg/util.sh index 55344b2..f80b871 100644 --- a/.config/wmii-hg/util.sh +++ b/.config/wmii-hg/util.sh @@ -116,3 +116,31 @@ scansection() { conffile() { echo "$HOME/.wmii-hg/$1" } + +################################################################################ +# 9P filesystem # +################################################################################ + +# Prefer 9pfuse since: +# 1. Linux 9p directory listings are broken on i686 +# 2. 9umount doesn't work with recent versions of Linux 9p +if (. /etc/profile.d/plan9.sh || true; type 9pfuse) &>/dev/null; then + . /etc/profile.d/plan9.sh || true + mount.9p() { + 9pfuse "$1" "$2" + while ! [[ -f "$2/event" ]]; do :; done + } + umount.9p() { + fusermount -u "$1" + } +elif type 9mount &>/dev/null; then + mount.9p() { + 9mount -i "$1" "$2" + } + umount.9p() { + 9umount "$1" + } +else + >&2 echo "ERROR: I don't know how to mount 9P filesystems" + exit 5 # EXIT_NOTINSTALLED (LSB) +fi -- cgit v1.1-4-g5e80 From 19f36d3d49f10e81c31cbc56b3f8bf65c91003ad Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:56:04 -0400 Subject: .config/systemd/user/*.service: Set SyslogIdentifier= to avoid 'env' in journal --- .config/systemd/user/dunst@.service | 1 + .config/systemd/user/emacs-daemon.service | 1 + .config/systemd/user/import-profile.service | 1 + .config/systemd/user/lxpanel@.service | 1 + .config/systemd/user/maildirproc@.service | 1 + .config/systemd/user/rbar@.service | 1 + .config/systemd/user/redshift@.service | 1 + .config/systemd/user/synergy@.service | 1 + .config/systemd/user/vncserver@.service | 1 + .config/systemd/user/wmii@.service | 1 + .config/systemd/user/wmiirc@.service | 1 + .config/systemd/user/x0vncserver@.service | 1 + .config/systemd/user/xcompmgr@.service | 1 + .config/systemd/user/xmodmap@.service | 1 + .config/systemd/user/xresources-dpi@.service | 1 + .config/systemd/user/xresources@.service | 1 + 16 files changed, 16 insertions(+) diff --git a/.config/systemd/user/dunst@.service b/.config/systemd/user/dunst@.service index 74d2447..bf923df 100644 --- a/.config/systemd/user/dunst@.service +++ b/.config/systemd/user/dunst@.service @@ -9,3 +9,4 @@ Environment=DISPLAY=%I Type=simple ExecStart=/usr/bin/env dunst +SyslogIdentifier=dunst diff --git a/.config/systemd/user/emacs-daemon.service b/.config/systemd/user/emacs-daemon.service index 3869d75..31aa22e 100644 --- a/.config/systemd/user/emacs-daemon.service +++ b/.config/systemd/user/emacs-daemon.service @@ -5,6 +5,7 @@ Description=Emacs deamon Type=forking ExecStart=/usr/bin/env emacs --daemon ExecStop=/usr/bin/env emacsclient -a false -e '(kill-emacs)' +SyslogIdentifier=emacs Restart=always [Install] diff --git a/.config/systemd/user/import-profile.service b/.config/systemd/user/import-profile.service index acde590..5660966 100644 --- a/.config/systemd/user/import-profile.service +++ b/.config/systemd/user/import-profile.service @@ -6,6 +6,7 @@ DefaultDependencies=no [Service] Type=oneshot ExecStart=/usr/bin/env bash -l -c systemd-import-profile +SyslogIdentifier=systemd-import-profile [Install] WantedBy=basic.target diff --git a/.config/systemd/user/lxpanel@.service b/.config/systemd/user/lxpanel@.service index 90c66c9..c4d478f 100644 --- a/.config/systemd/user/lxpanel@.service +++ b/.config/systemd/user/lxpanel@.service @@ -11,6 +11,7 @@ Environment=DISPLAY=%I Type=simple ExecStart=/usr/bin/env lxpanel +SyslogIdentifier=lxpanel [Install] RequiredBy=panel@%i.target diff --git a/.config/systemd/user/maildirproc@.service b/.config/systemd/user/maildirproc@.service index f5a7ca5..8f5eee6 100644 --- a/.config/systemd/user/maildirproc@.service +++ b/.config/systemd/user/maildirproc@.service @@ -5,6 +5,7 @@ Description=maildirproc mail filter Type=simple ExecStart=/usr/bin/env maildirproc --rcfile=${HOME}/.config/maildirproc/%I.rc --logfile=- Restart=on-failure +SyslogIdentifier=maildirproc [Install] WantedBy=mail.target diff --git a/.config/systemd/user/rbar@.service b/.config/systemd/user/rbar@.service index 55b802c..498d577 100644 --- a/.config/systemd/user/rbar@.service +++ b/.config/systemd/user/rbar@.service @@ -5,3 +5,4 @@ StopWhenUnneeded=true [Service] Type=simple ExecStart=/bin/sh -c '%h/.wmii-hg/rbar %I' +SyslogIdentifier=rbar_%I diff --git a/.config/systemd/user/redshift@.service b/.config/systemd/user/redshift@.service index fda41d6..ed5bbae 100644 --- a/.config/systemd/user/redshift@.service +++ b/.config/systemd/user/redshift@.service @@ -10,3 +10,4 @@ Environment=DISPLAY=%I Type=simple ExecStart=/usr/bin/env redshift ExecStopPost=/usr/bin/env redshift -x +SyslogIdentifier=redshift diff --git a/.config/systemd/user/synergy@.service b/.config/systemd/user/synergy@.service index c045749..c3b7698 100644 --- a/.config/systemd/user/synergy@.service +++ b/.config/systemd/user/synergy@.service @@ -10,3 +10,4 @@ Environment=DISPLAY=%I Type=simple ExecStart=/usr/bin/env synergy +SyslogIdentifier=synergy diff --git a/.config/systemd/user/vncserver@.service b/.config/systemd/user/vncserver@.service index 2cabf4f..8808386 100644 --- a/.config/systemd/user/vncserver@.service +++ b/.config/systemd/user/vncserver@.service @@ -9,6 +9,7 @@ Restart=always ExecStart=/usr/bin/env vncserver -fg %I ExecStop=/usr/bin/env vncserver -kill %I ExecStopPost=/bin/rm /tmp/.X%I-lock /tmp/.X11-unix/X%I +SyslogIdentifier=vncserver [Install] WantedBy=default.target diff --git a/.config/systemd/user/wmii@.service b/.config/systemd/user/wmii@.service index 121a004..92f3b40 100644 --- a/.config/systemd/user/wmii@.service +++ b/.config/systemd/user/wmii@.service @@ -12,3 +12,4 @@ NotifyAccess=all ExecStart=/usr/bin/env bash -c 'exec 8>%t/x11-wm@%I; echo "$DISPLAY"; exec wmii -a unix!%t/.%N.sock -r ${XDG_CONFIG_HOME}/systemd/user/wmiirc' ExecStop=/usr/bin/env wmiir -a unix!%t/.%N.sock xwrite /ctl Quit ExecStopPost=/bin/rm -f -- %t/.%N.sock +SyslogIdentifier=wmii diff --git a/.config/systemd/user/wmiirc@.service b/.config/systemd/user/wmiirc@.service index 7c64cca..a8af5a9 100644 --- a/.config/systemd/user/wmiirc@.service +++ b/.config/systemd/user/wmiirc@.service @@ -14,3 +14,4 @@ ExecStopPost=/bin/rm -rf -- %t/wmii@%I/ Environment=DISPLAY=%I WMII_ADDRESS=unix!%t/wmii@%I.sock ExecStart=/usr/bin/env WMII_CONFPATH=${XDG_CONFIG_HOME}/wmii-hg ${XDG_CONFIG_HOME}/wmii-hg/wmiirc +SyslogIdentifier=wmiirc diff --git a/.config/systemd/user/x0vncserver@.service b/.config/systemd/user/x0vncserver@.service index 1582f42..2d160dc 100644 --- a/.config/systemd/user/x0vncserver@.service +++ b/.config/systemd/user/x0vncserver@.service @@ -8,3 +8,4 @@ Requisite=X11@%i.target Type=simple ExecStart=/usr/bin/env x0vncserver display=%I PasswordFile=%h/.vnc/passwd +SyslogIdentifier=x0vncserver diff --git a/.config/systemd/user/xcompmgr@.service b/.config/systemd/user/xcompmgr@.service index 9cba5c0..e1d9195 100644 --- a/.config/systemd/user/xcompmgr@.service +++ b/.config/systemd/user/xcompmgr@.service @@ -9,3 +9,4 @@ Environment=DISPLAY=%I Type=simple ExecStart=/usr/bin/env xcompmgr +SyslogIdentifier=xcompmgr diff --git a/.config/systemd/user/xmodmap@.service b/.config/systemd/user/xmodmap@.service index 57bab8f..09d3b4e 100644 --- a/.config/systemd/user/xmodmap@.service +++ b/.config/systemd/user/xmodmap@.service @@ -9,6 +9,7 @@ Environment=DISPLAY=%I Type=oneshot ExecStart=-/usr/bin/env xmodmap ${XDG_CONFIG_HOME}/X11/modmap +SyslogIdentifier=xmodmap [Install] WantedBy=X11@%i.target diff --git a/.config/systemd/user/xresources-dpi@.service b/.config/systemd/user/xresources-dpi@.service index a112825..c9d23cc 100644 --- a/.config/systemd/user/xresources-dpi@.service +++ b/.config/systemd/user/xresources-dpi@.service @@ -9,6 +9,7 @@ Environment=DISPLAY=%I Type=oneshot ExecStart=/usr/bin/env flock %t/x11-xrdb@%I -c xrdb-set-dpi +SyslogIdentifier=xrdb-set-dpi [Install] WantedBy=X11@%i.target diff --git a/.config/systemd/user/xresources@.service b/.config/systemd/user/xresources@.service index 83e4523..63657c3 100644 --- a/.config/systemd/user/xresources@.service +++ b/.config/systemd/user/xresources@.service @@ -9,6 +9,7 @@ Environment=DISPLAY=%I Type=oneshot ExecStart=/usr/bin/env flock %t/x11-xrdb@%I -c 'xrdb -merge ${XDG_CONFIG_HOME}/X11/resources' +SyslogIdentifier=xrdb [Install] WantedBy=X11@%i.target -- cgit v1.1-4-g5e80 From 8233cd9bf1da9203d3ad5664be3864e4fdaeff55 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 13:47:08 -0400 Subject: wmiirc: make the wmiirc action work with systemd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because the new wmiirc won't be a direct child of `systemd --user` (why isn't it a subreaper!?), it won't notice if wmiirc crashes. But we don't expect it to do that. ¯\_(ツ)_/¯ --- .config/wmii-hg/util.sh | 2 +- .config/wmii-hg/wmiirc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/wmii-hg/util.sh b/.config/wmii-hg/util.sh index f80b871..49095b2 100644 --- a/.config/wmii-hg/util.sh +++ b/.config/wmii-hg/util.sh @@ -131,7 +131,7 @@ if (. /etc/profile.d/plan9.sh || true; type 9pfuse) &>/dev/null; then while ! [[ -f "$2/event" ]]; do :; done } umount.9p() { - fusermount -u "$1" + fusermount -u -z "$1" } elif type 9mount &>/dev/null; then mount.9p() { diff --git a/.config/wmii-hg/wmiirc b/.config/wmii-hg/wmiirc index f96642b..a71b6d2 100755 --- a/.config/wmii-hg/wmiirc +++ b/.config/wmii-hg/wmiirc @@ -8,6 +8,7 @@ fi . include.sh +systemd-notify --pid || true wmiir xwrite /event WmiircQuit # close any existing wmiirc's Event WmiircStart @@ -16,4 +17,4 @@ trap "Event Quit" EXIT while read -r event; do Event $event <&- -done < <(wmiir read /event 2>/dev/null) +done < "$WMII_DIR/event" -- cgit v1.1-4-g5e80 From b5711afc9b9f509d668994511b81cc24f4d352ef Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 14:11:54 -0400 Subject: wmii: improve logging --- .config/wmii-hg/config.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh index 967d5de..ca32e1a 100644 --- a/.config/wmii-hg/config.sh +++ b/.config/wmii-hg/config.sh @@ -12,6 +12,10 @@ mkdir -p -- "${HIST%/*}" # Colors tuples: " " . theme-abyss +log() { + echo "wmiirc[$$]: $*" +} + Event() { local event=$1; shift; case "$event" in @@ -30,7 +34,7 @@ Event() { ## Custom (non-WMII-generated) events WmiircStart) ## No args - echo ' ==> Starting wmiirc' + log " ==> Starting wmiirc[$$]" is_mounted $WMII_DIR && Event WmiircUnmount Event WmiircMount @@ -53,18 +57,18 @@ Event() { ;; WmiircQuit) ## No args trap - EXIT - echo ' ==> Stopping wmiirc' + log " ==> Stopping wmiirc[$$]" exit;; WmiircMount) ## No args - echo " -> Creating mountpoint WMII_DIR=$WMII_DIR..." + log " -> Creating mountpoint WMII_DIR=$WMII_DIR..." mkdir -p "$WMII_DIR" - echo " -> Mounting WMII_DIR=$WMII_DIR..." + log " -> Mounting WMII_DIR=$WMII_DIR..." mount.9p "$WMII_ADDRESS" "$WMII_DIR" ;; WmiircUnmount) ## No args - echo " -> Unmounting WMII_DIR=$WMII_DIR..." + log " -> Unmounting WMII_DIR=$WMII_DIR..." umount.9p "$WMII_DIR" - echo " -> Removing mountpoint WMII_DIR=$WMII_DIR..." + log " -> Removing mountpoint WMII_DIR=$WMII_DIR..." rmdir -p "$WMII_DIR" 2>/dev/null;; ## WMII-meta events Quit) ## No args -- cgit v1.1-4-g5e80 From 2ff110c097169d3e858829bf5fa05cc289a8e019 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 14:12:23 -0400 Subject: wmii: add prompts to wimenu --- .config/wmii-hg/config.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh index ca32e1a..02ec65b 100644 --- a/.config/wmii-hg/config.sh +++ b/.config/wmii-hg/config.sh @@ -235,11 +235,11 @@ Key() { ## Running programs $MODKEY-a) ## Open wmii actions menu local action - action="$(path_ls "$WMII_CONFPATH" | wimenu -h "${HIST}.actions" -n 5000)" || return + action="$(path_ls "$WMII_CONFPATH" | wimenu -p 'S-a' -h "${HIST}.actions" -n 5000)" || return Action "$action" & ;; $MODKEY-x) ## Open program menu local command - command="$(path_ls "$_PATH" | wimenu -h "${HIST}.progs" -n 5000)" || return + command="$(path_ls "$_PATH" | wimenu -p 'S-x' -h "${HIST}.progs" -n 5000)" || return runcmd "$command" & ;; $MODKEY-Return) ## Launch a terminal runcmd x-terminal-emulator & ;; @@ -247,12 +247,12 @@ Key() { ## Tag actions $MODKEY-t) ## Change to another tag local tag - tag=$(lstags | wimenu -h "${HIST}.tags" -n 50) || return + tag=$(lstags | wimenu -p 'S-t' -h "${HIST}.tags" -n 50) || return echo view "$tag" >> $WMII_DIR/ctl;; $MODKEY-Shift-t) ## Retag the selected client local sel tag sel=$(sed 1q $WMII_DIR/client/sel/ctl) - tag=$(lstags | wimenu -h "${HIST}.tags" -n 50) || return + tag=$(lstags | wimenu -p 'S-T' -h "${HIST}.tags" -n 50) || return echo "$tag" >> $WMII_DIR/client/$sel/tags;; ## Hardware keys -- cgit v1.1-4-g5e80