first commit

This commit is contained in:
hdvt
2026-03-28 16:48:16 +00:00
commit 0c097ebf97
15478 changed files with 850272 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
# --- AUTOCOMPLETION ---
complete -c servicectl -f
set -l commands start stop restart status enable disable activate
complete -c servicectl -n "not __fish_seen_subcommand_from $commands" -a "$commands"
# Подсказываем имена сервисов из папки репозитория (SV_DIR)
complete -c servicectl -n "__fish_seen_subcommand_from $commands" -a "(command ls -1 /etc/s6/sv/ 2>/dev/null)"

View File

@@ -0,0 +1,14 @@
# This file was created by fish when upgrading to version 4.3, to migrate
# the 'fish_key_bindings' variable from its old default scope (universal)
# to its new default scope (global). We recommend you delete this file
# and configure key bindings in ~/.config/fish/config.fish if needed.
# set --global fish_key_bindings fish_default_key_bindings
# Prior to version 4.3, fish shipped an event handler that runs
# `set --universal fish_key_bindings fish_default_key_bindings`
# whenever the fish_key_bindings variable is erased.
# This means that as long as any fish < 4.3 is still running on this system,
# we cannot complete the migration.
# As a workaround, erase the universal variable at every shell startup.
set --erase --universal fish_key_bindings

View File

@@ -0,0 +1,37 @@
# This file was created by fish when upgrading to version 4.3, to migrate
# theme variables from universal to global scope.
# Don't edit this file, as it will be written by the web-config tool (`fish_config`).
# To customize your theme, delete this file and see
# help interactive#syntax-highlighting
# or
# man fish-interactive | less +/^SYNTAX.HIGHLIGHTING
# for appropriate commands to add to ~/.config/fish/config.fish instead.
# See also the release notes for fish 4.3.0 (run `help relnotes`).
set --global fish_color_autosuggestion 555 brblack
set --global fish_color_cancel -r
set --global fish_color_command blue
set --global fish_color_comment red
set --global fish_color_cwd green
set --global fish_color_cwd_root red
set --global fish_color_end green
set --global fish_color_error brred
set --global fish_color_escape brcyan
set --global fish_color_history_current --bold
set --global fish_color_host normal
set --global fish_color_host_remote yellow
set --global fish_color_normal normal
set --global fish_color_operator brcyan
set --global fish_color_param cyan
set --global fish_color_quote yellow
set --global fish_color_redirection cyan --bold
set --global fish_color_search_match --background=111
set --global fish_color_selection white --bold --background=brblack
set --global fish_color_status red
set --global fish_color_user brgreen
set --global fish_color_valid_path --underline
set --global fish_pager_color_completion normal
set --global fish_pager_color_description B3A06D yellow -i
set --global fish_pager_color_prefix cyan --bold --underline
set --global fish_pager_color_progress brwhite --background=cyan
set --global fish_pager_color_selected_background -r

137
fish/config.fish Normal file
View File

