From 2b52ba86897ed947976d560fc1a1eb1a8499c451 Mon Sep 17 00:00:00 2001 From: Ensa <@> Date: Fri, 1 May 2020 17:39:45 -0700 Subject: cwm added, general updates, etc bother made the WM detection and X startup file detection more robust comm-sel replaced 6cord with cordless made the default case do nothing so it's less annoying lh removed ipc-server garbage changed the audio group to allow for streaming audio to mpv (this works with livestream audio files) mbsync-cron moved config file to $XDG_CONFIG_HOME/mbsync/mbsyncrc made error exits actually error (helps with crontab -n) renamed old popmail touch file to something more nominally appropriate same with notify-send --app-name cwmrc reading it, DEPENDENCIES.md, and `man cwmrc` will more than explain everything in here. except the commented binds, these are behaviours cwm does not have. completions.ksh self-explanatory. read it. diraliases added ~bin for user binaries dir added ~ksh for ksh config dir added ~pass for password database kshrc added safeguards for ensuring used directories exist switched lfcd source to a test and source prompt.ksh better sep symbols git branch occupies less space lfrc added auto-upload to ttm.sh, bound to t init.vim switched colourscheme to zellner removed syntastic checker specifiers, now uses aggregate checks. syntastic_c_compiler set to cc, symlink your preferred compiler to ~bin/cc switched ectags to ctags enabled folds shrc ALTSCR: terminal you want to use for programs that already have scrollback. set to "$TERMINAL" if you don't have one. fiddled with LESS, hopefully better now $TODO is the file todo(1) uses. ENV: file ksh sources on startup. 6cord.toml removed because it's abandoned now. colors-wal-dwm.h removed because i don't use dwm anymore. dunstrc, zathurarc now uses cozette font --- DEPENDENCIES.md | 61 +++++++++++--- bin/bother | 16 +++- bin/comm-sel | 6 +- bin/lh | 12 ++- bin/mbsync-cron | 23 +++--- bin/pw | 25 +----- config/cwmrc | 148 ++++++++++++++++++++++++++++++++++ config/ksh/completions.ksh | 44 ++++++++++ config/ksh/diraliases | 4 +- config/ksh/kshrc | 8 +- config/ksh/prompt.ksh | 6 +- config/lf/lfrc | 9 +++ config/nvim/init.vim | 13 ++- config/shrc | 11 ++- config/wal/templates/6cord.toml | 14 ---- config/wal/templates/colors-wal-dwm.h | 13 --- config/wal/templates/dunstrc | 2 +- config/wal/templates/zathurarc | 2 +- 18 files changed, 320 insertions(+), 97 deletions(-) create mode 100644 config/cwmrc create mode 100644 config/ksh/completions.ksh delete mode 100644 config/wal/templates/6cord.toml delete mode 100644 config/wal/templates/colors-wal-dwm.h diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index a2b356e..eef05a1 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -18,15 +18,20 @@ each and every file in this repository can be altered by anyone with any goal, i # bin/ * mbsync-cron: populate local maildirs and notify the user if there is new mail * [isync](https://isync.sourceforge.net) - * properly configured `$HOME/.mbsync` (One Group per email account) + * properly configured `$XDG_CONFIG_HOME/mbsync/mbsync` (One Group per email account) * libnotify (notifies the user for new mail and the subject line of said mail) * `$XDG_DATA_HOME` +* bother: urgently notifies you with the contents of $HOME/today + * opt: `$XFILE`: the location of the file that starts your X session + * please define this if you don't use .xsession or .xinitrc + * notify-send (the entire point of the script) + * `$HOME`/today (bother reads this file and sends it as a notification) + * pgrep (checks to see if your window manager is up yet) * comm-sel: a handy menu for spawning communication clients * [epic5](https://epicsol.org) - * [6cord](https://gitlab.com/diamondburned/6cord) + * [cordless](https://github.com/bios-marcel/cordless) * [scli](https://github.com/isamert/scli) * [dmenu](https://dmenu.suckless.org) (provides a menu for selecting which client to start) - * notify-send (notifies the user that they made an invalid choice) * opt: st-altscreen (build of st that doesn't have scrollback or extra bindings, doesnt interfere with programs and is generally smaller) * `$TERMINAL` * lh: a script that takes a URL as input and does different things depending on what the URL links to @@ -48,8 +53,6 @@ each and every file in this repository can be altered by anyone with any goal, i * prompt: makes prompting the user for particular actions easier * [dmenu](https://dmenu.suckless.org) * pw: generates a password of variable length - * opt: xclip (enables pw's mode copying the generated password to the clipboard or the primary selection) - * opt: libnotify (notifies the user that the password is generated, how long the password will be kept in the clipboard/primary selection for, and when the clipboard/primary selection is cleared.) * rsschk: takes a URL as an argument and adds it to newsboat's url file, with an optional second argument specifying a category * libnotify (notifies the user of improper usage, and whether or not they should probably edit the url file manually to add a category.) * [newsboat](https://newsboat.org) @@ -60,21 +63,52 @@ each and every file in this repository can be altered by anyone with any goal, i * opt: xdg-user-dir (lets you change the directory bg.png has to be in) * xwallpaper (sets the wallpaper) # config/ -* lfrc: configuration file for [lf](https://github.com/gokcehan/lf) +* cwmrc: config for [cwm](https://man.openbsd.org/cwm) + * [Cozette](https://github.com/slavfox/cozette) font + * st + * slock + * `$TERMINAL` + * `$ALTSCR` + * `$EDITOR` + * `$BROWSER` + * `$HOMEPAGE` + * `$COMM` + * `kpcli` + * bin/lh + * xclip + * `$MUSIC` + * `$MAILER` + * `$RSS` + * `$FILE` + * `$READER` + * `$SCR` + * xdg-user-dir + * mpc + * [sndioctl](https://man.openbsd.org/sndioctl) + * xbacklight + * bin/prompt + * [doas](https://man.openbsd.org/doas) + * [oxbar](https://github.com/ryanflannery/oxbar) + * xdotool +* lf/lfrc: configuration file for [lf](https://github.com/gokcehan/lf) * opt: bin/opener (for opening files) + * opt: curl (for uploading temporary content to the [ttm.sh](https://ttm.sh) site) * shrc: shell environment, particularly for bin/shenv * neovim (`$EDITOR`) * lf (`$FILE`) * st (`$TERMINAL`) + * st-altscreen (`$ALTSCR`) * firefox (`$BROWSER`) * bin/comm-sel (`$COMM`) * zathura (`$READER`) * neomutt (`$MAILER`) * ncmpcpp (`$MUSIC`) * newsboat (`$RSS`) - * ksh (`$ISH` `$ZDOTDIR`) + * ksh (`$ENV`) + * config/ksh (`$ENV`) * maim (`$SCR`) * slock (`$LOCK`) + * opt: [todo](https://tildegit.org/tomasino/todo) * opt: go (`$GOPATH`) * opt: cargo (`$CARGO_HOME`) * opt: mednafen (`$MEDNAFEN_HOME`) @@ -86,12 +120,21 @@ configuration files for ksh * mpv (for mpvpin() to work) * exports.ksh * opt: pfetch (`$PF_INFO`) +* completions.ksh + * `$XDG_CACHE_HOME` +## wal +config templates for [wal](https://github.com/dylanaraps/pywal) +* templates/ + * dunstrc + * [Cozette](https://github.com/slavfox/cozette) font + * zathurarc + * [Cozette](https://github.com/slavfox/cozette) font # data/ * mailcap: helps neomutt figure out what to do with particular MIME types - * $EDITOR + * `$EDITOR` * lynx * [mpv](https://mpv.io) - * $READER + * `$READER` ## applications/ * doc.desktop * [zathura](https://pwmt.org/projects/zathura) diff --git a/bin/bother b/bin/bother index 701b1a4..1d97791 100755 --- a/bin/bother +++ b/bin/bother @@ -1,7 +1,21 @@ #!/bin/sh # puts up a critical notification if $HOME/today exists, containing the contents of that file. +if [ -z "$XFILE" ]; then +if [ -f $HOME/.xsession ]; then + XFILE=xsession +elif [ -f $HOME/.xinitrc ]; then + XFILE=xinitrc +fi +fi +if grep -q "dwm" $XFILE; then + WM=dwm +elif grep -q 'exec' $XFILE; then + WM=$(grep 'exec' $XFILE|cut -f 2 -d ' ' -) +else + WM=$(last -1 $XFILE) +fi if [ -f "$HOME"/today ]; then - until pgrep -x dwm>/dev/null + until pgrep $WM>/dev/null do true done diff --git a/bin/comm-sel b/bin/comm-sel index 0678679..6ef97d9 100755 --- a/bin/comm-sel +++ b/bin/comm-sel @@ -6,9 +6,9 @@ if command -v st-altscreen>/dev/null; then TERMINAL="st-altscreen" fi -case "$(dmenu_path|grep -E "epic5$|6cord|scli$"|dmenu -p "choose chat app:")" in +case "$(dmenu_path|grep -E "epic5$|cordless|scli$"|dmenu -p "choose chat app:")" in epic5) $TERMINAL -c comm -e epic5 -l "$XDG_CONFIG_HOME/epic/epicrc" ensa&;; - 6cord) $TERMINAL -c comm -e env TERM=xterm 6cord&;; + cordless) $TERMINAL -c comm -e cordless&;; scli) $TERMINAL -c comm -e scli&;; - *) notify-send "comm-sel error" "invalid program selection"&&return 1;; + *) return;; esac diff --git a/bin/lh b/bin/lh index e4bdf0c..25a2f62 100755 --- a/bin/lh +++ b/bin/lh @@ -1,16 +1,14 @@ #!/bin/sh # lh: the Link Handler # takes one path or URL as its argument, launches the appropriate program for this. -### differs from Luke Smith's linkhandler in cleaner code, inclusion of epub/pdf handling, proper interpretation of twitch video URLs, and livestream handling with streamlink (twitch only for now, tipping me off to URL schemes to look for for other streaming sites would be appreciated.) # if $1 isn't provided, spawn $BROWSER and exit. this allows lh to be used as a pseudo-browser. [ -z "$1" ] && exec "$BROWSER" - case "$1" in *mkv|*webm|*mp4) - mpv --input-ipc-server=/tmp/mpv-socket$(date +%s) --quiet "$1" >/dev/null 2>&1 & ;; - *youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*twitch.tv/videos/*) - mpv --input-ipc-server=/tmp/mpv-socket$(date +%s) --quiet --ytdl "$1" >/dev/null 2>&1 & ;; + mpv "$1" >/dev/null 2>&1 & ;; + *youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*twitch.tv/videos/*|*twitch.tv/*/v/*) + mpv --ytdl "$1" >/dev/null 2>&1 & ;; *twitch.tv/*) STREAMQUAL="$(streamlink "$1"|\ grep "Available streams"|tr " " "\n"|grep -E "[0-9]"|tr -d ,|\ @@ -19,8 +17,8 @@ case "$1" in *png|*jpg|*jpe|*jpeg|*gif) IMGPATH="/tmp/$(echo "$1"|sed "s/.*\\///")" curl -sL "$1" >"$IMGPATH"&&sxiv -a "$IMGPATH">/dev/null 2>&1 & ;; - *mp3|*m4a|*flac|*aiff|*opus|*mp3?source*) - curl -LO "$1" >/dev/null 2>&1 & ;; + *mp3|*m4a|*flac|*aiff|*opus|*ogg|*mp3?source*) + mpv "$1" >/dev/null 2>&1 & ;; *epub|*pdf|*djvu) BOOKPATH="/tmp/$(echo "$1"|sed "s/.*\\///")" if [ -n "$READER" ]; then diff --git a/bin/mbsync-cron b/bin/mbsync-cron index dd69c01..fc611c2 100755 --- a/bin/mbsync-cron +++ b/bin/mbsync-cron @@ -6,12 +6,13 @@ # there is an internet connection. if ! pgrep -u "${USER:=$LOGNAME}" >/dev/null; then printf '%s not logged in. quitting...\n' "$USER" >/dev/stderr - exit + exit 1; elif pgrep -x mbsync >/dev/null; then printf 'mbsync is already running. quitting...\n' >/dev/stderr - exit + exit 1; elif ! ping -q -c 1 1.1.1.1 >/dev/null; then printf 'no internet connection, quitting...\n' >/dev/stderr + exit 1; fi export DISPLAY=:0 @@ -21,9 +22,9 @@ if ! [ -d "$XDG_DATA_HOME/neomutt" ]; then fi # check account for new mail, notify for new content syncandnotify() { - mbsync "$account">/dev/null 2>&1 - # $new holds an index of all mail since the last time popmail ran - new=$(find "$XDG_DATA_HOME/mail/$account/inbox/new/" -type f -newer "$XDG_DATA_HOME/neomutt/.popmail-last" 2> /dev/null) + mbsync -c "$XDG_CONFIG_HOME/mbsync/mbsyncrc" "$account">/dev/null 2>&1 + # $new holds an index of all mail since the last time mbsync-cron ran + new=$(find "$XDG_DATA_HOME/mail/$account/inbox/new/" -type f -newer "$XDG_DATA_HOME/neomutt/.mbsc-last" 2> /dev/null) # $newcount is the number of new mails newcount=$(printf '%s\n' "$new" | sed '/^\s*$/d' | wc -l | tr -d " ") # send $newcount to a file specific to $account @@ -31,7 +32,7 @@ syncandnotify() { printf ' %s' "$newcount" > "$XDG_DATA_HOME/mail/$account/note" # don't notify if there isn't new mail if [ "$newcount" -gt "0" ]; then - notify-send --app-name="popmail" "mail fetcher" "new mail for profile $account! [$newcount]" & + notify-send --app-name="mbsync-cron" "mail fetcher" "new mail for profile $account! [$newcount]" & # reduce output if you have a lot of new mail if [ "$newcount" -lt "16" ]; then for file in $new; do @@ -40,7 +41,7 @@ syncandnotify() { from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed '1!d'| sed '1,/From/s/From: //') # modified version of broken $subject variable, only prints the first subject line (so forwards are slightly unclear) subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | sed '$D' | grep -m 1 '^Subject: ' | sed 's/Subject: //') - notify-send --app-name="popmail" "$from:" "$subject" & + notify-send --app-name="mbsync-cron" "$from:" "$subject" & # sleep for half a second to avoid notification clog sleep .5 done @@ -48,10 +49,10 @@ syncandnotify() { fi } -# if popmail is given arguments, treat them as accounts to get mail from. +# if mbsync-cron is given arguments, treat them as accounts to get mail from. # otherwise, scan the mbsync config to get account names if [ "$#" -eq "0" ]; then - accounts="$(awk '/^Group/ {print $2}' "$HOME/.mbsyncrc")" + accounts="$(awk '/^Group/ {print $2}' "$XDG_CONFIG_HOME/mbsync/mbsyncrc")" else accounts=$* fi @@ -71,5 +72,5 @@ if cat "$XDG_DATA_HOME"/mail/*/note|grep -q '[1-9]'; then else printf '\n'>"$XDG_DATA_HOME/mail/note" fi -#create/update modification time on an empty file that indicates the time of the last run of popmail -touch "$XDG_DATA_HOME/neomutt/.popmail-last" +#create/update modification time on an empty file that indicates the time of the last run of mbsync-cron +touch "$XDG_DATA_HOME/neomutt/.mbsc-last" diff --git a/bin/pw b/bin/pw index cec9e54..fa33761 100755 --- a/bin/pw +++ b/bin/pw @@ -1,25 +1,4 @@ #!/bin/sh -# generates a password of length $1, sends it to stdout if $2 is blank. -# if $2 is clip, sends it to the X clipboard and clears it after 10 seconds. -# if $2 is anything else, sends it to the X primary selection and clears it after 10 seconds -if [ "$1" = "-h" ]; then - printf 'usage: %s [-h]|LENGTH [clip|pri]\n' "$(basename $0)">/dev/stderr - return 1 -fi +# generates a password of length $1. PW=$(tr -cd "[:alnum:][:punct:]"/dev/null 2>&1; then _GIT_BRANCH="$(git branch|grep -F '*'|sed 's/* //')" - printf '  %s\n' "$_GIT_BRANCH" + printf ' %s' "$_GIT_BRANCH" fi } PS1='\[\033[7;32m\]$?\[\033[0;32;45m\]$SEP\[\033[0;7;35m\]\A$RSEP\[\033[0;1;31m\]\u\[\033[0;32m\]@\[\033[1;34m\]\h\[\033[7;36m\]$SEP\[\033[7m\]\w$RSEP\[\033[0;32m\]$(vcs)\n\[\033[0;32m\]\$\[\033[0m\] ' diff --git a/config/lf/lfrc b/config/lf/lfrc index e5e58cd..138c470 100644 --- a/config/lf/lfrc +++ b/config/lf/lfrc @@ -9,6 +9,14 @@ cmd open ${{ opener $f }} +cmd ttmsh ${{ + TTMURL="curl -F 'file=@-' https://ttm.sh < $f" + if [ -n "$TTMURL" ]; then + echo "$TTMURL"|tee "$HOME/ttmsh"|xclip -r + done + notify-send 'successfully uploaded to ttm!' 'link copied to selection, backup is in $HOME/ttmsh' +}} + cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1 # binds @@ -19,3 +27,4 @@ map shell map R reload map x $$f map X !$f +map t ttmsh diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 0632b5d..64e6dfe 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -34,7 +34,7 @@ call plug#end() " end of vim-plug related lines -colo delek +colo zellner " productivity binds @@ -79,9 +79,8 @@ let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 -let g:syntastic_c_checkers = ["cppcheck"] -let g:syntastic_cpp_checkers = ["cppcheck"] -let g:syntastic_sh_checkers = ["shellcheck", "sh"] +let g:syntastic_aggregate_errors = 1 +let g:syntastic_c_compiler = "cc" " lightline config set noshowmode @@ -98,11 +97,11 @@ set path+=** cno w!! exe 'sil! w !doas tee % >/dev/null' e! nno :noh " add a ctags shortcut like a shitty goblin -com! MakeTags !ectags -R . -" make make work when im learning c -autocmd BufRead $HOME/src/me/c-practice/*.c set makeprg=pcc\ -ansi\ % +com! MakeTags !ctags ./* " calcurse notes should be treated as markdown autocmd BufRead,BufNewFile /tmp/calcurse* set filetype=markdown autocmd BufRead,BufNewFile ~/.local/share/calcurse/notes/* set filetype=markdown " ksh should work autocmd FileType ksh let g:is_kornshell = 1 +" good folds +set foldmethod=marker diff --git a/config/shrc b/config/shrc index bc5162e..3529cb1 100644 --- a/config/shrc +++ b/config/shrc @@ -10,20 +10,27 @@ export EDITOR="nvim" export FILE="lf" export PAGER="less" export TERMINAL="st" +export ALTSCR="st-altscreen" export BROWSER="firefox" export COMM="comm-sel" export READER="zathura" export MAILER="neomutt" export MUSIC="ncmpcpp" export RSS="newsboat" -export ISH="ksh" export SCR="maim" export LOCK="slock" -export LESS='-iMRS -x2' +#less args +export LESS='-iFMRX~ -x2' +#locale info export LANGUAGE="en" export LANG="POSIX.UTF-8" export LC_ALL="POSIX.UTF-8" +#lscolor export CLICOLOR=1 +#todo(1) +export TODO="$HOME/doc/todo" +#ksh +export ENV="$XDG_CONFIG_HOME/ksh/kshrc" #cleanup paths export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" diff --git a/config/wal/templates/6cord.toml b/config/wal/templates/6cord.toml deleted file mode 100644 index 52b5321..0000000 --- a/config/wal/templates/6cord.toml +++ /dev/null @@ -1,14 +0,0 @@ -# comment to get vim to recognize the ft -token = "" -[ properties ] - true-color = false - default-name-color = "{color7}" - mention-color = "{color5}" - mention-self-color = "{color14}" - compact-mode = false - syntax-highlight-colorscheme = "native" - show-emoji-urls = false - shorten-url = false - command-prefix = "[${{CHANNEL}}] " - default-status = "" - diff --git a/config/wal/templates/colors-wal-dwm.h b/config/wal/templates/colors-wal-dwm.h deleted file mode 100644 index eeea645..0000000 --- a/config/wal/templates/colors-wal-dwm.h +++ /dev/null @@ -1,13 +0,0 @@ -static const char norm_fg[] = "{color4}"; -static const char norm_bg[] = "{color0}"; -static const char norm_border[] = "{color8}"; - -static const char sel_fg[] = "{color1}"; -static const char sel_bg[] = "{color0}"; -static const char sel_border[] = "{color9}"; - -static const char *colors[][3] = {{ - /* fg bg border */ - [SchemeNorm] = {{ norm_fg, norm_bg, norm_border }}, // unfocused wins - [SchemeSel] = {{ sel_fg, sel_bg, sel_border }}, // the focused win -}}; diff --git a/config/wal/templates/dunstrc b/config/wal/templates/dunstrc index 61972d6..39a9a5e 100644 --- a/config/wal/templates/dunstrc +++ b/config/wal/templates/dunstrc @@ -24,7 +24,7 @@ idle_threshold = 120 ### Text ### - font = Terminus Medium 8 + font = Cozette Medium 8 line_height = 0 markup = full diff --git a/config/wal/templates/zathurarc b/config/wal/templates/zathurarc index ebb74ca..558b341 100644 --- a/config/wal/templates/zathurarc +++ b/config/wal/templates/zathurarc @@ -32,4 +32,4 @@ set render-loading-fg "{color15}" set window-title-home-tilde true set statusbar-basename true set selection-clipboard clipboard -set font "SauceCodePro Nerd Font Mono 10" +set font "Cozette 10" -- cgit 1.4.1-2-gfad0