From a68acb47f2e81738bfb525c4f6004807bc6e8144 Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Mon, 16 Jun 2025 13:27:32 -0700 Subject: [PATCH] update --- home/default.nix | 3 + home/ghostty.nix | 58 +++++++++--------- home/shell/bin/cb | 117 ++++++++++++++++++++++++++++++++++++ home/shell/bin/clear-pbcopy | 12 ++++ home/shell/bin/e | 3 + home/shell/bin/x-open | 9 +++ 6 files changed, 173 insertions(+), 29 deletions(-) create mode 100755 home/shell/bin/cb create mode 100755 home/shell/bin/clear-pbcopy create mode 100755 home/shell/bin/e create mode 100755 home/shell/bin/x-open diff --git a/home/default.nix b/home/default.nix index e7c9ea6..13cc09b 100644 --- a/home/default.nix +++ b/home/default.nix @@ -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); diff --git a/home/ghostty.nix b/home/ghostty.nix index 3dfa6c1..b21e8c6 100644 --- a/home/ghostty.nix +++ b/home/ghostty.nix @@ -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 ''; diff --git a/home/shell/bin/cb b/home/shell/bin/cb new file mode 100755 index 0000000..79917e0 --- /dev/null +++ b/home/shell/bin/cb @@ -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 diff --git a/home/shell/bin/clear-pbcopy b/home/shell/bin/clear-pbcopy new file mode 100755 index 0000000..779a79f --- /dev/null +++ b/home/shell/bin/clear-pbcopy @@ -0,0 +1,12 @@ +#!/bin/sh + +sleepsec=10 + +if [ $# == 1 ]; then + sleepsec=$1 +fi + + +sleep $sleepsec +pbcopy < /dev/null + diff --git a/home/shell/bin/e b/home/shell/bin/e new file mode 100755 index 0000000..ecb09dc --- /dev/null +++ b/home/shell/bin/e @@ -0,0 +1,3 @@ +#!/bin/sh + +emacs -nw $@ diff --git a/home/shell/bin/x-open b/home/shell/bin/x-open new file mode 100755 index 0000000..e35b7d1 --- /dev/null +++ b/home/shell/bin/x-open @@ -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