diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-09 18:21:35 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-09 18:21:35 +0200 |
commit | 02da333eb51cc5f7cfc28e194681db0e5f59d485 (patch) | |
tree | 8a6c6a629acceb22eb481ea97341c9f2a0f6cd9c | |
parent | 1db03774f313f1d740cda3f7e4dbc05a50c75d15 (diff) |
checkpoint
-rwxr-xr-x | bin/common/ytlink | 20 | ||||
-rwxr-xr-x | bin/extra/qrclip | 12 | ||||
-rwxr-xr-x | bin/guiscripts/clipo | 4 | ||||
-rwxr-xr-x | bin/guiscripts/clipp | 6 | ||||
-rw-r--r-- | config/essentials/git/config | 2 | ||||
-rw-r--r-- | config/essentials/shell/functions.sh | 2 | ||||
-rw-r--r-- | config/essentials/zsh/.zshrc | 5 | ||||
-rw-r--r-- | config/essentials/zsh/comp.zsh | 6 | ||||
-rwxr-xr-x | config/extra/qrclip | 29 |
9 files changed, 37 insertions, 49 deletions
diff --git a/bin/common/ytlink b/bin/common/ytlink index 48be9cf..215c164 100755 --- a/bin/common/ytlink +++ b/bin/common/ytlink @@ -2,15 +2,21 @@ # convert to youtube.com/path url # works for: -# - 'youtu.be/watch?v=xxxxxx' +# - 'youtu.be/xxxxxx' # - 'https://piped.video/watch?v=xxxxx' +# - https://youtube.com/watch?v=xxxx -inp="$1" -[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)" +# get from $1 or clipboard if empty +vid="${1:-$(clipo)}" +# The following subsitutions will try to grab the video id # if link is http://127.0.0.1:9010/https://www.youtube.com/watch?v=7KpxsqwNF0o -inp="${inp#*/https://}" +vid="${vid#*/https://}" # remove util scheme -inp="${inp#*//}" -inp="https://youtube.com/${inp#*/}" -printf "%s" "$inp" +vid="${vid#*//}" +# remove domain +vid="${vid#*/}" +# remove query string +vid="${vid#watch?v=}" + +printf "https://youtube.com/watch?v=%s\n" "$vid" diff --git a/bin/extra/qrclip b/bin/extra/qrclip new file mode 100755 index 0000000..f9dc92e --- /dev/null +++ b/bin/extra/qrclip @@ -0,0 +1,12 @@ +#!/bin/sh +case $1 in + '-o') + qrencode -s 16 "$(clipo)" -o - | + imv -w "imv - $(clipo)" - ;; + '-s') + qrencode -s 16 "https://duckduckgo.com/$(clipo)" -o - | + imv -w "imv - search $(clipo)" - ;; + *) + >&2 printf 'qrclip [-s | -o]\n' + exit 1 +esac diff --git a/bin/guiscripts/clipo b/bin/guiscripts/clipo index 078cc13..ebc9a25 100755 --- a/bin/guiscripts/clipo +++ b/bin/guiscripts/clipo @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j="-b" if [ "$WAYLAND_DISPLAY" ] then wl-paste -n "$1" -else xclip -o -selection "${arg:-clipboard}" -r +else xsel -o $j fi diff --git a/bin/guiscripts/clipp b/bin/guiscripts/clipp index c9e4f51..d545087 100755 --- a/bin/guiscripts/clipp +++ b/bin/guiscripts/clipp @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j='-b' if [ "$WAYLAND_DISPLAY" ] -then wl-copy -n $1 -else xclip -selection "${arg:-clipboard}" -r +then wl-copy -n $i +else xsel $j fi diff --git a/config/essentials/git/config b/config/essentials/git/config index ba81b18..99cf21e 100644 --- a/config/essentials/git/config +++ b/config/essentials/git/config @@ -12,3 +12,5 @@ ff = false [alias] change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;}; f " +[commit] + gpgsign = true diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 9f7f4ce..b69b775 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -109,7 +109,7 @@ clip() { then echo -n "$@" | wl-copy else - echo -n "$@" | xclip -selection clipboard -rmlastnl + echo -n "$@" | xsel -b fi } diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 91a1618..545f9cc 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -31,17 +31,12 @@ eval "$(zoxide init zsh)" ### Plugins [ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh" -plug "MichaelAquilina/zsh-you-should-use" plug "chivalryq/git-alias" -plug "kutsan/zsh-system-clipboard" # plug "marlonrichert/zsh-autocomplete" -plug "xPMo/zsh-toggle-command-prefix" plug "zap-zsh/fzf" -plug "zap-zsh/vim" plug "zdharma-continuum/fast-syntax-highlighting" plug "zsh-users/zsh-autosuggestions" plug "zsh-users/zsh-completions" -plug "zsh-users/zsh-history-substring-search" plug "MichaelAquilina/zsh-auto-notify" export AUTO_NOTIFY_TITLE="zsh" diff --git a/config/essentials/zsh/comp.zsh b/config/essentials/zsh/comp.zsh index 4836111..076882d 100644 --- a/config/essentials/zsh/comp.zsh +++ b/config/essentials/zsh/comp.zsh @@ -2,11 +2,10 @@ # Find most of the stuff at https://github.com/zap-zsh/completions zmodload zsh/complist -autoload -Uz compinit; compinit zstyle ':compinstall' filename '/home/aluc/.zshrc' # cache -zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache" +zstyle ':completion:*' use-cache on # completers zstyle ':completion:*' completer _extensions _complete @@ -37,6 +36,9 @@ zstyle ':completion:*' keep-prefix true # ui zstyle ':completion:*' menu select +ZSH_COMPDUMP="$ZDOTDIR"/zcompcache +autoload -Uz compinit; compinit -d "$ZSH_COMPDUMP" + _dotnet_zsh_complete() { local completions=("$(dotnet complete "$words")") diff --git a/config/extra/qrclip b/config/extra/qrclip deleted file mode 100755 index 2f5da5c..0000000 --- a/config/extra/qrclip +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -if [ "$WAYLAND_DISPLAY" ] -then - which wl-copy > /dev/null || exit 1 - clipp () { - wl-copy - } - clipo () { - wl-paste - } -else - which xclip > /dev/null || exit 1 - clipp () { - xclip -selection clipboard -r - } - clipo () { - xclip -o -selection clipboard -r - } -fi - -case $1 in - '-o') - qrencode -s 16 "$(clipo)" -o - | - imv -w "imv - $(clipo)" - ;; - '-s') - qrencode -s 16 "https://duckduckgo.com/$(clipo)" -o - | - imv -w "imv - search $(clipo)" - ;; -esac |