From bc06b8ae7e83c2901dff2bc7a2947b3e870be168 Mon Sep 17 00:00:00 2001 From: katherine Date: Sun, 8 Dec 2019 09:43:44 -0700 Subject: use tmpdir in vars --- .config/herbstluftwm/mpc-status.sh | 6 ++++-- .config/init/funcs/scap | 8 +++++--- .config/init/funcs/ssh-scrot | 11 +++++++---- .config/init/gen/bg-saved.sh | 2 +- .config/init/gen/x-theme.sh | 2 +- .config/init/gen/zathurarc.sh | 2 +- .config/init/vars | 9 ++++++--- .xinitrc | 23 ++++++++++++----------- .zprofile | 21 +++++++++++---------- .zprofile-dtach | 14 +++++++------- .zshrc | 1 - 11 files changed, 55 insertions(+), 44 deletions(-) diff --git a/.config/herbstluftwm/mpc-status.sh b/.config/herbstluftwm/mpc-status.sh index 2c1a662..6f3f699 100755 --- a/.config/herbstluftwm/mpc-status.sh +++ b/.config/herbstluftwm/mpc-status.sh @@ -1,5 +1,7 @@ #!/bin/bash +source $HOME/.config/init/vars + case "$1" in next) mpc next @@ -25,11 +27,11 @@ fi cd ~/music/ dir=$(dirname "$(mpc current -f %file%)") # linking is necessary because notify-send can't into icon paths containing commas -cd /tmp/ +cd $tmpdir ln -sf "$HOME/music/$dir/cover-small.png" mpd-icon.png message="$(mpc current -f '##%track% %title% (%date%)\n%artist% - %album%') $(mpc status | tail -n -2 | sed -re 's/volume.*repeat/\nrepeat/' -e 's/( ){3,4}/\n/g' -e '/volume: /d')" -notify-send -t 4000 -a closeme --icon=/tmp/mpd-icon.png "$message" +notify-send -t 4000 -a closeme --icon=$tmpdir/mpd-icon.png "$message" diff --git a/.config/init/funcs/scap b/.config/init/funcs/scap index f87eb93..94c39f7 100755 --- a/.config/init/funcs/scap +++ b/.config/init/funcs/scap @@ -1,18 +1,20 @@ #!/usr/bin/env zsh # capture webm +source $HOME/.config/init/vars + xset q [[ $? -ne 0 ]] && return 1 archey3 sleep .2 -if [[ -e '/tmp/cap.mp4' ]]; then - rm '/tmp/cap.mp4' || return 1 +if [[ -e "$tmpdir/cap.mp4" ]]; then + rm "$tmpdir/cap.mp4" || return 1 fi echo 'recording...' ffmpeg -v panic -video_size 1920x1080 -framerate 20 -f x11grab -i :0.0 \ -f pulse -ac 2 -i default -af aresample=async=1 \ - -c:v libx264 -q 0 -preset ultrafast '/tmp/cap.mp4' + -c:v libx264 -q 0 -preset ultrafast "$tmpdir/cap.mp4" diff --git a/.config/init/funcs/ssh-scrot b/.config/init/funcs/ssh-scrot index 8fa243c..e5a3a36 100755 --- a/.config/init/funcs/ssh-scrot +++ b/.config/init/funcs/ssh-scrot @@ -1,5 +1,8 @@ #!/usr/bin/env zsh # take a screenshot, upload to /img/scrot, and update current symlink +# + +source $HOME/.config/init/vars archey3 @@ -30,10 +33,10 @@ done echo 'cheese!' sleep .1 -scrot /tmp/$name.png -convert -scale 250x /tmp/$name.png /tmp/${name}_small.png +scrot $tmpdir/$name.png +convert -scale 250x $tmpdir/$name.png $tmpdir/${name}_small.png -scp /tmp/$name.png /tmp/${name}_small.png airen-no-jikken.icu:http/img/scrot/$date +scp $tmpdir/$name.png $tmpdir/${name}_small.png airen-no-jikken.icu:http/img/scrot/$date echo "https://airen-no-jikken.icu/img/scrot/$date/$name.png" | tr -d '\n' | xclip -i -selection clipboard echo "https://airen-no-jikken.icu/img/scrot/$date/$name.png" | tr -d '\n' | xclip -i -selection primary @@ -42,4 +45,4 @@ echo "https://airen-no-jikken.icu/img/scrot/$date/${name}_small.png" | tr -d '\n echo 'sent!' -rm /tmp/$name.png /tmp/${name}_small.png +rm $tmpdir/$name.png $tmpdir/${name}_small.png diff --git a/.config/init/gen/bg-saved.sh b/.config/init/gen/bg-saved.sh index 5a6c8e9..eb7e3b1 100644 --- a/.config/init/gen/bg-saved.sh +++ b/.config/init/gen/bg-saved.sh @@ -2,4 +2,4 @@ echo "\ [xin_-1] file=$HOME/backdrops/shadowed/$wallpaper mode=0 -bgcolor=#000000" > /tmp/bg-saved.cfg +bgcolor=#000000" > $tmpdir/bg-saved.cfg diff --git a/.config/init/gen/x-theme.sh b/.config/init/gen/x-theme.sh index 374f9a2..26505e5 100644 --- a/.config/init/gen/x-theme.sh +++ b/.config/init/gen/x-theme.sh @@ -58,5 +58,5 @@ echo "xft:${bkfont}:size=${bkfont_size}" echo -n "Sxiv.font: xft:${mfont}:size=${mfont_size}" -} > /tmp/x-theme +} > $tmpdir/x-theme diff --git a/.config/init/gen/zathurarc.sh b/.config/init/gen/zathurarc.sh index 387b1e3..f1b7e8b 100644 --- a/.config/init/gen/zathurarc.sh +++ b/.config/init/gen/zathurarc.sh @@ -26,4 +26,4 @@ for i in ${focus[@]}; do echo "set $i-bg \"$bg_focus\"" done -} > /tmp/zathurarc +} > $tmpdir/zathurarc diff --git a/.config/init/vars b/.config/init/vars index 7215db8..8a4356e 100644 --- a/.config/init/vars +++ b/.config/init/vars @@ -321,11 +321,11 @@ wallpaper='kuro.jpg' std_black='#100e10' std_red='#9e3e00' -std_green='#248753' +std_green='#2c945d' std_yellow='#b28158' std_blue='#405c90' std_magenta='#763d3f' -std_cyan='#52aea0' +std_cyan='#4b9f92' std_white='#d7dbda' light_black='#2f2c2f' @@ -334,7 +334,7 @@ light_green='#569822' light_yellow='#dbb460' light_blue='#558b9f' light_magenta='#b04857' -light_cyan='#52e1db' +light_cyan='#49c8c2' light_white='#f3fdf4' bg_normal="$std_black" @@ -412,6 +412,9 @@ tablet_mode="" kbrate=25 kbdelay=300 +# where should temporary files be stored? +tmpdir="/tmp" + # use overrides, if any if [ -f ~/.config/init/voverride ]; then source ~/.config/init/voverride diff --git a/.xinitrc b/.xinitrc index a38808e..04f933d 100644 --- a/.xinitrc +++ b/.xinitrc @@ -1,15 +1,15 @@ #pull inna vars -source ~/.config/init/vars +source "$HOME/.config/init/vars" #merge Xresources -if [ -s ~/.Xresources ] +if [ -s "$HOME/.Xresources" ] then - xrdb -override ~/.Xresources + xrdb -override "$HOME/.Xresources" fi -if [ -s /tmp/x-theme ] +if [ -s $tmpdir/x-theme ] then - xrdb -override /tmp/x-theme + xrdb -override $tmpdir/x-theme fi #add compose key @@ -25,18 +25,19 @@ fcitx & xset r rate $kbdelay $kbrate #store sxiv cache in ram -export XDG_CACHE_HOME=/home/shmibs/.cache -if [ -d /tmp/ ]; then - mkdir -p /tmp/sxiv - cd /home/shmibs/.cache/ - ln -sf /tmp/sxiv . +export XDG_CACHE_HOME="$HOME/.cache" +mkdir -p "$HOME/.cache" +if [ -d $tmpdir ]; then + mkdir -p $tmpdir/sxiv + cd "$HOME/.cache/" + ln -sf $tmpdir/sxiv . cd fi #load more fonts xset +fp /usr/share/fonts/local xset +fp /usr/share/fonts/misc -xset +fp ~/.fonts +xset +fp "$HOME/.fonts" xset fp rehash #disable power saving, so screen doesn't power off diff --git a/.zprofile b/.zprofile index c27d303..74605da 100644 --- a/.zprofile +++ b/.zprofile @@ -1,6 +1,8 @@ [[ -f /etc/profile ]] && \ emulate sh -c 'source /etc/profile' +export QT_STYLE_OVERRIDE=gtk + ################## SET EDITOR ################# if [[ ! -z $(whence nvim) ]] then export EDITOR=nvim @@ -10,16 +12,15 @@ elif [[ ! -z $(whence vi) ]] then export EDITOR=vi fi -############# STORE VIMTAGS IN TMP ############ -export QT_STYLE_OVERRIDE=gtk +source $HOME/.config/init/vars ############# STORE VIMTAGS IN TMP ############ -[[ -d /tmp/ ]] && \ - touch /tmp/.vimtags && ln -sf /tmp/.vimtags . +[[ -d $tmpdir ]] && \ + touch $tmpdir/.vimtags && ln -sf $tmpdir/.vimtags . ############# INITIALISE CONFIGS ############## -[[ -f ~/.config/init/init.sh ]] && \ - ~/.config/init/init.sh +[[ -f $HOME/.config/init/init.sh ]] && \ + $HOME/.config/init/init.sh ########## MAKE USER FUNCS AVAILABLE ########## func_init_checkreq() { @@ -43,15 +44,15 @@ func_init_checkreq() { } if [[ -d $HOME/.config/init/funcs/ && -d $HOME/.config/init/funcreqs ]]; then - rm -rf /tmp/funcs - mkdir -p /tmp/funcs - path+=(/tmp/funcs) + rm -rf $tmpdir/funcs + mkdir -p $tmpdir/funcs + path+=($tmpdir/funcs) for f in $HOME/.config/init/funcreqs/*; do source "$f" func_init_checkreq $func_init_prereqs , $func_init_checks if [[ $? -eq 0 ]] then chmod +x $HOME/.config/init/funcs/${f:t} - ln -s $HOME/.config/init/funcs/${f:t} /tmp/funcs/${f:t} + ln -s $HOME/.config/init/funcs/${f:t} $tmpdir/funcs/${f:t} fi done fi diff --git a/.zprofile-dtach b/.zprofile-dtach index 4571f94..b2256cb 100644 --- a/.zprofile-dtach +++ b/.zprofile-dtach @@ -3,12 +3,12 @@ if [[ -z "${DTACH_SUB}" ]]; then setopt NULL_GLOB while true; do - set -- /tmp/dtach* + set -- $tmpdir/dtach* if [[ "$#" -gt 0 ]]; then # session exists, so show the menu { while true; do - set -- /tmp/dtach* + set -- $tmpdir/dtach* if [[ "$#" -eq 0 ]]; then # logout if all sessions terminated clear @@ -16,9 +16,9 @@ if [[ -z "${DTACH_SUB}" ]]; then fi # list sessions - set -- /tmp/dtach* + set -- $tmpdir/dtach* if [[ "$#" -gt 0 ]]; then - ls /tmp/dtach* | sed 's/\/tmp\/dtach-//g' + ls $tmpdir/dtach* | sed "s/\$tmpdir\/dtach-//g" fi echo -n "> " @@ -33,7 +33,7 @@ if [[ -z "${DTACH_SUB}" ]]; then ;; *) - DTACH_SUB=true dtach -A "/tmp/dtach-${args[1]}" -z zsh + DTACH_SUB=true dtach -A "$tmpdir/dtach-${args[1]}" -z zsh clear ;; esac @@ -45,9 +45,9 @@ if [[ -z "${DTACH_SUB}" ]]; then logout else # create the main session - DTACH_SUB=true dtach -A /tmp/dtach-1 -z zsh + DTACH_SUB=true dtach -A $tmpdir/dtach-1 -z zsh clear - set -- /tmp/dtach* + set -- $tmpdir/dtach* if [[ "$#" -eq 0 ]]; then # logout if all sessions terminated clear diff --git a/.zshrc b/.zshrc index d848f6a..d8890bb 100644 --- a/.zshrc +++ b/.zshrc @@ -155,7 +155,6 @@ elif [[ ! -z $(whence vim) ]] then fi [[ ! -z $(whence sdcv) ]] && alias def='sdcv' -[[ ! -z $(whence herbstclient) ]] && alias hc='herbstclient' [[ ! -z $(whence aiksaurus) ]] && alias thesaurus='aiksaurus' [[ ! -z $(whence ag) ]] && alias ag='ag --color-match "1;34"' [[ ! -z $(whence latex) ]] && alias latex='latex -output-format=pdf' -- cgit v1.2.3