diff --git a/.config/X11/opt-apps b/.config/X11/opt-apps index 7c41a252..5fa0528b 100755 --- a/.config/X11/opt-apps +++ b/.config/X11/opt-apps @@ -1,11 +1,12 @@ #!/bin/sh -autostart="nextcloud telegram-desktop headset-charge-indicator spotify ferdium discord transmission-daemon" +autostart="nextcloud telegram-desktop headset-charge-indicator spotify ferdium discord transmission-daemon librewolf" for program in $autostart; do pidof -s "$program" || "$program" & done >/dev/null 2>&1 setxkbmap lv & +remaps & xrandr --output DisplayPort-0 --mode 1920x1080 --rate 75 --output HDMI-A-0 --mode 1920x1080 --rate 60 --left-of DisplayPort-0 & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc index aaa7c97c..e96cbaf7 100755 --- a/.config/X11/xinitrc +++ b/.config/X11/xinitrc @@ -14,6 +14,4 @@ else . "$HOME/.xprofile" fi -ssh-agent "$WM" - -# exec ssh-agent dbus-launch --sh-syntex --exit-with-session awesome +ssh-agent awesome diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 76ed17b0..a7e70e44 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -22,13 +22,11 @@ env: # check the local terminfo database and use `alacritty` if it is # available, otherwise `xterm-256color` is used. TERM: alacritty - # Background opacity # # Window opacity as a floating point number from `0.0` to `1.0`. # The value `0.0` is completely transparent and `1.0` is opaque. # background_opacity: 0.9 - window: # Window dimensions (changes require restart) # @@ -38,7 +36,6 @@ window: dimensions: columns: 0 lines: 0 - opacity: 0.9 # Window position (changes require restart) # @@ -55,10 +52,8 @@ window: padding: x: 0 y: 0 - # Spread additional padding evenly around the terminal content. dynamic_padding: true - # Window decorations # # Values for `decorations`: @@ -69,7 +64,6 @@ window: # - transparent: Title bar, transparent background and title bar buttons # - buttonless: Title bar, transparent background and no title bar buttons decorations: none - # Startup Mode (changes require restart) # # Values for `startup_mode`: @@ -80,13 +74,10 @@ window: # Values for `startup_mode` (macOS only): # - SimpleFullscreen startup_mode: Windowed - # Window title title: Alacritty - # Allow terminal applications to change Alacritty's window title. dynamic_title: true - # Window class (Linux/BSD only): # class: # Application instance name @@ -98,16 +89,13 @@ window: # # Override the variant of the GTK theme. Commonly supported values are `dark` # and `light`. Set this to `None` to use the default theme variant. - decorations_theme_variant: dark - + decorations_theme_variant: Dark scrolling: # Maximum number of lines in the scrollback buffer. # Specifying '0' will disable scrolling. history: 10000 - # Scrolling distance multiplier. multiplier: 3 - # Font configuration font: # Normal (roman) font face @@ -119,10 +107,8 @@ font: # - (Linux/BSD) monospace # - (Windows) Consolas family: JetBrainsMono NF - # The `style` can be specified to pick a specific face. style: Regular - # Bold font face bold: # Font family @@ -130,10 +116,8 @@ font: # If the bold family is not specified, it will fall back to the # value specified for the normal font. family: JetBrainsMono NF - # The `style` can be specified to pick a specific face. style: Bold - # Italic font face italic: # Font family @@ -141,10 +125,8 @@ font: # If the italic family is not specified, it will fall back to the # value specified for the normal font. family: JetBrainsMono NF - # The `style` can be specified to pick a specific face. style: Italic - # Bold italic font face bold_italic: # Font family @@ -152,52 +134,43 @@ font: # If the bold italic family is not specified, it will fall back to the # value specified for the normal font. family: JetBrainsMono NF - # The `style` can be specified to pick a specific face. style: Bold Italic - # Point size size: 11.0 - # Offset is the extra space around each character. `offset.y` can be thought # of as modifying the line spacing, and `offset.x` as modifying the letter # spacing. offset: x: 0 y: -1 - # Glyph offset determines the locations of the glyphs within their cells with # the default being at the bottom. Increasing `x` moves the glyph to the # right, increasing `y` moves the glyph upward. glyph_offset: x: 0 y: 0 - - # Thin stroke font rendering (macOS only) - # - # Thin strokes are suitable for retina displays, but for non-retina screens - # it is recommended to set `use_thin_strokes` to `false`. - # use_thin_strokes: false - + # Thin stroke font rendering (macOS only) + # + # Thin strokes are suitable for retina displays, but for non-retina screens + # it is recommended to set `use_thin_strokes` to `false`. + # use_thin_strokes: false # If `true`, bold text is drawn using the bright color variants. draw_bold_text_with_bright_colors: true - # Colors (Tomorrow Night) colors: # Default colors primary: - background: '#282a36' - foreground: '#f8f8f2' - + background: "#282a36" + foreground: "#f8f8f2" # Bright and dim foreground colors # # The dimmed foreground color is calculated automatically if it is not # present. If the bright foreground color is not set, or # `draw_bold_text_with_bright_colors` is `false`, the normal foreground # color will be used. - dim_foreground: '#828482' - bright_foreground: '#ffffff' - + dim_foreground: "#828482" + bright_foreground: "#ffffff" # Cursor colors # # Colors which should be used to draw the terminal cursor. @@ -207,7 +180,6 @@ colors: cursor: text: CellBackground cursor: CellForeground - # Vi mode cursor colors # # Colors for the cursor when the vi mode is active. @@ -217,7 +189,6 @@ colors: vi_mode_cursor: text: CellBackground cursor: CellForeground - # Search colors # # Colors used for the search bar and match highlighting. @@ -225,16 +196,14 @@ colors: # Allowed values are CellForeground/CellBackground, whichq reference the # affected cell, or hexadecimal colors like #ff00ff. matches: - foreground: '#44475a' - background: '#50fa7b' + foreground: "#44475a" + background: "#50fa7b" focused_match: - foreground: '#44475a' - background: '#ffb86c' - + foreground: "#44475a" + background: "#ffb86c" footer_bar: - background: '#282a36' - foreground: '#f8f8f2' - + background: "#282a36" + foreground: "#f8f8f2" # Keyboard regex hints hints: # First character in the hint label @@ -242,17 +211,15 @@ colors: # Allowed values are CellForeground/CellBackground, which reference the # affected cell, or hexadecimal colors like #ff00ff. start: - foreground: '#282a36' - background: '#f1fa8c' - + foreground: "#282a36" + background: "#f1fa8c" # All characters after the first one in the hint label # # Allowed values are CellForeground/CellBackground, which reference the # affected cell, or hexadecimal colors like #ff00ff. end: - foreground: '#f1fa8c' - background: '#282a36' - + foreground: "#f1fa8c" + background: "#282a36" # Line indicator # # Color used for the indicator displaying the position in history during @@ -272,29 +239,26 @@ colors: selection: text: CellBackground background: CellForeground - # Normal colors normal: - black: '#21222c' - red: '#ff5555' - green: '#50fa7b' - yellow: '#f1fa8c' - blue: '#bd93f9' - magenta: '#ff79c6' - cyan: '#8be9fd' - white: '#f8f8f2' - + black: "#21222c" + red: "#ff5555" + green: "#50fa7b" + yellow: "#f1fa8c" + blue: "#bd93f9" + magenta: "#ff79c6" + cyan: "#8be9fd" + white: "#f8f8f2" # Bright colors bright: - black: '#6272a4' - red: '#ff6e6e' - green: '#69ff94' - yellow: '#ffffa5' - blue: '#d6acff' - magenta: '#ff92df' - cyan: '#a4ffff' - white: '#ffffff' - + black: "#6272a4" + red: "#ff6e6e" + green: "#69ff94" + yellow: "#ffffa5" + blue: "#d6acff" + magenta: "#ff92df" + cyan: "#a4ffff" + white: "#ffffff" # Dim colors # # If the dim colors are not set, they will be calculated automatically based @@ -325,7 +289,6 @@ colors: # the default background. When set to `true` all cells will be transparent # regardless of their background color. transparent_background_colors: false - # Bell # # The bell is rung every time the BEL control character is received. @@ -366,15 +329,12 @@ colors: # args: ["Hello, World!"] # #command: None - selection: # This string contains all characters that are used as separators for # "semantic words" in Alacritty. semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" - # When set to `true`, selected text will be copied to the primary clipboard. save_to_clipboard: true - cursor: # Cursor style style: @@ -385,7 +345,6 @@ cursor: # - _ Underline # - | Beam shape: Beam - # Cursor blinking state # # Values for `blinking`: @@ -394,7 +353,6 @@ cursor: # - On: Enable blinking by default # - Always: Force the cursor to always blink #blinking: Off - # Vi mode cursor style # # If the vi mode cursor style is `None` or not specified, it will fall back to @@ -402,18 +360,15 @@ cursor: # # See `cursor.style` for available options. vi_mode_style: Block - # Cursor blinking interval in milliseconds. #blink_interval: 750 # If this is `true`, the cursor will be rendered as a hollow box when the # window is not focused. unfocused_hollow: false - # Thickness of the cursor relative to the cell width as floating point number # from `0.0` to `1.0`. #thickness: 0.15 - # Live config reload (changes require restart) #live_config_reload: true @@ -530,8 +485,7 @@ shell: # - `mods` (see key bindings) mouse_bindings: # - { mouse: Right, action: ExpandSelection } - - { mouse: Middle, mode: ~Vi, action: PasteSelection } - + - {mouse: Middle, mode: ~Vi, action: PasteSelection} # Key bindings # # Key bindings are specified as a list of objects. For example, this is the @@ -743,10 +697,10 @@ key_bindings: #- { key: Copy, action: Copy } # - { key: L, mods: Control, action: clear } #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } - - { key: Up, mods: Shift, mode: ~Alt, action: ScrollPageUp } - - { key: Down, mods: Shift, mode: ~Alt, action: ScrollPageDown } - - { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop } - - { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } + - {key: Up, mods: Shift, mode: ~Alt, action: ScrollPageUp} + - {key: Down, mods: Shift, mode: ~Alt, action: ScrollPageDown} + - {key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop} + - {key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom,} # - { key: Delete, actions: Del } # - { key: Key9, mods: Control|Shift, action: CreateNewWindow, } @@ -814,22 +768,21 @@ key_bindings: #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } # (Windows, Linux, and BSD only) - - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } - - { key: C, mods: Control|Shift, action: Copy } - - { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } - - { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } + - {key: V, mods: Control|Shift, mode: ~Vi, action: Paste} + - {key: C, mods: Control|Shift, action: Copy} + - {key: F, mods: Control|Shift, mode: ~Search, action: SearchForward} + - {key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward} #- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection } #- { key: Insert, mods: Shift, action: PasteSelection } - - { key: Key0, mods: Control, action: ResetFontSize } - - { key: Equals, mods: Control, action: IncreaseFontSize } + - {key: Key0, mods: Control, action: ResetFontSize} + - {key: Equals, mods: Control, action: IncreaseFontSize} # - { key: Plus, mods: Control, action: IncreaseFontSize } - - { key: NumpadAdd, mods: Control, action: IncreaseFontSize } - - { key: Minus, mods: Control, action: DecreaseFontSize } - - { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } - - { key: Q, mods: Control|Shift, action: Quit } + - {key: NumpadAdd, mods: Control, action: IncreaseFontSize} + - {key: Minus, mods: Control, action: DecreaseFontSize} + - {key: NumpadSubtract, mods: Control, action: DecreaseFontSize} + - {key: Q, mods: Control|Shift, action: Quit} # (Windows only) - - { key: F11, action: ToggleFullscreen } - + - {key: F11, action: ToggleFullscreen,} # (macOS only) #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } #- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory } diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 0a7ed1b8..07d8ca8c 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -802,5 +802,5 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -awful.spawn.with_shell("spotify") +-- awful.spawn.with_shell("spotify") awful.spawn.with_shell("discord") diff --git a/.config/btop/btop.conf b/.config/btop/btop.conf index febba77f..aefffb72 100644 --- a/.config/btop/btop.conf +++ b/.config/btop/btop.conf @@ -54,7 +54,7 @@ update_ms = 1000 #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. -proc_sorting = "memory" +proc_sorting = "cpu lazy" #* Reverse sorting order, True or False. proc_reversed = False diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index 5d635081..c3ba50fb 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -15,7 +15,8 @@ monitor=,preferred,auto,1 # Execute your favorite apps at launch # exec-once = waybar & hyprpaper & firefox -exec-once = pipewire & pipewire-pulse & wireplumber & waybar & hyprpaper & tuxedo-control-center & flameshot & librewolf & nextcloud & xrdb -load "$XDG_CONFIG_HOME"/X11/xresources & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec-once = pipewire & pipewire-pulse & wireplumber & waybar & hyprpaper & tuxedo-control-center & flameshot & librewolf & nextcloud & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & dbus-update-activation-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY & xrdb "$XDG_CONFIG_HOME/X11/xresources" + # Source a file (multi-file configs) @@ -29,11 +30,14 @@ input { kb_options = kb_rules = numlock_by_default = true + repeat_rate = 50 + repeat_delay = 300 follow_mouse = 1 touchpad { natural_scroll = yes + disable_while_typing = false } sensitivity = 0 # -1.0 - 1.0, 0 means no modification. @@ -205,6 +209,9 @@ bind = $mainMod SHIFT, H, movewindow, l # bind = $mainMod CTRL, P, exec, wayshot -f "$(HOME)/Pictures/screenshots/$(date + '%s.png')" -s "$(slurp -f '%x %y %w %y')" --stdout | wl-copy # bind = $mainMod CTRL, P, exec, wayshot -s "$(slurp -f '%x %y %w %y')" --stdout | wl-copy # bind = $mainMod, , exec, wayshot -f "$(HOME)/Pictures/screenshots/$(date + '%s.png')" +bind = CTRL, PRINT, exec, hyprshot -m region +bind = , PRINT, exec, hyprshot -m output +bind = SHIFT, PRINT, exec, hyprshot -m window bind = $mainMod ALT, P, exec, hyprpicker -a # colorpicker diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 9358c4e6..635f3395 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -1,16 +1,16 @@ #!/bin/sh # Basic Settings set autoquit on -set cleaner ~/.config/lf/cleaner +set cleaner "~/.config/lf/cleaner" set drawbox true set hidden true +set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" set icons true set ifs "\n" -set ifs "\n" set ignorecase true set info size set period 1 -set previewer ~/.config/lf/preview +set previewer "~/.config/lf/preview" set ratios 1:2:3 set scrolloff 10 set shellopts '-eu' @@ -21,7 +21,7 @@ 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 | sk | sed 's|~|$HOME|')" && + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' $XDG_CONFIG_HOME/shell/bm-dirs | sk | sed 's|~|$HOME|')" && for x in $fx; do eval mv -iv \"$x\" \"$dest\" done && @@ -33,7 +33,7 @@ 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 | sk | sed 's|~|$HOME|')" && + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' $XDG_CONFIG_HOME/shell/bm-dirs | sk | sed 's|~|$HOME|')" && for x in $fx; do eval cp -ivr \"$x\" \"$dest\" done && @@ -56,15 +56,15 @@ cmd open ${{ done & ;; audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; - video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + video/*) setsid -f mpv --speed=2 $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) setsid -f lowriter $fx >/dev/null 2>&1 ;; - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;; - application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint) setsid -f loimpress $fx >/dev/null 2>&1 ;; - application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f lodraw $fx >/dev/null 2>&1 ;; - application/vnd.oasis.opendocument.formula) setsid -f lomath $fx >/dev/null 2>&1 ;; - application/vnd.oasis.opendocument.database) setsid -f lobase $fx >/dev/null 2>&1 ;; + # application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;; + # application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;; + # application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint) setsid -f loimpress $fx >/dev/null 2>&1 ;; + # application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f lodraw $fx >/dev/null 2>&1 ;; + # application/vnd.oasis.opendocument.formula) setsid -f lomath $fx >/dev/null 2>&1 ;; + # application/vnd.oasis.opendocument.database) setsid -f lobase $fx >/dev/null 2>&1 ;; *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done ;; esac }} @@ -75,8 +75,8 @@ cmd extract ${{ set -f printf "%s\n\t" "$fx" printf "extract?[y/N]" - read ans - [ $ans = "y" ] && aunpack $fx + read answer + [ $answer = "y" ] && aunpack $fx }} @@ -95,6 +95,11 @@ cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" cmd mkfile $touch "$(echo $* | tr ' ' '\ ')" cmd setbg "$1" +cmd dragon %dragon-drop -a -x $fx +cmd dragon-stay %dragon-drop -a %fx +cmd dragon-individual %dragon-drop $fx + + # Bindings # Remove some defaults map "'" @@ -119,7 +124,7 @@ map rename map B $vidir # bulk rename map D delete map E extract -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 | sk)" +map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' $XDG_CONFIG_HOME/shell/bm-dirs | sk)" map O $mimeopen --ask "$f" map P paste map Y $printf "%s" "$fx" | xclip -selection clipboard @@ -134,5 +139,11 @@ map nN $spacefm -t "${PWD}" & disown >/dev/null 2>&1 map nn $setsid -f $TERMINAL >/dev/null 2>&1 map o &mimeopen "$f" +# Dragon Mapping +map dr dragon +map ds dragon-stay +map di dragon-individual + + # Source Bookmarks source "~/.config/lf/shortcutrc" diff --git a/.config/lf/preview b/.config/lf/preview index 2983b5e8..577baa78 100755 --- a/.config/lf/preview +++ b/.config/lf/preview @@ -6,16 +6,23 @@ 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 -} +# 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" +# echo "TRUE" +# else +# mediainfo "$6" +# echo "FALSE" +# fi +# } -ifub() { - [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 +image() { + if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; 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" + exit 1 + else + chafa "$1" -s "$4x" + fi } # Note that the cache file name is a function of file information, meaning if @@ -24,7 +31,7 @@ ifub() { case "$(file --dereference --brief --mime-type -- "$1")" in image/svg* | application/illustrator) - 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)" + CACHE="$XDG_CACHE_HOME/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" ] && convert "$1" "$CACHE.jpg" image "$CACHE.jpg" "$2" "$3" "$4" "$5" @@ -33,20 +40,20 @@ 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/markdown) glow -s dark "$1" ;; -text/* | */xml | application/json) bat --style=plain "$(($4 - 2))" -f "$1" ;; +text/* | */xml | application/json) bat --style=plain --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)" + CACHE="$XDG_CACHE_HOME/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)" + CACHE="$XDG_CACHE_HOME/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)" + CACHE="$XDG_CACHE_HOME/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" ;; @@ -58,7 +65,7 @@ application/x-iso*) iso-info "$1" ;; *openxmlformats-officedocument.wordprocessingml.document) docx2txt "$1" - ;; *opendocument*) odt2txt "$1" ;; *ms-excel | *openxmlformats-officedocument.spreadsheetml.sheet) - ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv + ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | bat --language=csv ;; esac exit 1 diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index e3c53970..ec2fbfac 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -12,7 +12,7 @@ alias \ mv="mv -iv" \ nsxiv="nsxiv -a" \ rm="rm -vI" \ - keychain="keychain --dir "$XDG_RUNTIME_DIR"/keychain" + keychain="keychain --dir $XDG_RUNTIME_DIR/keychain" # Colorize commands when possible alias \ @@ -41,14 +41,16 @@ alias \ matrix="unimatrix -s 95" \ night="redshift -PO 4500" \ py="python" \ + sv="rsv" \ v="$EDITOR" \ vpn-down="wg-quick down wg0" \ vpn-restart="wg-quick down wg0 && wg-quick up wg0" \ vpn-up="wg-quick up wg0" \ weather="curl wttr.in/" \ ww="$EDITOR ~/vimwiki/index.md" \ - z="zathura" \ - sv="rsv" + x="xplr -C ~/.config/xplr/hack.lua" \ + j="joshutoub" \ + z="zathura" # doas not required for some system commands for command in mount umount rsv sv pacman updatedb su shutdown poweroff reboot zzz systemctl wg wg-quick; do diff --git a/.config/shell/env b/.config/shell/env index c94dd150..5549dce7 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -12,6 +12,7 @@ export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}" # Disable files export LESSHISTFILE=- +export $(dbus-launch) unsetopt PROMPT_SP @@ -33,9 +34,7 @@ export XDG_CONFIG_HOME="$HOME/.config" export XDG_DATA_HOME="$HOME/.local/share" export XDG_STATE_HOME="$HOME/.local/share" -# export XDG_CURRENT_DESKTOP=Hyprland -# export XDG_SESSION_TYPE=wayland -# export XDG_SESSION_DESKTOP=Hyprland +export HYPRSHOT_DIR="$HOME/Pictures/screenshots" export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android" export ANDROID_HOME="$XDG_CONFIG_HOME/android" @@ -71,7 +70,7 @@ export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default" export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java" - +export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history" # Other program settings export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname diff --git a/.config/transmission-daemon/settings.json b/.config/transmission-daemon/settings.json index 5606b010..b49fb63e 100644 --- a/.config/transmission-daemon/settings.json +++ b/.config/transmission-daemon/settings.json @@ -6,6 +6,10 @@ "alt-speed-time-enabled": false, "alt-speed-time-end": 1020, "alt-speed-up": 50, + "announce-ip": "", + "announce-ip-enabled": false, + "anti-brute-force-enabled": false, + "anti-brute-force-threshold": 100, "bind-address-ipv4": "0.0.0.0", "bind-address-ipv6": "::", "blocklist-date": 1676459465, @@ -14,16 +18,17 @@ "blocklist-url": "http://list.iblocklist.com/?list=ydxerpxkpcfqjaybcssw&fileformat=p2p&archiveformat=gz", "cache-size-mb": 4, "compact-view": false, + "default-trackers": "", "details-window-height": 571, "details-window-width": 700, "dht-enabled": true, - "download-dir": "/home/kristofers/ISOs", + "download-dir": "/home/kristofers/Torrents", "download-queue-enabled": true, "download-queue-size": 5, "encryption": 1, "idle-seeding-limit": 30, "idle-seeding-limit-enabled": false, - "incomplete-dir": "/home/kristofers/Downloads", + "incomplete-dir": "/home/kristofers/Torrents/Incomplete-Torrents", "incomplete-dir-enabled": true, "inhibit-desktop-hibernation": false, "lpd-enabled": false, @@ -32,7 +37,7 @@ "main-window-width": 1900, "main-window-x": 1928, "main-window-y": 29, - "message-level": 1, + "message-level": 2, "peer-congestion-algorithm": "", "peer-id-ttl-hours": 6, "peer-limit-global": 200, @@ -41,7 +46,7 @@ "peer-port-random-high": 65535, "peer-port-random-low": 49152, "peer-port-random-on-start": false, - "peer-socket-tos": "default", + "peer-socket-tos": "le", "pex-enabled": true, "port-forwarding-enabled": true, "preallocation": 1, @@ -58,13 +63,18 @@ "rpc-host-whitelist-enabled": true, "rpc-password": "{7fc260c68dfba7c7f3fbed9c837945f36b835d28XmkvfKXx", "rpc-port": 9091, + "rpc-socket-mode": "0750", "rpc-url": "/transmission/", "rpc-username": "", "rpc-whitelist": "127.0.0.1,::1", "rpc-whitelist-enabled": true, "scrape-paused-torrents-enabled": true, + "script-torrent-added-enabled": false, + "script-torrent-added-filename": "", "script-torrent-done-enabled": false, "script-torrent-done-filename": "/home/kristofers/.local/bin/tordone", + "script-torrent-done-seeding-enabled": false, + "script-torrent-done-seeding-filename": "", "seed-queue-enabled": false, "seed-queue-size": 10, "show-backup-trackers": false, @@ -83,13 +93,15 @@ "speed-limit-up-enabled": false, "start-added-torrents": true, "statusbar-stats": "total-ratio", + "tcp-enabled": true, "torrent-added-notification-enabled": true, + "torrent-added-verify-mode": "fast", "torrent-complete-notification-enabled": true, "torrent-complete-sound-command": "canberra-gtk-play -i complete-download -d 'transmission torrent downloaded'", "torrent-complete-sound-enabled": true, "trash-can-enabled": true, "trash-original-torrent-files": false, - "umask": 18, + "umask": "022", "upload-slots-per-torrent": 14, "user-has-given-informed-consent": true, "utp-enabled": true diff --git a/.config/xplr/hack.lua b/.config/xplr/hack.lua new file mode 100644 index 00000000..2c3274d3 --- /dev/null +++ b/.config/xplr/hack.lua @@ -0,0 +1,59 @@ +---@diagnostic disable +local xplr = xplr -- The globally exposed configuration to be overridden. +---@diagnostic enable + +-- -- Preview images using imv. +-- xplr.config.modes.builtin.default.key_bindings.on_key.P = { +-- help = "preview", +-- messages = { +-- { +-- BashExecSilently0 = [===[ +-- FIFO_PATH="/tmp/xplr.fifo" +-- +-- if [ -e "$FIFO_PATH" ]; then +-- "$XPLR" -m StopFifo +-- rm -f -- "$FIFO_PATH" +-- else +-- mkfifo "$FIFO_PATH" +-- "$HOME/.local/bin/imv-open" "$FIFO_PATH" "$XPLR_FOCUS_PATH" & +-- "$XPLR" -m 'StartFifo: %q' "$FIFO_PATH" +-- fi +-- ]===], +-- }, +-- }, +-- } +-- +-- -- Batch rename the selected or visible files and directories in `$PWD`. +-- xplr.config.modes.builtin.default.key_bindings.on_key.R = { +-- help = "batch rename", +-- messages = { +-- { +-- BashExec = [===[ +-- SELECTION=$(cat "${XPLR_PIPE_SELECTION_OUT:?}") +-- NODES=${SELECTION:-$(cat "${XPLR_PIPE_DIRECTORY_NODES_OUT:?}")} +-- if [ "$NODES" ]; then +-- echo -e "$NODES" | renamer +-- "$XPLR" -m ExplorePwdAsync +-- fi +-- ]===], +-- }, +-- }, +-- } +-- +-- -- Serve `$PWD` using a static web server via LAN. +-- xplr.config.modes.builtin.default.key_bindings.on_key.S = { +-- help = "serve $PWD", +-- messages = { +-- { +-- BashExec0 = [===[ +-- IP=$(ip addr | rg -w inet | cut -d/ -f1 | rg -Eo '[0-9]{1,3}\.[0-9]{ 1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sk --prompt 'Select IP > ') +-- echo "IP: ${IP:?}" +-- read -p "Port (default 5000): " PORT +-- echo +-- sfz --all --cors --no-ignore --bind ${IP:?} --port ${PORT:-5000} . & +-- sleep 1 && read -p '[press enter to exit]' +-- kill -9 %1 +-- ]===], +-- }, +-- }, +-- } diff --git a/.config/xplr/init.lua b/.config/xplr/init.lua new file mode 100644 index 00000000..bca79e16 --- /dev/null +++ b/.config/xplr/init.lua @@ -0,0 +1,3079 @@ +---@diagnostic disable +local xplr = xplr -- The globally exposed configuration to be overridden. +---@diagnostic enable + +-- This is the built-in configuration file that gets loaded and sets the +-- default values when xplr loads, before loading any other custom +-- configuration file. +-- +-- You can use this file as a reference to create a your custom config file. +-- +-- To create a custom configuration file, you need to define the script version +-- for compatibility checks. +-- +-- See https://xplr.dev/en/upgrade-guide +-- +version = "0.20.2" + +-- # Configuration ------------------------------------------------------------ +-- +-- xplr can be configured using [Lua][1] via a special file named `init.lua`, +-- which can be placed in `~/.config/xplr/` (local to user) or `/etc/xplr/` +-- (global) depending on the use case. +-- +-- When xplr loads, it first executes the [built-in init.lua][2] to set the +-- default values, which is then overwritten by another config file, if found +-- using the following lookup order: +-- +-- 1. `--config /path/to/init.lua` +-- 2. `~/.config/xplr/init.lua` +-- 3. `/etc/xplr/init.lua` +-- +-- The first one found will be loaded by xplr and the lookup will stop. +-- +-- The loaded config can be further extended using the `-C` or `--extra-config` +-- command-line option. +-- +-- +-- [1]: https://www.lua.org +-- [2]: https://github.com/sayanarijit/xplr/blob/main/src/init.lua +-- [3]: https://xplr.dev/en/upgrade-guide + +-- ## Config ------------------------------------------------------------------ +-- +-- The xplr configuration, exposed via `xplr.config` Lua API contains the +-- following sections. +-- +-- See: +-- +-- * [xplr.config.general](https://xplr.dev/en/general-config) +-- * [xplr.config.node_types](https://xplr.dev/en/node_types) +-- * [xplr.config.layouts](https://xplr.dev/en/layouts) +-- * [xplr.config.modes](https://xplr.dev/en/modes) + +-- ### General Configuration -------------------------------------------------- +-- +-- The general configuration properties are grouped together in +-- `xplr.config.general`. + +-- Set it to `true` if you want to ignore the startup errors. You can still see +-- the errors in the logs. +-- +-- Type: boolean +xplr.config.general.disable_debug_error_mode = false + +-- Set it to `true` if you want to enable mouse scrolling. +-- +-- Type: boolean +xplr.config.general.enable_mouse = false + +-- Set it to `true` to show hidden files by default. +-- +-- Type: boolean +xplr.config.general.show_hidden = true + +-- Set it to `true` to use only a subset of selected operations that forbids +-- executing commands or performing write operations on the file-system. +-- +-- Type: boolean +xplr.config.general.read_only = false + +-- Set it to `true` if you want to enable a safety feature that will save you +-- from yourself when you type recklessly. +-- +-- Type: boolean +xplr.config.general.enable_recover_mode = false + +-- Set it to `true` if you want to hide all remaps in the help menu. +-- +-- Type: boolean +xplr.config.general.hide_remaps_in_help_menu = false + +-- Set it to `true` if you want the cursor to stay in the same position when +-- the focus is on the first path and you navigate to the previous path +-- (by pressing `up`/`k`), or when the focus is on the last path and you +-- navigate to the next path (by pressing `down`/`j`). +-- The default behavior is to rotate from the last/first path. +-- +-- Type: boolean +xplr.config.general.enforce_bounded_index_navigation = false + +-- This is the shape of the prompt for the input buffer. +-- +-- Type: nullable string +xplr.config.general.prompt.format = "❯ " + +-- This is the style of the prompt for the input buffer. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.prompt.style = {} + +-- The string to indicate an information in logs. +-- +-- Type: nullable string +xplr.config.general.logs.info.format = "INFO" + +-- The style for the information logs. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.logs.info.style = { fg = "LightBlue" } + +-- The string to indicate an success in logs. +-- +-- Type: nullable string +xplr.config.general.logs.success.format = "SUCCESS" + +-- The style for the success logs. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.logs.success.style = { fg = "Green" } + +-- The string to indicate an warnings in logs. +-- +-- Type: nullable string +xplr.config.general.logs.warning.format = "WARNING" + +-- The style for the warnings logs. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.logs.warning.style = { fg = "Yellow" } + +-- The string to indicate an error in logs. +-- +-- Type: nullable string +xplr.config.general.logs.error.format = "ERROR" + +-- The style for the error logs. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.logs.error.style = { fg = "Red" } + +-- Columns to display in the table header. +-- +-- Type: nullable list of tables with the following fields: +-- +-- * format: nullable string +-- * style: [Style](https://xplr.dev/en/style) +xplr.config.general.table.header.cols = { + { format = " index", style = {} }, + { format = "╭─── path", style = {} }, + { format = "permissions", style = {} }, + { format = "size", style = {} }, + { format = "modified", style = {} }, +} + +-- Style of the table header. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.table.header.style = {} + +-- Height of the table header. +-- +-- Type: nullable integer +xplr.config.general.table.header.height = 1 + +-- Columns to display in each row in the table. +-- +-- Type: nullable list of tables with the following fields: +-- +-- * format: nullable string +-- * style: [Style](https://xplr.dev/en/style) +xplr.config.general.table.row.cols = { + { + format = "builtin.fmt_general_table_row_cols_0", + style = {}, + }, + { + format = "builtin.fmt_general_table_row_cols_1", + style = {}, + }, + { + format = "builtin.fmt_general_table_row_cols_2", + style = {}, + }, + { + format = "builtin.fmt_general_table_row_cols_3", + style = {}, + }, + { + format = "builtin.fmt_general_table_row_cols_4", + style = {}, + }, +} + +-- Default style of the table. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.table.row.style = {} + +-- Height of the table rows. +-- +-- Type: nullable integer +xplr.config.general.table.row.height = 0 + +-- Default style of the table. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.table.style = {} + +-- Tree to display in the table. +-- +-- Type: nullable list of tables with the following fields: +-- +-- * format: nullable string +-- * style: [Style](https://xplr.dev/en/style) +xplr.config.general.table.tree = { + { format = "├", style = {} }, + { format = "├", style = {} }, + { format = "╰", style = {} }, +} + +-- Spacing between the columns in the table. +-- +-- Type: nullable integer +xplr.config.general.table.col_spacing = 1 + +-- Constraint for the column widths. +-- +-- Type: nullable list of [Constraint](https://xplr.dev/en/layouts#constraint) +xplr.config.general.table.col_widths = { + { Percentage = 10 }, + { Percentage = 50 }, + { Percentage = 10 }, + { Percentage = 10 }, + { Percentage = 20 }, +} + +-- The content that is placed before the item name for each row by default. +-- +-- Type: nullable string +xplr.config.general.default_ui.prefix = " " + +-- The content which is appended to each item name for each row by default. +-- +-- Type: nullable string +xplr.config.general.default_ui.suffix = "" + +-- The default style of each item for each row. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.default_ui.style = {} + +-- The string placed before the item name for a focused row. +-- +-- Type: nullable string +xplr.config.general.focus_ui.prefix = "▸[" + +-- The string placed after the item name for a focused row. +-- +-- Type: nullable string +xplr.config.general.focus_ui.suffix = "]" + +-- Style for focused item. +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.focus_ui.style = { add_modifiers = { "Bold" } } + +-- The string placed before the item name for a selected row. +-- +-- Type: nullable string +xplr.config.general.selection_ui.prefix = " {" + +-- The string placed after the item name for a selected row. +-- +-- Type: nullable string +xplr.config.general.selection_ui.suffix = "}" + +-- Style for selected rows. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.selection_ui.style = { + fg = "DarkGray", + add_modifiers = { "CrossedOut" }, +} + +-- The string placed before item name for a selected row that gets the focus. +-- +-- Type: nullable string +xplr.config.general.focus_selection_ui.prefix = "▸[" + +-- The string placed after the item name for a selected row that gets the focus. +-- +-- Type: nullable string +xplr.config.general.focus_selection_ui.suffix = "]" + +-- Style for a selected row that gets the focus. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.focus_selection_ui.style = { + add_modifiers = { "Bold", "CrossedOut" }, +} + +-- The shape of the separator for the Sort & filter panel. +-- +-- Type: nullable string +xplr.config.general.sort_and_filter_ui.separator.format = " › " + +-- The style of the separator for the Sort & filter panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.sort_and_filter_ui.separator.style = { + add_modifiers = { "Dim" }, +} + +-- The content of the default identifier in Sort & filter panel. +-- +-- Type: nullable string +xplr.config.general.sort_and_filter_ui.default_identifier.format = nil + +-- Style for the default identifier in Sort & filter panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.sort_and_filter_ui.default_identifier.style = {} + +-- The shape of the forward direction indicator for sort identifiers in Sort & filter panel. +-- +-- Type: nullable string +xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.forward.format = "↓" + +-- Style of forward direction indicator in Sort & filter panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.forward.style = nil + +-- The shape of the reverse direction indicator for sort identifiers in Sort & filter panel. +-- +-- Type: nullable string +xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.reverse.format = "↑" + +-- Style of reverse direction indicator in Sort & filter panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.reverse.style = nil + +-- The identifiers used to denote applied sorters in the Sort & filter panel. +-- +-- Type: nullable mapping of the following key-value pairs: +-- +-- * key: [Sorter](https://xplr.dev/en/sorting#sorter) +-- * value: +-- * format: nullable string +-- * style: [Style](https://xplr.dev/en/style) +xplr.config.general.sort_and_filter_ui.sorter_identifiers = { + ByExtension = { format = "ext", style = {} }, + ByICanonicalAbsolutePath = { format = "[ci]abs", style = {} }, + ByIRelativePath = { format = "[i]rel", style = {} }, + ByISymlinkAbsolutePath = { format = "[si]abs", style = {} }, + ByIsBroken = { format = "⨯", style = {} }, + ByIsDir = { format = "dir", style = {} }, + ByIsFile = { format = "file", style = {} }, + ByIsReadonly = { format = "ro", style = {} }, + ByIsSymlink = { format = "sym", style = {} }, + ByMimeEssence = { format = "mime", style = {} }, + ByRelativePath = { format = "rel", style = {} }, + BySize = { format = "size", style = {} }, + ByCreated = { format = "created", style = {} }, + ByLastModified = { format = "modified", style = {} }, + ByCanonicalAbsolutePath = { format = "[c]abs", style = {} }, + ByCanonicalExtension = { format = "[c]ext", style = {} }, + ByCanonicalIsDir = { format = "[c]dir", style = {} }, + ByCanonicalIsFile = { format = "[c]file", style = {} }, + ByCanonicalIsReadonly = { format = "[c]ro", style = {} }, + ByCanonicalMimeEssence = { format = "[c]mime", style = {} }, + ByCanonicalSize = { format = "[c]size", style = {} }, + ByCanonicalCreated = { format = "[c]created", style = {} }, + ByCanonicalLastModified = { format = "[c]modified", style = {} }, + BySymlinkAbsolutePath = { format = "[s]abs", style = {} }, + BySymlinkExtension = { format = "[s]ext", style = {} }, + BySymlinkIsDir = { format = "[s]dir", style = {} }, + BySymlinkIsFile = { format = "[s]file", style = {} }, + BySymlinkIsReadonly = { format = "[s]ro", style = {} }, + BySymlinkMimeEssence = { format = "[s]mime", style = {} }, + BySymlinkSize = { format = "[s]size", style = {} }, + BySymlinkCreated = { format = "[s]created", style = {} }, + BySymlinkLastModified = { format = "[s]modified", style = {} }, +} + +-- The identifiers used to denote applied filters in the Sort & filter panel. +-- +-- Type: nullable mapping of the following key-value pairs: +-- +-- * key: [Filter](https://xplr.dev/en/filtering#filter) +-- * value: +-- * format: nullable string +-- * style: [Style](https://xplr.dev/en/style) +xplr.config.general.sort_and_filter_ui.filter_identifiers = { + RelativePathDoesContain = { format = "rel=~", style = {} }, + RelativePathDoesEndWith = { format = "rel=$", style = {} }, + RelativePathDoesNotContain = { format = "rel!~", style = {} }, + RelativePathDoesNotEndWith = { format = "rel!$", style = {} }, + RelativePathDoesNotStartWith = { format = "rel!^", style = {} }, + RelativePathDoesStartWith = { format = "rel=^", style = {} }, + RelativePathIs = { format = "rel==", style = {} }, + RelativePathIsNot = { format = "rel!=", style = {} }, + RelativePathDoesMatchRegex = { format = "rel=/", style = {} }, + RelativePathDoesNotMatchRegex = { format = "rel!/", style = {} }, + IRelativePathDoesContain = { format = "[i]rel=~", style = {} }, + IRelativePathDoesEndWith = { format = "[i]rel=$", style = {} }, + IRelativePathDoesNotContain = { format = "[i]rel!~", style = {} }, + IRelativePathDoesNotEndWith = { format = "[i]rel!$", style = {} }, + IRelativePathDoesNotStartWith = { format = "[i]rel!^", style = {} }, + IRelativePathDoesStartWith = { format = "[i]rel=^", style = {} }, + IRelativePathIs = { format = "[i]rel==", style = {} }, + IRelativePathIsNot = { format = "[i]rel!=", style = {} }, + IRelativePathDoesMatchRegex = { format = "[i]rel=/", style = {} }, + IRelativePathDoesNotMatchRegex = { format = "[i]rel!/", style = {} }, + AbsolutePathDoesContain = { format = "abs=~", style = {} }, + AbsolutePathDoesEndWith = { format = "abs=$", style = {} }, + AbsolutePathDoesNotContain = { format = "abs!~", style = {} }, + AbsolutePathDoesNotEndWith = { format = "abs!$", style = {} }, + AbsolutePathDoesNotStartWith = { format = "abs!^", style = {} }, + AbsolutePathDoesStartWith = { format = "abs=^", style = {} }, + AbsolutePathIs = { format = "abs==", style = {} }, + AbsolutePathIsNot = { format = "abs!=", style = {} }, + AbsolutePathDoesMatchRegex = { format = "abs=/", style = {} }, + AbsolutePathDoesNotMatchRegex = { format = "abs!/", style = {} }, + IAbsolutePathDoesContain = { format = "[i]abs=~", style = {} }, + IAbsolutePathDoesEndWith = { format = "[i]abs=$", style = {} }, + IAbsolutePathDoesNotContain = { format = "[i]abs!~", style = {} }, + IAbsolutePathDoesNotEndWith = { format = "[i]abs!$", style = {} }, + IAbsolutePathDoesNotStartWith = { format = "[i]abs!^", style = {} }, + IAbsolutePathDoesStartWith = { format = "[i]abs=^", style = {} }, + IAbsolutePathIs = { format = "[i]abs==", style = {} }, + IAbsolutePathIsNot = { format = "[i]abs!=", style = {} }, + IAbsolutePathDoesMatchRegex = { format = "[i]abs=/", style = {} }, + IAbsolutePathDoesNotMatchRegex = { format = "[i]abs!/", style = {} }, +} + +-- The identifiers used to denote applied search input. +-- +-- Type: { format = nullable string, style = [Style](https://xplr.dev/en/style) } +xplr.config.general.sort_and_filter_ui.search_identifier = { + format = "search:", + style = {}, +} + +-- The content for panel title by default. +-- +-- Type: nullable string +xplr.config.general.panel_ui.default.title.format = nil + +-- The style for panel title by default. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.default.title.style = { + fg = "Reset", + add_modifiers = { "Bold" }, +} + +-- Style of the panels by default. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.default.style = {} + +-- Defines where to show borders for the panels by default. +-- +-- Type: nullable list of [Border](https://xplr.dev/en/borders#border) +xplr.config.general.panel_ui.default.borders = { + "Top", + "Right", + "Bottom", + "Left", +} + +-- Type of the borders by default. +-- +-- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) +xplr.config.general.panel_ui.default.border_type = "Rounded" + +-- Style of the panel borders by default. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.default.border_style = { fg = "DarkGray" } + +-- The content for the table panel title. +-- +-- Type: nullable string +xplr.config.general.panel_ui.table.title.format = nil + +-- Style of the table panel title. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.table.title.style = {} + +-- Style of the table panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.table.style = {} + +-- Defines where to show borders for the table panel. +-- +-- Type: nullable list of [Border](https://xplr.dev/en/borders#border) +xplr.config.general.panel_ui.table.borders = nil + +-- Type of the borders for table panel. +-- +-- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) +xplr.config.general.panel_ui.table.border_type = nil + +-- Style of the table panel borders. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.table.border_style = {} + +-- The content for the help menu panel title. +-- +-- Type: nullable string +xplr.config.general.panel_ui.help_menu.title.format = nil + +-- Style of the help menu panel title. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.help_menu.title.style = {} + +-- Style of the help menu panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.help_menu.style = {} + +-- Defines where to show borders for the help menu panel. +-- +-- Type: nullable list of [Border](https://xplr.dev/en/borders#border) +xplr.config.general.panel_ui.help_menu.borders = nil + +-- Type of the borders for help menu panel. +-- +-- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) +xplr.config.general.panel_ui.help_menu.border_type = nil + +-- Style of the help menu panel borders. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.help_menu.border_style = {} + +-- The content for the input & logs panel title. +-- +-- Type: nullable string +xplr.config.general.panel_ui.input_and_logs.title.format = nil + +-- Style of the input & logs panel title. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.input_and_logs.title.style = {} + +-- Style of the input & logs panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.input_and_logs.style = {} +-- Defines where to show borders for the input & logs panel. +-- +-- Type: nullable list of [Border](https://xplr.dev/en/borders#border) +xplr.config.general.panel_ui.input_and_logs.borders = nil + +-- Type of the borders for input & logs panel. +-- +-- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) +xplr.config.general.panel_ui.input_and_logs.border_type = nil + +-- Style of the input & logs panel borders. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.input_and_logs.border_style = {} + +-- The content for the selection panel title. +-- +-- Type: nullable string +xplr.config.general.panel_ui.selection.title.format = nil + +-- Style of the selection panel title. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.selection.title.style = {} + +-- Style of the selection panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.selection.style = {} +-- Defines where to show borders for the selection panel. +-- +-- Type: nullable list of [Border](https://xplr.dev/en/borders#border) +xplr.config.general.panel_ui.selection.borders = nil + +-- Type of the borders for selection panel. +-- +-- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) +xplr.config.general.panel_ui.selection.border_type = nil + +-- Style of the selection panel borders. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.selection.border_style = {} + +-- The content for the sort & filter panel title. +-- +-- Type: nullable string +xplr.config.general.panel_ui.sort_and_filter.title.format = nil + +-- Style of the sort & filter panel title. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.sort_and_filter.title.style = {} + +-- Style of the sort & filter panel. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.sort_and_filter.style = {} + +-- Defines where to show borders for the sort & filter panel. +-- +-- Type: nullable list of [Border](https://xplr.dev/en/borders#border) +xplr.config.general.panel_ui.sort_and_filter.borders = nil + +-- Type of the borders for sort & filter panel. +-- +-- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) +xplr.config.general.panel_ui.sort_and_filter.border_type = nil + +-- Style of the sort & filter panel borders. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.general.panel_ui.sort_and_filter.border_style = {} + +-- Initial group if sorters applied to the nodes list in the table. +-- +-- Type: nullable list of [Node Sorter](https://xplr.dev/en/sorting#node-sorter-applicable) +xplr.config.general.initial_sorting = { + { sorter = "ByCanonicalIsDir", reverse = true }, + { sorter = "ByIRelativePath", reverse = false }, +} + +-- The name of one of the modes to use when xplr loads. +-- +-- Type: nullable string +xplr.config.general.initial_mode = "default" + +-- The name of one of the layouts to use when xplr loads. +-- +-- Type: nullable string +xplr.config.general.initial_layout = "default" + +-- Set it to a file path to start fifo when xplr loads. +-- Generally it is used to integrate with external tools like previewers. +-- +-- Type: nullable string +xplr.config.general.start_fifo = nil + +-- Use it to define a set of key bindings that are available by default in +-- every [mode](https://xplr.dev/en/mode). They can be overwritten. +-- +-- Type: [Key Bindings](https://xplr.dev/en/configure-key-bindings#key-bindings) +xplr.config.general.global_key_bindings = { + on_key = { + ["esc"] = { + messages = { + "PopMode", + }, + }, + ["ctrl-c"] = { + messages = { + "Terminate", + }, + }, + }, +} + +-- ### Node Types ------------------------------------------------------------- +-- +-- This section defines how to deal with different kinds of nodes (files, +-- directories, symlinks etc.) based on their properties. +-- +-- One node can fall into multiple categories. For example, a node can have the +-- *extension* `md`, and also be a *file*. In that case, the properties from +-- the more specific category i.e. *extension* will be used. +-- +-- This can be configured using the `xplr.config.node_types` Lua API. + +-- The style for the directory nodes +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.node_types.directory.style = { + fg = "Blue", +} + +-- Metadata for the directory nodes. +-- You can set as many metadata as you want. +-- +-- Type: nullable string +-- +-- Example: +-- +-- ```lua +-- xplr.config.node_types.directory.meta.foo = "foo" +-- xplr.config.node_types.directory.meta.bar = "bar" +-- ``` +xplr.config.node_types.directory.meta.icon = "" + +-- The style for the file nodes. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.node_types.file.style = {} + +-- Metadata for the file nodes. +-- You can set as many metadata as you want. +-- +-- Type: nullable string +-- +-- Example: +-- +-- ```lua +-- xplr.config.node_types.file.meta.foo = "foo" +-- xplr.config.node_types.file.meta.bar = "bar" +-- ``` +xplr.config.node_types.file.meta.icon = "" + +-- The style for the symlink nodes. +-- +-- Type: [Style](https://xplr.dev/en/style) +xplr.config.node_types.symlink.style = { + fg = "Cyan", + add_modifiers = { "Italic" }, +} + +-- Metadata for the symlink nodes. +-- You can set as many metadata as you want. +-- +-- Type: nullable string +-- +-- Example: +-- +-- ```lua +-- xplr.config.node_types.symlink.meta.foo = "foo" +-- xplr.config.node_types.symlink.meta.bar = "bar" +-- ``` +xplr.config.node_types.symlink.meta.icon = "" + +-- Metadata and style based on mime types. +-- It is possible to use the wildcard `*` to match all mime sub types. It will +-- be overwritten by the more specific sub types that are defined. +-- +-- Type: mapping of the following key-value pairs: +-- +-- * key: string +-- * value: +-- * key: string +-- * value: [Node Type](https://xplr.dev/en/node-type) +-- +-- Example: +-- +-- ```lua +-- xplr.config.node_types.mime_essence = { +-- application = { +-- -- application/* +-- ["*"] = { meta = { icon = "a" } } +-- +-- -- application/pdf +-- pdf = { meta = { icon = "" }, style = { fg = "Blue" } }, +-- +-- -- application/zip +-- zip = { meta = { icon = ""} }, +-- }, +-- } +-- ``` +xplr.config.node_types.mime_essence = { + audio = { + ["*"] = { meta = { icon = "" } }, + }, + image = { + ["*"] = { meta = { icons = "" } }, + }, + video = { + ["*"] = { meta = { icons = "" } }, + }, + text = { + ["*"] = { meta = { icons = "" } }, + }, +} + +-- Metadata and style based on extension. +-- +-- Type: mapping of the following key-value pairs: +-- +-- * key: string +-- * value: [Node Type](https://xplr.dev/en/node-type) +-- +-- Example: +-- +-- ```lua +-- xplr.config.node_types.extension.md = { meta = { icon = "" }, style = { fg = "Blue" } } +-- xplr.config.node_types.extension.rs = { meta = { icon = "🦀" } } +-- ``` +xplr.config.node_types.extension = { + -- file extensions (vim-devicons) + ai = { meta = { icon = "" } }, + awk = { meta = { icon = "" } }, + bash = { meta = { icon = "" } }, + bat = { meta = { icon = "" } }, + bmp = { meta = { icon = "" } }, + c = { meta = { icon = "" } }, + cc = { meta = { icon = "" } }, + clj = { meta = { icon = "" } }, + cljc = { meta = { icon = "" } }, + cljs = { meta = { icon = "" } }, + coffee = { meta = { icon = "" } }, + conf = { meta = { icon = "" } }, + cp = { meta = { icon = "" } }, + cpp = { meta = { icon = "" } }, + cs = { meta = { icon = "" } }, + csh = { meta = { icon = "" } }, + css = { meta = { icon = "" } }, + cxx = { meta = { icon = "" } }, + ["c++"] = { meta = { icon = "" } }, + d = { meta = { icon = "" } }, + dart = { meta = { icon = "" } }, + db = { meta = { icon = "" } }, + diff = { meta = { icon = "" } }, + dump = { meta = { icon = "" } }, + edn = { meta = { icon = "" } }, + eex = { meta = { icon = "" } }, + ejs = { meta = { icon = "" } }, + elm = { meta = { icon = "" } }, + erl = { meta = { icon = "" } }, + ex = { meta = { icon = "" } }, + exs = { meta = { icon = "" } }, + fish = { meta = { icon = "" } }, + fs = { meta = { icon = "" } }, + fsi = { meta = { icon = "" } }, + fsscript = { meta = { icon = "" } }, + fsx = { meta = { icon = "" } }, + ["f#"] = { meta = { icon = "" } }, + gemspec = { meta = { icon = "" } }, + gif = { meta = { icon = "" } }, + go = { meta = { icon = "" } }, + h = { meta = { icon = "" } }, + haml = { meta = { icon = "" } }, + hbs = { meta = { icon = "" } }, + heex = { meta = { icon = "" } }, + hh = { meta = { icon = "" } }, + hpp = { meta = { icon = "" } }, + hrl = { meta = { icon = "" } }, + hs = { meta = { icon = "" } }, + htm = { meta = { icon = "" } }, + html = { meta = { icon = "" } }, + hxx = { meta = { icon = "" } }, + ico = { meta = { icon = "" } }, + ini = { meta = { icon = "" } }, + java = { meta = { icon = "" } }, + jl = { meta = { icon = "" } }, + jpeg = { meta = { icon = "" } }, + jpg = { meta = { icon = "" } }, + js = { meta = { icon = "" } }, + json = { meta = { icon = "" } }, + jsx = { meta = { icon = "" } }, + ksh = { meta = { icon = "" } }, + leex = { meta = { icon = "" } }, + less = { meta = { icon = "" } }, + lhs = { meta = { icon = "" } }, + lua = { meta = { icon = "" } }, + markdown = { meta = { icon = "" } }, + md = { meta = { icon = "" } }, + mdx = { meta = { icon = "" } }, + mjs = { meta = { icon = "" } }, + mk = { meta = { icon = "" } }, + ml = { meta = { icon = "λ" } }, + mli = { meta = { icon = "λ" } }, + mustache = { meta = { icon = "" } }, + nix = { meta = { icon = "" } }, + pem = { meta = { icon = "" } }, + php = { meta = { icon = "" } }, + pl = { meta = { icon = "" } }, + pm = { meta = { icon = "" } }, + png = { meta = { icon = "" } }, + pp = { meta = { icon = "" } }, + ps1 = { meta = { icon = "" } }, + psb = { meta = { icon = "" } }, + psd = { meta = { icon = "" } }, + py = { meta = { icon = "" } }, + pyc = { meta = { icon = "" } }, + pyd = { meta = { icon = "" } }, + pyo = { meta = { icon = "" } }, + r = { meta = { icon = "ﳒ" } }, + rake = { meta = { icon = "" } }, + rb = { meta = { icon = "" } }, + rlib = { meta = { icon = "" } }, + rmd = { meta = { icon = "" } }, + rproj = { meta = { icon = "鉶" } }, + rs = { meta = { icon = "" } }, + rss = { meta = { icon = "" } }, + sass = { meta = { icon = "" } }, + scala = { meta = { icon = "" } }, + scss = { meta = { icon = "" } }, + sh = { meta = { icon = "" } }, + slim = { meta = { icon = "" } }, + sln = { meta = { icon = "" } }, + sol = { meta = { icon = "ﲹ" } }, + sql = { meta = { icon = "" } }, + styl = { meta = { icon = "" } }, + suo = { meta = { icon = "" } }, + swift = { meta = { icon = "" } }, + t = { meta = { icon = "" } }, + tex = { meta = { icon = "ﭨ" } }, + toml = { meta = { icon = "" } }, + ts = { meta = { icon = "" } }, + tsx = { meta = { icon = "" } }, + twig = { meta = { icon = "" } }, + vim = { meta = { icon = "" } }, + vue = { meta = { icon = "﵂" } }, + webmanifest = { meta = { icon = "" } }, + webp = { meta = { icon = "" } }, + xcplayground = { meta = { icon = "" } }, + xul = { meta = { icon = "" } }, + yaml = { meta = { icon = "" } }, + yml = { meta = { icon = "" } }, + zsh = { meta = { icon = "" } }, + -- archives or compressed (extensions from dircolors defaults) + ["7z"] = { meta = { icon = "" } }, + ace = { meta = { icon = "" } }, + alz = { meta = { icon = "" } }, + arc = { meta = { icon = "" } }, + arj = { meta = { icon = "" } }, + bz = { meta = { icon = "" } }, + bz2 = { meta = { icon = "" } }, + cab = { meta = { icon = "" } }, + cpio = { meta = { icon = "" } }, + deb = { meta = { icon = "" } }, + dwm = { meta = { icon = "" } }, + dz = { meta = { icon = "" } }, + ear = { meta = { icon = "" } }, + esd = { meta = { icon = "" } }, + gz = { meta = { icon = "" } }, + jar = { meta = { icon = "" } }, + lha = { meta = { icon = "" } }, + lrz = { meta = { icon = "" } }, + lz = { meta = { icon = "" } }, + lz4 = { meta = { icon = "" } }, + lzh = { meta = { icon = "" } }, + lzma = { meta = { icon = "" } }, + lzo = { meta = { icon = "" } }, + rar = { meta = { icon = "" } }, + rpm = { meta = { icon = "" } }, + rz = { meta = { icon = "" } }, + sar = { meta = { icon = "" } }, + swm = { meta = { icon = "" } }, + t7z = { meta = { icon = "" } }, + tar = { meta = { icon = "" } }, + taz = { meta = { icon = "" } }, + tbz = { meta = { icon = "" } }, + tbz2 = { meta = { icon = "" } }, + tgz = { meta = { icon = "" } }, + tlz = { meta = { icon = "" } }, + txz = { meta = { icon = "" } }, + tz = { meta = { icon = "" } }, + tzo = { meta = { icon = "" } }, + tzst = { meta = { icon = "" } }, + war = { meta = { icon = "" } }, + wim = { meta = { icon = "" } }, + xz = { meta = { icon = "" } }, + z = { meta = { icon = "" } }, + zip = { meta = { icon = "" } }, + zoo = { meta = { icon = "" } }, + zst = { meta = { icon = "" } }, + -- image formats (extensions from dircolors defaults) + jpg = { meta = { icon = "" } }, + jpeg = { meta = { icon = "" } }, + mjpg = { meta = { icon = "" } }, + mjpeg = { meta = { icon = "" } }, + bmp = { meta = { icon = "" } }, + pbm = { meta = { icon = "" } }, + pgm = { meta = { icon = "" } }, + ppm = { meta = { icon = "" } }, + tga = { meta = { icon = "" } }, + xbm = { meta = { icon = "" } }, + xpm = { meta = { icon = "" } }, + tif = { meta = { icon = "" } }, + tiff = { meta = { icon = "" } }, + png = { meta = { icon = "" } }, + svg = { meta = { icon = "" } }, + svgz = { meta = { icon = "" } }, + pcx = { meta = { icon = "" } }, + m2v = { meta = { icon = "" } }, + ogm = { meta = { icon = "" } }, + nuv = { meta = { icon = "" } }, + rm = { meta = { icon = "" } }, + rmvb = { meta = { icon = "" } }, + flc = { meta = { icon = "" } }, + fli = { meta = { icon = "" } }, + gl = { meta = { icon = "" } }, + dl = { meta = { icon = "" } }, + xcf = { meta = { icon = "" } }, + xwd = { meta = { icon = "" } }, + cgm = { meta = { icon = "" } }, + emf = { meta = { icon = "" } }, + ogx = { meta = { icon = "" } }, + -- video formats + mkv = { meta = { icon = "" } }, + asf = { meta = { icon = "" } }, + yuv = { meta = { icon = "" } }, + avi = { meta = { icon = "" } }, + gif = { meta = { icon = "" } }, + mpg = { meta = { icon = "" } }, + mpeg = { meta = { icon = "" } }, + qt = { meta = { icon = "" } }, + mng = { meta = { icon = "" } }, + ogv = { meta = { icon = "" } }, + webm = { meta = { icon = "" } }, + vob = { meta = { icon = "" } }, + flv = { meta = { icon = "" } }, + mov = { meta = { icon = "" } }, + wmv = { meta = { icon = "" } }, + mp4 = { meta = { icon = "" } }, + m4v = { meta = { icon = "" } }, + mp4v = { meta = { icon = "" } }, + -- audio formats (extensions from dircolors defaults) + aac = { meta = { icon = "" } }, + au = { meta = { icon = "" } }, + flac = { meta = { icon = "" } }, + m4a = { meta = { icon = "" } }, + mid = { meta = { icon = "" } }, + midi = { meta = { icon = "" } }, + mka = { meta = { icon = "" } }, + mp3 = { meta = { icon = "" } }, + mpc = { meta = { icon = "" } }, + ogg = { meta = { icon = "" } }, + ra = { meta = { icon = "" } }, + wav = { meta = { icon = "" } }, + oga = { meta = { icon = "" } }, + opus = { meta = { icon = "" } }, + spx = { meta = { icon = "" } }, + xspf = { meta = { icon = "" } }, + -- other formats + pdf = { meta = { icon = "" } }, +} + +-- Metadata and style based on special file names. +-- +-- Type: mapping of the following key-value pairs: +-- +-- * key: string +-- * value: [Node Type](https://xplr.dev/en/node-type) +-- +-- Example: +-- +-- ```lua +-- xplr.config.node_types.special["Cargo.toml"] = { meta = { icon = "" } } +-- xplr.config.node_types.special["Downloads"] = { meta = { icon = "" }, style = { fg = "Blue" } } +-- ``` +xplr.config.node_types.special = { + -- file names (vim-devicons) + [".DS_Store"] = { meta = { icon = "" } }, + [".bashprofile"] = { meta = { icon = "" } }, + [".bashrc"] = { meta = { icon = "" } }, + [".ds_store"] = { meta = { icon = "" } }, + [".gitattributes"] = { meta = { icon = "" } }, + [".gitconfig"] = { meta = { icon = "" } }, + [".gitignore"] = { meta = { icon = "" } }, + [".gitlab-ci.yml"] = { meta = { icon = "" } }, + [".gvimrc"] = { meta = { icon = "" } }, + [".vimrc"] = { meta = { icon = "" } }, + [".zprofile"] = { meta = { icon = "" } }, + [".zshenv"] = { meta = { icon = "" } }, + [".zshrc"] = { meta = { icon = "" } }, + ["CMakeLists.txt"] = { meta = { icon = "" } }, + ["Docker-compose.yml"] = { meta = { icon = "" } }, + ["Dockerfile"] = { meta = { icon = "" } }, + ["Dropbox"] = { meta = { icon = "" } }, + ["Gemfile"] = { meta = { icon = "" } }, + ["Gruntfile.coffee"] = { meta = { icon = "" } }, + ["Gruntfile.js"] = { meta = { icon = "" } }, + ["Gruntfile.ls"] = { meta = { icon = "" } }, + ["Gulpfile.coffee"] = { meta = { icon = "" } }, + ["Gulpfile.js"] = { meta = { icon = "" } }, + ["Gulpfile.ls"] = { meta = { icon = "" } }, + ["LICENSE"] = { meta = { icon = "" } }, + ["Makefile"] = { meta = { icon = "" } }, + ["Procfile"] = { meta = { icon = "" } }, + ["Rakefile"] = { meta = { icon = "" } }, + ["React.jsx"] = { meta = { icon = "" } }, + ["_gvimrc"] = { meta = { icon = "" } }, + ["_vimrc"] = { meta = { icon = "" } }, + ["backbone.min.js"] = { meta = { icon = "" } }, + ["cmakelists.txt"] = { meta = { icon = "" } }, + ["config.ru"] = { meta = { icon = "" } }, + ["docker-compose.yml"] = { meta = { icon = "" } }, + ["dockerfile"] = { meta = { icon = "" } }, + ["dropbox"] = { meta = { icon = "" } }, + ["favicon.ico"] = { meta = { icon = "" } }, + ["gemfile"] = { meta = { icon = "" } }, + ["gruntfile.coffee"] = { meta = { icon = "" } }, + ["gruntfile.js"] = { meta = { icon = "" } }, + ["gruntfile.ls"] = { meta = { icon = "" } }, + ["gulpfile.coffee"] = { meta = { icon = "" } }, + ["gulpfile.js"] = { meta = { icon = "" } }, + ["gulpfile.ls"] = { meta = { icon = "" } }, + ["license"] = { meta = { icon = "" } }, + ["makefile"] = { meta = { icon = "" } }, + ["mix.lock"] = { meta = { icon = "" } }, + ["node_modules"] = { meta = { icon = "" } }, + ["procfile"] = { meta = { icon = "" } }, + ["rakefile"] = { meta = { icon = "" } }, + ["react.jsx"] = { meta = { icon = "" } }, + ["robots.txt"] = { meta = { icon = "ﮧ" } }, + -- file patterns (file name adaptations) + ["Vagrantfile "] = { meta = { icon = "" } }, + ["angular.min.js"] = { meta = { icon = "" } }, + ["jquery.min.js"] = { meta = { icon = "" } }, + ["materialize.min.css"] = { meta = { icon = "" } }, + ["materialize.min.js"] = { meta = { icon = "" } }, + ["mootools.min.js"] = { meta = { icon = "" } }, + ["require.min.js"] = { meta = { icon = "" } }, + ["vimrc"] = { meta = { icon = "" } }, +} + +-- ### Layouts ---------------------------------------------------------------- +-- +-- xplr layouts define the structure of the UI, i.e. how many panel we see, +-- placement and size of the panels, how they look etc. +-- +-- This is configuration exposed via the `xplr.config.layouts` API. +-- +-- `xplr.config.layouts.builtin` contain some built-in panels which can be +-- overridden, but you can't add or remove panels in it. +-- +-- You can add new panels in `xplr.config.layouts.custom`. +-- +-- ##### Example: Defining Custom Layout +-- +-- ![demo](https://s6.gifyu.com/images/layout.png) +-- +-- ```lua +-- xplr.config.layouts.builtin.default = { +-- Horizontal = { +-- config = { +-- margin = 1, +-- horizontal_margin = 2, +-- vertical_margin = 3, +-- constraints = { +-- { Percentage = 50 }, +-- { Percentage = 50 }, +-- } +-- }, +-- splits = { +-- "Table", +-- "HelpMenu", +-- } +-- } +-- } +-- ``` + +-- The default layout +-- +-- Type: [Layout](https://xplr.dev/en/layout) +xplr.config.layouts.builtin.default = { + Horizontal = { + config = { + constraints = { + { Percentage = 70 }, + { Percentage = 30 }, + }, + }, + splits = { + { + Vertical = { + config = { + constraints = { + { Length = 3 }, + { Min = 1 }, + { Length = 3 }, + }, + }, + splits = { + "SortAndFilter", + "Table", + "InputAndLogs", + }, + }, + }, + { + Vertical = { + config = { + constraints = { + { Percentage = 30 }, + { Percentage = 70 }, + }, + }, + splits = { + "Selection", + "HelpMenu", + }, + }, + }, + }, + }, +} + +-- The layout without help menu +-- +-- Type: [Layout](https://xplr.dev/en/layout) +xplr.config.layouts.builtin.no_help = { + Horizontal = { + config = { + constraints = { + { Percentage = 70 }, + { Percentage = 30 }, + }, + }, + splits = { + { + Vertical = { + config = { + constraints = { + { Length = 3 }, + { Min = 1 }, + { Length = 3 }, + }, + }, + splits = { + "SortAndFilter", + "Table", + "InputAndLogs", + }, + }, + }, + "Selection", + }, + }, +} + +-- The layout without selection panel +-- +-- Type: [Layout](https://xplr.dev/en/layout) +xplr.config.layouts.builtin.no_selection = { + Horizontal = { + config = { + constraints = { + { Percentage = 70 }, + { Percentage = 30 }, + }, + }, + splits = { + { + Vertical = { + config = { + constraints = { + { Length = 3 }, + { Min = 1 }, + { Length = 3 }, + }, + }, + splits = { + "SortAndFilter", + "Table", + "InputAndLogs", + }, + }, + }, + "HelpMenu", + }, + }, +} + +-- The layout without help menu and selection panel +-- +-- Type: [Layout](https://xplr.dev/en/layout) +xplr.config.layouts.builtin.no_help_no_selection = { + Vertical = { + config = { + constraints = { + { Length = 3 }, + { Min = 1 }, + { Length = 3 }, + }, + }, + splits = { + "SortAndFilter", + "Table", + "InputAndLogs", + }, + }, +} + +-- This is where you can define custom layouts +-- +-- Type: mapping of the following key-value pairs: +-- +-- * key: string +-- * value: [Layout](https://xplr.dev/en/layout) +-- +-- Example: +-- +-- ```lua +-- xplr.config.layouts.custom.example = "Nothing" -- Show a blank screen +-- xplr.config.general.initial_layout = "example" -- Load the example layout +-- ``` +xplr.config.layouts.custom = {} + +-- ### Modes ------------------------------------------------------------------ +-- +-- xplr is a modal file explorer. That means the users switch between different +-- modes, each containing a different set of key bindings to avoid clashes. +-- Users can switch between these modes at run-time. +-- +-- The modes can be configured using the `xplr.config.modes` Lua API. +-- +-- `xplr.config.modes.builtin` contain some built-in modes which can be +-- overridden, but you can't add or remove modes in it. + +-- The builtin default mode. +-- Visit the [Default Key Bindings](https://xplr.dev/en/default-key-bindings) +-- to see what each mode does. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.default = { + name = "default", + key_bindings = { + on_key = { + ["#"] = { + messages = { + "PrintAppStateAndQuit", + }, + }, + ["."] = { + help = "show hidden", + messages = { + { + ToggleNodeFilter = { filter = "RelativePathDoesNotStartWith", input = "." }, + }, + "ExplorePwdAsync", + }, + }, + [":"] = { + help = "action", + messages = { + "PopMode", + { SwitchModeBuiltin = "action" }, + }, + }, + ["?"] = { + help = "global help menu", + messages = { + { + BashExec = [===[ + [ -z "$PAGER" ] && PAGER="less -+F" + cat -- "${XPLR_PIPE_GLOBAL_HELP_MENU_OUT}" | ${PAGER:?} + ]===], + }, + }, + }, + ["G"] = { + help = "go to bottom", + messages = { + "PopMode", + "FocusLast", + }, + }, + ["ctrl-a"] = { + help = "select/unselect all", + messages = { + "ToggleSelectAll", + }, + }, + ["ctrl-f"] = { + help = "search", + messages = { + "PopMode", + { SwitchModeBuiltin = "search" }, + { SetInputBuffer = "" }, + }, + }, + ["ctrl-i"] = { + help = "next visited path", + messages = { + "NextVisitedPath", + }, + }, + ["ctrl-o"] = { + help = "last visited path", + messages = { + "LastVisitedPath", + }, + }, + ["ctrl-r"] = { + help = "refresh screen", + messages = { + "ClearScreen", + }, + }, + ["ctrl-u"] = { + help = "clear selection", + messages = { + "ClearSelection", + }, + }, + ["ctrl-w"] = { + help = "switch layout", + messages = { + { SwitchModeBuiltin = "switch_layout" }, + }, + }, + ["d"] = { + help = "delete", + messages = { + "PopMode", + { SwitchModeBuiltin = "delete" }, + }, + }, + ["down"] = { + help = "down", + messages = { + "FocusNext", + }, + }, + ["enter"] = { + help = "quit with result", + messages = { + "PrintResultAndQuit", + }, + }, + ["f"] = { + help = "filter", + messages = { + "PopMode", + { SwitchModeBuiltin = "filter" }, + }, + }, + ["g"] = { + help = "go to", + messages = { + "PopMode", + { SwitchModeBuiltin = "go_to" }, + }, + }, + ["left"] = { + help = "back", + messages = { + "Back", + }, + }, + ["q"] = { + help = "quit", + messages = { + "Quit", + }, + }, + ["r"] = { + help = "rename", + messages = { + "PopMode", + { SwitchModeBuiltin = "rename" }, + { + BashExecSilently0 = [===[ + NAME=$(basename "${XPLR_FOCUS_PATH:?}") + "$XPLR" -m 'SetInputBuffer: %q' "${NAME:?}" + ]===], + }, + }, + }, + ["ctrl-d"] = { + help = "duplicate as", + messages = { + "PopMode", + { SwitchModeBuiltin = "duplicate_as" }, + { + BashExecSilently0 = [===[ + NAME=$(basename "${XPLR_FOCUS_PATH:?}") + "$XPLR" -m 'SetInputBuffer: %q' "${NAME:?}" + ]===], + }, + }, + }, + ["right"] = { + help = "enter", + messages = { + "Enter", + }, + }, + ["s"] = { + help = "sort", + messages = { + "PopMode", + { SwitchModeBuiltin = "sort" }, + }, + }, + ["space"] = { + help = "toggle selection", + messages = { + "ToggleSelection", + "FocusNext", + }, + }, + ["up"] = { + help = "up", + messages = { + "FocusPrevious", + }, + }, + ["~"] = { + help = "go home", + messages = { + { + BashExecSilently0 = [===[ + "$XPLR" -m 'ChangeDirectory: %q' "${HOME:?}" + ]===], + }, + }, + }, + ["page-up"] = { + help = "scroll up", + messages = { + "ScrollUp", + }, + }, + ["page-down"] = { + help = "scroll down", + messages = { + "ScrollDown", + }, + }, + ["{"] = { + help = "scroll up half", + messages = { + "ScrollUpHalf", + }, + }, + ["}"] = { + help = "scroll down half", + messages = { + "ScrollDownHalf", + }, + }, + }, + on_number = { + help = "input", + messages = { + "PopMode", + { SwitchModeBuiltin = "number" }, + "BufferInputFromKey", + }, + }, + }, +} + +xplr.config.modes.builtin.default.key_bindings.on_key["tab"] = + xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-i"] +xplr.config.modes.builtin.default.key_bindings.on_key["v"] = + xplr.config.modes.builtin.default.key_bindings.on_key["space"] +xplr.config.modes.builtin.default.key_bindings.on_key["V"] = + xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-a"] +xplr.config.modes.builtin.default.key_bindings.on_key["/"] = + xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-f"] +xplr.config.modes.builtin.default.key_bindings.on_key["h"] = + xplr.config.modes.builtin.default.key_bindings.on_key["left"] +xplr.config.modes.builtin.default.key_bindings.on_key["j"] = + xplr.config.modes.builtin.default.key_bindings.on_key["down"] +xplr.config.modes.builtin.default.key_bindings.on_key["k"] = xplr.config.modes.builtin.default.key_bindings.on_key["up"] +xplr.config.modes.builtin.default.key_bindings.on_key["l"] = + xplr.config.modes.builtin.default.key_bindings.on_key["right"] + +-- The builtin debug error mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.debug_error = { + name = "debug error", + layout = { + Vertical = { + config = { + constraints = { + { Min = 14 }, + { MinLessThanScreenHeight = 14 }, + }, + }, + splits = { + { + CustomContent = { + title = "debug error", + body = { + StaticParagraph = { + render = [[ + + Some errors occurred during startup. + If you think this is a bug, please report it at: + + https://github.com/sayanarijit/xplr/issues/new + + Press `enter` to open the logs in your $EDITOR. + Press `escape` to ignore the errors and continue with the default config. + + To disable this mode, set `xplr.config.general.disable_debug_error_mode` + to `true` in your config file. + ]], + }, + }, + }, + }, + "InputAndLogs", + }, + }, + }, + key_bindings = { + on_key = { + ["enter"] = { + help = "open logs in editor", + messages = { + { + BashExec = [===[ + cat "${XPLR_PIPE_LOGS_OUT:?}" | ${EDITOR:-vi} - + ]===], + }, + }, + }, + ["q"] = { + help = "quit", + messages = { + "Quit", + }, + }, + }, + default = { + messages = {}, + }, + }, +} + +-- The builtin recover mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.recover = { + name = "recover", + layout = { + CustomContent = { + title = " recover ", + body = { + StaticParagraph = { + render = [[ + + You pressed an invalid key and went into "recover" mode. + This mode saves you from performing unwanted actions. + + Let's calm down, press `escape`, and try again. + + To disable this mode, set `xplr.config.general.enable_recover_mode` + to `false` in your config file. + ]], + }, + }, + }, + }, + key_bindings = { + default = { + messages = {}, + }, + }, +} + +-- The builtin go to path mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.go_to_path = { + name = "go to path", + key_bindings = { + on_key = { + ["enter"] = { + help = "submit", + messages = { + { + BashExecSilently0 = [===[ + PTH=${XPLR_INPUT_BUFFER} + PTH_ESC=$(printf %q "$PTH") + if [ -d "$PTH" ]; then + "$XPLR" -m 'ChangeDirectory: %q' "$PTH" + elif [ -e "$PTH" ]; then + "$XPLR" -m 'FocusPath: %q' "$PTH" + else + "$XPLR" -m 'LogError: %q' "could not find $PTH_ESC" + fi + ]===], + }, + "PopMode", + }, + }, + ["tab"] = { + help = "try complete", + messages = { + { CallLuaSilently = "builtin.try_complete_path" }, + }, + }, + }, + default = { + messages = { + "UpdateInputBufferFromKey", + }, + }, + }, +} + +-- The builtin selection ops mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.selection_ops = { + name = "selection ops", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["c"] = { + help = "copy here", + messages = { + { + BashExec0 = [===[ + (while IFS= read -r -d '' PTH; do + PTH_ESC=$(printf %q "$PTH") + if cp -vr -- "${PTH:?}" ./; then + "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC copied to ." + else + "$XPLR" -m 'LogError: %q' "Failed to copy $PTH_ESC to ." + fi + done < "${XPLR_PIPE_SELECTION_OUT:?}") + "$XPLR" -m ExplorePwdAsync + "$XPLR" -m ClearSelection + read -p "[enter to continue]" + ]===], + }, + "PopMode", + }, + }, + ["m"] = { + help = "move here", + messages = { + { + BashExec0 = [===[ + (while IFS= read -r -d '' PTH; do + PTH_ESC=$(printf %q "$PTH") + if mv -v -- "${PTH:?}" ./; then + "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC moved to ." + else + "$XPLR" -m 'LogError: %q' "Failed to move $PTH_ESC to ." + fi + done < "${XPLR_PIPE_SELECTION_OUT:?}") + "$XPLR" -m ExplorePwdAsync + read -p "[enter to continue]" + ]===], + }, + "PopMode", + }, + }, + ["u"] = { + help = "clear selection", + messages = { + "ClearSelection", + "PopMode", + }, + }, + }, + }, +} + +-- The builtin create mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.create = { + name = "create", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["d"] = { + help = "create directory", + messages = { + "PopMode", + { SwitchModeBuiltin = "create_directory" }, + { SetInputBuffer = "" }, + }, + }, + ["f"] = { + help = "create file", + messages = { + "PopMode", + { SwitchModeBuiltin = "create_file" }, + { SetInputBuffer = "" }, + }, + }, + }, + }, +} + +-- The builtin create directory mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.create_directory = { + name = "create directory", + prompt = "ð ❯ ", + key_bindings = { + on_key = { + ["tab"] = { + help = "try complete", + messages = { + { CallLuaSilently = "builtin.try_complete_path" }, + }, + }, + ["enter"] = { + help = "submit", + messages = { + { + BashExecSilently0 = [===[ + PTH="$XPLR_INPUT_BUFFER" + PTH_ESC=$(printf %q "$PTH") + if [ "$PTH" ]; then + mkdir -p -- "$PTH" \ + && "$XPLR" -m 'SetInputBuffer: ""' \ + && "$XPLR" -m ExplorePwd \ + && "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC created" \ + && "$XPLR" -m 'FocusPath: %q' "$PTH" + else + "$XPLR" -m PopMode + fi + ]===], + }, + }, + }, + }, + default = { + messages = { + "UpdateInputBufferFromKey", + }, + }, + }, +} + +-- The builtin create file mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.create_file = { + name = "create file", + prompt = "ƒ ❯ ", + key_bindings = { + on_key = { + ["tab"] = { + help = "try complete", + messages = { + { CallLuaSilently = "builtin.try_complete_path" }, + }, + }, + ["enter"] = { + help = "submit", + messages = { + { + BashExecSilently0 = [===[ + PTH="$XPLR_INPUT_BUFFER" + PTH_ESC=$(printf %q "$PTH") + if [ "$PTH" ]; then + mkdir -p -- "$(dirname $(realpath -m $PTH))" \ + && touch -- "$PTH" \ + && "$XPLR" -m 'SetInputBuffer: ""' \ + && "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC created" \ + && "$XPLR" -m 'ExplorePwd' \ + && "$XPLR" -m 'FocusPath: %q' "$PTH" + else + "$XPLR" -m PopMode + fi + ]===], + }, + }, + }, + }, + default = { + messages = { + "UpdateInputBufferFromKey", + }, + }, + }, +} + +-- The builtin number mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.number = { + name = "number", + prompt = ":", + key_bindings = { + on_key = { + ["down"] = { + help = "to down", + messages = { + "FocusNextByRelativeIndexFromInput", + "PopMode", + }, + }, + ["enter"] = { + help = "to index", + messages = { + "FocusByIndexFromInput", + "PopMode", + }, + }, + ["up"] = { + help = "to up", + messages = { + "FocusPreviousByRelativeIndexFromInput", + "PopMode", + }, + }, + }, + on_navigation = { + messages = { + "UpdateInputBufferFromKey", + }, + }, + on_number = { + help = "input", + messages = { + "UpdateInputBufferFromKey", + }, + }, + }, +} + +xplr.config.modes.builtin.number.key_bindings.on_key["j"] = xplr.config.modes.builtin.number.key_bindings.on_key["down"] +xplr.config.modes.builtin.number.key_bindings.on_key["k"] = xplr.config.modes.builtin.number.key_bindings.on_key["up"] + +-- The builtin go to mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.go_to = { + name = "go to", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["f"] = { + help = "follow symlink", + messages = { + "FollowSymlink", + "PopMode", + }, + }, + ["g"] = { + help = "top", + messages = { + "FocusFirst", + "PopMode", + }, + }, + ["p"] = { + help = "path", + messages = { + "PopMode", + { SwitchModeBuiltin = "go_to_path" }, + { SetInputBuffer = "" }, + }, + }, + ["i"] = { + help = "initial $PWD", + messages = { + "PopMode", + { + BashExecSilently0 = [===[ + "$XPLR" -m 'ChangeDirectory: %q' "${XPLR_INITIAL_PWD:?}" + ]===], + }, + }, + }, + ["x"] = { + help = "open in gui", + messages = { + { + BashExecSilently0 = [===[ + if [ -z "$OPENER" ]; then + if command -v xdg-open; then + OPENER=xdg-open + elif command -v open; then + OPENER=open + else + "$XPLR" -m 'LogError: "$OPENER not found"' + exit 1 + fi + fi + (while IFS= read -r -d '' PTH; do + $OPENER "${PTH:?}" > /dev/null 2>&1 + done < "${XPLR_PIPE_RESULT_OUT:?}") + ]===], + }, + "ClearScreen", + "PopMode", + }, + }, + }, + }, +} + +-- The builtin rename mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.rename = { + name = "rename", + key_bindings = { + on_key = { + ["tab"] = { + help = "try complete", + messages = { + { CallLuaSilently = "builtin.try_complete_path" }, + }, + }, + ["enter"] = { + help = "submit", + messages = { + { + BashExecSilently0 = [===[ + SRC="${XPLR_FOCUS_PATH:?}" + SRC_ESC=$(printf %q "$SRC") + TARGET="${XPLR_INPUT_BUFFER:?}" + TARGET_ESC=$(printf %q "$TARGET") + if [ -e "${TARGET:?}" ]; then + "$XPLR" -m 'LogError: %q' "$TARGET_ESC already exists" + else + mv -- "${SRC:?}" "${TARGET:?}" \ + && "$XPLR" -m ExplorePwd \ + && "$XPLR" -m 'FocusPath: %q' "$TARGET" \ + && "$XPLR" -m 'LogSuccess: %q' "$SRC_ESC renamed to $TARGET_ESC" + fi + ]===], + }, + "PopMode", + }, + }, + }, + default = { + messages = { + "UpdateInputBufferFromKey", + }, + }, + }, +} + +-- The builtin duplicate as mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.duplicate_as = { + name = "duplicate as", + key_bindings = { + on_key = { + ["tab"] = { + help = "try complete", + messages = { + { CallLuaSilently = "builtin.try_complete_path" }, + }, + }, + ["enter"] = { + help = "submit", + messages = { + { + BashExecSilently0 = [===[ + SRC="${XPLR_FOCUS_PATH:?}" + SRC_ESC=$(printf %q "$SRC") + TARGET="${XPLR_INPUT_BUFFER:?}" + TARGET_ESC=$(printf %q "$TARGET") + if [ -e "${TARGET:?}" ]; then + "$XPLR" -m 'LogError: %q' "$TARGET_ESC already exists" + else + cp -r -- "${SRC:?}" "${TARGET:?}" \ + && "$XPLR" -m ExplorePwd \ + && "$XPLR" -m 'FocusPath: %q' "$TARGET_ESC" \ + && "$XPLR" -m 'LogSuccess: %q' "$SRC_ESC duplicated as $TARGET_ESC" + fi + ]===], + }, + "PopMode", + }, + }, + }, + default = { + messages = { + "UpdateInputBufferFromKey", + }, + }, + }, +} + +-- The builtin delete mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.delete = { + name = "delete", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["D"] = { + help = "force delete", + messages = { + { + BashExec0 = [===[ + (while IFS= read -r -d '' PTH; do + PTH_ESC=$(printf %q "$PTH") + if rm -rfv -- "${PTH:?}"; then + "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted" + else + "$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC" + fi + done < "${XPLR_PIPE_RESULT_OUT:?}") + "$XPLR" -m ExplorePwdAsync + read -p "[enter to continue]" + ]===], + }, + "PopMode", + }, + }, + ["d"] = { + help = "delete", + messages = { + { + BashExec0 = [===[ + (while IFS= read -r -d '' PTH; do + PTH_ESC=$(printf %q "$PTH") + if [ -d "$PTH" ] && [ ! -L "$PTH" ]; then + if rmdir -v -- "${PTH:?}"; then + "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted" + else + "$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC" + fi + else + if rm -v -- "${PTH:?}"; then + "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted" + else + "$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC" + fi + fi + done < "${XPLR_PIPE_RESULT_OUT:?}") + "$XPLR" -m ExplorePwdAsync + read -p "[enter to continue]" + ]===], + }, + "PopMode", + }, + }, + }, + }, +} + +-- The builtin action mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.action = { + name = "action to", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["!"] = { + help = "shell", + messages = { + "PopMode", + { Call0 = { command = os.getenv("SHELL") or "bash", args = { "-i" } } }, + "ExplorePwdAsync", + }, + }, + ["c"] = { + help = "create", + messages = { + "PopMode", + { SwitchModeBuiltin = "create" }, + }, + }, + ["e"] = { + help = "open in editor", + messages = { + { + BashExec0 = [===[ + ${EDITOR:-vi} "${XPLR_FOCUS_PATH:?}" + ]===], + }, + "PopMode", + }, + }, + ["l"] = { + help = "logs", + messages = { + { + BashExec = [===[ + [ -z "$PAGER" ] && PAGER="less -+F" + cat -- "${XPLR_PIPE_LOGS_OUT}" | ${PAGER:?} + ]===], + }, + "PopMode", + }, + }, + ["s"] = { + help = "selection operations", + messages = { + "PopMode", + { SwitchModeBuiltin = "selection_ops" }, + }, + }, + ["m"] = { + help = "toggle mouse", + messages = { + "PopMode", + "ToggleMouse", + }, + }, + ["v"] = { + help = "vroot", + messages = { + "PopMode", + { SwitchModeBuiltin = "vroot" }, + }, + }, + ["q"] = { + help = "quit options", + messages = { + "PopMode", + { SwitchModeBuiltin = "quit" }, + }, + }, + }, + on_number = { + help = "go to index", + messages = { + "PopMode", + { SwitchModeBuiltin = "number" }, + "BufferInputFromKey", + }, + }, + }, +} + +-- The builtin quit mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.quit = { + name = "quit", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["enter"] = { + help = "just quit", + messages = { + "Quit", + }, + }, + ["p"] = { + help = "quit printing pwd", + messages = { + "PrintPwdAndQuit", + }, + }, + ["f"] = { + help = "quit printing focus", + messages = { + "PrintFocusPathAndQuit", + }, + }, + ["s"] = { + help = "quit printing selection", + messages = { + "PrintSelectionAndQuit", + }, + }, + ["r"] = { + help = "quit printing result", + messages = { + "PrintResultAndQuit", + }, + }, + }, + }, +} + +-- The builtin search mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.search = { + name = "search", + prompt = "/", + key_bindings = { + on_key = { + ["up"] = { + help = "up", + messages = { + "FocusPrevious", + }, + }, + ["down"] = { + help = "down", + messages = { + "FocusNext", + }, + }, + ["right"] = { + help = "enter", + messages = { + "Enter", + { SetInputBuffer = "" }, + }, + }, + ["left"] = { + help = "back", + messages = { + "Back", + { SetInputBuffer = "" }, + }, + }, + ["tab"] = { + help = "toggle selection", + messages = { + "ToggleSelection", + "FocusNext", + }, + }, + ["enter"] = { + help = "submit", + messages = { + "AcceptSearch", + "PopMode", + }, + }, + ["esc"] = { + help = "cancel", + messages = { + "CancelSearch", + "PopMode", + }, + }, + }, + default = { + messages = { + "UpdateInputBufferFromKey", + "SearchFuzzyFromInput", + "ExplorePwdAsync", + }, + }, + }, +} + +xplr.config.modes.builtin.search.key_bindings.on_key["ctrl-n"] = + xplr.config.modes.builtin.search.key_bindings.on_key["down"] +xplr.config.modes.builtin.search.key_bindings.on_key["ctrl-p"] = + xplr.config.modes.builtin.search.key_bindings.on_key["up"] + +-- The builtin filter mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.filter = { + name = "filter", + key_bindings = { + on_key = { + ["r"] = { + help = "relative path does match regex", + messages = { + { SwitchModeBuiltin = "relative_path_does_match_regex" }, + { SetInputBuffer = "" }, + { AddNodeFilterFromInput = "RelativePathDoesMatchRegex" }, + "ExplorePwdAsync", + }, + }, + ["R"] = { + help = "relative path does not match regex", + messages = { + { SwitchModeBuiltin = "relative_path_does_not_match_regex" }, + { SetInputBuffer = "" }, + { AddNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, + "ExplorePwdAsync", + }, + }, + ["backspace"] = { + help = "remove last filter", + messages = { + "RemoveLastNodeFilter", + "ExplorePwdAsync", + }, + }, + ["ctrl-r"] = { + help = "reset filters", + messages = { + "ResetNodeFilters", + "ExplorePwdAsync", + }, + }, + ["ctrl-u"] = { + help = "clear filters", + messages = { + "ClearNodeFilters", + "ExplorePwdAsync", + }, + }, + }, + }, +} + +-- The builtin relative_path_does_match_regex mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.relative_path_does_match_regex = { + name = "relative path does match regex", + prompt = xplr.config.general.sort_and_filter_ui.filter_identifiers.RelativePathDoesMatchRegex.format, + key_bindings = { + on_key = { + ["enter"] = { + help = "submit", + messages = { + "PopMode", + }, + }, + ["esc"] = { + messages = { + { RemoveNodeFilterFromInput = "RelativePathDoesMatchRegex" }, + "PopMode", + "ExplorePwdAsync", + }, + }, + }, + default = { + messages = { + { RemoveNodeFilterFromInput = "RelativePathDoesMatchRegex" }, + "UpdateInputBufferFromKey", + { AddNodeFilterFromInput = "RelativePathDoesMatchRegex" }, + "ExplorePwdAsync", + }, + }, + }, +} + +-- The builtin relative_path_does_not_match_regex mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.relative_path_does_not_match_regex = { + name = "relative path does not match regex", + prompt = xplr.config.general.sort_and_filter_ui.filter_identifiers.RelativePathDoesNotMatchRegex.format, + key_bindings = { + on_key = { + ["enter"] = { + help = "submit", + messages = { + "PopMode", + }, + }, + ["esc"] = { + messages = { + { RemoveNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, + "PopMode", + "ExplorePwdAsync", + }, + }, + }, + default = { + messages = { + { RemoveNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, + "UpdateInputBufferFromKey", + { AddNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, + "ExplorePwdAsync", + }, + }, + }, +} + +-- The builtin sort mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.sort = { + name = "sort", + key_bindings = { + on_key = { + ["!"] = { + help = "reverse sorters", + messages = { + "ReverseNodeSorters", + "ExplorePwdAsync", + }, + }, + ["E"] = { + help = "by canonical extension reverse", + messages = { + { AddNodeSorter = { sorter = "ByCanonicalExtension", reverse = true } }, + "ExplorePwdAsync", + }, + }, + ["M"] = { + help = "by canonical mime essence reverse", + messages = { + { AddNodeSorter = { sorter = "ByCanonicalMimeEssence", reverse = true } }, + "ExplorePwdAsync", + }, + }, + ["N"] = { + help = "by node type reverse", + messages = { + { AddNodeSorter = { sorter = "ByCanonicalIsDir", reverse = true } }, + { AddNodeSorter = { sorter = "ByCanonicalIsFile", reverse = true } }, + { AddNodeSorter = { sorter = "ByIsSymlink", reverse = true } }, + "ExplorePwdAsync", + }, + }, + ["R"] = { + help = "by relative path reverse", + messages = { + { AddNodeSorter = { sorter = "ByIRelativePath", reverse = true } }, + "ExplorePwdAsync", + }, + }, + ["S"] = { + help = "by size reverse", + messages = { + { AddNodeSorter = { sorter = "BySize", reverse = true } }, + "ExplorePwdAsync", + }, + }, + ["backspace"] = { + help = "remove last sorter", + messages = { + "RemoveLastNodeSorter", + "ExplorePwdAsync", + }, + }, + ["ctrl-r"] = { + help = "reset sorters", + messages = { + "ResetNodeSorters", + "ExplorePwdAsync", + }, + }, + ["ctrl-u"] = { + help = "clear sorters", + messages = { + "ClearNodeSorters", + "ExplorePwdAsync", + }, + }, + ["e"] = { + help = "by canonical extension", + messages = { + { AddNodeSorter = { sorter = "ByCanonicalExtension", reverse = false } }, + "ExplorePwdAsync", + }, + }, + ["enter"] = { + help = "submit", + messages = { + "PopMode", + }, + }, + ["m"] = { + help = "by canonical mime essence", + messages = { + { AddNodeSorter = { sorter = "ByCanonicalMimeEssence", reverse = false } }, + "ExplorePwdAsync", + }, + }, + ["n"] = { + help = "by node type", + messages = { + { AddNodeSorter = { sorter = "ByCanonicalIsDir", reverse = false } }, + { AddNodeSorter = { sorter = "ByCanonicalIsFile", reverse = false } }, + { AddNodeSorter = { sorter = "ByIsSymlink", reverse = false } }, + "ExplorePwdAsync", + }, + }, + ["r"] = { + help = "by relative path", + messages = { + { AddNodeSorter = { sorter = "ByIRelativePath", reverse = false } }, + "ExplorePwdAsync", + }, + }, + ["s"] = { + help = "by size", + messages = { + { AddNodeSorter = { sorter = "BySize", reverse = false } }, + "ExplorePwdAsync", + }, + }, + ["c"] = { + help = "by created", + messages = { + { AddNodeSorter = { sorter = "ByCreated", reverse = false } }, + "ExplorePwdAsync", + }, + }, + ["C"] = { + help = "by created reverse", + messages = { + { AddNodeSorter = { sorter = "ByCreated", reverse = true } }, + "ExplorePwdAsync", + }, + }, + ["l"] = { + help = "by last modified", + messages = { + { AddNodeSorter = { sorter = "ByLastModified", reverse = false } }, + "ExplorePwdAsync", + }, + }, + ["L"] = { + help = "by last modified reverse", + messages = { + { AddNodeSorter = { sorter = "ByLastModified", reverse = true } }, + "ExplorePwdAsync", + }, + }, + }, + }, +} + +-- The builtin switch layout mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.switch_layout = { + name = "switch layout", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["1"] = { + help = "default", + messages = { + { SwitchLayoutBuiltin = "default" }, + "PopMode", + }, + }, + ["2"] = { + help = "no help menu", + messages = { + { SwitchLayoutBuiltin = "no_help" }, + "PopMode", + }, + }, + ["3"] = { + help = "no selection panel", + messages = { + { SwitchLayoutBuiltin = "no_selection" }, + "PopMode", + }, + }, + ["4"] = { + help = "no help or selection", + messages = { + { SwitchLayoutBuiltin = "no_help_no_selection" }, + "PopMode", + }, + }, + }, + }, +} + +-- The builtin vroot mode. +-- +-- Type: [Mode](https://xplr.dev/en/mode) +xplr.config.modes.builtin.vroot = { + name = "vroot", + layout = "HelpMenu", + key_bindings = { + on_key = { + ["v"] = { + help = "toggle vroot", + messages = { + "PopMode", + "ToggleVroot", + }, + }, + ["."] = { + help = "vroot $PWD", + messages = { + "PopMode", + { + BashExecSilently0 = [===[ + "$XPLR" -m 'SetVroot: %q' "${PWD:?}" + ]===], + }, + }, + }, + ["/"] = { + help = "vroot /", + messages = { + "PopMode", + { SetVroot = "/" }, + }, + }, + ["~"] = { + help = "vroot $HOME", + messages = { + "PopMode", + { + BashExecSilently0 = [===[ + "$XPLR" -m 'SetVroot: %q' "${HOME:?}" + ]===], + }, + }, + }, + ["ctrl-r"] = { + help = "reset vroot", + messages = { + "PopMode", + "ResetVroot", + }, + }, + ["ctrl-u"] = { + help = "unset vroot", + messages = { + "PopMode", + "UnsetVroot", + }, + }, + }, + }, +} + +-- This is where you define custom modes. +-- +-- Type: mapping of the following key-value pairs: +-- +-- * key: string +-- * value: [Mode](https://xplr.dev/en/mode) +-- +-- Example: +-- +-- ```lua +-- xplr.config.modes.custom.example = { +-- name = "example", +-- key_bindings = { +-- on_key = { +-- enter = { +-- help = "default mode", +-- messages = { +-- "PopMode", +-- { SwitchModeBuiltin = "default" }, +-- }, +-- }, +-- }, +-- }, +-- } +-- +-- xplr.config.general.initial_mode = "example" +-- ``` +xplr.config.modes.custom = {} + +-- ## Function ---------------------------------------------------------------- +-- +-- While `xplr.config` defines all the static parts of the configuration, +-- `xplr.fn` defines all the dynamic parts using functions. +-- +-- See: [Lua Function Calls](https://xplr.dev/en/lua-function-calls) +-- +-- As always, `xplr.fn.builtin` is where the built-in functions are defined +-- that can be overwritten. + +-- Tries to auto complete the path in the input buffer +xplr.fn.builtin.try_complete_path = function(m) + if not m.input_buffer then + return + end + + local function matches_all(str, paths) + for _, path in ipairs(paths) do + if string.sub(path, 1, #str) ~= str then + return false + end + end + return true + end + + local path = m.input_buffer + local explorer_config = { + filters = { + { filter = "RelativePathDoesStartWith", input = xplr.util.basename(path) }, + }, + } + local parent = xplr.util.dirname(path) + if not parent or parent == "" then + parent = "./" + elseif parent ~= "/" then + parent = parent .. "/" + end + + local nodes = xplr.util.explore(parent, explorer_config) + local found = {} + for _, node in ipairs(nodes) do + table.insert(found, parent .. node.relative_path) + end + local count = #found + + if count == 0 then + return + elseif count == 1 then + return { + { SetInputBuffer = found[1] }, + } + else + local first = found[1] + while #first > #path and matches_all(path, found) do + path = string.sub(first, 1, #path + 1) + end + + if matches_all(path, found) then + return { + { SetInputBuffer = path }, + } + end + + return { + { SetInputBuffer = string.sub(path, 1, #path - 1) }, + } + end +end + +-- Renders the first column in the table +xplr.fn.builtin.fmt_general_table_row_cols_0 = function(m) + local r = "" + if m.is_before_focus then + r = r .. " -" + else + r = r .. " " + end + + r = r .. m.relative_index .. "│" .. m.index + + return r +end + +-- Renders the second column in the table +xplr.fn.builtin.fmt_general_table_row_cols_1 = function(m) + local r = m.tree .. m.prefix + + local function path_escape(path) + return string.gsub(string.gsub(path, "\\", "\\\\"), "\n", "\\n") + end + + if m.meta.icon == nil then + r = r .. "" + else + r = r .. m.meta.icon .. " " + end + + r = r .. path_escape(m.relative_path) + + if m.is_dir then + r = r .. "/" + end + + r = r .. m.suffix .. " " + + if m.is_symlink then + r = r .. "-> " + + if m.is_broken then + r = r .. "×" + else + r = r .. path_escape(m.symlink.absolute_path) + + if m.symlink.is_dir then + r = r .. "/" + end + end + end + + return r +end + +-- Renders the third column in the table +xplr.fn.builtin.fmt_general_table_row_cols_2 = function(m) + local no_color = os.getenv("NO_COLOR") + + local function green(x) + if no_color == nil then + return "\x1b[32m" .. x .. "\x1b[0m" + else + return x + end + end + + local function yellow(x) + if no_color == nil then + return "\x1b[33m" .. x .. "\x1b[0m" + else + return x + end + end + + local function red(x) + if no_color == nil then + return "\x1b[31m" .. x .. "\x1b[0m" + else + return x + end + end + + local function bit(x, color, cond) + if cond then + return color(x) + else + return color("-") + end + end + + local p = m.permissions + + local r = "" + + r = r .. bit("r", green, p.user_read) + r = r .. bit("w", yellow, p.user_write) + + if p.user_execute == false and p.setuid == false then + r = r .. bit("-", red, p.user_execute) + elseif p.user_execute == true and p.setuid == false then + r = r .. bit("x", red, p.user_execute) + elseif p.user_execute == false and p.setuid == true then + r = r .. bit("S", red, p.user_execute) + else + r = r .. bit("s", red, p.user_execute) + end + + r = r .. bit("r", green, p.group_read) + r = r .. bit("w", yellow, p.group_write) + + if p.group_execute == false and p.setuid == false then + r = r .. bit("-", red, p.group_execute) + elseif p.group_execute == true and p.setuid == false then + r = r .. bit("x", red, p.group_execute) + elseif p.group_execute == false and p.setuid == true then + r = r .. bit("S", red, p.group_execute) + else + r = r .. bit("s", red, p.group_execute) + end + + r = r .. bit("r", green, p.other_read) + r = r .. bit("w", yellow, p.other_write) + + if p.other_execute == false and p.setuid == false then + r = r .. bit("-", red, p.other_execute) + elseif p.other_execute == true and p.setuid == false then + r = r .. bit("x", red, p.other_execute) + elseif p.other_execute == false and p.setuid == true then + r = r .. bit("T", red, p.other_execute) + else + r = r .. bit("t", red, p.other_execute) + end + + return r +end + +-- Renders the fourth column in the table +xplr.fn.builtin.fmt_general_table_row_cols_3 = function(m) + if not m.is_dir then + return m.human_size + else + return "" + end +end + +-- Renders the fifth column in the table +xplr.fn.builtin.fmt_general_table_row_cols_4 = function(m) + return tostring(os.date("%a %b %d %H:%M:%S %Y", m.last_modified / 1000000000)) +end + +-- This is where the custom functions can be added. +-- +-- There is currently no restriction on what kind of functions can be defined +-- in `xplr.fn.custom`. +-- +-- You can also use nested tables such as +-- `xplr.fn.custom.my_plugin.my_function` to define custom functions. +xplr.fn.custom = {} + +-- ## Hooks ------------------------------------------------------------------- +-- +-- This section of the configuration cannot be overwritten by another config +-- file or plugin, since this is an optional lua return statement specific to +-- each config file. It can be used to define things that should be explicit +-- for reasons like performance concerns, such as hooks. +-- +-- Plugins should expose the hooks, and require users to subscribe to them +-- explicitly. +-- +-- Example: +-- +-- ```lua +-- return { +-- -- Add messages to send when the xplr loads. +-- -- This is similar to the `--on-load` command-line option. +-- -- +-- -- Type: list of [Message](https://xplr.dev/en/message#message)s +-- on_load = { +-- { LogSuccess = "Configuration successfully loaded!" }, +-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_load" }, +-- }, +-- +-- -- Add messages to send when the directory changes. +-- -- +-- -- Type: list of [Message](https://xplr.dev/en/message#message)s +-- on_directory_change = { +-- { LogSuccess = "Changed directory" }, +-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_directory_change" }, +-- }, +-- +-- -- Add messages to send when the focus changes. +-- -- +-- -- Type: list of [Message](https://xplr.dev/en/message#message)s +-- on_focus_change = { +-- { LogSuccess = "Changed focus" }, +-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_focus_change" }, +-- } +-- +-- -- Add messages to send when the mode is switched. +-- -- +-- -- Type: list of [Message](https://xplr.dev/en/message#message)s +-- on_mode_switch = { +-- { LogSuccess = "Switched mode" }, +-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_mode_switch" }, +-- } +-- +-- -- Add messages to send when the layout is switched +-- -- +-- -- Type: list of [Message](https://xplr.dev/en/message#message)s +-- on_layout_switch = { +-- { LogSuccess = "Switched layout" }, +-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_layout_switch" }, +-- } +-- } +-- ``` + +local home = os.getenv("HOME") +local xpm_path = home .. "/.local/share/xplr/dtomvan/xpm.xplr" +local xpm_url = "https://github.com/dtomvan/xpm.xplr" + +package.path = package.path .. ";" .. xpm_path .. "/?.lua;" .. xpm_path .. "/?/init.lua" + +os.execute(string.format("[ -e '%s' ] || git clone '%s' '%s'", xpm_path, xpm_url, xpm_path)) + +require("xpm").setup({ + plugins = { + "dtomvan/xpm.xplr", + "Junker/nuke.xplr", + }, + auto_install = true, + auto_cleanup = true, +}) + +xplr.config.modes.builtin.default.key_bindings.on_key.x = { + help = "xpm", + messages = { + "PopMode", + { SwitchModeCustom = "xpm" }, + }, +} + +require("nuke").setup({ + pager = "less -R", -- default: less -R + open = { + run_executables = false, -- default: false + custom = { + { mime = "image/*", command = "nsxiv -aio {}" }, + { mime = "video/*", command = "mpv {} -quiet" }, + { mime = "audio/*", command = "mpv --audio-display=no {}" }, + }, + }, + view = { + show_line_numbers = true, -- default: false + }, + smart_view = { + custom = { + { extension = "so", command = "ldd -r {} | less" }, + }, + }, +}) + +return { + on_load = {}, + on_directory_change = {}, + on_focus_change = {}, + on_mode_switch = {}, + on_layout_switch = {}, +} diff --git a/.config/zsh/.zprofile-wayland b/.config/zsh/.zprofile-wayland index fac5a9f4..ddc3dd21 100644 --- a/.config/zsh/.zprofile-wayland +++ b/.config/zsh/.zprofile-wayland @@ -1,5 +1,8 @@ -#!/bin/zsh +#!/bin/sh -if [ "$(tty)" = "/dev/tty1" ]; then - pgrep Hyprland || Hyprland -fi +export WM="Hyprland" +export XDG_CURRENT_DESKTOP=Hyprland +export XDG_SESSION_TYPE=wayland +export XDG_SESSION_DESKTOP=Hyprland + +[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Hyprland >/dev/null 2>&1 && Hyprland diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 9ec0f13b..43ad55a4 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -81,7 +81,18 @@ lfcd() { lf -last-dir-path="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" - [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" || return + fi +} + + +xplrcd() { + tmp="$(mktemp -uq)" + trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT + xplr -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" || return fi } diff --git a/.local/bin/compiler b/.local/bin/compiler index d15befc5..7bc8f9c5 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -13,14 +13,15 @@ file=$(readlink -f "$1") dir=${file%/*} base="${file%.*}" ext="${file##*.}" +echo "$file" cd "$dir" || exit 1 textype() { textarget="$(getcomproot "$file" || echo "$file")" echo "$textarget" - command="pdflatex" - (head -n5 "$textarget" | grep -qi 'xelatex') && command="xelatex" + command="luatex" + (head -n5 "$textarget" | grep -qi "xelatex") && command="xelatex" $command --output-directory="${textarget%/*}" "${textarget%.*}" grep -qi addbibresource "$textarget" && biber --input-directory "${textarget%/*}" "${textarget%.*}" && @@ -32,12 +33,13 @@ case "$ext" in # Try to keep these cases in alphabetical order. [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf >"$base".pdf ;; c) cc "$file" -o "$base" && "$base" ;; -cpp) g++ "$file" -o "$base" && "$base" ;; +cpp | cc) g++ "$file" -o "$base" && "$base" ;; cs) mcs "$file" && mono "$base".exe ;; go) go run "$file" ;; h) sudo make install ;; java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; m) octave "$file" ;; +*/Makefile) make --file "$file" ;; md) if [ -x "$(command -v lowdown)" ]; then lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf >"$base".pdf elif [ -x "$(command -v groffdown)" ]; then @@ -50,7 +52,7 @@ ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;; org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;; py) python "$file" ;; [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; -rs) cargo build ;; +rs) cargo run ;; sass) sassc -a "$file" "$base".css ;; scad) openscad -o "$base".stl "$file" ;; sent) setsid -f sent "$file" 2>/dev/null ;; diff --git a/.local/bin/imv-open b/.local/bin/imv-open new file mode 100644 index 00000000..fd6ec260 --- /dev/null +++ b/.local/bin/imv-open @@ -0,0 +1,23 @@ +#!/bin/sh + +FIFO_PATH="$1" +IMAGE="$2" +MAINWINDOW="$(xdotool getactivewindow)" +IMV_PID="$(pgrep nsxiv)" + +if [ ! "$IMV_PID" ]; then + nsxiv -aio "$IMAGE" & + IMV_PID=$! +fi + +sleep 0.5 + +xdotool windowactivate "$MAINWINDOW" + +while read -r path; do + imv-msg "$IMV_PID" close all + imv-msg "$IMV_PID" open "$path" +done <"$FIFO_PATH" + +imv-msg "$IMV_PID" quit +[ -e "$FIFO_PATH" ] && rm -f -- "$FIFO_PATH" diff --git a/.local/bin/lfub b/.local/bin/lfub index 7cf8b4fd..299f1505 100755 --- a/.local/bin/lfub +++ b/.local/bin/lfub @@ -1,4 +1,9 @@ #!/bin/sh + +# 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() { @@ -9,11 +14,11 @@ cleanup() { if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then lf "$@" else - [ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf" + [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" mkfifo "$FIFO_UEBERZUG" ueberzug layer -s -p json <"$FIFO_UEBERZUG" & exec 3>"$FIFO_UEBERZUG" - trap cleanup EXIT + trap cleanup HUP INT QUIT TERM PWR EXIT lf "$@" 3>&- fi diff --git a/.local/bin/remaps b/.local/bin/remaps index bd5f5c48..12bce668 100755 --- a/.local/bin/remaps +++ b/.local/bin/remaps @@ -14,4 +14,4 @@ killall xcape 2>/dev/null # Turn off caps lock if on since there is no longer a key for it. xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock # Turn on num lock -xset -q | grep "Num Lock:\s*on" && xdotool key Num_Lock +xset -q | grep "Num Lock:\s*off" && xdotool key Num_Lock diff --git a/.local/share/fonts/brill/.uuid b/.local/share/fonts/brill/.uuid new file mode 100644 index 00000000..10da2518 --- /dev/null +++ b/.local/share/fonts/brill/.uuid @@ -0,0 +1 @@ +9b2f00a5-323b-4f7b-89d5-82ada7d245ea \ No newline at end of file diff --git a/.local/share/fonts/brill/Brill-Bold.ttf b/.local/share/fonts/brill/Brill-Bold.ttf new file mode 100644 index 00000000..a015b732 Binary files /dev/null and b/.local/share/fonts/brill/Brill-Bold.ttf differ diff --git a/.local/share/fonts/brill/Brill-BoldItalic.ttf b/.local/share/fonts/brill/Brill-BoldItalic.ttf new file mode 100644 index 00000000..d0a56057 Binary files /dev/null and b/.local/share/fonts/brill/Brill-BoldItalic.ttf differ diff --git a/.local/share/fonts/brill/Brill-Italic.ttf b/.local/share/fonts/brill/Brill-Italic.ttf new file mode 100644 index 00000000..658c96c5 Binary files /dev/null and b/.local/share/fonts/brill/Brill-Italic.ttf differ diff --git a/.local/share/fonts/brill/Brill-Roman.ttf b/.local/share/fonts/brill/Brill-Roman.ttf new file mode 100644 index 00000000..150ea349 Binary files /dev/null and b/.local/share/fonts/brill/Brill-Roman.ttf differ diff --git a/.local/share/fonts/brill/Brill_typeface_end_user_license_agreement.pdf b/.local/share/fonts/brill/Brill_typeface_end_user_license_agreement.pdf new file mode 100644 index 00000000..af654df6 Binary files /dev/null and b/.local/share/fonts/brill/Brill_typeface_end_user_license_agreement.pdf differ diff --git a/.local/share/fonts/brill/Brill_version_4_00_for_non_commercial_use.pdf b/.local/share/fonts/brill/Brill_version_4_00_for_non_commercial_use.pdf new file mode 100644 index 00000000..68f6b6e0 Binary files /dev/null and b/.local/share/fonts/brill/Brill_version_4_00_for_non_commercial_use.pdf differ diff --git a/.local/share/fonts/brill/The_Brill_Typeface_Package_v_4_0.zip b/.local/share/fonts/brill/The_Brill_Typeface_Package_v_4_0.zip new file mode 100644 index 00000000..85d57308 Binary files /dev/null and b/.local/share/fonts/brill/The_Brill_Typeface_Package_v_4_0.zip differ