diff --git a/.bash_exports b/.bash_exports index c600aff..2387c27 100644 --- a/.bash_exports +++ b/.bash_exports @@ -14,6 +14,12 @@ export PROMPT_COMMAND="history -a" export GCM_CREDENTIAL_STORE=cache +# zoxide +if command -v zoxide >/dev/null 2>&1; then + eval "$(zoxide init bash)" +fi + + # pyenv if command -v pyenv >/dev/null 2>&1; then export PYENV_ROOT="$HOME/.pyenv" diff --git a/.bash_profile b/.bash_profile index 5831706..7f65d4e 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,3 +1,4 @@ +# includes if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi @@ -6,10 +7,9 @@ if [ -f "$HOME/.bash_exports" ]; then . "$HOME/.bash_exports" fi -# if ! shopt -oq posix; then -# if [ -f /usr/share/bash-completion/bash_completion ]; then -# . /usr/share/bash-completion/bash_completion -# elif [ -f /etc/bash_completion ]; then -# . /etc/bash_completion -# fi -# fi +# bash decorations +# arch-linux default: +# PS1='[\u@\h \W]\$ ' +# servers: +# PS1='|\u@\h \W|\$ ' +PS1='[\u@\h \W]\$ ' diff --git a/.bashrc b/.bashrc index 7577604..ee82ff5 100644 --- a/.bashrc +++ b/.bashrc @@ -1,12 +1,4 @@ -# additional aliases -if [ -f "$HOME/.bash_private" ]; then - . "$HOME/.bash_private" -fi -if [ -f "$HOME/.bash_aliases" ]; then - . "$HOME/.bash_aliases" -fi - -# saving aliases aliases +# aliases aliases alias aliasm='alias |comm -13 <(grep -h ^alias ~/.bashrc ~/.bash_private | sort) -' alias aliasd='aliasm |diff -u --color ~/.bash_aliases -' alias aliasr='unalias -a; . ~/.bashrc' @@ -21,50 +13,62 @@ alias l='ls --color=auto' alias s='ls --color=auto' # cd aliases +alias cr='cd ..' alias cdp='cd ~/Programming' alias cds='cd ~/services' alias cdd='cd ~/Downloads' alias cdt='cd ~/tmp' +alias cdn='cd ~/Documents/obsidian/Notes' alias cda='cd /run/media/$USER/' # rm aliases -alias cleartmp='rm -r ~/tmp/*' +alias rmr='rm -rf' # grep aliases alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' -# edit configs aliases -alias cfghypr='(nvim ~/.config/hypr)' -alias cfgkitty='(nvim ~/.config/kitty)' -alias cfgnvim='(nvim ~/.config/nvim)' -alias cfgrofi='(nvim ~/.config/rofi)' -alias cfgwaybar='(nvim ~/.config/waybar)' -alias cfgdunst='(nvim ~/.config/dunst)' -alias cfgyazi='(nvim ~/.config/yazi)' -alias cfgfastfetch='(nvim ~/.config/fastfetch)' -alias cfgbash='(nvim ~/.config/bash)' - -# utils aliases -alias y='yazi' -alias py='python' -alias pyv='python --version' -alias clipclear='cliphist wipe' -alias scrcpy-def='scrcpy -S --no-audio -K' -alias hload='hyprctl reload' +# wm aliases alias shy='start-hyprland' +alias hload='hyprctl reload' +alias sudo-gtk='sudo WAYLAND_DISPLAY="$WAYLAND_DISPLAY" XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR"' + +# edit aliases +alias cfgssh='(cd ~/.ssh && nvim .)' +alias cfghypr='(cd ~/.config/hypr && nvim .)' +alias cfgkitty='(cd ~/.config/kitty && nvim .)' +alias cfgnvim='(cd ~/.config/nvim && nvim .)' +alias cfgrofi='(cd ~/.config/rofi && nvim .)' +alias cfgwaybar='(cd ~/.config/waybar && nvim .)' +alias cfgdunst='(cd ~/.config/dunst && nvim .)' +alias cfgyazi='(cd ~/.config/yazi && nvim .)' +alias cfgfastfetch='(cd ~/.config/fastfetch && nvim .)' +alias cfgbash='(cd ~/.config/bash && nvim .)' +alias cfgquickshell='(cd ~/.config/quickshell && nvim .)' +alias cfgdriftwm='(cd ~/.config/driftwm && nvim .)' +alias cfgscripts='(cd ~/config-scripts && nvim .)' +alias script='(cd ~/scripts && nvim .)' +alias scripts='(cd ~/scripts && nvim .)' +alias notes='(cd ~/Documents/obsidian/Notes && nvim .)' + +# tmp handling aliases +alias cleartmp='rm -rf ~/tmp && mkdir -p ~/tmp/daily' +alias tmp='(cd ~/tmp/daily && nvim $(date +"%Y-%m-%d-%H").md)' +alias tmpmd='(cd ~/tmp/daily && nvim $(date +"%Y-%m-%d-%H").md)' +alias tmppy='(cd ~/tmp/daily && nvim $(date +"%Y-%m-%d-%H").py)' +alias tmpsh='(cd ~/tmp/daily && nvim $(date +"%Y-%m-%d-%H").sh)' + +# productivity aliases +alias profile='source ~/.bash_profile' +# rewrite "modes" to scripts +alias mode-local='cat ~/.config/nvim/lua/templates/clipboard/local-clipboard.lua > ~/.config/nvim/lua/config/clipboard.lua' +alias mode-remote='cat ~/.config/nvim/lua/templates/clipboard/remote-clipboard.lua > ~/.config/nvim/lua/config/clipboard.lua' + +# wifi aliases alias wifi-reload='nmcli r wifi off && nmcli r wifi on' alias wifi-reload-off='nmcli r wifi off' alias wifi-reload-on='nmcli r wifi on' -alias swagger-docs='sudo host-docs' -alias share='python3 -m http.server' -alias globalshare='(cd ~/Share && python3 -m http.server)' -alias download='aria2c -x16 -s16' -alias docker-enable='sudo systemctl start docker.service' -alias docker-disable='sudo systemctl stop docker.service && sudo systemctl stop docker.socket' -alias docker-status='sudo systemctl status docker.service' -alias sudo-gtk='sudo WAYLAND_DISPLAY="$WAYLAND_DISPLAY" XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR"' # kitty aliases alias ssh='kitty +kitten ssh' @@ -73,13 +77,48 @@ alias edit-in-kitty='kitten edit-in-kitty' # yay/pacman aliases alias pzf='yay -Qq | fzf --preview '\''yay -Qil {}'\'' --layout reverse --bind '\''enter:execute(yay -Qil {} | less)'\'' --bind '\''ctrl-r:execute(yay -R {} | less)'\''' alias paclean='sudo pacman -Rs ' +alias update='yay --noconfirm' -# fastfetch -alias fastfetch='python3 ~/.config/fastfetch/detect_os.py' -alias ff='python3 ~/.config/fastfetch/detect_os.py' +# fastfetch aliases +alias fastfetch='~/.config/fastfetch/detect_os.py' +alias ff='~/.config/fastfetch/detect_os.py' + +# curl aliases +alias post='curl -X POST -H "Content-Type: application\json"' +alias get='curl -X GET' + +# docker aliases +alias docker-enable='sudo systemctl start docker.service' +alias docker-disable='sudo systemctl stop docker.service && sudo systemctl stop docker.socket' +alias docker-status='sudo systemctl status docker.service' +alias dcd='sudo docker compose down' +alias dcu='sudo docker compose up' +alias dcp='sudo docker compose pull' +alias swagger-docs='sudo host-docs' + +# other utils aliases +alias x='sudo chmod +x' +alias y='yazi' +alias n='nvim .' +alias py='python' +alias pyv='python --version' +alias clipclear='cliphist wipe' +alias download='aria2c -x16 -s16' +alias scrcpy-def='scrcpy -S --no-audio -K' +alias share='python3 -m http.server' +alias globalshare='(cd ~/Share && python3 -m http.server)' # fun aliases alias mm='unimatrix -f -a -s 92 -l coo -c yellow' alias mmbee='unimatrix -f -a -s 86 -u '\''bee'\'' -c yellow' alias mmbeesquit='unimatrix -f -s 86 -u '\''beesquit'\'' -c yellow' alias mmsnow='unimatrix -u ❄❆❅᪥𑁍⭒*❄❆❅᪥* -c white -a' + +# extra +# additional aliases +if [ -f "$HOME/.bash_private" ]; then + . "$HOME/.bash_private" +fi +if [ -f "$HOME/.bash_aliases" ]; then + . "$HOME/.bash_aliases" +fi diff --git a/.config/fastfetch/detect_os.py b/.config/fastfetch/detect_os.py index 9695e83..d2b613b 100644 --- a/.config/fastfetch/detect_os.py +++ b/.config/fastfetch/detect_os.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import os import platform import subprocess diff --git a/.config/hypr/Wallpapers/Abstract/retro-arch-centered.png b/.config/hypr/Wallpapers/Abstract/retro-arch-centered.png new file mode 100644 index 0000000..7751d5c Binary files /dev/null and b/.config/hypr/Wallpapers/Abstract/retro-arch-centered.png differ diff --git a/.config/hypr/Wallpapers/Abstract/retro-arch.png b/.config/hypr/Wallpapers/Abstract/retro-arch.png new file mode 100644 index 0000000..5bc8ed1 Binary files /dev/null and b/.config/hypr/Wallpapers/Abstract/retro-arch.png differ diff --git a/.config/hypr/Wallpapers/Unsorted/gamer.jpg b/.config/hypr/Wallpapers/Anime/gamer.jpg similarity index 100% rename from .config/hypr/Wallpapers/Unsorted/gamer.jpg rename to .config/hypr/Wallpapers/Anime/gamer.jpg diff --git a/.config/hypr/Wallpapers/Unsorted/kita.png b/.config/hypr/Wallpapers/Anime/kita.png similarity index 100% rename from .config/hypr/Wallpapers/Unsorted/kita.png rename to .config/hypr/Wallpapers/Anime/kita.png diff --git a/.config/hypr/Wallpapers/Unsorted/kotamota.png b/.config/hypr/Wallpapers/Anime/kotamota.png similarity index 100% rename from .config/hypr/Wallpapers/Unsorted/kotamota.png rename to .config/hypr/Wallpapers/Anime/kotamota.png diff --git a/.config/hypr/Wallpapers/Unsorted/pink.png b/.config/hypr/Wallpapers/Anime/pink.png similarity index 100% rename from .config/hypr/Wallpapers/Unsorted/pink.png rename to .config/hypr/Wallpapers/Anime/pink.png diff --git a/.config/hypr/Wallpapers/Nature/bamboo.jpg b/.config/hypr/Wallpapers/Nature/bamboo.jpg new file mode 100644 index 0000000..84275b4 Binary files /dev/null and b/.config/hypr/Wallpapers/Nature/bamboo.jpg differ diff --git a/.config/hypr/Wallpapers/Nature/foggy-everforest.jpg b/.config/hypr/Wallpapers/Nature/foggy-everforest.jpg new file mode 100644 index 0000000..6d75259 Binary files /dev/null and b/.config/hypr/Wallpapers/Nature/foggy-everforest.jpg differ diff --git a/.config/hypr/Wallpapers/Unsorted/pagoda-sunset.jpeg b/.config/hypr/Wallpapers/Unsorted/pagoda-sunset.jpeg new file mode 100644 index 0000000..df613e1 Binary files /dev/null and b/.config/hypr/Wallpapers/Unsorted/pagoda-sunset.jpeg differ diff --git a/.config/hypr/config/autostart.conf b/.config/hypr/config/autostart.conf index 113e6c7..512c9d1 100644 --- a/.config/hypr/config/autostart.conf +++ b/.config/hypr/config/autostart.conf @@ -1,20 +1,31 @@ -# TODO: testing -exec-once = bash -c "sleep 1 && for monitor in $(hyprctl monitors -j | jq -r '.[].name'); do hyprctl dispatch workspace 100 && hyprctl dispatch focusworkspaceoncurrentmonitor 100; done" - +# System +# Initialize dbus exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP +# Set workspace 100 for the scroll-left support +exec-once = bash -c "sleep 1 && for monitor in $(hyprctl monitors -j | jq -r '.[].name'); do hyprctl dispatch workspace 100 && hyprctl dispatch focusworkspaceoncurrentmonitor 100; done" +# Initialize sleep +exec-once = uwsm app -- systemd-inhibit --who="Hyprland config" --why="wlogout keybind" --what=handle-power-key --mode=block sleep infinity +# Run xdg portals exec-once = uwsm app -- /usr/lib/xdg-desktop-portal-hyprland exec-once = uwsm app -- /usr/lib/xdg-desktop-portal exec-once = uwsm app -- /usr/lib/xdg-desktop-portal-gtk -exec-once = uwsm app -- hypridle +# Clipboard +exec-once = uwsm app -- wl-paste --type text --watch cliphist store #Stores only text data +exec-once = uwsm app -- wl-paste --type image --watch cliphist store #Stores only image data +# Essential +exec-once = uwsm app -- dunst exec-once = uwsm app -- awww-daemon exec-once = uwsm app -- awww img "$WALLPAPER" +# Important +exec-once = uwsm app -- hypridle exec-once = uwsm app -- waybar -exec-once = uwsm app -- dunst -exec-once = uwsm app -- wl-paste --type text --watch cliphist store #Stores only text data -exec-once = uwsm app -- wl-paste --type image --watch cliphist store #Stores only image data -exec-once = uwsm app -- systemd-inhibit --who="Hyprland config" --why="wlogout keybind" --what=handle-power-key --mode=block sleep infinity +# Extra +# Color correction +exec-once = uwsm app -- ~/.config/hypr/scripts/color-correction.sh +# Apply GTK themes +exec-once = nwg-look -a diff --git a/.config/hypr/config/binds.conf b/.config/hypr/config/binds.conf index 38a80a0..1a9682c 100644 --- a/.config/hypr/config/binds.conf +++ b/.config/hypr/config/binds.conf @@ -1,6 +1,13 @@ # general $mainMod = SUPER +# change layout that supports no shift retapping +bindl = ALT, Shift_L, exec, hyprctl switchxkblayout main next + + +# Toggle performance mode +bind = $mainMod, F1, exec, ~/.config/hypr/scripts/mode-performance.sh + # navigation binds bind = $mainMod SHIFT, C, killactive @@ -22,12 +29,12 @@ bind = $mainMod SHIFT, T, layoutmsg, swapsplit bind = $mainMod, Q, exec, kitty bind = $mainMod, E, exec, thunar bind = $mainMod, R, exec, rofi -show drun -no-history -matching prefix -drun-match-fields name -no-tokenize -bind = $mainMod SHIFT, R, exec, .config/rofi/network-manager/run-manager.sh +bind = $mainMod SHIFT, R, exec, ~/.config/rofi/network-manager/run-manager.sh +bind = $mainMod, C, exec, hyprpicker -a # copy binds bind = $mainMod, V, exec, rofi -modi clipboard:/$HOME/.config/rofi/clipboard/cliphist-rofi-img.sh -show clipboard -show-icon -config ~/.config/rofi/clipboard-config.rasi -# -config $HOME/.config/rofi/clipboard-config.rasi bind = $mainMod SHIFT, S, exec, IMG=~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).png && grim -g "$(slurp)" $IMG && wl-copy < $IMG bind = , PRINT, exec, grim - | wl-copy @@ -40,57 +47,54 @@ bind = $mainMod, code:49, exec, hyprlock bindr = $mainMod, w, exec, pkill -9 waybar || uwsm app -- waybar +# quickshell bind +bindr = $mainMod SHIFT, w, exec, pkill -9 quickshell || uwsm app -- quickshell + + # multimedia binds -binde = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%; .config/hypr/scripts/dunst/volume.sh -binde = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%; .config/hypr/scripts/dunst/volume-down.sh -bind = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle; .config/hypr/scripts/dunst/volume-mute.sh -bind = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle; .config/hypr/scripts/dunst/micro.sh +binde = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%; ~/.config/hypr/scripts/dunst/volume.sh +binde = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%; ~/.config/hypr/scripts/dunst/volume-down.sh +bind = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle; ~/.config/hypr/scripts/dunst/volume-mute.sh +bind = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle; ~/.config/hypr/scripts/dunst/micro.sh bind = , XF86AudioStop, exec, playerctl stop bind = , XF86AudioPause, exec, playerctl pause -bind = , XF86AudioPrev, exec, playerctl previous; .config/hypr/scripts/dunst/trackinfo.sh -bind = , XF86AudioNext, exec, playerctl next; .config/hypr/scripts/dunst/trackinfo.sh +bind = , XF86AudioPrev, exec, playerctl previous; ~/.config/hypr/scripts/dunst/trackinfo.sh +bind = , XF86AudioNext, exec, playerctl next; ~/.config/hypr/scripts/dunst/trackinfo.sh bind = , XF86AudioPlay, exec, playerctl play-pause -# bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +10% -# bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -10% -# bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle - # brightness binds -binde = , XF86MonBrightnessUp , exec, brightnessctl --class='backlight' set 5%+; .config/hypr/scripts/dunst/brightness.sh -binde = , XF86MonBrightnessDown , exec, brightnessctl --class='backlight' set 5%-; .config/hypr/scripts/dunst/brightness-down.sh +binde = , XF86MonBrightnessUp , exec, brightnessctl --class='backlight' set 5%+; ~/.config/hypr/scripts/dunst/brightness.sh +binde = , XF86MonBrightnessDown , exec, brightnessctl --class='backlight' set 5%-; ~/.config/hypr/scripts/dunst/brightness-down.sh # power binds -# bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, 1920x1080@120, 0x0, 1, vrr, 1" -# bindl = , switch:on:Lid Switch, exec, .config/hypr/scripts/eDPower.sh -# bind = , XF86PowerOff, exec, .config/hypr/scripts/before-sleep.sh bind = , XF86PowerOff, exec, systemctl suspend # Move focus with mainMod + arrow keys -bind = $mainMod, H, movefocus, l -bind = $mainMod, L, movefocus, r -bind = $mainMod, K, movefocus, u -bind = $mainMod, J, movefocus, d +binde = $mainMod, H, movefocus, l +binde = $mainMod, L, movefocus, r +binde = $mainMod, K, movefocus, u +binde = $mainMod, J, movefocus, d -bind = $mainMod, left, movefocus, l -bind = $mainMod, right, movefocus, r -bind = $mainMod, up, movefocus, u -bind = $mainMod, down, movefocus, d +binde = $mainMod, left, movefocus, l +binde = $mainMod, right, movefocus, r +binde = $mainMod, up, movefocus, u +binde = $mainMod, down, movefocus, d -bind = $mainMod SHIFT, H, movewindow, l -bind = $mainMod SHIFT, L, movewindow, r -bind = $mainMod SHIFT, K, movewindow, u -bind = $mainMod SHIFT, J, movewindow, d +binde = $mainMod SHIFT, H, movewindow, l +binde = $mainMod SHIFT, L, movewindow, r +binde = $mainMod SHIFT, K, movewindow, u +binde = $mainMod SHIFT, J, movewindow, d -bind = $mainMod SHIFT, left, movewindow, l -bind = $mainMod SHIFT, right, movewindow, r -bind = $mainMod SHIFT, up, movewindow, u -bind = $mainMod SHIFT, down, movewindow, d +binde = $mainMod SHIFT, left, movewindow, l +binde = $mainMod SHIFT, right, movewindow, r +binde = $mainMod SHIFT, up, movewindow, u +binde = $mainMod SHIFT, down, movewindow, d -bind = ALT, TAB, cyclenext +binde = ALT, TAB, cyclenext # Scroll through existing workspaces with mainMod + scroll @@ -105,24 +109,24 @@ bindm = $mainMod SHIFT, mouse:272, resizewindow # Resize with keyboard -bind = $mainMod CTRL, h, resizeactive, -30 0 -bind = $mainMod CTRL, l, resizeactive, 30 0 -bind = $mainMod CTRL, j, resizeactive, 0 30 -bind = $mainMod CTRL, k, resizeactive, 0 -30 +binde = $mainMod CTRL, h, resizeactive, -30 0 +binde = $mainMod CTRL, l, resizeactive, 30 0 +binde = $mainMod CTRL, j, resizeactive, 0 30 +binde = $mainMod CTRL, k, resizeactive, 0 -30 # Switch workspaces -bind = $mainMod, A, exec, .config/hypr/scripts/workspace-handler.sh change previous -bind = $mainMod, D, exec, .config/hypr/scripts/workspace-handler.sh change next -bind = $mainMod CTRL, A, focusworkspaceoncurrentmonitor, r-1 -bind = $mainMod CTRL, D, focusworkspaceoncurrentmonitor, r+1 +binde = $mainMod, A, exec, .config/hypr/scripts/workspace-handler.sh change previous +binde = $mainMod, D, exec, .config/hypr/scripts/workspace-handler.sh change next +binde = $mainMod CTRL, A, focusworkspaceoncurrentmonitor, r-1 +binde = $mainMod CTRL, D, focusworkspaceoncurrentmonitor, r+1 # Move active window between workspaces -bind = $mainMod SHIFT, A, exec, .config/hypr/scripts/workspace-handler.sh move previous -bind = $mainMod SHIFT, D, exec, .config/hypr/scripts/workspace-handler.sh move next -bind = $mainMod CTRL SHIFT, A, movetoworkspace, r-1 -bind = $mainMod CTRL SHIFT, D, movetoworkspace, r+1 +binde = $mainMod SHIFT, A, exec, .config/hypr/scripts/workspace-handler.sh move previous +binde = $mainMod SHIFT, D, exec, .config/hypr/scripts/workspace-handler.sh move next +binde = $mainMod CTRL SHIFT, A, movetoworkspace, r-1 +binde = $mainMod CTRL SHIFT, D, movetoworkspace, r+1 # Swap worlspaces between monitors diff --git a/.config/hypr/config/env.conf b/.config/hypr/config/env.conf index f6d24b0..44e63d4 100644 --- a/.config/hypr/config/env.conf +++ b/.config/hypr/config/env.conf @@ -1,20 +1,27 @@ +# GTK theme env = GTK_THEME,Colloid-Transparent-Dracula +# Session settings env = QT_QPA_PLATFORM,wayland;xcb env = XDG_CURRENT_DESKTOP,Hyprland env = XDG_SESSION_TYPE,wayland env = XDG_SESSION_DESKTOP,Hyprland env = GDK_BACKEND,wayland,x11,* +# Gnome theme exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" exec = gsettings set org.gnome.desktop.interface gtk-theme "adw-gtk3-dark" +# Cursor env = XCURSOR_SIZE,24 +# Wayland support env = ELECTRON_OZONE_PLATFORM_HINT,wayland env = MOZ_ENABLE_WAYLAND,1 -# env = chrome,--enable-features=TouchpadOverscrollHistoryNavigation +# chrome --enable-features=TouchpadOverscrollHistoryNavigation + +# Scaling env = GDK_SCALE,1 xwayland { force_zero_scaling = true diff --git a/.config/hypr/config/input_devices.conf b/.config/hypr/config/input_devices.conf index 7c82da7..2375d93 100644 --- a/.config/hypr/config/input_devices.conf +++ b/.config/hypr/config/input_devices.conf @@ -2,7 +2,10 @@ input { kb_layout = us, ru kb_variant = kb_model = - kb_options = grp:alt_shift_toggle, caps:escape + # The change layout hotkey is at the top of binds.conf + # The grp:alt_shift_toggle does not support not retapping shift after toggle to capitalize + # kb_options = grp:alt_shift_toggle, caps:escape + kb_options = caps:escape kb_rules = follow_mouse = 1 diff --git a/.config/hypr/config/monitors.conf b/.config/hypr/config/monitors.conf index 62af00d..36b0727 100644 --- a/.config/hypr/config/monitors.conf +++ b/.config/hypr/config/monitors.conf @@ -5,3 +5,4 @@ monitor = eDP-1, prefered, auto, 1 # custom monitor = desc:Communications Supply Corporation (A division of WESCO) P120ZDG-BF4, 2160x1440@60, auto, 1.33333334 +monitor = desc:AU Optronics 0x243D, 1920x1080@60, 0x0, 1, bitdepth, 10 diff --git a/.config/hypr/config/style.conf b/.config/hypr/config/style.conf index 49b5398..83ee0cf 100644 --- a/.config/hypr/config/style.conf +++ b/.config/hypr/config/style.conf @@ -7,6 +7,7 @@ ecosystem { misc { disable_hyprland_logo = true disable_splash_rendering = true + key_press_enables_dpms = true } @@ -23,6 +24,7 @@ general { dwindle { pseudotile = yes preserve_split = yes + # smart_split = no } cursor { diff --git a/.config/hypr/docs/sources.md b/.config/hypr/docs/sources.md new file mode 100644 index 0000000..532d48c --- /dev/null +++ b/.config/hypr/docs/sources.md @@ -0,0 +1,2 @@ +#### Layout change +https://www.reddit.com/r/hyprland/comments/1jintly/how_to_make_altshift_layout_switch_work_correctly/ diff --git a/.config/hypr/hypridle.conf b/.config/hypr/hypridle.conf index 7706c67..759f632 100644 --- a/.config/hypr/hypridle.conf +++ b/.config/hypr/hypridle.conf @@ -1,30 +1,34 @@ general { + lock_cmd = pidof hyprlock || hyprlock + before_sleep_cmd = loginctl lock-session + after_sleep_cmd = hyprctl dispatch dpms on && brightnessctl -r inhibit_sleep = 3 - # lock_cmd = pidof hyprlock || hyprlock - before_sleep_cmd = ~/.config/hypr/scripts/before-sleep.sh - after_sleep_cmd = ~/.config/hypr/scripts/after-sleep.sh - # ignore_dbus_inhibit = false } -# TODO: migrate to brillo? + +# Listener 1: Dim screen +# TODO: migrate to brillo? (just replace `brightnessctl` with `brillo`) listener { - timeout = 120 - on-timeout = brightnessctl -s set 0 # avoid 0 with OLED monitors + timeout = 180 + on-timeout = brightnessctl -s set 2% # avoid 0 with OLED monitors on-resume = brightnessctl -r } +# Listener 2: Lock session listener { - timeout = 180 + timeout = 240 on-timeout = loginctl lock-session } +# Listener 3: Turn off display listener { - timeout = 330 + timeout = 250 on-timeout = hyprctl dispatch dpms off on-resume = hyprctl dispatch dpms on && brightnessctl -r } +# Listener 4: Suspend system listener { - timeout = 300 + timeout = 360 on-timeout = systemctl suspend } diff --git a/.config/hypr/scripts/after-sleep.sh b/.config/hypr/scripts/after-sleep.sh deleted file mode 100755 index 9e450ca..0000000 --- a/.config/hypr/scripts/after-sleep.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# hyprctl keyword monitor "eDP-1, 1920x1080@120, 0x0, 1, vrr, 1" -# brightnessctl -r diff --git a/.config/hypr/scripts/before-sleep.sh b/.config/hypr/scripts/before-sleep.sh deleted file mode 100755 index d1828f1..0000000 --- a/.config/hypr/scripts/before-sleep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# hyprctl keyword monitor "eDP-1, 1920x1080@120, 0x0, 1, vrr, 1" - -# TODO: why uwsm? -brightnessctl -s -# brightnessctl --class='backlight' set 0% -# -# sleep 4 -# brightnessctl --class='backlight' set 20% - -uwsm app -- hyprlock & diff --git a/.config/hypr/scripts/color-correction.sh b/.config/hypr/scripts/color-correction.sh new file mode 100755 index 0000000..a1e29be --- /dev/null +++ b/.config/hypr/scripts/color-correction.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +if command -v hyprshade &>/dev/null; then + hyprshade on vibrance diff --git a/.config/hypr/scripts/dunst/icons/core.svg b/.config/hypr/scripts/dunst/icons/core.svg new file mode 100644 index 0000000..3b85950 --- /dev/null +++ b/.config/hypr/scripts/dunst/icons/core.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.config/hypr/scripts/dunst/icons/cpu.svg b/.config/hypr/scripts/dunst/icons/cpu.svg new file mode 100644 index 0000000..4a988b9 --- /dev/null +++ b/.config/hypr/scripts/dunst/icons/cpu.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.config/hypr/scripts/mode-performance.sh b/.config/hypr/scripts/mode-performance.sh new file mode 100755 index 0000000..8f7bba4 --- /dev/null +++ b/.config/hypr/scripts/mode-performance.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +msgId="3378455" + +PERFORMANCE_MODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') + +if [ "$PERFORMANCE_MODE" = 1 ] ; then + hyprctl --batch "\ + keyword general:allow_tearing 1;\ + keyword animations:enabled 0;\ + keyword animation borderangle,0; \ + keyword decoration:shadow:enabled 0;\ + keyword decoration:blur:enabled 0;\ + keyword decoration:fullscreen_opacity 1;\ + keyword general:gaps_in 0;\ + keyword general:gaps_out 0;\ + keyword general:border_size 1;\ + keyword decoration:rounding 0" + notify-send -i "$HOME/.config/hypr/scripts/dunst/icons/cpu.svg" -u low -r "$msgId" "Performance mode [ON]" + exit +else + notify-send -i "$HOME/.config/hypr/scripts/dunst/icons/core.svg" -u low -r "$msgId" "Performance mode [OFF]" + hyprctl reload + exit 0 +fi +exit 1 diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index d1131d4..341c408 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -23,14 +23,16 @@ disable_ligatures always # Opacity background_opacity 0.4 -# Curor trail +# Cursor +# shell_integration no-cursor +# cursor_shape block cursor_trail 4 cursor_trail_decay 0.1 0.4 # Window settings initial_window_width 95c initial_window_height 35c -window_padding_width 20 +window_padding_width 14 confirm_os_window_close 0 # Tab bar diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index fa9a71c..548a17d 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,31 +1,32 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "catppuccin": { "branch": "main", "commit": "ce8d176faa4643e026e597ae3c31db59b63cef09" }, + "catppuccin": { "branch": "main", "commit": "426dbebe06b5c69fd846ceb17b42e12f890aedf1" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, - "conform.nvim": { "branch": "master", "commit": "5420c4b5ea0aeb99c09cfbd4fd0b70d257b44f25" }, + "conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, - "flutter-tools.nvim": { "branch": "main", "commit": "539e84f5a652d96917f0afc1341c20f0d59dd789" }, + "flutter-tools.nvim": { "branch": "main", "commit": "677cc07c16e8b89999108d2ebeefcfc5f539b73c" }, "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "harpoon-lualine": { "branch": "master", "commit": "215c0847dfb787b19268f7b42eed83bdcf06b966" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, - "mini.nvim": { "branch": "main", "commit": "7e55c3d2c04da134085a31156196836f80a89982" }, - "neo-tree.nvim": { "branch": "main", "commit": "b0b73273b4f5a1f4b4aac8accd6e0c3b4b5a6967" }, + "lualine.nvim": { "branch": "master", "commit": "a905eeebc4e63fdc48b5135d3bf8aea5618fb21c" }, + "mini.nvim": { "branch": "main", "commit": "5849ef04c32a6a8e55957b946c0a275801d87530" }, + "neo-tree.nvim": { "branch": "main", "commit": "4d0828d95adaf4250c1373d2cd9318d3509712b7" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, - "nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" }, - "nvim-dap": { "branch": "master", "commit": "818cd8787a77a97703eb1d9090543a374f79a9ac" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, + "nvim-dap": { "branch": "master", "commit": "45a69eba683a2c448dd9ecfc4de89511f0646b5f" }, "nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" }, - "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lspconfig": { "branch": "master", "commit": "d696e36d5792daf828f8c8e8d4b9aa90c1a10c2a" }, + "nvim-dap-ui": { "branch": "master", "commit": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49" }, + "nvim-lspconfig": { "branch": "master", "commit": "e146efacbafed3789ac568abcc5a981c5decaa58" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "render-markdown.nvim": { "branch": "main", "commit": "07d088bf8bdadd159eb807b90eaee86a4778383f" }, - "telescope.nvim": { "branch": "master", "commit": "4d0f5e0e7f69071e315515c385fab2a4eff07b3d" }, - "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, + "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, + "nvim-web-devicons": { "branch": "master", "commit": "c72328a5494b4502947a022fe69c0c47e53b6aa6" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "render-markdown.nvim": { "branch": "main", "commit": "d67113f11384c0dad96fced2f7b91f1fc811e97f" }, + "telescope.nvim": { "branch": "master", "commit": "506338434fec5ad19cb1f8d45bf92d66c4917393" }, + "vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" }, "vim-suda": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" }, - "yanky.nvim": { "branch": "main", "commit": "04fc42b94305d94948c9c197f679336668af3292" } + "yanky.nvim": { "branch": "main", "commit": "784188e0a7363e762e53140f39124d786aec0832" } } diff --git a/.config/nvim/lua/config/key_binds.lua b/.config/nvim/lua/config/key_binds.lua index 6a097f5..ef5f36b 100644 --- a/.config/nvim/lua/config/key_binds.lua +++ b/.config/nvim/lua/config/key_binds.lua @@ -1,15 +1,24 @@ --- Also check plugins/neo-tree.lua for binds +-- There are more binds in plugins/ +-- /neo-tree.lua +-- /harpoon.lua vim.cmd([[ + " Terminal thingies tnoremap h tnoremap k tnoremap l tnoremap j - " Moving between windows + " Window navigation nnoremap h + nnoremap j nnoremap k nnoremap l - nnoremap j + + " Arrows navigation + nnoremap h + nnoremap j + nnoremap k + nnoremap l " I don't remember nnoremap  diff --git a/.config/nvim/lua/plugins/executable_fugitive.lua b/.config/nvim/lua/plugins/executable-fugitive.lua similarity index 100% rename from .config/nvim/lua/plugins/executable_fugitive.lua rename to .config/nvim/lua/plugins/executable-fugitive.lua diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua index 86b0cae..651328c 100644 --- a/.config/nvim/lua/plugins/harpoon.lua +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -1,5 +1,5 @@ function number_switch(harpoon) - for i = 1, 9, 1 do + for i = 1, 10, 1 do vim.keymap.set("n", "" .. i, function() harpoon:list():select(i) end) @@ -15,18 +15,24 @@ return { opts = { settings = { - save_on_toggle = false, + tabline = false, + save_on_toggle = true, save_on_change = true, - excluded_filetypes = { "harpoon" }, + excluded_filetypes = { + "harpoon", + "neo-tree", + }, }, menu = { + border = "rounded", width = vim.api.nvim_win_get_width(0) - 4, }, }, - config = function() - local harpoon = require("harpoon") - harpoon:setup() + -- vim.g.harpoon_log_level = "fatal", + config = function(_, opts) + local harpoon = require("harpoon") + harpoon:setup(opts) local harpoon_extensions = require("harpoon.extensions") harpoon:extend(harpoon_extensions.builtins.highlight_current_file()) @@ -34,6 +40,9 @@ return { vim.keymap.set("n", "h", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + vim.keymap.set("n", "a", function() + harpoon:list():add() + end) vim.keymap.set("n", "H", function() harpoon:list():add() end) @@ -43,14 +52,14 @@ return { vim.keymap.set("n", "L", function() harpoon:list():clear() end) - - vim.keymap.set("n", "", function() + + vim.keymap.set("n", "", function() harpoon:list():prev() end) - vim.keymap.set("n", "", function() + vim.keymap.set("n", "", function() harpoon:list():next() end) - number_switch(harpoon) + -- number_switch(harpoon) end, } diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index ff23b26..4dfff6b 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -1,7 +1,25 @@ return { "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, + dependencies = { + "nvim-tree/nvim-web-devicons", + "letieu/harpoon-lualine", + }, config = function() - require("lualine").setup() + require("lualine").setup({ + sections = { + lualine_c = { + { + "harpoon2", + icon = " Tabs: ", + _separator = " ", + + indicators = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }, + active_indicators = { "!", "@", "#", "$", "%%", "^", "&", "*", "-", "+" }, + + color_active = { fg = "#6aa0d2", gui = "bold" }, + }, + }, + }, + }) end, } diff --git a/.config/nvim/lua/plugins/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua index b300cfd..d0713d7 100644 --- a/.config/nvim/lua/plugins/neo-tree.lua +++ b/.config/nvim/lua/plugins/neo-tree.lua @@ -23,6 +23,24 @@ return { [""] = "open", [""] = "close_node", ["C"] = "convert_to_directory", + ["F"] = "toggle_hidden", + ["/"] = "fuzzy_search", + }, + }, + filesystem = { + filtered_items = { + visible = false, + show_hidden_count = true, + hide_dotfiles = false, + hide_gitignored = true, + hide_by_name = { + ".git", + ".venv", + ".copier-answers.yml", + ".prettierrc.json", + "package-lock.json", + }, + never_show = {}, }, }, commands = { diff --git a/.config/nvim/lua/plugins/tabline.lua b/.config/nvim/lua/plugins/tabline.lua deleted file mode 100644 index 8f88577..0000000 --- a/.config/nvim/lua/plugins/tabline.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - -- "crispgm/nvim-tabline", - -- config = true, - -- require("tabline").setup({ - -- show_index = true, - -- show_modify = true, - -- show_icon = true, - -- fnamemodify = ":t", - -- modify_indicator = "*", - -- no_name = "Без вымени", - -- brackets = { "[", "]" }, - -- inactive_tab_max_length = 0, - -- }), -} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index f78d3a8..c8ae2be 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,26 +1,48 @@ return { "nvim-treesitter/nvim-treesitter", config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "python", - "go", - "kotlin", - "dart", - "lua", - "bash", - "json", - "yaml", - "markdown", - }, + ts = require("nvim-treesitter") + ts.setup() + ts.install({ + "python", + "go", + "kotlin", + "dart", + "lua", + "bash", + "json", + "yaml", + "markdown", + "vim", + "vimdoc", + }) + vim.treesitter.language.register("html", "gotmpl") + vim.api.nvim_create_autocmd("FileType", { + callback = function(args) + local lang = vim.treesitter.language.get_lang(args.match) + if vim.list_contains(ts.get_available(), lang) then + if not vim.list_contains(ts.get_installed(), lang) then + ts.install(lang):wait() + end - sync_install = false, - auto_install = true, + vim.treesitter.start(args.buf) + end + end, + desc = "enable nvim-treesitter and install parser if not installed", + }) - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - }) + -- require("nvim-treesitter").setup() + -- { + -- ensure_installed = { + -- }, + -- + -- sync_install = false, + -- auto_install = true, + -- + -- highlight = { + -- enable = true, + -- additional_vim_regex_highlighting = false, + -- }, + -- }) end, } diff --git a/.config/nvim/lua/templates/clipboard/local-clipboard.lua b/.config/nvim/lua/templates/clipboard/local-clipboard.lua new file mode 100644 index 0000000..06d3aee --- /dev/null +++ b/.config/nvim/lua/templates/clipboard/local-clipboard.lua @@ -0,0 +1,3 @@ +-- clipboard.lua will be edited by the bash command +-- it will be replaced with one of the files from templates/clipboard/ directory +vim.o.clipboard = "unnamedplus" diff --git a/.config/nvim/lua/templates/clipboard/remote-clipboard.lua b/.config/nvim/lua/templates/clipboard/remote-clipboard.lua new file mode 100644 index 0000000..5d5f697 --- /dev/null +++ b/.config/nvim/lua/templates/clipboard/remote-clipboard.lua @@ -0,0 +1,12 @@ +-- clipboard.lua will be edited by the bash command +-- it will be replaced with one of the files from templates/clipboard/ directory +vim.o.clipboard = "unnamedplus" + +vim.api.nvim_create_autocmd("TextYankPost", { + callback = function() + local copy_to_unnamedplus = require("vim.ui.clipboard.osc52").copy("+") + copy_to_unnamedplus(vim.v.event.regcontents) + local copy_to_unnamed = require("vim.ui.clipboard.osc52").copy("*") + copy_to_unnamed(vim.v.event.regcontents) + end, +}) diff --git a/.config/rofi/clipboard-config.rasi b/.config/rofi/clipboard-config.rasi index 26c13cd..042fc44 100644 --- a/.config/rofi/clipboard-config.rasi +++ b/.config/rofi/clipboard-config.rasi @@ -5,6 +5,7 @@ configuration { display-clipboard: "󰅌 Clipboard"; drun-display-format: "{name}"; window-format: "{w} · {c} · {t}"; + terminal: "kitty"; // binds kb-row-up: "Up,Control+k,Shift+Tab,Shift+ISO_Left_Tab"; diff --git a/.config/rofi/config.rasi b/.config/rofi/config.rasi index dd756c4..83290f6 100644 --- a/.config/rofi/config.rasi +++ b/.config/rofi/config.rasi @@ -6,6 +6,7 @@ configuration { display-window: " "; drun-display-format: "{name}"; window-format: "{w} · {c} · {t}"; + terminal: "kitty"; // binds kb-row-up: "Up,Control+k,Shift+Tab,Shift+ISO_Left_Tab"; diff --git a/.config/rofi/network-manager/vpn-manager.sh b/.config/rofi/network-manager/vpn-manager.sh index b543629..8e285ca 100755 --- a/.config/rofi/network-manager/vpn-manager.sh +++ b/.config/rofi/network-manager/vpn-manager.sh @@ -52,7 +52,7 @@ fi # active param active="\0active\x1f" -# netbird +# wireguard if $wireguard_installed; then wireguard_status=$(sudo wg show interfaces) if [ "$wireguard_status" != "wg0" ]; then @@ -67,7 +67,10 @@ fi # netbird if $netbird_installed; then - netbird_status=$(netbird status | grep "Networks" | cut -d: -f2 | sed "s/ -//") + netbird_status="" + if timeout 0.3 netbird status >/dev/null 2>&1; then + netbird_status=$(netbird status | grep "Networks" | cut -d: -f2 | sed "s/ -//") + fi if [ -z "$netbird_status" ]; then echo " Start netbird" else diff --git a/.config/waybar/modules/clock.jsonc b/.config/waybar/modules/clock.jsonc index 2b9f0f0..e78ae90 100644 --- a/.config/waybar/modules/clock.jsonc +++ b/.config/waybar/modules/clock.jsonc @@ -2,6 +2,7 @@ "clock": { "format": "{:%H:%M}", "tooltip-format": "{calendar}", + "locale": "en_GB.UTF-8", "calendar": { "mode": "month", "mode-mon-col": 3, diff --git a/.config/waybar/modules/workspaces.jsonc b/.config/waybar/modules/workspaces.jsonc index f1733a4..8d38575 100644 --- a/.config/waybar/modules/workspaces.jsonc +++ b/.config/waybar/modules/workspaces.jsonc @@ -1,10 +1,16 @@ { "group/workspaces-group": { "orientation": "horizontal", - "modules": ["hyprland/windowcount", "hyprland/workspaces"], + "modules": ["hyprland/workspaces#active", "hyprland/workspaces#list"], }, - - "hyprland/workspaces": { + // fix on-click + "hyprland/workspaces#active": { + "format": "{id}", + "tooltip": false, + "active-only": true, + "on-click": "rofi -show", + }, + "hyprland/workspaces#list": { "format": "{icon}", "tooltip": false, "tooltips": { @@ -19,11 +25,4 @@ "default": "󰣇", //  }, }, - "hyprland/windowcount": { - "format": "{icon}", - "format-empty": "{}", - "format-windowed": "{}", - "separate-outputs": true, - "on-click": "rofi -show", - }, } diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 7cf9439..524aef9 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -79,23 +79,22 @@ tooltip label { } #custom-media { - margin-left: 5px; - padding-left: 12px; - padding-right: 12px; + padding-right: 8px; } -#windowcount { - padding-left: 12px; - padding-right: 4px; -} - #workspaces button { padding-left: 4px; } -#workspaces { - padding-right: 6px; +#workspaces.active { + padding-left: 12px; + padding-right: 4px; +} + +#workspaces list { + padding-left: 12px; + padding-right: 4px; } diff --git a/.config/yazi/init.lua b/.config/yazi/init.lua new file mode 100644 index 0000000..95f5b99 --- /dev/null +++ b/.config/yazi/init.lua @@ -0,0 +1,3 @@ +require("full-border"):setup({ + type = ui.Border.ROUNDED, +}) diff --git a/.config/yazi/keymap.toml b/.config/yazi/keymap.toml index cbe43cc..a624d24 100644 --- a/.config/yazi/keymap.toml +++ b/.config/yazi/keymap.toml @@ -83,3 +83,24 @@ run = ["plugin wl-clipboard"] on = [ "D", "" ] run = 'remove --force --permanently' desc = "Permanently delete" + + +[[mgr.prepend_keymap]] +on = "F" +run = "plugin toggle-pane max-preview" +desc = "Maximize or restore the preview pane" + +[[mgr.prepend_keymap]] +on = "M" +run = "plugin mount" +desc = "Mount plugin" + +[[mgr.prepend_keymap]] +on = "f" +run = "plugin jump-to-char" +desc = "Jump to char" + +[[mgr.prepend_keymap]] +on = "p" +run = "plugin smart-paste" +desc = "Paste into the hovered directory or CWD" diff --git a/.config/yazi/package.toml b/.config/yazi/package.toml index 723911b..5d021a5 100644 --- a/.config/yazi/package.toml +++ b/.config/yazi/package.toml @@ -1,7 +1,32 @@ [[plugin.deps]] use = "grappas/wl-clipboard" -rev = "e9a38e4" -hash = "6b8e5d6b09626facec713923d3ddb54b" +rev = "8cc5524" +hash = "5c587834c274dca9059092714ece1f18" + +[[plugin.deps]] +use = "yazi-rs/plugins:toggle-pane" +rev = "ac82af3" +hash = "4c0260feb50ea2437380690ffc241da7" + +[[plugin.deps]] +use = "yazi-rs/plugins:full-border" +rev = "ac82af3" +hash = "eff8ff12fa4e5f035a10d8aeeb4c258d" + +[[plugin.deps]] +use = "yazi-rs/plugins:mount" +rev = "ac82af3" +hash = "77e20b071404f97c09d3f9afdb9482e0" + +[[plugin.deps]] +use = "yazi-rs/plugins:jump-to-char" +rev = "ac82af3" +hash = "7a4b4237223aaa94e589d1c01a23542a" + +[[plugin.deps]] +use = "yazi-rs/plugins:smart-paste" +rev = "ac82af3" +hash = "3f8d49413bc8691b4c652eb417a20178" [flavor] deps = [] diff --git a/.config/yazi/plugins/full-border.yazi/LICENSE b/.config/yazi/plugins/full-border.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/.config/yazi/plugins/full-border.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.config/yazi/plugins/full-border.yazi/README.md b/.config/yazi/plugins/full-border.yazi/README.md new file mode 100644 index 0000000..269ca8e --- /dev/null +++ b/.config/yazi/plugins/full-border.yazi/README.md @@ -0,0 +1,32 @@ +# full-border.yazi + +Add a full border to Yazi to make it look fancier. + +![full-border](https://github.com/yazi-rs/plugins/assets/17523360/ef81b560-2465-4d36-abf2-5d21dcb7b987) + +## Installation + +```sh +ya pkg add yazi-rs/plugins:full-border +``` + +## Usage + +Add this to your `init.lua` to enable the plugin: + +```lua +require("full-border"):setup() +``` + +Or you can customize the border type: + +```lua +require("full-border"):setup { + -- Available values: ui.Border.PLAIN, ui.Border.ROUNDED + type = ui.Border.ROUNDED, +} +``` + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/.config/yazi/plugins/full-border.yazi/main.lua b/.config/yazi/plugins/full-border.yazi/main.lua new file mode 100644 index 0000000..501156d --- /dev/null +++ b/.config/yazi/plugins/full-border.yazi/main.lua @@ -0,0 +1,53 @@ +--- @since 25.2.26 + +local function setup(_, opts) + local type = opts and opts.type or ui.Border.ROUNDED + local old_build = Tab.build + + Tab.build = function(self, ...) + local bar = function(c, x, y) + if x <= 0 or x == self._area.w - 1 or th.mgr.border_symbol ~= "│" then + return ui.Bar(ui.Edge.TOP) + end + + return ui.Bar(ui.Edge.TOP) + :area( + ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) } + ) + :symbol(c) + end + + local c = self._chunks + self._chunks = { + c[1]:pad(ui.Pad.y(1)), + -- TODO: remove this compatibility hack + fs.unique and c[2]:pad(ui.Pad.y(1)) or c[2]:pad(ui.Pad(1, c[3].w > 0 and 0 or 1, 1, c[1].w > 0 and 0 or 1)), + c[3]:pad(ui.Pad.y(1)), + } + + local style = th.mgr.border_style + if rt.opener then -- TODO: remove this compatibility hack + self._base = ya.list_merge(self._base or {}, { + ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style), + + bar("┬", c[2].x, c[1].y), + bar("┴", c[2].x, c[1].bottom - 1), + bar("┬", c[2].right - 1, c[2].y), + bar("┴", c[2].right - 1, c[2].bottom - 1), + }) + else + self._base = ya.list_merge(self._base or {}, { + ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style), + + bar("┬", c[1].right - 1, c[1].y), + bar("┴", c[1].right - 1, c[1].bottom - 1), + bar("┬", c[2].right, c[2].y), + bar("┴", c[2].right, c[2].bottom - 1), + }) + end + + old_build(self, ...) + end +end + +return { setup = setup } diff --git a/.config/yazi/plugins/jump-to-char.yazi/LICENSE b/.config/yazi/plugins/jump-to-char.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/.config/yazi/plugins/jump-to-char.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.config/yazi/plugins/jump-to-char.yazi/README.md b/.config/yazi/plugins/jump-to-char.yazi/README.md new file mode 100644 index 0000000..6a77faf --- /dev/null +++ b/.config/yazi/plugins/jump-to-char.yazi/README.md @@ -0,0 +1,28 @@ +# jump-to-char.yazi + +Vim-like `f`, jump to the next file whose name starts with ``. + +https://github.com/yazi-rs/plugins/assets/17523360/aac9341c-b416-4e0c-aaba-889d48389869 + +## Installation + +```sh +ya pkg add yazi-rs/plugins:jump-to-char +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[mgr.prepend_keymap]] +on = "f" +run = "plugin jump-to-char" +desc = "Jump to char" +``` + +Note that, the keybindings above are just examples, please tune them up as needed to ensure they don't conflict with your other actions/plugins. + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/.config/yazi/plugins/jump-to-char.yazi/main.lua b/.config/yazi/plugins/jump-to-char.yazi/main.lua new file mode 100644 index 0000000..8a434f1 --- /dev/null +++ b/.config/yazi/plugins/jump-to-char.yazi/main.lua @@ -0,0 +1,32 @@ +--- @since 25.5.31 + +local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789." + +local changed = ya.sync(function(st, new) + local b = st.last ~= new + st.last = new + return b or not cx.active.finder +end) + +local escape = function(s) return s == "." and "\\." or s end + +return { + entry = function() + local cands = {} + for i = 1, #AVAILABLE_CHARS do + cands[#cands + 1] = { on = AVAILABLE_CHARS:sub(i, i) } + end + + local idx = ya.which { cands = cands, silent = true } + if not idx then + return + end + + local kw = escape(cands[idx].on) + if changed(kw) then + ya.emit("find_do", { "^" .. kw }) + else + ya.emit("find_arrow", {}) + end + end, +} diff --git a/.config/yazi/plugins/mount.yazi/LICENSE b/.config/yazi/plugins/mount.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/.config/yazi/plugins/mount.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.config/yazi/plugins/mount.yazi/README.md b/.config/yazi/plugins/mount.yazi/README.md new file mode 100644 index 0000000..16b5a16 --- /dev/null +++ b/.config/yazi/plugins/mount.yazi/README.md @@ -0,0 +1,50 @@ +# mount.yazi + +A mount manager for Yazi, providing disk mount, unmount, and eject functionality. + +Supported platforms: + +- Linux with [`udisksctl`](https://github.com/storaged-project/udisks), `lsblk` and `eject` both provided by [`util-linux`](https://github.com/util-linux/util-linux) +- macOS with `diskutil`, which is pre-installed + +https://github.com/user-attachments/assets/c6f780ab-458b-420f-85cf-2fc45fcfe3a2 + +## Installation + +```sh +ya pkg add yazi-rs/plugins:mount +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[mgr.prepend_keymap]] +on = "M" +run = "plugin mount" +``` + +Note that, the keybindings above are just examples, please tune them up as needed to ensure they don't conflict with your other actions/plugins. + +## Actions + +| Key binding | Alternate key | Action | +| ------------ | ------------- | --------------------- | +| q | - | Quit the plugin | +| k | | Move up | +| j | | Move down | +| l | | Enter the mount point | +| m | - | Mount the partition | +| u | - | Unmount the partition | +| e | - | Eject the disk | + +## TODO + +- Custom keybindings +- Windows support (I don't use Windows myself, PRs welcome!) +- Support mount, unmount, and eject the entire disk + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/.config/yazi/plugins/mount.yazi/cross.lua b/.config/yazi/plugins/mount.yazi/cross.lua new file mode 100644 index 0000000..85c14f7 --- /dev/null +++ b/.config/yazi/plugins/mount.yazi/cross.lua @@ -0,0 +1,66 @@ +local M = {} + +--- @param type "mount"|"unmount"|"eject" +--- @param partition table +function M.operate(type, partition) + if not partition then + return + elseif not partition.sub then + return -- TODO: mount/unmount main disk + end + + local cmd, output, err + if ya.target_os() == "macos" then + cmd, output, err = "diskutil", M.diskutil(type, partition.src) + elseif ya.target_os() == "linux" then + if type == "eject" and partition.src:match("^/dev/sr%d+") then + M.udisksctl("unmount", partition.src) + cmd, output, err = "eject", M.eject(partition.src) + elseif type == "eject" then + M.udisksctl("unmount", partition.src) + cmd, output, err = "udisksctl", M.udisksctl("power-off", partition.src) + else + cmd, output, err = "udisksctl", M.udisksctl(type, partition.src) + end + end + + if not cmd then + M.fail("mount.yazi is not currently supported on your platform") + elseif not output then + M.fail("Failed to spawn `%s`: %s", cmd, err) + elseif not output.status.success then + M.fail("Failed to %s `%s`: %s", type, partition.src, output.stderr) + end +end + +--- @param type "mount"|"unmount"|"eject" +--- @param src string +--- @return Output? output +--- @return Error? err +function M.diskutil(type, src) return Command("diskutil"):arg({ type, src }):output() end + +--- @param type "mount"|"unmount"|"power-off" +--- @param src string +--- @return Output? output +--- @return Error? err +function M.udisksctl(type, src) + local args = { type, "-b", src, "--no-user-interaction" } + local output, err = Command("udisksctl"):arg(args):output() + + if not output or err then + return nil, err + elseif output.stderr:find("org.freedesktop.UDisks2.Error.NotAuthorizedCanObtain", 1, true) then + return require(".sudo").run_with_sudo("udisksctl", args) + else + return output + end +end + +--- @param src string +--- @return Output? output +--- @return Error? err +function M.eject(src) return Command("eject"):arg({ "--traytoggle", src }):output() end + +function M.fail(...) ya.notify { title = "Mount", content = string.format(...), timeout = 10, level = "error" } end + +return M diff --git a/.config/yazi/plugins/mount.yazi/main.lua b/.config/yazi/plugins/mount.yazi/main.lua new file mode 100644 index 0000000..4f84cc7 --- /dev/null +++ b/.config/yazi/plugins/mount.yazi/main.lua @@ -0,0 +1,263 @@ +--- @since 25.12.29 + +local toggle_ui = ya.sync(function(self) + if self.children then + Modal:children_remove(self.children) + self.children = nil + else + self.children = Modal:children_add(self, 10) + end + ui.render() +end) + +local subscribe = ya.sync(function(self) + ps.unsub("mount") + ps.sub("mount", function() ya.emit("plugin", { self._id, "refresh" }) end) +end) + +local update_partitions = ya.sync(function(self, partitions) + self.partitions = partitions + self.cursor = math.max(0, math.min(self.cursor or 0, #self.partitions - 1)) + ui.render() +end) + +local active_partition = ya.sync(function(self) return self.partitions[self.cursor + 1] end) + +local update_cursor = ya.sync(function(self, cursor) + if #self.partitions == 0 then + self.cursor = 0 + else + self.cursor = ya.clamp(0, self.cursor + cursor, #self.partitions - 1) + end + ui.render() +end) + +local M = { + keys = { + { on = "q", run = "quit" }, + { on = "", run = "quit" }, + { on = "", run = { "enter", "quit" } }, + + { on = "k", run = "up" }, + { on = "j", run = "down" }, + { on = "l", run = { "enter", "quit" } }, + + { on = "", run = "up" }, + { on = "", run = "down" }, + { on = "", run = { "enter", "quit" } }, + + { on = "m", run = "mount" }, + { on = "u", run = "unmount" }, + { on = "e", run = "eject" }, + }, +} + +function M:new(area) + self:layout(area) + return self +end + +function M:layout(area) + local chunks = ui.Layout() + :constraints({ + ui.Constraint.Percentage(10), + ui.Constraint.Percentage(80), + ui.Constraint.Percentage(10), + }) + :split(area) + + local chunks = ui.Layout() + :direction(ui.Layout.HORIZONTAL) + :constraints({ + ui.Constraint.Percentage(10), + ui.Constraint.Percentage(80), + ui.Constraint.Percentage(10), + }) + :split(chunks[2]) + + self._area = chunks[2] +end + +function M:entry(job) + if job.args[1] == "refresh" then + return update_partitions(self.obtain()) + end + + toggle_ui() + update_partitions(self.obtain()) + subscribe() + + local tx1, rx1 = ya.chan("mpsc") + local tx2, rx2 = ya.chan("mpsc") + function producer() + while true do + local cand = self.keys[ya.which { cands = self.keys, silent = true }] or { run = {} } + for _, r in ipairs(type(cand.run) == "table" and cand.run or { cand.run }) do + tx1:send(r) + if r == "quit" then + toggle_ui() + return + end + end + end + end + + function consumer1() + repeat + local run = rx1:recv() + if run == "quit" then + tx2:send(run) + break + elseif run == "up" then + update_cursor(-1) + elseif run == "down" then + update_cursor(1) + elseif run == "enter" then + local active = active_partition() + if active and active.dist then + ya.emit("cd", { active.dist }) + end + else + tx2:send(run) + end + until not run + end + + function consumer2() + repeat + local run = rx2:recv() + if run == "quit" then + break + elseif run == "mount" then + require(".cross").operate("mount", active_partition()) + elseif run == "unmount" then + require(".cross").operate("unmount", active_partition()) + elseif run == "eject" then + require(".cross").operate("eject", active_partition()) + end + until not run + end + + ya.join(producer, consumer1, consumer2) +end + +function M:reflow() return { self } end + +function M:redraw() + local rows = {} + for _, p in ipairs(self.partitions or {}) do + if not p.sub then + rows[#rows + 1] = ui.Row { p.main } + elseif p.sub == "" then + rows[#rows + 1] = ui.Row { p.main, p.label or "", p.dist or "", p.fstype or "" } + else + rows[#rows + 1] = ui.Row { " " .. p.sub, p.label or "", p.dist or "", p.fstype or "" } + end + end + + return { + ui.Clear(self._area), + ui.Border(ui.Edge.ALL) + :area(self._area) + :type(ui.Border.ROUNDED) + :style(ui.Style():fg("blue")) + :title(ui.Line("Mount"):align(ui.Align.CENTER)), + ui.Table(rows) + :area(self._area:pad(ui.Pad(1, 2, 1, 2))) + :header(ui.Row({ "Src", "Label", "Dist", "FSType" }):style(ui.Style():bold())) + :row(self.cursor) + :row_style(ui.Style():fg("blue"):underline()) + :widths { + ui.Constraint.Length(20), + ui.Constraint.Length(20), + ui.Constraint.Percentage(70), + ui.Constraint.Length(20), + }, + } +end + +function M.obtain() + local tbl = {} + local last + for _, p in ipairs(fs.partitions()) do + local main, sub = M.split(p.src) + if main and last ~= main then + if p.src == main then + last, p.main, p.sub, tbl[#tbl + 1] = p.src, p.src, "", p + else + last, tbl[#tbl + 1] = main, { src = main, main = main, sub = "" } + end + end + if sub then + if tbl[#tbl].sub == "" and tbl[#tbl].main == main then + tbl[#tbl].sub = nil + end + p.main, p.sub, tbl[#tbl + 1] = main, sub, p + end + end + table.sort(M.fillin(tbl), function(a, b) + if a.main == b.main then + return (a.sub or "") < (b.sub or "") + else + return a.main > b.main + end + end) + return tbl +end + +function M.split(src) + local pats = { + { "^/dev/sd[a-z]", "%d+$" }, -- /dev/sda1 + { "^/dev/nvme%d+n%d+", "p%d+$" }, -- /dev/nvme0n1p1 + { "^/dev/mmcblk%d+", "p%d+$" }, -- /dev/mmcblk0p1 + { "^/dev/disk%d+", ".+$" }, -- /dev/disk1s1 + { "^/dev/sr%d+", ".+$" }, -- /dev/sr0 + { "^/dev/fd%d+", ".+$" }, -- /dev/fd0 + { "^/dev/md%d+", "p%d+$" }, -- /dev/md0p1 + { "^/dev/nbd%d+", "p%d+$" }, -- /dev/nbd0p1 + { "^/dev/bcache%d+", "p%d+$" }, -- /dev/bcache0p1 + { "^/dev/mapper/", ".+$" }, -- /dev/mapper/ + } + for _, p in ipairs(pats) do + local main = src:match(p[1]) + if main then + return main, src:sub(#main + 1):match(p[2]) + end + end +end + +function M.fillin(tbl) + if ya.target_os() ~= "linux" then + return tbl + end + + local sources, indices = {}, {} + for i, p in ipairs(tbl) do + if p.sub and not p.fstype then + sources[#sources + 1], indices[p.src] = p.src, i + end + end + if #sources == 0 then + return tbl + end + + local output, err = Command("lsblk"):arg({ "-p", "-o", "name,fstype", "-J" }):arg(sources):output() + if err then + ya.dbg("Failed to fetch filesystem types for unmounted partitions: " .. err) + return tbl + end + + local t = ya.json_decode(output and output.stdout or "") + for _, p in ipairs(t and t.blockdevices or {}) do + tbl[indices[p.name]].fstype = p.fstype + end + return tbl +end + +function M:click() end + +function M:scroll() end + +function M:touch() end + +return M diff --git a/.config/yazi/plugins/mount.yazi/sudo.lua b/.config/yazi/plugins/mount.yazi/sudo.lua new file mode 100644 index 0000000..b157e6d --- /dev/null +++ b/.config/yazi/plugins/mount.yazi/sudo.lua @@ -0,0 +1,54 @@ +local M = {} + +--- Verify if `sudo` is already authenticated +--- @return boolean +--- @return Error? +function M.sudo_already() + local status, err = Command("sudo"):arg({ "--validate", "--non-interactive" }):status() + return status and status.success or false, err +end + +--- Run a program with `sudo` privilege +--- @param program string +--- @param args table +--- @return Output? output +--- @return Error? err +function M.run_with_sudo(program, args) + local cmd = Command("sudo") + :arg({ "--stdin", "--user", "#" .. ya.uid(), "--", program }) + :arg(args) + :stdin(Command.PIPED) + :stdout(Command.PIPED) + :stderr(Command.PIPED) + + if M.sudo_already() then + return cmd:output() + end + + local value, event = ya.input { + pos = { "top-center", y = 3, w = 40 }, + title = string.format("Password for `sudo %s`:", program), + obscure = true, + } + if not value or event ~= 1 then + return nil, Err("Sudo password input cancelled") + end + + local child, err = cmd:spawn() + if not child or err then + return nil, err + end + + child:write_all(value .. "\n") + child:flush() + local output, err = child:wait_with_output() + if not output or err then + return nil, err + elseif output.status.success or M.sudo_already() then + return output + else + return nil, Err("Incorrect sudo password") + end +end + +return M diff --git a/.config/yazi/plugins/smart-paste.yazi/LICENSE b/.config/yazi/plugins/smart-paste.yazi/LICENSE new file mode 100644 index 0000000..ea5b606 --- /dev/null +++ b/.config/yazi/plugins/smart-paste.yazi/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/.config/yazi/plugins/smart-paste.yazi/README.md b/.config/yazi/plugins/smart-paste.yazi/README.md new file mode 100644 index 0000000..66da8c8 --- /dev/null +++ b/.config/yazi/plugins/smart-paste.yazi/README.md @@ -0,0 +1,28 @@ +# smart-paste.yazi + +Paste files into the hovered directory or to the CWD if hovering over a file. + +https://github.com/user-attachments/assets/b3f6348e-abbe-42fe-9a67-a96e68f11255 + +## Installation + +```sh +ya pkg add yazi-rs/plugins:smart-paste +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[mgr.prepend_keymap]] +on = "p" +run = "plugin smart-paste" +desc = "Paste into the hovered directory or CWD" +``` + +Note that, the keybindings above are just examples, please tune them up as needed to ensure they don't conflict with your other actions/plugins. + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/.config/yazi/plugins/smart-paste.yazi/main.lua b/.config/yazi/plugins/smart-paste.yazi/main.lua new file mode 100644 index 0000000..0837a4b --- /dev/null +++ b/.config/yazi/plugins/smart-paste.yazi/main.lua @@ -0,0 +1,14 @@ +--- @since 25.5.31 +--- @sync entry +return { + entry = function() + local h = cx.active.current.hovered + if h and h.cha.is_dir then + ya.emit("enter", {}) + ya.emit("paste", {}) + ya.emit("leave", {}) + else + ya.emit("paste", {}) + end + end, +} diff --git a/.config/yazi/plugins/toggle-pane.yazi/LICENSE b/.config/yazi/plugins/toggle-pane.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/.config/yazi/plugins/toggle-pane.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.config/yazi/plugins/toggle-pane.yazi/README.md b/.config/yazi/plugins/toggle-pane.yazi/README.md new file mode 100644 index 0000000..7c0c473 --- /dev/null +++ b/.config/yazi/plugins/toggle-pane.yazi/README.md @@ -0,0 +1,80 @@ +# toggle-pane.yazi + +Toggle the show, hide, and maximize states for different panes: parent, current, and preview. It respects the user's [`ratio` settings](https://yazi-rs.github.io/docs/configuration/yazi#mgr.ratio)! + +Assume the user's `ratio` is $$[A, B, C]$$, that is, $$\text{parent}=A, \text{current}=B, \text{preview}=C$$: + +- `min-parent`: Toggles between $$0$$ and $$A$$ - the parent is either completely hidden or showed with width $$A$$. +- `max-parent`: Toggles between $$A$$ and $$\infty$$ - the parent is either showed with width $$A$$ or fills the entire screen. +- `min-current`: Toggles between $$0$$ and $$B$$ - the current is either completely hidden or showed with width $$B$$. +- `max-current`: Toggles between $$B$$ and $$\infty$$ - the current is either showed with width $$B$$ or fills the entire screen. +- `min-preview`: Toggles between $$0$$ and $$C$$ - the preview is either completely hidden or showed with width $$C$$. +- `max-preview`: Toggles between $$C$$ and $$\infty$$ - the preview is either showed with width $$C$$ or fills the entire screen. +- `reset`: Resets to the user's configured `ratio`. + +## Installation + +```sh +ya pkg add yazi-rs/plugins:toggle-pane +``` + +## Usage + +Hide/Show preview: + +```toml +# keymap.toml +[[mgr.prepend_keymap]] +on = "T" +run = "plugin toggle-pane min-preview" +desc = "Show or hide the preview pane" +``` + +Maximize/Restore preview: + +```toml +# keymap.toml +[[mgr.prepend_keymap]] +on = "T" +run = "plugin toggle-pane max-preview" +desc = "Maximize or restore the preview pane" +``` + +You can replace `preview` with `current` or `parent` to toggle the other panes. + +Note that, the keybindings above are just examples, please tune them up as needed to ensure they don't conflict with your other actions/plugins. + +## Advanced + +In addition to triggering the plugin with a keypress, you can also trigger it in your `init.lua` file: + +```lua +if os.getenv("NVIM") then + require("toggle-pane"):entry("min-preview") +end +``` + +In the example above, when it detects that you're [using Yazi in nvim](https://yazi-rs.github.io/docs/resources#vim), the preview is hidden by default — you can always press `T` (or any key you've bound) to show it again. + +## Tips + +This plugin only maximizes the "available preview area", without actually changing the content size. + +This means that the appearance of your preview largely depends on the previewer you are using. +However, most previewers tend to make the most of the available space, so this usually isn't an issue. + +For image previews, you may want to tune up the [`max_width`][max-width] and [`max_height`][max-height] options in your `yazi.toml`: + +```toml +[preview] +# Change them to your desired values +max_width = 1000 +max_height = 1000 +``` + +[max-width]: https://yazi-rs.github.io/docs/configuration/yazi/#preview.max_width +[max-height]: https://yazi-rs.github.io/docs/configuration/yazi/#preview.max_height + +## License + +This plugin is MIT-licensed. For more information, check the [LICENSE](LICENSE) file. diff --git a/.config/yazi/plugins/toggle-pane.yazi/main.lua b/.config/yazi/plugins/toggle-pane.yazi/main.lua new file mode 100644 index 0000000..72bbf0e --- /dev/null +++ b/.config/yazi/plugins/toggle-pane.yazi/main.lua @@ -0,0 +1,45 @@ +--- @since 25.5.31 +--- @sync entry + +local function entry(st, job) + local R = rt.mgr.ratio + job = type(job) == "string" and { args = { job } } or job + + st.parent = st.parent or R.parent + st.current = st.current or R.current + st.preview = st.preview or R.preview + + local act, to = string.match(job.args[1] or "", "(.-)-(.+)") + if act == "min" then + st[to] = st[to] == R[to] and 0 or R[to] + elseif act == "max" then + local max = st[to] == 65535 and R[to] or 65535 + st.parent = st.parent == 65535 and R.parent or st.parent + st.current = st.current == 65535 and R.current or st.current + st.preview = st.preview == 65535 and R.preview or st.preview + st[to] = max + end + + if not st.old then + st.old = Tab.layout + Tab.layout = function(self) + local all = st.parent + st.current + st.preview + self._chunks = ui.Layout() + :direction(ui.Layout.HORIZONTAL) + :constraints({ + ui.Constraint.Ratio(st.parent, all), + ui.Constraint.Ratio(st.current, all), + ui.Constraint.Ratio(st.preview, all), + }) + :split(self._area) + end + end + + if not act then + Tab.layout, st.old = st.old, nil + st.parent, st.current, st.preview = nil, nil, nil + end + ya.emit("app:resize", {}) +end + +return { entry = entry } diff --git a/.config/yazi/plugins/wl-clipboard.yazi/main.lua b/.config/yazi/plugins/wl-clipboard.yazi/main.lua index 1c737b2..87be707 100644 --- a/.config/yazi/plugins/wl-clipboard.yazi/main.lua +++ b/.config/yazi/plugins/wl-clipboard.yazi/main.lua @@ -13,7 +13,7 @@ end) return { entry = function() - ya.manager_emit("escape", { visual = true }) + ya.emit("escape", { visual = true }) local urls = selected_or_hovered() diff --git a/config-scripts/export-config.sh b/config-scripts/export-config.sh new file mode 100755 index 0000000..9e09375 --- /dev/null +++ b/config-scripts/export-config.sh @@ -0,0 +1,33 @@ +#!/bin/bash +CONFIG_TIME=$(date +"%Y-%m-%d-%H-%M") +CONFIG_SAVE_DIR="$HOME/tmp/config-$CONFIG_TIME" + +mkdir -p "$CONFIG_SAVE_DIR/.config" +mkdir -p "$CONFIG_SAVE_DIR/.themes" +echo 'Created config save directory' + +cp -r ~/config-scripts "$CONFIG_SAVE_DIR/config-scripts" + +cp -r ~/.themes/Colloid-Transparent-Dracula "$CONFIG_SAVE_DIR/.themes/Colloid-Transparent-Dracula/" + +cp -r ~/.config/nvim "$CONFIG_SAVE_DIR/.config/nvim/" +cp -r ~/.config/rofi "$CONFIG_SAVE_DIR/.config/rofi/" +cp -r ~/.config/yazi "$CONFIG_SAVE_DIR/.config/yazi/" +cp -r ~/.config/hypr "$CONFIG_SAVE_DIR/.config/hypr/" +cp -r ~/.config/waybar "$CONFIG_SAVE_DIR/.config/waybar/" +cp -r ~/.config/dunst "$CONFIG_SAVE_DIR/.config/dunst/" +cp -r ~/.config/kitty "$CONFIG_SAVE_DIR/.config/kitty/" +cp -r ~/.config/fastfetch "$CONFIG_SAVE_DIR/.config/fastfetch/" + +cp -r ~/.inputrc "$CONFIG_SAVE_DIR/.inputrc" +cp -r ~/.bash_profile "$CONFIG_SAVE_DIR/.bash_profile" +cp -r ~/.bashrc "$CONFIG_SAVE_DIR/.bashrc" +cp -r ~/.bash_exports "$CONFIG_SAVE_DIR/.bash_exports" +cp -r ~/.bash_aliases "$CONFIG_SAVE_DIR/.bash_aliases" + +cp -r ~/.ideavimrc "$CONFIG_SAVE_DIR/.ideavimrc" +echo 'Copied configs' + +zip -r "$HOME/tmp/config-$CONFIG_TIME.zip" "$CONFIG_SAVE_DIR" +echo 'Compressed the configs' +echo -e "\e[32mDone!\e[0m" diff --git a/config-scripts/import-config.sh b/config-scripts/import-config.sh new file mode 100755 index 0000000..69dc406 --- /dev/null +++ b/config-scripts/import-config.sh @@ -0,0 +1,51 @@ +#!/bin/bash +SOURCE=$1 + +if [ -z "$SOURCE" ]; then + echo "Usage: $0 " + exit 1 +fi + +# Handle zip extraction +if [[ "$SOURCE" == *.zip ]]; then + TEMP_DIR=$(mktemp -d) + unzip -q "$SOURCE" -d "$TEMP_DIR" + RESTORE_PATH=$(find "$TEMP_DIR" -maxdepth 1 -type d -name "config-*" | head -n 1) +else + RESTORE_PATH="$SOURCE" +fi + +if [ ! -d "$RESTORE_PATH" ]; then + echo "Error: Invalid config source" + exit 1 +fi + +# Clean and restore config-scripts/ +rm -rf ~/config-scripts +cp -r "$RESTORE_PATH/config-scripts" ~/ + +# Clean and restore .themes/ +rm -rf ~/.themes/Colloid-Transparent-Dracula +mkdir -p ~/.themes +cp -r "$RESTORE_PATH/.themes/Colloid-Transparent-Dracula" ~/.themes/ + +# Clean and restore .config/ +for dir in nvim rofi yazi hypr waybar dunst kitty fastfetch; do + rm -rf ~/.config/$dir + mkdir -p ~/.config/$dir + cp -r "$RESTORE_PATH/.config/$dir/." ~/.config/$dir/ +done + +# Restore single dotfiles +cp -r "$RESTORE_PATH/.inputrc" ~/ +cp -r "$RESTORE_PATH/.bash_profile" ~/ +cp -r "$RESTORE_PATH/.bashrc" ~/ +cp -r "$RESTORE_PATH/.bash_exports" ~/ +cp -r "$RESTORE_PATH/.bash_aliases" ~/ +cp -r "$RESTORE_PATH/.ideavimrc" ~/ +echo 'Restored configs' + +# Cleanup temp files +[ -n "$TEMP_DIR" ] && rm -rf "$TEMP_DIR" + +echo -e "\e[32mDone!\e[0m" diff --git a/config-scripts/install-config.sh b/config-scripts/install-config.sh new file mode 100755 index 0000000..24ff110 --- /dev/null +++ b/config-scripts/install-config.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# ---- Initial setup ---- +# Creating all the directories +echo "Creating all the directories...." +mkdir -p ~/.config/bash +mkdir -p ~/Documents/obsidian/Notes +mkdir -p ~/Pictures/Screenshots +mkdir ~/Downloads +mkdir ~/Programming +mkdir ~/Public +mkdir ~/Music +mkdir ~/Videos +mkdir ~/config-scripts +mkdir ~/scripts +mkdir -p ~/tmp/daily + +# Creating extra files +echo "Creating extra files...." +touch ~/.bash_profile +touch ~/.bash_exports +touch ~/.inputrc +touch ~/.bashrc +touch ~/.bash_aliases +touch ~/.bash_private + +# Creating extra links +echo "Creating extra links...." +ln -s ~/.bash_profile ~/.config/bash/bash_profile +ln -s ~/.bash_exports ~/.config/bash/bash_exports +ln -s ~/.inputrc ~/.config/bash/inputrc +ln -s ~/.bashrc ~/.config/bash/bashrc +ln -s ~/.bash_aliases ~/.config/bash/bash_aliases +ln -s ~/.bash_private ~/.config/bash/bash_private + + +# ---- Packages setup ---- +# Updating package databases & installed packages +echo "Updating package databases & installed packages...." +sudo pacman -Syu --noconfirm + +# Installing the base packages +echo "Installing the base packages...." +sudo pacman -S --needed git base-devel less jq inetutils + +# Installing extra packages +echo "Installing extra packages...." +sudo pacman -S --noconfirm yadm wl-clipboard hyprland uwsm hypridle hyprlock brightnessctl +sudo pacman -S --noconfirm xdg-desktop-portal-hyprland xdg-desktop-portal xdg-desktop-portal-gtk +sudo pacman -S --noconfirm rofi waybar dunst awww kitty neovim nwg-look grim slurp +sudo pacman -S --noconfirm thunar thunar-shares-plugin thunar-archive-plugin thunar-volman gvfs gvfs-goa gvfs-nfs gvfs-smb + + +# ---- Config setup ---- +# This will delete all current dotfiles. Please be careful! +# Cloning config from git +echo "Cloning config from git...." +yadm clone https://git.frik.su/Beesquit/dotfiles.git +yadm reset --hard origin/main +ya pkg upgrade diff --git a/config-scripts/install-yay.sh b/config-scripts/install-yay.sh new file mode 100755 index 0000000..582cbf4 --- /dev/null +++ b/config-scripts/install-yay.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Installing yay +echo "Checking if yay is installed...." +if ! command -v yay >/dev/null 2>&1; then + echo "yay is not installed. Installing..." + mkdir -p ~/tmp/yay-install + cd ~/tmp/yay-install + git clone https://aur.archlinux.org/yay.git + cd yay + makepkg -si + cd + rm -rf ~/tmp/yay-install +else + echo "yay is installed. Skipping..." +fi diff --git a/config-scripts/link-bash.sh b/config-scripts/link-bash.sh new file mode 100755 index 0000000..7b64878 --- /dev/null +++ b/config-scripts/link-bash.sh @@ -0,0 +1,17 @@ +#!/bin/bash +bash_cfg_path=~/.config/bash + +touch ~/.inputrc +touch ~/.bash_profile +touch ~/.bashrc +touch ~/.bash_aliases +touch ~/.bash_private +touch ~/.bash_exports + +mkdir -p "$bash_cfg_path" +ln -s ~/.inputrc "$bash_cfg_path/inputrc" +ln -s ~/.bash_profile "$bash_cfg_path/bash_profile" +ln -s ~/.bashrc "$bash_cfg_path/bashrc" +ln -s ~/.bash_aliases "$bash_cfg_path/bash_aliases" +ln -s ~/.bash_private "$bash_cfg_path/bash_private" +ln -s ~/.bash_exports "$bash_cfg_path/bash_exports" diff --git a/yadm-readd.sh b/config-scripts/yadm-readd.sh similarity index 93% rename from yadm-readd.sh rename to config-scripts/yadm-readd.sh index d2c9724..b39c216 100755 --- a/yadm-readd.sh +++ b/config-scripts/yadm-readd.sh @@ -1,4 +1,4 @@ -yadm add ~/yadm-readd.sh +yadm add ~/config-scripts yadm add ~/.themes/Colloid-Transparent-Dracula/