├── Equalizer ├── conky_start.sh ├── conkyrc ├── horical_conky ├── info_conkyrc ├── ip_conkyrc ├── net_conkyrc └── top_conkyrc ├── README.md ├── Screenshot.png ├── Wallpaper.jpg └── scripts ├── equilizer.lua ├── horizontal_calendar.sh └── ip.sh /Equalizer/conky_start.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | conky -c ~/.conky/Equalizer/conkyrc & 4 | conky -c ~/.conky/Equalizer/horical_conky & 5 | conky -c ~/.conky/Equalizer/ip_conkyrc & 6 | conky -c ~/.conky/Equalizer/net_conkyrc & 7 | conky -c ~/.conky/Equalizer/info_conkyrc & 8 | conky -c ~/.conky/Equalizer/top_conkyrc 9 | -------------------------------------------------------------------------------- /Equalizer/conkyrc: -------------------------------------------------------------------------------- 1 | own_window yes 2 | own_window_argb_visual yes 3 | own_window_transparent yes 4 | own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 5 | 6 | # ARGB can be used for real transparency, note that a composite manager is required for real transparency 7 | own_window_argb_visual true 8 | 9 | # Set the transparency alpha value from 0 to 255 10 | own_window_argb_value 0 11 | 12 | update_interval 1 # this is used if system is not running on battery battery 13 | update_interval_on_battery 1 # this is used if system is running on battery battery, higher value ensures that conky save battery power 14 | 15 | double_buffer yes 16 | no_buffers yes 17 | text_buffer_size 2048 18 | gap_x 1080 19 | gap_y 700 20 | minimum_size 800 200 21 | maximum_width 1920 22 | 23 | border_inner_margin 0 24 | border_outer_margin 0 25 | use_spacer none 26 | alignment tl 27 | 28 | draw_shades no 29 | draw_outline no 30 | draw_borders no 31 | draw_graph_borders no 32 | 33 | override_utf8_locale yes 34 | use_xft yes 35 | xftfont ubuntu light:size=8 36 | xftalpha 0.5 37 | uppercase yes 38 | 39 | lua_load /home/ujjwal/.conky/scripts/equilizer.lua 40 | lua_draw_hook_pre main_bars 41 | 42 | TEXT 43 | 44 | 45 | 46 | 47 | ${color 56696F} 48 | #${voffset 150}${goto 18}cpu 49 | ${voffset 150}${goto 88}cpu ${goto 158}ram${goto 228}swap${goto 298}home${goto 368}root${goto 444}up${goto 508}down${goto 578}wifi${goto 637}battery${goto 718}temp 50 | -------------------------------------------------------------------------------- /Equalizer/horical_conky: -------------------------------------------------------------------------------- 1 | own_window yes 2 | own_window_argb_visual yes 3 | own_window_transparent yes 4 | own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 5 | 6 | # ARGB can be used for real transparency, note that a composite manager is required for real transparency 7 | own_window_argb_visual true 8 | 9 | # Set the transparency alpha value from 0 to 255 10 | own_window_argb_value 0 11 | 12 | update_interval 1 # this is used if system is not running on battery battery 13 | update_interval_on_battery 1 # this is used if system is running on battery battery, higher value ensures that conky save battery power 14 | 15 | double_buffer yes 16 | no_buffers yes 17 | text_buffer_size 2048 18 | gap_x 0 19 | gap_y 950 20 | minimum_size 1920 21 | maximum_width 1920 22 | 23 | border_inner_margin 0 24 | border_outer_margin 0 25 | use_spacer none 26 | alignment tl 27 | 28 | draw_shades no 29 | draw_outline no 30 | draw_borders no 31 | draw_graph_borders no 32 | 33 | override_utf8_locale yes 34 | use_xft yes 35 | xftfont ubuntu light:size=12 36 | xftalpha 0.2 37 | uppercase no 38 | 39 | TEXT 40 | 41 | $color${execpi 36000 ~/.conky/scripts/horizontal_calendar.sh}${color} 42 | 43 | #${voffset -32}${font Sahara:italic:size=20}${goto 280}${color 383333}${execi 30 fortune fran} 44 | -------------------------------------------------------------------------------- /Equalizer/info_conkyrc: -------------------------------------------------------------------------------- 1 | own_window yes 2 | own_window_argb_visual yes 3 | own_window_transparent yes 4 | own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 5 | 6 | # ARGB can be used for real transparency, note that a composite manager is required for real transparency 7 | own_window_argb_visual true 8 | 9 | # Set the transparency alpha value from 0 to 255 10 | own_window_argb_value 0 11 | 12 | update_interval 1 # this is used if system is not running on battery battery 13 | update_interval_on_battery 1 # this is used if system is running on battery battery, higher value ensures that conky save battery power 14 | 15 | double_buffer yes 16 | no_buffers yes 17 | text_buffer_size 2048 18 | gap_x 1590 19 | gap_y 500 20 | minimum_size 250 21 | maximum_width 250 22 | 23 | border_inner_margin 0 24 | border_outer_margin 0 25 | use_spacer none 26 | alignment tl 27 | 28 | draw_shades no 29 | draw_outline no 30 | draw_borders no 31 | draw_graph_borders no 32 | 33 | override_utf8_locale yes 34 | use_xft yes 35 | xftfont ubuntu light:size=8 36 | xftalpha 0.2 37 | uppercase no 38 | 39 | TEXT 40 | ${font monospace:pixelsize=14}${color 63767B} 41 | Hostname: $alignr${nodename} 42 | Uptime: $alignr${uptime} 43 | Battery: $alignr${battery_percent BAT0}% 44 | Temperature: $alignr${acpitemp} 45 | -------------------------------------------------------------------------------- /Equalizer/ip_conkyrc: -------------------------------------------------------------------------------- 1 | own_window yes 2 | own_window_argb_visual yes 3 | own_window_transparent yes 4 | own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 5 | 6 | # ARGB can be used for real transparency, note that a composite manager is required for real transparency 7 | own_window_argb_visual true 8 | 9 | # Set the transparency alpha value from 0 to 255 10 | own_window_argb_value 0 11 | 12 | update_interval 600 # this is used if system is not running on battery battery 13 | update_interval_on_battery 600 # this is used if system is running on battery battery, higher value ensures that conky save battery power 14 | 15 | double_buffer yes 16 | no_buffers yes 17 | text_buffer_size 2048 18 | gap_x 1540 19 | gap_y 700 20 | minimum_size 300 21 | maximum_width 300 22 | 23 | border_inner_margin 0 24 | border_outer_margin 0 25 | use_spacer none 26 | alignment tl 27 | 28 | draw_shades no 29 | draw_outline no 30 | draw_borders no 31 | draw_graph_borders no 32 | 33 | override_utf8_locale yes 34 | use_xft yes 35 | xftfont ubuntu light:size=7 36 | xftalpha 0.2 37 | uppercase no 38 | 39 | TEXT 40 | 41 | ${font monospace:pixelsize=20}${color 56696F} 42 | Wireless Ip:$alignr${if_up wlp5s0}${addr wlp5s0}${else}${endif} 43 | Public Ip:$alignr${if_up wlp5s0}${execi 30 ~/.conky/scripts/ip.sh}${else}${endif} 44 | -------------------------------------------------------------------------------- /Equalizer/net_conkyrc: -------------------------------------------------------------------------------- 1 | own_window yes 2 | own_window_argb_visual yes 3 | own_window_transparent yes 4 | own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 5 | 6 | # ARGB can be used for real transparency, note that a composite manager is required for real transparency 7 | own_window_argb_visual true 8 | 9 | # Set the transparency alpha value from 0 to 255 10 | own_window_argb_value 0 11 | 12 | update_interval 1 # this is used if system is not running on battery battery 13 | update_interval_on_battery 1 # this is used if system is running on battery battery, higher value ensures that conky save battery power 14 | 15 | double_buffer yes 16 | no_buffers yes 17 | text_buffer_size 2048 18 | gap_x 1590 19 | gap_y 580 20 | minimum_size 250 21 | maximum_width 250 22 | 23 | border_inner_margin 0 24 | border_outer_margin 0 25 | use_spacer none 26 | alignment tl 27 | 28 | draw_shades no 29 | draw_outline no 30 | draw_borders no 31 | draw_graph_borders no 32 | 33 | override_utf8_locale yes 34 | use_xft yes 35 | xftfont ubuntu light:size=7 36 | xftalpha 0.2 37 | uppercase no 38 | 39 | TEXT 40 | 41 | ${font monospace:pixelsize=14}${color 63767B} 42 | Wireless Essid:$alignr${wireless_essid wlp5s0} 43 | Wireless Signal:$alignr${if_up wlp5s0}${wireless_link_qual_perc wlp5s0}%${else}${endif} 44 | Upload:$alignr${upspeedf wlp5s0} kbps 45 | Total Upload:$alignr${totalup wlp5s0}${color 63767B} 46 | Download:$alignr${downspeedf wlp5s0} kbps 47 | Total Download:$alignr${totaldown wlp5s0} 48 | -------------------------------------------------------------------------------- /Equalizer/top_conkyrc: -------------------------------------------------------------------------------- 1 | own_window yes 2 | own_window_argb_visual yes 3 | own_window_transparent yes 4 | own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 5 | 6 | # ARGB can be used for real transparency, note that a composite manager is required for real transparency 7 | own_window_argb_visual true 8 | 9 | # Set the transparency alpha value from 0 to 255 10 | own_window_argb_value 0 11 | 12 | update_interval 0.5 # this is used if system is not running on battery battery 13 | update_interval_on_battery 1 # this is used if system is running on battery battery, higher value ensures that conky save battery power 14 | 15 | double_buffer yes 16 | no_buffers yes 17 | text_buffer_size 2048 18 | gap_x 1590 19 | gap_y 260 20 | minimum_size 250 21 | maximum_width 250 22 | 23 | border_inner_margin 0 24 | border_outer_margin 0 25 | use_spacer none 26 | alignment tl 27 | 28 | draw_shades no 29 | draw_outline no 30 | draw_borders no 31 | draw_graph_borders no 32 | 33 | override_utf8_locale yes 34 | use_xft yes 35 | xftfont ubuntu light:size=8 36 | xftalpha 0.1 37 | uppercase no 38 | 39 | TEXT 40 | ${font monospace:pixelsize=14}${color 6A7F85} 41 | $alignr CPU 42 | ${goto 0}${top name 1}$alignr${top cpu 1}% 43 | ${goto 0}${top name 2}$alignr${top cpu 2}% 44 | ${goto 0}${top name 3}$alignr${top cpu 3}% 45 | ${goto 0}${top name 4}$alignr${top cpu 4}% 46 | ${goto 0}${top name 5}$alignr${top cpu 5}% 47 | ${voffset -5} 48 | ${color 6A7F85} 49 | $alignr RAM 50 | ${goto 0}${top_mem name 1}$alignr${top mem 1}% 51 | ${goto 0}${top_mem name 2}$alignr${top mem 2}% 52 | ${goto 0}${top_mem name 3}$alignr${top mem 3}% 53 | ${goto 0}${top_mem name 4}$alignr${top mem 4}% 54 | ${goto 0}${top_mem name 5}$alignr${top mem 5}% 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Conky 2 | # See https://github.com/ujjwal96/conkit 3 | My conky setup. These are not created by me but I customised them according to my needs. 4 | ![screenshot](https://github.com/ujjwal96/Conky/blob/master/Screenshot.png) 5 | -------------------------------------------------------------------------------- /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r00tdaemon/Conky/33d0e3f50d8914f958b21e8110402b70d4c041d1/Screenshot.png -------------------------------------------------------------------------------- /Wallpaper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r00tdaemon/Conky/33d0e3f50d8914f958b21e8110402b70d4c041d1/Wallpaper.jpg -------------------------------------------------------------------------------- /scripts/equilizer.lua: -------------------------------------------------------------------------------- 1 | --[[ Equalizer modified by plusdm 2012 2 | 3 | Parameters are : 4 | 3 parameters are mandatory 5 | name - the name of the conky variable to display, for example for {$cpu cpu0}, just write name="cpu" 6 | arg - the argument of the above variable, for example for {$cpu cpu0}, just write arg="cpu0" 7 | arg can be a numerical value if name="" 8 | max - the maximum value the above variable can reach, for example, for {$cpu cpu0}, just write max=100 9 | 10 | Optional parameters: 11 | x,y - coordinates of the starting point of the bar, default = middle of the conky window 12 | cap - end of cap line, possibles values are r,b,s (for round, butt, square), default="b" 13 | http://www.cairographics.org/samples/set_line_cap/ 14 | angle - angle of rotation of the bar in degress, default = 0 (i.e. a vertical bar) 15 | set to 90 for an horizontal bar 16 | skew_x - skew bar around x axis, default = 0 17 | skew_y - skew bar around y axis, default = 0 18 | blocks - number of blocks to display for a bar (values >0) , default= 10 19 | height - height of a block, default=10 pixels 20 | width - width of a block, default=20 pixels 21 | space - space between 2 blocks, default=2 pixels 22 | angle_bar - this angle is used to draw a bar on a circular way (ok, this is no more a bar !) default=0 23 | radius - for cicular bars, internal radius, default=0 24 | with radius, parameter width has no more effect. 25 | 26 | Colours below are defined into braces {colour in hexadecimal, alpha} 27 | fg_colour - colour of a block ON, default= {0x00FF00,1} 28 | bg_colour - colour of a block OFF, default = {0x00FF00,0.5} 29 | alarm - threshold, values after this threshold will use alarm_colour colour , default=max 30 | alarm_colour - colour of a block greater than alarm, default=fg_colour 31 | smooth - (true or false), create a gradient from fg_colour to bg_colour, default=false 32 | mid_colour - colours to add to gradient, with this syntax {position into the gradient (0 to1), colour hexa, alpha} 33 | for example, this table {{0.25,0xff0000,1},{0.5,0x00ff00,1},{0.75,0x0000ff,1}} will add 34 | 3 colurs to gradient created by fg_colour and alarm_colour, default=no mid_colour 35 | led_effect - add LED effects to each block, default=no led_effect 36 | if smooth=true, led_effect is not used 37 | possibles values : "r","a","e" for radial, parallelel, perdendicular to the bar (just try!) 38 | led_effect has to be used with theses colours : 39 | fg_led - middle colour of a block ON, default = fg_colour 40 | bg_led - middle colour of a block OFF, default = bg_colour 41 | alarm_led - middle colour of a block > ALARM, default = alarm_colour 42 | 43 | reflection parameters, not available for circular bars 44 | reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection 45 | other values = starting opacity 46 | reflection_scale - scale of the reflection (default = 1 = height of text) 47 | reflection_length - length of reflection, define where the opacity will be set to zero 48 | calues from 0 to 1, default =1 49 | reflection - position of reflection, relative to a vertical bar, default="b" 50 | possibles values are : "b","t","l","r" for bottom, top, left, right 51 | draw_me - if set to false, text is not drawn (default = true or 1) 52 | it can be used with a conky string, if the string returns 1, the text is drawn : 53 | example : "${if_empty ${wireless_essid wlan0}}${else}1$endif", 54 | 55 | -- This program is free software; you can redistribute it and/or modify 56 | -- it under the terms of the GNU General Public License as published by 57 | -- the Free Software Foundation version 3 (GPLv3) 58 | 59 | ]] 60 | 61 | require 'cairo' 62 | 63 | ----------------START OF PARAMETERS ---------- 64 | function conky_main_bars() 65 | local bars_settings={ 66 | { 67 | name="cpu", 68 | arg="cpu", 69 | max=100, 70 | alarm=80, 71 | bg_colour={0x4F5E63,0.20}, 72 | fg_colour={0x56696F,1.00}, 73 | alarm_colour={0xA0584A,0.80}, 74 | x=5,y=200, 75 | blocks=8, 76 | height=8,width=50, 77 | angle=360, 78 | smooth=true, 79 | cap="r", 80 | skew_y=0, 81 | space=6, 82 | mid_colour={{0.5,0x4F5E63,0.60}}, 83 | draw_me=false 84 | }, 85 | { 86 | name="cpu", 87 | arg="cpu", 88 | max=100, 89 | alarm=80, 90 | bg_colour={0x4F5E63,0.20}, 91 | fg_colour={0x56696F,1.00}, 92 | alarm_colour={0xA0584A,0.80}, 93 | x=75,y=200, 94 | blocks=8, 95 | height=8,width=50, 96 | angle=360, 97 | smooth=true, 98 | cap="r", 99 | skew_y=0, 100 | space=6, 101 | mid_colour={{0.5,0x4F5E63,0.60}} 102 | }, 103 | { 104 | name="memperc", 105 | arg="memperc", 106 | max=100, 107 | alarm=80, 108 | bg_colour={0x4F5E63,0.20}, 109 | fg_colour={0x56696F,1.00}, 110 | alarm_colour={0xA0584A,0.80}, 111 | x=145,y=200, 112 | blocks=8, 113 | height=8,width=50, 114 | angle=360, 115 | smooth=true, 116 | cap="r", 117 | skew_y=0, 118 | space=6, 119 | mid_colour={{0.5,0x4F5E63,0.60}} 120 | }, 121 | { 122 | name="fs_used_perc", 123 | arg="/dev/sda7", 124 | max=100, 125 | alarm=80, 126 | bg_colour={0x4F5E63,0.20}, 127 | fg_colour={0x56696F,1.00}, 128 | alarm_colour={0xA0584A,0.80}, 129 | x=215,y=200, 130 | blocks=8, 131 | height=8,width=50, 132 | angle=360, 133 | smooth=true, 134 | cap="r", 135 | skew_y=0, 136 | space=6, 137 | mid_colour={{0.5,0x4F5E63,0.60}} 138 | }, 139 | { 140 | name="fs_used_perc", 141 | arg="/", 142 | max=100, 143 | alarm=80, 144 | bg_colour={0x4F5E63,0.20}, 145 | fg_colour={0x56696F,1.00}, 146 | alarm_colour={0xA0584A,0.80}, 147 | x=285,y=200, 148 | blocks=8, 149 | height=8,width=50, 150 | angle=360, 151 | smooth=true, 152 | cap="r", 153 | skew_y=0, 154 | space=6, 155 | mid_colour={{0.5,0x4F5E63,0.60}} 156 | }, 157 | { 158 | name="fs_used_perc", 159 | arg="/home", 160 | max=100, 161 | alarm=80, 162 | bg_colour={0x4F5E63,0.20}, 163 | fg_colour={0x56696F,1.00}, 164 | alarm_colour={0xA0584A,0.80}, 165 | x=355,y=200, 166 | blocks=8, 167 | height=8,width=50, 168 | angle=360, 169 | smooth=true, 170 | cap="r", 171 | skew_y=0, 172 | space=6, 173 | mid_colour={{0.5,0x4F5E63,0.60}} 174 | }, 175 | { 176 | name="upspeedf", 177 | arg="wlp5s0", 178 | max=140, 179 | alarm=100, 180 | bg_colour={0x4F5E63,0.20}, 181 | fg_colour={0x56696F,1.00}, 182 | alarm_colour={0xA0584A,0.80}, 183 | x=425,y=200, 184 | blocks=8, 185 | height=8,width=50, 186 | angle=360, 187 | smooth=true, 188 | cap="r", 189 | skew_y=0, 190 | space=6, 191 | mid_colour={{0.5,0x4F5E63,0.60}} 192 | }, 193 | { 194 | name="downspeedf", 195 | arg="wlp5s0", 196 | max=700, 197 | alarm=600, 198 | bg_colour={0x4F5E63,0.20}, 199 | fg_colour={0x56696F,1.00}, 200 | alarm_colour={0xA0584A,0.80}, 201 | x=495,y=200, 202 | blocks=8, 203 | height=8,width=50, 204 | angle=360, 205 | smooth=true, 206 | cap="r", 207 | skew_y=0, 208 | space=6, 209 | mid_colour={{0.5,0x4F5E63,0.60}} 210 | }, 211 | { 212 | name="wireless_link_qual_perc", 213 | arg="wlp5s0", 214 | max=100, 215 | alarm=80, 216 | bg_colour={0x4F5E63,0.20}, 217 | fg_colour={0x56696F,1.00}, 218 | alarm_colour={0xA0584A,0.80}, 219 | x=565,y=200, 220 | blocks=8, 221 | height=8,width=50, 222 | angle=360, 223 | smooth=true, 224 | cap="r", 225 | skew_y=0, 226 | space=6, 227 | mid_colour={{0.5,0x4F5E63,0.60}} 228 | }, 229 | 230 | { 231 | name="battery_percent", 232 | arg="BAT0", 233 | max=100, 234 | alarm=20, 235 | bg_colour={0x4F5E63,0.20}, 236 | fg_colour={0x56696F,1.00}, 237 | alarm_colour={0xA0584A,0.80}, 238 | x=635,y=200, 239 | blocks=8, 240 | height=8,width=50, 241 | angle=360, 242 | smooth=true, 243 | cap="r", 244 | skew_y=0, 245 | space=6, 246 | reflection=4, 247 | mid_colour={{0.5,0x4F5E63,0.60}} 248 | }, 249 | { 250 | name="execi", 251 | arg="10 sensors|grep CPU|cut -c 18-21", 252 | max=100, 253 | alarm=80, 254 | bg_colour={0x4F5E63,0.20}, 255 | fg_colour={0x56696F,1.00}, 256 | alarm_colour={0xA0584A,0.80}, 257 | x=705,y=200, 258 | blocks=8, 259 | height=8,width=50, 260 | angle=360, 261 | smooth=true, 262 | cap="r", 263 | skew_y=0, 264 | space=6, 265 | reflection=4, 266 | mid_colour={{0.5,0x4F5E63,0.60}} 267 | }, 268 | 269 | } 270 | 271 | -----------END OF PARAMETERS-------------- 272 | 273 | 274 | 275 | if conky_window == nil then return end 276 | 277 | local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height) 278 | 279 | cr = cairo_create(cs) 280 | 281 | --prevent segmentation error when reading cpu state 282 | if tonumber(conky_parse('${updates}'))>3 then 283 | 284 | for i in pairs(bars_settings) do 285 | 286 | draw_multi_bar_graph(bars_settings[i]) 287 | 288 | end 289 | end 290 | cairo_destroy(cr) 291 | cairo_surface_destroy(cs) 292 | cr=nil 293 | 294 | end 295 | 296 | 297 | 298 | function draw_multi_bar_graph(t) 299 | cairo_save(cr) 300 | --check values 301 | 302 | if t.draw_me == true then t.draw_me = nil end 303 | if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end 304 | if t.name==nil and t.arg==nil then 305 | print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ") 306 | return 307 | end 308 | if t.max==nil then 309 | print ("No maximum value defined, use 'max'") 310 | return 311 | end 312 | if t.name==nil then t.name="" end 313 | if t.arg==nil then t.arg="" end 314 | 315 | --set default values 316 | if t.x == nil then t.x = conky_window.width/2 end 317 | if t.y == nil then t.y = conky_window.height/2 end 318 | if t.blocks == nil then t.blocks=10 end 319 | if t.height == nil then t.height=10 end 320 | if t.angle == nil then t.angle=0 end 321 | t.angle = t.angle*math.pi/180 322 | --line cap style 323 | if t.cap==nil then t.cap = "b" end 324 | local cap="b" 325 | for i,v in ipairs({"s","r","b"}) do 326 | if v==t.cap then cap=v end 327 | end 328 | local delta=0 329 | if t.cap=="r" or t.cap=="s" then delta = t.height end 330 | if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE 331 | elseif cap=="r" then 332 | cap = CAIRO_LINE_CAP_ROUND 333 | elseif cap=="b" then 334 | cap = CAIRO_LINE_CAP_BUTT 335 | end 336 | --end line cap style 337 | --if t.led_effect == nil then t.led_effect="r" end 338 | if t.width == nil then t.width=20 end 339 | if t.space == nil then t.space=2 end 340 | if t.radius == nil then t.radius=0 end 341 | if t.angle_bar == nil then t.angle_bar=0 end 342 | t.angle_bar = t.angle_bar*math.pi/360 --halt angle 343 | 344 | --colours 345 | if t.bg_colour == nil then t.bg_colour = {0x00FF00,0.5} end 346 | if #t.bg_colour~=2 then t.bg_colour = {0x00FF00,0.5} end 347 | if t.fg_colour == nil then t.fg_colour = {0x00FF00,1} end 348 | if #t.fg_colour~=2 then t.fg_colour = {0x00FF00,1} end 349 | if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end 350 | if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end 351 | 352 | if t.mid_colour ~= nil then 353 | for i=1, #t.mid_colour do 354 | if #t.mid_colour[i]~=3 then 355 | print ("error in mid_color table") 356 | t.mid_colour[i]={1,0xFFFFFF,1} 357 | end 358 | end 359 | end 360 | 361 | if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end 362 | if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end 363 | if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end 364 | 365 | if t.led_effect~=nil then 366 | if t.bg_led == nil then t.bg_led = t.bg_colour end 367 | if t.fg_led == nil then t.fg_led = t.fg_colour end 368 | if t.alarm_led == nil then t.alarm_led = t.fg_led end 369 | end 370 | 371 | 372 | if t.alarm==nil then t.alarm = t.max end --0.8*t.max end 373 | if t.smooth == nil then t.smooth = false end 374 | 375 | if t.skew_x == nil then 376 | t.skew_x=0 377 | else 378 | t.skew_x = math.pi*t.skew_x/180 379 | end 380 | if t.skew_y == nil then 381 | t.skew_y=0 382 | else 383 | t.skew_y = math.pi*t.skew_y/180 384 | end 385 | 386 | if t.reflection_alpha==nil then t.reflection_alpha=0 end 387 | if t.reflection_length==nil then t.reflection_length=1 end 388 | if t.reflection_scale==nil then t.reflection_scale=1 end 389 | 390 | --end of default values 391 | 392 | 393 | local function rgb_to_r_g_b(col_a) 394 | return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2] 395 | end 396 | 397 | 398 | --functions used to create patterns 399 | 400 | local function create_smooth_linear_gradient(x0,y0,x1,y1) 401 | local pat = cairo_pattern_create_linear (x0,y0,x1,y1) 402 | cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour)) 403 | cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour)) 404 | if t.mid_colour ~=nil then 405 | for i=1, #t.mid_colour do 406 | cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]})) 407 | end 408 | end 409 | return pat 410 | end 411 | 412 | local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1) 413 | local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1) 414 | cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour)) 415 | cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour)) 416 | if t.mid_colour ~=nil then 417 | for i=1, #t.mid_colour do 418 | cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]})) 419 | end 420 | end 421 | return pat 422 | end 423 | 424 | local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led) 425 | local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0) 426 | cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp)) 427 | cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led)) 428 | cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp)) 429 | return pat 430 | end 431 | 432 | local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode) 433 | local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1) 434 | if mode==3 then 435 | cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp)) 436 | cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led)) 437 | cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp)) 438 | else 439 | cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led)) 440 | cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp)) 441 | end 442 | return pat 443 | end 444 | 445 | 446 | 447 | 448 | 449 | 450 | local function draw_single_bar() 451 | --this fucntion is used for bars with a single block (blocks=1) but 452 | --the drawing is cut in 3 blocks : value/alarm/background 453 | --not zvzimzblr for circular bar 454 | local function create_pattern(col_alp,col_led,bg) 455 | local pat 456 | 457 | if not t.smooth then 458 | if t.led_effect=="e" then 459 | pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led) 460 | elseif t.led_effect=="a" then 461 | pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led) 462 | elseif t.led_effect=="r" then 463 | pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2) 464 | else 465 | pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp)) 466 | end 467 | else 468 | if bg then 469 | pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour)) 470 | else 471 | pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height) 472 | end 473 | end 474 | return pat 475 | end 476 | 477 | local y1=-t.height*pct/100 478 | local y2,y3 479 | if pct>(100*t.alarm/t.max) then 480 | y1 = -t.height*t.alarm/100 481 | y2 = -t.height*pct/100 482 | if t.smooth then y1=y2 end 483 | end 484 | 485 | if t.angle_bar==0 then 486 | 487 | --block for fg value 488 | local pat = create_pattern(t.fg_colour,t.fg_led,false) 489 | cairo_set_source(cr,pat) 490 | cairo_rectangle(cr,0,0,t.width,y1) 491 | cairo_fill(cr) 492 | cairo_pattern_destroy(pat) 493 | 494 | -- block for alarm value 495 | if not t.smooth and y2 ~=nil then 496 | pat = create_pattern(t.alarm_colour,t.alarm_led,false) 497 | cairo_set_source(cr,pat) 498 | cairo_rectangle(cr,0,y1,t.width,y2-y1) 499 | cairo_fill(cr) 500 | y3=y2 501 | cairo_pattern_destroy(pat) 502 | else 503 | y2,y3=y1,y1 504 | end 505 | -- block for bg value 506 | cairo_rectangle(cr,0,y2,t.width,-t.height-y3) 507 | pat = create_pattern(t.bg_colour,t.bg_led,true) 508 | cairo_set_source(cr,pat) 509 | cairo_pattern_destroy(pat) 510 | cairo_fill(cr) 511 | end 512 | end --end single bar 513 | 514 | 515 | 516 | 517 | 518 | 519 | local function draw_multi_bar() 520 | --function used for bars with 2 or more blocks 521 | for pt = 1,t.blocks do 522 | --set block y 523 | local y1 = -(pt-1)*(t.height+t.space) 524 | local light_on=false 525 | 526 | --set colors 527 | local col_alp = t.bg_colour 528 | local col_led = t.bg_led 529 | if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block 530 | if pct>=(pcb*(pt-1)) then 531 | light_on = true 532 | col_alp = t.fg_colour 533 | col_led = t.fg_led 534 | if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then 535 | col_alp = t.alarm_colour 536 | col_led = t.alarm_led 537 | end 538 | end 539 | end 540 | 541 | --set colors 542 | --have to try to create gradients outside the loop ? 543 | local pat 544 | 545 | if not t.smooth then 546 | if t.angle_bar==0 then 547 | if t.led_effect=="e" then 548 | pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led) 549 | elseif t.led_effect=="a" then 550 | pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led) 551 | elseif t.led_effect=="r" then 552 | pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2) 553 | else 554 | pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp)) 555 | end 556 | else 557 | if t.led_effect=="a" then 558 | pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1), 559 | 0, 0, t.radius+(t.height+t.space)*(pt), 560 | col_alp,col_led,3) 561 | else 562 | pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp)) 563 | end 564 | 565 | end 566 | else 567 | 568 | if light_on then 569 | if t.angle_bar==0 then 570 | pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space)) 571 | else 572 | pat = create_smooth_radial_gradient(0, 0, (t.height+t.space), 0,0,(t.blocks+1)*(t.height+t.space),2) 573 | end 574 | else 575 | pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour)) 576 | end 577 | end 578 | cairo_set_source (cr, pat) 579 | cairo_pattern_destroy(pat) 580 | 581 | --draw a block 582 | if t.angle_bar==0 then 583 | cairo_move_to(cr,0,y1) 584 | cairo_line_to(cr,t.width,y1) 585 | else 586 | cairo_arc( cr,0,0, 587 | t.radius+(t.height+t.space)*(pt)-t.height/2, 588 | -t.angle_bar -math.pi/2 , 589 | t.angle_bar -math.pi/2) 590 | end 591 | cairo_stroke(cr) 592 | end 593 | end 594 | 595 | 596 | 597 | 598 | local function setup_bar_graph() 599 | --function used to retrieve the value to display and to set the cairo structure 600 | if t.blocks ~=1 then t.y=t.y-t.height/2 end 601 | 602 | local value = 0 603 | if t.name ~="" then 604 | value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg))) 605 | --$to_bytes doesn't work when value has a decimal point, 606 | --https://garage.maemo.org/plugins/ggit/browse.php/?p=monky;a=commitdiff;h=174c256c81a027a2ea406f5f37dc036fac0a524b;hp=d75e2db5ed3fc788fb8514121f67316ac3e5f29f 607 | --http://sourceforge.net/tracker/index.php?func=detail&aid=3000865&group_id=143975&atid=757310 608 | --conky bug? 609 | --value = (conky_parse(string.format('${%s %s}', t.name, t.arg))) 610 | --if string.match(value,"%w") then 611 | -- value = conky_parse(string.format('${to_bytes %s}',value)) 612 | --end 613 | else 614 | value = tonumber(t.arg) 615 | end 616 | 617 | if value==nil then value =0 end 618 | 619 | pct = 100*value/t.max 620 | pcb = 100/t.blocks 621 | 622 | cairo_set_line_width (cr, t.height) 623 | cairo_set_line_cap (cr, cap) 624 | cairo_translate(cr,t.x,t.y) 625 | cairo_rotate(cr,t.angle) 626 | 627 | local matrix0 = cairo_matrix_t:create() 628 | tolua.takeownership(matrix0) 629 | cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0) 630 | cairo_transform(cr,matrix0) 631 | 632 | 633 | 634 | --call the drawing function for blocks 635 | if t.blocks==1 and t.angle_bar==0 then 636 | draw_single_bar() 637 | if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end 638 | else 639 | draw_multi_bar() 640 | end 641 | 642 | --dot for reminder 643 | --[[ 644 | if t.blocks ~=1 then 645 | cairo_set_source_rgba(cr,1,0,0,1) 646 | cairo_arc(cr,0,t.height/2,3,0,2*math.pi) 647 | cairo_fill(cr) 648 | else 649 | cairo_set_source_rgba(cr,1,0,0,1) 650 | cairo_arc(cr,0,0,3,0,2*math.pi) 651 | cairo_fill(cr) 652 | end]] 653 | 654 | --call the drawing function for reflection and prepare the mask used 655 | if t.reflection_alpha>0 and t.angle_bar==0 then 656 | local pat2 657 | local matrix1 = cairo_matrix_t:create() 658 | tolua.takeownership(matrix1) 659 | if t.angle_bar==0 then 660 | pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)} 661 | if t.reflection=="t" then 662 | cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2) 663 | pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2) 664 | elseif t.reflection=="r" then 665 | cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0) 666 | pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0) 667 | elseif t.reflection=="l" then 668 | cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0) 669 | pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0) 670 | else --bottom 671 | cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2) 672 | pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks)) 673 | end 674 | end 675 | cairo_transform(cr,matrix1) 676 | 677 | if t.blocks==1 and t.angle_bar==0 then 678 | draw_single_bar() 679 | cairo_translate(cr,0,-t.height/2) 680 | else 681 | draw_multi_bar() 682 | end 683 | 684 | 685 | cairo_set_line_width(cr,0.01) 686 | cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha) 687 | cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1) 688 | if t.angle_bar==0 then 689 | cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4]) 690 | end 691 | cairo_clip_preserve(cr) 692 | cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR) 693 | cairo_stroke(cr) 694 | cairo_mask(cr,pat2) 695 | cairo_pattern_destroy(pat2) 696 | cairo_set_operator(cr,CAIRO_OPERATOR_OVER) 697 | 698 | end --reflection 699 | pct,pcb=nil 700 | end --setup_bar_graph() 701 | 702 | --start here ! 703 | setup_bar_graph() 704 | cairo_restore(cr) 705 | end 706 | -------------------------------------------------------------------------------- /scripts/horizontal_calendar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # a script to display a horizontal calendar on conky (hence the name horical :D) 3 | # if you need to ask something, contact me via email nhianho@gmail.com 4 | TODAY=`date +%d` 5 | TOPLINE=" " 6 | OVER=" " 7 | REST=" " 8 | # -------- This part is to find out the number of days in a month to display-----------# 9 | a=`date +%-Y` 10 | e1=`expr $a % 400` 11 | e2=`expr $a % 100` 12 | e3=`expr $a % 4` 13 | if [ $e1 == 0 ] 14 | then c=1 15 | elif [ $e2 == 0 ] 16 | then c=0 17 | elif [ $e3 == 0 ] 18 | then c=1 19 | else c=0 20 | fi 21 | p=`date +%-m` 22 | # if the current year is not a leap one, c = 0 23 | if [ $c == 0 ] 24 | then 25 | if [ $p == 2 ] 26 | then b=28 # this is the number of days in Febuary 27 | elif [ $p == 11 ] || [ $p == 4 ] || [ $p == 6 ] || [ $p == 9 ] 28 | then b=30 29 | else b=31 30 | fi 31 | else 32 | if [ $p == 2 ] 33 | then b=29 # the number of days in Febuary in a leap year 34 | elif [ $p == 11 ] || [ $p == 4 ] || [ $p == 6 ] || [ $p == 9 ] 35 | then b=30 36 | else b=31 37 | fi 38 | fi 39 | #--------------------- The bottom line which displays the days of month ----------# 40 | i=1 41 | if [ $TODAY -ne 1 ] 42 | then 43 | while [ $i -lt $TODAY ]; do 44 | if [ $i -lt 10 ] 45 | then 46 | OVER="$OVER 0$i" 47 | else 48 | OVER="$OVER $i" 49 | fi 50 | i=$[$i+1] 51 | done 52 | fi 53 | i=$[$i+1] 54 | if [ $TODAY -ne $b ] 55 | then 56 | while [ $i -ne $[$b] ]; do 57 | if [ $i -lt 10 ] 58 | then 59 | REST="$REST 0$i" 60 | else 61 | REST="$REST $i" 62 | fi 63 | i=$[$i+1] 64 | done 65 | REST="$REST $b" 66 | fi 67 | #------------- the top line which displays the abbreviated weekday names-------# 68 | k=`date +%u` 69 | j=`date +%e` 70 | f=`expr $j % 7` 71 | if [ $k -lt $f ] 72 | then 73 | y=$[$k+8-$f] 74 | else 75 | y=$[$k-$f+1] 76 | fi 77 | while [ $b -gt -0 ]; do 78 | case "$y" in 79 | 1) TOPLINE="$TOPLINE Mo";; 80 | 2) TOPLINE="$TOPLINE Tu";; 81 | 3) TOPLINE="$TOPLINE We";; 82 | 4) TOPLINE="$TOPLINE Th";; 83 | 5) TOPLINE="$TOPLINE Fr";; 84 | 6) TOPLINE="$TOPLINE Sa";; 85 | 7) TOPLINE="$TOPLINE Su";; 86 | esac 87 | b=$[$b-1] 88 | y=$[$y+1] 89 | if [ $y -eq 8 ] 90 | then 91 | y=1 92 | fi 93 | done 94 | echo '${goto 930}''${font mono:size=12}'$TOPLINE | sed 's/Su/${color cf5160}Su${color}/g' 95 | echo '${goto 930}''${font mono:bold:size=12}''${color 56696F}'$OVER '${color 985d50}'$TODAY'${color 56696F}'$REST 96 | -------------------------------------------------------------------------------- /scripts/ip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl "https://api.ipify.org/?format=raw" 4 | --------------------------------------------------------------------------------