标签: conky

python获取上传/下载速度

我想在我的计算机上监控上传和下载速度.一个名为conky的程序已经在conky conf中执行以下操作:

Connection quality: $alignr ${wireless_link_qual_perc wlan0}%
${downspeedgraph wlan0}
DLS:${downspeed wlan0} kb/s $alignr total: ${totaldown wlan0}
Run Code Online (Sandbox Code Playgroud)

它在我浏览时几乎实时显示了我的速度.我希望能够使用python访问相同的信息.

python linux networking conky

4
推荐指数
2
解决办法
5537
查看次数

如何在 Conky 中实现一个基本的 Lua 函数?

我正在尝试向我的 Conky 添加一个函数,该函数打印字符串的长度以进行调试。位于名为 的文件中的代码test.lua非常简单:

function test(word)
return string.len(word)
end
Run Code Online (Sandbox Code Playgroud)

...我像这样加载它。在我的conky.config部分,我有:

lua_load = '/home/xvlaze/test.lua',
lua_draw_hook_pre = 'test'
Run Code Online (Sandbox Code Playgroud)

...在conky.text我有的部分:

${lua test "fooo"}
Run Code Online (Sandbox Code Playgroud)

...其中test是函数的名称和fooo要测试的字符串。

预期的结果应该是在 Conky 中打印的 4,但我得到的是:

conky: llua_do_call: function conky_test execution failed: /home/xvlaze/test.lua:2: attempt to index a nil value (local 'string')
conky: llua_getstring: function conky_test didn't return a string, result discarded
Run Code Online (Sandbox Code Playgroud)

我浏览了文档,但找不到任何内容。有谁知道失败在哪里?

debugging customization lua function conky

4
推荐指数
1
解决办法
1885
查看次数

与if_match和'和'一致

由于我的可搜索关键字的广泛含义,我很难用谷歌搜索并搜索我正在尝试做的事情.

我正在尝试修改我的.conkyrc文件以根据温度更改字体颜色,这需要我写下这样的内容:

if [ $test >="50" and $test <="60"];
Run Code Online (Sandbox Code Playgroud)

我不希望上述内容完全起作用,我知道语法都是错误的,但这是我描述我想要完成的内容的最简单方法

下面是我配置中的一个实际部分,我试图在没有"和"或"或"的情况下进行,但当然,它不能像我希望的那样工作.

${goto 45}${if_match "${platform coretemp.0 temp 2}" >= "115"}${color4}${endif}${if_match "${platform coretemp.0 temp 2}" >= "125"}${color5}${endif}${if_match "${platform coretemp.0 temp 2}" >= "145"}${color6}${endif}${if_match "${platform coretemp.0 temp 2}" >= "155"}${color7}${endif}${if_match "${platform coretemp.0 temp 2}" >= "170"}${color8}${endif}${platform coretemp.0 temp 2}°F
Run Code Online (Sandbox Code Playgroud)

另外,我可以使用带有conky的elseif吗?

${if_match "$test" >="113"}${color4}${elseif "$test1" <="120"}${color5}${endif}
Run Code Online (Sandbox Code Playgroud)

或类似的东西?

if-statement conky

3
推荐指数
1
解决办法
1万
查看次数

lua 无法识别 cairo_text_extents_t

我正在用 lua 编写一些小部件,用于conky显示一些东西。我到达了一个点,我想将文本居中。按照教程,我将C代码移植到lua代码中,现在看起来像这样:

local extents
local utf8 = "cairo"
local x, y
cairo_select_font_face(cr, "Ubuntu", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size(cr, 13)
cairo_text_extents(cr, utf8, extents)
x = 128.0 - (extents.width / 2 + extents.x_bearing)
y = 128.0 - (extents.height / 2 + extents.y_bearing)

cairo_move_to(cr, x, y)
cairo_show_text(cr, utf8)
Run Code Online (Sandbox Code Playgroud)

我现在正在处理的问题是,应该传递给的C数据类型不被 识别,实际上在没有任何输出的情况下关闭。cairo_text_extents_tcairo_text_extentsluaconky

有没有办法lua识别该数据类型?

lua cairo conky

3
推荐指数
1
解决办法
328
查看次数

将文件内容传送到 conky?

我一直在写一个脚本来检查天气。该脚本很好,并且作为 cronjob 工作得很好,但是,我现在试图将脚本(今天的天气预报)的结果显示在 conky 中。

我有一个 python-weather 脚本写入的文件“weather-outside”,然后我将它添加到 conkyrc 文件中:

${color grey}Weather:${scroll 16 $execi 3600 cat $/home/User/Desktop/misc./weather-outside | fold}
Run Code Online (Sandbox Code Playgroud)

execi命令是假设在时间间隔设置为3600secs运行,但,这后运行时Conky的是错误消息:

Conky: execi needs arguments
Conky: Error destroying thread
***** Imlib2 Developer Warning ***** :
    This program is calling the Imlib call:

    imlib_context_free();

    With the parameter:

    context

    being NULL. Please fix your program.
Run Code Online (Sandbox Code Playgroud)

我已将execi更改为exec但是,然后实际行 'cat $home/User/Desktop/misc./weather-outside | fold' 在 conky 上滚动而不是该文件中的文本?

linux conky

2
推荐指数
1
解决办法
3548
查看次数

Bash如果块明显不应该运行

代码:

first=true
mountpoint=" "
partlist=`df -h | grep "^/dev"` # get partition info
for i in $partlist              # loop through info
do
  if [[ ${i:0:1} = "/" ]]       # items starting with / are what I'm interested in
  then
    if [[ $first ]]             # The first instance in each pair is the device name
    then
      mountdev=$i
      mountpoint=" "
      first=false
    else                        # The second instance is the device mount point
      mountpoint=$i
      first=true
    fi
    if [[ $mountpoint != " " ]] # …
Run Code Online (Sandbox Code Playgroud)

bash conky

0
推荐指数
1
解决办法
131
查看次数