i3blocks, new nfrc script

This commit is contained in:
Nefrace 2025-04-01 00:38:10 +03:00
parent 616e8e4441
commit e9305858a5
8 changed files with 210 additions and 94 deletions

View File

@ -122,22 +122,6 @@ export PATH=$PATH:$HOME/go/bin
eval "$(zoxide init bash)" eval "$(zoxide init bash)"
question() { source ~/.dotfiles/nfrc.sh
if [[ "$2" == "1" ]]; then
read -r -p "$1 (y/N)" choice < /dev/tty
case "$choice" in
"y"|"Y"|"д"|"Д" ) exit 0 ;;
""|"n"|"N"|"н"|"Н" ) exit 1 ;;
* ) echo "Неопознанный ответ"; question "$1" $2 ;;
esac
else
read -r -p "$1 (Y/n)" choice < /dev/tty
case "$choice" in
""|"y"|"Y"|"д"|"Д" ) exit 0 ;;
"n"|"N"|"н"|"Н" ) exit 1 ;;
* ) echo "Неопознанный ответ"; question "$1" $2 ;;
esac
fi
}
source ~/.dotfiles/nfrc export QT_QPA_PLATFORMTHEME=qt5ct

11
bin/daily Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
year=$(date +%Y)
month=$(date +%m)
day=$(date +%d)
folder="$HOME/docs/daily/$year"
note="$folder/$month.$day.md"
mkdir -p $folder
[ ! -f "$note" ] && echo "# $year.$month.$day" > "$note"
nvim $note

View File

@ -0,0 +1,15 @@
[Settings]
gtk-theme-name=Arc-Dark
gtk-icon-theme-name=Papirus-Dark
gtk-font-name=IosevkaTerm Nerd Font Mono Medium 13
gtk-cursor-theme-name=Adwaita
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintmedium

View File

@ -19,6 +19,9 @@ font pango:IosevkaTerm NF 14
# text rendering and scalability on retina/hidpi displays (thanks to pango). # text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8 #font pango:DejaVu Sans Mono 8
gaps inner 10
gaps outer 10
# Start XDG autostart .desktop files using dex. See also # Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart # https://wiki.archlinux.org/index.php/XDG_Autostart
exec --no-startup-id dex --autostart --environment i3 exec --no-startup-id dex --autostart --environment i3
@ -33,6 +36,8 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux, # NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it. # and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet exec --no-startup-id nm-applet
exec --no-startup-id nitrogen --restore
exec --no-startup-id picom
# Use pactl to adjust volume in PulseAudio. # Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status set $refresh_i3status killall -SIGUSR1 i3status
@ -55,9 +60,9 @@ bindsym $mod+Return exec kitty
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# start dmenu (a program launcher) # start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id dmenu_run # bindsym $mod+d exec --no-startup-id dmenu_run
# A more modern dmenu replacement is rofi: # A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec "rofi -modi drun,run -show drun" bindsym $mod+d exec "rofi -modi drun,run -show drun"
# There also is i3-dmenu-desktop which only displays applications shipping a # There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed. # .desktop file. It is a wrapper around dmenu, so you need that installed.
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop # bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
@ -183,8 +188,15 @@ mode "resize" {
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
mode "launch" {
bindsym e exec nemo & i3-msg mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Shift+v mode "launch"
# Start i3bar to display a workspace bar (plus the system information i3status # Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available) # finds out, if available)
bar { bar {
status_command i3status status_command i3blocks
} }

View File

@ -0,0 +1,30 @@
# i3blocks configuration file
#
# The i3blocks man page describes the usage of the binary,
# and its website describes the configuration:
#
# https://vivien.github.io/i3blocks
# Global properties
separator=true
separator_block_width=15
[documentation]
full_text=Documentation
website=https://vivien.github.io/i3blocks
command=xdg-open "$website"
color=#f12711
[tailscale]
command=echo TS: $(ip a show tailscale0 | rg "inet (\d+\.\d+\.\d+\.\d+)" -or '$1')
interval=30
[greetings]
color=#f5af19
command=echo "Hello, $USER!"
interval=once
[time]
command=date '+%Y-%m-%d %H:%M:%S'
interval=1

View File

@ -0,0 +1,64 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
}
order += "wireless _first_"
order += "ethernet _first_"
order += "battery 0"
order += "battery 1"
order += "disk /"
order += "load"
order += "memory"
order += "tztime local"
wireless _first_ {
format_up = "W: (%quality at %essid) %ip"
format_down = "W: down"
}
ethernet _first_ {
format_up = "E: %ip (%speed)"
format_down = "E: down"
}
battery 0 {
format = "B0 %percentage"
hide_seconds = true
path = /sys/class/power_supply/BAT0/uevent
status_unk = BAT0
status_bat = BAT0
}
battery 1 {
format = "B1 %percentage"
hide_seconds = true
path = /sys/class/power_supply/BAT1/uevent
status_unk = BAT1
status_bat = BAT1
}
disk "/" {
format = "%avail"
}
load {
format = "CPU %1min"
}
memory {
format = "MEM %available"
threshold_degraded = "1G"
format_degraded = "MEMORY < %available"
}
tztime local {
format = "%Y-%m-%d %H:%M:%S"
}

73
nfrc
View File

@ -1,73 +0,0 @@
eval "$(fzf --bash)"
FMENU="fzf --header=$(basename "$0") \
--layout=reverse \
--exact \
--border=bold \
--border=rounded \
--margin=5% \
--multi \
--color=dark \
--height=95% \
--info=hidden \
--header-first \
--bind change:top \
--prompt"
_fzf_compgen_path() {
fd --hidden --follow --exclude ".git" --exclude ".cargo" --exclude ".cache" . "$1"
}
sshto() {
ssh $(cat ~/.ssh/config | grep "Host " | awk '{print $2}' | $FMENU "choose host ")
}
sshapt() {
user=$(echo $1 | cut -d@ -f1)
prefix=$(echo $1 | cut -d@ -f2)
[ -z "$user" ] && user="useraccount"
[ -z "$prefix" ] && {
apt=$(cat ~/bazis.csv | $FMENU "Выбирай аптеку: ")
[ -z "$apt" ] && return 1
prefix=$(echo $apt | cut -d, -f1)
}
echo "USER: '$user'"
echo "PREFIX: $prefix"
octet1=10
octet2=0
octet3=0
case "${#prefix}" in
1)
octet3=$prefix
;;
2)
octet3=$prefix
;;
3)
octet2=${prefix:0:2}
octet3=${prefix:2:2}
;;
4)
octet2=${prefix:0:3}
octet3=${prefix:3:3}
;;
esac
ips=""
for i in {100..130..10}; do
addr=$octet1.$octet2.$octet3.$i
printf "Trying $addr..."
nc -z -w 1 $addr 22
[ $? -eq 0 ] && {
[ -z "$ips" ] && ips=$addr || ips=$ips'\n'$addr
printf " yes!\n"
} || printf " no.\n"
done
addr=$(printf "$ips" | $FMENU "Выбери ПК: ")
[ -z "$addr" ] && return 1
ssh $user@$addr
}

