This commit is contained in:
Victor Lalle 2023-06-04 15:00:13 +02:00
commit 30e94a06db
52 changed files with 3995 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
chromium/Variations

27
dunst/dunstrc Normal file
View File

@ -0,0 +1,27 @@
[global]
monitor = 0
follow = keyboard
width = 370
height = 350
offset = 0x19
padding = 2
horizontal_padding = 2
transparency = 25
font = Monospace 12
format = "<b>%s</b>\n%b"
[urgency_low]
background = "#1d2021"
foreground = "#928374"
timeout = 3
[urgency_normal]
foreground = "#ebdbb2"
background = "#458588"
timeout = 5
[urgency_critical]
background = "#1cc24d"
foreground = "#ebdbb2"
frame_color = "#fabd2f"
timeout = 10

47
firefox/larbs.js Normal file
View File

@ -0,0 +1,47 @@
// These are changes made on top of the Arkenfox JS file to tweak it as
// desired. Any of these settings can be overridden by the user.
// Disable the Twitter/R*ddit/Faceberg ads in the URL bar:
user_pref("browser.urlbar.quicksuggest.enabled", false);
user_pref("browser.urlbar.suggest.topsites", false); // [FF78+]
// Do not suggest web history in the URL bar:
user_pref("browser.urlbar.suggest.history", false);
// Do not prefil forms:
user_pref("signon.prefillForms", false);
// Do not autocomplete in the URL bar:
user_pref("browser.urlbar.autoFill", false);
// Enable the addition of search keywords:
user_pref("keyword.enabled", true);
// Allow access to http (i.e. not https) sites:
user_pref("dom.security.https_only_mode", false);
// Keep cookies until expiration or user deletion:
user_pref("network.cookie.lifetimePolicy", 0);
user_pref("dom.webnotifications.serviceworker.enabled", false);
// Disable push notifications:
user_pref("dom.push.enabled", false);
// Disable the pocket antifeature:
user_pref("extensions.pocket.enabled", false);
// Don't autodelete cookies on shutdown:
user_pref("privacy.clearOnShutdown.cookies", false);
// Enable custom userChrome.js:
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
// This could otherwise cause some issues on bank logins and other annoying sites:
user_pref("network.http.referer.XOriginPolicy", 0);
// Disable Firefox sync and its menu entries
user_pref("identity.fxaccounts.enabled", false);
// Fix the issue where right mouse button instantly clicks
user_pref("ui.context_menus.after_mouseup", true);

40
fontconfig/fonts.conf Executable file
View File

@ -0,0 +1,40 @@
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>Linux Libertine</family>
<family>Joy Pixels</family>
<family>Noto Color Emoji</family>
<family>FontAwesome</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Linux Biolinum</family>
<family>Joy Pixels</family>
<family>Noto Color Emoji</family>
<family>FontAwesome</family>
</prefer>
</alias>
<alias>
<family>sans</family>
<prefer>
<family>Linux Biolinum</family>
<family>Joy Pixels</family>
<family>Noto Color Emoji</family>
<family>FontAwesome</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Sans Mono</family>
<family>Liberation Mono</family>
<family>FontAwesome</family>
<family>Braille</family>
</prefer>
</alias>
</fontconfig>

19
gtk-2.0/gtkrc-2.0 Normal file
View File

@ -0,0 +1,19 @@
# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
include "~/.gtkrc-2.0.mine"
gtk-theme-name="Arc-Gruvbox"
gtk-icon-theme-name="Adwaita"
gtk-font-name="Sans 10"
gtk-cursor-theme-name="Adwaita"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintfull"
gtk-xft-rgba="rgb"

2
gtk-3.0/bookmarks Normal file
View File

@ -0,0 +1,2 @@
file:///home/victor/pix/memes
file:///home/victor/gits/stable-diffusion-webui/models

16
gtk-3.0/settings.ini Normal file
View File

@ -0,0 +1,16 @@
[Settings]
gtk-theme-name=Arc-Gruvbox
gtk-icon-theme-name=Adwaita
gtk-font-name=Sans 10
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb
gtk-cursor-theme-name=Adwaita

4
lf/cleaner Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
if [ -n "$FIFO_UEBERZUG" ]; then
printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
fi

77
lf/icons Normal file
View File

@ -0,0 +1,77 @@
di 📁
fi 📃
tw 🤝
ow 📂
ln ⛓
or ❌
ex 🎯
*.txt ✍
*.mom ✍
*.me ✍
*.ms ✍
*.avif 🖼
*.png 🖼
*.webp 🖼
*.ico 🖼
*.jpg 📸
*.jpe 📸
*.jpeg 📸
*.gif 🖼
*.svg 🗺
*.tif 🖼
*.tiff 🖼
*.xcf 🖌
*.html 🌎
*.xml 📰
*.gpg 🔒
*.css 🎨
*.pdf 📚
*.djvu 📚
*.epub 📚
*.csv 📓
*.xlsx 📓
*.tex 📜
*.md 📘
*.r 📊
*.R 📊
*.rmd 📊
*.Rmd 📊
*.m 📊
*.mp3 🎵
*.opus 🎵
*.ogg 🎵
*.m4a 🎵
*.flac 🎼
*.wav 🎼
*.mkv 🎥
*.mp4 🎥
*.webm 🎥
*.mpeg 🎥
*.avi 🎥
*.mov 🎥
*.mpg 🎥
*.wmv 🎥
*.m4b 🎥
*.flv 🎥
*.zip 📦
*.rar 📦
*.7z 📦
*.tar 📦
*.z64 🎮
*.v64 🎮
*.n64 🎮
*.gba 🎮
*.nes 🎮
*.gdi 🎮
*.1
*.nfo
*.info
*.log 📙
*.iso 📀
*.img 📀
*.bib 🎓
*.ged 👪
*.part 💔
*.torrent 🔽
*.jar ♨
*.java ♨

153
lf/lfrc Normal file
View File

