From 30fb0e5959ad23aa2770079d051f7858700284e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 4 Apr 2026 18:11:38 +0200 Subject: [PATCH] complete new config --- .tmux.conf | 19 +- .zshrc | 30 ++- ghostty/config.ghostty | 12 + ghostty/themes/catppuccin-machiato.conf | 23 ++ laio/_default.yaml | 33 +++ laio/iron-thread.yaml | 28 ++ lazygit/config.yml | 28 ++ lazygit/teal.yml | 1 + sway/config | 3 +- sway/config.d/20-idle.conf | 15 +- sway/config.d/20-workspace.conf | 10 + swaync/config.json | 96 +++++++ swaync/style.css | 330 ++++++++++++++++++++++++ swaync/style.css.old | 308 ++++++++++++++++++++++ yazi/package.toml | 7 + yazi/plugins/piper.yazi/LICENSE | 21 ++ yazi/plugins/piper.yazi/README.md | 102 ++++++++ yazi/plugins/piper.yazi/main.lua | 70 +++++ yazi/yazi.toml | 15 ++ 19 files changed, 1144 insertions(+), 7 deletions(-) create mode 100644 ghostty/config.ghostty create mode 100644 ghostty/themes/catppuccin-machiato.conf create mode 100644 laio/_default.yaml create mode 100644 laio/iron-thread.yaml create mode 100644 lazygit/config.yml create mode 120000 lazygit/teal.yml create mode 100644 swaync/config.json create mode 100644 swaync/style.css create mode 100644 swaync/style.css.old create mode 100644 yazi/package.toml create mode 100644 yazi/plugins/piper.yazi/LICENSE create mode 100644 yazi/plugins/piper.yazi/README.md create mode 100644 yazi/plugins/piper.yazi/main.lua create mode 100644 yazi/yazi.toml diff --git a/.tmux.conf b/.tmux.conf index e86c1b5..fcf54c7 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -4,16 +4,31 @@ set -g set-titles on set -g set-titles-string '#{session_name}: #{window_name}' # List of plugins +set -g @plugin 'catppuccin/tmux#v2.1.3' set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'catppuccin/tmux' +set -g @plugin 'omerxx/tmux-floax' +# set -g @plugin 'niksingh710/minimal-tmux-status' +# Einstellungen für den Zen-Look: +# set -g @minimal-tmux-justify "left" +# set -g @minimal-tmux-indicator false +# set -g @minimal-tmux-status "bottom" # oder "top" # Other examples: # set -g @plugin 'github_username/plugin_name' # set -g @plugin 'github_username/plugin_name#branch' # set -g @plugin 'git@github.com:user/plugin' # set -g @plugin 'git@bitbucket.com:user/plugin' +# Erlaubt Yazi & Neovim Bilder/Grafiken in Ghostty anzuzeigen +set -g allow-passthrough on -set -g @plugin 'catppuccin/tmux' +# Verhindert Verzögerungen beim Wechsel in den Normal-Mode in AstroNvim +set -s escape-time 0 + +# Stellt sicher, dass Ghostty die Farben korrekt darstellt +set -ag terminal-overrides ",xterm-256color:RGB" # set -g @catppuccin_flavor 'macchiato' # or frappe, macchiato, mocha set -g @catppuccin_flavor 'macchiato' # or frappe, macchiato, mocha set -g @catppuccin_window_status_style 'rounded' @@ -29,6 +44,8 @@ set -ag status-right "#{E:@catppuccin_status_user}" set -ag status-right "#{E:@catppuccin_status_session}" set -ag status-right "#{E:@catppuccin_status_host}" +# set allow-passthrough on + # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm' diff --git a/.zshrc b/.zshrc index 39afbbe..642e2eb 100644 --- a/.zshrc +++ b/.zshrc @@ -15,9 +15,9 @@ fi #export TERM="xterm-256color" # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH -export PATH=$HOME/.cargo/bin:$PATH +export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH" -export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts:$HOME/.local/bin" +export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts" # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" @@ -155,3 +155,29 @@ if [[ -z "$TMUX" ]]; then fi eval "$(direnv hook zsh)" + + +alias freecad='LD_PRELOAD=/usr/lib64/libdrm_amdgpu.so.1 /opt/FreeCAD-0.21.2-Linux-x86_64.AppImage' +export NDK_HOME=/home/crimsen/Android/Sdk/ndk/29.0.14206865 +export ANDROID_HOME=/home/crimsen/Android/Sdk +export EDITOR=nvim + + +if command -v yazi >/dev/null 2>&1; then + # Hier kommt der Code hin, der nur mit Yazi läuft + echo "Yazi gefunden! Initialisiere Aliase..." + + # Beispiel: Ein Alias, der beim Beenden von Yazi ins letzte Verzeichnis wechselt + function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + command yazi "$@" --cwd-file="$tmp" + IFS= read -r -d '' cwd < "$tmp" + [ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd" + rm -f -- "$tmp" + } +else + # Optionaler Fallback oder einfach gar nichts tun + echo "Yazi ist nicht installiert. Nutze stattdessen 'ls' oder 'cd'." +fi + +source ~/.env.secrets diff --git a/ghostty/config.ghostty b/ghostty/config.ghostty new file mode 100644 index 0000000..aaf88c7 --- /dev/null +++ b/ghostty/config.ghostty @@ -0,0 +1,12 @@ +# Font-Einstellungen (Wichtig für Icons in AstroNvim) +font-family = "Hack Nerd Font" +font-size = 11 + +# Performance & Grafik (Für Bild-Support & Geschwindigkeit) # Oder dein bevorzugtes Theme + +theme = catppuccin-machiato.conf +window-decoration = false +confirm-close-surface = false + +# Maus-Support für Neovim +mouse-hide-while-typing = true diff --git a/ghostty/themes/catppuccin-machiato.conf b/ghostty/themes/catppuccin-machiato.conf new file mode 100644 index 0000000..d685700 --- /dev/null +++ b/ghostty/themes/catppuccin-machiato.conf @@ -0,0 +1,23 @@ +palette = 0=#494d64 +palette = 1=#ed8796 +palette = 2=#a6da95 +palette = 3=#eed49f +palette = 4=#8aadf4 +palette = 5=#f5bde6 +palette = 6=#8bd5ca +palette = 7=#a5adcb +palette = 8=#5b6078 +palette = 9=#ed8796 +palette = 10=#a6da95 +palette = 11=#eed49f +palette = 12=#8aadf4 +palette = 13=#f5bde6 +palette = 14=#8bd5ca +palette = 15=#b8c0e0 +background = 24273a +foreground = cad3f5 +cursor-color = f4dbd6 +cursor-text = 181926 +selection-background = 3a3e53 +selection-foreground = cad3f5 +split-divider-color = 363a4f diff --git a/laio/_default.yaml b/laio/_default.yaml new file mode 100644 index 0000000..1870652 --- /dev/null +++ b/laio/_default.yaml @@ -0,0 +1,33 @@ +--- +name: {{ session_name }} + +startup: + - command: echo + args: + - starting {{ session_name }} session # add commands here to run on session startup + +shutdown: + - command: echo + args: + - stopping {{ session_name }} session # add commands here to run on session shutdown + +path: {{ path }} + +windows: + - name: code + flex_direction: column # panes are above one another, if ommited defaults to row where panes are side by side + panes: + - name: Editor + commands: + - command: {{ editor | default(value="nvim") }} + + - name: misc + flex_direction: row + panes: + - flex: 1 + - flex: 1 + path: . # optional relative or absolute path + flex_direction: column + panes: + - flex: 1 + - flex: 5 diff --git a/laio/iron-thread.yaml b/laio/iron-thread.yaml new file mode 100644 index 0000000..373d821 --- /dev/null +++ b/laio/iron-thread.yaml @@ -0,0 +1,28 @@ +--- +name: iron-thread + +startup: + - command: echo + args: + - starting iron-thread session # add commands here to run on session startup + +shutdown: + - command: echo + args: + - stopping iron-thread session # add commands here to run on session shutdown + +path: /home/crimsen/git/iron-thread/ + +windows: + - name: editor + flex_direction: column # panes are above one another, if ommited defaults to row where panes are side by side + panes: + - name: Editor + commands: + - command: nvim + + - name: env_starter + flex_direction: column + panes: + - commands: + - command: cargo tauri android dev diff --git a/lazygit/config.yml b/lazygit/config.yml new file mode 100644 index 0000000..a28f32c --- /dev/null +++ b/lazygit/config.yml @@ -0,0 +1,28 @@ +gui: + nerdFontsVersion: "3" + theme: + activeBorderColor: + - "#8bd5ca" + - bold + inactiveBorderColor: + - "#a5adcb" + optionsTextColor: + - "#8aadf4" + selectedLineBgColor: + - "#363a4f" + cherryPickedCommitBgColor: + - "#494d64" + cherryPickedCommitFgColor: + - "#8bd5ca" + unstagedChangesColor: + - "#ed8796" + defaultFgColor: + - "#cad3f5" + searchingActiveBorderColor: + - "#eed49f" + authorColors: + "*": "#b7bdf8" + +git: + pagers: + - pager: delta --dark --paging=never diff --git a/lazygit/teal.yml b/lazygit/teal.yml new file mode 120000 index 0000000..4b5d2fc --- /dev/null +++ b/lazygit/teal.yml @@ -0,0 +1 @@ +/home/crimsen/git/lazygit/themes-mergable/macchiato/teal.yml \ No newline at end of file diff --git a/sway/config b/sway/config index 83e812c..aed3673 100644 --- a/sway/config +++ b/sway/config @@ -15,7 +15,8 @@ set $down n set $up r set $right t # Your preferred terminal emulator -set $term alacritty +#set $term alacritty +set $term $HOME/.local/bin/ghostty # Your preferred application launcher # Note: pass the final command to swaymsg so that the resulting window can be opened # on the original workspace that the command was run on. diff --git a/sway/config.d/20-idle.conf b/sway/config.d/20-idle.conf index c5d3ac8..5863c74 100644 --- a/sway/config.d/20-idle.conf +++ b/sway/config.d/20-idle.conf @@ -12,14 +12,23 @@ # resumed. It will also lock your screen before your computer goes to sleep. # Definiere den Lock-Befehl (falls noch nicht geschehen) -set $lock_cmd swaylock --screenshots --clock --indicator --indicator-radius 120 --indicator-thickness 10 --ignore-empty-password --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.3 --ring-color 8bd5ca --key-hl-color 91d7e3 --text-color cad3f5 --line-color 00000000 --inside-color 24273a88 --separator-color 00000000 --ring-ver-color 8aadf4 --inside-ver-color 24273a88 --ring-wrong-color ed8796 --inside-wrong-color 24273a88 --text-wrong-color ed8796 --bs-hl-color ed8796 --effect-compose "50%,25%;150x150;center;/home/crimsen/Bilder/wallpaper/logo.png" +# set $lock_cmd swaylock --screenshots --clock --indicator --indicator-radius 120 --indicator-thickness 10 --ignore-empty-password --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.3 --ring-color 8bd5ca --key-hl-color 91d7e3 --text-color cad3f5 --line-color 00000000 --inside-color 24273a88 --separator-color 00000000 --ring-ver-color 8aadf4 --inside-ver-color 24273a88 --ring-wrong-color ed8796 --inside-wrong-color 24273a88 --text-wrong-color ed8796 --bs-hl-color ed8796 --effect-compose "50%,25%;150x150;center;/home/crimsen/Bilder/wallpaper/logo.png" +# +# # Swayidle Konfiguration +# exec swayidle -w \ +# timeout 300 '$lock_cmd' \ +# timeout 600 'swaymsg "output * power off"' \ +# resume 'swaymsg "output * power on"' \ +# before-sleep '$lock_cmd' +# Ich habe pkill -0 vorne ergänzt, damit kein zweiter Lock startet +set $lock_cmd pkill -0 swaylock || swaylock -f --screenshots --clock --indicator --indicator-radius 120 --indicator-thickness 10 --ignore-empty-password --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 0 --fade-in 0.3 --ring-color 8bd5ca --key-hl-color 91d7e3 --text-color cad3f5 --line-color 00000000 --inside-color 24273a88 --separator-color 00000000 --ring-ver-color 8aadf4 --inside-ver-color 24273a88 --ring-wrong-color ed8796 --inside-wrong-color 24273a88 --text-wrong-color ed8796 --bs-hl-color ed8796 --effect-compose "50%,25%;150x150;center;/home/crimsen/Bilder/wallpaper/logo.png" --no-unlock-indicator --indicator-idle-visible # Swayidle Konfiguration exec swayidle -w \ timeout 300 '$lock_cmd' \ timeout 600 'swaymsg "output * power off"' \ resume 'swaymsg "output * power on"' \ - before-sleep '$lock_cmd' - + before-sleep '$lock_cmd' \ + after-resume 'swaymsg "output * power on"' # Shortcut zum Sperren (z.B. Mod + L) bindsym $mod+Shift+j exec $lock_cmd diff --git a/sway/config.d/20-workspace.conf b/sway/config.d/20-workspace.conf index f60f944..17c379a 100644 --- a/sway/config.d/20-workspace.conf +++ b/sway/config.d/20-workspace.conf @@ -57,5 +57,15 @@ for_window [title="Android Emulator - Pixel_9*"] resize set width 500 px # Optional: Fokus zurück auf das Terminal setzen, falls gewünscht # for_window [class="Emulator"] focus left +# 1. Standardmäßig alle Godot-Fenster auf Floating setzen +for_window [class="Godot"] floating enable + +# 2. Das Haupt-Editor-Fenster (Tiling) erzwingen +# Wir suchen nach Fenstern, die "Godot Engine" im Titel haben, +# aber NICHT den Projekt-Manager oder kleine Popups sind. +for_window [class="Godot" title="(?i).*Godot Engine.*"] floating disable + +# 3. Optional: Den Projekt-Manager gezielt floaten lassen (falls er nicht schon durch Regel 1 floatet) +for_window [class="Godot" title="Project Manager"] floating enable # ext: set ft=swayconfig diff --git a/swaync/config.json b/swaync/config.json new file mode 100644 index 0000000..b1974f9 --- /dev/null +++ b/swaync/config.json @@ -0,0 +1,96 @@ +{ + "$schema": "/etc/xdg/swaync/configSchema.json", + "ignore-gtk-theme": true, + "positionX": "right", + "positionY": "top", + "layer": "overlay", + "control-center-layer": "top", + "layer-shell": true, + "layer-shell-cover-screen": true, + "cssPriority": "highest", + "control-center-margin-top": 0, + "control-center-margin-bottom": 0, + "control-center-margin-right": 0, + "control-center-margin-left": 0, + "notification-2fa-action": true, + "notification-inline-replies": false, + "notification-body-image-height": 100, + "notification-body-image-width": 200, + "timeout": 10, + "timeout-low": 5, + "timeout-critical": 0, + "fit-to-screen": true, + "relative-timestamps": true, + "control-center-width": 500, + "control-center-height": 600, + "notification-window-width": 500, + "keyboard-shortcuts": true, + "notification-grouping": true, + "image-visibility": "when-available", + "transition-time": 200, + "hide-on-clear": false, + "hide-on-action": true, + "text-empty": "No Notifications", + "script-fail-notify": true, + "scripts": { + "example-script": { + "exec": "echo 'Do something...'", + "urgency": "Normal" + }, + "example-action-script": { + "exec": "echo 'Do something actionable!'", + "urgency": "Normal", + "run-on": "action" + } + }, + "notification-visibility": { + "example-name": { + "state": "muted", + "urgency": "Low", + "app-name": "Spotify" + } + }, + "widgets": [ + "inhibitors", + "title", + "dnd", + "notifications" + ], + "widget-config": { + "inhibitors": { + "text": "Inhibitors", + "button-text": "Clear All", + "clear-all-button": true + }, + "title": { + "text": "Notifications", + "clear-all-button": true, + "button-text": "Clear All" + }, + "dnd": { + "text": "Do Not Disturb" + }, + "label": { + "max-lines": 5, + "text": "Label Text" + }, + "mpris": { + "blacklist": [], + "autohide": false, + "show-album-art": "always", + "loop-carousel": false + }, + "buttons-grid": { + "buttons-per-row": 7, + "actions": [ + { + "label": "直", + "type": "toggle", + "active": true, + "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && nmcli radio wifi on || nmcli radio wifi off'", + "update-command": "sh -c '[[ $(nmcli radio wifi) == \"enabled\" ]] && echo true || echo false'" + } + ] + } + } +} diff --git a/swaync/style.css b/swaync/style.css new file mode 100644 index 0000000..362f9f8 --- /dev/null +++ b/swaync/style.css @@ -0,0 +1,330 @@ +* { + all: unset; + font-size: 14px; + font-family: "Hack Nerd Font"; + transition: 200ms; +} + +trough highlight { + background: #cad3f5; +} + +scale { + margin: 0 7px; +} + +scale trough { + margin: 0rem 1rem; + min-height: 8px; + min-width: 70px; + border-radius: 12.6px; +} + +trough slider { + margin: -10px; + border-radius: 12.6px; + box-shadow: 0 0 2px rgba(0, 0, 0, 0.8); + transition: all 0.2s ease; + background-color: #8aadf4; +} + +trough slider:hover { + box-shadow: + 0 0 2px rgba(0, 0, 0, 0.8), + 0 0 8px #8aadf4; +} + +trough { + background-color: #363a4f; +} + +/* notifications */ +.notification-background { + box-shadow: + 0 0 8px 0 rgba(0, 0, 0, 0.8), + inset 0 0 0 1px #494d64; + border-radius: 12.6px; + margin: 18px; + background: #1e2030; + color: #cad3f5; + padding: 0; +} + +.notification-background .notification { + padding: 7px; + border-radius: 12.6px; +} + +.notification-background .notification.critical { + box-shadow: inset 0 0 7px 0 #ed8796; +} + +.notification .notification-content { + margin: 7px; +} + +.notification .notification-content overlay { + /* icons */ + margin: 4px; +} + +.notification-content .summary { + color: #cad3f5; +} + +.notification-content .time { + color: #a5adcb; +} + +.notification-content .body { + color: #b8c0e0; +} + +.notification > *:last-child > * { + min-height: 3.4em; +} + +.notification-background .close-button { + margin: 7px; + padding: 2px; + border-radius: 6.3px; + color: #24273a; + background-color: #ed8796; +} + +.notification-background .close-button:hover { + background-color: #ee99a0; +} + +.notification-background .close-button:active { + background-color: #f5bde6; +} + +.notification .notification-action { + border-radius: 7px; + color: #cad3f5; + box-shadow: inset 0 0 0 1px #494d64; + margin: 4px; + padding: 8px; + font-size: 0.2rem; /* controls the button size not text size*/ +} + +.notification .notification-action { + background-color: #363a4f; +} + +.notification .notification-action:hover { + background-color: #494d64; +} + +.notification .notification-action:active { + background-color: #5b6078; +} + +.notification.critical progress { + background-color: #ed8796; +} + +.notification.low progress, +.notification.normal progress { + background-color: #8aadf4; +} + +.notification progress, +.notification trough, +.notification progressbar { + border-radius: 12.6px; + padding: 3px 0; +} + +/* control center */ +.control-center { + box-shadow: + 0 0 8px 0 rgba(0, 0, 0, 0.8), + inset 0 0 0 1px #363a4f; + border-radius: 12.6px; + background-color: #24273a; + color: #cad3f5; + padding: 14px; +} + +.control-center .notification-background { + border-radius: 7px; + box-shadow: inset 0 0 0 1px #494d64; + margin: 4px 10px; +} + +.control-center .notification-background .notification { + border-radius: 7px; +} + +.control-center .notification-background .notification.low { + opacity: 0.8; +} + +.control-center .widget-title > label { + color: #cad3f5; + font-size: 1.3em; +} + +.control-center .widget-title button { + border-radius: 7px; + color: #cad3f5; + background-color: #363a4f; + box-shadow: inset 0 0 0 1px #494d64; + padding: 8px; +} + +.control-center .widget-title button:hover { + background-color: #494d64; +} + +.control-center .widget-title button:active { + background-color: #5b6078; +} + +.control-center .notification-group { + margin-top: 10px; +} + +scrollbar slider { + margin: -3px; + opacity: 0.8; +} + +scrollbar trough { + margin: 2px 0; +} + +/* dnd */ +.widget-dnd { + margin-top: 5px; + border-radius: 8px; + font-size: 1.1rem; +} + +.widget-dnd > switch { + font-size: initial; + border-radius: 8px; + background: #363a4f; + box-shadow: none; +} + +.widget-dnd > switch:checked { + background: #8aadf4; +} + +.widget-dnd > switch slider { + background: #494d64; + border-radius: 8px; +} + +/* mpris */ +.widget-mpris-player { + background: #363a4f; + border-radius: 12.6px; + color: #cdd6f4; +} + +.mpris-overlay { + background-color: #363a4f; + opacity: 0.9; + padding: 15px 10px; +} + +.widget-mpris-album-art { + -gtk-icon-size: 100px; + border-radius: 12.6px; + margin: 0 10px; +} + +.widget-mpris-title { + font-size: 1.2rem; + color: #cad3f5; +} + +.widget-mpris-subtitle { + font-size: 1rem; + color: #b8c0e0; +} + +.widget-mpris button { + border-radius: 12.6px; + color: #cad3f5; + margin: 0 5px; + padding: 2px; +} + +.widget-mpris button image { + -gtk-icon-size: 1.8rem; +} + +.widget-mpris button:hover { + background-color: #363a4f; +} + +.widget-mpris button:active { + background-color: #494d64; +} + +.widget-mpris button:disabled { + opacity: 0.5; +} + +.widget-menubar > box > .menu-button-bar > button > label { + font-size: 3rem; + padding: 0.5rem 2rem; +} + +.widget-menubar > box > .menu-button-bar > :last-child { + color: #ed8796; +} + +.power-buttons button:hover, +.powermode-buttons button:hover, +.screenshot-buttons button:hover { + background: #363a4f; +} + +.control-center .widget-label > label { + color: #cad3f5; + font-size: 2rem; +} + +.widget-buttons-grid { + padding-top: 1rem; +} + +.widget-buttons-grid > flowbox > flowboxchild > button label { + font-size: 2.5rem; +} + +.widget-volume { + padding: 1rem 0; +} + +.widget-volume label { + color: #7dc4e4; + padding: 0 1rem; +} + +.widget-volume trough highlight { + background: #7dc4e4; +} + +.widget-backlight trough highlight { + background: #eed49f; +} + +.widget-backlight label { + font-size: 1.5rem; + color: #eed49f; +} + +.widget-backlight .KB { + padding-bottom: 1rem; +} + +.image { + padding-right: 0.5rem; +} diff --git a/swaync/style.css.old b/swaync/style.css.old new file mode 100644 index 0000000..ec5e1a6 --- /dev/null +++ b/swaync/style.css.old @@ -0,0 +1,308 @@ +* { + all: unset; + font-size: 14px; + font-family: "Hack Nerd Font"; + transition: 200ms; +} + +.floating-notifications.background .notification-row .notification-background { + box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.8), inset 0 0 0 1px #363a4f; + border-radius: 12.6px; + margin: 18px; + background-color: #24273a; + color: #cad3f5; + padding: 0; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification { + padding: 7px; + border-radius: 12.6px; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification.critical { + box-shadow: inset 0 0 7px 0 #ed8796; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content { + margin: 7px; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .summary { + color: #cad3f5; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .time { + color: #a5adcb; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .body { + color: #cad3f5; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * { + min-height: 3.4em; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action { + border-radius: 7px; + color: #cad3f5; + background-color: #363a4f; + box-shadow: inset 0 0 0 1px #494d64; + margin: 7px; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:hover { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #363a4f; + color: #cad3f5; +} + +.floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:active { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #7dc4e4; + color: #cad3f5; +} + +.floating-notifications.background + .notification-row + .notification-background + .close-button { + margin: 7px; + padding: 2px; + border-radius: 6.3px; + color: #24273a; + background-color: #ed8796; +} + +.floating-notifications.background + .notification-row + .notification-background + .close-button:hover { + background-color: #ee99a0; + color: #24273a; +} + +.floating-notifications.background + .notification-row + .notification-background + .close-button:active { + background-color: #ed8796; + color: #24273a; +} + +.control-center { + box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.8), inset 0 0 0 1px #363a4f; + border-radius: 12.6px; + margin: 18px; + background-color: #24273a; + color: #cad3f5; + padding: 14px; +} + +.control-center .widget-title { + color: #cad3f5; + font-size: 1.3em; +} + +.control-center .widget-title button { + border-radius: 7px; + color: #cad3f5; + background-color: #363a4f; + box-shadow: inset 0 0 0 1px #494d64; + padding: 8px; +} + +.control-center .widget-title button:hover { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #5b6078; + color: #cad3f5; +} + +.control-center .widget-title button:active { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #7dc4e4; + color: #24273a; +} + +.control-center .notification-row .notification-background { + border-radius: 7px; + color: #cad3f5; + background-color: #363a4f; + box-shadow: inset 0 0 0 1px #494d64; + margin-top: 14px; +} + +.control-center .notification-row .notification-background .notification { + padding: 7px; + border-radius: 7px; +} + +.control-center + .notification-row + .notification-background + .notification.critical { + box-shadow: inset 0 0 7px 0 #ed8796; +} + +.control-center + .notification-row + .notification-background + .notification + .notification-content { + margin: 7px; +} + +.control-center + .notification-row + .notification-background + .notification + .notification-content + .summary { + color: #cad3f5; +} + +.control-center + .notification-row + .notification-background + .notification + .notification-content + .time { + color: #a5adcb; +} + +.control-center + .notification-row + .notification-background + .notification + .notification-content + .body { + color: #cad3f5; +} + +.control-center + .notification-row + .notification-background + .notification + > *:last-child + > * { + min-height: 3.4em; +} + +.control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action { + border-radius: 7px; + color: #cad3f5; + background-color: #181926; + box-shadow: inset 0 0 0 1px #494d64; + margin: 7px; +} + +.control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:hover { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #363a4f; + color: #cad3f5; +} + +.control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:active { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #7dc4e4; + color: #cad3f5; +} + +.control-center .notification-row .notification-background .close-button { + margin: 7px; + padding: 2px; + border-radius: 6.3px; + color: #24273a; + background-color: #ee99a0; +} + +.control-center .notification-row .notification-background .close-button:hover { + background-color: #ed8796; + color: #24273a; +} + +.control-center + .notification-row + .notification-background + .close-button:active { + background-color: #ed8796; + color: #24273a; +} + +.control-center .notification-row .notification-background:hover { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #8087a2; + color: #cad3f5; +} + +.control-center .notification-row .notification-background:active { + box-shadow: inset 0 0 0 1px #494d64; + background-color: #7dc4e4; + color: #cad3f5; +} diff --git a/yazi/package.toml b/yazi/package.toml new file mode 100644 index 0000000..6ca5cd3 --- /dev/null +++ b/yazi/package.toml @@ -0,0 +1,7 @@ +[[plugin.deps]] +use = "yazi-rs/plugins:piper" +rev = "e84f4fe" +hash = "384464b6df8cb807425c521f8cd790f3" + +[flavor] +deps = [] diff --git a/yazi/plugins/piper.yazi/LICENSE b/yazi/plugins/piper.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/yazi/plugins/piper.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +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. diff --git a/yazi/plugins/piper.yazi/README.md b/yazi/plugins/piper.yazi/README.md new file mode 100644 index 0000000..114c46b --- /dev/null +++ b/yazi/plugins/piper.yazi/README.md @@ -0,0 +1,102 @@ +# piper.yazi + +Pipe any shell command as a previewer. + +## Installation + +```sh +ya pkg add yazi-rs/plugins:piper +``` + +## Usage + +Piper is a general-purpose previewer - you can pass any shell command to `piper` and it will use the command's output as the preview content. + +It accepts a string parameter, which is the shell command to be executed, for example: + +```toml +# ~/.config/yazi/yazi.toml +[[plugin.prepend_previewers]] +url = "*" +run = 'piper -- echo "$1"' +``` + +This will set `piper` as the previewer for all file types and use `$1` (file path) as the preview content. + +## Variables + +Available variables: + +- `$w`: the width of the preview area. +- `$h`: the height of the preview area. +- `$1`: the path to the file being previewed. + +## Examples + +Here are some configuration examples: + +### Preview tarballs with [`tar`](https://man7.org/linux/man-pages/man1/tar.1.html) + +```toml +[[plugin.prepend_previewers]] +url = "*.tar*" +run = 'piper --format=url -- tar tf "$1"' +``` + +In this example, `--format=url` tells `piper` to parse the `tar` output as file URLs, so you'll be able to get a list of files with icons. + +### Preview CSV with [`bat`](https://github.com/sharkdp/bat) + +```toml +[[plugin.prepend_previewers]] +url = "*.csv" +run = 'piper -- bat -p --color=always "$1"' +``` + +Note that certain distributions might use a different name than `bat`, like Debian and Ubuntu use `batcat`, so please adjust accordingly. + +### Preview Markdown with [`glow`](https://github.com/charmbracelet/glow) + +```toml +[[plugin.prepend_previewers]] +url = "*.md" +run = 'piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"' +``` + +Note that there's [a bug in Glow v2.0](https://github.com/charmbracelet/glow/issues/440#issuecomment-2307992634) that causes slight color differences between tty and non-tty environments. + +### Preview directory tree with [`eza`](https://github.com/eza-community/eza) + +```toml +[[plugin.prepend_previewers]] +url = "*/" +run = 'piper -- eza -TL=3 --color=always --icons=always --group-directories-first --no-quotes "$1"' +``` + +### Preview the schema of a SQLite database + +```toml +[[plugin.prepend_previewers]] +mime = "application/sqlite3" +run = 'piper -- sqlite3 "$1" ".schema --indent"' +``` + +### Use [`hexyl`](https://github.com/sharkdp/hexyl) as fallback previewer + +Yazi defaults to using [`file -bL "$1"`](https://github.com/sxyazi/yazi/blob/main/yazi-plugin/preset/plugins/file.lua) if there's no matched previewer. + +This example uses `hexyl` as a fallback previewer instead of `file`. + +```toml +[[plugin.append_previewers]] +url = "*" +run = 'piper -- hexyl --border=none --terminal-width=$w "$1"' +``` + +## Related projects + +[`faster-piper.yazi`](https://github.com/alberti42/faster-piper.yazi): a cache-based, scrolling-optimized rewrite compatible with `piper.yazi`. + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/yazi/plugins/piper.yazi/main.lua b/yazi/plugins/piper.yazi/main.lua new file mode 100644 index 0000000..a4a0bb3 --- /dev/null +++ b/yazi/plugins/piper.yazi/main.lua @@ -0,0 +1,70 @@ +--- @since 26.1.22 + +local M = {} + +local function fail(job, s) ya.preview_widget(job, ui.Text.parse(s):area(job.area):wrap(ui.Wrap.YES)) end + +function M:peek(job) + local child, err = Command("sh") + :arg({ "-c", job.args[1], "sh", tostring(job.file.path) }) + :env("w", job.area.w) + :env("h", job.area.h) + :stdout(Command.PIPED) + :stderr(Command.PIPED) + :spawn() + + if not child then + return fail(job, "sh: " .. err) + end + + local limit = job.area.h + local i, outs, errs = 0, {}, {} + repeat + local next, event = child:read_line() + if event == 1 then + errs[#errs + 1] = next + elseif event ~= 0 then + break + end + + i = i + 1 + if i > job.skip then + outs[#outs + 1] = next + end + until i >= job.skip + limit + + child:start_kill() + if #errs > 0 then + fail(job, table.concat(errs, "")) + elseif job.skip > 0 and i < job.skip + limit then + ya.emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) + else + ya.preview_widget(job, M.format(job, outs)) + end +end + +function M:seek(job) require("code"):seek(job) end + +function M.format(job, lines) + local format = job.args.format + if format ~= "url" then + local s = table.concat(lines, ""):gsub("\t", string.rep(" ", rt.preview.tab_size)) + return ui.Text.parse(s):area(job.area) + end + + for i = 1, #lines do + lines[i] = lines[i]:gsub("[\r\n]+$", "") + + local icon = File({ + url = Url(lines[i]), + cha = Cha { mode = tonumber(lines[i]:sub(-1) == "/" and "40700" or "100644", 8) }, + }):icon() + + if icon then + lines[i] = ui.Line { ui.Span(" " .. icon.text .. " "):style(icon.style), lines[i] } + end + end + return ui.Text(lines):area(job.area) +end + +return M diff --git a/yazi/yazi.toml b/yazi/yazi.toml new file mode 100644 index 0000000..1dff1f4 --- /dev/null +++ b/yazi/yazi.toml @@ -0,0 +1,15 @@ +[manager] +show_hidden = true + +[[plugin.prepend_previewers]] +url = "*.tar*" +run = 'piper --format=url -- tar tf "$1"' +[[plugin.prepend_previewers]] +url = "*.csv" +run = 'piper -- bat -p --color=always "$1"' +[[plugin.prepend_previewers]] +url = "*.md" +run = 'piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"' +[[plugin.prepend_previewers]] +mime = "application/sqlite3" +run = 'piper -- sqlite3 "$1" ".schema --indent"'