From e9305858a5166366c6a38547b062311dbf711e50 Mon Sep 17 00:00:00 2001 From: Nefrace Date: Tue, 1 Apr 2025 00:38:10 +0300 Subject: [PATCH] i3blocks, new nfrc script --- bash/.bashrc | 20 +-------- bin/daily | 11 +++++ gtk/.config/gtk-3.0/settings.ini | 15 +++++++ i3/.config/i3/config | 18 ++++++-- i3/.config/i3blocks/config | 30 +++++++++++++ i3/.config/i3status/config | 64 ++++++++++++++++++++++++++++ nfrc | 73 -------------------------------- nfrc.sh | 73 ++++++++++++++++++++++++++++++++ 8 files changed, 210 insertions(+), 94 deletions(-) create mode 100755 bin/daily create mode 100644 gtk/.config/gtk-3.0/settings.ini create mode 100644 i3/.config/i3blocks/config create mode 100644 i3/.config/i3status/config delete mode 100644 nfrc create mode 100644 nfrc.sh diff --git a/bash/.bashrc b/bash/.bashrc index 8d31225..65d16dc 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -122,22 +122,6 @@ export PATH=$PATH:$HOME/go/bin eval "$(zoxide init bash)" -question() { - 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.sh -source ~/.dotfiles/nfrc +export QT_QPA_PLATFORMTHEME=qt5ct diff --git a/bin/daily b/bin/daily new file mode 100755 index 0000000..8947e1b --- /dev/null +++ b/bin/daily @@ -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 diff --git a/gtk/.config/gtk-3.0/settings.ini b/gtk/.config/gtk-3.0/settings.ini new file mode 100644 index 0000000..3ea9c38 --- /dev/null +++ b/gtk/.config/gtk-3.0/settings.ini @@ -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 diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 730a2de..33f8ead 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -19,6 +19,9 @@ font pango:IosevkaTerm NF 14 # text rendering and scalability on retina/hidpi displays (thanks to pango). #font pango:DejaVu Sans Mono 8 +gaps inner 10 +gaps outer 10 + # Start XDG autostart .desktop files using dex. See also # https://wiki.archlinux.org/index.php/XDG_Autostart 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, # and nm-applet is a desktop environment-independent system tray GUI for it. exec --no-startup-id nm-applet +exec --no-startup-id nitrogen --restore +exec --no-startup-id picom # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status @@ -55,9 +60,9 @@ bindsym $mod+Return exec kitty bindsym $mod+Shift+q kill # 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: -# 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 # .desktop file. It is a wrapper around dmenu, so you need that installed. # bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop @@ -183,8 +188,15 @@ 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 # finds out, if available) bar { - status_command i3status + status_command i3blocks } diff --git a/i3/.config/i3blocks/config b/i3/.config/i3blocks/config new file mode 100644 index 0000000..609dd33 --- /dev/null +++ b/i3/.config/i3blocks/config @@ -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 diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config new file mode 100644 index 0000000..9097bae --- /dev/null +++ b/i3/.config/i3status/config @@ -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" +} diff --git a/nfrc b/nfrc deleted file mode 100644 index 3bf6886..0000000 --- a/nfrc +++ /dev/null @@ -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 - -} diff --git a/nfrc.sh b/nfrc.sh new file mode 100644 index 0000000..f80dd06 --- /dev/null +++ b/nfrc.sh @@ -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