Removed redundant env var check

This commit is contained in:
Vlad Doster 2020-05-18 20:11:32 -05:00
parent a077346e39
commit 4d85b0d871
28 changed files with 249 additions and 122 deletions

View File

@ -38,6 +38,6 @@ alias \
alias \
magit="nvim -c MagitOnly" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" \
weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \
tmux="tmux -f ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME}/shortcutrc ; source ${XDG_CONFIG_HOME}/zshnameddirrc" \
weath="less -S ${XDG_DATA_HOME}/weatherreport" \
tmux="tmux -f ${XDG_CONFIG_HOME}/tmux/tmux.conf" \

View File

@ -5,7 +5,7 @@ D ~/Downloads
m ~/Music
pp ~/Pictures
vv ~/Videos
cf ${XDG_CONFIG_HOME:-$HOME/.config}
cac ${XDG_CACHE_HOME:-$HOME/.cache}
cf ${XDG_CONFIG_HOME}
cac ${XDG_CACHE_HOME}
sc ~/.local/bin
mn /mnt

View File

@ -1,16 +1,16 @@
bf ${XDG_CONFIG_HOME:-$HOME/.config}/files
bd ${XDG_CONFIG_HOME:-$HOME/.config}/directories
bw ${XDG_CONFIG_HOME:-$HOME/.config}/bookmarks
cfa ${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc
bf ${XDG_CONFIG_HOME}/files
bd ${XDG_CONFIG_HOME}/directories
bw ${XDG_CONFIG_HOME}/bookmarks
cfa ${XDG_CONFIG_HOME}/aliasrc
cfz $ZDOTDIR/.zshrc
cfv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim
cft ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/.tmux.conf
cfm ${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc
cfx ${XDG_CONFIG_HOME:-$HOME/.config}/Xresources
cfu ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls
cfn ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/config
cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings
cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config
cfk ${XDG_CONFIG_HOME:-$HOME/.config}/sxhkd/sxhkdrc
cfi ${XDG_CONFIG_HOME:-$HOME/.config}/i3/config
cfb ${XDG_CONFIG_HOME:-$HOME/.config}/i3blocks/config
cfv ${XDG_CONFIG_HOME}/nvim/init.vim
cft ${XDG_CONFIG_HOME}/tmux/.tmux.conf
cfm ${XDG_CONFIG_HOME}/mutt/muttrc
cfx ${XDG_CONFIG_HOME}/Xresources
cfu ${XDG_CONFIG_HOME}/newsboat/urls
cfn ${XDG_CONFIG_HOME}/newsboat/config
cfmb ${XDG_CONFIG_HOME}/ncmpcpp/bindings
cfmc ${XDG_CONFIG_HOME}/ncmpcpp/config
cfk ${XDG_CONFIG_HOME}/sxhkd/sxhkdrc
cfi ${XDG_CONFIG_HOME}/i3/config
cfb ${XDG_CONFIG_HOME}/i3blocks/config

View File

@ -222,7 +222,7 @@ for_window [title="mpvfloat"] border pixel 0
no_focus [title="mpvfloat"]
# #---Function Buttons---# #
bindsym $mod+F1 exec --no-startup-id groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura -
bindsym $mod+F1 exec --no-startup-id groff -mom ${XDG_DATA_HOME}/larbs/readme.mom -Tpdf | zathura -
bindsym $mod+F2 restart
bindsym $mod+F3 exec --no-startup-id displayselect
bindsym $mod+F4 exec --no-startup-id prompt "Hibernate computer?" "$hibernate"

View File

@ -10,7 +10,7 @@ set icons
set period 1
# Vars that depend on environmental variables
$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
$lf -remote "send $id set previewer ${XDG_CONFIG_HOME}/lf/scope"
# cmds/functions
cmd open ${{
@ -42,7 +42,7 @@ cmd moveto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
clear; echo "Move to where?"
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" &&
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME}/directories | fzf)" &&
eval mv -iv $fx $dest &&
notify-send "🚚 File(s) moved." "File(s) moved to $dest."
}}
@ -51,7 +51,7 @@ cmd copyto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
clear; echo "Copy to where?"
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" &&
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME}/directories | fzf)" &&
eval cp -ivr $fx $dest &&
notify-send "📋 File(s) copied." "File(s) copies to $dest."
}}
@ -62,7 +62,7 @@ cmd bulkrename ${{
# Bindings
map <c-f> $lf -remote "send $id select '$(fzf)'"
map J $lf -remote "send $id cd $(cut -d' ' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)"
map J $lf -remote "send $id cd $(cut -d' ' -f2 ${XDG_CONFIG_HOME}/directories | fzf)"
map gh
map g top
map D delete

View File

@ -1,13 +1,13 @@
let mapleader =","
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME}/nvim/autoload/plug.vim"'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
silent !mkdir -p ${XDG_CONFIG_HOME}/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME}/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"'))
call plug#begin(system('echo -n "${XDG_CONFIG_HOME}/nvim/plugged"'))
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'junegunn/goyo.vim'

