如何使用带有 own_window_type=panel 的 conky 沿屏幕顶部边缘创建一个不与其他窗口重叠的 conky 窗口?

如何使用带有 own_window_type=panel 的 conky 沿屏幕顶部边缘创建一个不与其他窗口重叠的 conky 窗口?

我想要创建一个位于屏幕顶部边缘的 conky 窗口,并且与最大化或非最大化的窗口不重叠。

我尝试使用 own_window 和 own_window_type=panel,结果 conky 窗口位于现有窗口之上(并重叠)。

有人能提供一些建议吗?

谢谢。


我在 Debian buster 上运行 conky (1.10.8),并安装了 lxde、lxpanel (0.9.3) 和 openbox (3.6.1)。我在屏幕底部边缘运行了一个 lxpanel,在最大化窗口时效果很好。


下面是运行 conky -C 的默认 conky 配置:

conky.config = {
    alignment = 'top_left',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    use_xft = true,
    font = 'DejaVu Sans Mono:size=12',
    gap_x = 5,
    gap_y = 60,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false
}

以下是我的配置文件:

conky.config = {

background = true,
update_interval = 10,
update_interval_on_battery = 10,
total_run_times = 0,

double_buffer = true,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'panel',
own_window_hints = 'undecorated,above,sticky,skip_taskbar,skip_pager',
own_window_transparent = false,
own_window_colour = '17171D',
own_window_argb_visual = false,
own_window_argb_value = 0,

alignment = 'top_middle',
gap_x = 0,
gap_y = 0,
minimum_height = 18,
minimum_width = 1366,
maximum_width = 1366,

draw_borders = false,
border_outer_margin = 0,
border_width = 0,
border_inner_margin = 0,

default_color = 'FFFFFF',
color0 = 'CCCCCC',
color1 = '999999',
color2 = 'FFC466',
color3 = 'C2A270',
color4 = 'FFFF66',
color5 = 'C2C270',
color6 = '00FF66',
color7 = '71C191',
color8 = '0066FF',
color9 = '7191C1',

use_xft = true,
xftalpha = 1.0,

font = 'Ubuntu:style=Medium:size=10',

draw_outline = false,
default_outline_color = '000000',
draw_shades = false,
default_shade_color = '333333',

max_text_width = 0,

uppercase = false,
format_human_readable = true,
short_units = true,

draw_graph_borders = false,
show_graph_range = false,
show_graph_scale = false,

temperature_unit='celsius',

cpu_avg_samples = 4,
net_avg_samples = 2,
diskio_avg_samples = 2,

if_up_strictness = 'address',

top_cpu_separate = false,
top_name_verbose = false,
top_name_width = 20,

out_to_console = false,
out_to_ncurses = false,
-- out_to_http = false,
out_to_stderr = false,

override_utf8_locale = true,

no_buffers = true,
text_buffer_size = 2048

}

conky.text = [[
Some text to display
]]

当我将配置减少到最低限度时,我得到了相同的结果:

conky.config = {

double_buffer = true,
own_window = true,
own_window_type = 'panel',
own_window_hints = 'undecorated,above,sticky,skip_taskbar,skip_pager',

}

conky.text = [[
Some text to display
]]

下面是我运行 conky -D -c conky-panel-display.conf 时的输出:

DEBUG(0) [/build/conky-2JSxht/conky-1.10.8/src/conky.cc:2740]: reading contents from config file 'conky-panel-display.conf'
DEBUG(0) [/build/conky-2JSxht/conky-1.10.8/src/x11.cc:494]: Fixed xinerama area to: 0 0 1366 768
DEBUG(0) [/build/conky-2JSxht/conky-1.10.8/src/x11.cc:494]: Fixed xinerama area to: 0 0 1366 768
conky: desktop window (e002af) is subwindow of root window (10e)
conky: window type - panel
conky: drawing to created window (0x2400001)
conky: drawing to double buffer
conky: forked to background, pid is 22113

答案1

正如我上面指定的,一切都按照我在 conky 中需要的方式运行。

然后我只需在文件 ~/.config/openbox/lxde-rc.xml 中配置 openbox,这样窗口就不会放置在放置我的 conky 面板的顶部边缘。

<?xml version="1.0" encoding="UTF-8"?>
<openbox_config xmlns="http://openbox.org/3.4/rc">

    ...

    <margins>
      <top>22</top>
      <bottom>0</bottom>
      <left>0</left>
      <right>0</right>
    </margins>

    ...

</openbox_config>

相关内容