@ -0,0 +1,153 @@
# Luke's lf settings
# Note on Image Previews
# For those wanting image previews, like this system, there are four steps to
# set it up. These are done automatically for LARBS users, but I will state
# them here for others doing it manually.
#
# 1. ueberzug must be installed.
# 2. The scope file (~/.config/lf/scope for me), must have a command similar to
# mine to generate ueberzug images.
# 3. A `set cleaner` line as below is a cleaner script.
# 4. lf should be started through a wrapper script (~/.local/bin/lfub for me)
# that creates the environment for ueberzug. This command can be be aliased
# in your shellrc (`alias lf="lfub") or if set to a binding, should be
# called directly instead of normal lf.
# Basic vars
set shellopts '-eu'
set ifs "\n"
set scrolloff 10
set icons
set period 1
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
set cleaner '~/.config/lf/cleaner'
set previewer '~/.config/lf/scope'
set autoquit true
# cmds/functions
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;;
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
[ -z "$file" ] && continue
lf -remote "send select \"$file\""
lf -remote "send toggle"
done &
;;
audio/*|video/x-ms-asf) mpv --audio-display=no $f ;;
video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
application/pgp-encrypted) $EDITOR $fx ;;
application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
esac
}}
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
cmd extract ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
printf "%s\n\t" "$fx"
printf "extract?[y/N]"
read ans
[ $ans = "y" ] && aunpack $fx
}}
cmd delete ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
printf "%s\n\t" "$fx"
printf "delete?[y/N]"
read ans
[ $ans = "y" ] && rm -rf -- $fx
}}
cmd moveto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
clear; echo "Move to where?"
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
for x in $fx; do
eval mv -iv \"$x\" \"$dest\"
done &&
notify-send "🚚 File(s) moved." "File(s) moved to $dest."
}}
cmd copyto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
clear; echo "Copy to where?"
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
for x in $fx; do
eval cp -ivr \"$x\" \"$dest\"
done &&
notify-send "📋 File(s) copied." "File(s) copies to $dest."
}}
cmd setbg "$1"
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)\""
map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)"
map gh
map g top
map D delete
map E extract
map C copyto
map M moveto
map <c-n> push :mkdir<space>
map <c-r> reload
map <c-s> set hidden!
map <enter> shell
map x $$f
map X !$f
map o &mimeopen "$f"
map O $mimeopen --ask "$f"
map A :rename; cmd-end # at the very end
map c push A<c-u> # new rename
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
map <c-e> down
map <c-y> up
map V push :!nvim<space>
map W $setsid -f $TERMINAL >/dev/null 2>&1
map Y $printf "%s" "$fx" | xclip -selection clipboard
# Source Bookmarks
source "~/.config/lf/shortcutrc"

52
lf/scope Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
# File preview handler for lf.
set -C -f
IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}"
image() {
if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then
printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG"
else
mediainfo "$6"
fi
}
ifub() {
[ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1
}
# Note that the cache file name is a function of file information, meaning if
# an image appears in multiple places across the machine, it will not have to
# be regenerated once seen.
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/*) 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" ;;
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)"
[ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0
image "$CACHE" "$2" "$3" "$4" "$5" "$1"
;;
*/pdf)
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.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
;;
*/epub+zip|*/mobi*)
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.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg"
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
;;
application/*zip) atool --list -- "$1" ;;
*opendocument*) odt2txt "$1" ;;
application/pgp-encrypted) gpg -d -- "$1" ;;
esac
exit 1

29
lf/shortcutrc Normal file
View File

@ -0,0 +1,29 @@
map Ccac cd "/home/victor/.cache"
map Ccf cd "/home/victor/.config"
map CD cd "/home/victor/down"
map Cd cd "/home/victor/dox"
map Cdt cd "/home/victor/.local/share"
map Crr cd "/home/victor/.local/src"
map Ch cd "/home/victor"
map Cm cd "/home/victor/music"
map Cmn cd "/mnt"
map Cpp cd "/home/victor/pix"
map Csc cd "/home/victor/.local/bin"
map Csrc cd "/home/victor/.local/src"
map Cvv cd "/home/victor/vids"
map Ebf $$EDITOR "/home/victor/.config/shell/bm-files"
map Ebd $$EDITOR "/home/victor/.config/shell/bm-dirs"
map Ecfx $$EDITOR "/home/victor/.config/x11/xresources"
map Ecfb $$EDITOR "~/.local/src/dwmblocks/config.h"
map Ecfv $$EDITOR "/home/victor/.config/nvim/init.lua"
map Ecfz $$EDITOR "/home/victor/.config/zsh/.zshrc"
map Ecfa $$EDITOR "/home/victor/.config/shell/aliasrc"
map Ecfp $$EDITOR "/home/victor/.config/shell/profile"
map Ecfm $$EDITOR "/home/victor/.config/mutt/muttrc"
map Ecfn $$EDITOR "/home/victor/.config/newsboat/config"
map Ecfu $$EDITOR "/home/victor/.config/newsboat/urls"
map Ecfmb $$EDITOR "/home/victor/.config/ncmpcpp/bindings"
map Ecfmc $$EDITOR "/home/victor/.config/ncmpcpp/config"
map Ecfl $$EDITOR "/home/victor/.config/lf/lfrc"
map EcfL $$EDITOR "/home/victor/.config/lf/scope"
map EcfX $$EDITOR "/home/victor/.config/sxiv/exec/key-handler"

25
mimeapps.list Normal file
View File

@ -0,0 +1,25 @@
[Default Applications]
# xdg-open will use these settings to determine how to open filetypes.
# These .desktop entries can also be seen and changed in ~/.local/share/applications/
text/x-shellscript=text.desktop;
x-scheme-handler/magnet=torrent.desktop;
application/x-bittorrent=torrent.desktop;
x-scheme-handler/mailto=thunderbird.desktop;
text/plain=text.desktop;
application/postscript=pdf.desktop;
application/pdf=pdf.desktop;
image/png=img.desktop;
image/jpeg=img.desktop;
image/gif=img.desktop;
application/rss+xml=rss.desktop
video/x-matroska=video.desktop
video/mp4=video.desktop
x-scheme-handler/lbry=lbry.desktop
inode/directory=file.desktop
text/html=librewolf.desktop
x-scheme-handler/http=librewolf.desktop
x-scheme-handler/https=librewolf.desktop
x-scheme-handler/about=librewolf.desktop
x-scheme-handler/unknown=librewolf.desktop

21
mpd/mpd.conf Normal file
View File

@ -0,0 +1,21 @@
music_directory "~/Music"
playlist_directory "~/.config/mpd/playlists"
auto_update "yes"
bind_to_address "127.0.0.1"
restore_paused "yes"
max_output_buffer_size "16384"
audio_output {
type "pulse"
name "pulse"
#type "alsa"
#name "ALSA"
}
audio_output {
type "fifo"
name "Visualizer feed"
path "/tmp/mpd.fifo"
format "44100:16:2"
}

5
mpv/input.conf Normal file
View File

@ -0,0 +1,5 @@
l seek 5
h seek -5
j seek -60
k seek 60
S cycle sub

47
mpv/mpv.conf Normal file
View File

@ -0,0 +1,47 @@
# Enable caching
cache=yes
cache-default=512
cache-file=./cache
# Save timestamps to a file
osd-fractions=yes
osd-status-msg="[$timestamp] ${filename/no-ext} [${duration} / ${playlist-pos-1}/${playlist-count}]"
# Recommended video output settings
vo=gpu
gpu-context=auto
hwdec=auto
# Audio settings
audio-channels=auto
# Subtitle settings
sub-auto=fuzzy
# Volume normalization
volume-max=100
volume-normalization=yes
# Mouse input settings
input-cursor=yes
mouse-movements=yes
mouse-speed=1.0
# Default playback speed
speed=1.0
# Skip forward/backward in seconds
osd-duration=1000
input-sec-up="seek +10"
input-sec-down="seek -10"
# Display video info
msg-level=all=status
[extension.webm]
loop-playlist=yes
loop-playlist-start=inf
loop-file=inf

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Wis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,76 @@
# mpvSockets
create one sockets per mpv instance (with the instance's process **ID** (PID), (**unique**)), instead of one socket for the last started instance
dangling sockets for crashed or killed instances is an issue,
not sure if this script should handle/remove them or the clients/users, or both.
# Installation
Download the single script file to your mpv-scripts-directory
## Linux / unixes:
``` bash
curl "https://raw.githubusercontent.com/wis/mpvSockets/master/mpvSockets.lua" --create-dirs -o "$Your_Mpv_Scripts_Directory_Location/mpvSockets.lua"
```
if you're on Linux, most likely the location is `~/.config/mpv/scripts`, so run this before:
``` bash
$Your_Mpv_Scripts_Directory_Location=$HOME/config/mpv/scripts
```
## Windows (untested)
powershell:
``` powershell
Invoke-WebRequest -OutFile "$env:LOCALAPPDATA\mpv\scripts\mpvSockets.lua" "https://raw.githubusercontent.com/wis/mpvSockets/master/mpvSockets.lua"
```
# Usage, with Mpv's [JSON IPC](https://github.com/mpv-player/mpv/blob/master/DOCS/man/ipc.rst)
## Linux / unixes (unix sockets):
a script that pauses all running mpv instances:
bash:
``` bash
#!/bin/bash
for i in $(ls /tmp/mpvSockets/*); do
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
done
# Socat is a command line based utility that establishes two bidirec-tional byte streams and transfers data between them.
# available on Linux and FreeBSD, propably most unixes. you can also use
```
## Windows (named pipes):
quote from https://mpv.io/manual/stable/#command-prompt-example
> Unfortunately, it's not as easy to test the IPC protocol on Windows, since Windows ports of socat (in Cygwin and MSYS2) don't understand named pipes. In the absence of a simple tool to send and receive from bidirectional pipes, the echo command can be used to send commands, but not receive replies from the command prompt.
>
> Assuming mpv was started with:
>
> `mpv file.mkv --input-ipc-server=\\.\pipe\mpvsocket`
> You can send commands from a command prompt:
>
> `echo show-text ${playback-time} >\\.\pipe\mpvsocket`
To be able to simultaneously read and write from the IPC pipe, like on Linux, it's necessary to write an external program that uses overlapped file I/O (or some wrapper like .NET's NamedPipeClientStream.)
powershell client writer and reader (untested):
``` powershell
# socat.ps1
# usage: socat.ps1 <Pipe-name> <Message>
$sockedName = args[0]
$message = args[1]
$npipeClient = new-object System.IO.Pipes.NamedPipeClientStream('.', $socketName, [System.IO.Pipes.PipeDirection]::InOut, [System.IO.Pipes.PipeOptions]::None, [System.Security.Principal.TokenImpersonationLevel]::Impersonation)
$pipeReader = $pipeWriter = $null
try {
$npipeClient.Connect()
$pipeReader = new-object System.IO.StreamReader($npipeClient)
$pipeWriter = new-object System.IO.StreamWriter($npipeClient)
$pipeWriter.AutoFlush = $true
$pipeWriter.WriteLine($message)
while (($data = $pipeReader.ReadLine()) -ne $null) {
$data
}
}
catch {
"An error occurred that could not be resolved."
}
finally {
$npipeClient.Dispose()
}
```

View File

@ -0,0 +1,36 @@
-- mpvSockets, one socket per instance, removes socket on exit
local utils = require 'mp.utils'
local function get_temp_path()
local directory_seperator = package.config:match("([^\n]*)\n?")
local example_temp_file_path = os.tmpname()
-- remove generated temp file
pcall(os.remove, example_temp_file_path)
local seperator_idx = example_temp_file_path:reverse():find(directory_seperator)
local temp_path_length = #example_temp_file_path - seperator_idx
return example_temp_file_path:sub(1, temp_path_length)
end
tempDir = get_temp_path()
function join_paths(...)
local arg={...}
path = ""
for i,v in ipairs(arg) do
path = utils.join_path(path, tostring(v))
end
return path;
end
ppid = utils.getpid()
os.execute("mkdir " .. join_paths(tempDir, "mpvSockets") .. " 2>/dev/null")
mp.set_property("options/input-ipc-server", join_paths(tempDir, "mpvSockets", ppid))
function shutdown_handler()
os.remove(join_paths(tempDir, "mpvSockets", ppid))
end
mp.register_event("shutdown", shutdown_handler)

3
mpv/scripts/modules.lua Normal file
View File

@ -0,0 +1,3 @@
local mpv_config_dir_path = require("mp").command_native({"expand-path", "~~/"})
function load(relative_path) dofile(mpv_config_dir_path .. "/script_modules/" .. relative_path) end
load("mpvSockets/mpvSockets.lua")

479
ncmpcpp/bindings Normal file
View File

@ -0,0 +1,479 @@
##############################################################
## This is the example bindings file. Copy it to ##
## ~/.ncmpcpp/bindings or $XDG_CONFIG_HOME/ncmpcpp/bindings ##
## and set up your preferences ##
##############################################################
#
#def_key "mouse"
# mouse_event
#
#def_key "up"
# scroll_up
#
#def_key "shift-up"
# select_item
# scroll_up
#
#def_key "down"
# scroll_down
#
#def_key "shift-down"
# select_item
# scroll_down
#
#def_key "["
# scroll_up_album
#
#def_key "]"
# scroll_down_album
#
#def_key "{"
# scroll_up_artist
#
#def_key "}"
# scroll_down_artist
#
#def_key "page_up"
# page_up
#
#def_key "page_down"
# page_down
#
#def_key "home"
# move_home
#
#def_key "end"
# move_end
#
#def_key "insert"
# select_item
#
#def_key "enter"
# enter_directory
#
#def_key "enter"
# toggle_output
#
#def_key "enter"
# run_action
#
#def_key "enter"
# play_item
#
#def_key "space"
# add_item_to_playlist
#
#def_key "space"
# toggle_lyrics_update_on_song_change
#
#def_key "space"
# toggle_visualization_type
#
#def_key "delete"
# delete_playlist_items
#
#def_key "delete"
# delete_browser_items
#
#def_key "delete"
# delete_stored_playlist
#
#def_key "right"
# next_column
#
#def_key "right"
# slave_screen
#
#def_key "right"
# volume_up
#
#def_key "+"
# volume_up
#
#def_key "left"
# previous_column
#
#def_key "left"
# master_screen
#
#def_key "left"
# volume_down
#
#def_key "-"
# volume_down
#
#def_key ":"
# execute_command
#
#def_key "tab"
# next_screen
#
#def_key "shift-tab"
# previous_screen
#
#def_key "f1"
# show_help
#
#def_key "1"
# show_playlist
#
#def_key "2"
# show_browser
#
#def_key "2"
# change_browse_mode
#
#def_key "3"
# show_search_engine
#
#def_key "3"
# reset_search_engine
#
#def_key "4"
# show_media_library
#
#def_key "4"
# toggle_media_library_columns_mode
#
#def_key "5"
# show_playlist_editor
#
#def_key "6"
# show_tag_editor
#
#def_key "7"
# show_outputs
#
#def_key "8"
# show_visualizer
#
#def_key "="
# show_clock
#
#def_key "@"
# show_server_info
#
#def_key "s"
# stop
#
#def_key "p"
# pause
#
#def_key ">"
# next
#
#def_key "<"
# previous
#
#def_key "ctrl-h"
# jump_to_parent_directory
#
#def_key "ctrl-h"
# replay_song
#
#def_key "backspace"
# jump_to_parent_directory
#
#def_key "backspace"
# replay_song
#
#def_key "f"
# seek_forward
#
#def_key "b"
# seek_backward
#
#def_key "r"
# toggle_repeat
#
#def_key "z"
# toggle_random
#
#def_key "y"
# save_tag_changes
#
#def_key "y"
# start_searching
#
#def_key "y"
# toggle_single
#
#def_key "R"
# toggle_consume
#
#def_key "Y"
# toggle_replay_gain_mode
#
#def_key "T"
# toggle_add_mode
#
#def_key "|"
# toggle_mouse
#
#def_key "#"
# toggle_bitrate_visibility
#
#def_key "Z"
# shuffle
#
#def_key "x"
# toggle_crossfade
#
#def_key "X"
# set_crossfade
#
#def_key "u"
# update_database
#
#def_key "ctrl-s"
# sort_playlist
#
#def_key "ctrl-s"
# toggle_browser_sort_mode
#
#def_key "ctrl-s"
# toggle_media_library_sort_mode
#
#def_key "ctrl-r"
# reverse_playlist
#
#def_key "ctrl-f"
# apply_filter
#
#def_key "ctrl-_"
# select_found_items
#
#def_key "/"
# find
#
#def_key "/"
# find_item_forward
#
#def_key "?"
# find
#
#def_key "?"
# find_item_backward
#
#def_key "."
# next_found_item
#
#def_key ","
# previous_found_item
#
#def_key "w"
# toggle_find_mode
#
#def_key "e"
# edit_song
#
#def_key "e"
# edit_library_tag
#
#def_key "e"
# edit_library_album
#
#def_key "e"
# edit_directory_name
#
#def_key "e"
# edit_playlist_name
#
#def_key "e"
# edit_lyrics
#
#def_key "i"
# show_song_info
#
#def_key "I"
# show_artist_info
#
#def_key "g"
# jump_to_position_in_song
#
#def_key "l"
# show_lyrics
#
#def_key "ctrl-v"
# select_range
#
#def_key "v"
# reverse_selection
#
#def_key "V"
# remove_selection
#
#def_key "B"
# select_album
#
#def_key "a"
# add_selected_items
#
#def_key "c"
# clear_playlist
#
#def_key "c"
# clear_main_playlist
#
#def_key "C"
# crop_playlist
#
#def_key "C"
# crop_main_playlist
#
#def_key "m"
# move_sort_order_up
#
#def_key "m"
# move_selected_items_up
#
#def_key "n"
# move_sort_order_down
#
#def_key "n"
# move_selected_items_down
#
#def_key "M"
# move_selected_items_to
#
#def_key "A"
# add
#
#def_key "S"
# save_playlist
#
#def_key "o"
# jump_to_playing_song
#
#def_key "G"
# jump_to_browser
#
#def_key "G"
# jump_to_playlist_editor
#
#def_key "~"
# jump_to_media_library
#
#def_key "E"
# jump_to_tag_editor
#
#def_key "U"
# toggle_playing_song_centering
#
#def_key "P"
# toggle_display_mode
#
#def_key "\\"
# toggle_interface
#
#def_key "!"
# toggle_separators_between_albums
#
#def_key "L"
# toggle_lyrics_fetcher
#
#def_key "F"
# fetch_lyrics_in_background
#
#def_key "alt-l"
# toggle_fetching_lyrics_in_background
#
#def_key "ctrl-l"
# toggle_screen_lock
#
#def_key "`"
# toggle_library_tag_type
#
#def_key "`"
# refetch_lyrics
#
#def_key "`"
# add_random_items
#
#def_key "ctrl-p"
# set_selected_items_priority
#
#def_key "q"
# quit
#
#
#def_key "f"
# find
#def_key "f"
# find_item_forward
def_key "+"
show_clock
def_key "="
volume_up
def_key "j"
scroll_down
def_key "k"
scroll_up
def_key "ctrl-u"
page_up
#push_characters "kkkkkkkkkkkkkkk"
def_key "ctrl-d"
page_down
#push_characters "jjjjjjjjjjjjjjj"
def_key "u"
page_up
#push_characters "kkkkkkkkkkkkkkk"
def_key "d"
page_down
#push_characters "jjjjjjjjjjjjjjj"
def_key "h"
previous_column
def_key "l"
next_column
def_key "."
show_lyrics
def_key "n"
next_found_item
def_key "N"
previous_found_item
# not used but bound
def_key "J"
move_sort_order_down
def_key "K"
move_sort_order_up
def_key "h"
jump_to_parent_directory
def_key "l"
enter_directory
def_key "l"
run_action
def_key "l"
play_item
def_key "m"
show_media_library
def_key "m"
toggle_media_library_columns_mode
def_key "t"
show_tag_editor
def_key "v"
show_visualizer
def_key "G"
move_end
def_key "g"
move_home
#jump_to_position_in_song
def_key "U"
update_database
def_key "s"
reset_search_engine
def_key "s"
show_search_engine
def_key "f"
show_browser
def_key "f"
change_browse_mode
def_key "x"
delete_playlist_items
def_key "P"
show_playlist

33
ncmpcpp/config Normal file
View File

@ -0,0 +1,33 @@
# vim: filetype=conf
ncmpcpp_directory = "~/.config/ncmpcpp"
lyrics_directory = "~/.local/share/lyrics"
mpd_music_dir = "~/Music"
message_delay_time = "1"
visualizer_type = "spectrum"
song_list_format = {$4%a - }{%t}|{$8%f$9}$R{$3(%l)$9}
song_status_format = $b{{$8"%t"}} $3by {$4%a{ $3in $7%b{ (%y)}} $3}|{$8%f}
song_library_format = {%n - }{%t}|{%f}
alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b
alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}
current_item_prefix = $(cyan)$r$b
current_item_suffix = $/r$(end)$/b
current_item_inactive_column_prefix = $(magenta)$r
current_item_inactive_column_suffix = $/r$(end)
playlist_display_mode = columns
browser_display_mode = columns
progressbar_look = ->
media_library_primary_tag = album_artist
media_library_albums_split_by_date = no
startup_screen = "media_library"
display_volume_level = no
ignore_leading_the = yes
external_editor = nvim
use_console_editor = yes
empty_tag_color = magenta
main_window_color = white
progressbar_color = black:b
progressbar_elapsed_color = blue:b
statusbar_color = red
statusbar_time_color = cyan:b
execute_on_song_change="pkill -RTMIN+11 dwmblocks"

55
newsboat/config Normal file
View File

@ -0,0 +1,55 @@
#show-read-feeds no
auto-reload yes
external-url-viewer "urlscan -dc -r 'linkhandler {}'"
bind-key j down
bind-key k up
bind-key j next articlelist
bind-key k prev articlelist
bind-key J next-feed articlelist
bind-key K prev-feed articlelist
bind-key G end
bind-key g home
bind-key d pagedown
bind-key u pageup
bind-key l open
bind-key h quit
bind-key a toggle-article-read
bind-key n next-unread
bind-key N prev-unread
bind-key D pb-download
bind-key U show-urls
bind-key x pb-delete
color listnormal cyan default
color listfocus black yellow standout bold
color listnormal_unread blue default
color listfocus_unread yellow default bold
color info red black bold
color article white default bold
browser linkhandler
macro , open-in-browser
macro t set browser "qndl" ; open-in-browser ; set browser linkhandler
macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best --restrict-filenames" ; open-in-browser ; set browser linkhandler
macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler
macro w set browser "lynx" ; open-in-browser ; set browser linkhandler
macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler
macro c set browser "echo %u | xclip -r -sel c" ; open-in-browser ; set browser linkhandler
macro C set browser "youtube-viewer --comments=%u" ; open-in-browser ; set browser linkhandler
macro p set browser "peertubetorrent %u 480" ; open-in-browser ; set browser linkhandler
macro P set browser "peertubetorrent %u 1080" ; open-in-browser ; set browser linkhandler
highlight all "---.*---" yellow
highlight feedlist ".*(0/0))" black
highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold
highlight article "(^Link:.*|^Date:.*)" default default
highlight article "https?://[^ ]+" green default
highlight article "^(Title):.*$" blue default
highlight article "\\[[0-9][0-9]*\\]" magenta default bold
highlight article "\\[image\\ [0-9]+\\]" green default bold
highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold
highlight article ":.*\\(link\\)$" cyan default
highlight article ":.*\\(image\\)$" blue default
highlight article ":.*\\(embedded flash\\)$" magenta default

10
newsboat/urls Normal file
View File

@ -0,0 +1,10 @@
https://lukesmith.xyz/rss.xml
https://videos.lukesmith.xyz/feeds/videos.xml?videoChannelId=2 "~Luke Smith (Videos)"
https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA "~Luke Smith (YouTube)"
https://lindypress.net/rss
https://notrelated.xyz/rss
https://landchad.net/rss.xml
https://based.cooking/index.xml
https://artixlinux.org/feed.php "tech"
https://www.archlinux.org/feeds/news/ "tech"
https://github.com/LukeSmithxyz/voidrice/commits/master.atom "~LARBS dotfiles"

5
pinentry/preexec Executable file
View File

@ -0,0 +1,5 @@
#!/hint/sh
# Define additional functionality for pinentry. For example
test -e /usr/lib/libgcr-base-3.so.1 && exec /usr/bin/pinentry-gnome3 "$@"
#test -e /usr/lib/libQt5Widgets.so.5 && exec /usr/bin/pinentry-qt "$@"

BIN
pulse/cookie Normal file

Binary file not shown.

4
pulse/daemon.conf Normal file
View File

@ -0,0 +1,4 @@
# Never exit pulseaudio if idle. This is to deal with an issue of Chromium
# browsers not properly starting Pulseaudio by themselves. When the underlying
# issue is solved, this file/directory should be removed.
exit-idle-time = -1

63
shell/aliasrc Normal file
View File

@ -0,0 +1,63 @@
#!/bin/sh
# Use neovim for vim if present.
[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"
# Use $XINITRC variable if file exists.
[ -f "$XINITRC" ] && alias startx="startx $XINITRC"
[ -f "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC"
# sudo not required for some system commands
for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do
alias $command="sudo $command"
done; unset command
se() {
choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)"
[ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice"
;}
# Verbosity and settings that you pretty much just always are going to want.
alias \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -vI" \
bc="bc -ql" \
rsync="rsync -vrPlu" \
mkd="mkdir -pv" \
yt="yt-dlp --embed-metadata -i" \
yta="yt -x -f bestaudio/best" \
ytt="yt --skip-download --write-thumbnail" \
ffmpeg="ffmpeg -hide_banner" \
code="vscodium" \
edge="microsoft-edge-stable" \
# Colorize commands when possible.
alias \
ls="ls -hN --color=auto --group-directories-first" \
grep="grep --color=auto" \
diff="diff --color=auto" \
ccat="highlight --out-format=ansi" \
ip="ip -color=auto"
# These common commands are just too long! Abbreviate them.
alias \
ka="killall" \
g="git" \
trem="transmission-remote" \
YT="youtube-viewer" \
sdn="shutdown -h now" \
e="$EDITOR" \
v="$EDITOR" \
p="pacman" \
xi="sudo xbps-install" \
xr="sudo xbps-remove -R" \
xq="xbps-query" \
z="zathura"
alias \
lf="lfub" \
magit="nvim -c MagitOnly" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \

14
shell/bm-dirs Normal file
View File

@ -0,0 +1,14 @@
# You can add comments to these files with #
cac ${XDG_CACHE_HOME:-$HOME/.cache}
cf ${XDG_CONFIG_HOME:-$HOME/.config}
D ${XDG_DOWNLOAD_DIR:-$HOME/down}
d ${XDG_DOCUMENTS_DIR:-$HOME/dox}
dt ${XDG_DATA_HOME:-$HOME/.local/share}
rr $HOME/.local/src
h $HOME
m ${XDG_MUSIC_DIR:-$HOME/music}
mn /mnt
pp ${XDG_PICTURES_DIR:-$HOME/pix}
sc $HOME/.local/bin
src $HOME/.local/src
vv ${XDG_VIDEOS_DIR:-$HOME/vids}

23
shell/bm-files Normal file
View File

@ -0,0 +1,23 @@
# These files automatically update when edited/saved in vim:
# keys filename description
bf ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files # This file, a list of bookmarked files
bd ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs # A list of bookmarked directories similar to this file
cfx ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources # Colors, themes and variables for X11
cfb ~/.local/src/dwmblocks/config.h # dwmblocks: the status bar for dwm
# These do not update automatically, but on the next new instance of a program:
cfv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.lua # vim/neovim config
cfz $ZDOTDIR/.zshrc # zsh (shell) config
cfa ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc # aliases used by zsh (and potentially other shells)
cfp ${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile # profile file for login settings for zsh
cfm ${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc # mutt (email client) config
cfn ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/config # newsboat (RSS reader)
cfu ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls # RSS urls for newsboat
cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings # ncmpcpp (music player) keybinds file
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

19
shell/inputrc Normal file
View File

@ -0,0 +1,19 @@
$include /etc/inputrc
set editing-mode vi
$if mode=vi
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[6 q\2
set vi-cmd-mode-string \1\e[2 q\2
set keymap vi-command
# these are for vi-command mode
Control-l: clear-screen
Control-a: beginning-of-line
set keymap vi-insert
# these are for vi-insert mode
Control-l: clear-screen
Control-a: beginning-of-line
$endif

82
shell/profile Normal file
View File

@ -0,0 +1,82 @@
#!/bin/zsh
# profile file. Runs on login. Environmental variables are set here.
# If you don't plan on reverting to bash, you can remove the link in ~/.profile
# to clean up.
# Adds `~/.local/bin` to $PATH
export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}"
unsetopt PROMPT_SP
# Default programs:
export EDITOR="nvim"
export TERMINAL="st"
export TERMINAL_PROG="st"
# Change the default crypto/weather monitor sites.
# export CRYPTOURL="rate.sx"
# export WTTRURL="wttr.in"
# ~/ Clean-up:
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch-config"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0"
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export INPUTRC="$XDG_CONFIG_HOME/shell/inputrc"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
#export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default"
export KODI_DATA="$XDG_DATA_HOME/kodi"
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export GOPATH="$XDG_DATA_HOME/go"
export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible/ansible.cfg"
export UNISON="$XDG_DATA_HOME/unison"
export HISTFILE="$XDG_DATA_HOME/history"
export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/config"
export ELECTRUMDIR="$XDG_DATA_HOME/electrum"
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc"
export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
export XDG_DESKTOP_DIR="$HOME/"
export XDG_DOWNLOAD_DIR="$HOME/down"
export XDG_TEMPLATES_DIR="$HOME/temp"
export XDG_PUBLICSHARE_DIR="$HOME/pub"
export XDG_DOCUMENTS_DIR="$HOME/dox"
export XDG_MUSIC_DIR="$HOME/music"
export XDG_PICTURES_DIR="$HOME/pix"
export XDG_VIDEOS_DIR="$HOME/vids"
# Other program settings:
export DICS="/usr/share/stardict/dic/"
export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
export LESS=-R
export LESS_TERMCAP_mb="$(printf '%b' '')"
export LESS_TERMCAP_md="$(printf '%b' '')"
export LESS_TERMCAP_me="$(printf '%b' '')"
export LESS_TERMCAP_so="$(printf '%b' '')"
export LESS_TERMCAP_se="$(printf '%b' '')"
export LESS_TERMCAP_us="$(printf '%b' '')"
export LESS_TERMCAP_ue="$(printf '%b' '')"
export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && setsid shortcuts >/dev/null 2>&1
# Start graphical server on user's current tty if not already running.
[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC"
# Switch escape and caps if tty and no passwd required:
sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/ttymaps.kmap 2>/dev/null

30
shell/shortcutrc Normal file
View File

@ -0,0 +1,30 @@
# vim: filetype=sh
alias cac="cd /home/victor/.cache && ls -A" \
cf="cd /home/victor/.config && ls -A" \
D="cd /home/victor/down && ls -A" \
d="cd /home/victor/dox && ls -A" \
dt="cd /home/victor/.local/share && ls -A" \
rr="cd /home/victor/.local/src && ls -A" \
h="cd /home/victor && ls -A" \
m="cd /home/victor/music && ls -A" \
mn="cd /mnt && ls -A" \
pp="cd /home/victor/pix && ls -A" \
sc="cd /home/victor/.local/bin && ls -A" \
src="cd /home/victor/.local/src && ls -A" \
vv="cd /home/victor/vids && ls -A" \
bf="$EDITOR /home/victor/.config/shell/bm-files" \
bd="$EDITOR /home/victor/.config/shell/bm-dirs" \
cfx="$EDITOR /home/victor/.config/x11/xresources" \
cfb="$EDITOR ~/.local/src/dwmblocks/config.h" \
cfv="$EDITOR /home/victor/.config/nvim/init.lua" \
cfz="$EDITOR /home/victor/.config/zsh/.zshrc" \
cfa="$EDITOR /home/victor/.config/shell/aliasrc" \
cfp="$EDITOR /home/victor/.config/shell/profile" \
cfm="$EDITOR /home/victor/.config/mutt/muttrc" \
cfn="$EDITOR /home/victor/.config/newsboat/config" \
cfu="$EDITOR /home/victor/.config/newsboat/urls" \
cfmb="$EDITOR /home/victor/.config/ncmpcpp/bindings" \
cfmc="$EDITOR /home/victor/.config/ncmpcpp/config" \
cfl="$EDITOR /home/victor/.config/lf/lfrc" \
cfL="$EDITOR /home/victor/.config/lf/scope" \
cfX="$EDITOR /home/victor/.config/sxiv/exec/key-handler" \

29
shell/zshnameddirrc Normal file
View File

@ -0,0 +1,29 @@
hash -d cac=/home/victor/.cache
hash -d cf=/home/victor/.config
hash -d D=/home/victor/down
hash -d d=/home/victor/dox
hash -d dt=/home/victor/.local/share
hash -d rr=/home/victor/.local/src
hash -d h=/home/victor
hash -d m=/home/victor/music
hash -d mn=/mnt
hash -d pp=/home/victor/pix
hash -d sc=/home/victor/.local/bin
hash -d src=/home/victor/.local/src
hash -d vv=/home/victor/vids
hash -d bf=/home/victor/.config/shell/bm-files
hash -d bd=/home/victor/.config/shell/bm-dirs
hash -d cfx=/home/victor/.config/x11/xresources
hash -d cfb=~/.local/src/dwmblocks/config.h
hash -d cfv=/home/victor/.config/nvim/init.lua
hash -d cfz=/home/victor/.config/zsh/.zshrc
hash -d cfa=/home/victor/.config/shell/aliasrc
hash -d cfp=/home/victor/.config/shell/profile
hash -d cfm=/home/victor/.config/mutt/muttrc
hash -d cfn=/home/victor/.config/newsboat/config
hash -d cfu=/home/victor/.config/newsboat/urls
hash -d cfmb=/home/victor/.config/ncmpcpp/bindings
hash -d cfmc=/home/victor/.config/ncmpcpp/config
hash -d cfl=/home/victor/.config/lf/lfrc
hash -d cfL=/home/victor/.config/lf/scope
hash -d cfX=/home/victor/.config/sxiv/exec/key-handler

33
sxiv/exec/key-handler Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
while read -r file
do
case "$1" in
"w") setbg "$file" & ;;
"c")
[ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
;;
"r")
convert -rotate 90 "$file" "$file" ;;
"R")
convert -rotate -90 "$file" "$file" ;;
"f")
convert -flop "$file" "$file" ;;
"y")
printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;
"Y")
readlink -f "$file" | tr -d '\n' | xclip -selection clipboard &&
notify-send "$(readlink -f "$file") copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
"g") ifinstalled gimp && setsid -f gimp "$file" ;;
"i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | grep "<b>")" ;;
esac
done

8
user-dirs.dirs Normal file
View File

@ -0,0 +1,8 @@
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/down"
XDG_TEMPLATES_DIR="$HOME/temp"
XDG_PUBLICSHARE_DIR="$HOME/pub"
XDG_DOCUMENTS_DIR="$HOME/dox"
XDG_MUSIC_DIR="$HOME/music"
XDG_PICTURES_DIR="$HOME/pix"
XDG_VIDEOS_DIR="$HOME/vids"

32
wal/postrun Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
source "${XDG_CACHE_HOME:-$HOME/.cache}/wal/colors.sh"
mkdir -p "${dunstconf%/*}" "${zathuraconf%/*}"
mv -n "$dunstconf" "$dunstconf.bak"
mv -n "$zathuraconf" "$zathuraconf.bak"
ln -sf "${XDG_CACHE_HOME:-$HOME/.cache}/wal/dunstrc" "$dunstconf"
ln -sf "${XDG_CACHE_HOME:-$HOME/.cache}/wal/zathurarc" "$zathuraconf"
fix_sequences() {
e=$'\e'
sequences=$(cat)
foreground_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]10[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")"
background_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]11[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")"
cursor_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]12[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")"
for term in /dev/pts/{0..9}*; do
echo -e "\e]4;256;${cursor_color}\a\c" > "${term}" 2>/dev/null
echo -e "\e]4;258;${background_color}\a\c" > "${term}" 2>/dev/null
echo -e "\e]4;259;${foreground_color}\a\c" > "${term}" 2>/dev/null
done
}
fix_sequences <"${XDG_CACHE_HOME:-$HOME/.cache}/wal/sequences"
pkill dunst; setsid -f dunst

27
wal/templates/dunstrc Normal file
View File

@ -0,0 +1,27 @@
[global]
monitor = 0
follow = keyboard
width = 370
height = 350
offset = 0x19
padding = 2
horizontal_padding = 2
transparency = 25
font = Monospace 12
format = "<b>%s</b>\n%b"
[urgency_low]
background = "{color0}" # color0
foreground = "{color8}" # color8
timeout = 3
[urgency_normal]
foreground = "{color15}" # color15
background = "{color4}" # color4
timeout = 5
[urgency_critical]
background = "{color1}" # color1
foreground = "{color15}" # color15
frame_color = "{color11}" # color11
timeout = 10

36
wal/templates/zathurarc Normal file
View File

@ -0,0 +1,36 @@
set sandbox none
set statusbar-h-padding 0
set statusbar-v-padding 0
set page-padding 1
set selection-clipboard clipboard
map u scroll half-up
map d scroll half-down
map D toggle_page_mode
map r reload
map R rotate
map K zoom in
map J zoom out
map i recolor
map p print
map g goto top
set default-bg "{background}"
set default-fg "{foreground}"
set statusbar-bg "{background}"
set statusbar-fg "{foreground}"
set inputbar-bg "{background}"
set inputbar-fg "{foreground}"
set notification-bg "{background}"
set notification-fg "{foreground}"
set notification-error-bg "{background}"
set notification-error-fg "{foreground}"
set notification-warning-bg "{background}"
set notification-warning-fg "{foreground}"
set highlight-color "{color3}"
set highlight-active-color "{color4}"
set completion-bg "{color3}"
set completion-fg "{color4}"
set completion-highlight-bg "{color3}"
set completion-highlight-fg "{color4}"
set recolor-lightcolor "{background}"
set recolor-darkcolor "{foreground}"

1
wget/wgetrc Normal file
View File

@ -0,0 +1 @@
hsts-file=~/.cache/wget-hsts

17
x11/xinitrc Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# xinitrc runs automatically when you run startx.
# There are some small but important commands that need to be run when we start
# the graphical environment. There is a link to this file in ~/.xprofile
# because that file is run automatically if someone uses a display manager
# (login screen) and so they are needed there. To prevent doubling up commands,
# I source them here with the line below.
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then
. "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile"
else
. "$HOME/.xprofile"
fi
ssh-agent dwm

18
x11/xprofile Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# This file runs when a DM logs you into a graphical session.
# If you use startx/xinit like a Chad, this file will also be sourced.
xrandr --dpi 96 # Set DPI. User may want to use a larger number for larger screens.
setbg & # set the background with the `setbg` script
# xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources & xrdbpid=$! # Uncomment to use Xresources colors/settings on startup
autostart="mpd picom dunst unclutter pipewire remapd"
eval $(/usr/bin/gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
dbus-update-activation-environment --all # Update dbus environment variables
for program in $autostart; do
pidof -sx "$program" || "$program" &
done >/dev/null 2>&1
# Ensure that xrdb has finished running before moving on to start the WM/DE.
[ -n "$xrdbpid" ] && wait "$xrdbpid"

156
x11/xresources Normal file
View File

@ -0,0 +1,156 @@
!! Transparency (0-1):
*.alpha: 0.8
!! Set a default font and font size as below:
*.font: monospace:size=10
/* name dark light */
/* black 0 8 */
/* red 1 9 */
/* green 2 10 */
/* yellow 3 11 */
/* blue 4 12 */
/* purple 5 13 */
/* cyan 6 14 */
/* white 7 15 */
/* !! gruvbox: */
/* *.color0: #1d2021 */
/* *.color1: #cc241d */
/* *.color2: #98971a */
/* *.color3: #d79921 */
/* *.color4: #458588 */
/* *.color5: #b16286 */
/* *.color6: #689d6a */
/* *.color7: #a89984 */
/* *.color8: #928374 */
/* *.color9: #fb4934 */
/* *.color10: #b8bb26 */
/* *.color11: #fabd2f */
/* *.color12: #83a598 */
/* *.color13: #d3869b */
/* *.color14: #8ec07c */
/* *.color15: #ebdbb2 */
/* *.color256: #1d2021 */
/* *.color257: #ebdbb2 */
/* !! gruvbox light: */
/* *.color0: #fbf1c7 */
/* *.color1: #cc241d */
/* *.color2: #98971a */
/* *.color3: #d79921 */
/* *.color4: #458588 */
/* *.color5: #b16286 */
/* *.color6: #689d6a */
/* *.color7: #7c6f64 */
/* *.color8: #928374 */
/* *.color9: #9d0006 */
/* *.color10: #79740e */
/* *.color11: #b57614 */
/* *.color12: #076678 */
/* *.color13: #8f3f71 */
/* *.color14: #427b58 */
/* *.color15: #3c3836 */
/* *.background: #fbf1c7 */
/* *.foreground: #282828 */
/* st.alpha: 0.9 */
/* !! brogrammer: */
/* *.foreground: #d6dbe5 */
/* *.background: #131313 */
/* *.color0: #1f1f1f */
/* *.color8: #d6dbe5 */
/* *.color1: #f81118 */
/* *.color9: #de352e */
/* *.color2: #2dc55e */
/* *.color10: #1dd361 */
/* *.color3: #ecba0f */
/* *.color11: #f3bd09 */
/* *.color4: #2a84d2 */
/* *.color12: #1081d6 */
/* *.color5: #4e5ab7 */
/* *.color13: #5350b9 */
/* *.color6: #1081d6 */
/* *.color14: #0f7ddb */
/* *.color7: #d6dbe5 */
/* *.color15: #ffffff */
/* *.colorBD: #d6dbe5 */
/* ! base16 */
/* *.color0: #181818 */
/* *.color1: #ab4642 */
/* *.color2: #a1b56c */
/* *.color3: #f7ca88 */
/* *.color4: #7cafc2 */
/* *.color5: #ba8baf */
/* *.color6: #86c1b9 */
/* *.color7: #d8d8d8 */
/* *.color8: #585858 */
/* *.color9: #ab4642 */
/* *.color10: #a1b56c */
/* *.color11: #f7ca88 */
/* *.color12: #7cafc2 */
/* *.color13: #ba8baf */
/* *.color14: #86c1b9 */
/* *.color15: #f8f8f8 */
/* !! solarized */
/* *.color0: #073642 */
/* *.color1: #dc322f */
/* *.color2: #859900 */
/* *.color3: #b58900 */
/* *.color4: #268bd2 */
/* *.color5: #d33682 */
/* *.color6: #2aa198 */
/* *.color7: #eee8d5 */
/* *.color9: #cb4b16 */
/* *.color8: #fdf6e3 */
/* *.color10: #586e75 */
/* *.color11: #657b83 */
/* *.color12: #839496 */
/* *.color13: #6c71c4 */
/* *.color14: #93a1a1 */
/* *.color15: #fdf6e3 */
/* !! xterm */
/* *.color0: #000000 */
/* *.color1: #cd0000 */
/* *.color2: #00cd00 */
/* *.color3: #cdcd00 */
/* *.color4: #0000cd */
/* *.color5: #cd00cd */
/* *.color6: #00cdcd */
/* *.color7: #e5e5e5 */
/* *.color8: #4d4d4d */
/* *.color9: #ff0000 */
/* *.color10: #00ff00 */
/* *.color11: #ffff00 */
/* *.color12: #0000ff */
/* *.color13: #ff00ff */
/* *.color14: #00ffff */
/* *.color15: #aabac8 */
/* *.background: #000000 */
/* ! Dracula Xresources palette */
/* *.foreground: #F8F8F2 */
/* *.background: #282A36 */
/* *.color0: #000000 */
/* *.color8: #4D4D4D */
/* *.color1: #FF5555 */
/* *.color9: #FF6E67 */
/* *.color2: #50FA7B */
/* *.color10: #5AF78E */
/* *.color3: #F1FA8C */
/* *.color11: #F4F99D */
/* *.color4: #BD93F9 */
/* *.color12: #CAA9FA */
/* *.color5: #FF79C6 */
/* *.color13: #FF92D0 */
/* *.color6: #8BE9FD */
/* *.color14: #9AEDFE */
/* *.color7: #BFBFBF */
/* *.color15: #E6E6E6 */
/* *.background: .color0 */
/* *.color256: 0#1d2021 */
/* *.color257: 15#ebdbb2 */