View File

@ -137,10 +137,10 @@ XF86MyComputer
# Function keys
super + shift + F1
grep LARBSWELCOME ~/.xprofile && ( sed -i "/LARBSWELCOME/d" ~/.xprofile && notify-send "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) || ( echo "notify-send -i "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/larbs.png" \"Welcome to LARBS\" \"Press super+F1 for the help menu.\" # LARBSWELCOME" >> ~/.xprofile && notify-send "LARBS welcome message" "Welcome message re-enabled." )
grep LARBSWELCOME ~/.xprofile && ( sed -i "/LARBSWELCOME/d" ~/.xprofile && notify-send "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) || ( echo "notify-send -i "${XDG_DATA_HOME}/larbs/larbs.png" \"Welcome to LARBS\" \"Press super+F1 for the help menu.\" # LARBSWELCOME" >> ~/.xprofile && notify-send "LARBS welcome message" "Welcome message re-enabled." )
# Show readme
super + F1
groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura -
groff -mom ${XDG_DATA_HOME}/larbs/readme.mom -Tpdf | zathura -
# F2 restarts either dwm or i3 and is bound in each.
# Change display
super + F3

View File

@ -4,13 +4,13 @@ do
case "$1" in
"w") setbg "$file" & ;;
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/directories | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME}/directories | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/directories | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME}/directories | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &

View File

@ -1,5 +1,5 @@
" vim: filetype=vifm
source ${XDG_CONFIG_HOME:-$HOME/.config}/vifm/vifmshortcuts
source ${XDG_CONFIG_HOME}/vifm/vifmshortcuts
set vicmd=$EDITOR
set syscalls

View File

@ -9,12 +9,12 @@ stty stop undef # Disable ctrl-s to freeze terminal.
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
HISTFILE="${XDG_CACHE_HOME}"/zsh/history
# Load aliases and shortcuts if existent.
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc"
[ -f "${XDG_CONFIG_HOME}"/shortcutrc ] && source "${XDG_CONFIG_HOME}"/shortcutrc
[ -f "${XDG_CONFIG_HOME}"/aliasrc ] && source "${XDG_CONFIG_HOME}"/aliasrc
[ -f "${XDG_CONFIG_HOME}"/zshnameddirrc ] && source "${XDG_CONFIG_HOME}"/zshnameddirrc
# Basic auto/tab complete:
autoload -U compinit

View File

