Kako izgleda vaš desktop

Vijesti, rasprave, pitanja i savjeti o grafičkim okruženjima te upraviteljima prozora.

Moderator/ica: Moderatori/ce

Lutherus

Re: Kako izgleda vaš desktop

Post Postao/la Lutherus »

# -- Lua Load -- #
lua_load ~/.conky/conky_widgets/conky_widgets.lua
lua_draw_hook_pre widgets

pod tekst stavljaš one funkcije koje želiš i koj tekst želiš da conky ispisuje.
trebaš imati sljedeće pakete instalirane da bi radilo.
imlib2,scons,lua,tolua++,conky.obavezno instaliraš tim redosljedom s time da kod kompajliranja conky moraš omogučiti lua bindinge sa LUA=yes u .configure inače ništa od toga i žali bože truda.
većina distra već ima složene pakete.
arch ima u auru conky-lua,kod gentoo-a naparviš emerge paketa a kod debiana i njegove dječice instaliaraš conky-all,lua,cairo sa synaptica
Avatar
retsam
Postovi: 2254
Pridružen/a: 11 svi 2009, 16:26
Spol: M
OS: Arch Linux x86-64 subtle
Lokacija: /dev/pts/0

Re: Kako izgleda vaš desktop

Post Postao/la retsam »

zagortenay je napisao/la:To nije conky to je screenlet.Nego ljudi može li iko sebi odvojiti koju minutu i objasniti mi kako zaboga funkcioniše ova lua scripta u conky-u.Koliko sam ja razumio prvo moram imati conky 1.7.2+ uglavnom da ima lua cairo i i još neki binding.To imam imam conky 1.8.1 ili tako nekako.E sad šta dalje.Pretpostavljam da mi treba lua scripta i nju recimo spremim u home folder.Onda mi treba conkyrc scripta u home folderu.E sad prije texta u conkyrc napišem ono "lua load".Sad ne kapiram koji tekst onda treba staviti u conkyrc file.I da li je to onda sve i bi li mi neko mogao dati onda scripte da sebi napravim onaj rings sat.Ovako izgleda

slika

A još bih više volio ovaj conky

slika
Evo primjer:

Kod: Označi sve

# -- Conky settings -- #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

# -- Window specifications -- #

own_window yes
own_window_type desktop
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 1020 600
maximum_width 1000

alignment tm
gap_x 10
gap_y 0

# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# -- Text settings -- #
use_xft yes
xftfont Santana:size=24
xftalpha 0.8

uppercase no

default_color FFFFFF

# -- Lua Load -- #
lua_load ~/scripts/rings-v1.2.1.lua
lua_draw_hook_pre ring_stats

TEXT
${voffset 35}${font Santana:size=50}${alignr}${time %H.%M}${font}
${goto 160}${hr 2}
${goto 250}${time %A, %d %B %Y}
Dakle moraš pomoću lua_load-a učitati lua skriptu i onda pomoću lua_draw_hook_pre ring_stats u conky nacrtati te krugove a ti zoveš ovu lua skriptu:

Kod: Označi sve

--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
    lua_load ~/scripts/rings-v1.2.1.lua
    lua_draw_hook_pre ring_stats

Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]

settings_table = {
    {
        -- Edit this table to customise your rings.
        -- You can create more rings simply by adding more elements to settings_table.
        -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
        name='time',
        -- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
        arg='%I.%M',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
        max=12,
        -- "bg_colour" is the colour of the base ring.
        bg_colour=0xffffff,
        -- "bg_alpha" is the alpha value of the base ring.
        bg_alpha=0.1,
        -- "fg_colour" is the colour of the indicator part of the ring.
        fg_colour=0xffffff,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=0.2,
        -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
        x=165, y=170,
        -- "radius" is the radius of the ring.
        radius=50,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=5,
        -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
        start_angle=0,
        -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle.
        end_angle=360
    },
    {
        name='time',
        arg='%M.%S',
        max=60,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.4,
        x=165, y=170,
        radius=56,
        thickness=5,
        start_angle=0,
        end_angle=360
    },
    {
        name='time',
        arg='%S',
        max=60,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.6,
        x=165, y=170,
        radius=62,
        thickness=5,
        start_angle=0,
        end_angle=360
    },
    {
        name='cpu',
        arg='cpu1',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0,
        fg_colour=0xffffff,
        fg_alpha=0.1,
        x=165, y=170,
        radius=70,
        thickness=5,
        start_angle=60,
        end_angle=120
    },
    {
        name='cpu',
        arg='cpu2',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0,
        fg_colour=0xffffff,
        fg_alpha=0.1,
        x=165, y=170,
        radius=76,
        thickness=5,
        start_angle=60,
        end_angle=120
    },
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.4,
        x=165, y=170,
        radius=84.5,
        thickness=8,
        start_angle=60,
        end_angle=120
    },
    {
        name='battery_percent',
        arg='BAT1',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.6,
        x=165, y=170,
        radius=72,
        thickness=11,
        start_angle=122,
        end_angle=210
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=165, y=170,
        radius=83.5,
        thickness=8,
        start_angle=122,
        end_angle=210
    },
    {
        name='time',
        arg='%d',
        max=31,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=165, y=170,
        radius=70,
        thickness=5,
        start_angle=212,
        end_angle=360
    },
    {
        name='time',
        arg='%m',
        max=12,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=165, y=170,
        radius=76,
        thickness=5,
        start_angle=212,
        end_angle=360
    },
    {
        name='fs_used_perc',
        arg='/',
        max=150,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xffffff,
        fg_alpha=0.3,
        x=165, y=170,
        radius=108.5,
        thickness=3,
        start_angle=-120,
        end_angle=240
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xffffff,
        fg_alpha=0.3,
        x=165, y=170,
        radius=135,
        thickness=50,
        start_angle=-120,
        end_angle=120
    },
}

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
    local w,h=conky_window.width,conky_window.height

    local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

    local angle_0=sa*(2*math.pi/360)-math.pi/2
    local angle_f=ea*(2*math.pi/360)-math.pi/2
    local t_arc=t*(angle_f-angle_0)

    -- Draw background ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
    cairo_set_line_width(cr,ring_w)
    cairo_stroke(cr)

    -- Draw indicator ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
    cairo_stroke(cr)        
