Initial commit

This commit is contained in:
2025-07-11 18:08:12 +03:00
commit 74c6a29a13
478 changed files with 23775 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
function aichat_fish
set -l _old (commandline)
if test -n $_old
echo -n "⌛"
commandline -f repaint
commandline (aichat -e $_old)
end
end

View File

@@ -0,0 +1,33 @@
function airplane_mode_toggle
set backup_file ~/.cache/airplane_backup
if test -e $backup_file
# Read network states from the backup file
set -l wifi_status (cat $backup_file | grep -o 'wifi:\(on\|off\)$' | cut -d':' -f2)
set -l bluetooth_status (cat $backup_file | grep -o 'bluetooth:\(on\|off\)$' | cut -d':' -f2)
# Restore network states
if test "$wifi_status" = on
rfkill unblock wifi
# else
# rfkill block wifi
end
if test "$bluetooth_status" = on
rfkill unblock bluetooth
# else
# rfkill block bluetooth
end
# Remove the backup file
rm $backup_file
else
# Backup the current network states and turn off all networks
echo "wifi:$(rfkill list wifi | grep -q "Soft blocked: no" && echo "on" || echo "off")" >$backup_file
echo "bluetooth:$(rfkill list bluetooth | grep -qi "Soft blocked: no" && echo "on" || echo "off")" >>$backup_file
# Add more lines to backup other network types if needed
rfkill block wifi
rfkill block bluetooth
end
end

View File

@@ -0,0 +1,11 @@
function archive-preview
set archive "$argv[1]"
set supported_archive_formats tar.gz tar.bz2 tar.xz zip rar 7z
for format in $supported_archive_formats
if string match -q "application/$format" (file -b --mime-type "$archive")
ouch list --tree --no "$archive"
exit 0
end
end
end

View File

@@ -0,0 +1,3 @@
function autostart
pypr & hyprpaper & waybar & poweralertd -s & wl-paste --type text --watch cliphist store & wl-paste --type image --watch cliphist store & wl-clip-persist --clipboard regular & avizo-service & systemctl --user start psi-notify
end

View File

@@ -0,0 +1,4 @@
function back-op
cd ..
commandline -f repaint
end

View File

@@ -0,0 +1,4 @@
function backtrack-op
cd -
commandline -f repaint
end

View File

@@ -0,0 +1,13 @@
function bluetooth_toggle
set bluetooth_status (rfkill list bluetooth | grep -i -o "Soft blocked: yes")
set backup_file ~/.cache/airplane_backup
if [ -z "$bluetooth_status" ]
rfkill block bluetooth
else
rfkill unblock bluetooth
if test -e $backup_file
rm $backup_file
end
end
end

View File

@@ -0,0 +1,10 @@
function bookmark_add
if [ -z $(wl-paste) ]
dunstify "Bookmarks" "Can`t add empty space" -u critical -t 2000
else if grep -q "^$(wl-paste)\$" .bookmarks
dunstify "Bookmarks" "Bookmark '$(wl-paste)' already exists" -u critical -t 2000
else
wl-paste >> .bookmarks;
dunstify "Bookmarks" "Bookmark '$(wl-paste)' was added" -t 2000
end
end

View File

@@ -0,0 +1,7 @@
function bookmark_delete
set bookmark $(cat .bookmarks | rofi -dmenu -p 'delete bookmark')
if not [ -z $bookmark ]
sed -i -e /$bookmark/d .bookmarks
dunstify "Bookmarks" "Bookmark '$bookmark' was deleted" -t 2000
end
end

View File

@@ -0,0 +1,3 @@
function bookmark_to_type
cat .bookmarks | rofi -dmenu -p bookmarks | tr -d '\n' | wtype -
end

View File

@@ -0,0 +1,9 @@
function check_airplane_mode
set backup_file ~/.cache/airplane_backup
if test -e $backup_file
echo "{ \"text\":\"󰀝\", \"tooltip\": \"airplane-mode <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
else
echo "{ \"text\":\"󰀞\", \"tooltip\": \"airplane-mode <span color='#ee99a0'>off</span>\", \"class\": \"off\" }"
end
end

View File

@@ -0,0 +1,7 @@
function check_geo_module
set target_process "geoclue"
if pgrep $target_process > /dev/null
echo "{\"text\":\"󰆤\", \"tooltip\":\"Geopositioning\", \"alt\":\"Geo\"}"
end
end

View File

@@ -0,0 +1,9 @@
function check_night_mode
set target_process wlsunset
if pgrep $target_process >/dev/null
echo "{ \"text\":\"󱩌\", \"tooltip\": \"night-mode <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
else
echo "{ \"text\":\"󱩍\", \"tooltip\": \"night-mode <span color='#ee99a0'>off</span>\", \"class\": \"off\" }"
end
end

View File

@@ -0,0 +1,7 @@
function check_recording
set target_process wl-screenrec
if pgrep $target_process >/dev/null
echo "{\"text\":\"\", \"tooltip\":\"Recording\", \"alt\":\"Recording\"}"
end
end

View File

