Compare commits

..

1 Commits

Author SHA1 Message Date
0930ceb2bc add nvim plugin for asciidoc 2025-05-15 18:49:40 +03:00
127 changed files with 1323 additions and 4006 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
custom: ['https://www.blockchain.com/btc/address/bc1qgh2fyzqgyxgpstsmqwxyev2luzx7hwc4ezq03u', 'https://www.blockchain.com/eth/address/0x01931cf08BbbA74629c232DbEDB390798cDD121f']

10
.gitignore vendored
View File

@ -36,14 +36,8 @@ home/user/.tmux/*
!home/user/.tmux/sandbox !home/user/.tmux/sandbox
!home/user/.tmux/ssh !home/user/.tmux/ssh
!home/user/.tmux/example-background-job !home/user/.tmux/example-background-job
!home/user/.tmux/system-update
!home/user/.tmux/music
!home/user/.tmux/landing
home/user/.config/git/local home/user/.config/git/local
home/user/.config/sway/config.d/* home/user/.config/i3/config.d/*
!home/user/.config/sway/config.d/.gitkeep !home/user/.config/i3/config.d/.gitkeep
home/user/.config/sway/variables.d/*
!home/user/.config/sway/variables.d/.gitkeep

View File

@ -26,7 +26,7 @@ Config files for:
* ssh * ssh
* git * git
* ranger * ranger
* sway * i3
* vim * vim
* nvim * nvim

View File

@ -1,19 +1,17 @@
readonly TARGETS="\ readonly TARGETS="\
colors:.config/terminal-colors.d colors:.config/terminal-colors.d
less:.lesskey .infokey less:.lesskey .infokey
tmux:.config/tmux .tmux .config/systemd/user/tmux.service %copypasta tmux:.config/tmux .tmux .config/systemd/user/tmux.service .local/bin/tmux_start_session.sh .local/bin/tmux_list_sessions.sh .local/bin/tmux_attach_session.sh .local/bin/tmux_kill_sessions.sh .local/bin/tmux_start_projects.sh
t: t:
note: note:
psw: zsh:.config/zsh .zshenv .zshenv.d .inputrc %colors
zsh:.config/zsh .zshenv .zshenv.d .inputrc %copypasta %colors
alacritty:.config/alacritty alacritty:.config/alacritty
nvim:.config/nvim .editorconfig .editrc .local/bin/vim_askpass_helper nvim:.config/nvim .editorconfig .editrc .local/bin/vim_askpass_helper
ssh: ssh:
git:.config/git .local/bin/ga git:.config/git
ranger:.config/ranger ranger:.config/ranger
gpg: gpg:
sway:.config/sway .config/i3blocks .config/mako .config/mimeapps.list .config/rofi .local/bin/screenshot .config/swaylock .Xresources .local/bin/slm .local/bin/slm_rofi .local/bin/firefox_media %copypasta %pomodoro i3:.xinitrc .xprofile .Xresources .config/i3 .config/i3status .local/bin/i3status_wrapper .config/rofi .config/picom .local/bin/slm .local/bin/slm_rofi.sh .local/bin/power_rofi.sh .local/bin/i3_switch_workspace.sh .config/mimeapps.list
pomodoro:
bat:.config/bat bat:.config/bat
font: font:
termux:.termux termux:.termux
@ -23,8 +21,6 @@ docker:.docker/cli-plugins
ipython:.ipython/profile_default/ipython_config.py ipython:.ipython/profile_default/ipython_config.py
gdb:.config/gdb gdb:.config/gdb
sandbox: sandbox:
utils:.local/bin/myip .local/bin/genpass .local/bin/gensalt .local/bin/django-create-project .local/bin/mirror-site .local/bin/split-file .local/bin/extract .local/bin/destroy
chromium:.local/bin/pchromium .local/share/applications/pchromium.desktop chromium:.local/bin/pchromium .local/share/applications/pchromium.desktop
scripts:.local/bin/httpstatus .local/bin/apco .local/bin/bb .local/bin/emoji .local/bin/mksh .local/bin/nato .local/bin/pastas .local/bin/timer .local/bin/tryna .local/bin/trynafail .local/bin/bak .local/bin/cleanup-directory .local/bin/cleanup-directory-log .local/bin/cleanup-downloads .local/bin/gobuild .local/bin/json .local/bin/open .local/bin/py .local/bin/sha .local/bin/showtips .local/bin/weather .local/bin/radio .local/bin/rmt .local/bin/scratch .local/bin/wake .local/bin/myip .local/bin/genpass .local/bin/gensalt .local/bin/django-create-project .local/bin/mirror-site .local/bin/split-file .local/bin/extract .local/bin/destroy .local/bin/serveit .local/bin/highlight-logs %copypasta
music:.local/bin/mpv-service.sh .config/systemd/user/mpv.service .local/bin/player
copypasta:.local/bin/copy .local/bin/pasta
all:%less %t %note %tmux %zsh %nvim %git" all:%less %t %note %tmux %zsh %nvim %git"

63
etc/X11/xorg.conf Normal file
View File

@ -0,0 +1,63 @@
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 565.57.01
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "LG Electronics LG TV"
HorizSync 30.0 - 83.0
VertRefresh 58.0 - 62.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "NVIDIA GeForce GTX 1050 Ti"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DP-0"
Option "metamodes" "HDMI-0: 1920x1080_60 +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, DP-0: 1920x1080_75 +0+1080 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSectionSub "Display"
Depth 24
EndSubSection
EndSection

View File

@ -1,4 +0,0 @@
[Service]
Type=simple
ExecStart=
ExecStart=-/sbin/agetty --noreset --noclear --autologin thek4n - ${TERM}

View File

@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -- %%USER%%' --noclear --skip-login - $TERM

View File

@ -1,3 +0,0 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -- %%USER%%' --noclear --skip-login - $TERM

View File

@ -0,0 +1 @@
../getty@tty1.service.d/skip-username.conf

View File

@ -3,7 +3,6 @@
echo "wg0 status: $(systemctl is-active wg-quick@wg0.service)" echo "wg0 status: $(systemctl is-active wg-quick@wg0.service)"
if ! systemctl is-active wg-quick@wg0.service 1>/dev/null; then if ! systemctl is-active wg-quick@wg0.service 1>/dev/null; then
#shellcheck disable=SC2016
echo 'Executing this command may fix wireguard: "sudo apt update && sudo apt install linux-headers-$(uname -r) && sudo reboot"' echo 'Executing this command may fix wireguard: "sudo apt update && sudo apt install linux-headers-$(uname -r) && sudo reboot"'
fi fi

View File

@ -28,7 +28,7 @@ multiplier = 3
[window] [window]
dynamic_title = true dynamic_title = true
opacity = 0.92 opacity = 1
[window.dimensions] [window.dimensions]
columns = 150 columns = 150

View File

@ -2,7 +2,7 @@
[alias] [alias]
a = "!ga" a = "!git ls-files --exclude-standard --modified -t | fzf -1 -0 -m --bind load:last --preview 'git diff --color=always {2}' | cut -d' ' -f2 | xargs -r git add"
u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged" u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged"
msg = log -1 --pretty=%B msg = log -1 --pretty=%B
d = diff d = diff
@ -11,10 +11,6 @@
dno = diff --name-only dno = diff --name-only
dw = diff --word-diff=color dw = diff --word-diff=color
dws = diff --word-diff=color --staged dws = diff --word-diff=color --staged
sw = switch
swl = switch -
swb = switch -c
swc = switch -c
co = checkout co = checkout
col = checkout @{-1} col = checkout @{-1}
cob = checkout -b cob = checkout -b
@ -28,7 +24,6 @@
cim = "!_m() { git commit -m \"$*\"; }; _m" cim = "!_m() { git commit -m \"$*\"; }; _m"
cima = "!_m() { git commit -am \"$*\"; }; _m" cima = "!_m() { git commit -am \"$*\"; }; _m"
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)" ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
pst = "!git push origin --tags"
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)" pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"
pr = "pull --rebase" pr = "pull --rebase"
s = status s = status
@ -48,8 +43,6 @@
dump = cat-file -p dump = cat-file -p
unstage = "reset HEAD --" unstage = "reset HEAD --"
count = "rev-list --count --all" count = "rev-list --count --all"
tags = "for-each-ref --sort=-creatordate --format '%(refname:strip=2)' refs/tags"
initci = "commit --allow-empty -m 'Initial commit'"
# edit conflicted file on merge # edit conflicted file on merge
edit-unmerged = "!$EDITOR $(git ls-files --unmerged | cut -f2 | sort -u)" edit-unmerged = "!$EDITOR $(git ls-files --unmerged | cut -f2 | sort -u)"

View File

@ -5,11 +5,10 @@
fileMode = true fileMode = true
whitespace = fix,trailing-space,cr-at-eol whitespace = fix,trailing-space,cr-at-eol
autocrlf = input autocrlf = input
quotepath = false
[i18n] [i18n]
commitEncoding = utf-8 commitEncoding = utf-8
logOutputEncoding = utf-8 logOutputEncoding = utf-8
[init] [init]
defaultBranch = main defaultBranch = main

View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
if command -v makepkg >/dev/null && [ -e PKGBUILD ]; then
if [ -e VERSION ]; then
sed -i "s/pkgver=.\+/pkgver=$(cat VERSION)/" PKGBUILD
git add PKGBUILD
fi
makepkg --printsrcinfo > .SRCINFO
git add .SRCINFO
exit
fi

View File

@ -52,5 +52,3 @@ node_modules/
*.gz *.gz
*.zip *.zip
.redo/

View File

@ -34,8 +34,8 @@
pushInsteadOf = "git@gitlab.com:" pushInsteadOf = "git@gitlab.com:"
pushInsteadOf = "gl:" pushInsteadOf = "gl:"
; [url "https://github.com/"] [url "https://github.com/"]
; insteadOf = "git@github.com:" insteadOf = "git@github.com:"
[url "https://gitlab.com/"] [url "https://gitlab.com/"]
insteadOf = "git@gitlab.com:" insteadOf = "git@gitlab.com:"

244
home/user/.config/i3/config Normal file
View File

@ -0,0 +1,244 @@
# screen layout
exec --no-startup-id ~/.screenlayout/default
for_window [tiling] border pixel 3
smart_borders on
set $mod Mod4
# screensaver
set $i3lock_cmd "i3lock -enf -c 1e1e1e"
exec --no-startup-id xset s off
exec --no-startup-id xset +dpms dpms 600 600 600
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -enf -c 1e1e1e
# hide cursor
exec --no-startup-id unclutter -idle 0.3 -root
exec_always --no-startup-id xset r rate 250 100
exec_always --no-startup-id setxkbmap -model pc105 -layout us,ru -option grp:win_space_toggle -option ctrl:nocaps
# wallpapers
exec --no-startup-id nitrogen --restore; sleep 1; picom -b --config ~/.config/picom/picom.conf
exec --no-startup-id hsetroot
exec --no-startup-id feh --randomize --no-fehbg --bg-scale $HOME/.wallpaper/*
set $font_size 11
font xft:FiraCode $font_size
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86MonBrightnessUp exec xbacklight -inc 20
bindsym XF86MonBrightnessDown exec xbacklight -dec 20
bindsym $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
bindsym --release $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
bindsym $mod+Shift+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
bindsym --release XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
bindsym XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk, x1carb11
bindsym --release XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute, x1carb11
bindsym $mod+XF86AudioMicMute exec --no-startup-id pactl list short sources | awk '/input.*RUNNING/ {system("pactl set-source-mute " $1 " toggle")}' ## Find and mute mics
bindsym $mod+m exec i3-input -F 'mark %s' -l 1 -P 'Mark: '
bindsym $mod+g exec i3-input -F '[con_mark="%s"] focus' -l 1 -P 'Goto: '
focus_follows_mouse no
popup_during_fullscreen smart
# kill focused window
bindsym $mod+Shift+q kill
bindsym $mod+d exec --no-startup-id rofi -show drun -m -1
bindsym $mod+i exec --no-startup-id i3_switch_workspace.sh
bindsym $mod+o exec --no-startup-id slm_rofi.sh
bindsym $mod+p exec --no-startup-id power_rofi.sh
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
bindsym $mod+Ctrl+Shift+l move workspace to output right
bindsym $mod+Ctrl+Shift+h move workspace to output left
bindsym $mod+Ctrl+Shift+k move workspace to output up
bindsym $mod+Ctrl+Shift+j move workspace to output down
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (tabbed, toggle split)
bindsym $mod+t layout tabbed
bindsym $mod+v layout toggle split
bindsym $mod+a focus parent
# toggle tiling / floating
bindsym $mod+Shift+slash floating toggle
bindsym $mod+Shift+comma sticky toggle
for_window [title="Picture-in-Picture"] sticky enable
for_window [title="Picture-in-Picture"] border pixel 0
# change focus between tiling / floating windows
bindsym $mod+slash focus mode_toggle
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1 Browser"
set $ws2 "2  Code"
set $ws3 "3  Code"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8💬Social"
set $ws9 "9🎵Music"
set $ws10 "10🍿Media"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
bindsym $mod+u workspace prev
bindsym $mod+Shift+u workspace next
# resize window (you can also use the mouse for that)
bindsym $mod+r mode "resize"
mode "resize" {
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
bindsym $mod+r mode "default"
bindsym p mode "resize_precise"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "resize_precise" {
bindsym h resize shrink width 1 px or 1 ppt
bindsym j resize grow height 1 px or 1 ppt
bindsym k resize shrink height 1 px or 1 ppt
bindsym l resize grow width 1 px or 1 ppt
bindsym $mod+r mode "default"
bindsym p mode "resize"
bindsym Return mode "default"
bindsym Escape mode "default"
}
set $exitmode "Power: [e]xit, [r]eboot, [s]hutdown, s[u]spend, [l]ock, [b]lack"
mode $exitmode {
bindsym e exit
bindsym r exec reboot
bindsym s exec shutdown -h now
bindsym u exec systemctl suspend; mode "default"
bindsym l exec $i3lock_cmd; mode "default"
bindsym b exec magick canvas:none PNG:- | feh -YF -; mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}
bindsym $mod+x mode $exitmode
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
bar {
output primary
output nonprimary
tray_output primary
status_command exec ~/.local/bin/i3status_wrapper
}
## Clipboard Screenshots
bindsym Print exec --no-startup-id maim | xclip -selection clipboard -t image/png
bindsym $mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) | xclip -selection clipboard -t image/png
bindsym Ctrl+Print exec --no-startup-id maim --select | xclip -selection clipboard -t image/png
# Screenshots
bindsym Shift+Print exec --no-startup-id maim "$SCREENSHOTS_DIR/$(date +'%d-%m-%Y-%T').png"
bindsym Shift+$mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) "$SCREENSHOTS_DIR/$(date +'%d-%m-%Y-%T').png"
bindsym Shift+Ctrl+Print exec --no-startup-id maim --select "$SCREENSHOTS_DIR/$(date +'%d-%m-%Y-%T').png"
# default workspaces for monitors in setup
workspace $ws1 output primary
workspace $ws2 output primary
workspace $ws3 output primary
workspace $ws9 output nonprimary
workspace $ws10 output nonprimary
workspace hide1 output primary
workspace hide2 output nonprimary
bindsym $mod+q exec --no-startup-id i3-msg workspace hide1; workspace hide2
no_focus [title="^Peek preview$"]
include ~/.config/i3/config.d/*.conf

View File

@ -1,64 +0,0 @@
separator_block_width=15
markup=pango
color=#FFFFFF
interval=5
[wireless]
command=~/.config/i3blocks/scripts/builder.sh wireless
interval=10
[ethernet]
command=~/.config/i3blocks/scripts/builder.sh ethernet
interval=10
[diskroot]
command=~/.config/i3blocks/scripts/builder.sh disk_root
interval=30
[diskhome]
command=~/.config/i3blocks/scripts/builder.sh disk_home
interval=30
[memory]
command=~/.config/i3blocks/scripts/builder.sh memory
interval=5
[cpu_usage]
command=~/.config/i3blocks/scripts/builder.sh cpu_usage
interval=5
[cpu_temp]
command=~/.config/i3blocks/scripts/builder.sh cpu_temp
interval=5
[bluetooth]
command=~/.config/i3blocks/scripts/builder.sh bluetooth_battery
interval=5
[battery]
command=~/.config/i3blocks/scripts/builder.sh battery
interval=30
[volume]
command=~/.config/i3blocks/scripts/builder.sh volume
interval=1
signal=1
[pomodoro]
command=~/.config/i3blocks/scripts/builder.sh pomodoro
interval=1
signal=2
[language]
command=~/.config/i3blocks/scripts/builder.sh language
signal=1
[userhost]
command=~/.config/i3blocks/scripts/builder.sh userhost
signal=1
[time]
command=~/.config/i3blocks/scripts/builder.sh time
interval=30

View File

@ -1,125 +0,0 @@
#!/bin/sh
set -ue
readonly EXIT_SUCCESS=0
readonly EXIT_FAILURE=1
cmd_wireless() {
wifiname="$(LANG=C nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2)"
wifi_ip=$(ip -o -4 addr show | grep wlp | awk '{print $4}' | cut -d/ -f1 | head -1)
if [ -z "${wifiname}" ] || [ -z "${wifi_ip}" ]; then
return 0
fi
printf ' %s %s\n' "${wifiname}" "${wifi_ip}"
}
cmd_battery() {
charging_status="$(cat /sys/class/power_supply/BAT0/status)"
percent="$(cat /sys/class/power_supply/BAT0/capacity)"
if [ "${percent}" -lt 35 ]; then
emoji_status="🪫"
else
emoji_status="🔋"
fi
if [ "${charging_status}" = "Charging" ]; then
emoji_status="🔌"
fi
printf "%s %s%%\n" "${emoji_status}" "${percent}"
}
cmd_disk_root() {
df -h / | awk '/\// {print "/ "$3"/"$2}'
}
cmd_disk_home() {
res="$(df -h /home)"
if [ "$(echo "${res}" | awk '/\// {print $6}')" = "/" ]; then
return 1
fi
df -h /home | awk '/\// {print " "$3"/"$2}'
}
cmd_memory() {
free -h | awk '/^Mem/ {print "🎟 "$3"/"$2}' | sed 's/i//g'
}
cmd_cpu_usage() {
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print " "100 - $1"%"}'
}
cmd_cpu_temp() {
temp_mC="$(cat /sys/class/thermal/thermal_zone0/temp)"
temp_C="$((temp_mC / 1000))"
if [ "${temp_C}" -gt 80 ]; then
printf '<span foreground="red"> %s°C</span>\n' "${temp_C}"
else
printf ' %s°C\n' "${temp_C}"
fi
}
cmd_time() {
LC_ALL=C date '+ %d.%m.%y %a  %H:%M'
}
cmd_volume() {
value="$(pactl --format=json get-sink-volume @DEFAULT_SINK@ | jq --raw-output '.volume."front-left".value_percent')"
printf ' %s\n' "${value}"
}
cmd_pomodoro() {
pomodoro get
}
cmd_bluetooth_battery() {
device="$(upower -e | grep headset | head -1)"
upower -i "${device}" | grep percentage | awk '{ print "🎧🔋"$2"" }'
}
cmd_language() {
layout="$(swaymsg -t get_inputs | jq -r '.[] | select(.type == "keyboard") | .xkb_active_layout_name' | head -1)"
case "${layout}" in
"English (US)")
printf '🇬🇧 En\n'
;;
Russian)
printf '🇷🇺 Ru\n'
;;
*)
printf '🌐 %s\n' "${layout}"
;;
esac
}
cmd_userhost() {
printf "%s@%s\n" "${USER}" "${HOST:-${HOSTNAME:-}}"
}
case "${1}" in
wireless) shift; cmd_wireless "$@" ;;
ethernet) shift; cmd_ethernet "$@" ;;
battery) shift; cmd_battery "$@" ;;
disk_root) shift; cmd_disk_root "$@" ;;
disk_home) shift; cmd_disk_home "$@" ;;
memory) shift; cmd_memory "$@" ;;
cpu_usage) shift; cmd_cpu_usage "$@" ;;
cpu_temp) shift; cmd_cpu_temp "$@" ;;
time) shift; cmd_time "$@" ;;
volume) shift; cmd_volume "$@" ;;
pomodoro) shift; cmd_pomodoro "$@" ;;
bluetooth_battery) shift; cmd_bluetooth_battery "$@" ;;
language) shift; cmd_language "$@" ;;
userhost) shift; cmd_userhost "$@" ;;
*) exit "${EXIT_FAILURE}" ;;
esac
exit "${EXIT_SUCCESS}"

View File

@ -1,8 +0,0 @@
#!/bin/sh
swaymsg -m -t SUBSCRIBE "['input']" | \
jq --unbuffered -r '.change' | while read -r line; do
if echo "${line}" | grep -q "xkb_layout"; then
pkill -RTMIN+1 i3blocks
fi
done

View File

@ -0,0 +1,82 @@
general {
colors = true
interval = 5
output_format = i3bar
}
order += "wireless _first_"
order += "ethernet _first_"
order += "disk /"
order += "disk /home"
order += "memory"
order += "cpu_usage"
order += "cpu_temperature 0"
order += "tztime holder__headphones"
order += "battery all"
order += "volume master"
order += "tztime local"
wireless _first_ {
format_up = " (%quality at %essid %frequency) %ip"
format_down = " down"
color_bad = "#454545"
}
ethernet _first_ {
format_up = " %ip"
format_down = " down"
}
battery all {
format = "%status %percentage"
last_full_capacity = false
format_down = ""
status_chr = "⚡"
status_bat = "🔋"
status_unk = "?"
status_full = ""
path = "/sys/class/power_supply/BAT%d/uevent"
low_threshold = 15
}
disk "/" {
format = "/ %used/%total"
}
disk "/home" {
format = " %used/%total"
}
memory {
format = " %used/%total"
threshold_degraded = "1G"
threshold_critical = "200M"
format_degraded = "MEMORY < %available"
}
cpu_usage {
format = " %usage"
}
cpu_temperature 0 {
format = " %degrees°"
max_threshold = "80"
format_above_threshold = " %degrees"
}
tztime local {
format = " %d.%m.%y %a  %H:%M"
}
volume master {
format = " %volume"
format_muted = ": muted %volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}
tztime holder__headphones {
format = "holder__headphones"
}

View File

@ -1 +0,0 @@
output=DP-1

View File

@ -4,8 +4,6 @@ text/html=firefox.desktop
x-scheme-handler/about=firefox.desktop x-scheme-handler/about=firefox.desktop
x-scheme-handler/http=firefox.desktop x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop x-scheme-handler/https=firefox.desktop
x-scheme-handler/about=firefox.desktop
x-scheme-handler/unknown=firefox.desktop
x-scheme-handler/tonsite=org.telegram.desktop.desktop x-scheme-handler/tonsite=org.telegram.desktop.desktop
x-scheme-handler/tg=org.telegram.desktop.desktop x-scheme-handler/unknown=firefox.desktop
x-scheme-handler/postman=Postman.desktop x-scheme-handler/postman=Postman.desktop

View File

@ -25,11 +25,9 @@ end
map('n', '<Leader>hc', create_function_tabdo('set cursorline!'), map('n', '<Leader>hc', create_function_tabdo('set cursorline!'),
{desc = "Toggle line highlighting"}) {desc = "Toggle line highlighting"})
map('n', '<Leader>cs', map('n', '<Leader>h/',
function() vim.fn.setreg('/', '\\%x') end, function() vim.opt.hlsearch = not vim.opt.hlsearch["_value"] end,
{desc = "Clear search"}) {desc = "Toggle search highlighting"})
map('n', '<Leader>h/', function() vim.o.hlsearch = not vim.o.hlsearch end, {desc = "Clear search"})
-- enable search highlight in search mode -- enable search highlight in search mode
@ -46,9 +44,6 @@ map('n', '<Leader>hl', create_function_tabdo('lua toggle_number_style()'),
map('n', '~', 'vg~', {desc = "Toggle character case"}) map('n', '~', 'vg~', {desc = "Toggle character case"})
map('n', 'Ё', 'vg~', {desc = "Toggle character case"})
map('v', 'Ё', '~', {desc = "Toggle character case"})
map('n', map('n',

View File

@ -2,11 +2,12 @@
local function map_filetype(filetype, key, cmd) local function map_filetype(filetype, key, cmd)
local function format_string() local function format_string()
local run_script_string = [[:terminal %s <CR> :set nocursorline number norelativenumber <CR> G]] local run_script_string = [[:e %% | :terminal %s <CR> :set nocursorline number norelativenumber <CR> G]]
local cmd_string = string.format(run_script_string, cmd) local cmd_string = string.format(run_script_string, cmd)
local map = vim.keymap.set
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
vim.keymap.set('n', key, cmd_string, opts) map('n', key, cmd_string, opts)
end end

View File

@ -144,28 +144,19 @@ vim.cmd.highlight({ "DiagnosticHint", "guifg=Grey" })
opt.langmap = 'ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz' opt.langmap = 'ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz'
vim.o.viewdir = vim.fn.stdpath('cache')..'/view'
vim.fn.mkdir(vim.o.viewdir, 'p')
opt.viewoptions = "folds,cursor" opt.viewoptions = "folds,cursor"
vim.api.nvim_create_autocmd("BufWinLeave", { vim.api.nvim_create_autocmd({"BufWinLeave", "BufLeave"}, {
pattern = {"?*"}, pattern = {"?*"},
callback = function(args) callback = function()
local bufname = vim.api.nvim_buf_get_name(args.buf) vim.cmd.mkview(1)
if not bufname:match("^term://") then
vim.cmd.mkview(1)
end
end end
}) })
vim.api.nvim_create_autocmd("BufWinEnter", { vim.api.nvim_create_autocmd("BufWinEnter", {
pattern = {"?*"}, pattern = {"?*"},
callback = function(args) callback = function()
local bufname = vim.api.nvim_buf_get_name(args.buf) vim.cmd("silent! loadview 1")
if not bufname:match("^term://") then
vim.cmd([[silent! loadview 1]])
end
end, end,
}) })

View File

@ -89,6 +89,15 @@ return {
}, },
config = function() config = function()
require('neodev').setup() require('neodev').setup()
require('lspconfig').lua_ls.setup({
settings = {
Lua = {
completion = {
callSnippet = "Replace"
}
}
}
})
end end
}, },
{ {
@ -157,9 +166,6 @@ return {
set_gitsigns_keymap('h', 'toggle_linehl', {desc = "Toggle changes highlight"}) set_gitsigns_keymap('h', 'toggle_linehl', {desc = "Toggle changes highlight"})
end end
}, },
{
"wsdjeg/vim-fetch",
},
{ {
"aznhe21/actions-preview.nvim", "aznhe21/actions-preview.nvim",
dependencies = { dependencies = {

View File

@ -23,7 +23,7 @@ local function lsp_buf_rename(client_name)
vim.lsp.buf.rename(nil, { name = client_name }) vim.lsp.buf.rename(nil, { name = client_name })
end end
function LSP_BUF_RENAME_USE_ANY(fallback) function lsp_buf_rename_use_any(fallback)
local client_names = get_lsp_client_names(lsp_have_feature.rename) local client_names = get_lsp_client_names(lsp_have_feature.rename)
for _, client_name in ipairs(client_names) do for _, client_name in ipairs(client_names) do
lsp_buf_rename(client_name) lsp_buf_rename(client_name)
@ -35,46 +35,67 @@ function LSP_BUF_RENAME_USE_ANY(fallback)
end end
local on_attach = function(_, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_set_option_value(...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc', {})
-- Mappings.
local opts = { noremap=true, silent=true }
local function desc(description)
return vim.tbl_extend("keep", opts, {desc = description})
end
-- Sections
buf_set_keymap('n', '<space>w', '', {desc = "Workspace manage"})
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', desc("Go declaration"))
buf_set_keymap('n', 'gd', '<cmd>Telescope lsp_definitions<CR>', desc("Go definition"))
buf_set_keymap('n', 'gi', '<cmd>Telescope lsp_implementations<CR>', desc("Go implementation"))
buf_set_keymap('n', 'gr', '<cmd>Telescope lsp_references<CR>', desc("Go references"))
buf_set_keymap('n', 'gt', '<cmd>Telescope lsp_type_definitions<CR>', desc("Go type references"))
buf_set_keymap('n', '<space>k', '<cmd>lua vim.lsp.buf.hover()<CR>', desc("Show help"))
buf_set_keymap('n', '<space>K', '<cmd>lua vim.lsp.buf.signature_help()<CR>', desc("Show signature"))
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', desc("Add workspace folder"))
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', desc("Remove workspace folder"))
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', desc("Show workspace folders"))
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', desc("Show type"))
buf_set_keymap('n', '<space>rn', "<cmd>lua lsp_buf_rename_use_any()<CR>", desc("Rename object"))
buf_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', desc("Show diagnostic"))
buf_set_keymap('n', '<space>p', '<cmd>lua vim.diagnostic.goto_prev()<CR>', desc("Previous problem"))
buf_set_keymap('n', '<space>n', '<cmd>lua vim.diagnostic.goto_next()<CR>', desc("Next problem"))
buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.format()<CR>', desc("Format file"))
end
return { return {
{ {
'mason-org/mason.nvim', 'williamboman/mason.nvim',
dependencies = { dependencies = {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
"mason-org/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
}, },
config = function() config = function()
-- Mappings.
local opts = { noremap=true, silent=true }
local function desc(description)
return vim.tbl_extend("keep", opts, {desc = description})
end
-- Sections
vim.api.nvim_set_keymap('n', '<space>w', '', {desc = "Workspace manage"})
-- See `:help vim.lsp.*` for documentation on any of the below functions
vim.api.nvim_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', desc("Go declaration"))
vim.api.nvim_set_keymap('n', 'gd', '<cmd>Telescope lsp_definitions<CR>', desc("Go definition"))
vim.api.nvim_set_keymap('n', 'gi', '<cmd>Telescope lsp_implementations<CR>', desc("Go implementation"))
vim.api.nvim_set_keymap('n', 'gr', '<cmd>Telescope lsp_references<CR>', desc("Go references"))
vim.api.nvim_set_keymap('n', 'gt', '<cmd>Telescope lsp_type_definitions<CR>', desc("Go type references"))
vim.api.nvim_set_keymap('n', '<space>k', '<cmd>lua vim.lsp.buf.hover()<CR>', desc("Show help"))
vim.api.nvim_set_keymap('n', '<space>K', '<cmd>lua vim.lsp.buf.signature_help()<CR>', desc("Show signature"))
vim.api.nvim_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', desc("Add workspace folder"))
vim.api.nvim_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', desc("Remove workspace folder"))
vim.api.nvim_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', desc("Show workspace folders"))
vim.api.nvim_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', desc("Show type"))
vim.api.nvim_set_keymap('n', '<space>rn', "<cmd>lua LSP_BUF_RENAME_USE_ANY()<CR>", desc("Rename object"))
vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', desc("Show diagnostic"))
vim.api.nvim_set_keymap('n', '<space>p', '<cmd>lua vim.diagnostic.goto_prev()<CR>', desc("Previous problem"))
vim.api.nvim_set_keymap('n', '<space>n', '<cmd>lua vim.diagnostic.goto_next()<CR>', desc("Next problem"))
vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
vim.api.nvim_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.format()<CR>', desc("Format file"))
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup() local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup()
mason_lspconfig.setup_handlers({
function (server_name)
require("lspconfig")[server_name].setup({
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
})
end
})
end, end,
}, },
} }

View File

@ -125,4 +125,9 @@ return {
}) })
end end
}, },
{
'tigion/nvim-asciidoc-preview',
ft = { 'asciidoc' },
build = 'cd server && npm install --omit=dev',
},
} }

View File

@ -15,9 +15,6 @@ return {
cmd = { cmd = {
"Telescope" "Telescope"
}, },
previewers = {
buffer_previewer_maker = require('telescope.previewers').buffer_previewer_maker
},
keys = { keys = {
{ '<Leader>fb', '<cmd>Telescope buffers<CR>' }, { '<Leader>fb', '<cmd>Telescope buffers<CR>' },
{ '<Leader>ff', '<cmd>Telescope find_files<CR>' }, { '<Leader>ff', '<cmd>Telescope find_files<CR>' },

View File

@ -200,10 +200,4 @@ return {
end end
end end
}, },
{
"petertriho/nvim-scrollbar",
config = function()
require("scrollbar").setup()
end
},
} }

View File

@ -0,0 +1,435 @@
#################################
# Shadows #
#################################
# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
#
# shadow = false
shadow = true;
# The blur radius for shadows, in pixels. (defaults to 12)
# shadow-radius = 12
shadow-radius = 7;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
# shadow-opacity = .75
# The left offset for shadows, in pixels. (defaults to -15)
# shadow-offset-x = -15
shadow-offset-x = -7;
# The top offset for shadows, in pixels. (defaults to -15)
# shadow-offset-y = -15
shadow-offset-y = -7;
# Red color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-red = 0
# Green color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-green = 0
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-blue = 0
# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue)
# shadow-color = "#000000"
# Specify a list of conditions of windows that should have no shadow.
#
# examples:
# shadow-exclude = "n:e:Notification";
#
# shadow-exclude = []
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"_GTK_FRAME_EXTENTS@:c"
];
# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window.
# clip-shadow-above = []
# Specify a X geometry that describes the region in which shadow should not
# be painted in, such as a dock window region. Use
# shadow-exclude-reg = "x10+0+0"
# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
#
# shadow-exclude-reg = ""
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
# xinerama-shadow-crop = false
#################################
# Fading #
#################################
# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used.
fading = false
# fading = true;
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
# fade-in-step = 0.028
fade-in-step = 0.075;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
# fade-out-step = 0.03
fade-out-step = 0.075;
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
# fade-delta = 10
# Specify a list of conditions of windows that should not be faded.
# fade-exclude = []
# Do not fade on window open/close.
# no-fading-openclose = false
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
# no-fading-destroyed-argb = false
#################################
# Transparency / Opacity #
#################################
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
inactive-opacity = 1
# inactive-opacity = 0.95;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
# frame-opacity = 1.0
frame-opacity = 0.9;
# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows.
# inactive-opacity-override = true
inactive-opacity-override = false;
# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
# active-opacity = 1.0
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
inactive-dim = 0.15
# Specify a list of conditions of windows that should never be considered focused.
# focus-exclude = []
focus-exclude = [
"class_g = 'firefox'",
"class_g = 'chromium'",
"class_g = 'webview'",
"class_g = 'Cairo-clock'",
"class_g = 'Conky'"
];
# Use fixed inactive dim value, instead of adjusting according to window opacity.
# inactive-dim-fixed = 1.0
# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
# like `50:name *= "Firefox"`. picom-trans is recommended over this.
# Note we don't make any guarantee about possible conflicts with other
# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
# example:
# opacity-rule = [ "80:class_g = 'URxvt'" ];
#
# opacity-rule = []
#################################
# Corners #
#################################
# Sets the radius of rounded window corners. When > 0, the compositor will
# round the corners of windows. Does not interact well with
# `transparent-clipping`.
corner-radius = 3
# Exclude conditions for rounded corners.
rounded-corners-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'"
];
#################################
# Background-Blurring #
#################################
# Parameters for background blurring, see the *BLUR* section for more information.
# blur-method =
# blur-size = 12
#
# blur-deviation = false
#
# blur-strength = 5
# Blur background of semi-transparent / ARGB windows.
# Bad in performance, with driver-dependent behavior.
# The name of the switch may change without prior notifications.
#
# blur-background = false
# Blur background of windows when the window frame is not opaque.
# Implies:
# blur-background
# Bad in performance, with driver-dependent behavior. The name may change.
#
# blur-background-frame = false
# Use fixed blur strength rather than adjusting according to window opacity.
# blur-background-fixed = false
# Specify the blur convolution kernel, with the following format:
# example:
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
#
# blur-kern = ""
blur-kern = "3x3box";
# Exclude conditions for background blur.
# blur-background-exclude = []
blur-background-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'",
"_GTK_FRAME_EXTENTS@:c"
];
#################################
# General Settings #
#################################
# Enable remote control via D-Bus. See the man page for more details.
# dbus = true
# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
# daemon = false
# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
# `xrender` is the default one.
#
# backend = "glx"
backend = "xrender";
# Enable/disable VSync.
# vsync = false
vsync = true;
# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
# dbus = false
# Try to detect WM windows (a non-override-redirect window with no
# child that has 'WM_STATE') and mark them as active.
#
# mark-wmwin-focused = false
mark-wmwin-focused = true;
# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
# mark-ovredir-focused = false
mark-ovredir-focused = true;
# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
#
# detect-rounded-corners = false
detect-rounded-corners = true;
# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
#
# detect-client-opacity = false
detect-client-opacity = true;
# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
# provided that the WM supports it.
#
# use-ewmh-active-win = false
# Unredirect all windows if a full-screen opaque window is detected,
# to maximize performance for full-screen windows. Known to cause flickering
# when redirecting/unredirecting windows.
#
# unredir-if-possible = false
# Delay before unredirecting the window, in milliseconds. Defaults to 0.
# unredir-if-possible-delay = 0
# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
# unredir-if-possible-exclude = []
# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
# in the same group focused at the same time.
#
# detect-transient = false
detect-transient = true;
# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
# group focused at the same time. This usually means windows from the same application
# will be considered focused or unfocused at the same time.
# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too.
#
# detect-client-leader = false
# Resize damaged region by a specific number of pixels.
# A positive value enlarges it while a negative one shrinks it.
# If the value is positive, those additional pixels will not be actually painted
# to screen, only used in blur calculation, and such. (Due to technical limitations,
# with use-damage, those pixels will still be incorrectly painted to screen.)
# Primarily used to fix the line corruption issues of blur,
# in which case you should use the blur radius value here
# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
# with a 5x5 one you use `--resize-damage 2`, and so on).
# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
#
# resize-damage = 1
# Specify a list of conditions of windows that should be painted with inverted color.
# Resource-hogging, and is not well tested.
#
# invert-color-include = []
# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
# Might cause incorrect opacity when rendering transparent content (but never
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
#
glx-no-stencil = true;
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
# Recommended if it works.
#
# glx-no-rebind-pixmap = false
# Disable the use of damage information.
# This cause the whole screen to be redrawn every time, instead of the part of the screen
# has actually changed. Potentially degrades the performance, but might fix some artifacts.
# The opposing option is use-damage
#
# no-use-damage = false
use-damage = true;
# Use X Sync fence to sync clients' draw calls, to make sure all draw
# calls are finished before picom starts drawing. Needed on nvidia-drivers
# with GLX backend for some users.
#
# xrender-sync-fence = false
# GLX backend: Use specified GLSL fragment shader for rendering window
# contents. Read the man page for a detailed explanation of the interface.
#
# window-shader-fg = "default"
# Use rules to set per-window shaders. Syntax is SHADER_PATH:PATTERN, similar
# to opacity-rule. SHADER_PATH can be "default". This overrides window-shader-fg.
#
# window-shader-fg-rule = [
# "my_shader.frag:window_type != 'dock'"
# ]
# Force all windows to be painted with blending. Useful if you
# have a glx-fshader-win that could turn opaque pixels transparent.
#
# force-win-blend = false
# Do not use EWMH to detect fullscreen windows.
# Reverts to checking if a window is fullscreen based only on its size and coordinates.
#
# no-ewmh-fullscreen = false
# Dimming bright windows so their brightness doesn't exceed this set value.
# Brightness of a window is estimated by averaging all pixels in the window,
# so this could comes with a performance hit.
# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
#
# max-brightness = 1.0
# Make transparent windows clip other windows like non-transparent windows do,
# instead of blending on top of them.
#
# transparent-clipping = false
# Specify a list of conditions of windows that should never have transparent
# clipping applied. Useful for screenshot tools, where you need to be able to
# see through transparent parts of the window.
#
# transparent-clipping-exclude = []
# Set the log level. Possible values are:
# "trace", "debug", "info", "warn", "error"
# in increasing level of importance. Case doesn't matter.
# If using the "TRACE" log level, it's better to log into a file
# using *--log-file*, since it can generate a huge stream of logs.
#
# log-level = "debug"
log-level = "warn";
# Set the log file.
# If *--log-file* is never specified, logs will be written to stderr.
# Otherwise, logs will to written to the given file, though some of the early
# logs might still be written to the stderr.
# When setting this option from the config file, it is recommended to use an absolute path.
#
# log-file = "/path/to/your/log/file"
# Show all X errors (for debugging)
# show-all-xerrors = false
# Write process ID to a file.
# write-pid-path = "/path/to/your/log/file"
# Window type settings
#
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
# "tooltip", "notification", "combo", and "dnd".
#
# Following per window-type options are available: ::
#
# fade, shadow:::
# Controls window-type-specific shadow and fade settings.
#
# opacity:::
# Controls default opacity of the window type.
#
# focus:::
# Controls whether the window of this type is to be always considered focused.
# (By default, all window types except "normal" and "dialog" has this on.)
#
# full-shadow:::
# Controls whether shadow is drawn under the parts of the window that you
# normally won't be able to see. Useful when the window has parts of it
# transparent, and you want shadows in those areas.
#
# clip-shadow-above:::
# Controls whether shadows that would have been drawn above the window should
# be clipped. Useful for dock windows that should have no shadow painted on top.
#
# redir-ignore:::
# Controls whether this type of windows should cause screen to become
# redirected again after been unredirected. If you have unredir-if-possible
# set, and doesn't want certain window to cause unnecessary screen redirection,
# you can set this to `true`.
#
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
dock = { shadow = false; clip-shadow-above = true; }
dnd = { shadow = false; }
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
};

View File

@ -1,28 +0,0 @@
# vim: ft=swayconfig
# Sway autostart
exec swayidle -w \
timeout 1800 'swaylock -f' \
timeout 1805 'swaymsg "output * power off"' \
resume 'swaymsg "output * power on"' \
before-sleep 'swaylock -f'
# Screen layout
exec_always ~/.screenlayout/default
output * bg "$(find ~/.wallpaper -type f | shuf -n 1)" fill
# Notifications
#systemctl --user enable --now dbus.service
exec mako --anchor top-right --default-timeout 4000 --icons 1 --actions 1 --output $primary
exec_always wayvnc -o $primary -S "$(mktemp --dry-run --tmpdir="${XDG_RUNTIME_DIR}" wayvnc.XXXXXXXXXX)" 127.0.0.1 5900
exec_always wayvnc -o $secondary -S "$(mktemp --dry-run --tmpdir="${XDG_RUNTIME_DIR}" wayvnc.XXXXXXXXXX)" 127.0.0.1 5901
exec --no-startup-id easyeffects --gapplication-service
exec --no-startup-id pomodoro daemon
exec $browser
exec $terminal
exec Telegram
exec firefox_media

View File

@ -1,19 +0,0 @@
# vim: ft=swayconfig
# Sway bar
bar {
mode dock
position bottom
status_command i3blocks
wrap_scroll no
bindsym button4 nop
bindsym button5 nop
hidden_state hide
output *
tray_output $primary
strip_workspace_name no
strip_workspace_numbers no
modifier $mod
}
exec ~/.config/i3blocks/scripts/layout_change_handler.sh

View File

@ -1,201 +0,0 @@
# vim: ft=swayconfig
# Sway bindings
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -RTMIN+1 i3blocks
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -RTMIN+1 i3blocks
bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+1 i3blocks
bindsym --locked XF86AudioPlay exec playerctl play-pause
bindsym --locked XF86AudioPause exec playerctl play-pause
bindsym --locked XF86AudioNext exec playerctl next
bindsym --locked XF86AudioPrev exec playerctl previous
bindsym --locked XF86Tools exec pavucontrol
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym --to-code $mod+p exec pomodoro toggle && pkill -RTMIN+2 i3blocks
bindsym $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
bindsym --release $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
bindsym $mod+Shift+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
bindsym --release XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
bindsym XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk, x1carb11
bindsym --release XF86Go exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute, x1carb11
bindsym $mod+XF86AudioMicMute exec --no-startup-id pactl list short sources | awk '/input.*RUNNING/ {system("pactl set-source-mute " $1 " toggle")}' ## Find and mute mics
bindsym --to-code $mod+s exec ~/.config/sway/scripts/swap-workspaces.sh
bindsym --to-code $mod+Shift+q kill
bindsym --to-code $mod+Shift+r reload
set $menu rofi -show drun -m -1
bindsym --to-code $mod+d exec $menu
bindsym $mod+o exec --no-startup-id slm_rofi
# Change focus
bindsym --to-code $mod+h focus left
bindsym --to-code $mod+j focus down
bindsym --to-code $mod+k focus up
bindsym --to-code $mod+l focus right
bindsym --to-code $mod+Left focus left
bindsym --to-code $mod+Down focus down
bindsym --to-code $mod+Up focus up
bindsym --to-code $mod+Right focus right
# Move focused window
bindsym --to-code $mod+Shift+h move left
bindsym --to-code $mod+Shift+j move down
bindsym --to-code $mod+Shift+k move up
bindsym --to-code $mod+Shift+l move right
bindsym --to-code $mod+Shift+Left move left
bindsym --to-code $mod+Shift+Down move down
bindsym --to-code $mod+Shift+Up move up
bindsym --to-code $mod+Shift+Right move right
bindsym --to-code $mod+Ctrl+Shift+l move workspace to output right
bindsym --to-code $mod+Ctrl+Shift+h move workspace to output left
bindsym --to-code $mod+Ctrl+Shift+k move workspace to output up
bindsym --to-code $mod+Ctrl+Shift+j move workspace to output down
bindsym --to-code $mod+f fullscreen toggle
bindsym --to-code $mod+t layout tabbed
bindsym --to-code $mod+v layout toggle split
bindsym --to-code $mod+a focus parent
bindsym --to-code $mod+Shift+slash floating toggle
bindsym --to-code $mod+Shift+comma sticky toggle
# Change focus between tiling / floating windows
bindsym --to-code $mod+slash focus mode_toggle
bindsym --to-code Print exec --no-startup-id screenshot select copy
bindsym --to-code $mod+Print exec --no-startup-id screenshot window copy
bindsym --to-code Ctrl+Print exec --no-startup-id screenshot entire copy
bindsym --to-code Shift+Print exec --no-startup-id screenshot select save
bindsym --to-code Shift+$mod+Print exec --no-startup-id screenshot window save
bindsym --to-code Shift+Ctrl+Print exec --no-startup-id screenshot entire save
bindsym --to-code $mod+q workspace hide1; workspace hide2
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
bindsym --to-code $mod+b bar mode toggle
set $exitmode "Power: [e]xit, [r]eboot, [s]hutdown, s[u]spend, [l]ock, [b]lack, [R]UEFI"
mode $exitmode {
bindsym --to-code e exit
bindsym --to-code r exec --no-startup-id reboot
bindsym --to-code s exec --no-startup-id shutdown -h now
bindsym --to-code u exec ~/.config/sway/scripts/lock-telegram.sh && systemctl suspend; mode "default"
bindsym --to-code l exec ~/.config/sway/scripts/lock-telegram.sh && swaylock -f; mode "default"
bindsym --to-code b exec magick canvas:none PNG:- | feh --class black -YFx -; mode "default"
bindsym --to-code Shift+r exec --no-startup-id systemctl reboot --firmware-setup
bindsym Escape mode "default"
bindsym Return mode "default"
}
bindsym --to-code $mod+x mode $exitmode
# switch to workspace
bindsym --to-code $mod+1 workspace number $ws1
bindsym --to-code $mod+2 workspace number $ws2
bindsym --to-code $mod+3 workspace number $ws3
bindsym --to-code $mod+4 workspace number $ws4
bindsym --to-code $mod+5 workspace number $ws5
bindsym --to-code $mod+6 workspace number $ws6
bindsym --to-code $mod+7 workspace number $ws7
bindsym --to-code $mod+8 workspace number $ws8
bindsym --to-code $mod+9 workspace number $ws9
bindsym --to-code $mod+0 workspace number $ws10
# move focused container to workspace
bindsym --to-code $mod+Shift+1 move container to workspace number $ws1
bindsym --to-code $mod+Shift+2 move container to workspace number $ws2
bindsym --to-code $mod+Shift+3 move container to workspace number $ws3
bindsym --to-code $mod+Shift+4 move container to workspace number $ws4
bindsym --to-code $mod+Shift+5 move container to workspace number $ws5
bindsym --to-code $mod+Shift+6 move container to workspace number $ws6
bindsym --to-code $mod+Shift+7 move container to workspace number $ws7
bindsym --to-code $mod+Shift+8 move container to workspace number $ws8
bindsym --to-code $mod+Shift+9 move container to workspace number $ws9
bindsym --to-code $mod+Shift+0 move container to workspace number $ws10
bindsym --to-code $mod+u workspace prev
bindsym --to-code $mod+Shift+u workspace next
# workspace_auto_back_and_forth no
bindsym --to-code $mod+Tab workspace back_and_forth
# resize window (you can also use the mouse for that)
set $resizemode "Resize: toggle [p]recize"
mode $resizemode {
bindsym --to-code h resize shrink width 10 px or 10 ppt
bindsym --to-code j resize grow height 10 px or 10 ppt
bindsym --to-code k resize shrink height 10 px or 10 ppt
bindsym --to-code l resize grow width 10 px or 10 ppt
bindsym --to-code $mod+r mode "default"
bindsym --to-code p mode $presizemode
bindsym --to-code Return mode "default"
bindsym --to-code Escape mode "default"
}
set $presizemode "Precise resize: toggle [p]resize"
mode $presizemode {
bindsym --to-code h resize shrink width 1 px or 1 ppt
bindsym --to-code j resize grow height 1 px or 1 ppt
bindsym --to-code k resize shrink height 1 px or 1 ppt
bindsym --to-code l resize grow width 1 px or 1 ppt
bindsym --to-code $mod+r mode "default"
bindsym --to-code p mode $resizemode
bindsym --to-code Return mode "default"
bindsym --to-code Escape mode "default"
}
bindsym --to-code $mod+r mode $resizemode
input type:keyboard {
xkb_layout us,ru
xkb_options grp:win_space_toggle,caps:ctrl_modifier
xkb_model "pc101"
repeat_delay 250
repeat_rate 100
}
input type:pointer {
natural_scroll disabled
}
input type:touchpad {
tap enabled
tap_button_map lrm
dwt enabled
scroll_method two_finger
natural_scroll enabled
drag enabled
drag_lock disabled
pointer_accel 0.4
}
bindgesture swipe:3:right workspace next
bindgesture swipe:3:left workspace prev
bindgesture swipe:3:up exec $menu
bindgesture swipe:3:down workspace hide1; workspace hide2

View File

@ -1,34 +0,0 @@
# Sway config sourcer
exec swaylock -f
set $mod Mod4
set $ws1 "1 Browser"
set $ws2 "2  Code"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8💬Social"
set $ws9 "9🎵Music"
set $ws10 "10🍿Media"
set $terminal ~/.config/sway/scripts/auto-alacritty.sh
set $browser firefox
# Example variables.d:
#set $primary DVI-I-1
#set $secondary VGA-1
#set $terminal alacritty
#set $browser firefox
include ~/.config/sway/variables.d/*.conf
include ~/.config/sway/other.conf
include ~/.config/sway/bindings.conf
include ~/.config/sway/bar.conf
include ~/.config/sway/autostart.conf
include /etc/sway/config.d/*.conf
include ~/.config/sway/config.d/*.conf

View File

@ -1,55 +0,0 @@
# vim: ft=swayconfig
# Other sway config
# Hide cursor
seat seat0 hide_cursor when-typing enable
seat seat0 hide_cursor 5000
set $font_size 11
font xft:FiraCode $font_size
floating_modifier $mod
focus_follows_mouse no
mouse_warping none
popup_during_fullscreen smart
smart_borders on
focus_on_window_activation urgent
default_border pixel 1
default_floating_border normal
hide_edge_borders smart
for_window [tiling] border pixel 3
for_window [title="Picture-in-Picture"] sticky enable
for_window [title="Picture-in-Picture"] border pixel 0
for_window [app_id="firefox"] inhibit_idle fullscreen
for_window [app_id="pavucontrol"] {
floating enable
resize set width 60 ppt height 80 ppt
move position center
}
for_window [class="black"] fullscreen enable
no_focus [title="^Peek preview$"]
no_focus [class="black"]
assign [app_id="firefox_media"] workspace $ws10
assign [app_id="Alacritty"] workspace $ws2
assign [app_id="org.telegram.desktop"] workspace $ws8
assign [app_id="firefox"] workspace $ws1
workspace $ws1 output $primary
workspace $ws2 output $primary
workspace $ws3 output $primary
workspace $ws9 output $secondary
workspace $ws10 output $secondary
workspace hide1 output $primary
workspace hide2 output $secondary
exec_always test -f ~/.Xresources && xrdb -merge ~/.Xresources

View File

@ -1,6 +0,0 @@
#!/bin/sh
while true; do
alacritty
sleep 1
done

View File

@ -1,25 +0,0 @@
#!/bin/bash
TELEGRAM_WINDOW="$(
swaymsg -t get_tree | \
jq -r '.. | select(.app_id? == "org.telegram.desktop") | .id' | \
head -n 1
)"
readonly TELEGRAM_WINDOW
if [ -z "${TELEGRAM_WINDOW}" ]; then
echo "Error: Telegram not found"
exit 0
fi
swaymsg "[con_id=${TELEGRAM_WINDOW}] focus"
sleep 0.2
wtype -M ctrl l
swaymsg workspace back_and_forth
exit 0

View File

@ -1,26 +0,0 @@
#!/bin/bash
set -eu
current_monitor=$(swaymsg -r -t get_workspaces | jq '.[] | select(.focused).output' | tr -d '"')
other_monitor=$(swaymsg -r -t get_outputs | jq -r ".[] | select(.active and .name != \"${current_monitor}\").name" | head -n 1)
if [ -z "${other_monitor}" ]; then
echo "No other active monitor found."
exit 1
fi
current_workspace=$(swaymsg -r -t get_workspaces | jq '.[] | select(.focused).name' | tr -d '"')
other_workspace=$(swaymsg -r -t get_workspaces | jq -r ".[] | select(.visible and .output == \"${other_monitor}\").name" | head -n 1)
if [ -n "${other_workspace}" ]; then
# Swap workspaces
swaymsg "workspace ${other_workspace}; move workspace to output ${current_monitor}"
swaymsg "workspace ${current_workspace}; move workspace to output ${other_monitor}"
swaymsg "workspace ${other_workspace}"
else
# Just move current workspace if target is empty
swaymsg "move workspace to output ${other_monitor}"
fi

View File

@ -1,3 +0,0 @@
color=000000
ignore-empty-password
show-failed-attempts

View File

@ -1,18 +0,0 @@
[Unit]
Description=MPV Audio Player Service
Documentation=man:mpv(1)
After=sound.target graphical-session.target
Wants=sound.target
[Service]
Type=simple
ExecStart=%h/.local/bin/mpv-service.sh
Restart=on-failure
RestartSec=5
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=%t/bus
Environment=XDG_RUNTIME_DIR=%t
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=default.target

View File

@ -8,10 +8,7 @@ After=default.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/ssh -o ControlMaster=no -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -vCTN -D 127.0.0.1:1080 %i ExecStart=/usr/bin/ssh -o ControlMaster=no -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -vCTN -D 127.0.0.1:1080 %i
Restart=always Restart=on-failure
RestartSec=3
StartLimitInterval=0
StartLimitBurst=0
[Install] [Install]
WantedBy=default.target WantedBy=default.target

View File

@ -8,8 +8,7 @@ Type=simple
ExecStart=/usr/bin/tmux -D -L %u ExecStart=/usr/bin/tmux -D -L %u
ExecStop=/usr/bin/tmux -L %u kill-server ExecStop=/usr/bin/tmux -L %u kill-server
ExecReload=/usr/bin/tmux -L %u source-file %h/.config/tmux/tmux.conf ExecReload=/usr/bin/tmux -L %u source-file %h/.config/tmux/tmux.conf
Restart=on-failure Restart=always
ExecStartPost=/usr/bin/tmux -L %u new-session -d -s landing 'sh -c "tmux rename-window -t 1 landing; tmux set-option remain-on-exit on; figlet -w 200 -c -f big Landing; trap : INT; while true; do sleep 3600; done"'
[Install] [Install]
WantedBy=default.target WantedBy=default.target

View File

@ -3,7 +3,6 @@
set -g prefix C-b set -g prefix C-b
bind C-b send-prefix bind C-b send-prefix
bind C-и send-prefix
# Toggle local tmux mappings to allow control remote tmux # Toggle local tmux mappings to allow control remote tmux
@ -62,21 +61,14 @@ bind n new-session -c ~
# Switch new named session # Switch new named session
bind N command-prompt -p "New session:" "new-session -A -s '%1' -c ~" bind N command-prompt -p "New session:" "new-session -A -s '%1' -c ~"
bind x if -F "#{?#{==:#{client_session},landing},0,1}" \
"confirm-before -p \"kill current session? (y/n)\" kill-session" \
"display-message 'Cannot kill session: landing'"
bind X if -F "#{?#{==:#{client_last_session},landing},0,1}" \ bind x confirm-before -p "kill current session? (y/n)" "kill-session"
"confirm-before -p \"kill last session [#{client_last_session}]? (y/n)\" \"kill-session -t #{client_last_session} \\; display-message 'Killed last session'\"" \ bind X confirm-before -p "kill last session [#{client_last_session}]? (y/n)" "kill-session -t #{client_last_session} \; display-message \"Killed last session\""
"display-message 'Cannot kill session: landing'" bind C-x confirm-before -p "kill other sessions? (y/n)" "kill-session -a"
bind q if -F "#{?#{==:#{client_session},landing},0,1}" \ bind q confirm-before -p "kill current pane? (y/n)" "kill-pane"
"confirm-before -p \"kill current pane? (y/n)\" kill-pane" \ bind Q kill-window
"display-message 'Cannot kill session: landing'" bind C-q confirm-before -p "kill other windows? (y/n)" "kill-window -a"
bind Q if -F "#{?#{==:#{window_name},landing},0,1}" \
"confirm-before -p \"kill current window? (y/n)\" kill-window" \
"display-message 'Cannot kill session: landing'"
bind d detach bind d detach
bind D choose-client -Z bind D choose-client -Z
@ -187,26 +179,24 @@ bind -n M-Tab swap-pane -t '{left-of}'
setw -g mode-keys vi setw -g mode-keys vi
bind v copy-mode bind v copy-mode
bind C-p choose-buffer bind C-p choose-buffer
bind -T copy-mode-vi C-v { bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
send-keys -X rectangle-toggle
if -F '#{selection_active}' '' 'send-keys -X begin-selection'
}
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "copy"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard"
bind -T copy-mode-vi Y send-keys -X copy-selection-and-cancel
bind MouseDrag1Pane copy-mode bind MouseDrag1Pane copy-mode
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "copy" bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard"
bind -r p run-shell "pasta | tmux load-buffer - && tmux paste-buffer -p" bind -r p run-shell "xclip -selection clipboard -o | tmux load-buffer -; tmux paste-buffer -p"
bind -r з run-shell "pasta | tmux load-buffer - && tmux paste-buffer -p"
bind -r P paste-buffer -p bind -r P paste-buffer -p
## Toggle selection ## Toggle selection
bind -T copy-mode-vi v if -F '#{selection_active}' 'send-keys -X clear-selection' 'send-keys -X begin-selection' bind -T copy-mode-vi v if -F '#{selection_active}' 'send-keys -X clear-selection' 'send-keys -X begin-selection'
bind -T copy-mode-vi Escape if -F '#{selection_active}' 'send-keys -X clear-selection' 'send-keys -X cancel'
bind -T copy-mode-vi Escape send-keys -X cancel
bind -T copy-mode-vi C-c send-keys -X cancel bind -T copy-mode-vi C-c send-keys -X cancel
bind -T copy-mode-vi q send-keys -X cancel bind -T copy-mode-vi q send-keys -X cancel
@ -214,12 +204,9 @@ bind -T copy-mode-vi q send-keys -X cancel
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down
## Search all files in buffer
bind-key f copy-mode \; send-keys -X search-backward \
'(^|/|\<|[[:space:]"])((\.|\.\.)|[[:alnum:]~_"-]*)((/[][[:alnum:]_.#$%&+=@"-]+)+([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)|(/[][[:alnum:]_.#$%&+=@"-]+){2,}([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)?|(\.|\.\.)/([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?))'
# Session managment # Session managment
bind a display-popup -EE -w 80% -h 80% -B '~/.config/tmux/scripts/attach_session.sh' bind a display-popup -EE -w 80% -h 80% -B '~/.local/bin/tmux_attach_session.sh'
bind s display-popup -EE -w 80% -h 80% -B '~/.config/tmux/scripts/start_session.sh' bind s display-popup -EE -w 80% -h 80% -B '~/.local/bin/tmux_start_session.sh'
bind S display-popup -EE -w 40% -h 80% -B '~/.config/tmux/scripts/start_projects.sh' bind S display-popup -EE -w 40% -h 80% -B '~/.local/bin/tmux_start_projects.sh'
bind k display-popup -EE -w 80% -h 80% -B '~/.local/bin/tmux_kill_sessions.sh'

View File

@ -36,4 +36,12 @@ set -g terminal-overrides[101] "xterm-256color:Tc"
set-hook -g after-new-session[101] 'rename-window -t 1 1' set-hook -g after-new-session[101] 'rename-window -t 1 1'
set -g update-environment "PATH DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM LANG LC_ALL COLORTERM EDITOR VISUAL SWAYSOCK WAYLAND_DISPLAY" set -g update-environment[101] 'DISPLAY'
set -g update-environment[102] 'WINDOWID'
set -g update-environment[103] 'XAUTHORITY'
set -g update-environment[104] 'SSH_CLIENT'
set -g update-environment[105] 'SSH_ASKPASS'
set -g update-environment[106] 'SSH_AUTH_SOCK'
set -g update-environment[107] 'SSH_AGENT_PID'
set -g update-environment[108] 'SSH_CONNECTION'
set -g update-environment[109] 'SSH_TTY'

View File

@ -1,7 +0,0 @@
#!/bin/sh
if [ "${1}" = "landing" ]; then
exit 0
fi
tmux kill-session -t "${1}"

View File

@ -1,10 +1,10 @@
# vim: ft=tmux # vim: ft=tmux
_tmux_color_inactive_background="terminal" # "colour236" _tmux_color_inactive_background="colour236"
_tmux_color_inactive_foreground="colour247" _tmux_color_inactive_foreground="colour247"
_tmux_color_main_background="terminal" _tmux_color_main_background="terminal"
_tmux_color_border="colour12" _tmux_color_border="colour24"
_tmux_color_menu="colour24" _tmux_color_menu="colour24"
_tmux_color_activity_style="colour239" _tmux_color_activity_style="colour239"

View File

@ -1,42 +0,0 @@
{
"layer": "bottom",
"position": "bottom",
"modules-left": [
"sway/workspaces",
"sway/mode",
],
"modules-center": [],
"modules-right": [
"sway/language",
"clock",
"tray"
],
"sway/workspaces": {
"disable-scroll": true
},
"clock": {
"format": " {:%F %a  %H:%M}",
"format-alt": " {:%A, %B %d, %Y (%R)}",
"tooltip-format": "<tt><small>{calendar}</small></tt>",
"calendar": {
"mode" : "year",
"mode-mon-col" : 3,
"weeks-pos" : "right",
"on-scroll" : 1,
"format": {
"months": "<span color='#ffead3'><b>{}</b></span>",
"days": "<span color='#ecc6d9'><b>{}</b></span>",
"weeks": "<span color='#99ffdd'><b>W{}</b></span>",
"weekdays": "<span color='#ffcc66'><b>{}</b></span>",
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
}
},
"actions": {
"on-click-right": "mode",
"on-scroll-up": "tz_up",
"on-scroll-down": "tz_down",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down"
}
},
}

View File

@ -1,11 +1,9 @@
if [[ "${TTY}" =~ /dev/tty* ]]; then if [[ "$TTY" =~ /dev/tty* ]]; then
setterm -blength=0 setterm -blength=0
setfont cyr-sun16 setfont cyr-sun16
fi fi
if [ "${TTY}" = "/dev/tty1" ] && [ -z "${WAYLAND_DISPLAY}" ] && [ -z "${DISPLAY}" ]; then if [[ "$TTY" = "/dev/tty1" ]] && [[ $XDG_VTNR -eq 1 ]] && [[ -z $DISPLAY ]] && systemctl -q is-active graphical.target; then
wayland_dir="${XDG_STATE_HOME:-${HOME}/.local/state}/wayland" exec startx >> ~/.xlogs 2>&1
mkdir -p "${wayland_dir}"
exec sway >> "${wayland_dir}/sway.log" 2>&1
fi fi

View File

@ -7,9 +7,6 @@ if \
[ -z "${TMUX}" ] && \ [ -z "${TMUX}" ] && \
tmux -N -L "${USER}" list-sessions &>/dev/null tmux -N -L "${USER}" list-sessions &>/dev/null
then then
if [ -n "${SSH_CLIENT}" ]; then
exec tmux -N -L "${USER}" new-session
fi
exec tmux -N -L "${USER}" new-session -A exec tmux -N -L "${USER}" new-session -A
fi fi

View File

@ -2,27 +2,9 @@ export ZCALC_HISTFILE="${HOME}/.zcalc_history"
autoload -U zcalc autoload -U zcalc
function __format_number() {
local num="${1}"
local res
num="$(echo "${num}" | sed 's/\.$//')"
res="${num}"
if [[ "${num}" =~ ^[-]?[0-9]+$ ]]; then
res="$(LC_NUMERIC='en_US.UTF-8' printf "%'.20f\n" "${num}" | sed "s/,/_/g")"
fi
echo "${res}" | sed 's/\.\([0-9]*[1-9]\)0*$/.\1/; s/\.0*$//'
}
function __calc { function __calc {
local result zcalc -f -e "$*"
result="$(ZDOTDIR="${HOME}" zcalc -f -e "$*" 2>/dev/null)"
__format_number "${result}"
} }
aliases[calc]='noglob __calc' aliases[calc]='noglob __calc'
aliases[=]='noglob __calc' aliases[=]='noglob __calc'
@ -31,7 +13,7 @@ function accept-line() {
if [[ ${BUFFER} =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then if [[ ${BUFFER} =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then
echo echo
test "${BUFFER[1]}" != " " && print -S -- "${BUFFER}" # saving the command to history test "${BUFFER[1]}" != " " && print -S -- "${BUFFER}" # saving the command to history
__calc "${BUFFER}" __calc "${BUFFER}" | sed 's/\.$//'
BUFFER= BUFFER=
fi fi

View File

@ -76,11 +76,12 @@ alias vi='nvim'
alias svi="sudo --preserve-env nvim" alias svi="sudo --preserve-env nvim"
# git # git
for al in s d di co col cob ds u ps pst pl pr hs last lastd df amend br fuck sw swl swc swb for al in s d di co col cob ds a u ps pl pr hs last lastd df amend br fuck
do do
alias "g${al}"="git ${al}" alias "g${al}"="git ${al}"
done done
alias gcim="noglob git cim"
# net # net
alias ports='ss -tlnp' alias ports='ss -tlnp'
@ -88,7 +89,8 @@ alias wget='wget -c'
alias ip='ip -c' alias ip='ip -c'
alias fastping='ping -c 100 -i 0.1' alias fastping='ping -c 100 -i 0.1'
alias www='serveit' # starts web server
alias www='python3 -m http.server 8080'
# hardware # hardware
alias reboot='sudo /sbin/reboot' alias reboot='sudo /sbin/reboot'
@ -99,6 +101,12 @@ alias shutdown='sudo /sbin/shutdown now'
alias meminfo='free -mlth' alias meminfo='free -mlth'
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
alias wake='((speaker-test -t sine -f 400 &>/dev/null)& local pid=$! ;sleep 0.2s; kill -9 $pid) &>/dev/null'
elif [[ "${OSTYPE}" == "linux-android"* ]]; then
alias wake='termux-notification --sound --vibrate 500,1000,200'
fi
# python # python
alias pipir='pip install -r requirements.txt' alias pipir='pip install -r requirements.txt'
alias pipar='pip list --not-required --format freeze | tee requirements.txt' alias pipar='pip list --not-required --format freeze | tee requirements.txt'
@ -112,8 +120,6 @@ alias drmc='docker container prune'
alias drmi='docker image prune' alias drmi='docker image prune'
alias dpsa='docker ps -a' alias dpsa='docker ps -a'
alias gb='gobuild'
# tmux # tmux
alias dt='tmux detach' alias dt='tmux detach'
@ -125,39 +131,38 @@ alias CAPS='xdotool key Caps_Lock'
alias colors='for i in {0..255}; do printf "\x1b[38;5;${i}mcolor${i} - ██████████\n"; done' alias colors='for i in {0..255}; do printf "\x1b[38;5;${i}mcolor${i} - ██████████\n"; done'
alias paste.thek4n.ru='curl --data-binary @- "https://paste.thek4n.ru/" 2>/dev/null' alias paste.thek4n.ru='curl --data-binary @- paste.thek4n.ru/ 2>/dev/null'
alias pastewww='paste.thek4n.ru' alias pastewww='paste.thek4n.ru'
alias copy='tee /dev/stderr | \copy' alias t='noglob t'
alias е='noglob t'
alias ta='t all'
alias еф='t all'
# clipboard
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
if [ -n "${DISPLAY}" ]; then
alias _copy='sed -z "$ s/\n$//" | xclip -selection clipboard -i'
alias paste='xclip -selection clipboard -o'
else
alias _copy='read -rd "EOF" TTYCLIPBOARD'
alias paste='echo "$TTYCLIPBOARD"'
fi
elif [[ "${OSTYPE}" == "linux-android"* ]]; then
alias _copy='termux-clipboard-set'
alias paste='termux-clipboard-get'
elif [[ "${OSTYPE}" == "darwin" ]]; then
alias _copy='pbcopy'
alias paste='pbpaste'
fi
alias copy='tee /dev/stderr | _copy'
alias ssh='TERM=xterm-256color ssh' alias ssh='TERM=xterm-256color ssh'
alias sshn='ssh -S none' alias sshn='ssh -S none'
alias black='magick canvas:none PNG:- | feh --class black -YFx -' alias black='magick canvas:none PNG:- | feh -YF -'
alias ex='extract'
# Notes
alias notes='note'
alias n='note'
alias ns='note sync'
alias ne='note edit'
alias nfe='note fe'
alias nfg='note fg'
alias ng='note git'
alias sn='mdpreview --browser --host localhost --port 0 "$(note --prefix)"'
# Cargo
alias cr='cargo run'
alias crr='cargo run --release'
alias cb='cargo build'
alias cbr='cargo build --release'
alias ct='cargo test'
alias cf='cargo fmt'
alias cl='cargo clippy --release'
alias p='player'
# :) # :)
alias PINK='beep -f 233 -l 440 -n -f 349 -l 440 -n -f 196 -l 440 -n -f 330 -l 650' alias PINK='beep -f 233 -l 440 -n -f 349 -l 440 -n -f 196 -l 440 -n -f 330 -l 650'
@ -195,11 +200,4 @@ alias -g RED='2> >(while read line; do printf "\033[0;31m${line}\033[0m\n"; done
alias -g BEEP='&& beep -f 800 -l 250 -n -f 1000 -l 500 || beep -f 800 -l 250 -n -f 500 -l 500' alias -g BEEP='&& beep -f 800 -l 250 -n -f 1000 -l 500 || beep -f 800 -l 250 -n -f 500 -l 500'
if [[ "${OSTYPE}" == "linux-android"* ]]; then
alias -g BEEP='&& termux-notification --sound --vibrate 500,1000,200'
fi
alias -g WAKE='BEEP; notify-send --urgency normal Wake'
alias -g PROXY='http_proxy="socks5://${SOCKS5_SERVER:-localhost}"' alias -g PROXY='http_proxy="socks5://${SOCKS5_SERVER:-localhost}"'

View File

@ -24,17 +24,10 @@ zstyle ':completion:*:*:extract:*' file-patterns '*.tar* *.lzma *.bz2 *.zip *.7z
zstyle ':completion:*' complete-options true zstyle ':completion:*' complete-options true
zstyle ':completion:*' squeeze-slashes true zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate _prefix _list
zstyle ':completion:*:match:*' original only zstyle ':completion:*:match:*' original only
zstyle ':completion:*:*:(eza|ls):*' file-sort modification
zstyle ':completion:*' completer _expand _complete _ignored _prefix _list
zstyle ':completion:*:correct:*' completer _correct
zstyle ':completion:*:approximate:*' completer _approximate
zstyle ':completion:*:correct:*' max-errors 1
zstyle ':completion:*:approximate:*' max-errors 1 numeric zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS' zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS' zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'
@ -52,7 +45,7 @@ bindkey -M menuselect '^k' vi-up-line-or-history
bindkey -M menuselect '^j' vi-down-line-or-history bindkey -M menuselect '^j' vi-down-line-or-history
bindkey -M menuselect '^l' vi-forward-char bindkey -M menuselect '^l' vi-forward-char
bindkey -M menuselect '^e' undo bindkey -M menuselect '^e' undo
bindkey -M menuselect '^[' accept bindkey -M menuselect '^[' undo
bindkey -M menuselect '^M' check-command bindkey -M menuselect '^M' check-command
bindkey -M menuselect '^I' accept-and-infer-next-history bindkey -M menuselect '^I' accept-and-infer-next-history
bindkey '^l' menu-select bindkey '^l' menu-select
@ -63,30 +56,3 @@ unsetopt menucomplete
compdef _directories mcd compdef _directories mcd
_gcim_completion() {
local -a commit_types
commit_types=(
'fix:Fix errors'
'feat:New features'
'chore:Routine chore'
'docs:Documentation changes'
'style:Code style'
'refactor:Refactoring'
'perf:Performance improvements'
'test:Add tests'
'revert:Revert changes'
'ci:CI/CD changes'
'build:Build system changes'
)
_describe 'commit message type in format CT1: "type(optional-scope): description"' commit_types -S ''
}
function _gcim() {
noglob git cim "${*}"
}
compdef _gcim_completion _gcim
alias gcim='noglob _gcim'

View File

@ -1,15 +1,11 @@
# vim: ft=zsh # vim: ft=zsh
mcd() { py() {
local dir if [[ -z "$@" && -x "$(command -v ipython 2>/dev/null)" ]]; then
if [ -z "${1}" ]; then ipython -i -c "q = exit"
dir="$(mktemp -ut "${USER:-user}.XXXX")"
else else
dir="${1}" python3 "$@"
fi fi
readonly dir
mkdir -p "${dir}" && cd "${dir}"
} }
ve() { ve() {
@ -24,7 +20,7 @@ va() {
return 0 return 0
fi fi
echo "va: error: virtual environment ${1} not found, use 'python3 -m venv ${1}'" >&2 echo "va: error: virtual environment ${1} not found, use 'python3 -m venv ${1}'" >&2
return 1$ return 1
fi fi
if [[ -f "./venv/bin/activate" ]]; then if [[ -f "./venv/bin/activate" ]]; then
@ -45,28 +41,142 @@ va() {
fi fi
} }
top-commands() { mcd() {
local -r num_args="${1:-1}" local dir
if ! [[ "${num_args}" =~ ^[1-9][0-9]*$ ]]; then if [ -z "${1}" ]; then
echo "error: usage: top-commands [N]" >&2 dir="$(mktemp -ut "${USER:-user}.XXXX")"
echo "error: N must be a positive non-zero integer." >&2 else
dir="${1}"
fi
mkdir -p "${dir}" && cd "${dir}"
}
open() {
if [ ! -e "${1}" ]; then
printf 'File %s not found' "${1}" >&2
exit 1
fi
nohup xdg-open "${1}" 1>/dev/null 2>&1 &
}
json() {
if [ -t 0 ]; then
python -m json.tool <<< "$*"
else # pipe
python -m json.tool
fi
}
showtips() {
local -r tips_dir="${HOME}/.tips"
if [ ! -d "${tips_dir}" ]; then
mkdir "${tips_dir}" 2>/dev/null
git init "${tips_dir}"
fi
set -o nullglob
local filename
for filename in "${tips_dir}"/*
do
cat "${filename}"
done
return 0
}
cleanup-directory() {
local -r directory="$(realpath "${1}")"
local -r age="+21" # Notation: +n => "At least n days"
if [ ! -d "${directory}" ]; then
echo "Directory '${directory}' not found" >&2
return 1 return 1
fi fi
fc -l -n 1 | awk 'NF' | awk -v n="$num_args" '{ if [ -n "${DRYRUN}" ]; then
end = (NF < n) ? NF : n echo "Deleting files not accessed for a ${age} days:"
for (i = 1; i <= end; i++) { find "${directory}" -atime "${age}"
printf "%s%s", $i, (i == end ? "\n" : OFS)
} echo "Deleting empty directories:"
}' | sort | uniq -c | sort -nr | sed 's/^[[:space:]]*//' find "${directory}" -type d -empty -print
else
echo "Deleting files not accessed for a ${age} days:"
find "${directory}" -atime "${age}" | xargs -r rm -fv
echo "Deleting empty directories:"
find "${directory}" -type d -empty -print | xargs -r rmdir
fi
} }
cargo-init() { cleanup-directory-log() {
if [[ ! -v 1 ]]; then local -r directory="$(realpath "${1}")"
if [ ! -d "${directory}" ]; then
echo "Directory '${directory}' not found" >&2
return 1 return 1
fi fi
cargo init "${1}" && cd "${1}" && \ local log_file="${directory}/cleanup.log"
return "${?}"
if [ -n "${DRYRUN}" ]; then
log_file="/dev/null"
fi
touch "${log_file}"
echo "$(date -Iseconds) : Start cleanup" >> "${log_file}"
cleanup-directory "${directory}" | tee -a "${log_file}"
}
cleanup-downloads() {
local -r downloads_directory="${XDG_DOWNLOAD_DIR}"
cleanup-directory-log "${downloads_directory}"
}
_bak() {
local -r filename="${1}"
mv "${filename}" "${filename}.bak"
}
_unbak() {
local -r filename="${1}"
local -r new_filename="${filename/%.bak/}"
if [[ -e "${new_filename}" ]]; then
echo "Filename '${new_filename}' already exists" >&2
return 1
fi
mv "${filename}" "${new_filename}"
}
bak() {
local filename
for filename in "$@"; do
if [[ "${filename: -4}" = ".bak" ]]; then
_unbak "${filename}"
else
_bak "${filename}"
fi
done
}
sha() {
if [ -v 2 ]; then
shasum -a 256 "${@}"
elif [ -v 1 ]; then
shasum -a 256 "${@}" | head -c 64
else
shasum -a 256 | head -c 64
fi
}
weather() {
local city="${1}"
curl "wttr.in/${city}" 2>/dev/null | head -n -1
}
gobuild() {
go build $@ -o ./bin/ ./...
} }

