1
0
Fork 0

sync iluminator

This commit is contained in:
Vladimír Dudr 2022-07-08 14:46:20 +02:00
parent 00149ec272
commit e0a2aa986f
3 changed files with 142 additions and 142 deletions

View file

@ -56,7 +56,7 @@ hc --idle | {
#count-mails; #count-mails;
#charge=$(battery | awk '{print $2}') #charge=$(battery | awk '{print $2}')
while true ; do while true ; do
res=
### prepare by monitor tags displaying ### prepare by monitor tags displaying
for monitor in "${monitors[@]}" ; do for monitor in "${monitors[@]}" ; do
output_tags[$monitor]="%{A4:herbstclient use_index +1 --skip-visible:}%{A5:herbstclient use_index -1 --skip-visible:}" output_tags[$monitor]="%{A4:herbstclient use_index +1 --skip-visible:}%{A5:herbstclient use_index -1 --skip-visible:}"
@ -100,19 +100,19 @@ hc --idle | {
### All drawing happens here ### All drawing happens here
# echo -n "%{T5}" # set font # echo -n "%{T5}" # set font
date="$(printf ' %%{F#efefef}%(%H:%M%)T{F#909090}, %(%Y-%m)T-%%{F#efefef}%(%d)T')" res=
for m in "${!monitors[@]}" ; do for m in "${!monitors[@]}" ; do
monitor=${monitors[$m]} monitor=${monitors[$m]}
### set monitor ### set monitor
res="$res%{S$m}" res+="%{S$m}"
#echo -en "%{S$((${#monitors[@]} - monitor))}" #echo -en "%{S$((${#monitors[@]} - monitor))}"
### print the left ### print the left
res="$res%{l}${output_tags[$monitor]}$separator ${windowtitle:0:150}" res+="%{l}${output_tags[$monitor]}$separator ${windowtitle:0:150}"
### center ### center
#echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}" #echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}"
### print the right ### print the right
res="$res%{r}$playing $separator $volume $separator $load $separator $date " res+="%{r}$playing $separator $volume $separator $wifi $separator $network $separator $temperature $separator $load $separator $date $separator %{U#f2f229}$charge%{U-} $separator"
#echo -en "%{r}$right $separator %{U#f2f229}$charge%{U-} $separator" #echo -en "%{r}$right $separator %{U#f2f229}$charge%{U-} $separator"
done done
@ -127,145 +127,144 @@ hc --idle | {
# "Special" events (quit_panel/togglehidepanel/reload) are also handled # "Special" events (quit_panel/togglehidepanel/reload) are also handled
# here. # here.
# wait for next event # wait for next event
IFS=$'\t' read -ra cmd || break IFS=$'\t' read -ra cmd || break
#for z in ${cmd[@]} #for z in ${cmd[@]}
#do #do
#echo -n "'$z' " >&2 #echo -n "'$z' " >&2
#done #done
#echo >&2 #echo >&2
# find out event origin # find out event origin
case "${cmd[0]}" in case "${cmd[0]}" in
tag*) tag*)
#echo "resetting tags" >&2 #echo "resetting tags" >&2
for monitor in "${monitors[@]}" ; do for monitor in "${monitors[@]}" ; do
tags[$monitor]="$(hc tag_status "$monitor")" tags[$monitor]="$(hc tag_status "$monitor")"
done done
;; ;;
date) date)
#echo "resetting date" >&2 #echo "resetting date" >&2
# date="${cmd[*]:1}" date="${cmd[*]:1}"
;; ;;
quit_panel) quit_panel)
exit exit
;; ;;
reload) reload)
exit exit
;; ;;
load) load)
load=" ${cmd[*]:1}" load=" ${cmd[*]:1}"
;; ;;
focus_changed|window_title_changed) focus_changed|window_title_changed)
windowtitle="${cmd[*]:2}" windowtitle="${cmd[*]:2}"
;; echo "$windowtitle" > /tmp/wt
player) ;;
# declare -A player_status player)
if [[ "${cmd[1]}" = cmus ]] # declare -A player_status
then if [[ "${cmd[1]}" = cmus ]]
play_line=" ${cmd[3]:0:20}/${cmd[4]:0:20}" then
[[ -n ${cmd[5]} ]] && play_line="$play_line: ${cmd[5]:0:20}" play_line=" ${cmd[3]:0:20}/${cmd[4]:0:20}: ${cmd[5]:0:20}"
play_sym=
play_sym= case "${cmd[2]}" in
case "${cmd[2]}" in off|Stopped)
off|Stopped) play_line=
play_line= ;;
;; Paused)
Paused) play_sym=
play_sym= ;;
;; *)
*) play_sym="%{T2}%{T-}"
play_sym="%{T2}%{T-}" ;;
;; esac
esac playing="$play_sym$play_line"
playing="$play_sym$play_line" fi
fi
# [[ "${player_status[${cmd[1]}]}" != "${cmd[2]}" ]] && # [[ "${player_status[${cmd[1]}]}" != "${cmd[2]}" ]] &&
# notify "Player: ${cmd[1]}" "${cmd[2]}" # notify "Player: ${cmd[1]}" "${cmd[2]}"
# player_status[${cmd[1]}]="${cmd[2]}" # player_status[${cmd[1]}]="${cmd[2]}"
;; ;;
ac) ac)
case ${cmd[1]} in case ${cmd[1]} in
charging) charging)
batt_sym="%{F#00aa00}$batt_sym%{F-}" batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+" ac="+"
notify "Power" "Battery charging" notify "Power" "Battery charging"
;; ;;
discharging) discharging)
ac="-" ac="-"
batt_sym="%{F#ffdb00}$batt_sym%{F-}" batt_sym="%{F#ffdb00}$batt_sym%{F-}"
notify "Power" "Battery discharging" notify "Power" "Battery discharging"
;; ;;
idle) idle)
ac="=" ac="="
notify "Power" "Fully charged" notify "Power" "Fully charged"
;; ;;
esac esac
;; ;;
battery) battery)
#echo "battery" >&2 #echo "battery" >&2
batt_perc="${cmd[1]}" batt_perc="${cmd[1]}"
{ [ "$batt_perc" -ge 95 ] && batt_sym= ; } || { [ "$batt_perc" -ge 95 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 75 ] && batt_sym= ; } || { [ "$batt_perc" -ge 75 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 50 ] && batt_sym= ; } || { [ "$batt_perc" -ge 50 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 25 ] && batt_sym= ; } || batt_sym= { [ "$batt_perc" -ge 25 ] && batt_sym= ; } || batt_sym=
case "$ac" in case "$ac" in
+) +)
batt_sym="%{F#00aa00}$batt_sym%{F-}" batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+" ac="+"
;; ;;
-) -)
batt_sym="%{F#ffdb00}$batt_sym%{F-}" batt_sym="%{F#ffdb00}$batt_sym%{F-}"
;; ;;
*) *)
;; ;;
esac esac
charge="$batt_sym ${batt_perc}%" charge="$batt_sym ${batt_perc}%%"
[ "$batt_perc" -le 15 ] && [ "$ac" != '+' ] && notify -u critical "Power" "Battery has only ${batt_perc}%" [ "$batt_perc" -le 15 ] && [ "$ac" != '+' ] && notify -u critical "Power" "Battery has only ${batt_perc}%"
;; ;;
temperature) temperature)
temperature=" ${cmd[1]}°C" temperature=" ${cmd[1]}°C"
;; ;;
wifi) wifi)
_wifi_net="${cmd[1]}" _wifi_net="${cmd[1]}"
if [[ -n "$_wifi_net" ]] if [[ -n "$_wifi_net" ]]
then then
_wifi_sym=直 _wifi_sym=直
else else
_wifi_sym=睊 _wifi_sym=睊
fi fi
wifi="$(xargs <<<"$_wifi_sym $_wifi_net")" wifi="$(xargs <<<"$_wifi_sym $_wifi_net")"
;; ;;
network) network)
_net_status="${cmd[1]}" _net_status="${cmd[1]}"
if [[ "$_net_status" == 'UP' ]] if [[ "$_net_status" == 'UP' ]]
then then
network="$(xargs <<<"ﯱ ${cmd[2]}")" network="$(xargs <<<"ﯱ ${cmd[2]}")"
else else
network= network=
fi fi
;; ;;
volume)
sleep 0.1
volume)
sleep 0.1
mute="$(pactl get-sink-mute "$(pactl get-default-sink)" | awk '{print $2}')" mute="$(pactl get-sink-mute "$(pactl get-default-sink)" | awk '{print $2}')"
if [[ "$mute" == yes ]] if [[ "$mute" == yes ]]
then then
volume="" volume=""
else else
volume=" ${cmd[1]}" volume=" ${cmd[1]}"
fi fi
;; ;;
esac esac
first_loop=0 first_loop=0
done done
} | lemonbar -f "Noto Sans Mono-10" -f "Symbols Nerd Font-10" -a30 -B "$col_bg" -F "$col_fg" -u 1 | sh } | lemonbar -f "Noto Sans Mono-10" -f "Symbols Nerd Font-10" -a30 -B "$col_bg" -F "$col_fg" -u 1 | sh
#} | lemonbar -f "DejaVu Sans-9" -f "Font Awesome-9" -f "Symbols Nerd Font-9" #} | lemonbar -f "DejaVu Sans-9" -f "Font Awesome-9" -f "Symbols Nerd Font-9"

