mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
Merge ba070c3d79bcff466412da06fc46d901b6bfbcd7 into 1f7376c805cb57daef05713412f8e562141eead8
This commit is contained in:
commit
6a2d292fa7
@ -16,7 +16,7 @@ done; unset command
|
|||||||
se() {
|
se() {
|
||||||
choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)"
|
choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)"
|
||||||
[ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice"
|
[ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice"
|
||||||
;}
|
}
|
||||||
|
|
||||||
# Verbosity and settings that you pretty much just always are going to want.
|
# Verbosity and settings that you pretty much just always are going to want.
|
||||||
alias \
|
alias \
|
||||||
@ -58,4 +58,3 @@ alias \
|
|||||||
lf="lfub" \
|
lf="lfub" \
|
||||||
magit="nvim -c MagitOnly" \
|
magit="nvim -c MagitOnly" \
|
||||||
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
|
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
|
||||||
weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \
|
|
||||||
|
|||||||
25
.local/bin/weath
Normal file
25
.local/bin/weath
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Get the weather on the terminal. You can pass an alternative location as a parameter,
|
||||||
|
# and/or use the 'cp' option to copy the forecast as plaintext to the clipboard.
|
||||||
|
|
||||||
|
report="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
|
||||||
|
|
||||||
|
if [ "$1" = 'cp' ]; then
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -z "$2" ] && sed 's/\x1b\[[^m]*m//g' "$report" | xclip -selection clipboard &&
|
||||||
|
notify-send "Weather forecast for '${LOCATION:-$(head -n 1 "$report" | cut -d' ' -f3-)}' copied to clipboard." ||
|
||||||
|
{ data="$(curl -sfm 5 "${WTTRURL:-wttr.in}/$2?T")" &&
|
||||||
|
notify-send "Weather forecast for '$2' copied to clipboard." &&
|
||||||
|
echo "$data" | xclip -selection clipboard ||
|
||||||
|
notify-send 'Failed to get weather forecast!' 'Check your internet connection and the supplied location.'; }
|
||||||
|
else
|
||||||
|
[ -n "$2" ] &&
|
||||||
|
notify-send "Invalid option '$1'! The only valid option is 'cp'." &&
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -z "$1" ] && less -S "$report" ||
|
||||||
|
data="$(curl -sfm 5 "${WTTRURL:-wttr.in}/$1")" && echo "$data" | less -S ||
|
||||||
|
notify-send 'Failed to get weather forecast!' 'Check your internet connection and the supplied location.'
|
||||||
|
fi
|
||||||
Loading…
x
Reference in New Issue
Block a user