View File

@ -11,8 +11,6 @@ setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a dupl
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space. setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found. setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file. setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Убирать лишние пробелы из командных строк, добавляемых в историю.
setopt HIST_NO_STORE # Не хранить записи о командах history.
export HISTSIZE=100000 export HISTSIZE=100000

View File

@ -11,7 +11,7 @@ bindkey -M visual 'a' vi-add-next
# Yank to the system clipboard # Yank to the system clipboard
function vi-yank-xclip { function vi-yank-xclip {
zle vi-yank zle vi-yank
echo -n "$CUTBUFFER" | \copy echo -n "$CUTBUFFER" | copy # alias 'copy' from earlier loaded file
} }
zle -N vi-yank-xclip zle -N vi-yank-xclip
@ -89,37 +89,22 @@ zle -N cddotdot
bindkey "^O" cddotdot bindkey "^O" cddotdot
bindkey -M vicmd "^O" cddotdot bindkey -M vicmd "^O" cddotdot
fzfhistory() { fzfhistory() {
local cmd LBUFFER="$( \
cmd=$(fc -il 1 | \ history -n 0 | \
awk '{ fzf \
original = $0; --ignore-case \
clean = $0; --scheme=history \
sub(/^[ ]*[0-9]+[ ]+[0-9]{4}-[0-9]{2}-[0-9]{2}[ ]+[0-9]{2}:[0-9]{2}[ ]*/, "", clean); --tac \
print clean "\t" original --no-multi \
}' | \ --tiebreak=begin,index \
fzf \ --height="$(($LINES/4))" \
--ignore-case \ --query="$BUFFER" \
--scheme=history \ )"
--no-multi \
--tac \
--tiebreak=begin,index \
--height="$((${LINES}/4))" \
--query="${BUFFER}" \
--delimiter=$'\t' \
--with-nth=1 \
--preview="echo {2} | sed 's/\\\n/\\n/g' | highlight -O ansi -S zsh" \
--preview-window=wrap:30%:50% | \
cut -f1 | sed 's/\\n/\n/g')
if [[ -n "${cmd}" ]]; then
BUFFER="${cmd}"
CURSOR=$#BUFFER
fi
zle reset-prompt zle reset-prompt
} }
zle -N fzfhistory zle -N fzfhistory
bindkey "^R" fzfhistory bindkey "^R" fzfhistory
bindkey -M vicmd "^R" fzfhistory bindkey -M vicmd "^R" fzfhistory

