diff options
| -rwxr-xr-x | mut/bin/lfub | 13 | ||||
| -rwxr-xr-x | mut/bin/rotdir | 12 | ||||
| -rwxr-xr-x | mut/bin/vremote | 50 | ||||
| m--------- | mut/dwm | 0 | ||||
| -rwxr-xr-x | mut/lf/cleaner | 6 | ||||
| -rwxr-xr-x | mut/lf/scope | 2 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/init.fnl | 6 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/oil.fnl | 3 | ||||
| m--------- | mut/st | 0 | ||||
| -rw-r--r-- | overlays/suckless.nix | 10 | ||||
| -rw-r--r-- | profiles/core/configuration.nix | 2 | ||||
| -rw-r--r-- | profiles/core/home.nix | 29 | ||||
| -rw-r--r-- | profiles/core/lf.nix | 2 | ||||
| -rw-r--r-- | profiles/station/packages.nix | 6 |
14 files changed, 90 insertions, 51 deletions
diff --git a/mut/bin/lfub b/mut/bin/lfub index 894ffde..ffcb52a 100755 --- a/mut/bin/lfub +++ b/mut/bin/lfub @@ -3,7 +3,6 @@ # This is a wrapper script for lb that allows it to create image previews with # ueberzug. This works in concert with the lf configuration file and the # lf-cleaner script. - set -e cleanup() { @@ -11,4 +10,14 @@ cleanup() { rm "$FIFO_UEBERZUG" } -lf "$@" +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi diff --git a/mut/bin/rotdir b/mut/bin/rotdir new file mode 100755 index 0000000..d171f29 --- /dev/null +++ b/mut/bin/rotdir @@ -0,0 +1,12 @@ +#!/bin/sh + +# When I open an image from the file manager in nsxiv (the image viewer), I want +# to be able to press the next/previous keys to key through the rest of the +# images in the same directory. This script "rotates" the content of a +# directory based on the first chosen file, so that if I open the 15th image, +# if I press next, it will go to the 16th etc. Autistic, I know, but this is +# one of the reasons that nsxiv is great for being able to read standard input. + +[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 +base="$(basename "$1")" +ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }' diff --git a/mut/bin/vremote b/mut/bin/vremote index 75b404e..4d0d417 100755 --- a/mut/bin/vremote +++ b/mut/bin/vremote @@ -3,31 +3,39 @@ if [ -z "$PATH" ]; then PATH="/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/usr/bin:/bin" fi server_pipe="$XDG_CACHE_HOME/nvim/server.pipe" +if ! [ -e "$server_pipe" ]; then + nohup nvim --listen "$server_pipe" --headless >/dev/null 2>&1 & +fi + ( - if ! [ -e "$server_pipe" ]; then - nohup nvim --listen "$server_pipe" --headless >/dev/null 2>&1 & + file_names=() + if [ -n "$1" ]; then + for file_name in "${@}"; do + if [[ "${file_name:0:1}" == / || "${file_name:0:2}" == ~[/a-zA-Z0-9] ]] + then + file_names+=("$file_name") + else + file_names+=("${PWD}/$file_name") + fi + done + echo "got file_names: ${file_names[*]}" fi - if nvim --headless --server ~/.cache/nvim/server.pipe --remote-expr 'luaeval("vim.json.encode(vim.iter(vim.api.nvim_list_uis()):map(function(v) return v.chan end):totable())")' \ - | jq -r '.[]' \ - | while read -r chan; do - osascript -e 'display notification "already existing ui('"$chan"')..." with title "vremote"' - exit 1 - done + if ! nvim \ + --headless \ + --server ~/.cache/nvim/server.pipe \ + --remote-expr 'luaeval("vim.json.encode(vim.iter(vim.api.nvim_list_uis()):map(function(v) return v.chan end):totable())")' \ + | jq -er '.[]' then - if [ -n "$1" ]; then - file_names=() - for file_name in "${@}"; do - if [[ "${file_name:0:1}" == / || "${file_name:0:2}" == ~[/a-zA-Z0-9] ]] - then - file_names+=("$file_name") - else - file_names+=("${PWD}/$file_name") - fi - done - echo "got file_names: ${file_names[*]}" - nvim --server "$server_pipe" --remote "${file_names[@]}" >/dev/tty - fi + nvim --server "$server_pipe" --remote "${file_names[@]}" >/dev/tty exec nvim --server "$server_pipe" --remote-ui >/dev/tty + else + if ! command -v osascript >/dev/null 2>&1; then + notify-send "already existing ui +starting new nvim instance" + else + osascript -e 'display notification "already existing ui..." with title "vremote"' + fi + exec nvim "${file_names[@]}" >/dev/tty </dev/tty fi ) > ~/vremote_logs 2>&1 diff --git a/mut/dwm b/mut/dwm -Subproject 2133b7633e0ebaa6ee07bac9dd49016d84889b2 +Subproject 04c767c276cf4bbdd9bfdb6d2e8e05a1ca2909a diff --git a/mut/lf/cleaner b/mut/lf/cleaner index 1b18195..9513d38 100755 --- a/mut/lf/cleaner +++ b/mut/lf/cleaner @@ -1,2 +1,6 @@ #!/bin/sh -exec kitten icat --clear --stdin no --transfer-mode file < /dev/null > /dev/tty +if [ -n "$FIFO_UEBERZUG" ]; then + printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" +else + exec kitten icat --clear --stdin no --transfer-mode file < /dev/null > /dev/tty +fi diff --git a/mut/lf/scope b/mut/lf/scope index 5571d42..57c0ed9 100755 --- a/mut/lf/scope +++ b/mut/lf/scope @@ -8,6 +8,8 @@ IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" image() { if [ -f "$1" ] && command -V kitten >/dev/null 2>&1; then kitten icat --transfer-mode file --stdin no --place "${2}x${3}@${4}x${5}" "$1" < /dev/null > /dev/tty + elif [ -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 diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl index 3e39450..05fbdac 100644 --- a/mut/neovim/fnl/conf/init.fnl +++ b/mut/neovim/fnl/conf/init.fnl @@ -115,6 +115,10 @@ :path "~/Sync/my/notes"}]})) +(do + (local fzf (require "fzf-lua")) + ((. fzf "register_ui_select"))) + (vim.api.nvim_create_user_command :NixEdit (fn [{: args}] @@ -122,8 +126,6 @@ (vim.cmd (.. "e " (f:read)))) {:nargs 1}) -;; I like to use the qf to run a lot of stuff that prints junk -;; Here I just check if ansi control stuff is printed and reparse the lines with efm (local qf (fn [{: id : title}] (fn [lines] diff --git a/mut/neovim/fnl/conf/pkgs/oil.fnl b/mut/neovim/fnl/conf/pkgs/oil.fnl index 7845b79..284b8bd 100644 --- a/mut/neovim/fnl/conf/pkgs/oil.fnl +++ b/mut/neovim/fnl/conf/pkgs/oil.fnl @@ -1,4 +1,5 @@ (local oil (require :oil)) +(local fzf (require :fzf-lua)) (oil.setup { @@ -22,7 +23,7 @@ "<C-s>" "actions.select_vsplit" "<C-h>" "actions.select_split" "<C-t>" "actions.select_tab" - "<C-p>" "actions.preview" + "<C-p>" #(fzf.files) "<C-c>" "actions.close" "<C-l>" "actions.refresh" "." "actions.open_cmdline" diff --git a/mut/st b/mut/st -Subproject e0b285014d599ac4ee60f5d905884d8c6bb85ad +Subproject d0cddd9c9e004f794c3bc5d63b1bf1ef7d964ef diff --git a/overlays/suckless.nix b/overlays/suckless.nix index 89280e5..c92cb70 100644 --- a/overlays/suckless.nix +++ b/overlays/suckless.nix @@ -1,14 +1,14 @@ {pkgs, home, ...}: (final: prev: { - st = (prev.st.overrideAttrs (oldAttrs: rec { + st = (prev.st.overrideAttrs (oldAttrs: { src = /. + home + "/flake/mut/st"; - version = "0.3.0"; + version = "0.3.1"; buildInputs = oldAttrs.buildInputs ++ [prev.harfbuzz]; })); - dwm = (prev.dwm.overrideAttrs (oldAttrs: rec { + dwm = (prev.dwm.overrideAttrs (oldAttrs: { src = /. + home + "/flake/mut/dwm"; - version = "0.1.3"; + version = "0.1.4"; })); - dwmblocks =(prev.stdenv.mkDerivation rec { + dwmblocks =(prev.stdenv.mkDerivation { pname = "dwmblocks"; version = "1.1.3"; src = /. + home + "/flake/mut/dwmblocks"; diff --git a/profiles/core/configuration.nix b/profiles/core/configuration.nix index 51e2f91..bfebed3 100644 --- a/profiles/core/configuration.nix +++ b/profiles/core/configuration.nix @@ -32,7 +32,7 @@ uid = mkIf (!machine.isDarwin) 1000; description = ivi.realName; openssh.authorizedKeys.keys = ivi.sshKeys; - extraGroups = ["wheel" "networkmanager" "docker" "transmission"]; + extraGroups = ["wheel" "networkmanager" "docker" "transmission" "dialout"]; isNormalUser = true; }; root = { diff --git a/profiles/core/home.nix b/profiles/core/home.nix index 5238800..f535e57 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -40,8 +40,11 @@ ''; in { enable = true; + } // (if machine.isDarwin then { + tmuxConfig = cfg; + } else { extraConfig = cfg; - }; + }); hm = { fonts.fontconfig.enable = true; @@ -120,15 +123,12 @@ zsh = { enable = true; completionInit = '' - if type brew &>/dev/null; then - FPATH="$(brew --prefix)/share/zsh/site-functions:''${FPATH}" - fi - autoload -U compinit select-word-style select-word-style - select-word-style bash - zstyle ':completion:*' menu select - zmodload zsh/complist - compinit - _comp_options+=(globdots) # Include hidden files. + autoload -U compinit select-word-style select-word-style + select-word-style bash + zstyle ':completion:*' menu select + zmodload zsh/complist + compinit + _comp_options+=(globdots) # Include hidden files. ''; initExtra = '' # Use vim keys in tab complete menu: @@ -136,15 +136,14 @@ 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 -M menuselect 'n' vi-forward-blank-word - bindkey -M menuselect 'p' vi-backward-blank-word + set -o emacs # 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 EXIT' HUP INT QUIT TERM EXIT - EDITOR=vremote lf -last-dir-path="$tmp" "$@" + EDITOR=vremote lfub -last-dir-path="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" @@ -174,6 +173,7 @@ ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk ''; shellAliases = { + open = "xdg-open "; k9s = "k9s "; k = "kubectl "; d = "docker "; @@ -276,8 +276,7 @@ enableSshSupport = false; defaultCacheTtl = 34550000; maxCacheTtl = 34550000; - # pinentryFlavor = "gtk2"; - pinentryPackage = pkgs.pinentry-gtk2; + pinentryFlavor = "gtk2"; }; }; } diff --git a/profiles/core/lf.nix b/profiles/core/lf.nix index 5e1474c..2fb11f6 100644 --- a/profiles/core/lf.nix +++ b/profiles/core/lf.nix @@ -1,5 +1,5 @@ {pkgs,config,...}: { - hm.home.packages = [pkgs.ueberzug pkgs.lf]; + hm.home.packages = [pkgs.ueberzugpp pkgs.lf pkgs.nsxiv]; hm.xdg.configFile = { # "lf/cleaner".source = config.lib.meta.mkMutableSymlink /mut/lf/cleaner; # "lf/scope".source = config.lib.meta.mkMutableSymlink /mut/lf/scope; diff --git a/profiles/station/packages.nix b/profiles/station/packages.nix index 4d16657..7a3c0fb 100644 --- a/profiles/station/packages.nix +++ b/profiles/station/packages.nix @@ -12,6 +12,9 @@ bashInteractive powershell + arduino-ide + arduino-cli + k9s krew azure-cli @@ -21,16 +24,15 @@ ])) imagemagick ] ++ (optionals (!machine.isDarwin) [ + xdotool pywal dasel - ueberzug inotify-tools raylib maim profanity mypaint lynx - sxiv sent initool dmenu |
