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;
#charge=$(battery | awk '{print $2}')
while true ; do
res=
### prepare by monitor tags displaying
for monitor in "${monitors[@]}" ; do
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
# 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
monitor=${monitors[$m]}
### set monitor
res="$res%{S$m}"
res+="%{S$m}"
#echo -en "%{S$((${#monitors[@]} - monitor))}"
### print the left
res="$res%{l}${output_tags[$monitor]}$separator ${windowtitle:0:150}"
res+="%{l}${output_tags[$monitor]}$separator ${windowtitle:0:150}"
### center
#echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}"
### 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"
done
@ -127,145 +127,144 @@ hc --idle | {
# "Special" events (quit_panel/togglehidepanel/reload) are also handled
# here.
# wait for next event
IFS=$'\t' read -ra cmd || break
#for z in ${cmd[@]}
#do
#echo -n "'$z' " >&2
#done
#echo >&2
# find out event origin
case "${cmd[0]}" in
tag*)
#echo "resetting tags" >&2
for monitor in "${monitors[@]}" ; do
tags[$monitor]="$(hc tag_status "$monitor")"
done
;;
date)
#echo "resetting date" >&2
# date="${cmd[*]:1}"
;;
quit_panel)
exit
;;
reload)
exit
;;
load)
load=" ${cmd[*]:1}"
;;
focus_changed|window_title_changed)
windowtitle="${cmd[*]:2}"
;;
player)
# declare -A player_status
if [[ "${cmd[1]}" = cmus ]]
then
play_line=" ${cmd[3]:0:20}/${cmd[4]:0:20}"
[[ -n ${cmd[5]} ]] && play_line="$play_line: ${cmd[5]:0:20}"
play_sym=
case "${cmd[2]}" in
off|Stopped)
play_line=
;;
Paused)
play_sym=
;;
*)
play_sym="%{T2}%{T-}"
;;
esac
playing="$play_sym$play_line"
fi
# wait for next event
IFS=$'\t' read -ra cmd || break
#for z in ${cmd[@]}
#do
#echo -n "'$z' " >&2
#done
#echo >&2
# find out event origin
case "${cmd[0]}" in
tag*)
#echo "resetting tags" >&2
for monitor in "${monitors[@]}" ; do
tags[$monitor]="$(hc tag_status "$monitor")"
done
;;
date)
#echo "resetting date" >&2
date="${cmd[*]:1}"
;;
quit_panel)
exit
;;
reload)
exit
;;
load)
load=" ${cmd[*]:1}"
;;
focus_changed|window_title_changed)
windowtitle="${cmd[*]:2}"
echo "$windowtitle" > /tmp/wt
;;
player)
# declare -A player_status
if [[ "${cmd[1]}" = cmus ]]
then
play_line=" ${cmd[3]:0:20}/${cmd[4]:0:20}: ${cmd[5]:0:20}"
play_sym=
case "${cmd[2]}" in
off|Stopped)
play_line=
;;
Paused)
play_sym=
;;
*)
play_sym="%{T2}%{T-}"
;;
esac
playing="$play_sym$play_line"
fi
# [[ "${player_status[${cmd[1]}]}" != "${cmd[2]}" ]] &&
# notify "Player: ${cmd[1]}" "${cmd[2]}"
# player_status[${cmd[1]}]="${cmd[2]}"
;;
ac)
case ${cmd[1]} in
charging)
batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+"
notify "Power" "Battery charging"
;;
discharging)
ac="-"
batt_sym="%{F#ffdb00}$batt_sym%{F-}"
notify "Power" "Battery discharging"
;;
idle)
ac="="
notify "Power" "Fully charged"
;;
esac
;;
# [[ "${player_status[${cmd[1]}]}" != "${cmd[2]}" ]] &&
# notify "Player: ${cmd[1]}" "${cmd[2]}"
# player_status[${cmd[1]}]="${cmd[2]}"
;;
ac)
case ${cmd[1]} in
charging)
batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+"
notify "Power" "Battery charging"
;;
discharging)
ac="-"
batt_sym="%{F#ffdb00}$batt_sym%{F-}"
notify "Power" "Battery discharging"
;;
idle)
ac="="
notify "Power" "Fully charged"
;;
esac
;;
battery)
#echo "battery" >&2
batt_perc="${cmd[1]}"
{ [ "$batt_perc" -ge 95 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 75 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 50 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 25 ] && batt_sym= ; } || batt_sym=
battery)
#echo "battery" >&2
batt_perc="${cmd[1]}"
{ [ "$batt_perc" -ge 95 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 75 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 50 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 25 ] && batt_sym= ; } || batt_sym=
case "$ac" in
+)
batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+"
;;
-)
batt_sym="%{F#ffdb00}$batt_sym%{F-}"
;;
*)
;;
esac
case "$ac" in
+)
batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+"
;;
-)
batt_sym="%{F#ffdb00}$batt_sym%{F-}"
;;
*)
;;
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}%"
;;
temperature)
temperature=" ${cmd[1]}°C"
;;
wifi)
_wifi_net="${cmd[1]}"
if [[ -n "$_wifi_net" ]]
then
_wifi_sym=直
else
_wifi_sym=睊
fi
[ "$batt_perc" -le 15 ] && [ "$ac" != '+' ] && notify -u critical "Power" "Battery has only ${batt_perc}%"
;;
temperature)
temperature=" ${cmd[1]}°C"
;;
wifi)
_wifi_net="${cmd[1]}"
if [[ -n "$_wifi_net" ]]
then
_wifi_sym=直
else
_wifi_sym=睊
fi
wifi="$(xargs <<<"$_wifi_sym $_wifi_net")"
;;
;;
network)
_net_status="${cmd[1]}"
if [[ "$_net_status" == 'UP' ]]
then
_net_status="${cmd[1]}"
if [[ "$_net_status" == 'UP' ]]
then
network="$(xargs <<<"ﯱ ${cmd[2]}")"
else
network=
fi
;;
else
network=
fi
;;
volume)
sleep 0.1
volume)
sleep 0.1
mute="$(pactl get-sink-mute "$(pactl get-default-sink)" | awk '{print $2}')"
if [[ "$mute" == yes ]]
then
volume=""
else
volume=" ${cmd[1]}"
fi
;;
esac
first_loop=0
done
if [[ "$mute" == yes ]]
then
volume=""
else
volume=" ${cmd[1]}"
fi
;;
esac
first_loop=0
done
} | 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"

View file

@ -139,7 +139,7 @@ vim.cmd([[
-- local saga = require('lspsaga').init_lsp_saga()
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_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_next()<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("v", "<space>gf", "<cmd>lua vim.lsp.buf.range_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)
end
-- 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
nvim_lsp[lsp].setup {
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

View file

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