This commit is contained in:
Ray Andrew 2025-06-16 13:27:32 -07:00
parent 8132ea8455
commit a68acb47f2
Signed by: rayandrew
SSH key fingerprint: SHA256:XYrYrxF0Z3A72n8P/p6mqPRNQZT22F88XcLsG+kX4xw
6 changed files with 173 additions and 29 deletions

View file

@ -42,6 +42,9 @@
fontconfig
pandoc
duckdb
(pkgs.python311.withPackages (ppkgs: [
ppkgs.numpy
]))
]
++ lib.optionals pkgs.stdenv.isDarwin [ coreutils ]
++ (lib.attrValues config.custom.shell.packages);

View file

@ -34,39 +34,39 @@
macos-option-as-alt = left
# theme = gruber-darker
# theme = xcodelighthc
theme = zenburned
# theme = zenburned
# font-family = Iosevka Nerd Font Mono
# font-size = 13
# # background = #062329
# background = #072626
# # foreground = #d1b897
# foreground = #d3b58d
# cursor-color = #ffffff
# # cursor-text = #d1b897
# cursor-text = #d3b58d
# # selection-background = #0000ff
# # selection-foreground = #d1b897
# background = #062329
background = #072626
# foreground = #d1b897
foreground = #d3b58d
cursor-color = #ffffff
# cursor-text = #d1b897
cursor-text = #d3b58d
# selection-background = #0000ff
# selection-foreground = #d3b58d
# # palette = 0=#062329
# palette = 0=#072626
# # palette = 1=#0b3335
# # palette = 2=#0000ff
# palette = 3=#44b340
# palette = 4=#8cde94
# # palette = 5=#d1b897
# palette = 5=#d3b58d
# palette = 6=#c1d1e3
# palette = 7=#ffffff
# palette = 8=#626880
# palette = 9=#e67172
# palette = 10=#8ec772
# palette = 11=#d9ba73
# palette = 12=#7b9ef0
# palette = 13=#f2a4db
# palette = 14=#5abfb5
# palette = 15=#b5bfe2
# selection-foreground = #d1b897
selection-background = #0000ff
selection-foreground = #d3b58d
# palette = 0=#062329
palette = 0=#072626
# palette = 1=#0b3335
# palette = 2=#0000ff
palette = 3=#44b340
palette = 4=#8cde94
# palette = 5=#d1b897
palette = 5=#d3b58d
palette = 6=#c1d1e3
palette = 7=#ffffff
palette = 8=#626880
palette = 9=#e67172
palette = 10=#8ec772
palette = 11=#d9ba73
palette = 12=#7b9ef0
palette = 13=#f2a4db
palette = 14=#5abfb5
palette = 15=#b5bfe2
keybind = all:ctrl+shift+period=text:\x1b\x1f\x4c\x23\x1f
'';

117
home/shell/bin/cb Executable file
View file

@ -0,0 +1,117 @@
#!/bin/bash
# from: https://gist.github.com/RichardBronosky/56d8f614fab2bacdd8b048fb58d0c0c7
LINUX_copy() {
cat | xclip -selection clipboard
}
LINUX_paste() {
xclip -selection clipboard -o
}
WSL_copy() {
cat | /mnt/c/Windows/System32/clip.exe
}
WSL_paste() {
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe Get-Clipboard | sed 's/\r//'
}
CYGWIN_copy() {
cat > /dev/clipboard
}
CYGWIN_paste() {
cat /dev/clipboard
}
MAC_copy() {
cat | pbcopy
}
MAC_paste() {
pbpaste
}
stdin_is_a_pipe() {
[[ -p /dev/stdin ]]
}
stdin_is_a_tty() {
[[ -t 0 ]]
}
stdin_is_pipe_like() {
stdin_is_a_pipe || ! stdin_is_a_tty
}
stdout_is_pipe_like() {
! stdout_is_a_tty # meaning # it must be a pipe or redirection
}
stdout_is_a_tty() {
[[ -t 1 ]]
}
requested_open_ended() {
[[ "${args[0]:-}" == "-" ]]
}
requested_test_suite() {
[[ "${args[0]:-}" == "--test" ]]
}
enable_tee_like_chaining() {
# see `man tee`
if stdout_is_pipe_like; then
${os}_paste
elif requested_open_ended; then
${os}_paste
echo
fi
}
prevent_prompt_from_being_on_the_same_line() {
if stdout_is_a_tty; then # we don't have to be strict about not altering the output
echo
fi
}
detect_os() {
if [[ -f /proc/version ]] && grep -iq Microsoft /proc/version; then
printf WSL
else
case "$(uname -s)" in
Linux*) printf LINUX;;
Darwin*) printf MAC;;
CYGWIN*) printf CYGWIN;;
esac
fi
}
function debug() {
stdin_is_a_pipe && echo "stdin_is_a_pipe: 1" >> /tmp/ono || echo "stdin_is_a_pipe: 0" >> /tmp/ono
stdin_is_a_tty && echo "stdin_is_a_tty: 1" >> /tmp/ono || echo "stdin_is_a_tty: 0" >> /tmp/ono
stdin_is_pipe_like && echo "stdin_is_pipe_like: 1" >> /tmp/ono || echo "stdin_is_pipe_like: 0" >> /tmp/ono
stdout_is_pipe_like && echo "stdout_is_pipe_like: 1" >> /tmp/ono || echo "stdout_is_pipe_like: 0" >> /tmp/ono
stdout_is_a_tty && echo "stdout_is_a_tty: 1" >> /tmp/ono || echo "stdout_is_a_tty: 0" >> /tmp/ono
echo >> /tmp/ono
}
main() {
os="$(detect_os)"
if stdin_is_pipe_like; then
${os}_copy
enable_tee_like_chaining
else # stdin is not pipe-like
${os}_paste
prevent_prompt_from_being_on_the_same_line
fi
}
args=("$@")
[[ ${DEBUG:-} == 1 ]] && debug
main

12
home/shell/bin/clear-pbcopy Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
sleepsec=10
if [ $# == 1 ]; then
sleepsec=$1
fi
sleep $sleepsec
pbcopy < /dev/null

3
home/shell/bin/e Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
emacs -nw $@

9
home/shell/bin/x-open Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
if [ "$(uname)" == "Darwin" ]; then
open $@
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
xdg-open $@
else
echo "Platform Not supported"
fi