Compare commits

...

18 Commits

Author SHA1 Message Date
appeasementPolitik
7bf7b73a4e
Give weath 'cp' option to copy forecast as plain text for sharing 2023-08-24 14:20:23 +00:00
appeasementPolitik
c389d429bb
Merge branch 'LukeSmithxyz:master' into weath 2023-08-24 14:10:48 +00:00
Luke Smith
a360fadd5f
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-08-23 12:28:53 +02:00
Luke Smith
8315e4c885
libertinus replaces libertine 2023-08-23 12:28:42 +02:00
appeasementPolitik
f26e5678e6
Fix arkenfox pacman hook complaining about root (#1351)
The previous pull request on LARBS turned out not to work, so make sure `arkenfox-auto-update` runs `arkenfox-update` as the user of the firefox profile. Otherwise it complains that it's running as root and stops.

The way of getting the username is safe, because it gets the username from the owner of the user.js file of that profile.
2023-08-18 12:20:05 +00:00
Simon Nikolai Varøy
ed9633da3f
added webp to image formats in linkhandler (#1347)
Co-authored-by: Simon Nikolai Varøy <simon@simonvaroy.xyz>
2023-08-16 14:39:40 +00:00
appeasementPolitik
ec8e82745e
sb-internet: replace grep/sed commands for more efficiency (#1349) 2023-08-16 14:38:10 +00:00
appeasementPolitik
44cb5f12e6
Give setbg parameter to make notifications silent (#1350) 2023-08-16 13:55:59 +00:00
poeplva
d8a8970715
djvu files cannot be previewed (#1335)
added support for previewing books in djvu format.
2023-07-23 23:06:04 +00:00
Lalle
0497dcd51c
Add jsonl to lf (#1345) 2023-07-23 23:02:33 +00:00
Gunnar K. Halvorsen
6f6b749d0e
Fixed formatting bug with notify-send (#1344)
* Fixed formatting bug with notify-send

* Update sb-clock

Fix suggested by 'mhdna'
2023-07-23 23:02:14 +00:00
Luke Smith
9a85d328cc
nsxiv replaces unmaintained sxiv 2023-07-15 18:57:12 +02:00
Luke Smith
07de33840d
Revert "application/octet-stream is for arbitrary binary files (#1321)" (#1336)
This reverts commit af2710799b069486d04ba23c5bdab9cf6c4d6b04.
2023-05-27 01:46:54 +00:00
appeasementPolitik
08639706a9
Make sure sb-volume module is updated when closed after opening (#1316) 2023-05-26 22:11:06 +00:00
poeplva
af2710799b
application/octet-stream is for arbitrary binary files (#1321)
application/octet-stream mime-type is used for arbitrary binary files, so the best guess at opening those kind of should be based on the extension. before this all of this kind of files were tried to be opened with zathura, now it is the last resort in case the file extension is unknown.
2023-05-26 22:10:29 +00:00
Mahdi Nayef
1633233c9d
bulkrename using built-ins instead of using a completely separate program (#1330)
* bulkrename using bult-ins instead of using a completely separate program

* Make it more efficient
2023-05-26 22:08:43 +00:00
Spenser Truex
ce1f0bfa05
Re-add whitespace to some buffer types as needed. (#1333)
Very arcane.

C ANSI standard requires a newline at the end. GCC will complain.

Email signatures should have a space after the -- according to the
standard. Neomutt does this automatically for you if you have a
signature.

Co-authored-by: Spenser Truex <truex@equwal.com>
2023-05-25 03:40:55 +00:00
Mahdi Nayef
0a29cfbf4f
Fix rename key bindings in lf (#1331) 2023-05-24 13:28:56 +00:00
18 changed files with 99 additions and 43 deletions

View File

@ -4,7 +4,7 @@
<alias>
<family>serif</family>
<prefer>
<family>Linux Libertine</family>
<family>Libertinus Serif</family>
<family>Joy Pixels</family>
<family>Noto Color Emoji</family>
<family>FontAwesome</family>
@ -13,7 +13,7 @@
<alias>
<family>sans-serif</family>
<prefer>
<family>Linux Biolinum</family>
<family>Libertinus Sans</family>
<family>Joy Pixels</family>
<family>Noto Color Emoji</family>
<family>FontAwesome</family>
@ -22,7 +22,7 @@
<alias>
<family>sans</family>
<prefer>
<family>Linux Biolinum</family>
<family>Libertinus Sans</family>
<family>Joy Pixels</family>
<family>Noto Color Emoji</family>
<family>FontAwesome</family>
@ -32,7 +32,7 @@
<family>monospace</family>
<prefer>
<family>Noto Sans Mono</family>
<family>Liberation Mono</family>
<family>Liberatinus Mono</family>
<family>FontAwesome</family>
<family>Braille</family>
</prefer>

View File

@ -35,7 +35,7 @@ cmd open ${{
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
image/svg+xml) display -- $f ;;
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" |
setsid -f sxiv -aio 2>/dev/null | while read -r file; do
setsid -f nsxiv -aio 2>/dev/null | while read -r file; do
[ -z "$file" ] && continue
lf -remote "send select \"$file\""
lf -remote "send toggle"
@ -93,7 +93,27 @@ cmd copyto ${{
}}
cmd setbg "$1"
cmd bulkrename $vidir
cmd bulkrename ${{
tmpfile_old="$(mktemp)"
tmpfile_new="$(mktemp)"
[ -n "$fs" ] && fs=$(basename -a $fs) || fs=$(ls)
echo "$fs" > "$tmpfile_old"
echo "$fs" > "$tmpfile_new"
$EDITOR "$tmpfile_new"
[ "$(wc -l < "$tmpfile_old")" -eq "$(wc -l < "$tmpfile_new")" ] || { rm -f "$tmpfile_old" "$tmpfile_new"; exit 1; }
paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst
do
[ "$src" = "$dst" ] || [ -e "$dst" ] || mv -- "$src" "$dst"
done
rm -f "$tmpfile_old" "$tmpfile_new"
lf -remote "send $id unselect"
}}
# Bindings
map <c-f> $lf -remote "send $id select \"$(fzf)\""
@ -113,11 +133,11 @@ map X !$f
map o &mimeopen "$f"
map O $mimeopen --ask "$f"
map A rename # at the very end
map A :rename; cmd-end # at the very end
map c push A<c-u> # new rename
map I push A<c-a> # at the very beginning
map i push A<a-b><a-b><a-f> # before extension
map a push A<a-b> # after extension
map I :rename; cmd-home # at the very beginning
map i :rename # before extension
map a :rename; cmd-right # after extension
map B bulkrename
map b $setbg $f

View File

@ -25,10 +25,14 @@ case "$(file --dereference --brief --mime-type -- "$1")" in
image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
[ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg"
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
image/vnd.djvu)
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
[ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;;
text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
text/troff) man ./ "$1" | col -b ;;
text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;;
text/* | */xml | application/json | application/x-ndjson) bat --terminal-width "$(($4-2))" -f "$1" ;;
audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;;
video/* )
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"

View File

@ -117,6 +117,8 @@ set noshowcmd
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
autocmd BufWritePre *.[ch] %s/\%$/\r/e " add trailing newline for ANSI C standard
autocmd BufWritePre *neomutt* %s/^--$/-- /e " dash-dash-space signature delimiter in emails
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
" When shortcut files are updated, renew bash and ranger configs with new material:

View File

@ -16,12 +16,26 @@ done; unset command
se() {
choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)"
[ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice"
;}
}
weath() {
[ -z "$1" ] && less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport ||
curl -sm 5 "${WTTRURL:-wttr.in}/$1" | less -S
;}
if [ "$1" = 'cp' ]; then
[ -z "$2" ] && sed 's/\x1b\[[^m]*m//g' "${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" | xclip -selection clipboard &&
notify-send "Weather forecast for '$LOCATION' 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 if the location is correct.'; }
else
[ -n "$2" ] &&
notify-send "Invalid option '$1'! The only valid option is 'cp'." &&
return 1
[ -z "$1" ] && less -S "${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" ||
data="$(curl -sfm 5 "${WTTRURL:-wttr.in}/$1")" && echo "$data" | less -S ||
notify-send 'Failed to get weather forecast!' 'Check your internet connection and if the location is correct.'
fi
}
# Verbosity and settings that you pretty much just always are going to want.
alias \

View File

@ -20,4 +20,4 @@ cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings # ncmpcpp (music player)
cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config # ncmpcpp (music player) config
cfl ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc # lf (file browser) config
cfL ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope # lf's scope/preview file
cfX ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler # sxiv (image viewer) key/script handler
cfX ${XDG_CONFIG_HOME:-$HOME/.config}/nsxiv/exec/key-handler # nsxiv (image viewer) key/script handler

View File

@ -16,5 +16,8 @@ IFS='
# Update each found profile.
for profile in $profiles; do
arkenfox-updater -p "${profile%%/user.js*}" -s
userjs=${profile%%/user.js*}
user=$(stat -c '%U' "$userjs") || continue
su -l "$user" -c "arkenfox-updater -c -p $userjs -s"
done

View File

@ -4,7 +4,7 @@
# some choice programs to use to open it.
feed="${1:-$(true | dmenu -p 'Paste URL or file path')}"
case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in
case "$(printf "copy url\\nnsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in
"copy url") echo "$feed" | xclip -selection clipboard ;;
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
@ -13,7 +13,7 @@ case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv
"queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;;
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
nsxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Feed script a url or file location.
# If an image, it will view in sxiv,
# If an image, it will view in nsxiv,
# if a video or gif, it will view in mpv
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
@ -15,8 +15,8 @@ fi
case "$url" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*png|*jpg|*jpe|*jpeg|*gif|*webp)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*pdf|*cbz|*cbr)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)

View File

@ -1,11 +1,11 @@
#!/bin/sh
# When I open an image from the file manager in sxiv (the image viewer), I want
# When I open an image from the file manager in nsxiv (the image viewer), I want
# to be able to press the next/previous keys to key through the rest of the
# images in the same directory. This script "rotates" the content of a
# directory based on the first chosen file, so that if I open the 15th image,
# if I press next, it will go to the 16th etc. Autistic, I know, but this is
# one of the reasons that sxiv is great for being able to read standard input.
# one of the reasons that nsxiv is great for being able to read standard input.
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
base="$(basename "$1")"

View File

@ -13,11 +13,18 @@ bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg"
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
# Give -s as parameter to make notifications silent.
while getopts "s" o; do case "${o}" in
s) silent='1' ;;
esac done
shift $((OPTIND - 1))
trueloc="$(readlink -f "$1")" &&
case "$(file --mime-type -b "$trueloc")" in
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
*) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
image/* ) ln -sf "$trueloc" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Changing wallpaper..." ;;
inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
*) [ -z "$silent" ] && notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
esac
# If pywal is installed, use it.

View File

@ -19,7 +19,7 @@ case "$clock" in
esac
case $BLOCK_BUTTON in
1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s|..27m|</span></b>|")" && notify-send "Appointments" "$(calcurse -d3)" ;;
1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
2) setsid -f "$TERMINAL" -e calcurse ;;
3) 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" ;;

View File

@ -17,10 +17,17 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
# Wifi
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="📡 " || wifiicon="❌ "
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
[ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="📡 " || wifiicon="❌ "
fi
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"
# Ethernet
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="🌐 " || ethericon="❎ "
# TUN
[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon="🔒 "
printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon"

View File

@ -3,7 +3,7 @@
# Prints the current volume or 🔇 if muted.
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e pulsemixer ;;
1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;;
2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;;
5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;;

View File

@ -8,7 +8,7 @@ vidlist="
dwm (window manager) https://videos.lukesmith.xyz/videos/watch/f6b78db7-b368-4647-bc64-28c08fff1988
dwmblocks (status bar) https://videos.lukesmith.xyz/w/mmxHMbqZZEr5FManB57Yy1
pacman (installing/managing programs) https://videos.lukesmith.xyz/videos/watch/8e7cadb9-0fed-47ce-a2a8-6635fa48614b
sxiv (image viewer) https://videos.lukesmith.xyz/videos/watch/ad4c8d85-90c3-4f3d-a1f3-89129e64a3c2
sxiv/nsxiv (image viewer) https://videos.lukesmith.xyz/videos/watch/ad4c8d85-90c3-4f3d-a1f3-89129e64a3c2
st (terminal) https://videos.lukesmith.xyz/videos/watch/efddd39d-bac5-4599-b572-177beb4ce6e8
i3 (old window manager) https://videos.lukesmith.xyz/videos/watch/b861525c-7ada-40ee-a2bb-b5e1ffe0f48b
neomutt (email) https://videos.lukesmith.xyz/videos/watch/83122e83-52d9-4278-ae1a-7d1beeb50c8e

View File

@ -1,4 +1,4 @@
[Desktop Entry]
Type=Application
Name=Image viewer
Exec=/usr/bin/sxiv -a %f
Exec=/usr/bin/nsxiv -a %f

View File

@ -1,9 +1,8 @@
_
_____ _(_)_ __
/ __\ \/ / \ \ / /
\__ \> <| |\ V /
|___/_/\_\_| \_/
sxiv is the image viewer.
_ __ _____ _(_)_ __
| '_ \/ __\ \/ / \ \ / /
| | | \__ \> <| |\ V /
|_| |_|___/_/\_\_| \_/
nsxiv is the image viewer.
h/j/k/l - Pan image
-/+ - Zoom out/in
Enter - Toggle thumbnail mode
@ -12,4 +11,4 @@ sxiv is the image viewer.
r - Reload image if changed
m - Mark/unmark image
w - Zoom to fit window
ctrl-x - Run external command (see ~/.config/sxiv/exec/key-handler for options)
ctrl-x - Run external command (see ~/.config/nsxiv/exec/key-handler for options)

View File

@ -9,7 +9,7 @@ These are the dotfiles deployed by [LARBS](https://larbs.xyz) and as seen on
- zsh (shell)
- lf (file manager)
- mpd/ncmpcpp (music)
- sxiv (image/gif viewer)
- nsxiv (image/gif viewer)
- mpv (video player)
- other stuff like xdg default programs, inputrc and more, etc.
- I try to minimize what's directly in `~` so: