diff options
author | Ratakor <ratakor@disroot.org> | 2023-06-30 15:57:49 +0200 |
---|---|---|
committer | Ratakor <ratakor@disroot.org> | 2023-06-30 15:57:49 +0200 |
commit | c59e9a4dbbbe7269888806a3e72ce654fb8ead04 (patch) | |
tree | 467a163da85fc69ac10916e9540691860743969d | |
parent | d825cc17dfca37ad67a9c7d3e5c41b940aa03c1c (diff) |
Improve plumber and other changes
Remove headers.
Change some sxhkd bindings.
Fix music's ytdl-format.
Make musiccmd notification prettier by using music title instead of it's
path/url.
-rwxr-xr-x | .local/bin/dmenusearch | 15 | ||||
-rwxr-xr-x | .local/bin/music | 2 | ||||
-rwxr-xr-x | .local/bin/musiccmd | 39 | ||||
-rw-r--r--[-rwxr-xr-x] | .local/bin/plumber | 53 | ||||
-rwxr-xr-x | .local/bin/ytdl | 15 | ||||
-rw-r--r-- | .local/etc/nvim/basics.vim | 7 | ||||
-rw-r--r-- | .local/etc/nvim/init.vim | 1 | ||||
-rw-r--r-- | .local/etc/sxhkd/sxhkdrc | 19 | ||||
-rw-r--r-- | .local/share/packages | 6 |
9 files changed, 79 insertions, 78 deletions
diff --git a/.local/bin/dmenusearch b/.local/bin/dmenusearch index abdb6cf..d779198 100755 --- a/.local/bin/dmenusearch +++ b/.local/bin/dmenusearch @@ -1,17 +1,6 @@ #!/bin/sh -# . :-. . -# author: ratakor <ratakor@disroot.org> :*==*%%%#%+=---: -# :#%%%*+%#=+%*:. -# created: Fri, 12 May 2023 07:58:58 +0200 :%%%. . -*%- -# updated: Fri, 19 May 2023 17:06:26 +0200 =## . :#%*=:. -# -#*#%:=#%%%#- -# description: *:*%%%%%%%#- -# search web, parabola/arch wiki, aur youtube, .-#%%%%%%+ -# man pages or emoji with dmenu %%%--%%%%*- -# ##%= +%%=:.. -# #* #%# -# :# -==* -# :: .: +# search web, parabola/arch wiki, AUR, youtube, man pages or emoji with dmenu + # websearch dependencies : shuf, curl, /tmp needs to be temporary # wiki dependency: parabola-wiki-docs (can be used with arch-wiki-docs) # youtube dependency: ytfzf diff --git a/.local/bin/music b/.local/bin/music index f78790d..6a68f88 100755 --- a/.local/bin/music +++ b/.local/bin/music @@ -37,4 +37,4 @@ fi printf 'stop\n' | socat - /tmp/mpvsocket 2> /dev/null mpv --vid=no --input-ipc-server=/tmp/mpvsocket --loop-playlist\ - --ytdl-format="wv*+ba" --script="$SCRIPT" --shuffle="$SHUFFLE" "$MUSIC" + --ytdl-format=ba --script="$SCRIPT" --shuffle="$SHUFFLE" "$MUSIC" diff --git a/.local/bin/musiccmd b/.local/bin/musiccmd index f45f709..b5f25d3 100755 --- a/.local/bin/musiccmd +++ b/.local/bin/musiccmd @@ -9,28 +9,35 @@ CACHE="${XDG_CACHE_HOME:-$HOME/.cache}" IMG="nsxiv" getpath() { - tmp="$(printf '{ "command": ["get_property", "path"] }\n'\ - | socat - /tmp/mpvsocket)" - tmp="${tmp#{\"data\":\"}" - path="${tmp%\",\"request_id\":0,\"error\":\"success\"\}}" + tmp=$(printf '{ "command": ["get_property", "path"] }\n'\ + | socat - /tmp/mpvsocket) + tmp=${tmp#{\"data\":\"} + path=${tmp%\",\"request_id\":0,\"error\":\"success\"\}} +} + +gettitle() { + tmp=$(printf '{ "command": ["get_property", "media-title"] }\n'\ + | socat - /tmp/mpvsocket) + tmp=${tmp##{\"data\":\"} + title=${tmp%\",\"request_id\":0,\"error\":\"success\"\}} } getvol() { - tmp="$(printf '{ "command": ["get_property", "volume"] }\n'\ - | socat - /tmp/mpvsocket)" - tmp="${tmp#{\"data\":}" + tmp=$(printf '{ "command": ["get_property", "volume"] }\n'\ + | socat - /tmp/mpvsocket) + tmp=${tmp#{\"data\":} printf '%s\n' "${tmp%.000000,\"request_id\":0,\"error\":\"success\"\}}" } download() { mkdir -p "$1" - notify-send "Downloading '$path' to '$1'" + notify-send "Downloading '$title' to '$1'" if yt-dlp -f "ba" -x --embed-thumbnail --audio-format mp3\ -o"%(title)s [%(id)s].%(ext)s" -P "$1" "$path"; then - notify-send "'$path' successfuly downloaded to '$2'" + notify-send "'$title' successfuly downloaded to '$1'" return 0 else - notify-send "Error: '$path' couldn't be downloaded" + notify-send "Error: '$title' couldn't be downloaded" return 1 fi } @@ -42,10 +49,10 @@ addtofav() { *) mkdir -p "$FAVDIR" if cp "$path" "$FAVDIR"; then - notify-send "'$path' was copied to '$FAVDIR'" + notify-send "'$title' was copied to '$FAVDIR'" return 0 else - notify-send "'$path' couldn't be copied to '$FAVDIR'" + notify-send "'$title' couldn't be copied to '$FAVDIR'" return 1 fi ;; esac @@ -68,8 +75,7 @@ main() { if ! pgrep -x music >/dev/null; then kill -35 "$(pidof dwmblocks)" herbe "Error: There is no music playing"\ - "Do you want to play some ?" && - music + "Do you want to play some ?" && music return 1 fi @@ -93,9 +99,11 @@ main() { kill -35 "$(pidof dwmblocks)" ;; *favorite|fav) getpath + gettitle addtofav ;; *download) getpath + gettitle download "$DLDIR" ;; *thumbnail) getpath @@ -108,6 +116,9 @@ main() { path) getpath printf '%s\n' "$path" ;; + title) + gettitle + printf '%s\n' "$title" ;; vol) getvol ;; esac diff --git a/.local/bin/plumber b/.local/bin/plumber index 905e287..c29b8e4 100755..100644 --- a/.local/bin/plumber +++ b/.local/bin/plumber @@ -1,17 +1,12 @@ #!/bin/sh -# . :-. . -# author: ratakor <ratakor@disroot.org> :*==*%%%#%+=---: -# :#%%%*+%#=+%*:. -# created: Sat, 13 May 2023 13:06:54 +0200 :%%%. . -*%- -# updated: Fri, 19 May 2023 00:54:45 +0200 =## . :#%*=:. -# -#*#%:=#%%%#- -# description: plumber 🪠*:*%%%%%%%#- -# .-#%%%%%%+ -# dependencies: %%%--%%%%*- -# - default programs ##%= +%%=:.. -# - xdo #* #%# -# - xclip or xsel :# -==* -# - (optional) herbe and dmenusearch web :: .: +# Copywrong © 2023 Ratakor. Under ISC License. +# plumber 🪠+# dependencies: +# - default programs +# - xdo +# - xclip or xsel +# - (optional) herbe and dmenusearch web +# - (optional) dmenu_path # shellcheck disable=SC2086 # default programs @@ -22,13 +17,13 @@ AUDIO="music --shuffle" PIC="nsxiv -a" DOC="zathura" DIR="$TERMINAL -e lfub" -CD="st -d" openlink() { case "$1" in - *.mkv|*.webm|*.mp4|*.mov|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*inv*/playlist*|*inv*/watch*) + *.mkv|*.webm|*.mp4|*.mov|*youtube.com/watch*|*youtube.com/playlist*|\ + *youtube.com/shorts*|*youtu.be*|*inv*/playlist*|*inv*/watch*) setsid -f $VIDEO "$1" >/dev/null 2>&1 ;; - *.mp3|*.flac|*.opus|*mp3?source*|*.ogg|*.wav) + *.mp3|*.flac|*.opus|*mp3?source*|*.ogg|*.wav|*soundcloud.com*) setsid -f $AUDIO "$1" >/dev/null 2>&1 ;; *.png|*.jpg|*.jpeg|*.gif|*.webp) file=$(printf '%s' "$1" | sed "s/.*\///;s/%20/ /g") @@ -39,10 +34,11 @@ openlink() { curl -sL "$1" > "/tmp/$file" && $DOC "/tmp/$file" >/dev/null 2>&1 & ;; *wp.com/stonetoss.com*) - file=$(printf '%s' "$1" | sed "s/.*\///;s/%20/ /g") + file=$(printf '%s' "${1%"?resize=150%2C150&ssl=1"}" |\ + sed "s/.*\///;s/%20/ /g") curl -sL "${1%"?resize=150%2C150&ssl=1"}" > "/tmp/$file" && $PIC "/tmp/$file" >/dev/null 2>&1 & ;; - git://*|"git clone"*|*.git|git@*) + git://*|git@*|*.git) "$TERMINAL" -e git clone "$1" ;; *) setsid -f $WEB "$1" >/dev/null 2>&1 ;; @@ -76,13 +72,14 @@ openfile() { checksel() { case "$1" in - http://*|https://*|git://*|irc://*|ircs://*|"git clone"*|git@*|*.git) + http://*|https://*|irc://*|ircs://*|git://*|git@*) openlink "$1" ;; /*) opensel "$1" "$1" ;; *) - pid=$(pstree -lpA "$(xdo pid)" | tail -n 1 | awk -F '---' '{print $NF}' | sed -re 's/[^0-9]//g') + pid=$(pstree -lpA "$(xdo pid)" | tail -n 1 |\ + awk -F '---' '{print $NF}' | sed -re 's/[^0-9]//g') opensel "$(readlink "/proc/$pid/cwd")/$1" "$1" ;; esac } @@ -94,15 +91,22 @@ opensel() { setsid -f $AUDIO "$1" >/dev/null 2>&1 ;; *) xdo kill - $CD "$1" ;; + $TERMINAL -e sh -c "cd $1; $SHELL" ;; esac return fi if [ ! -f "$1" ]; then - # "$TERMINAL" -e $1 # idk how to make st not exiting with -e - herbe "Do you want to search for '$2' ?" && - dmenusearch web "$2" + progname=${2%\ *} + for prog in $(dmenu_path); do + case $prog in + "$progname") + $TERMINAL -e sh -c\ + "cd ${1%"$2"}; echo \$ $2; $2; $SHELL" + return ;; + esac + done + herbe "Do you want to search for '$2' ?" && dmenusearch web "$2" return fi @@ -143,7 +147,6 @@ Config: picture = $PIC document = $DOC file manager = $DIR - cd = $CD EOF } diff --git a/.local/bin/ytdl b/.local/bin/ytdl index 3e22447..aea1e64 100755 --- a/.local/bin/ytdl +++ b/.local/bin/ytdl @@ -1,17 +1,6 @@ #!/bin/sh -# . :-. . -# author: ratakor <ratakor@disroot.org> :*==*%%%#%+=---: -# :#%%%*+%#=+%*:. -# created: Mon, 15 May 2023 21:13:44 +0200 :%%%. . -*%- -# updated: Tue, 16 May 2023 23:55:02 +0200 =## . :#%*=:. -# -#*#%:=#%%%#- -# description: *:*%%%%%%%#- -# wrapper for yt-dlp with notification support .-#%%%%%%+ -# %%%--%%%%*- -# ##%= +%%=:.. -# #* #%# -# :# -==* -# shellcheck disable=SC2015 # :: .: +# wrapper for yt-dlp with notification support +# shellcheck disable=SC2015 TYPE=$1 if [ -d "$2" ]; then diff --git a/.local/etc/nvim/basics.vim b/.local/etc/nvim/basics.vim index 0cf5aa9..11ce16d 100644 --- a/.local/etc/nvim/basics.vim +++ b/.local/etc/nvim/basics.vim @@ -8,8 +8,6 @@ set softtabstop=8 " n of whitespace to delete with backspace " Disable the mouse, btw use shift for highlighting "set mouse= -map <Middlemouse> <Nop> -imap <Middlemouse> <Nop> aunmenu PopUp " better <C-d> and <C-u> @@ -29,10 +27,13 @@ set clipboard+=unnamedplus "set lcs=tab:\|\ ,space:⋅,eol:$ "↴ autocmd FileType * setl fo-=ro fo+=tc abbreviate hte the +nnoremap :Q<CR> :q<CR> +nnoremap :Q!<CR> :q!<CR> " Language specific autocmd FileType python setl ts=4 sw=4 sts=4 expandtab autocmd FileType lisp,html setl ts=2 sw=2 sts=2 expandtab autocmd FileType html,markdown setl spell autocmd FileType tex setl spell spl=fr -autocmd BufWritePost *.c silent! !astyle -A3 -t8 -p -xg -H -xB -n %:p +autocmd BufWritePost *.c silent! !astyle -A3 -t8 -p -xg -H -xB -n -w %:p +command Astyle !astyle -A3 -t8 -p -xg -H -xB -n -w %:p diff --git a/.local/etc/nvim/init.vim b/.local/etc/nvim/init.vim index 181b9ed..a63e664 100644 --- a/.local/etc/nvim/init.vim +++ b/.local/etc/nvim/init.vim @@ -60,6 +60,7 @@ nnoremap <C-G> :Telescope git_files<CR> " NerdTree config nnoremap <F2> :NERDTreeToggle<CR> +autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif " Undotree config nnoremap <F3> :UndotreeToggle<CR> diff --git a/.local/etc/sxhkd/sxhkdrc b/.local/etc/sxhkd/sxhkdrc index 9739250..2badbc8 100644 --- a/.local/etc/sxhkd/sxhkdrc +++ b/.local/etc/sxhkd/sxhkdrc @@ -2,7 +2,7 @@ super + Escape kill -10 $(pidof sxhkd) {super + Return,button8) $TERMINAL -{super + d,button10} +super + d dmenu_run -hp "browser,mail" XF86ScreenSaver slock & xset dpms force off @@ -22,15 +22,20 @@ XF86Launch1 wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -44 $(pidof dwmblocks) F6 wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle; kill -45 $(pidof dwmblocks) -{F7,super + b} - $TERMINAL -e {dmenurecord,newsboat} -super + {n,shift + n} - st -d "$XDG_DATA_HOME/notes" {-e lfub, } +F7 + $TERMINAL -e dmenurecord +super + b + $BROWSER +super + n + $TERMINAL -e sh -c 'cd "$XDG_DATA_HOME/notes"; lfub' +super + shift + n + $TERMINAL -e newsboat super + {m,shift + m} {music,musiccmd} -#super + shift + {Left, Right, Down, Up} XF86Audio{Prev,Next,Play,Stop} musiccmd {prev,next,cycle,stop} +super + shift + {Left, Right, Down, Up} + musiccmd {prev,next,cycle,stop} super + {s,a,y,w,e} dmenusearch {web,aur,youtube,man,emoji} super + shift + w @@ -41,3 +46,5 @@ super + u plumber --sel button9 xdo kill +button10 + musiccmd diff --git a/.local/share/packages b/.local/share/packages index 6796d44..6e8cc4f 100644 --- a/.local/share/packages +++ b/.local/share/packages @@ -29,7 +29,7 @@ randhost # set a random hostname (OpenRC service) blocktooth # block bluetooth with rfkill (OpenRC service) networkmanager-hardened # set a randomized MAC address + disable co test quand # a calendar app like when -clangbincc # a pacman hook to symlink clang to cc when there is a gcc update +#clangbincc # a pacman hook to symlink clang to cc when there is a gcc update pinentry-dmenu # use dmenu for gpg ratakor-repo/dragon # a simple drag-and-drop replacement for graphical stuff ratakor-repo/your-privacy # your-privacy but without NM as it's in another pkg @@ -69,7 +69,7 @@ fd # find replacement gitui # tui for git (good if you don't remember what change you made) ## dev -#texlive-most # LaTeX (big package) +#texlive # LaTeX (big package) #pandoc-cli # I only use that to convert markdown to latex to pdf (big package) #dotnet-sdk # C# for lsp do dotnet tool install -g csharp-ls rustup # rust @@ -89,6 +89,7 @@ vscode-css-languageserver vscode-html-languageserver astyle # C formatter shellcheck +mingw-w64-gcc ## sound rtkit @@ -147,5 +148,4 @@ hunspell-fr python-axolotl # gajim dependency python-gnupg # gajim dependency git-lfs -xorg-xsetroot # to restart dwm with command line xdo # window manipulation |