From eebe0cbca5cda5e846b14a1ccc7231863d434d26 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Mon, 7 Nov 2022 09:57:59 +0100 Subject: [PATCH 1/9] [mail] feat: add tags for univ --- .config/notmuch/tags/univ | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .config/notmuch/tags/univ diff --git a/.config/notmuch/tags/univ b/.config/notmuch/tags/univ new file mode 100644 index 0000000..b6d7884 --- /dev/null +++ b/.config/notmuch/tags/univ @@ -0,0 +1,18 @@ +# vim: filetype=none + +# !filters will be applied top to bottom + +# mailbox +#+univ -- path:univ/ + ++teaching/X11I020 -inbox subject:x11i020 ++teaching/X11I040 -inbox subject:x11i040 + ++publications -inbox subject:[hal] ++forge -inbox from:gitlab@univ-nantes.fr + ++velo -inbox subject:[ls2n-velo] ++login -inbox from:login@univ-nantes.fr + ++admin -inbox from:virginie.dupont or from alexiane.brard or from emmanuelle.sale ++thesis -inbox from:benoit.delahaye or from:guillaume.cantin or from:gilles.ardourel From f76d95e482579e43278e930685c9ce1de6ec4a2e Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 20:42:38 +0100 Subject: [PATCH 2/9] [nvim] feat: update packer icons during update --- .config/nvim/lua/plugin/packer.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.config/nvim/lua/plugin/packer.lua b/.config/nvim/lua/plugin/packer.lua index 16cda69..987a6ef 100644 --- a/.config/nvim/lua/plugin/packer.lua +++ b/.config/nvim/lua/plugin/packer.lua @@ -22,12 +22,12 @@ end packer.init({ display = { - working_sym = 'o', -- The symbol for a plugin being installed/updated - error_sym = '', -- The symbol for a plugin with an error in installation/updating - done_sym = '✓', -- The symbol for a plugin which has completed installation/updating - removed_sym = '-', -- The symbol for an unused plugin which was removed - moved_sym = '→', -- The symbol for a plugin which was moved (e.g. from opt to start) - header_sym = '━', -- The symbol for the header line in packer's display + working_sym = ' ', -- The symbol for a plugin being installed/updated + error_sym = ' ', -- The symbol for a plugin with an error in installation/updating + done_sym = ' ', -- The symbol for a plugin which has completed installation/updating + removed_sym = '- ', -- The symbol for an unused plugin which was removed + moved_sym = '→ ', -- The symbol for a plugin which was moved (e.g. from opt to start) + header_sym = '━ ', -- The symbol for the header line in packer's display }, }) From 2e26e7df303ffdbcddabe1b8a13a966e2d272d3f Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 20:52:33 +0100 Subject: [PATCH 3/9] [nvim] fix: call packer *after* downloading it --- .config/nvim/lua/plugin/packer.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/plugin/packer.lua b/.config/nvim/lua/plugin/packer.lua index 987a6ef..f5cf5dd 100644 --- a/.config/nvim/lua/plugin/packer.lua +++ b/.config/nvim/lua/plugin/packer.lua @@ -4,7 +4,6 @@ -- Description : neovim packer config file -local packer = require("packer") local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" if vim.fn.empty(vim.fn.glob(install_path)) > 0 then print("Cloning packer...") @@ -20,6 +19,8 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then print("Done.") end +local packer = require("packer") + packer.init({ display = { working_sym = ' ', -- The symbol for a plugin being installed/updated From 03a7796555df24de0e0e7b683ba4b545746677fc Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 20:53:58 +0100 Subject: [PATCH 4/9] [nvim] fix: change deprecated LSP installer use `mason` instead of `lsp-install` --- .config/nvim/lua/plugin/lsp/init.lua | 14 ++++++++++---- .config/nvim/lua/plugin/packer.lua | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.config/nvim/lua/plugin/lsp/init.lua b/.config/nvim/lua/plugin/lsp/init.lua index 4a22120..274c9b6 100644 --- a/.config/nvim/lua/plugin/lsp/init.lua +++ b/.config/nvim/lua/plugin/lsp/init.lua @@ -5,7 +5,8 @@ local lspconfig = require("lspconfig") -local lsp_installer = require("nvim-lsp-installer") +local mason = require("mason") +local mason_lspconfig = require("mason-lspconfig") local globals = require("globals") local signs = { @@ -58,8 +59,8 @@ local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) local servers = { "clangd", "sumneko_lua", "texlab" } -lsp_installer.setup { - ensure_installed = servers, + +mason.setup({ ui = { icons = { server_installed = "✓", @@ -67,7 +68,12 @@ lsp_installer.setup { server_uninstalled = "" } } -} +}) + +mason_lspconfig.setup({ + ensure_installed = servers, +}) + for _, server in ipairs(servers) do local opts = { diff --git a/.config/nvim/lua/plugin/packer.lua b/.config/nvim/lua/plugin/packer.lua index f5cf5dd..b1afd3b 100644 --- a/.config/nvim/lua/plugin/packer.lua +++ b/.config/nvim/lua/plugin/packer.lua @@ -69,7 +69,8 @@ return require("packer").startup(function() use { "neovim/nvim-lspconfig", requires = { - "williamboman/nvim-lsp-installer", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", }, config = function() require("plugin.lsp") end } From 7ab5d2909b944eaa154378f20a3ef57ebc9af1cb Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 20:57:44 +0100 Subject: [PATCH 5/9] [status] feat: add sb-cpu --- .local/bin/statusbar/sb-cpu | 37 +++++++++++++++++++++++++++++++++++++ .local/src/dwmblocks | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 .local/bin/statusbar/sb-cpu diff --git a/.local/bin/statusbar/sb-cpu b/.local/bin/statusbar/sb-cpu new file mode 100755 index 0000000..7648df1 --- /dev/null +++ b/.local/bin/statusbar/sb-cpu @@ -0,0 +1,37 @@ +#!/usr/bin/env sh + +# Module showing CPU load as a changing bars. +# Just like in polybar. +# Each bar represents amount of load on one core since +# last run. + +# Cache in tmpfs to improve speed and reduce SSD load +cache=/tmp/cpubarscache + +# id total idle +stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) +[ ! -f $cache ] && echo "$stats" > "$cache" +old=$(cat "$cache") +printf " %s " " " +echo "$stats" | while read -r row; do + id=${row%% *} + rest=${row#* } + total=${rest%% *} + idle=${rest##* } + + case "$(echo "$old" | awk '{if ($1 == id) + printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ + id="$id" total="$total" idle="$idle")" in + + "0") printf "▁";; + "1") printf "▂";; + "2") printf "▃";; + "3") printf "▄";; + "4") printf "▅";; + "5") printf "▆";; + "6") printf "▇";; + "7") printf "█";; + "8") printf "█";; + esac +done; printf " \\n" +echo "$stats" > "$cache" diff --git a/.local/src/dwmblocks b/.local/src/dwmblocks index b78f4dc..5c9090a 160000 --- a/.local/src/dwmblocks +++ b/.local/src/dwmblocks @@ -1 +1 @@ -Subproject commit b78f4dc620d0ab9eb6e70eace07263b2c1f9a66c +Subproject commit 5c9090ae551a08e13201b92d63bcff8110264f23 From f062d118c2221302d0459978be70a3e456578818 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 20:59:41 +0100 Subject: [PATCH 6/9] [scripts] feat: gentoo is the default distro --- .config/pacman/hooks/cache_cleanup.hook | 12 --- .config/pacman/hooks/dashbinsh.hook | 11 --- .config/pacman/hooks/pkglist.hook | 10 --- .config/paru/paru.conf | 29 ------- .config/paru/pkglist.txt | 110 ------------------------ .local/bin/fetch | 35 ++++---- 6 files changed, 18 insertions(+), 189 deletions(-) delete mode 100644 .config/pacman/hooks/cache_cleanup.hook delete mode 100644 .config/pacman/hooks/dashbinsh.hook delete mode 100644 .config/pacman/hooks/pkglist.hook delete mode 100644 .config/paru/paru.conf delete mode 100644 .config/paru/pkglist.txt diff --git a/.config/pacman/hooks/cache_cleanup.hook b/.config/pacman/hooks/cache_cleanup.hook deleted file mode 100644 index 358f02f..0000000 --- a/.config/pacman/hooks/cache_cleanup.hook +++ /dev/null @@ -1,12 +0,0 @@ -[Trigger] -Operation = Remove -Operation = Install -Operation = Upgrade -Type = Package -Target = * - -[Action] -Description = Keep the last cache and the currently installed... -Depends = pacman-contrib -When = PostTransaction -Exec = /usr/bin/paccache -rvk2 diff --git a/.config/pacman/hooks/dashbinsh.hook b/.config/pacman/hooks/dashbinsh.hook deleted file mode 100644 index ed08b69..0000000 --- a/.config/pacman/hooks/dashbinsh.hook +++ /dev/null @@ -1,11 +0,0 @@ -[Trigger] -Type = Package -Operation = Install -Operation = Upgrade -Target = bash - -[Action] -Description = Re-pointing /bin/sh symlink to dash... -When = PostTransaction -Exec = /usr/bin/ln -sfT dash /usr/bin/sh -Depends = dash diff --git a/.config/pacman/hooks/pkglist.hook b/.config/pacman/hooks/pkglist.hook deleted file mode 100644 index a24d05a..0000000 --- a/.config/pacman/hooks/pkglist.hook +++ /dev/null @@ -1,10 +0,0 @@ -[Trigger] -Operation = Remove -Operation = Install -Type = Package -Target = * - -[Action] -Description = Update the pkglist... -When = PostTransaction -Exec = /bin/sh -c '/usr/bin/pacman -Qqe > /home/swytch/.config/paru/pkglist.txt' diff --git a/.config/paru/paru.conf b/.config/paru/paru.conf deleted file mode 100644 index fea7ea6..0000000 --- a/.config/paru/paru.conf +++ /dev/null @@ -1,29 +0,0 @@ -# -# $PARU_CONF -# /etc/paru.conf -# ~/.config/paru/paru.conf -# -# See the paru.conf(5) manpage for options - -# -# GENERAL OPTIONS -# -[options] -PgpFetch -Devel -Provides -DevelSuffixes = -git -cvs -svn -bzr -darcs -always -BottomUp -RemoveMake -SudoLoop -#UseAsk -#CombinedUpgrade -#CleanAfter -#UpgradeMenu -NewsOnUpgrade - -# -# Binary OPTIONS -# -#[bin] -#FileManager = vifm diff --git a/.config/paru/pkglist.txt b/.config/paru/pkglist.txt deleted file mode 100644 index 136a578..0000000 --- a/.config/paru/pkglist.txt +++ /dev/null @@ -1,110 +0,0 @@ -abcde -abook -adobe-source-han-sans-cn-fonts -adobe-source-han-sans-jp-fonts -alsa-plugins -alsa-utils -android-tools -android-udev -arandr -autoconf -automake -autorandr -base -beets -binutils -bison -capitaine-cursors -cdparanoia -clang -cmake -cronie -dash -dunst -efibootmgr -fakeroot -file -findutils -firefox -flex -gawk -gcc -gettext -git -grep -groff -grub -gsasl -gzip -htop -imagemagick -isync -iwd -jedi-language-server -libnotify -libtool -linux -linux-firmware -linux-lts -lynx -m4 -make -man-db -mpc -mpd -mpv -msmtp -ncmpcpp -neomutt -ninja -nnn -notmuch -pacman -pacman-contrib -pam-gnupg -paru -pass -patch -pkgconf -pulseaudio-alsa -pulsemixer -python-eyed3 -python-requests -redshift -sed -shotgun -sox -sudo -sxhkd -sxiv -texinfo -texlab -texlive-bibtexextra -texlive-core -texlive-latexextra -transmission-cli -tree-sitter -tremc -ttf-dejavu -ttf-fira-sans -ttf-iosevka-fixed-slab -ttf-nerd-fonts-symbols-mono -unzip -upower -usbutils -which -xcape -xclip -xf86-video-intel -xorg-server -xorg-xinit -xorg-xinput -xorg-xsetroot -xss-lock -xwallpaper -zathura -zathura-pdf-mupdf -zip -zsh -zsh-history-substring-search -zsh-syntax-highlighting diff --git a/.local/bin/fetch b/.local/bin/fetch index 254c08b..487a8ab 100755 --- a/.local/bin/fetch +++ b/.local/bin/fetch @@ -13,11 +13,12 @@ ## INFO # $USER is already defined -host="$(cat /etc/hostname)" -os='Arch Linux' +host="$(cat /etc/conf.d/hostname | awk -F'"' '{ printf $2 }')" +cpu="$(grep "name" /proc/cpuinfo | uniq | sed -e 's/.*: //' -e 's/ .-Core.*//')" +os="Gentoo" kernel="$(uname -sr)" uptime="$(uptime -p | sed 's/up //')" -packages="$(pacman -Q | wc -l)" +packages="$(printf '%s\n' /var/db/pkg/*/* | wc -l)" shell="$($SHELL --version | sed -e 's/(.*)//')" wm="$(tail -n 1 "$XDG_CONFIG_HOME/X11/xinitrc" | rev | cut -d ' ' -f 1 | rev)" @@ -61,20 +62,20 @@ if [ -x "$(command -v tput)" ]; then fi # you can change these -lc="${bold}${green}" # labels -nc="${bold}${red}" # user and hostname -ic="${white}" # info -a0="${blue}" # first arch color -a1="${cyan}" # second arch color +lc="${bold}${magenta}" # labels +nc="${bold}${magenta}" # user and hostname +ic="${reset}${white}" # info +a0="${reset}${magenta}" # first gentoo color +a1="${reset}${white}" # second logo color cat < Date: Thu, 10 Nov 2022 21:12:02 +0100 Subject: [PATCH 7/9] [zsh] fix: set envvars in .zprofile --- .config/zsh/.zprofile | 11 ++++++++++- .zshenv | 12 ------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index e4e030c..a0783b6 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -1,6 +1,8 @@ #!/bin/zsh # This file is sourced when launching a DM from startx/xinit +# path +export PATH="$(find $HOME/.local/bin -type d | tr '\n' ':' | sed 's/:$//'):$PATH" # environment variables ## custom paths @@ -31,7 +33,7 @@ export SUDO_EDITOR="nvim" export EDITOR="nvim" export TERMINAL="st" export READER="zathura" -export BROWSER="firefox" +export BROWSER="firefox-bin" export IRC_CLIENT="irssi" export MAIL_CLIENT="neomutt" export MUSIC_CLIENT="ncmpcpp" @@ -39,3 +41,10 @@ export MUSIC_CLIENT="ncmpcpp" ## misc export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java +export LESS_TERMCAP_md="$(printf '%b' '\e[01;32m')" +export LESS_TERMCAP_me="$(printf '%b' '\e[0m')" +export LESS_TERMCAP_se="$(printf '%b' '\e[0m')" +export LESS_TERMCAP_so="$(printf '%b' '\e[01;44;33em')" +export LESS_TERMCAP_ue="$(printf '%b' '\e[0m')" +export LESS_TERMCAP_us="$(printf '%b' '\e[01;35m')" +export LS_COLORS='rs=0:di=01;34:ln=01;35:mh=00:pi=40;35:so=01;33:do=01;33:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=00;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;33:*.jpeg=01;33:*.mjpg=01;33:*.mjpeg=01;33:*.gif=01;33:*.bmp=01;33:*.pbm=01;33:*.pgm=01;33:*.ppm=01;33:*.tga=01;33:*.xbm=01;33:*.xpm=01;33:*.tif=01;33:*.tiff=01;33:*.png=01;33:*.svg=01;33:*.svgz=01;33:*.mng=01;33:*.pcx=01;33:*.mov=01;33:*.mpg=01;33:*.mpeg=01;33:*.m2v=01;33:*.mkv=01;33:*.webm=01;33:*.ogm=01;33:*.mp4=01;33:*.m4v=01;33:*.mp4v=01;33:*.vob=01;33:*.qt=01;33:*.nuv=01;33:*.wmv=01;33:*.asf=01;33:*.rm=01;33:*.rmvb=01;33:*.flc=01;33:*.avi=01;33:*.fli=01;33:*.flv=01;33:*.gl=01;33:*.dl=01;33:*.xcf=01;33:*.xwd=01;33:*.yuv=01;33:*.cgm=01;33:*.emf=01;33:*.ogv=01;33:*.ogx=01;33:*.aac=01;33:*.au=01;33:*.flac=01;33:*.m4a=01;33:*.mid=01;33:*.midi=01;33:*.mka=01;33:*.mp3=01;33:*.mpc=01;33:*.ogg=01;33:*.ra=01;33:*.wav=01;33:*.oga=01;33:*.opus=01;33:*.spx=01;33:*.xspf=01;33:'; diff --git a/.zshenv b/.zshenv index ba8353c..717a84d 100644 --- a/.zshenv +++ b/.zshenv @@ -7,15 +7,3 @@ export XDG_DATA_HOME="$HOME/.local/share" export XDG_STATE_HOME="$HOME/.local/state" export ZDOTDIR="$HOME/.config/zsh" - -## paths -export PATH="$(find $HOME/.local/bin -type d | tr '\n' ':' | sed 's/:$//'):$PATH" - -## misc -export LESS_TERMCAP_md="$(printf '%b' '\e[01;32m')" -export LESS_TERMCAP_me="$(printf '%b' '\e[0m')" -export LESS_TERMCAP_se="$(printf '%b' '\e[0m')" -export LESS_TERMCAP_so="$(printf '%b' '\e[01;44;33em')" -export LESS_TERMCAP_ue="$(printf '%b' '\e[0m')" -export LESS_TERMCAP_us="$(printf '%b' '\e[01;35m')" -export LS_COLORS='rs=0:di=01;34:ln=01;35:mh=00:pi=40;35:so=01;33:do=01;33:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=00;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;33:*.jpeg=01;33:*.mjpg=01;33:*.mjpeg=01;33:*.gif=01;33:*.bmp=01;33:*.pbm=01;33:*.pgm=01;33:*.ppm=01;33:*.tga=01;33:*.xbm=01;33:*.xpm=01;33:*.tif=01;33:*.tiff=01;33:*.png=01;33:*.svg=01;33:*.svgz=01;33:*.mng=01;33:*.pcx=01;33:*.mov=01;33:*.mpg=01;33:*.mpeg=01;33:*.m2v=01;33:*.mkv=01;33:*.webm=01;33:*.ogm=01;33:*.mp4=01;33:*.m4v=01;33:*.mp4v=01;33:*.vob=01;33:*.qt=01;33:*.nuv=01;33:*.wmv=01;33:*.asf=01;33:*.rm=01;33:*.rmvb=01;33:*.flc=01;33:*.avi=01;33:*.fli=01;33:*.flv=01;33:*.gl=01;33:*.dl=01;33:*.xcf=01;33:*.xwd=01;33:*.yuv=01;33:*.cgm=01;33:*.emf=01;33:*.ogv=01;33:*.ogx=01;33:*.aac=01;33:*.au=01;33:*.flac=01;33:*.m4a=01;33:*.mid=01;33:*.midi=01;33:*.mka=01;33:*.mp3=01;33:*.mpc=01;33:*.ogg=01;33:*.ra=01;33:*.wav=01;33:*.oga=01;33:*.opus=01;33:*.spx=01;33:*.xspf=01;33:'; From fff5fa44562ddb05625b2f03e9ba5ee4b6a66bd7 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 21:14:02 +0100 Subject: [PATCH 8/9] [gnupg] feat: update config keep agent alive for 1 week -> 1 day chaneg default pinentry to GTK3 --- .config/gnupg/gpg-agent.conf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.config/gnupg/gpg-agent.conf b/.config/gnupg/gpg-agent.conf index 949b2b2..3cda906 100644 --- a/.config/gnupg/gpg-agent.conf +++ b/.config/gnupg/gpg-agent.conf @@ -1,5 +1,4 @@ -allow-preset-passphrase -default-cache-ttl 604800 -max-cache-ttl 604800 +default-cache-ttl 86400 +max-cache-ttl 86400 -pinentry-program /usr/bin/pinentry-gtk-2 +pinentry-program /usr/bin/pinentry-gnome3 From 618f657d4b9c73092873b70c3fb4c8e8dc97570d Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 21:15:10 +0100 Subject: [PATCH 9/9] [scripts] feat: convert audio files to ogg --- .local/bin/oggconv | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 .local/bin/oggconv diff --git a/.local/bin/oggconv b/.local/bin/oggconv new file mode 100755 index 0000000..56f74fc --- /dev/null +++ b/.local/bin/oggconv @@ -0,0 +1,23 @@ +#!/usr/bin/env sh + +# Author: Simon Legner + +convert () { + ffmpeg -i "$in" \ + -acodec libvorbis -aq 6 -vn -ac 2 \ + -map_metadata 0 \ + "$out" +} + +if [ "" = "$1" ]; then + echo Converts audio files to Ogg Vorbis using ffmpeg. + echo Usage: $0 file1.ext1 file2.ext2 ... fileN.ext4 + echo ... produces file1.ogg file2.ogg ... fileN.ogg +fi + +for i in "$@"; do + in="$1" + ext="$(basename "$in" | sed -e 's/.*\.//')" + out="${in%.$ext}.ogg" + convert +done