15
zathura/zathurarc Normal file
View File

@ -0,0 +1,15 @@
set sandbox none
set statusbar-h-padding 0
set statusbar-v-padding 0
set page-padding 1
set selection-clipboard clipboard
map u scroll half-up
map d scroll half-down
map D toggle_page_mode
map r reload
map R rotate
map K zoom in
map J zoom out
map i recolor
map p print
map g goto top

1
zsh/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
ohmyzsh/**/*

1795
zsh/.zcompdump Normal file

File diff suppressed because it is too large Load Diff

89
zsh/.zshrc Normal file
View File

@ -0,0 +1,89 @@
# Luke's config for the Zoomer Shell
# Uncomment below for debugging part (1/2)
# zmodload zsh/zprof
# Enable colors and change prompt:
autoload -U colors && colors # Load colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
setopt autocd # Automatically cd into typed directory.
stty stop undef # Disable ctrl-s to freeze terminal.
setopt interactive_comments
# History in cache directory:
HISTSIZE=10000000
SAVEHIST=10000000
HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
# Load aliases and shortcuts if existent.
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# vi mode
bindkey -v
export KEYTIMEOUT=1
# Use keychain to load ssh-agent
eval `keychain --eval --quiet --noask --agents ssh id_rsa ~/.ssh/id_rsa`
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# Change cursor shape for different vi modes.
function zle-keymap-select () {
case $KEYMAP in
vicmd) echo -ne '\e[1 q';; # block
viins|main) echo -ne '\e[5 q';; # beam
esac
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
bindkey -s '^o' '^ulfcd\n'
bindkey -s '^a' '^ubc -lq\n'
bindkey -s '^f' '^ucd "$(dirname "$(fzf)")"\n'
bindkey '^[[P' delete-char
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line
bindkey -M vicmd '^[[P' vi-delete-char
bindkey -M vicmd '^e' edit-command-line
bindkey -M visual '^[[P' vi-delete
# Pre plugin variables:
zstyle ':omz:plugins:nvm' lazy yes
## Load plugins:
source ~/.config/zsh/copyfile.zsh
source /home/victor/.config/zsh/nvm/nvm.plugin.zsh
# Load syntax highlighting; should be last.
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
# Uncomment below for debugging part (2/2)
# zprof