View File

@ -21,7 +21,7 @@ tab_width = 4
[*.go] [*.go]
indent_style = tab indent_style = tab
[*.{tsx,css,html}] [*.{tsx,css}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
tab_width = 2 tab_width = 2

View File

@ -1,37 +0,0 @@
#!/bin/sh
set -eu
codes="10-0 - Офицер ранен
10-1 - Офицеру нужна помощь
10-4 - Принято
10-6 - Временно недоступен
10-7 - Закончил смену
10-8 - На смене
10-9 - Повторите ваше сообщение
10-10 - Потасовка
10-14 - Похищение
10-15 - Подозреваемый в наручниках
10-19 - Возвращаюсь на станцию
10-20 - Местоположение
10-24 - Брошенный автомобиль
10-27 - Информация о человеке
10-29 - Запрос проверки ордеров
10-30 - Подозреваемый в розыске
10-31 - Автомобиль в розыске
10-32 - Дополнительный юнит
10-41 - Нужна медицинская помощь
10-42 - Запрашиваю департамент общественной безопасности
10-50 - Авария/ДТП
10-53 - Человек ранен
10-66 - Подозрительный человек
10-67 - Человек зовет на помощь
10-71 - Открыт огонь
10-80 - Преследование
10-94 - Остановка человека/траффик стоп
10-97 - На ситуации/вызове"
if [ ${#} -eq 0 ]; then
echo "${codes}"
else
echo "${codes}" | grep -i --color=never "${@}"
fi

View File

@ -1,34 +0,0 @@
#!/bin/sh
set -eu
ends_with_bak() {
case "${1}" in
*.bak) return 0 ;;
*) return 1 ;;
esac
}
_bak() {
filename="${1}"
mv "${filename}" "${filename}.bak"
}
_unbak() {
filename="${1}"
new_filename="$(echo "${filename}" | sed 's/\.bak$//')"
if [ -e "${new_filename}" ]; then
echo "Filename '${new_filename}' already exists" >&2
return 1
fi
mv "${filename}" "${new_filename}"
}
for filename in "${@}"; do
if ends_with_bak "${filename}"; then
_unbak "${filename}"
else
_bak "${filename}"
fi
done

View File

@ -1,13 +0,0 @@
#!/bin/sh
set -eu
if test -t 1; then
exec 1>/dev/null
fi
if test -t 2; then
exec 2>/dev/null
fi
"${@}" &

View File

@ -1,26 +0,0 @@
#!/bin/sh
set -eu
directory="$(realpath "${1}")"
readonly directory
readonly age="+21" # Notation: +n => "At least n days"
if [ ! -d "${directory}" ]; then
echo "Directory '${directory}' not found" >&2
return 1
fi
if [ -n "${DRYRUN:-}" ]; then
echo "Deleting files not accessed for a ${age} days:"
find "${directory}" -mindepth 1 -atime "${age}" -not -type d -not -name cleanup.log
echo "Deleting empty directories:"
find "${directory}" -mindepth 1 -type d -empty
else
echo "Deleting files not accessed for a ${age} days:"
find "${directory}" -mindepth 1 -atime "${age}" -not -type d -not -name cleanup.log -print -delete
echo "Deleting empty directories:"
find "${directory}" -mindepth 1 -type d -empty -print -delete
fi

View File

@ -1,22 +0,0 @@
#!/bin/sh
set -eu
directory="$(realpath "${1}")"
readonly directory
if [ ! -d "${directory}" ]; then
echo "Directory '${directory}' not found" >&2
return 1
fi
readonly log_file="${directory}/cleanup.log"
if [ -n "${DRYRUN:-}" ]; then
log_file="/dev/null"
fi
touch "${log_file}"
echo "$(date -Iseconds) : Start cleanup" >> "${log_file}"
cleanup-directory "${directory}" | tee -a "${log_file}"

View File

@ -1,5 +0,0 @@
#!/bin/sh
set -eu
readonly downloads_directory="${XDG_DOWNLOAD_DIR}"
cleanup-directory-log "${downloads_directory}"

View File

@ -1,31 +0,0 @@
#!/bin/sh
set -eu
case "${OSTYPE:-}" in
"linux-gnu"*)
if [ -n "${WAYLAND_DISPLAY:-}" ]; then
wl-copy --trim-newline
exit 0
elif [ -n "${DISPLAY:-}" ]; then
xclip -selection clipboard -in
exit 0
else
sed -z '$ s/\n$//' > "${HOME}/.ttyclipboard"
exit 0
fi
;;
"linux-android"*)
termux-clipboard-set
exit 0
;;
"darwin")
pbcopy
exit 0
;;
*)
sed -z '$ s/\n$//' > "${HOME}/.ttyclipboard"
exit 0
;;
esac

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +0,0 @@
#!/bin/sh
set -eu
firefox --new-instance -P media --name firefox_media

