From ff1a2414a9bf713665df692fab9cae9d2320b2f1 Mon Sep 17 00:00:00 2001 From: ds6 Date: Wed, 23 May 2018 22:28:27 -0500 Subject: [PATCH] refactor submodules, add xorg, small fixes & changes Xorg font descr changed to be less specific Xcursor modified (pointless future-proofing) temporarily removed urxvt unicode termName for NetBSD fixed xdotool in xinitrc deprecate tint2, etc in xinitrc in favor of i3status (soon conky) LC, LANG, PATH to .zshenv; don't rely on FreeBSD login env fixed XDG, etc vars to accept pkgsrc and other paths fix OSTYPE, local vars, NetBSD wscons fix in .zshrc add NetBSD mixerctl, /dev/sound aliases improve FreeBSD sound aliases dmenu color script no longer uses fixed dmenu path add i3-mode, i3-printinfo; remove tint2-i3mode install.sh: fix & add more dirs, uname -o -> -s, add `test' arg add xorg icons, themes, fonts; remove .hushlogin hardcode XDG env vars, may not be set yet --- .gitmodules | 15 ++-- base/.Xresources | 11 ++- .../pack/commentary.vim/start/vim-commentary | 2 +- base/.xinitrc | 7 +- base/.zshenv | 30 +++++-- base/.zshrc | 79 ++++++++++++------- bin/dmenu | 2 +- bin/i3-mode | 10 +++ bin/i3-printinfo | 30 +++++++ bin/i3subscribe | 4 +- bin/lck | 4 +- bin/redoff | 2 +- bin/redon | 2 +- bin/tint2-i3mode | 13 --- bin/yabar-i3mode | 4 + install.sh | 13 +-- xdg/i3/config | 41 +++++----- xdg/tint2/tint2rc | 2 +- xorg/icons/paper-icon-theme | 1 + 19 files changed, 174 insertions(+), 98 deletions(-) create mode 100755 bin/i3-mode create mode 100755 bin/i3-printinfo delete mode 100755 bin/tint2-i3mode create mode 100755 bin/yabar-i3mode create mode 160000 xorg/icons/paper-icon-theme diff --git a/.gitmodules b/.gitmodules index 22719d8..7215e25 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,21 @@ -[submodule "base/.vim/pack/todo.txt/start/todo.txt-vim"] +[submodule "todo.txt-vim"] path = base/.vim/pack/todo.txt/start/todo.txt-vim url = https://github.com/freitass/todo.txt-vim -[submodule "base/.vim/pack/surround.vim/start/vim-surround"] +[submodule "vim-surround"] path = base/.vim/pack/surround.vim/start/vim-surround url = https://github.com/tpope/vim-surround -[submodule "base/.vim/pack/commentary.vim/start/vim-commentary"] +[submodule "vim-commentary"] path = base/.vim/pack/commentary.vim/start/vim-commentary url = https://github.com/tpope/vim-commentary -[submodule "base/.vim/pack/speeddating.vim/start/vim-speeddating"] +[submodule "vim-speeddating"] path = base/.vim/pack/speeddating.vim/start/vim-speeddating url = https://github.com/tpope/vim-speeddating -[submodule "base/.vim/pack/repeat.vim/start/vim-repeat"] +[submodule "vim-repeat"] path = base/.vim/pack/repeat.vim/start/vim-repeat url = https://github.com/tpope/vim-repeat -[submodule "urxvt-ext/urxvt-font-size"] +[submodule "urxvt-font-size"] path = urxvt-ext/urxvt-font-size url = https://github.com/majutsushi/urxvt-font-size +[submodule "paper-icon-theme"] + path = xorg/icons/paper-icon-theme + url = https://github.com/snwh/paper-icon-theme diff --git a/base/.Xresources b/base/.Xresources index 04f7674..6e81302 100644 --- a/base/.Xresources +++ b/base/.Xresources @@ -1,6 +1,5 @@ ! fonts -*font: -windows-dina-medium-r-normal--10-80-96-96-c-70-\ -microsoft-cp1252 +*font: -windows-dina-medium-r-*-*-13-80-*-*-*-*-* *faceName: Dina *faceSize: 8 Xft.antialias: true @@ -10,7 +9,7 @@ Xft.hintstyle: hintslight Xft.rgba: none ! theming -Xcursor.theme: Paper +Xcursor.theme: Paper-Mono-Dark ! colors ! http://ethanschoonover.com/solarized @@ -68,7 +67,7 @@ Xcursor.theme: Paper ! URxvt -URxvt.termName: rxvt-unicode-256color +URxvt.termName: rxvt-256color URxvt.perl-ext: URxvt.perl-ext-common: searchable-scrollback,confirm-paste,matcher,font-size @@ -100,7 +99,7 @@ URxvt.keysym.M-slash: font-size:show URxvt.print-pipe: cat > "$HOME/urxvt-$(date +'%Y-%m-%d-%H%M%S')" ! bg terminal 1 -TermBg1.termName: rxvt-unicode-256color +TermBg1.termName: rxvt-256color TermBg1.perl-ext: TermBg1.perl-ext-common: @@ -115,7 +114,7 @@ TermBg1.shading: 80 TermBg1.blurRadius: 2x4 ! bg terminal 2 -TermBg2.termName: rxvt-unicode-256color +TermBg2.termName: rxvt-256color TermBg2.perl-ext: TermBg2.perl-ext-common: diff --git a/base/.vim/pack/commentary.vim/start/vim-commentary b/base/.vim/pack/commentary.vim/start/vim-commentary index 296d99b..54e5676 160000 --- a/base/.vim/pack/commentary.vim/start/vim-commentary +++ b/base/.vim/pack/commentary.vim/start/vim-commentary @@ -1 +1 @@ -Subproject commit 296d99b353261191adb7a356ee3fefbce8e6096b +Subproject commit 54e5676988e6eeaa05b41730b6b056026ad0ef13 diff --git a/base/.xinitrc b/base/.xinitrc index 36171bf..838c1e9 100644 --- a/base/.xinitrc +++ b/base/.xinitrc @@ -27,11 +27,13 @@ xset r rate 290 26 & xset m 1/1 0 & xset s off xset dpms 0 0 600 +xset +fp ${XDG_DATA_HOME:-~/share}/fonts/Dina/ +xset fp rehash # root terminal urxvt -name TermBg1 -override-redirect -geometry x5+0--1 \ -e tail -F /var/log/messages & -xdotool search --limit 1 --sync --classname TermBg1 windowsize -usehints 100% 6 +xdotool search --limit 1 --sync --classname TermBg1 windowsize --usehints 100% 6 # tray icons #"$HOME/src/phwmon/phwmon.py" --mem --mem_percent --net --io --bg \#0000 & @@ -64,7 +66,8 @@ if [ -x /usr/local/bin/urxvtd ]; then fi # try to wait for session to start -(sleep 0.1 && tint2) & +#(sleep 0.1 && tint2) & +#(sleep 0.1 && yabar -c "$HOME/etc/yabar/yabar.conf") & #x220t (sleep 0.1 && [ -x "$HOME/bin/acpi_ac" ] && \ "$HOME/bin/acpi_ac" "0x0`sysctl -n hw.acpi.acline`") & diff --git a/base/.zshenv b/base/.zshenv index 3a577ad..7c2fe94 100644 --- a/base/.zshenv +++ b/base/.zshenv @@ -1,17 +1,35 @@ +### path +# typeset -U makes every array entry unique +# /usr/{pkg,local,games} are unix/bsdisms +typeset -U path +path=({~/,/,/usr/}sbin {~/,/,/usr/}bin /usr/pkg/{s,}bin /usr/X11R{7,6}/bin + /usr/local/{s,}bin /usr/games $path) + +### posix export EDITOR=vim +export PAGER=less +export GREP_OPTIONS=--color=auto +export LANG="en_US.UTF-8" +export LC_CTYPE="$LANG" + +### xdg export XDG_CONFIG_HOME=~/etc -export XDG_CONFIG_DIRS=~/.config:/etc/xdg +export XDG_CONFIG_DIRS=~/.config:/usr/pkg/etc/xdg:/usr/local/etc/xdg:/etc/xdg export XDG_DATA_HOME=~/share -export XDG_DATA_DIRS=~/.local/share:/usr/local/share/:/usr/share/ +export XDG_DATA_DIRS=~/.local/share/:/usr/pkg/share/:/usr/local/share/:/usr/share/ export XDG_CACHE_HOME=~/tmp +### applications export DVTM_TERM=rxvt-unicode -export CLICOLOR= -export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' -export GREP_OPTIONS=--color=auto - export PYTHONSTARTUP=~/.pythonrc +### freebsd +if [[ "$OSTYPE" = "freebsd" ]]; then + export CLICOLOR= + export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' +fi + +### load site-specific if [[ -f ~/.zshenv.local ]]; then source ~/.zshenv.local fi diff --git a/base/.zshrc b/base/.zshrc index 0fee297..2dd25ff 100644 --- a/base/.zshrc +++ b/base/.zshrc @@ -2,12 +2,6 @@ setopt autocd extendedglob unsetopt beep -### path -# typeset -U makes every array entry unique; /usr/{pkg,local} are bsdisms -typeset -U path -path=({~/,/,/usr/}sbin {~/,/,/usr/}bin /usr/pkg/{s,}bin /usr/X11R{7,6}/bin - /usr/local/{s,}bin $path) - ### history setopt appendhistory HISTFILE=~/.histfile @@ -48,7 +42,7 @@ alias vd="deactivate" ## be paranoid alias cp='cp -ip' alias mv='mv -i' -if [[ "$OSTYPE" = "freebsd" ]] { +if [[ "$OSTYPE" =~ '^freebsd' ]] { # don't confirm if only a few files are deleted alias rm='rm -I' } else { @@ -57,8 +51,8 @@ if [[ "$OSTYPE" = "freebsd" ]] { ### prompt setopt prompt_subst -local f -if [[ "$TERM" = "wsvt25" ]] { +local f= +if [[ "$OSTYPE" = "netbsd" && ( "$TERM" = "wsvt25" || "$TERM" =~ '^vt' ) ]] { # fix for wscons f="%F{white}" } else { @@ -89,7 +83,7 @@ zstyle ':vcs_info:git*' unstagedstr "%F{red}*" unset f ### hooks -local _exectime +local _exectime= function precmd { # change terminal title print -Pn "\e]2;%(1j,%j,)%#${SSH_CLIENT+$USER@$HOST:}%~\e\\" @@ -108,29 +102,54 @@ function chpwd { l } -### freebsd-specific -if [[ "$OSTYPE" = "freebsd" ]] { - ## vt binds - bindkey "^[[H" beginning-of-line #Home - bindkey -a "^[[H" beginning-of-line - bindkey "^[[F" end-of-line #End - bindkey -a "^[[F" end-of-line +### system-specific configs and aliases +case "$OSTYPE"; in + freebsd*) + ## vt binds + bindkey "^[[H" beginning-of-line #Home + bindkey -a "^[[H" beginning-of-line + bindkey "^[[F" end-of-line #End + bindkey -a "^[[F" end-of-line - ## oss sound source - function s { sysctl hw.snd.default_unit${1:+\=$1} } + ## sound + function s { sysctl hw.snd.default_unit${1:+\=$1} } + alias vol mixer - ## install port dependencies from pkg (like pkgsrc `bmake bin-install') - function portpkg { - case "$1" { - build|run) - sudo pkg install -AU $(make ${1}-depends-list | - sed 's_/usr/ports/_ _' | tr -d '\n') - ;; - *) echo "Usage: \`portpkg ' in a port directory" - return 1;; + ## install port dependencies from pkg (like pkgsrc `bmake bin-install') + #XXX: should probably use package-depends where possible, breaks when + # port name is different to package name + # (eg. graphics/sdl20 == sdl2, devel/glib20 == glib2, etc) + function portpkg { + case "$1" { + build|run) + sudo pkg install -AU $(make ${1}-depends-list | + sed 's_/usr/ports/_ _' | tr -d '\n') + ;; + *) echo "Usage: \`portpkg ' in a port directory" + return 1;; + } + };; + netbsd) + ## sound + function s { + if [[ -z "$1" ]] { + ll /dev/mixer /dev/sound /dev/audio + return + } + for x in mixer sound audio; do + ln -sf /dev/$x"$1" /dev/$x + done } - } -} + function vol { + if [[ -z "$1" ]] { + for x in $(mixerctl -a | grep 'outputs\.master'); do + echo $x + done + return + } + mixerctl -w outputs.master"$2"="$1" + };; +esac # The following lines were added by compinstall zstyle ':completion:*' auto-description 'specify: %d' diff --git a/bin/dmenu b/bin/dmenu index 81f61e4..171f8c5 100755 --- a/bin/dmenu +++ b/bin/dmenu @@ -1,2 +1,2 @@ #!/bin/sh -exec /usr/local/bin/dmenu -fn 'Dina-10' -nb \#110800 -nf \#93a1a1 -sb \#aa5500 -sf \#eee8d5 "$@" +exec `which -a dmenu | grep -iv ~ | head -1` -fn 'Dina-10' -nb \#110800 -nf \#93a1a1 -sb \#aa5500 -sf \#eee8d5 "$@" diff --git a/bin/i3-mode b/bin/i3-mode new file mode 100755 index 0000000..7835670 --- /dev/null +++ b/bin/i3-mode @@ -0,0 +1,10 @@ +#!/bin/sh +first=true +i3subscribe mode | while read -r x; do + if $first; then + first=false + x=default #XXX: i3 does not expose method to get mode, assume + fi + x=${x#mode:} + [ "$1" = "hide-default" -a "$x" = "default" ] && echo || echo "$x" +done diff --git a/bin/i3-printinfo b/bin/i3-printinfo new file mode 100755 index 0000000..60150d6 --- /dev/null +++ b/bin/i3-printinfo @@ -0,0 +1,30 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Text::Template 'fill_in_string'; +use AnyEvent::I3; +use v5.10; + +my $i3 = i3(); +$i3->connect->recv or die "Error connecting to i3"; + +my ($ev, $str) = @ARGV; +if (not defined $str) { + die "Error: Too few arguments\n" . + "Usage: $0 workspace|output|mode|window|barconfig_update|binding format_string\n" . + "Example: $0 window 'The window title is {\$name}'" +} + +$i3->subscribe({ + $ev => sub { + # XXX: there has to be a better way to do this + my ($msg) = @_; + # XXX: not escaped + say Text::Template::fill_in_string($str, HASH=>$msg->{'container'}); + } +})->recv; + +AE::cv->recv; + +# vim: et:ts=4:sts=4:sw=4 diff --git a/bin/i3subscribe b/bin/i3subscribe index 166cd3f..76f2ff2 100755 --- a/bin/i3subscribe +++ b/bin/i3subscribe @@ -23,13 +23,13 @@ sub subscribe { } } })->recv->{success}) { - say "Successfully subscribed to $ev-event"; + say "Successfully subscribed to $ev event"; } } my $nextArg = shift; if(!$nextArg) { - say "Subscribe to i3-events"; + say "Subscribe to i3 events"; say "Usage: $0 workspace|output|mode|window|barconfig_update|binding [dump]"; say "Example: $0 workspace dump window binding dump"; exit 1; diff --git a/bin/lck b/bin/lck index 172e813..87cfce8 100755 --- a/bin/lck +++ b/bin/lck @@ -36,7 +36,7 @@ ffmpeg -y -loglevel 0 \ [out]" \ -map "[out]" -vframes 1 "$img" # pause dunst -killall -USR1 dunst +pkill -USR1 dunst i3lock -nefi "$img" rm "$img" -killall -USR2 dunst +pkill -USR2 dunst diff --git a/bin/redoff b/bin/redoff index 25c0f37..5b0cb03 100755 --- a/bin/redoff +++ b/bin/redoff @@ -1,3 +1,3 @@ #!/bin/sh -killall redshift > /dev/null 2>&1 +pkill redshift > /dev/null 2>&1 redshift -m randr -x diff --git a/bin/redon b/bin/redon index 055e2c7..72119f2 100755 --- a/bin/redon +++ b/bin/redon @@ -1,3 +1,3 @@ #!/bin/sh -killall redshift > /dev/null 2>&1 +pkill redshift > /dev/null 2>&1 redshift -l manual:lat=38.95171:lon=-92.33407 -m randr -t 6600:4000 -r & diff --git a/bin/tint2-i3mode b/bin/tint2-i3mode deleted file mode 100755 index 2fc24e0..0000000 --- a/bin/tint2-i3mode +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -first=true -i3subscribe mode | while read -r x; do - if $first; then - first=false - continue - fi - x=${x#mode:} - case $x in - default) echo;; - *) echo $x;; - esac -done diff --git a/bin/yabar-i3mode b/bin/yabar-i3mode new file mode 100755 index 0000000..93c944a --- /dev/null +++ b/bin/yabar-i3mode @@ -0,0 +1,4 @@ +#!/bin/sh +i3-mode | while read -r x; do + [ "$x" != "default" ] && echo "!Ybg0x268bd2Y!$x" || echo "$x" +done diff --git a/install.sh b/install.sh index 3eeca8b..e5ccd5f 100755 --- a/install.sh +++ b/install.sh @@ -11,15 +11,15 @@ fi # create preferred folder structure cd ~ -mkdir -p bin etc share .urxvt/ext > /dev/null 2>&1 -mkdir -m 700 var/tmp var/tmp/vim > /dev/null 2>&1 +mkdir -p bin etc share .urxvt/ext .icons .themes > /dev/null 2>&1 +mkdir -pm 700 var/tmp var/tmp/vim > /dev/null 2>&1 cd - # accomodate multiple userlands fex='-perm -ugo=x' lnargs=-sfnv if [ -z "$OSTYPE" ]; then - OSTYPE=`uname -o | tr '[:upper:]' '[:lower:]'` + OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'` fi case "$OSTYPE" in # TODO: make links safer for systems without -Fw @@ -47,17 +47,18 @@ done find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do l "$HOME/.urxvt/ext/`basename $x`" done +find "$PWD/xorg" -type d -mindepth 3 -maxdepth 3 | while read -r x; do + l "$HOME/.icons/`basename $x`" +done +#TODO: theme cd ~ if [ "$OSTYPE" = "freebsd" ]; then - touch .hushlogin - # FreeBSD tries `_secure_path' on `.login_conf' before reading the # database, so it needs to be compiled and unlinked for it to actually # take effect. rm .login_conf.db cap_mkdb .login_conf - fi unlink .login_conf # run .zprofile to set up tmp diff --git a/xdg/i3/config b/xdg/i3/config index a37e72e..e7e66f5 100644 --- a/xdg/i3/config +++ b/xdg/i3/config @@ -4,7 +4,7 @@ # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -font pango:Dina, DejaVu Sans Mono, monospace 7 +font pango:Dina 7 # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). @@ -217,25 +217,26 @@ set $inactive #884400 #221100 #93a1a1 #264bd2 #884400 set $urgent #ff4444 #dc322f #000000 #4466ff #ff4444 set $blue #4466ff #268bd2 #fdf6e3 #264db2 #4466ff -#bar { -# position top -# tray_output primary -# status_command i3status -# separator_symbol "|" -# -# colors { -# background #110800 -# statusline #93a1a1 -# separator #268bd2 -# -# # class border backgr. text -# focused_workspace $focused -# active_workspace $inactive -# inactive_workspace $inactive -# urgent_workspace $urgent -# binding_mode $blue -# } -#} +bar { + position top + output LVDS1 + tray_output primary + status_command i3status + separator_symbol "|" + + colors { + background #110800 + statusline #93a1a1 + separator #268bd2 + + # class border backgr. text + focused_workspace $focused + active_workspace $inactive + inactive_workspace $inactive + urgent_workspace $urgent + binding_mode $blue + } +} # colors # class border backgr. text indicator child_border diff --git a/xdg/tint2/tint2rc b/xdg/tint2/tint2rc index 081c965..96da161 100644 --- a/xdg/tint2/tint2rc +++ b/xdg/tint2/tint2rc @@ -207,7 +207,7 @@ separator_padding = 5 0 #------------------------------------- # Executor 1 execp = new -execp_command = ~/bin/tint2-i3mode +execp_command = ~/bin/i3-mode execp_interval = 0 execp_has_icon = 0 execp_cache_icon = 0 diff --git a/xorg/icons/paper-icon-theme b/xorg/icons/paper-icon-theme new file mode 160000 index 0000000..d2476a6 --- /dev/null +++ b/xorg/icons/paper-icon-theme @@ -0,0 +1 @@ +Subproject commit d2476a6274cd4a690d344de94984f481ca7783cc -- 2.47.0