@ -3,4 +3,4 @@
# Toggles all cronjobs off/on.
# Stores disabled crontabs in ~/.consaved until restored.
([ -f ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved ] && crontab - < ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && rm ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")
([ -f ${XDG_CONFIG_HOME}/cronsaved ] && crontab - < ${XDG_CONFIG_HOME}/cronsaved && rm ${XDG_CONFIG_HOME}/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ${XDG_CONFIG_HOME}/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")

View File

@ -1,5 +1,5 @@
#!/bin/sh
cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit
cat ${XDG_DATA_HOME}/larbs/getkeys/"$1" 2>/dev/null && exit
echo "Run command with one of the following arguments for info about that program:"
ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys
ls ${XDG_DATA_HOME}/larbs/getkeys

View File

@ -2,7 +2,7 @@
# Toggles the LARBS welcome message.
PIC="${XDG_DATA_HOME:-$HOME/.local/share}/larbs/larbs.png"
PIC="${XDG_DATA_HOME}/larbs/larbs.png"
grep LARBSWELCOME "$XDG_CONFIG_HOME/xprofile" &&
( sed -i "/LARBSWELCOME/d" "$XDG_CONFIG_HOME/xprofile" && notify-send -i "$PIC" "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) ||

View File

@ -4,4 +4,4 @@
[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
echo ${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null
echo ${XDG_DATA_HOME}/newsboat/queue | entr -p queueandnotify 2>/dev/null

View File

@ -3,7 +3,7 @@
# Podboat sucks. This script replaces it.
# It reads the newsboat queue, queuing downloads with taskspooler.
# It also removes the junk from extentions.
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
queuefile="${XDG_DATA_HOME}/newsboat/queue"
while read -r line; do
[ -z "$line" ] && continue

View File

@ -2,7 +2,7 @@
! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null &&
notify-send "That doesn't look like a full URL." && exit
RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
RSSFILE="${XDG_CONFIG_HOME}/newsboat/urls"
if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then
notify-send "You already have this RSS feed."
else

View File

@ -7,14 +7,14 @@
# If wal is installed, also generates a colorscheme.
# Location of link to wallpaper link.
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
bgloc="${XDG_DATA_HOME}/bg"
[ -f "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..."
[ -d "$1" ] && ln -sf "$(find "$(readlink -f "$1")" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen."
# If pywal is installed, use it.
wal -i "$(readlink -f "$bgloc")" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1
wal -i "$(readlink -f "$bgloc")" -o "${XDG_CONFIG_HOME}/wal/postrun" >/dev/null 2>&1
pidof dwm >/dev/null && xdotool key super+F12
xwallpaper --zoom "$bgloc"

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash
# Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc"
zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc"
ranger_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf"
shell_shortcuts="${XDG_CONFIG_HOME}/shortcutrc"
zsh_named_dirs="${XDG_CONFIG_HOME}/zshnameddirrc"
ranger_shortcuts="${XDG_CONFIG_HOME}/ranger/shortcuts.conf"
qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null"
vifm_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/vifm/vifmshortcuts"
vifm_shortcuts="${XDG_CONFIG_HOME}/vifm/vifmshortcuts"
# Remove, prepare files
rm -f "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null
@ -15,7 +15,7 @@ printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
# Format the `directories` file in the correct syntax and sent it to all three configs.
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME}/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
>(awk '{print "hash -d "$1"="$2}' >> "$zsh_named_dirs") \
>(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
>(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \
@ -23,7 +23,7 @@ sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" | tee
| awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts"
# Format the `files` file in the correct syntax and sent it to both configs.
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME}/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"

View File

@ -11,7 +11,7 @@ Basic Attention Token;bat;🦁
LBC;lbc;📚"
# Directory where currency info is stored.
dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices"
dir="${XDG_DATA_HOME}/crypto-prices"
getprices() { # The command to get the desired prices
printf "🔃 "; printprices

View File

@ -9,7 +9,7 @@ ps ax | grep -q "\sdwm$" &&
restartwm() { i3 restart ;}
case $BLOCK_BUTTON in
1) groff -mom "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom}" -Tpdf | zathura - ;;
1) groff -mom "${READMEFILE:-${XDG_DATA_HOME}/larbs/readme.mom}" -Tpdf | zathura - ;;
2) restartwm ;;
3) notify-send "❓ Help module" "\- Left click to open LARBS guide.
- Middle click to refresh window manager." ;;

View File

@ -7,4 +7,4 @@
ifinstalled "geoip" || exit
addr="$(curl ifconfig.me 2>/dev/null)" || exit
grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
grep "flag: " "${XDG_DATA_HOME}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"

View File

@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
unread="$(find "${XDG_DATA_HOME}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
icon="$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)"

View File

@ -2,7 +2,7 @@
# Shows the current moon phase.
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
moonfile="${XDG_DATA_HOME}/moonphase"
[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
{ curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}

View File

@ -10,8 +10,8 @@ case "$BLOCK_BUTTON" in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
rxfile="${XDG_CACHE_HOME:-$HOME/.cache}/rxlog"
txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog"
rxfile="${XDG_CACHE_HOME}/rxlog"
txfile="${XDG_CACHE_HOME}/txlog"
rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+' | bc)"
txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)"

View File

@ -14,4 +14,4 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰 " $1}' | sed 's/^📰 0$//g')$(cat ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/.update 2>/dev/null)"
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰 " $1}' | sed 's/^📰 0$//g')$(cat ${XDG_CONFIG_HOME}/newsboat/.update 2>/dev/null)"

View File

@ -6,17 +6,17 @@
# If we have internet, get a weather report from wttr.in and store it locally.
# You could set up a shell alias to view the full file in a pager in the
# terminal if desired. This function will only be run once a day when needed.
getforecast() { curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" || exit 1 ;}
getforecast() { curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME}/weatherreport" || exit 1 ;}
# Some very particular and terse stream manipulation. We get the maximum
# precipication chance and the daily high and low from the downloaded file and
# display them with coresponding emojis.
showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" |
showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME}/weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔ /g;1q" | tr -d '\n')"
sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶",$1 "°","🌞",$2 "°"}' ;}
sed '13q;d' "${XDG_DATA_HOME}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶",$1 "°","🌞",$2 "°"}' ;}
case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" & ;;
1) setsid "$TERMINAL" -e less -Srf "${XDG_DATA_HOME}/weatherreport" & ;;
2) getforecast && showweather ;;
3) notify-send "🌈 Weather module" "\- Left click for full forecast.
- Middle click to update forecast.
@ -28,7 +28,7 @@ esac
# The test if our forcecast is updated to the day. If it isn't download a new
# weather report from wttr.in with the above function.
[ "$(stat -c %y "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
[ "$(stat -c %y "${XDG_DATA_HOME}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
getforecast
showweather

View File

@ -1 +0,0 @@
.zprofile

128
.profile Normal file
View File

@ -0,0 +1,128 @@
#!/bin/zsh
# zsh profile file. Runs on login. Environmental variables are set here.
# If you don't plan on reverting to bash, you can remove the link in ~/.profile
# to clean up.
# Adds `~/.local/bin` to $PATH
export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | paste -sd ':')"
# Default programs:
export EDITOR="nvim"
export TERMINAL="st"
export BROWSER="brave"
export READER="zathura"
# ~/ Clean-up:
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
## configs
export ALSA_CONFIG_PATH="${XDG_CONFIG_HOME}/alsa/asoundrc"
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME}/android"
export ANSIBLE_CONFIG="${XDG_CONFIG_HOME}/ansible/ansible.cfg"
export GTK2_RC_FILES="${XDG_CONFIG_HOME}/gtk-2.0/gtkrc-2.0"
export INPUTRC="${XDG_CONFIG_HOME}/readline/inputrc"
export NOTMUCH_CONFIG="${XDG_CONFIG_HOME}/notmuch-config"
export WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
## program data
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
#export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export GOPATH="${XDG_DATA_HOME}/go"
export KODI_DATA="${XDG_DATA_HOME}/kodi"
export PASSWORD_STORE_DIR="${XDG_DATA_HOME}/password-store"
export TMUX_TMPDIR="${XDG_RUNTIME_DIR}"
export WINEPREFIX="${XDG_DATA_HOME}/wineprefixes/default"
# Misc. program settings:
export DICS="/usr/share/stardict/dic/"
export SUDO_ASKPASS="${HOME}/.local/bin/dmenupass"
export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
export LESS=-R
export LESSHISTFILE="-"
export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
export LESS_TERMCAP_mb="$(printf '%b' '')"
export LESS_TERMCAP_md="$(printf '%b' '')"
export LESS_TERMCAP_me="$(printf '%b' '')"
export LESS_TERMCAP_se="$(printf '%b' '')"
export LESS_TERMCAP_so="$(printf '%b' '')"
export LESS_TERMCAP_ue="$(printf '%b' '')"
export LESS_TERMCAP_us="$(printf '%b' '')"
export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm.
# This is the list for lf icons:
export LF_ICONS="di=📁:\
fi=📃:\
tw=🤝:\
ow=📂:\
ln=⛓:\
or=❌:\
ex=🎯:\
*.1=:\
*.7z=📦:\
*.R=📊:\
*.Rmd=📊:\
*.avi=🎥:\
*.bib=🎓:\
*.css=🎨:\
*.csv=📓:\
*.djvu=📚:\
*.epub=📚:\
*.flac=🎼:\
*.ged=👪:\
*.gif=🖼:\
*.gpg=🔒:\
*.html=🌎:\
*.ico=🖼:\
*.img=📀:\
*.info=:\
*.iso=📀:\
*.jpeg=📸:\
*.jpg=📸:\
*.log=📙:\
*.m4a=🎵:\
*.md=📘:\
*.me=✍:\
*.mkv=🎥:\
*.mom=✍:\
*.mp3=🎵:\
*.mp4=🎥:\
*.mpeg=🎥:\
*.ms=✍:\
*.n64=🎮:\
*.nfo=:\
*.ogg=🎵:\
*.opus=🎵:\
*.part=💔:\
*.pdf=📚:\
*.png=🖼:\
*.r=📊:\
*.rar=📦:\
*.rmd=📊:\
*.svg=🗺:\
*.tar.gz=📦:\
*.tex=📜:\
*.torrent=🔽:\
*.txt=✍:\
*.v64=🎮:\
*.webm=🎥:\
*.xcf=🖌:\
*.xlsx=📓:\
*.xml=📰:\
*.z64=🎮:\
*.zip=📦:\
"
[ ! -f "${XDG_CONFIG_HOME}"/shortcutrc ] && shortcuts >/dev/null 2>&1 &
# Start graphical server on tty1 if not already running.
[ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec startx "${XDG_CONFIG_HOME}"/X11/xinitrc
# Switch escape and caps if tty and no passwd required:
sudo -n loadkeys "${XDG_DATA_HOME}"/larbs/ttymaps.kmap 2>/dev/null

110
.zprofile
View File

@ -15,11 +15,10 @@ export BROWSER="brave"
export READER="zathura"
# ~/ Clean-up:
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
## configs
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export ALSA_CONFIG_PATH="${XDG_CONFIG_HOME}/alsa/asoundrc"
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME}/android"
export ANSIBLE_CONFIG="${XDG_CONFIG_HOME}/ansible/ansible.cfg"
@ -27,6 +26,7 @@ export GTK2_RC_FILES="${XDG_CONFIG_HOME}/gtk-2.0/gtkrc-2.0"
export INPUTRC="${XDG_CONFIG_HOME}/readline/inputrc"
export NOTMUCH_CONFIG="${XDG_CONFIG_HOME}/notmuch-config"
export WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
## program data
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
@ -34,8 +34,8 @@ export CARGO_HOME="${XDG_DATA_HOME}/cargo"
export GOPATH="${XDG_DATA_HOME}/go"
export KODI_DATA="${XDG_DATA_HOME}/kodi"
export PASSWORD_STORE_DIR="${XDG_DATA_HOME}/password-store"
export WINEPREFIX="${XDG_DATA_HOME}/wineprefixes/default"
export TMUX_TMPDIR="${XDG_RUNTIME_DIR}"
export WINEPREFIX="${XDG_DATA_HOME}/wineprefixes/default"
# Misc. program settings:
export DICS="/usr/share/stardict/dic/"
@ -47,14 +47,14 @@ export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
export LESS_TERMCAP_mb="$(printf '%b' '')"
export LESS_TERMCAP_md="$(printf '%b' '')"
export LESS_TERMCAP_me="$(printf '%b' '')"
export LESS_TERMCAP_so="$(printf '%b' '')"
export LESS_TERMCAP_se="$(printf '%b' '')"
export LESS_TERMCAP_us="$(printf '%b' '')"
export LESS_TERMCAP_so="$(printf '%b' '')"
export LESS_TERMCAP_ue="$(printf '%b' '')"
export LESS_TERMCAP_us="$(printf '%b' '')"
export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm.
# This is the list for lf icons:
export LF_ICONS="di=📁:\
@ -64,65 +64,65 @@ ow=📂:\
ln=⛓:\
or=❌:\
ex=🎯:\
*.txt=✍:\
*.mom=✍:\
*.me=✍:\
*.ms=✍:\
*.png=🖼:\
*.ico=🖼:\
*.jpg=📸:\
*.jpeg=📸:\
*.gif=🖼:\
*.svg=🗺:\
*.xcf=🖌:\
*.html=🌎:\
*.xml=📰:\
*.gpg=🔒:\
*.1=:\
*.7z=📦:\
*.R=📊:\
*.Rmd=📊:\
*.avi=🎥:\
*.bib=🎓:\
*.css=🎨:\
*.pdf=📚:\
*.csv=📓:\
*.djvu=📚:\
*.epub=📚:\
*.csv=📓:\
*.xlsx=📓:\
*.tex=📜:\
*.md=📘:\
*.r=📊:\
*.R=📊:\
*.rmd=📊:\
*.Rmd=📊:\
*.mp3=🎵:\
*.opus=🎵:\
*.ogg=🎵:\
*.m4a=🎵:\
*.flac=🎼:\
*.mkv=🎥:\
*.mp4=🎥:\
*.webm=🎥:\
*.mpeg=🎥:\
*.avi=🎥:\
*.zip=📦:\
*.rar=📦:\
*.7z=📦:\
*.tar.gz=📦:\
*.z64=🎮:\
*.v64=🎮:\
*.n64=🎮:\
*.1=:\
*.nfo=:\
*.info=:\
*.log=📙:\
*.iso=📀:\
*.img=📀:\
*.bib=🎓:\
*.ged=👪:\
*.gif=🖼:\
*.gpg=🔒:\
*.html=🌎:\
*.ico=🖼:\
*.img=📀:\
*.info=:\
*.iso=📀:\
*.jpeg=📸:\
*.jpg=📸:\
*.log=📙:\
*.m4a=🎵:\
*.md=📘:\
*.me=✍:\
*.mkv=🎥:\
*.mom=✍:\
*.mp3=🎵:\
*.mp4=🎥:\
*.mpeg=🎥:\
*.ms=✍:\
*.n64=🎮:\
*.nfo=:\
*.ogg=🎵:\
*.opus=🎵:\
*.part=💔:\
*.pdf=📚:\
*.png=🖼:\
*.r=📊:\
*.rar=📦:\
*.rmd=📊:\
*.svg=🗺:\
*.tar.gz=📦:\
*.tex=📜:\
*.torrent=🔽:\
*.txt=✍:\
*.v64=🎮:\
*.webm=🎥:\
*.xcf=🖌:\
*.xlsx=📓:\
*.xml=📰:\
*.z64=🎮:\
*.zip=📦:\
"
[ ! -f ${XDG_CONFIG_HOME}/shortcutrc ] && shortcuts >/dev/null 2>&1 &
[ ! -f "${XDG_CONFIG_HOME}"/shortcutrc ] && shortcuts >/dev/null 2>&1 &
# Start graphical server on tty1 if not already running.
[ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec startx "${XDG_CONFIG_HOME}/X11/xinitrc"
[ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec startx "${XDG_CONFIG_HOME}"/X11/xinitrc
# Switch escape and caps if tty and no passwd required:
sudo -n loadkeys ${XDG_DATA_HOME}/larbs/ttymaps.kmap 2>/dev/null
sudo -n loadkeys "${XDG_DATA_HOME}"/larbs/ttymaps.kmap 2>/dev/null