@@ -0,0 +1,137 @@
set -x MANROFFOPT "-c"
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
# Set settings for https://github.com/franciscolourenco/done
set -U __done_min_cmd_duration 10000
set -U __done_notification_urgency_level low
## Environment setup
# Apply .profile: use this to put fish compatible .profile stuff in
if test -f ~/.fish_profile
source ~/.fish_profile
end
# Add ~/.local/bin to PATH
if test -d ~/.local/bin
if not contains -- ~/.local/bin $PATH
set -p PATH ~/.local/bin
end
end
# Add depot_tools to PATH
if test -d ~/Applications/depot_tools
if not contains -- ~/Applications/depot_tools $PATH
set -p PATH ~/Applications/depot_tools
end
end
## Functions
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
function __history_previous_command
switch (commandline -t)
case "!"
commandline -t $history[1]; commandline -f repaint
case "*"
commandline -i !
end
end
function __history_previous_command_arguments
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end
if [ "$fish_key_bindings" = fish_vi_key_bindings ];
bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments
else
bind ! __history_previous_command
bind '$' __history_previous_command_arguments
end
# Fish command history
function history
builtin history --show-time='%F %T '
end
function backup --argument filename
cp $filename $filename.bak
end
# Copy DIR1 DIR2
function copy
set count (count $argv | tr -d \n)
if test "$count" = 2; and test -d "$argv[1]"
set from (echo $argv[1] | trim-right /)
set to (echo $argv[2])
command cp -r $from $to
else
command cp $argv
end
end
## Useful aliases
# Replace ls with eza
# Common use
alias grubup="sudo grub-mkconfig -o /boot/grub/grub.cfg"
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
alias tarnow='tar -acf '
alias untar='tar -zxvf '
alias wget='wget -c '
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias hw='hwinfo --short' # Hardware Info
alias big="expac -H M '%m\t%n' | sort -h | nl" # Sort installed packages according to size in MB
alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages
alias update='sudo pacman -Syu'
# Get fastest mirrors
alias mirror="sudo cachyos-rate-mirrors"
alias apt='man pacman'
alias apt-get='man pacman'
alias please='sudo'
alias tb='nc termbin.com 9999'
alias cleanup='sudo pacman -Rns (pacman -Qtdq)'
alias jctl="journalctl -p 3 -xb"
alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl"
starship init fish | source
set -x EZA_COLORS "da=38;5;244:uu=38;5;244:ug=38;5;244:su=38;5;244:di=1;37:ln=36:b=33:c=33:p=33:s=1;31:fi=0:gm=33:ga=32:gd=31:gR=34:gt=34:lp=36:hd=4:*.md=38;5;220:*.gradle=38;5;220"
alias ls='eza --icons --git'
alias ll='eza -l --icons --git'
alias la='eza -la --icons --git'
alias llt='eza --tree --level=2 --long --icons --git'
function =
math "$argv"
end
function fish_command_not_found
if math $argv >/dev/null 2>&1
math $argv
else
__fish_default_command_not_found_handler $argv
end
end

11
fish/fish_variables Normal file
View File

@@ -0,0 +1,11 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __done_min_cmd_duration:10000
SETUVAR __done_notification_urgency_level:low
SETUVAR __fish_initialized:4300
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_quote:f1c40f
SETUVAR fish_greeting:
SETUVAR fish_user_paths:/var/lib/flatpak/exports/bin\x1e/home/hadvart/\x2espicetify

View File

@@ -0,0 +1,43 @@
function fish_prompt
# Сохраняем код последней выполненной команды
set -l last_status $status
# --- Левая (черная) часть ---
# Устанавливаем черный фон и белый цвет текста
set_color -b black white
# Выводим текущую директорию. prompt_pwd - это встроенная функция fish для сокращенного пути
echo -n ' '(prompt_pwd)' '
# --- Разделитель и правая (белая) часть ---
# Используем символ powerline для плавного перехода
set_color -b white black
echo -n '' # Символ-разделитель
# Получаем информацию о Git
set -l git_info (fish_git_prompt)
# Если мы находимся в Git-репозитории, отображаем информацию
if test -n "$git_info"
# Устанавливаем белый фон и черный цвет текста
set_color -b white black
echo -n $git_info' '
set_color -b normal # Сбрасываем фон
echo -n ' '
else
# Если не в репозитории, просто завершаем белую часть
set_color -b normal
echo -n ' '
# --- Завершение командной строки ---
# Возвращаем стандартные цвета
set_color normal
# Отображаем символ '>' красным цветом, если последняя команда завершилась с ошибкой
if test $last_status -ne 0
set_color red
end
echo -n '> '
set_color normal
end
end

View File

