summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/cron/crontog2
-rwxr-xr-x.local/bin/dmenuunicode2
-rwxr-xr-x.local/bin/getkeys4
-rwxr-xr-x.local/bin/i3cmds/toggle-welcome2
-rwxr-xr-x.local/bin/lmc2
-rwxr-xr-x.local/bin/podentr2
-rwxr-xr-x.local/bin/queueandnotify2
-rwxr-xr-x.local/bin/rssadd2
-rwxr-xr-x.local/bin/setbg2
-rwxr-xr-x.local/bin/shortcuts12
-rwxr-xr-x.local/bin/statusbar/clock2
-rwxr-xr-x.local/bin/statusbar/help2
-rwxr-xr-x.local/bin/statusbar/iplocate2
-rwxr-xr-x.local/bin/statusbar/mailbox2
-rwxr-xr-x.local/bin/statusbar/news2
-rwxr-xr-x.local/bin/statusbar/weather10
16 files changed, 25 insertions, 27 deletions
diff --git a/.local/bin/cron/crontog b/.local/bin/cron/crontog
index 67f620b..8168012 100755
--- a/.local/bin/cron/crontog
+++ b/.local/bin/cron/crontog
@@ -3,4 +3,4 @@
# Toggles all cronjobs off/on.
# Stores disabled crontabs in ~/.consaved until restored.
-([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")
+([ -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.")
diff --git a/.local/bin/dmenuunicode b/.local/bin/dmenuunicode
index 12240e7..15799a3 100755
--- a/.local/bin/dmenuunicode
+++ b/.local/bin/dmenuunicode
@@ -5,7 +5,7 @@
# Must have xclip installed to even show menu.
xclip -h 2>/dev/null || exit 1
-chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//")
+chosen=$(cut -d ';' -f1 ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//")
[ "$chosen" != "" ] || exit
diff --git a/.local/bin/getkeys b/.local/bin/getkeys
index 8871d41..0a0e86e 100755
--- a/.local/bin/getkeys
+++ b/.local/bin/getkeys
@@ -1,5 +1,5 @@
#!/bin/sh
-cat ~/.local/share/larbs/getkeys/"$1" 2>/dev/null && exit
+cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit
echo "Run command with one of the following arguments for info about that program:"
-ls ~/.local/share/larbs/getkeys
+ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys
diff --git a/.local/bin/i3cmds/toggle-welcome b/.local/bin/i3cmds/toggle-welcome
index 715db09..517c301 100755
--- a/.local/bin/i3cmds/toggle-welcome
+++ b/.local/bin/i3cmds/toggle-welcome
@@ -2,7 +2,7 @@
# Toggles the LARBS welcome message.
-PIC="$HOME/.local/share/larbs/larbs.png"
+PIC="${XDG_DATA_HOME:-$HOME/.local/share}/larbs/larbs.png"
grep LARBSWELCOME "$HOME/.xprofile" &&
( sed -i "/LARBSWELCOME/d" ~/.xprofile && notify-send -i "$PIC" "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) ||
diff --git a/.local/bin/lmc b/.local/bin/lmc
index 6d64b64..d431495 100755
--- a/.local/bin/lmc
+++ b/.local/bin/lmc
@@ -26,5 +26,3 @@ case "$1" in
down) down ;;
control) control ;;
esac
-
-pkill -RTMIN+10 "${STATUSBAR:?}" &
diff --git a/.local/bin/podentr b/.local/bin/podentr
index e765c58..9a8313a 100755
--- a/.local/bin/podentr
+++ b/.local/bin/podentr
@@ -4,4 +4,4 @@
[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
-echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null
+echo ${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null
diff --git a/.local/bin/queueandnotify b/.local/bin/queueandnotify
index 867b15e..a54b13e 100755
--- a/.local/bin/queueandnotify
+++ b/.local/bin/queueandnotify
@@ -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="$HOME/.local/share/newsboat/queue"
+queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
while read -r line; do
[ -z "$line" ] && continue
diff --git a/.local/bin/rssadd b/.local/bin/rssadd
index 4ef31a4..2ce421b 100755
--- a/.local/bin/rssadd
+++ b/.local/bin/rssadd
@@ -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="$HOME/.config/newsboat/urls"
+RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then
notify-send "You already have this RSS feed."
else
diff --git a/.local/bin/setbg b/.local/bin/setbg
index 7b07e23..8269378 100755
--- a/.local/bin/setbg
+++ b/.local/bin/setbg
@@ -7,7 +7,7 @@
# If wal is installed, also generate a colorscheme.
# Location of link to wallpaper link.
-bgloc="${XDG_CACHE_HOME:-$HOME/.cache/}/bg"
+bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
[ -f "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..."
diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts
index 2611206..19d3ffd 100755
--- a/.local/bin/shortcuts
+++ b/.local/bin/shortcuts
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# Output locations. Unactivated progs should go to /dev/null.
-shell_shortcuts="$HOME/.config/shortcutrc"
-zsh_named_dirs="$HOME/.config/zshnameddirrc"
-ranger_shortcuts="$HOME/.config/ranger/shortcuts.conf"
+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"
qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null"
-vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
+vifm_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/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" "$HOME/.config/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
+sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/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" "$HOME/.config/directories" | tee >(awk '{print $1"=\
| 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" "$HOME/.config/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
+sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/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"
diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock
index d17f3c6..23e881e 100755
--- a/.local/bin/statusbar/clock
+++ b/.local/bin/statusbar/clock
@@ -4,7 +4,7 @@ date '+%Y %b %d (%a) %I:%M%p'
case $BLOCK_BUTTON in
1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
- 2) $TERMINAL -e calcurse -D ~/.config/calcurse ;;
+ 2) $TERMINAL -e calcurse -D ${XDG_CONFIG_HOME:-$HOME/.config}/calcurse ;;
3) pgrep -x dunst >/dev/null && notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
- Middle click opens calcurse if installed" ;;
esac
diff --git a/.local/bin/statusbar/help b/.local/bin/statusbar/help
index d7345dc..c1f1caa 100755
--- a/.local/bin/statusbar/help
+++ b/.local/bin/statusbar/help
@@ -1,7 +1,7 @@
#!/bin/sh
case $BLOCK_BUTTON in
- 1) groff -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura - ;;
+ 1) groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - ;;
2) i3 restart ;;
3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide.
- Middle click to refresh i3.";;
diff --git a/.local/bin/statusbar/iplocate b/.local/bin/statusbar/iplocate
index 4ca4f10..1dddb7c 100755
--- a/.local/bin/statusbar/iplocate
+++ b/.local/bin/statusbar/iplocate
@@ -6,4 +6,4 @@
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
ifinstalled "geoiplookup" || exit
addr="$(curl ifconfig.me 2>/dev/null)" || exit
-grep "flag: " ~/.config/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
+grep "flag: " ${XDG_CONFIG_HOME:-$HOME/.config}/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox
index 3ace5f5..49630ad 100755
--- a/.local/bin/statusbar/mailbox
+++ b/.local/bin/statusbar/mailbox
@@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
- Middle click syncs mail" ;;
esac
-unread="$(find ~/.local/share/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)"
+unread="$(find ${XDG_DATA_HOME:-$HOME/.local/share}/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)"
icon="$(cat "/tmp/imapsyncicon_$USER")"
diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news
index a8842ad..28b2940 100755
--- a/.local/bin/statusbar/news
+++ b/.local/bin/statusbar/news
@@ -14,4 +14,4 @@ case $BLOCK_BUTTON in
<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;;
esac
- cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰 " $1}' | sed s/^0$//g)$(cat ~/.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:-$HOME/.config}/newsboat/.update 2>/dev/null)"
diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather
index e98628e..59198a0 100755
--- a/.local/bin/statusbar/weather
+++ b/.local/bin/statusbar/weather
@@ -7,18 +7,18 @@
# 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() { ping -q -c 1 1.1.1.1 >/dev/null &&
-curl -sf "wttr.in/$LOCATION" > "$HOME/.local/share/weatherreport" || exit 1 ;}
+curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:-$HOME/.local/share}/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' "$HOME/.local/share/weatherreport" |
+showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔ /g;1q" | tr -d '\n')"
-sed '13q;d' "$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:-$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 "°"}' ;}
# The BLOCK_BUTTON bloat for clicking in i3.
case $BLOCK_BUTTON in
- 1) $TERMINAL -e less -Srf "$HOME/.local/share/weatherreport" ;;
+ 1) $TERMINAL -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" ;;
2) getforecast && showweather ;;
3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast.
- Middle click to update forecast.
@@ -29,7 +29,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 "$HOME/.local/share/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
+[ "$(stat -c %y "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
getforecast
showweather