end

function conky_ring_stats()
    local function setup_rings(cr,pt)
        local str=''
        local value=0

        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)

        value=tonumber(str)
        if value == nil then value = 0 end
        pct=value/pt['max']

        draw_ring(cr,pct,pt)
    end

    if conky_window==nil then return end
    local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)

    local cr=cairo_create(cs)    

    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)

    if update_num>5 then
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
end
Dalje zadaješ conky-u parametre koje treba ispisati, npr sat u ocom primjeru i to na kraju izgleda ovako:

http://conky-pitstop.wdfiles.com/local- ... 1010/3.png

Dakle datum, mjesec ispisuje conky.

Za početak ti moraš biti siguran da je tvoj conky prekompajliran da podržava lua-u, a često nije pa sam moraš skompajlirati
conky s omogućenom luom

EDIT: tek sad vidim da me odin prestigao
Ken Thompson je napisao/la:One of my most productive days was throwing away 1000 lines of code.

Pikacode - Arch configs
Pikacode - dwm config
Lutherus

Re: Kako izgleda vaš desktop

Post Postao/la Lutherus »

no po skici preuzetoj od kolegice sa deviantart-a mogu reć da jedino koje mu treba je instalirati sve potrebne pakete i prekompajlirati conky.jer londonali uvijek stavlja i pakete sa gotovim konfiruracijama . :bleh za razliku od mene.
Avatar
zagortenay
Postovi: 680
Pridružen/a: 04 pro 2010, 14:04
OS: Guess!

Re: Kako izgleda vaš desktop

Post Postao/la zagortenay »

conky
Conky: llua_load: cannot open /home/bernard/.conky/conky_widgets/conky_widgets.lua: No such file or directory
Conky: /home/bernard/.conkyrc: 5: no such configuration: '...'
Conky: desktop window (18000b2) is subwindow of root window (18f)
Conky: drawing to desktop window
Conky: drawing to single buffer
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: can't load font 'Santana:size=50'
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_widgets execution failed: attempt to call a nil value
Conky: llua_do


Evo šta dobijem kad ubacim ove scripte u terminalu

A ovo je sve što mi na desku izađeslika
No pain,no pain!
Lutherus

Re: Kako izgleda vaš desktop

Post Postao/la Lutherus »

prekompajliraj conky i dozvoli mu lua binding
Avatar
Hugo
Postovi: 2451
Pridružen/a: 28 vel 2010, 18:13
Spol: M
OS: Linux
Lokacija: Đubrovnik
Kontakt:

Re: Kako izgleda vaš desktop

Post Postao/la Hugo »

zagortenay je napisao/la:conky
Conky: llua_load: cannot open /home/bernard/.conky/conky_widgets/conky_widgets.lua: No such file or directory
Conky: /home/bernard/.conkyrc: 5: no such configuration: '...'
Pretpostavljam da se ti ne zoveš bernard, nego taj tip koji je sastavio taj conky... :)

Unesi pravu putanju do lua skripte i conkyrc-a.. kava
One definition of the word mean is "small." Mean people live small, think small, and feel small—the smaller, the meaner.
Avatar
zagortenay
Postovi: 680
Pridružen/a: 04 pro 2010, 14:04
OS: Guess!

Re: Kako izgleda vaš desktop

Post Postao/la zagortenay »

Yeap my name'Bernard.Ali stvarno ne kapiram ovo.Obe scripte se nalaze u home .I naštiomao sam ali opet ne funkcioniše.Šta tačno taj lua load mora da piše ako se lua scripta nalazi u home/bernard
No pain,no pain!
Lutherus

Re: Kako izgleda vaš desktop

Post Postao/la Lutherus »

odin je napisao/la:# -- Lua Load -- #
lua_load /putanja/do/skripte/luaskripta.lua
lua_draw_hook_pre widgets
a dal imaš sve potrebne instaliranje pakete?jesi prekompajliral conky i omogučil lua bindings?
u supratnom uzalud sve ovo ako mu ne omogučiš to.
conky ispisuje txt,conky skripta radi.ono kaj tebi neradi je lua.prekompajliraj conky,omoguči mu lua bindinge,a prije instaliraj sve potrebne pakete.kak imaš ubuntu netrebaš ništa raditi ručno,imaš sve gotovo,samo vučeš sa repozitorija
Avatar
zagortenay
Postovi: 680
Pridružen/a: 04 pro 2010, 14:04
OS: Guess!

Re: Kako izgleda vaš desktop

Post Postao/la zagortenay »

Imam sve instalirano samo kako omogućiti lua to ne znam
No pain,no pain!
Lutherus

Re: Kako izgleda vaš desktop

Post Postao/la Lutherus »

vraćen skoro u "tvorničko" stanje
slika
Odgovori