73
nfrc.sh Normal file
View File

@ -0,0 +1,73 @@
eval "$(fzf --bash)"
FMENU="fzf --header=$(basename "$0") \
--layout=reverse \
--exact \
--border=bold \
--border=rounded \
--margin=5% \
--multi \
--color=dark \
--height=95% \
--info=hidden \
--header-first \
--bind change:top \
--prompt"
_fzf_compgen_path() {
fd --hidden --follow --exclude ".git" --exclude ".cargo" --exclude ".cache" . "$1"
}
sshto() {
ssh $(cat ~/.ssh/config | grep "Host " | awk '{print $2}' | $FMENU "choose host ")
}
sshapt() {
user=$(echo $1 | cut -d@ -f1)
prefix=$(echo $1 | cut -d@ -f2)
[ -z "$user" ] && user="useraccount"
[ -z "$prefix" ] && {
apt=$(cat ~/bazis.csv | $FMENU "Выбирай аптеку: ")
[ -z "$apt" ] && return 1
prefix=$(echo $apt | cut -d, -f1)
}
echo "USER: '$user'"
echo "PREFIX: $prefix"
octet1=10
octet2=0
octet3=0
case "${#prefix}" in
1)
octet3=$prefix
;;
2)
octet3=$prefix
;;
3)
octet2=${prefix:0:2}
octet3=${prefix:2:2}
;;
4)
octet2=${prefix:0:3}
octet3=${prefix:3:3}
;;
esac
ips=""
for i in {100..130..10}; do
addr=$octet1.$octet2.$octet3.$i
printf "Trying $addr..."
nc -z -w 1 $addr 22
[ $? -eq 0 ] && {
[ -z "$ips" ] && ips=$addr || ips=$ips'\n'$addr
printf " yes!\n"
} || printf " no.\n"
done
addr=$(printf "$ips" | $FMENU "Выбери ПК: ")
[ -z "$addr" ] && return 1
ssh $user@$addr
}
export PATH=$PATH:$HOME/.dotfiles/bin