@@ -0,0 +1,11 @@
function check_webcam
set process_pids (fuser /dev/video0 | awk '{print $2}' | sort -u)
if test -n "$process_pids"
set processes ""
for process_pid in $process_pids
set process_name (ps -q $process_pid -o comm=)
set processes "$processes\n<span color='#eed49f'>$process_name($process_pid)</span>"
end
echo "{\"text\":\"󰖠\", \"tooltip\":\"webcam is used by: $processes\", \"alt\":\"Webcam\"}"
end
end

View File

@@ -0,0 +1,4 @@
function clear-op
clear
commandline -f repaint
end

View File

@@ -0,0 +1,4 @@
function clipboard_clear
rm "$HOME/.cache/cliphist/db"
dunstify Clipboard Cleared -t 2000
end

View File

@@ -0,0 +1,7 @@
function clipboard_delete_item
set clip $(cliphist list | rofi -dmenu -p 'clipboard delete item')
if not [ -z $clip ]
echo $clip | cliphist delete
dunstify "Clipboard" "Clip '$clip' was deleted" -t 2000
end
end

View File

@@ -0,0 +1,3 @@
function clipboard_to_type
cliphist list | rofi -dmenu -p clipboard | cliphist decode | wtype -
end

View File

@@ -0,0 +1,7 @@
function clipboard_to_wlcopy
set clip $(cliphist list | rofi -dmenu -p 'clipboard copy')
if not [ -z $clip ]
echo $clip | cliphist decode | wl-copy
dunstify "Clipboard" "Clip '$clip' was copied" -t 2000
end
end

View File

@@ -0,0 +1,4 @@
function dir-preview
set dir "$argv[1]"
lsd --tree --depth=1 --color=always --icon=always --icon-theme=fancy "$dir"
end

View File

@@ -0,0 +1,20 @@
function dunst_pause
set COUNT_WAITING (dunstctl count waiting)
set COUNT_DISPLAYED (dunstctl count displayed)
set ENABLED "{ \"text\": \"󰂜\", \"tooltip\": \"notifications <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
set DISABLED "{ \"text\": \"󰪑\", \"tooltip\": \"notifications <span color='#ee99a0'>off</span>\", \"class\": \"off\" }"
if [ $COUNT_DISPLAYED != 0 ]
set ENABLED "{ \"text\": \"󰂚$COUNT_DISPLAYED\", \"tooltip\": \"$COUNT_DISPLAYED notifications\", \"class\": \"on\" }"
end
if [ $COUNT_WAITING != 0 ]
set DISABLED "{ \"text\": \"󰂛$COUNT_WAITING\", \"tooltip\": \"(silent) $COUNT_WAITING notifications\", \"class\": \"off\" }"
end
if dunstctl is-paused | rg -q "false"
echo $ENABLED
else
echo $DISABLED
end
end

View File

@@ -0,0 +1,3 @@
function fetch_music_player_data
playerctl -a metadata --format "{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"<i><span color='#a6da95'>{{playerName}}</span></i>: <b><span color='#f5a97f'>{{artist}}</span> - <span color='#c6a0f6'>{{markup_escape(title)}}</span></b>\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}" -F
end

View File

@@ -0,0 +1,4 @@
function file-preview
set file "$argv[1]"
bat --color=always --style=numbers,header-filesize,grid --line-range=:15 --wrap=auto "$file"
end

View File

@@ -0,0 +1,13 @@
function fish_greeting
set_color blue
echo " Distro:  NixOS"
set_color white
echo "󰅱 Langs:  Rust  Zig  Go  JS 󰛦 TS  Python  Lua  Wasm"
set_color green
echo " Shell: 󰈺 Fish"
set_color yellow
echo "󰟶 Mood: 👨‍💻"
set_color cyan
figlet random -f binary
# clear
end

View File

@@ -0,0 +1,26 @@
function fish_user_key_bindings
# Execute this once per mode that emacs bindings should be used in
fish_default_key_bindings -M insert
# Then execute the vi-bindings so they take precedence when there's a conflict.
# Without --no-erase fish_vi_key_bindings will default to
# resetting all bindings.
# The argument specifies the initial mode (insert, "default" or visual).
fish_vi_key_bindings --no-erase insert
# Nullify fzf default keybindings
bind \cT '' -M insert
bind \cR '' -M insert
bind \er fzf-history-widget -M insert
bind \ef fzf-file-preview-widget -M insert
bind \ec fzf-cd-preview-widget -M insert
bind \ep fzf-ps-widget -M insert
bind \e\f clear-op -M insert
bind \eb back-op -M insert
bind \eB backtrack-op -M insert
bind \e/ list-op -M insert
bind \ea aichat_fish -M insert
end

View File

@@ -0,0 +1,8 @@
function fzf-cd-preview-widget
set selected_dir (fd --type d --hidden --no-ignore --exclude .git --exclude .direnv | fzf --height 40% --reverse --preview 'dir-preview {}' --preview-window=right:40%)
if test -n "$selected_dir"
cd "$selected_dir"
end
commandline -f repaint
end

View File

