summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-12-12 09:22:22 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-12-12 09:22:22 +0100
commitffc2a7d3cee6385508601374bdd34db253b70c65 (patch)
tree433bda0daa8504538ce27bdc7a80999bba611663
parentf4dc6e9489bd1274cba77aec04343dbec72f4a7d (diff)
parent6b44e39caba17672bf32960f5829597d9fa544b1 (diff)
Merge branch 'main' of debuc.com:dotfiles
-rwxr-xr-xbin/common/ytclipo19
-rwxr-xr-xbin/common/ytlink14
-rwxr-xr-xbin/extra/sgimg2
-rwxr-xr-xbin/guiscripts/linkhandler8
-rwxr-xr-xbin/guiscripts/sturl6
-rw-r--r--config/common/newsboat/config8
-rw-r--r--config/essentials/zsh/.zshrc2
-rw-r--r--config/essentials/zsh/aliases.sh3
-rw-r--r--config/essentials/zsh/functions.sh (renamed from config/essentials/zsh/functions.zsh)52
-rw-r--r--config/extra/tridactyl/tridactylrc2
10 files changed, 62 insertions, 54 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo
index 959ee21..1a82df2 100755
--- a/bin/common/ytclipo
+++ b/bin/common/ytclipo
@@ -1,23 +1,6 @@
#!/bin/sh
-# argument ($1) -> clipboard -> stdin
-if [ "$WAYLAND_DISPLAY" ]
-then paste() { wl-paste; }
-elif [ "$TERMUX_VERSION" ]
-then paste() { termux-clipboard-get; }
-else paste() { xclip -o -sel c; }
-fi
-
-inp="$1"
-[ "${inp:=$(paste)}" ] || inp="$(cat /dev/stdin)"
-
-# remove util scheme
-inp="${inp#*//}"
-# convert to youtube.com/path url
-# works for:
-# - 'youtu.be/watch?v=xxxxxx'
-# - 'https://piped.video/watch?v=xxxxx'
-inp="https://youtube.com/${inp#*/}"
+inp="$(ytlink)"
>&2 printf "inp: %s\n" "$inp"
notify-send "ytclipo" "downloading <i>$inp</i>" || :
diff --git a/bin/common/ytlink b/bin/common/ytlink
new file mode 100755
index 0000000..a5e9bf0
--- /dev/null
+++ b/bin/common/ytlink
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# convert to youtube.com/path url
+# works for:
+# - 'youtu.be/watch?v=xxxxxx'
+# - 'https://piped.video/watch?v=xxxxx'
+
+inp="$1"
+[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)"
+
+# remove util scheme
+inp="${inp#*//}"
+inp="https://youtube.com/${inp#*/}"
+printf "%s" "$inp"
diff --git a/bin/extra/sgimg b/bin/extra/sgimg
index 7c1823c..acb8126 100755
--- a/bin/extra/sgimg
+++ b/bin/extra/sgimg
@@ -1,6 +1,6 @@
#!/bin/sh
-imv "$(find ~/.local/share/gurk/ -type f -printf "%A@\t%p\n" |
+imv "$(find ~/.local/share/gurk/ -type f \( -iname '*.png' -o -iname '*.jpg' \) -printf "%A@\t%p\n" |
sort -n |
tail -n 1 |
cut -f 2-)"
diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/linkhandler
index aeec202..329e267 100755
--- a/bin/guiscripts/linkhandler
+++ b/bin/guiscripts/linkhandler
@@ -11,6 +11,12 @@ test -z "${url:=$1}" &&
dunstify "linkhandler" "<b>handling</b> $url"
case "$url" in
+ file://*) file="${url##file:/}"
+ case "$(file -bi "$file" | cut -f1 -d'/')" in
+ audio|video) mpv "$file" ;;
+ image) imv "$file" ;;
+ *) xdg-open "$file" ;;
+ esac ;;
*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 --ytdl --ytdl-raw-options="format-sort=res:720" "$url" > /dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif)
@@ -18,7 +24,7 @@ case "$url" in
*pdf|*cbz|*cbr)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && $VIEWER "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)
- qndl "$url" 'curl -LO' >/dev/null 2>&1 ;;
+ mpv "$url" 'curl -LO' >/dev/null 2>&1 ;;
*)
if [ -f "$url" ]
then setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1
diff --git a/bin/guiscripts/sturl b/bin/guiscripts/sturl
index c738c8e..5b8b1e7 100755
--- a/bin/guiscripts/sturl
+++ b/bin/guiscripts/sturl
@@ -1,11 +1,11 @@
#!/bin/sh
-regex='(((https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
-url="$(tr -d '\n' | grep -Eo "$regex" | dmenu -x -c -g 1 -l 10)"
+regex='(((file|https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
+url="$(tr -d '\n' | grep -Eo "$regex" | tac | commander -cl)"
[ -z "$url" ] && exit 1
case $1 in
- 'c') echo -n "$url" | xclip -sel c -r ;;
+ 'c') printf '%s' "$url" | xclip -sel c -r ;;
'o') linkhandler "$url" ;;
*) echo "no option" ;;
esac
diff --git a/config/common/newsboat/config b/config/common/newsboat/config
index 5f93d68..88ec7ad 100644
--- a/config/common/newsboat/config
+++ b/config/common/newsboat/config
@@ -18,15 +18,19 @@ highlight article "\\[[0-9]+\\]" color10 default bold
highlight article "\\[image\\ [0-9]+\\]" color10 default bold
highlight feedlist "^─.*$" color6 color0 bold
-bind-key j next all
-bind-key k prev all
+bind-key j next
+bind-key k prev
bind-key h quit
+bind-key h set-tag feedlist # return back to tags from 'selected tag' view
bind-key l open
bind-key g home
bind-key G end
bind-key U show-urls
bind-key a toggle-article-read
+# Set home to tags
+run-on-startup set-tag
+
show-keymap-hint no
swap-title-and-hints yes
diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc
index c590d54..7b1f7a0 100644
--- a/config/essentials/zsh/.zshrc
+++ b/config/essentials/zsh/.zshrc
@@ -67,7 +67,7 @@ zle -N add-surround surround
zle -N change-surround surround
# Source files
-. $ZDOTDIR/functions.zsh
+. $ZDOTDIR/functions.sh
. $ZDOTDIR/aliases.sh
for file in /{etc,usr/lib}/os-release
diff --git a/config/essentials/zsh/aliases.sh b/config/essentials/zsh/aliases.sh
index a7e14fb..2e23010 100644
--- a/config/essentials/zsh/aliases.sh
+++ b/config/essentials/zsh/aliases.sh
@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/bin/sh
# s/alias \([^-]\)/alias -g \1
# The most important one
@@ -287,6 +287,7 @@ alias ffwin='hyprctl clients -j | jq '\''.[].pid'\'' | fzf --preview "hyprctl cl
alias pff='find ${PASSWORD_STORE_DIR:=~/src/password-store/} -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e '\''s/\.gpg$//'\'' | fzf | xargs pass show -c'
alias fzps='fzf --print0 | xargs -0I{}'
alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s/%(title)s.%(ext)s"'
+alias ytplay='mpv "$(ytlink)"'
# emacs aliases
alias emacsd='emacs --daemon'
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.sh
index 98cca08..b285e05 100644
--- a/config/essentials/zsh/functions.zsh
+++ b/config/essentials/zsh/functions.sh
@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/bin/sh
log() { >&2 printf '%s' "$@"; }
logn() { >&2 printf '%s\n' "$@"; }
@@ -9,8 +9,8 @@ vmp() {
-c 'set ft=man nolist nonu nornu'
}
nvf() {
- local cache="$HOME/.cache/nvf"
- local match="$(grep -m1 "$1$" "$cache" 2> /dev/null)"
+ cache="$HOME/.cache/nvf"
+ match="$(grep -m1 "$1$" "$cache" 2> /dev/null)"
if test ! -f "$match"
then
logn "resetting cache..."
@@ -26,8 +26,8 @@ nvf() {
fi
}
-nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit }
-ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit }
+nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit; }
+ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit; }
# googoo aliases
_googoo_fzf_opt()
@@ -62,7 +62,7 @@ vimh() { vi -c "help $1" -c 'call feedkeys("\<c-w>o")'; }
dgo() { cd "$(goo d ~ | fzf --filter "$@" | head -n 1)"; }
open() { $EDITOR "$(goo f ~ | fzf --filter "$@" | head -n 1)"; }
pkbs() { doas pacman -Sy "$(pkgfile -b "$1" | tee /dev/stderr)"; }
-oclip() { printf "\033]52;c;$(echo -n "$@" | base64)\a"; }
+oclip() { printf "\033]52;c;$(printf '%s' "$@" | base64)\a"; }
sms() { ssh -t phone sendmsg "$1" "'$2'"; }
trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; }
rln() { ln -s "$(readlink -f "$1")" "$2"; }
@@ -70,7 +70,7 @@ getgit() { git clone git@db:"$1"; }
ipc()
{
- if [[ "$(ip link show eno1 | awk -F, 'NR=1 {print $3}')" == "UP" ]]
+ if [ "$(ip link show eno1 | awk -F, 'NR=1 {print $3}')" = "UP" ]
then
doas ip link set eno1 down
else
@@ -85,7 +85,6 @@ psgrep()
}
unique() {
- local f
f="$(mktemp)"
awk '!x[$0]++' "$1" > "$f"
mv "$f" "$1"
@@ -152,16 +151,16 @@ ginit()
# Returns current branch
git_current_branch()
{
- command git rev-parse --git-dir &>/dev/null || return
+ command git rev-parse --git-dir > /dev/null 2>&1 || return
git branch --show-current
}
# Check if main exists and use instead of master
git_main_branch()
{
- command git rev-parse --git-dir &>/dev/null || return
- local ref
- for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do
+ command git rev-parse --git-dir > /dev/null 2>&1 || return
+ for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}
+ do
if command git show-ref -q --verify $ref; then
echo ${ref:t}
return
@@ -172,10 +171,11 @@ git_main_branch()
# Check for develop and similarly named branches
function git_develop_branch() {
- command git rev-parse --git-dir &>/dev/null || return
- local branch
- for branch in dev devel development; do
- if command git show-ref -q --verify refs/heads/$branch; then
+ command git rev-parse --git-dir > /dev/null 2>&1 || return
+ for branch in dev devel development
+ do
+ if command git show-ref -q --verify refs/heads/$branch
+ then
echo $branch
return
fi
@@ -186,11 +186,14 @@ function git_develop_branch() {
# gpg backup
gpg_backup()
{
- gpg --export-secret-keys --armor > private.asc
- gpg --export --armor > public.asc
- gpg --export-ownertrust --armor > trust.asc
- tar czf gpg_backup.tar.gz {public,private,trust}.asc
- shred -uz {public,private,trust}.asc
+ # $1: option
+ # $2: output file (without .asc)
+ gpg_command() {gpg "$1" --armor > "$2".asc ; }
+ gpg_command --export-secret-keys "private"
+ gpg_command --export "public"
+ gpg_command --export-ownertrust "trust"
+ tar -czvf gpg_backup.tar.gz public.asc private.asc trust.asc
+ shred -uz public.asc private.asc trust.asc
}
gpg_import()
@@ -200,7 +203,7 @@ gpg_import()
gpg --import public.asc
gpg --import-ownertrust trust.asc
gpg --import private.asc
- shred -uz {public,private,trust}.asc
+ shred -uz public.asc private.asc trust.asc
}
ngenable()
@@ -242,7 +245,6 @@ pacsize()
mime-default ()
{
- local mime
[ "${mime:=$1}" ] ||
mime="$(find /usr/share/applications/ -iname '*.desktop' -printf '%f\n' |
sed 's/\.desktop$//' |
@@ -259,7 +261,7 @@ mime-default ()
addedkeys() {
find ~/.ssh -iname "*.pub" | while read key
do
- local fingerprint="$(ssh-keygen -lf "$key" 2>/dev/null)"
+ fingerprint="$(ssh-keygen -lf "$key" 2>/dev/null)"
if ssh-add -l | grep -q "$fingerprint"
then
echo "$key"
@@ -277,8 +279,6 @@ fpass() {
muttmail()
{
- local config
- local mail
config="$HOME/.config/mutt"
mail="$(find "$config"/configs -type f -printf '%f\n' | fzf)"
[ "$mail" ] || return 1
diff --git a/config/extra/tridactyl/tridactylrc b/config/extra/tridactyl/tridactylrc
index 977578b..1a96af5 100644
--- a/config/extra/tridactyl/tridactylrc
+++ b/config/extra/tridactyl/tridactylrc
@@ -1,5 +1,5 @@
set newtab http://localhost:28669
-set searchengine duckduckgo
+set searchengine ""
" Searchurls
set searchurls.1x https://www.1377x.to/search/%s/1