diff --git a/.config/ncmpcpp/config b/.config/ncmpcpp/config index 8c39b9d..06e3833 100644 --- a/.config/ncmpcpp/config +++ b/.config/ncmpcpp/config @@ -215,7 +215,7 @@ media_library_albums_split_by_date = yes # #lines_scrolled = 2 # -lyrics_fetchers = lyricwiki, azlyrics, genius, sing365, lyricsmania, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, internet +lyrics_fetchers = azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet # #follow_now_playing_lyrics = no # diff --git a/.config/polybar/config b/.config/polybar/config index 21a8af5..33682d0 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -76,6 +76,12 @@ type = custom/script exec = /home/pavel/bin/polybar/ipstack.sh interval = 1200 +[module/weather] +type = custom/script +exec = /home/pavel/bin/polybar/weather.sh +format-underline = ${colors.red} +interval = 1200 + [module/ipstack-vpn] type = custom/script exec = /home/pavel/bin/polybar/ipstack-vpn.sh diff --git a/.emacs.d/emacs.org b/.emacs.d/emacs.org index 60b0d6a..a2cb0d0 100644 --- a/.emacs.d/emacs.org +++ b/.emacs.d/emacs.org @@ -944,6 +944,18 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." ;; Hightlight line (global-hl-line-mode 1) #+end_src +** Frame title +#+begin_src emacs-lisp +(setq frame-title-format + '("" + "emacs" + (:eval + (let ((project-name (projectile-project-name))) + (if (not (string= "-" project-name)) + (format ":%s@%s" project-name (system-name)) + (format "@%s" (system-name))))) + )) +#+end_src ** Tab bar #+begin_src emacs-lisp (general-define-key @@ -1271,10 +1283,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." #+end_src ** JavaScript #+begin_src emacs-lisp -(add-hook 'javascript-mode-hook #'smartparens-mode) -(my/set-smartparens-indent 'javascript-mode) +(add-hook 'js-mode-hook #'smartparens-mode) +(my/set-smartparens-indent 'js-mode) #+end_src - ** Vue.js #+begin_src emacs-lisp (use-package vue-mode @@ -1317,6 +1328,11 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (add-hook 'svelte-mode-hook 'set-flycheck-eslint) #+end_src +** SCSS +#+begin_src emacs-lisp +(add-hook 'scss-mode-hook #'smartparens-mode) +(my/set-smartparens-indent 'scss-mode) +#+end_src ** PHP #+begin_src emacs-lisp (use-package php-mode @@ -1375,11 +1391,15 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (add-hook 'LaTeX-mode-hook #'(lambda () - (lsp) + (unless (string-match "\.hogan\.tex$" (buffer-name)) + (lsp)) (setq-local lsp-diagnostic-package :none) (setq-local flycheck-checker 'tex-chktex))) (add-hook 'LaTeX-mode-hook #'rainbow-delimiters-mode) +(add-hook 'LaTeX-mode-hook #'smartparens-mode) + +(my/set-smartparens-indent 'LaTeX-mode) (general-nmap :keymaps '(LaTeX-mode-map latex-mode-map) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 220f94a..a5d5fe5 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -800,6 +800,16 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." ;; Hightlight line (global-hl-line-mode 1) +(setq frame-title-format + '("" + "emacs" + (:eval + (let ((project-name (projectile-project-name))) + (if (not (string= "-" project-name)) + (format ":%s@%s" project-name (system-name)) + (format "@%s" (system-name))))) + )) + (general-define-key :keymaps 'override :states '(normal emacs) @@ -1059,8 +1069,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." ;; (add-hook 'typescript-mode-hook ;; #'set-flycheck-eslint) -(add-hook 'javascript-mode-hook #'smartparens-mode) -(my/set-smartparens-indent 'javascript-mode) +(add-hook 'js-mode-hook #'smartparens-mode) +(my/set-smartparens-indent 'js-mode) (use-package vue-mode :straight t) @@ -1098,6 +1108,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (add-hook 'svelte-mode-hook 'set-flycheck-eslint) +(add-hook 'scss-mode-hook #'smartparens-mode) +(my/set-smartparens-indent 'scss-mode) + (use-package php-mode :straight t) @@ -1145,11 +1158,15 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (add-hook 'LaTeX-mode-hook #'(lambda () - (lsp) + (unless (string-match "\.hogan\.tex$" (buffer-name)) + (lsp)) (setq-local lsp-diagnostic-package :none) (setq-local flycheck-checker 'tex-chktex))) (add-hook 'LaTeX-mode-hook #'rainbow-delimiters-mode) +(add-hook 'LaTeX-mode-hook #'smartparens-mode) + +(my/set-smartparens-indent 'LaTeX-mode) (general-nmap :keymaps '(LaTeX-mode-map latex-mode-map) diff --git a/bin/emacs.sh b/bin/emacs.sh index c4314ef..0d1461b 100755 --- a/bin/emacs.sh +++ b/bin/emacs.sh @@ -8,5 +8,7 @@ if [ -d "$HOME/go" ] ; then export PATH="$HOME/go/bin:$PATH" fi +export PATH="/usr/local/texlive/2020/bin/x86_64-linux:$PATH" + [ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env emacs diff --git a/bin/polybar.sh b/bin/polybar.sh index 4f0459b..730012c 100755 --- a/bin/polybar.sh +++ b/bin/polybar.sh @@ -23,8 +23,8 @@ declare -A BAR_HEIGHT=( ["HDMI-A-0"]="29" ) declare -A BLOCKS=( - ["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP sun aw-afk date TSEP" - ["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP sun aw-afk date TSEP" + ["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP" + ["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP" ["eDP1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun aw-afk date TSEP" ) diff --git a/bin/polybar/aw_afk.sh b/bin/polybar/aw_afk.sh new file mode 100755 index 0000000..93cbd46 --- /dev/null +++ b/bin/polybar/aw_afk.sh @@ -0,0 +1,12 @@ +#!/bin/bash +afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_$(hostname)/events?limit=1" -H "accept: application/json") +status=$(echo ${afk_event} | jq -r '.[0].data.status') +afk_time=$(echo "${afk_event}" | jq -r '.[0].duration' | xargs -I ! date -u -d @! +"%H:%M") + +uptime=$(datediff "$(uptime -s | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M") +res="${afk_time} / ${uptime}" +if [[ $status == 'afk' ]]; then + echo "%{u#f07178}%{+u} [AFK] $res %{u-}" +else + echo "%{u#82aaff}%{+u} $res %{u-}" +fi diff --git a/bin/polybar/ipstack-vpn.sh b/bin/polybar/ipstack-vpn.sh new file mode 100755 index 0000000..7ae3101 --- /dev/null +++ b/bin/polybar/ipstack-vpn.sh @@ -0,0 +1,17 @@ +#!/bin/bash +ip=$(dig +short +timeout=1 myip.opendns.com @resolver1.opendns.com 2> /dev/null) +API_KEY="8948d12cd68a3b7ac60d405ed4118b43" +if [[ -z $ip || $ip == *"timed out"* ]]; then + echo "%{u#f07178}%{+u} ?? %{u-}" + exit +fi +ip_info=$(curl -s http://api.ipstack.com/${ip}?access_key=${API_KEY}) +# emoji=$(echo $ip_info | jq -r '.location.country_flag_emoji') +code=$(echo $ip_info | jq -r '.country_code') +vpn=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1) + +if [ -n "$vpn" ]; then + echo "%{u#9cc4ff}%{+u}  $code %{u-}" +else + echo "%{u#f07178}%{+u}  $code %{u-}" +fi diff --git a/bin/polybar/ipstack.sh b/bin/polybar/ipstack.sh new file mode 100755 index 0000000..a08eb18 --- /dev/null +++ b/bin/polybar/ipstack.sh @@ -0,0 +1,11 @@ +#!/bin/bash +ip=$(dig +short +timeout=1 myip.opendns.com @resolver1.opendns.com 2> /dev/null) +API_KEY="8948d12cd68a3b7ac60d405ed4118b43" +if [[ -z $ip || $ip == *"timed out"* ]]; then + echo "%{u#f07178}%{+u} ?? %{u-}" + exit +fi +ip_info=$(curl -s http://api.ipstack.com/${ip}?access_key=${API_KEY}) +# emoji=$(echo $ip_info | jq -r '.location.country_flag_emoji') +code=$(echo $ip_info | jq -r '.country_code') +echo "%{u#9cc4ff}%{+u} $code $ip %{u-}" diff --git a/bin/polybar/sun.sh b/bin/polybar/sun.sh new file mode 100755 index 0000000..8a086f0 --- /dev/null +++ b/bin/polybar/sun.sh @@ -0,0 +1,22 @@ +#1/bin/bash +LAT=59.9375N +LON=30.308611E + +time=$(sunwait poll daylight rise ${LAT} $LON) + +function send_report { + report="$(sunwait report ${LAT} ${LON} | sed 's/^[[:space:]]*//gm')" + notify-send "Sunwait report" "$report" +} + +case $BLOCK_BUTTON in + 1) send_report +esac + +if [[ ${time} == 'DAY' ]]; then + sunset=$(sunwait list daylight set ${LAT} ${LON}) + echo "%{u#ffcb6b}%{+u} $sunset %{u-}" +else + sunrise=$(sunwait list daylight rise ${LAT} ${LON}) + echo "%{u#f07178}%{+u} $sunrise %{u-}" +fi diff --git a/bin/polybar/tray-sep.sh b/bin/polybar/tray-sep.sh new file mode 100755 index 0000000..102386c --- /dev/null +++ b/bin/polybar/tray-sep.sh @@ -0,0 +1,4 @@ +#!/bin/bash +if [ ! -z "$TRAY" ] && [ "$TRAY" != "none" ]; then + echo "| " +fi diff --git a/bin/polybar/weather.sh b/bin/polybar/weather.sh new file mode 100755 index 0000000..ce97949 --- /dev/null +++ b/bin/polybar/weather.sh @@ -0,0 +1,14 @@ +#/bin/sh +bar_format="${BAR_FORMAT:-"%t"}" +location="${LOCATION:-"Saint-Petersburg"}" +format_1=${FORMAT_1:-"qF"} +format_2=${FORMAT_1:-"format=v2n"} + +bar_weather=$(curl -s wttr.in/${location}?format=${bar_format} || echo "??") +if [ -z ${bar_weather} ]; then + exit 1 +elif [[ ${bar_weather} == *"Unknown"* ]]; then + echo "??" + exit 1 +fi +echo ${bar_weather}