@@ -0,0 +1,151 @@
function servicectl --description "Manage s6 services (systemd-style wrapper)"
# --- CONFIGURATION ---
# Папка, где лежат оригиналы скриптов сервисов
set -l SV_DIR /etc/s6/sv
# "Живая" папка, которую сканирует s6 прямо сейчас (обычно в tmpfs/RAM)
set -l SCAN_DIR /run/service
# ПАПКА ДЛЯ АВТОЗАГРУЗКИ (Persistent).
# Сюда ставятся симлинки, чтобы сервис запускался после ребута.
# В Void Linux это /var/service, в других может быть /etc/s6/enabled
set -l PERM_DIR /var/service
# Пути для поиска логов
set -l LOG_SEARCH_PATHS /var/log /var/log/s6
# ---------------------
set -l cmd $argv[1]
set -l service $argv[2]
if test -z "$cmd"
echo "Usage: servicectl <start|stop|restart|status|enable|disable|activate> <service_name>"
return 1
end
switch $cmd
# --- УПРАВЛЕНИЕ СОСТОЯНИЕМ (ВКЛ/ВЫКЛ) ---
case activate
# Просто линкуем в SCAN_DIR (работает до перезагрузки)
if not test -d $SV_DIR/$service
echo "Error: Service '$service' does not exist in $SV_DIR."
return 1
end
if test -L $SCAN_DIR/$service; or test -d $SCAN_DIR/$service
echo "Service '$service' is already active (linked in runtime)."
else
sudo ln -s $SV_DIR/$service $SCAN_DIR/$service
echo "Service '$service' activated (runtime link created)."
# Обычно s6 сам запускает сервис при появлении линка, но можно ускорить
sudo s6-svscanctl -a $SCAN_DIR
end
case enable
# Линкуем в PERM_DIR (для ребута) + активируем в рантайме
if not test -d $SV_DIR/$service
echo "Error: Service '$service' does not exist in $SV_DIR."
return 1
end
# 1. Создаем постоянный линк
if test -L $PERM_DIR/$service; or test -d $PERM_DIR/$service
echo "Service '$service' is already enabled for boot."
else
sudo ln -s $SV_DIR/$service $PERM_DIR/$service
echo "Service '$service' enabled (boot link created in $PERM_DIR)."
end
# 2. Активируем прямо сейчас (если еще нет)
if not test -d $SCAN_DIR/$service
sudo ln -s $SV_DIR/$service $SCAN_DIR/$service
sudo s6-svscanctl -a $SCAN_DIR
echo "Service '$service' activated for current session."
end
case disable
# Удаляем отовсюду
# 1. Останавливаем и удаляем из runtime
if test -d $SCAN_DIR/$service
sudo s6-svc -d $SCAN_DIR/$service # Send Down signal
sudo rm $SCAN_DIR/$service # Remove runtime link
echo "Service '$service' deactivated (runtime link removed)."
else
echo "Service '$service' was not active in runtime."
end
# 2. Удаляем из автозагрузки
if test -L $PERM_DIR/$service; or test -d $PERM_DIR/$service
sudo rm $PERM_DIR/$service
echo "Service '$service' disabled (boot link removed)."
end
# --- УПРАВЛЕНИЕ ПРОЦЕССОМ (UP/DOWN) ---
case start
if not test -d $SCAN_DIR/$service
echo "Error: Service '$service' is not active (not linked in $SCAN_DIR)."
echo "Hint: Run 'servicectl activate $service' or 'servicectl enable $service' first."
return 1
end
sudo s6-svc -u $SCAN_DIR/$service
echo "Service '$service' started (up signal sent)."
case stop
if not test -d $SCAN_DIR/$service
echo "Error: Service '$service' is not active."
return 1
end
sudo s6-svc -d $SCAN_DIR/$service
echo "Service '$service' stopped (down signal sent)."
case restart
if not test -d $SCAN_DIR/$service
echo "Error: Service '$service' is not active."
return 1
end
sudo s6-svc -r $SCAN_DIR/$service
echo "Service '$service' restarted."
case status
if test -d $SCAN_DIR/$service
echo "--- Service Status ($service) ---"
sudo s6-svstat $SCAN_DIR/$service
if test -d $SCAN_DIR/$service/log
echo "--- Logger Status ---"
sudo s6-svstat $SCAN_DIR/$service/log
end
set -l found_log 0
for path in $LOG_SEARCH_PATHS
if test -f "$path/$service/current"
echo ""
echo "--- Last 10 log lines ---"
# Попытка сконвертировать TAI64N время, если есть утилита
if type -q s6-tai64nlocal
sudo tail -n 10 "$path/$service/current" | s6-tai64nlocal
else
sudo tail -n 10 "$path/$service/current"
end
set found_log 1
break
end
end
else
echo "Status: Service '$service' is INACTIVE (not linked)."
if test -L $PERM_DIR/$service
echo " (But it IS enabled for boot in $PERM_DIR)"
else
echo " (Not enabled for boot)"
end
end
case '*'
echo "Unknown command: $cmd"
echo "Available: start, stop, restart, status, enable, disable, activate"
return 1
end
end

3
fish/functions/zzz.fish Normal file
View File

@@ -0,0 +1,3 @@
function zzz --wraps='echo mem | sudo tee /sys/power/state' --description 'alias zzz=echo mem | sudo tee /sys/power/state'
echo mem | sudo tee /sys/power/state $argv
end