View file

@ -139,7 +139,7 @@ vim.cmd([[
-- local saga = require('lspsaga').init_lsp_saga() -- local saga = require('lspsaga').init_lsp_saga()
local nvim_lsp = require('lspconfig') local nvim_lsp = require('lspconfig')
local on_attach = function(client, bufnr) local on_attach = function(_, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
@ -165,8 +165,8 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
buf_set_keymap("n", "<space>gf", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) buf_set_keymap('n', "<space>F", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
buf_set_keymap("v", "<space>gf", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) buf_set_keymap('v', "<space>gf", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end end
-- Use a loop to conveniently both setup defined servers -- Use a loop to conveniently both setup defined servers
@ -175,7 +175,8 @@ local servers = { 'phpactor', 'gopls', 'clangd', 'zls', 'hls', 'tsserver', 'sumn
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
root_dir = require('lspconfig.util').root_pattern('composer.json')
} }
end end

View file

@ -47,12 +47,12 @@ bar:
foreground: ebdbb2ff foreground: ebdbb2ff
spacing: 5 spacing: 5
# margin: 7 # margin: 7
monitor: HDMI-1 monitor: LVDS-1
font: Noto Sans Mono font: Noto Sans Mono
left: left:
- script: - script:
path: /home/vladimir/herbsttag path: /home/sogun/.config/herbstluftwm/herbsttag
args: [0] args: [0]
anchors: anchors:
- viewed: &viewed {foreground: *dark0, deco: {background: {color: *bright_blue}}} - viewed: &viewed {foreground: *dark0, deco: {background: {color: *bright_blue}}}
@ -145,7 +145,7 @@ bar:
- read min _ < /proc/loadavg ; echo -e "load|string|$min\n" - read min _ < /proc/loadavg ; echo -e "load|string|$min\n"
content: {string: {text: " {load}"}} content: {string: {text: " {load}"}}
- network: - network:
name: eth0 name: wlan0
content: content:
map: map:
tag: state tag: state
@ -155,13 +155,13 @@ bar:
- string: - string:
text: "" text: ""
font: "Font Awesome 5 Free:style=solid:size=12" font: "Font Awesome 5 Free:style=solid:size=12"
- string: {text: "{ipv4} "} - string: {text: "{ssid} "}
- clock: - clock:
date-format: "%d.%m." date-format: "%d.%m."
content: content:
- string: {text: , font: "Font Awesome 5 Free:style=solid:size=12"} - string: {text: , font: "Font Awesome 5 Free:style=solid:size=12"}
- string: {text: " {date}", right-margin: 5} - string: {text: " {date}", right-margin: 5}
- string: {text: , font: "Font Awesome 5 Free:style=solid:size=12"} - string: {text: "", font: "Font Awesome 5 Free:style=solid:size=12"}
- string: {text: " {time}"} - string: {text: " {time} "}