View File

@ -1,31 +0,0 @@
#!/bin/sh
_fzf_base() {
fzf -0 -m --bind load:last --print0 "${@}" | sed -z 's/^[^ ]* //'
}
fzf_get_selected_modified() {
_fzf_base -1 --border-label=' Modified ' --preview 'git diff --color=always -- "$(echo {+} | sed "s/^[^ ]* //")"'
}
fzf_get_selected_untracked() {
_fzf_base --border-label=' Untracked ' --preview 'highlight -O xterm256 -- "$(echo {+} | sed "s/^[^ ]* //")"'
}
gitadd() {
xargs -0 git add
}
git_ls_files() {
git ls-files --exclude-standard -t "${@}"
}
modified_files="$(git_ls_files --modified)"
if [ -n "$modified_files" ]; then
printf "%s\n" "${modified_files}" | fzf_get_selected_modified | gitadd
fi
untracked_files="$(git_ls_files --others)"
if [ -n "$untracked_files" ]; then
printf "%s\n" "${untracked_files}" | fzf_get_selected_untracked | gitadd
fi

View File

@ -2,71 +2,6 @@
set -ue set -ue
LC_ALL=C len="${1:-20}"
DEFAULT_PASSWORD_LENGTH=20
simple() { LC_ALL=C tr -dc 'A-Za-z0-9@#%^&*()_+=-{}[]:;<>,.?/' < /dev/urandom | head -c "${len}"| xargs echo
PASSWORD_LENGTH="${1:-$DEFAULT_PASSWORD_LENGTH}"
tr -dc 'A-Za-z0-9@#%^&*()_+=-{}[]:;<>,.?/' < /dev/urandom | head -c "${PASSWORD_LENGTH}" | xargs echo
}
_shuf_line() {
fold -w1 | shuf | tr -d '\n'
}
_gen_random_by_charset() {
length="${1}"
charset="${2}"
tr -dc "${charset}" < /dev/random | head -c "${length}"
}
_gen_random_lower() {
length="${1}"
_gen_random_by_charset "${length}" '[:lower:]'
}
_gen_random_upper() {
length="${1}"
_gen_random_by_charset "${length}" '[:upper:]'
}
_gen_random_digits() {
length="${1}"
_gen_random_by_charset "${length}" '[:digit:]'
}
_gen_random_special() {
length="${1}"
_gen_random_by_charset "${length}" '!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~'\'''
}
protected() {
readonly symbols_count_of_each_type=5
password=""
password="${password}$(_gen_random_lower "${symbols_count_of_each_type}")"
password="${password}$(_gen_random_upper "${symbols_count_of_each_type}")"
password="${password}$(_gen_random_digits "${symbols_count_of_each_type}")"
password="${password}$(_gen_random_special "${symbols_count_of_each_type}")"
echo "${password}" | _shuf_line
}
if [ -z "${1+x}" ]; then
simple "${DEFAULT_PASSWORD_LENGTH}"
exit 0
fi
main() {
if [ "${1}" = "-p" ]; then
protected
exit 0
fi
simple "${1}"
exit 0
}
main "${@}"

View File

@ -1,4 +0,0 @@
#!/bin/sh
set -eu
go build -v "${@}" -o ./bin/ ./...

View File

@ -1,21 +0,0 @@
#!/bin/sh
set -eu
ESC=$(printf '\033')
RESET="${ESC}[0m"
COLOR_ERROR="${ESC}[1;31m"
COLOR_WARN="${ESC}[1;33m"
COLOR_INFO="${ESC}[1;32m"
COLOR_DEBUG="${ESC}[1;36m"
COLOR_TRACE="${ESC}[1;37m"
sed -E \
-e "s/\bFATAL\b/${COLOR_ERROR}&${RESET}/" \
-e "s/\bERROR\b/${COLOR_ERROR}&${RESET}/" \
-e "s/\bWARN\b/${COLOR_WARN}&${RESET}/" \
-e "s/\bWARNING\b/${COLOR_WARN}&${RESET}/" \
-e "s/\bINFO\b/${COLOR_INFO}&${RESET}/" \
-e "s/\bDEBUG\b/${COLOR_DEBUG}&${RESET}/" \
-e "s/\bTRACE\b/${COLOR_TRACE}&${RESET}/"

View File

@ -1,69 +0,0 @@
#!/bin/sh
set -eu
statuses="100 Continue - Разрешение клиенту на продолжение отправки.
101 Switching Protocols - Переключение протоколов, исходя из указаний клиента.
102 Processing - Зпрос помещен в обработку.
200 OK - Успех и возврат запрошенных данных.
201 Created - Запрос успешен и создан новый ресурс. URI нового ресурса в Location.
202 Accepted - Запрос помещен в обработку.
203 Non-Authoritative Information - Возвращаемая информация из ненадежных источников.
204 No Content - Возврат без ответа в теле.
205 Reset Content - Успех и сброс пользовательских данных.
206 Partial Content - Возврат части сообщения.
207 Multi-Status - Успех и возврат результатов более чем одной независимой операции в теле сообщения.
208 Already Reported - Уже были отправлены результаты с ответом 207.
300 Multiple Choices - В теле возвращается перечисление альтернативных результатов дял перенаправления.
301 Moved Permanently - Окончательный перенос ресурса на другой URI.
302 Found - Временный перенос ресурса на другой URI.
303 See Other - Перенаправление только методом GET.
304 Not Modified - Ресурс не был изменен с конкретного момента.
305 Use Proxy - Запрос должен производиться через прокси-сервер.
307 Temporary Redirect - Временный перенос ресурса на другой URI без изменения метода и тела запроса.
308 Permanent Redirect - Постоянный перенос ресурса на другой URI без изменения метода и тела запроса.
400 Bad Request - Ошибка синтаксиса в запросе.
401 Unauthorized - Требуется аутентификация.
402 Payment Required - Требуется оплата.
403 Forbidden - Недостаточно прав.
404 Not Found - Не найден.
405 Method Not Allowed - Недопустимый метод для запрашиваемого URI.
406 Not Acceptable - URI не поддерживает формат запроса.
407 Proxy Authentication Required - Требуется авторизация на прокси сервере.
408 Request Timeout - Истекло время ожидания окончания передачи данных клиента серверу.
409 Conflict - Одновременно запросы на изменения ресурса от нескольких клиентов.
410 Gone - Запрашиваемый ресурс существовал ранее, но был удален.
411 Length Required - Треубется заголовок Content-Length.
412 Precondition Failed - Условия If-Match не выполнены.
413 Request Entity Too Large - Размер тела запроса слишком большой.
414 Request-URI Too Large - URI запроса слишком длинный.
415 Unsupported Media Type - Ресурс не может обработать указанный в запросе тип данных.
416 Request Range Not Satisfiable - Переданный диапазон в заголовке Range некорректен.
417 Expectation Failed - Значение Expect некорректное.
418 I'm a teapot - Шутка).
421 Misdirected Request - Произошло перенаправление на сервер, который не в состоянии вернуть ответ.
422 Unprocessable Entity - Логическая ошибка содержимого запроса.
423 Locked - Данный ресурс заблокирован.
424 Failed Dependency - Зависимость ресурса заблокирована.
425 Too Early - Запрос слишком рискованно обрабатывать повторно, например при использовании механизма Early Data (0-RTT) в TLS.
426 Upgrade Required - Сервер запрашивает обновление соеднинения до SSL, а клиент не поддерживает.
428 Precondition Required - Клиент обязан передать заголовок If-Match.
429 Too Many Requests - Клиент запрашивает ресурс слишком часто.
431 Request Header Fields Too Large - Длина заголовков слишком большая.
449 Retry with - Клиентом отправлено недостаточно информации.
500 Internal Server Error - Внутренняя ошибка сервера.
501 Not Implemented - Серверу неизвестен метод.
502 Bad Gateway - Ошибка прокси-сервера, который получил некорректное ответное сообщение.
503 Service Unavailable - Сервис временно недоступен.
504 Gateway Timeout - Ошибка посредника.
505 HTTP Version Not Supported - Неподдерживаемая версия протокола.
506 Variant Also Negotiates
507 Insufficient Storage - На сервере недостаточно места.
509 Bandwidth Limit Exceeded
510 Not Extended - Сервером неподдерживается расширение.
511 Network Authentication Required - Прокси-сервер сообщает, что необходимо пройти авторизацию."
if [ ${#} -eq 0 ]; then
echo "${statuses}"
else
echo "${statuses}" | grep -i --color=never "${@}"
fi

View File

@ -0,0 +1,13 @@
#!/bin/sh
gen_workspaces()
{
i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g'
}
choosed_workspace=$(gen_workspaces | rofi -dmenu -m -1 -i -p "Select workspace")
if [ -n "${choosed_workspace}" ]
then
i3-msg workspace "${choosed_workspace}"
fi

View File

@ -0,0 +1,50 @@
#!/bin/sh
# The idea is to define "holder" modules in i3status config and then replace them
# In order to make this example work you need to add
# order += "tztime holder__headphones"
# and
# tztime holder__headphones {
# format = "holder__headphones"
# }
[ -x "/usr/bin/jq" ] || exec i3status
update_holder() {
instance="${1}"
replacement="${2}"
echo "${3}" | jq --argjson arg_j "${replacement}" "(.[] | (select(.instance==\"${instance}\"))) |= \$arg_j"
}
get_device_battery_status() {
for uuid in $(timeout 1 bluetoothctl devices | cut -f2 -d' ' 2>/dev/null)
do
device_info="$(timeout 1 bluetoothctl info "${uuid}")"
if echo "${device_info}" | grep -q 'Connected: yes\|Battery Percentage'; then
echo "${device_info}" | grep 'Battery Percentage' | awk -F '[()]' '{ print "🎧🔋"$2"%" }'
break
fi
done
}
update_json_with_text() {
json="{ \"full_text\": \"${1}\", \"color\": \"#FFFFFF\"}"
update_holder "holder__headphones" "${json}" "${2}"
}
i3status | (
# read first 2 lines without formatting
read -r line
echo "${line}"
read -r line
echo "${line}"
while true
do
read -r line
json_array="$(echo "${line}" | sed -e 's/^,//')"
echo "$(update_json_with_text "$(get_device_battery_status)" "${json_array}"),"
done
)

View File

@ -1,8 +0,0 @@
#!/bin/sh
set -eu
if [ -t 0 ]; then
echo "${@}" | python3 -m json.tool --no-ensure-ascii
else
python3 -m json.tool --no-ensure-ascii
fi

View File

@ -1,20 +0,0 @@
#!/bin/sh
set -eu
if [ ! ${#} -eq 1 ]; then
echo 'mksh takes one argument' 1>&2
exit 1
elif [ -e "${1}" ]; then
echo "${1} already exists" 1>&2
exit 1
fi
echo '#!/bin/sh
set -eu
' > "${1}"
chmod u+x "${1}"
"${EDITOR}" "${1}"

View File

@ -1,15 +0,0 @@
#!/bin/sh
set -eu
SOCKET_PATH="/tmp/mpv-${USER}.sock"
rm -f "${SOCKET_PATH}"
cleanup() {
echo "Stopping MPV service..."
rm -f "${SOCKET_PATH}"
pkill -P $$ mpv || true
}
trap cleanup EXIT TERM INT
exec mpv --really-quiet --idle --no-video --input-ipc-server="${SOCKET_PATH}" --ytdl-format=worstaudio

View File

@ -13,13 +13,9 @@ execute_and_format_result() {
printf "%s\t%s\n" "${ip}" "${cmd}" printf "%s\t%s\n" "${ip}" "${cmd}"
} }
if [ "${1}" = '--short' ]; then
curl ip.thek4n.ru
exit "${?}"
fi
{ {
execute_and_format_result curl ipinfo.io/ip execute_and_format_result curl ipinfo.io/ip
execute_and_format_result curl https://ip.thek4n.ru/ execute_and_format_result curl ip.thek4n.ru
execute_and_format_result dig +short myip.opendns.com @resolver1.opendns.com execute_and_format_result dig +short myip.opendns.com @resolver1.opendns.com
} | column -t -s "${TAB}" } | column -t -s "${TAB}"

View File

@ -1,83 +0,0 @@
#!/usr/bin/env ruby
# tags: фонетический алфавит
DICTIONARY = {
"a" => "Alfa",
"b" => "Bravo",
"c" => "Charlie",
"d" => "Delta",
"e" => "Echo",
"f" => "Foxtrot",
"g" => "Golf",
"h" => "Hotel",
"i" => "India",
"j" => "Juliett",
"k" => "Kilo",
"l" => "Lima",
"m" => "Mike",
"n" => "November",
"o" => "Oscar",
"p" => "Papa",
"q" => "Quebec",
"r" => "Romeo",
"s" => "Sierra",
"t" => "Tango",
"u" => "Uniform",
"v" => "Victor",
"w" => "Whiskey",
"x" => "X-ray",
"y" => "Yankee",
"z" => "Zulu",
"1" => "One",
"2" => "Two",
"3" => "Three",
"4" => "Four",
"5" => "Five",
"6" => "Six",
"7" => "Seven",
"8" => "Eight",
"9" => "Niner",
"0" => "Zero",
"а" => "Анна",
"б" => "Борис",
"в" => "Василий",
"г" => "Галина",
"д" => "Дмитрий",
"е" => "Елена",
"ё" => "Елена",
"ж" => "Женя",
"з" => "Зинаида",
"и" => "Иван",
"й" => "Иван",
"к" => "Константин",
"л" => "Леонид",
"м" => "Михаил",
"н" => "Николай",
"о" => "Ольга",
"п" => "Павел",
"р" => "Роман",
"с" => "Сергей",
"т" => "Тамара",
"у" => "Ульяна",
"ф" => "Федор",
"х" => "Харитон",
"ц" => "Цапля",
"ч" => "Человек",
"ш" => "Шура",
"щ" => "Щука",
"ъ" => "Твердый знак",
"ы" => "Игрек",
"ь" => "Мягкий знак",
"э" => "Эдуард",
"ю" => "Юрий",
"я" => "Яков"
}
ARGV.join(' ').split(' ').each do |word|
letters = word.downcase.each_char.map do |char|
DICTIONARY.fetch char, char
end
puts letters.join(' ')
end

View File

@ -1,10 +0,0 @@
#!/bin/sh
set -eu
if [ ! -e "${1}" ]; then
printf 'File %s not found' "${1}" >&2
exit 1
fi
setsid --fork xdg-open "${1}" < /dev/null > /dev/null 2>&1

View File

@ -1,31 +0,0 @@
#!/bin/sh
set -eu
case "${OSTYPE:-}" in
"linux-gnu"*)
if [ -n "${WAYLAND_DISPLAY:-}" ]; then
wl-paste --no-newline
exit 0
elif [ -n "${DISPLAY:-}" ]; then
xclip -selection clipboard -out
exit 0
else
cat "${HOME}/.ttyclipboard"
exit 0
fi
;;
"linux-android"*)
termux-clipboard-get
exit 0
;;
"darwin")
pbpaste
exit 0
;;
*)
cat "${HOME}/.ttyclipboard"
exit 0
;;
esac

View File

@ -1,18 +0,0 @@
#!/bin/sh
set -eu
trap 'exit 0' INT
last_value="$(pasta)"
while true
do
value="$(pasta)"
if [ "${last_value}" != "${value}" ]; then
echo "${value}"
last_value="${value}"
fi
sleep 0.1
done

View File

@ -1,133 +0,0 @@
#!/bin/sh
set -eu
PROG="$(basename "${0}")"
SOCKET_PATH="/tmp/mpv-${USER}.sock"
die() {
echo "Error: $*" >&2
exit 1
}
usage() {
cat <<EOF
Usage: ${PROG} <command> [args]
Commands:
radio <CHANNEL> Switch to a radio station
local, music [PATH] Switch to local music playlist (default: ~/Music)
next, n Next track
prev, p Previous track
pause, stop, toggle, s Toggle pause
help Show this message
Radio Channels:
lofi, fallout, wasteland, retrofm, rusradio, rock, phonk, dorognoe
EOF
}
get_radio_url() {
channel="${1:-}"
case "${channel}" in
lofi) echo 'https://radiorecord.hostingradio.ru/lofi96.aacp' ;;
fallout) echo 'http://fallout.fm:8000/falloutfm1.ogg' ;;
wasteland) echo 'http://wasteland.su:8080/radio' ;;
retrofm) echo 'http://hls-01-retro.emgsound.ru/12/128/playlist.m3u8' ;;
rusradio) echo 'https://rusradio.hostingradio.ru/rusradio128.mp3' ;;
rock) echo 'https://radiorecord.hostingradio.ru/rock96.aacp' ;;
phonk) echo 'https://radiorecord.hostingradio.ru/phonk96.aacp' ;;
dorognoe) echo 'https://dorognoe.hostingradio.ru:8000/dorognoe' ;;
*) die "Unknown radio channel '${channel}'. Available: lofi/fallout/wasteland/retrofm/rusradio/rock/phonk/dorognoe" ;;
esac
}
send_cmd() {
if [ ! -S "${SOCKET_PATH}" ]; then
die "MPV socket not found at '${SOCKET_PATH}'. Is mpv running?"
fi
printf '{ "command": %s }\n' "${1}" | socat - "${SOCKET_PATH}" >/dev/null
}
tune_radio() {
channel="${1:-}"
if [ -z "${channel}" ]; then
die "Radio channel required. Usage: ${PROG} radio <channel>"
fi
url="$(get_radio_url "${channel}")"
send_cmd "[\"loadfile\", \"${url}\", \"replace\"]"
echo "📻 Switched to radio: ${channel}"
}
play_local_playlist() {
playlist_path="${1:-${HOME}/Music}"
if [ ! -e "${playlist_path}" ]; then
die "Path not found: ${playlist_path}"
fi
if command -v realpath >/dev/null 2>&1; then
playlist_path="$(realpath "${playlist_path}")"
fi
escaped_path=$(printf '%s' "${playlist_path}" | sed 's/\\/\\\\/g; s/"/\\"/g')
send_cmd '["set", "pause", "yes"]'
sleep 0.1
send_cmd "[\"loadfile\", \"${escaped_path}\", \"replace\"]"
sleep 0.1
send_cmd '["set", "pause", "yes"]'
sleep 0.1
send_cmd '["playlist-shuffle"]'
sleep 0.1
send_cmd '["playlist-next"]'
sleep 0.1
send_cmd '["set", "pause", "no"]'
echo "🎵 Switched to local playlist: ${playlist_path}"
}
handle_control() {
action="${1}"
case "${action}" in
next|n)
send_cmd '["playlist-next"]'
echo "➡️ Next"
;;
prev|p)
send_cmd '["playlist-prev"]'
echo "⬅️ Prev"
;;
pause|stop|toggle|t|s)
send_cmd '["cycle", "pause"]'
echo "⏯️ Pause toggled"
;;
*)
usage
exit 1
;;
esac
}
ACTION="${1:-}"
shift 2>/dev/null || true
case "${ACTION}" in
radio|tune)
tune_radio "$@"
;;
local|music|m)
play_local_playlist "$@"
;;
next|n|prev|p|pause|stop|toggle|t|s)
handle_control "${ACTION}"
;;
help|"")
usage
;;
*)
echo "Unknown command: ${ACTION}" >&2
usage
exit 1
;;
esac

View File

@ -0,0 +1,9 @@
#!/bin/sh
eval "$(echo "i3-msg exit
reboot
shutdown -h now
systemctl suspend
i3lock -enf -c 1e1e1e
convert canvas:none PNG:- | feh -YF -" | rofi -dmenu -m -1 -i -p "Power")"

View File

@ -1,9 +0,0 @@
#!/bin/sh
set -eu
if [ -z "${*}" ] && [ -x "$(command -v ipython 2>/dev/null)" ]; then
ipython -i -c "q = exit"
else
python3 "${@}"
fi

View File

@ -1,29 +0,0 @@
#!/bin/sh
set -eu
channel="${1:-}"
if [ "${channel}" = lofi ]; then
url='https://radiorecord.hostingradio.ru/lofi96.aacp'
elif [ "${channel}" = fallout ]; then
url='http://fallout.fm:8000/falloutfm1.ogg'
elif [ "${channel}" = wasteland ]; then
url='http://wasteland.su:8080/radio'
elif [ "${channel}" = retrofm ]; then
url='http://hls-01-retro.emgsound.ru/12/128/playlist.m3u8'
elif [ "${channel}" = rusradio ]; then
url='https://rusradio.hostingradio.ru/rusradio128.mp3'
elif [ "${channel}" = rock ]; then
url='https://radiorecord.hostingradio.ru/rock96.aacp'
elif [ "${channel}" = phonk ]; then
url='https://radiorecord.hostingradio.ru/phonk96.aacp'
elif [ "${channel}" = dorognoe ]; then
url='https://dorognoe.hostingradio.ru:8000/dorognoe'
else
echo "don't know \"${channel}\": lofi/fallout/wasteland/retrofm/rusradio/rock/phonk/dorognoe" 1>&2
exit 1
fi
exec mpv --really-quiet "${url}"
# https://gist.github.com/ergoz/e7837a54956116167db93b016dbd51a9

View File

@ -1,4 +0,0 @@
#!/bin/sh
set -eu
gio trash "${@}"

View File

@ -1,7 +0,0 @@
#!/bin/sh
set -eu
file="$(mktemp)"
echo "Editing ${file}"
exec "${EDITOR}" "${file}"

View File

@ -1,170 +0,0 @@
#!/usr/bin/env zsh
set -euo pipefail
readonly LOG_FILE="${HOME}/.screenshots.log"
readonly NOTIFY_TIME_LOW_MS=1500
readonly NOTIFY_TIME_NORMAL_MS=3000
readonly NOTIFY_TIME_CRITICAL_MS=5000
readonly CODE_CANCELED=22
readonly NOTIFY_LABEL="Screenshot"
readonly SCREENSHOTS_DIR="${SCREENSHOTS_DIR:-${HOME}/Pictures/screenshots}"
readonly TIMESTAMP_FORMAT="%H-%M-%S_%Y-%m-%d"
readonly NOOPENGL="${NOOPENGL:-}"
readonly NONOTIFY="${NONOTIFY:-}"
mkdir -p "${SCREENSHOTS_DIR}"
_notify() {
local -r level="${1}"
local -r notify_time_ms="${2}"
local -r msg="${3}"
if [ -n "${NONOTIFY}" ]; then
return 0
fi
notify-send --urgency "${level}" \
--expire-time "${notify_time_ms}" \
"${NOTIFY_LABEL}" \
"${msg}"
}
_notify_low() {
_notify low "${NOTIFY_TIME_LOW_MS}" "${1}"
}
_notify_normal() {
_notify normal "${NOTIFY_TIME_NORMAL_MS}" "${1}"
}
_notify_error() {
_notify critical "${NOTIFY_TIME_CRITICAL_MS}" "Error: ${1}"
}
_capture_select() {
local -r pipe="$(mktemp)"
grim -g "$(slurp 2>"${pipe}")" -
local -r code="$?"
if grep -F "selection cancelled" <"${pipe}"; then
rm "${pipe}"
return "${CODE_CANCELED}"
fi
cat "${pipe}" 1>&2
rm "${pipe}"
return "${code}"
}
_capture_entire() {
grim -
}
_capture_window() {
grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.type? == "con" and .focused == true) | .rect | "\(.x),\(.y) \(.width)x\(.height)"')" -
}
_copy_to_clipboard() {
wl-copy -t image/png
}
_save_to_file() {
cat > "${1}"
}
_process_screenshot() {
local -r capture_func="${1}"
local -r output_func="${2}"
local -r success_msg="${3}"
local -r error_msg="${4}"
local -r output_arg="${5:-}"
if ! ${capture_func} | ${output_func} "${output_arg}"; then
if (( ${pipestatus[1]} == "${CODE_CANCELED}" )); then
_notify_low "Selection was cancelled by keystroke."
return 0
fi
_notify_error "${error_msg}"
return 1
fi
_notify_normal "${success_msg}"
return 0
}
_select_save() {
local -r filename="${SCREENSHOTS_DIR}/selection_$(date +"${TIMESTAMP_FORMAT}").png"
_process_screenshot _capture_select \
_save_to_file \
"Selection saved to ${filename}" \
"Failed to save selection screenshot" \
"${filename}"
}
_select_copy() {
_process_screenshot _capture_select \
_copy_to_clipboard \
"Selection copied to clipboard" \
"Failed to copy selection to clipboard"
}
_window_save() {
local -r filename="${SCREENSHOTS_DIR}/window_$(date +"${TIMESTAMP_FORMAT}").png"
_process_screenshot _capture_window \
_save_to_file \
"Current window saved to ${filename}" \
"Failed to save Current window screenshot" \
"${filename}"
}
_window_copy() {
_process_screenshot _capture_window \
_copy_to_clipboard \
"Current window copied to clipboard" \
"Failed to copy current window to clipboard"
}
_entire_save() {
local -r filename="${SCREENSHOTS_DIR}/screen_$(date +"${TIMESTAMP_FORMAT}").png"
_process_screenshot _capture_entire \
_save_to_file \
"Entire screen saved to ${filename}" \
"Failed to save entire screen" \
"${filename}"
}
_entire_copy() {
_process_screenshot _capture_entire \
_copy_to_clipboard \
"Entire screen copied to clipboard" \
"Failed to copy entire screen to clipboard"
}
main() {
if [ $# -ne 2 ]; then
echo "Usage: ${0} {select|window|entire} {save|copy}"
exit 1
fi
local -r target="${1}"
local -r action="${2}"
case "${target}-${action}" in
select-save) _select_save &>> "${LOG_FILE}" ;;
select-copy) _select_copy &>> "${LOG_FILE}" ;;
window-save) _window_save &>> "${LOG_FILE}" ;;
window-copy) _window_copy &>> "${LOG_FILE}" ;;
entire-save) _entire_save &>> "${LOG_FILE}" ;;
entire-copy) _entire_copy &>> "${LOG_FILE}" ;;
*)
echo "Invalid options: target=${target}, action=${action}"
echo "Available targets: select, window, entire"
echo "Available actions: save, copy"
exit 1
;;
esac
}
main "$@"

View File

@ -1,41 +0,0 @@
#!/bin/sh
set -eu
PROGRAM="$(basename "${0}")"
has_h=0
for arg in "${@}"; do
case "${arg}" in
-h)
has_h=1
break
;;
--help)
has_h=1
break
;;
esac
done
if [ "${has_h}" -eq 1 ]; then
TAB=$(printf '\t')
printf 'Usage: %s\tListen on localhost:8080\nUsage: %s PORT\tListen on localhost:PORT\nUsage: %s HOST PORT\tListen on HOST:PORT\n' "${PROGRAM}" "${PROGRAM}" "${PROGRAM}" | column -t -s "${TAB}"
exit 0
fi
HOST="localhost"
PORT="8080"
if [ ${#} -gt 1 ]; then
HOST="${1:-localhost}"
PORT="${2:-8080}"
else
HOST="localhost"
PORT="${1:-8080}"
fi
readonly HOST
readonly PORT
python3 -m http.server -b "${HOST}" "${PORT}"

View File

@ -1,11 +0,0 @@
#!/bin/sh
set -eu
if [ -n "${2+x}" ]; then
shasum -a 256 "${@}"
elif [ -n "${1+x}" ]; then
shasum -a 256 "${@}" | head -c 64
else
shasum -a 256 | head -c 64
fi

View File

@ -1,12 +0,0 @@
#!/bin/sh
set -eu
readonly tips_dir="${HOME}/.tips"
if [ ! -d "${tips_dir}" ]; then
mkdir "${tips_dir}" 2>/dev/null
git init "${tips_dir}"
fi
find "${tips_dir}" -mindepth 1 -maxdepth 1 -type f -exec cat {} \;

View File

@ -11,7 +11,12 @@ if [ ! -d "${LAYOUTS_DIR}" ]; then
fi fi
cmd_list() { cmd_list() {
find "${LAYOUTS_DIR}" -type f,l -exec basename {} \; find "$LAYOUTS_DIR" -type f,l -exec basename {} \;
}
cmd_wallpaper() {
readonly wallpapers="${HOME}/.wallpaper"
feh --no-fehbg --bg-scale "$(find "${wallpapers}" | shuf -n 1)"
} }
cmd_load() { cmd_load() {
@ -20,16 +25,18 @@ cmd_load() {
else else
"${LAYOUTS_DIR}/${1}" "${LAYOUTS_DIR}/${1}"
fi fi
cmd_wallpaper
} }
cmd_help () { cmd_help () {
echo "slm (ls|load)" >&2 echo "slm (ls|load|wallpaper)" >&2
} }
case "${1}" in case "${1}" in
ls) shift; cmd_list "$@" ;; ls) shift; cmd_list "$@" ;;
load) shift; cmd_load "$@" ;; load) shift; cmd_load "$@" ;;
wallpaper) shift; cmd_wallpaper "$@" ;;
*) shift; cmd_help "$@" ;; *) shift; cmd_help "$@" ;;
esac esac
exit 0 exit 0

View File

@ -1,6 +0,0 @@
#!/bin/sh
set -eu
sleep "${@}"
notify-send -- 'Timer complete' "${*}"

View File

@ -1,8 +1,7 @@
#!/bin/sh #!/bin/sh
readonly tmux_list_sessions_script="${HOME}/.config/tmux/scripts/list_sessions.sh" readonly tmux_list_sessions_script="${HOME}/.local/bin/tmux_list_sessions.sh"
readonly tmux_kill_session_script="${HOME}/.config/tmux/scripts/kill_session.sh"
export FZF_DEFAULT_OPTS="\ export FZF_DEFAULT_OPTS="\
${FZF_DEFAULT_OPTS} ${FZF_DEFAULT_OPTS}
@ -15,7 +14,7 @@ ${FZF_DEFAULT_OPTS}
--preview-window=follow --preview-window=follow
--preview='tmux capture-pane -p -e -t {1}' --preview='tmux capture-pane -p -e -t {1}'
--bind --bind
ctrl-x:execute\(${tmux_kill_session_script}\ {1}\)+reload\(${tmux_list_sessions_script}\),\ ctrl-x:execute\(tmux\ kill-session\ -t\ {1}\)+reload\(${tmux_list_sessions_script}\),\
load:reload\(${tmux_list_sessions_script}\;sleep\ 1\)\ load:reload\(${tmux_list_sessions_script}\;sleep\ 1\)\
" "

View File

@ -0,0 +1,24 @@
#!/bin/sh
readonly tmux_list_sessions_script="${HOME}/.local/bin/tmux_list_sessions.sh"
export FZF_DEFAULT_OPTS="\
${FZF_DEFAULT_OPTS}
--multi
--border=rounded
--border-label-pos=bottom
--border-label=' Kill sessions '
--color='border:red,label:red'
--preview-window=follow
--preview='tmux capture-pane -p -e -t {1}'
--bind
ctrl-x:execute\(tmux\ kill-session\ -t\ {1}\)+reload\(${tmux_list_sessions_script}\)\
"
sessions_to_kill="$(~/.local/bin/tmux_list_sessions.sh | fzf | awk '{printf $1"\n"}')"
readonly sessions_to_kill
if [ -n "${sessions_to_kill}" ]; then
echo "${sessions_to_kill}" | xargs -n 1 tmux kill-session -t
fi

Some files were not shown because too many files have changed in this diff Show More