Conky 警告:无效的头部索引

Conky 警告:无效的头部索引

我的 Conky 在控制台测试期间仍然回显“无效的头部索引”。

一般来说,它可以在我的操作系统上顺利启动: 5.8.0-63-通用 #71~20.04.1-Ubuntu SMP 星期四 7 月 15 日 17:46:08 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux,每次启动时都会有效地执行 bash 文件 '~/conkystartup.sh':

#!/bin/bash
sleep 15
dir=~/.config/conky
cnf=${dir}/conky.conf
log=${dir}/conky.log
dat=$(date +%x-%X)
# execute command and append result in log file
if 
conky -d -c $cnf; then
    echo $dat " conky start succeed " >> $log
else 
    echo $dat  " ---- conky failed!!! " >> $log
fi

在'~/.config/conky/conky.conf'中配置如下:

conky.config = {

background = false,
update_interval = 1,
double_buffer = true,
no_buffers = true,
text_buffer_size = 2048,
own_window = true,
own_window_class = 'conky',
own_window_argb_visual = true,
own_window_argb_value = 50,
own_window_hints = 'undecorated,above,sticky,skip_taskbar,skip_pager',
own_window_colour = '#252525',
own_window_type = 'normal',
background = false,
minimum_width = 80,
alignment = 'bottom_right',
xinerama_head = 2,    
gap_x = 10,
gap_y = 10,
draw_shades = false,
draw_outline = false,
draw_borders = false,
override_utf8_locale = true,
use_xft = true,
font = 'Noto:size=24',
xftalpha = 0.5,
uppercase = false
};
conky.text = [[
${font Noto:size=24}${color white}${offset 0}${color white}${time %H}:${time %M}
${voffset -18}${offset 3}${font Noto:size=10}${color white}${time %e} ${time %b} ${time %A}
]];

请在通过直接命令 '~$ sh conkystartup.sh ' 触发的控制台测试后找到所附的所有回显行:

conky: warning: invalid head index, ignoring head settings
conky: warning: invalid head index, ignoring head settings
conky: desktop window (600010) is subwindow of root window (178)
conky: window type - normal
conky: drawing to created window (0x3e00002)
conky: drawing to double buffer
conky: forked to background, pid is 4525

每个调用的测试当然都以命令“$ killall conky”开头。

提前感谢您的可靠评论:)

===

编辑 27-07-2021 - 解决方案:

我的展示:

|-----------| |-----------------|
|0(laptop)  | |1(LCDtv)         |
|           | |                 |
|           | |                 |
|           | |             time|
|-----------| |-----------------|

在将“conky.conf”中的“xinerama_head = 2,' -> 'xinerama_head = 1,' 行更改之后,控制台结果测试“$ conky -d -c ~/.config/conky/conky.conf”为:

conky: desktop window (600010) is subwindow of root window (178)
conky: window type - normal
conky: drawing to created window (0x3800002)
conky: drawing to double buffer
conky: forked to background, pid is 5793

没有警告 - 达到预期结果!谢谢 :)

答案1

xinerama_head选项在多显示器设置中很有用。您放入该变量的值是您希望显示 conky 面板的显示器的索引(从零开始)。

警告告诉你,你正在使用一个不对应任何显示的索引。这可以从 conky 源代码中看到(感谢meuh 的评论),其中检查最大可用显示器数量可能会触发警告:

  int i = head_index.get(*state);
  if (i < 0 || i >= heads) {
    NORM_ERR("warning: invalid head index, ignoring head settings");
    return;
  }

删除/注释该xinerama_head = 2行,或者为您的设置添加一个适当的数字。

相关内容