@@ -0,0 +1,4 @@
function fzf-file-preview-widget
commandline -i (fd --hidden --no-ignore --exclude .git --exclude .direnv | fzf --height 40% --preview-window=right:40% --reverse --preview 'switch-preview {}')
commandline -f repaint
end

View File

@@ -0,0 +1,4 @@
function fzf-ps-widget
commandline -i (pgrep -a . | fzf --height 40%)
commandline -f repaint
end

View File

@@ -0,0 +1,9 @@
function image-preview
set image "$argv[1]"
# Retrieve the current terminal dimensions and reduce them slightly to avoid boundary issues
set term_width (math (tput cols) - 1)
set term_height (math (tput lines) - 1)
chafa "$image" --size="$term_width"x"$term_height"
end

View File

@@ -0,0 +1,6 @@
function list-op
echo \n
lsd -Alg
echo \n\n
commandline -f repaint
end

View File

@@ -0,0 +1,9 @@
function night_mode_toggle
set target_process wlsunset
if pgrep $target_process >/dev/null
killall -s SIGINT wlsunset
else
wlsunset
end
end

View File

@@ -0,0 +1,18 @@
function record_screen_gif
set target_process wl-screenrec
if pgrep $target_process >/dev/null
killall -s SIGINT $target_process
else
set geometry (slurp)
if not [ -z $geometry ]
set record_name $(echo "recrod-$(date +"%Y-%m-%d--%H:%M:%S")")
dunstify -i ~/.config/fish/icons/camera_gif_icon.png -r $(cd ~/Pictures/Records/ && ls -1 | wc -l) "Recording Started  (GIF)" -t 2000
wl-screenrec -g "$geometry" -f "$HOME/Pictures/Records/$record_name.mp4" --encode-resolution 1920x1080
ffmpeg -i "$HOME/Pictures/Records/$record_name.mp4" "$HOME/Pictures/Records/$record_name.gif"
rm "$HOME/Pictures/Records/$record_name.mp4"
wl-copy -t text/uri-list file://$HOME/Pictures/Records/$record_name.gif\n
dunstify -i ~/.config/fish/icons/camera_gif_icon.png -r $(cd ~/Pictures/Records/ && ls -1 | wc -l) "Recording Stopped 󰙧 (GIF)" -t 2000
end
end
end

View File

@@ -0,0 +1,16 @@
function record_screen_mp4
set target_process wl-screenrec
if pgrep $target_process >/dev/null
killall -s SIGINT $target_process
else
set geometry (slurp)
if not [ -z $geometry ]
set record_name $(echo "recrod-$(date +"%Y-%m-%d--%H:%M:%S")")
dunstify -i ~/.config/fish/icons/camera_mp4_icon.png -r $(cd ~/Videos/Records/ && ls -1 | wc -l) "Recording Started  (MP4)" -t 2000
wl-screenrec -g "$geometry" -f "$HOME/Videos/Records/$record_name.mp4"
wl-copy -t text/uri-list file://$HOME/Videos/Records/$record_name.mp4\n
dunstify -i ~/.config/fish/icons/camera_mp4_icon.png -r $(cd ~/Videos/Records/ && ls -1 | wc -l) "Recording Stopped 󰙧 (MP4)" -t 2000
end
end
end

View File

@@ -0,0 +1,3 @@
function screenshot_edit
swappy -f ~/Pictures/Screenshots/(cd ~/Pictures/Screenshots && ls -tA | head -n1 | awk '{print $NF}')
end

View File

@@ -0,0 +1,9 @@
function screenshot_to_clipboard
set screenshot_filename (echo "$HOME/Pictures/Screenshots/screenshot-$(date +"%Y-%m-%d--%H:%M:%S").png")
grim -g (slurp) $screenshot_filename
if [ -e $screenshot_filename ]
cat $screenshot_filename | wl-copy --type image/png
dunstify -i $screenshot_filename -r (cd ~/Pictures/Screenshots/ && ls -1 | wc -l) "Screenshots" "Screenshot was taken" -t 2000
end
end

View File

@@ -0,0 +1,20 @@
function switch-preview
set path "$argv[1]"
if test -f "$path"
if test ! -s "$path"
echo "File is empty"
else
archive-preview "$path"
if string match -q "image/*" (file -b --mime-type "$path")
image-preview "$path"
else
file-preview "$path"
end
end
else if test -d "$path"
dir-preview "$path"
else
echo "Preview unavailable"
end
end

View File

@@ -0,0 +1,3 @@
function tre
command tre $argv -e; and source /tmp/tre_aliases_$USER ^/dev/null
end

View File

@@ -0,0 +1,13 @@
function wifi_toggle
set wifi_status (rfkill list wifi | grep -i -o "Soft blocked: yes")
set backup_file ~/.cache/airplane_backup
if [ -z "$wifi_status" ]
rfkill block wifi
else
rfkill unblock wifi
if test -e $backup_file
rm $backup_file
end
end
end

View File

@@ -0,0 +1,5 @@
function wlogout_uniqe
if [ -z $(pidof wlogout) ]
wlogout
end
end