Update some commands and change terminal to st

This commit is contained in:
2021-05-29 19:03:23 +01:00
parent bc8d62e90b
commit b17345ecdf
12 changed files with 88 additions and 48 deletions

View File

@@ -9,8 +9,9 @@ unsetopt PROMPT_SP
# Default programs # Default programs
export EDITOR="nvim" export EDITOR="nvim"
export TERMINAL="alacritty" export TERMINAL="st"
export BROWSER="firefox" export BROWSER="firefox"
export LOCATION="guildford"
# ~/ Clean-up: # ~/ Clean-up:
export TOWER="$HOME/Tower" export TOWER="$HOME/Tower"

8
.local/bin/cron/checkup Normal file → Executable file
View File

@@ -2,9 +2,7 @@
# Syncs repositories and downloads updates, meant to be run as a cronjob. # Syncs repositories and downloads updates, meant to be run as a cronjob.
ping -q -c 1 example.org > /dev/null || exit notify-send " Repository Sync" "Checking for package updates..."
notify-send "📦 Repository Sync" "Checking for package updates..."
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
Check your internet connection, if pacman is already running, or run update manually to see errors." Check your internet connection, if pacman is already running, or run update manually to see errors."
@@ -12,7 +10,7 @@ pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
if pacman -Qu | grep -v "\[ignored\]" if pacman -Qu | grep -v "\[ignored\]"
then then
notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update." notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
else else
notify-send "📦 Repository Sync" "Sync complete. No new packages for update." notify-send " Repository Sync" "Sync complete. No new packages for update."
fi fi

0
.local/bin/cron/crontog Normal file → Executable file
View File

4
.local/bin/cron/newsup Normal file → Executable file
View File

@@ -3,13 +3,11 @@
# Set as a cron job to check for new RSS entries for newsboat. # Set as a cron job to check for new RSS entries for newsboat.
# If newsboat is open, sends it an "R" key to refresh. # If newsboat is open, sends it an "R" key to refresh.
ping -q -c 1 example.org > /dev/null || exit
/usr/bin/notify-send "📰 Updating RSS feeds..." /usr/bin/notify-send "📰 Updating RSS feeds..."
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
echo 🔃 > /tmp/newsupdate echo > /tmp/newsupdate
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
/usr/bin/newsboat -x reload /usr/bin/newsboat -x reload
rm -f /tmp/newsupdate rm -f /tmp/newsupdate

View File

@@ -1,35 +1,88 @@
#!/bin/sh #!/bin/sh
# Displays todays precipication chance () and daily low (🥶) and high (🌞). # Displays todays precipication chance () and daily low () and high ().
# Usually intended for the statusbar. # Usually intended for the statusbar.
# If we have internet, get a weather report from wttr.in and store it locally. # 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 # 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. # terminal if desired. This function will only be run once a day when needed.
weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" weather_report="${XDG_DATA_HOME:-$HOME/.local/share}/weather_report"
getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;}
# Some very particular and terse stream manipulation. We get the maximum get_forecast() {
# precipitation chance and the daily high and low from the downloaded file and curl -sf "wttr.in/$LOCATION?format=j1" > "$weather_report" || exit 1
# display them with coresponding emojis. }
showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^//g;1q" | tr -d '\n')" codes="113=
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " " $1 "°","" $2 "°"}' ;} 116=
119=
122=
143=
176=
179=
182=
185=
200=
227=
230=
248=
260=
263=
266=
281=
284=
293=
296=
299=
302=
305=
308=
311=
314=
317=
320=
323=
326=
329=
332=
335=
338=
350=
353=
356=
359=
362=
365=
368=
371=
374=
377=
386=
389=
392=
395="
show_weather() {
weather_code="$(cat "$weather_report" | jq -r '.current_condition[0].weatherCode')"
temperature="$(cat "$weather_report" | jq -r '.current_condition[0].FeelsLikeC')"
echo "$codes" | sed -n "/$weather_code/{s/[0-9]*=//;p;q}" | tr -d '\n'
symbol="$([[ $temperature -lt 15 ]] && echo  || echo )"
echo " $temperature$symbol"
}
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; 1) setsid -f "$TERMINAL" -e curl "wttr.in/$LOCATION";;
2) getforecast && showweather ;; 2) get_forecast && show_weather ;;
3) notify-send "🌈 Weather module" "\- Left click for full forecast. 3) notify-send "🌈 Weather module" "\- Left click for full forecast.
- Middle click to update forecast. - Middle click to update forecast." ;;
: Chance of rain/snow
: Daily low
: Daily high" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
# The test if our forcecast is updated to the day. If it isn't download a new # 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. # weather report from wttr.in with the above function.
[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || [ "$(stat -c %y "$weather_report" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
getforecast get_forecast
showweather show_weather

View File

@@ -1,10 +0,0 @@
#!/bin/sh
# Gets your public ip address checks which country you are in and
# displays that information in the statusbar
#
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
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/;.*//"

View File

@@ -13,4 +13,4 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
echo "$kb" echo " $kb"

View File

@@ -4,14 +4,14 @@
# When clicked, brings up `newsboat`. # When clicked, brings up `newsboat`.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e newsboat ;; 1) setsid "$TERMINAL" -e newsboat ;;
2) setsid -f newsup >/dev/null exit ;; 2) setsid -f newsup >/dev/null exit ;;
3) notify-send "📰 News module" "\- Shows unread news items 3) notify-send " News module" "\- Shows unread news items
- Shows  if updating with \`newsup\` - Shows  if updating with \`newsup\`
- Left click opens newsboat - Left click opens newsboat
- Middle click syncs RSS feeds - Middle click syncs RSS feeds
<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;; <b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print " " $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"

View File

@@ -20,10 +20,10 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e sb-popupgrade ;; 1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
2) notify-send "$(/usr/bin/pacman -Qu)" ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
3) notify-send "🎁 Upgrade module" ": number of upgradable packages 3) notify-send " Upgrade module" ": number of upgradable packages
- Left click to upgrade packages - Left click to upgrade packages
- Middle click to show upgradable packages" ;; - Middle click to show upgradable packages" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
pacman -Qu | grep -Fcv "[ignored]" | sed "s/^//;s/^0$//g" pacman -Qu | grep -Fcv "[ignored]" | sed "s/^//;s/^0$//g"

View File

@@ -1,4 +1,4 @@
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=File Manager Name=File Manager
Exec=/usr/bin/alacritty -e lf %u Exec=/usr/local/bin/st -e lf %u

View File

@@ -1,4 +1,4 @@
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=Mail Name=Mail
Exec=/usr/bin/alacritty -e neomutt %u Exec=/usr/local/bin/st -e neomutt %u

View File

@@ -1,4 +1,4 @@
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=Text editor Name=Text editor
Exec=/usr/bin/alacritty -e nvim %u Exec=/usr/local/bin/st -e nvim %u