20
zsh/copyfile.zsh Normal file
View File

@ -0,0 +1,20 @@
# Copy the content of a file to the clipboard using xclip
function copyfile() {
if [[ -z $1 ]]; then
echo "Usage: copy-file-to-clipboard <file>"
return 1
fi
if ! command -v xclip &> /dev/null; then
echo "xclip is not installed. Please install it first."
return 1
fi
if [[ ! -f $1 ]]; then
echo "$1 is not a valid file."
return 1
fi
xclip -sel clip < "$1"
echo "$1 content copied to clipboard."
}

60
zsh/nvm/README.md Normal file
View File

@ -0,0 +1,60 @@
# nvm plugin
This plugin adds autocompletions for [nvm](https://github.com/nvm-sh/nvm) — a Node.js version manager. It also
automatically sources nvm, so you don't need to do it manually in your `.zshrc`.
To use it, add `nvm` to the plugins array of your zshrc file:
```zsh
plugins=(... nvm)
```
## Settings
If you installed nvm in a directory other than `$HOME/.nvm`, set and export `NVM_DIR` to be the directory
where you installed nvm.
These settings should go in your zshrc file, before Oh My Zsh is sourced:
- **`NVM_HOMEBREW`**: if you installed nvm via Homebrew, in a directory other than `/usr/local/opt/nvm`, you
can set `NVM_HOMEBREW` to be the directory where you installed it. For example, on Apple Silicon-based Macs,
[Homebrew is installed in `/opt/homebrew`](https://docs.brew.sh/Installation). To get the directory where
nvm has been installed, regardless of chip architecture, use `NVM_HOMEBREW=$(brew --prefix nvm)`.
## Customization
#### Lazy startup
This option will help you to defer nvm's load until you use it to speed-up your zsh startup. This will source
nvm script only when using it, and will create a function for `node`, `npm`, `pnpm`, `yarn`, and the
command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be loaded and run with
default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is sourced:
```zsh
zstyle ':omz:plugins:nvm' lazy yes
```
Then, to define extra commands that will also trigger nvm load, you can use a similar syntax, adding as many
as you want:
```zsh
zstyle ':omz:plugins:nvm' lazy-cmd eslint prettier typescript ...
```
#### `.nvmrc` autoload
If set, the plugin will automatically load a node version when if finds a
[`.nvmrc` file](https://github.com/nvm-sh/nvm#nvmrc) in the current working directory indicating which node
version to load. This can be done, similar as previous options, adding:
```zsh
zstyle ':omz:plugins:nvm' autoload yes
```
To remove the output generated by NVM when autoloading, you can set the following option:
```zsh
zstyle ':omz:plugins:nvm' silent-autoload yes
```
Note: _this will not remove regular `nvm` output_

34
zsh/nvm/_nvm Normal file
View File

@ -0,0 +1,34 @@
#compdef nvm
#autoload
[[ -f "$NVM_DIR/nvm.sh" ]] || return 0
local -a _1st_arguments
_1st_arguments=(
'help:show help'
'--version:print out the latest released version of nvm'
'install:download and install a version in <node|iojs|node version number>'
'install-latest-npm:download and install the latest npm version'
'uninstall:uninstall a version'
'use:modify PATH to use <version>. Uses .nvmrc if available'
'exec:run <command> on <version>. Uses .nvmrc if available'
'run:run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
'current:list installed versions'
'ls:list installed versions or versions matching a given description'
'version:resolve the given description to a single local version'
'version-remote:resolve the given description to a single remote version'
'ls-remote:list remote versions available for install'
'deactivate:undo effects of `nvm` on current shell'
'alias:show or set aliases'
'unalias:deletes an alias'
'reinstall-packages:reinstall global `npm` packages contained in <version> to current version'
'unload:unload `nvm` from shell'
'which:display path to installed node version. Uses .nvmrc if available'
)
_arguments -C '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "nvm subcommand" _1st_arguments
return
fi

105
zsh/nvm/nvm.plugin.zsh Normal file
View File

@ -0,0 +1,105 @@
# See https://github.com/nvm-sh/nvm#installation-and-update
if [[ -z "$NVM_DIR" ]]; then
if [[ -d "$HOME/.nvm" ]]; then
export NVM_DIR="$HOME/.nvm"
elif [[ -d "${XDG_CONFIG_HOME:-$HOME/.config}/nvm" ]]; then
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvm"
elif (( $+commands[brew] )); then
NVM_HOMEBREW="${NVM_HOMEBREW:-${HOMEBREW_PREFIX:-$(brew --prefix)}/opt/nvm}"
if [[ -d "$NVM_HOMEBREW" ]]; then
export NVM_DIR="$NVM_HOMEBREW"
fi
fi
fi
# Don't try to load nvm if command already available
# Note: nvm is a function so we need to use `which`
which nvm &>/dev/null && return
# TODO: 2022-11-11: Remove soft-deprecate options
if (( ${+NVM_LAZY} + ${+NVM_LAZY_CMD} + ${+NVM_AUTOLOAD} )); then
# Get list of NVM_* variable settings defined
local -a used_vars
used_vars=(${(o)parameters[(I)NVM_(AUTOLOAD|LAZY|LAZY_CMD)]})
# Nicely print the list in the style `var1, var2 and var3`
echo "${fg[yellow]}[nvm plugin] Variable-style settings are deprecated. Instead of ${(j:, :)used_vars[1,-2]}${used_vars[-2]+ and }${used_vars[-1]}, use:\n"
if (( $+NVM_AUTOLOAD )); then
echo " zstyle ':omz:plugins:nvm' autoload yes"
zstyle ':omz:plugins:nvm' autoload yes
fi
if (( $+NVM_LAZY )); then
echo " zstyle ':omz:plugins:nvm' lazy yes"
zstyle ':omz:plugins:nvm' lazy yes
fi
if (( $+NVM_LAZY_CMD )); then
echo " zstyle ':omz:plugins:nvm' lazy-cmd $NVM_LAZY_CMD"
zstyle ':omz:plugins:nvm' lazy-cmd $NVM_LAZY_CMD
fi
echo "$reset_color"
unset used_vars NVM_AUTOLOAD NVM_LAZY NVM_LAZY_CMD
fi
if zstyle -t ':omz:plugins:nvm' lazy; then
# Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd
zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
eval "
function nvm node npm pnpm yarn $nvm_lazy_cmd {
unfunction nvm node npm pnpm yarn $nvm_lazy_cmd
# Load nvm if it exists in \$NVM_DIR
[[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
\"\$0\" \"\$@\"
}
"
unset nvm_lazy_cmd
elif [[ -f "$NVM_DIR/nvm.sh" ]]; then
# Load nvm if it exists in $NVM_DIR
source "$NVM_DIR/nvm.sh"
else
return
fi
# Autoload nvm when finding a .nvmrc file in the current directory
# Adapted from: https://github.com/nvm-sh/nvm#zsh
if zstyle -t ':omz:plugins:nvm' autoload; then
function load-nvmrc {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
local nvm_silent=""
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
if [[ -n "$nvmrc_path" ]]; then
local nvmrc_node_version=$(nvm version $(cat "$nvmrc_path" | tr -dc '[:print:]'))
if [[ "$nvmrc_node_version" = "N/A" ]]; then
nvm install
elif [[ "$nvmrc_node_version" != "$node_version" ]]; then
nvm use $nvm_silent
fi
elif [[ "$node_version" != "$(nvm version default)" ]]; then
if [[ -z $nvm_silent ]]; then
echo "Reverting to nvm default version"
fi
nvm use default $nvm_silent
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd load-nvmrc
load-nvmrc
fi
# Load nvm bash completion
for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
if [[ -f "$nvm_completion" ]]; then
# Load bashcompinit
autoload -U +X bashcompinit && bashcompinit
# Bypass compinit call in nvm bash completion script. See:
# https://github.com/nvm-sh/nvm/blob/4436638/bash_completion#L86-L93
ZSH_VERSION= source "$nvm_completion"
break
fi
done
unset NVM_HOMEBREW nvm_completion

1
zsh/ohmyzsh Submodule

@ -0,0 +1 @@
Subproject commit 00241073105643874531e1826b7df6d2cb3cadfb