diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-07-12 15:45:45 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-07-12 15:45:45 -0300 |
commit | e5b5be048c087e04bd504d4c13a48317d7a45915 (patch) | |
tree | b18e8b9e75c148fc4a353b5b1da15ca849a8ddc6 /config.dot/awesome.link/widgets.lua | |
parent | 1d37c3c4cfd5c554ea018c9ff38ab4f4e9f3dae8 (diff) | |
download | awesome-e5b5be048c087e04bd504d4c13a48317d7a45915.tar.gz awesome-e5b5be048c087e04bd504d4c13a48317d7a45915.tar.bz2 |
Refactor for 4.x compatibility
Diffstat (limited to 'config.dot/awesome.link/widgets.lua')
-rw-r--r-- | config.dot/awesome.link/widgets.lua | 236 |
1 files changed, 0 insertions, 236 deletions
diff --git a/config.dot/awesome.link/widgets.lua b/config.dot/awesome.link/widgets.lua deleted file mode 100644 index 7cea6fd..0000000 --- a/config.dot/awesome.link/widgets.lua +++ /dev/null @@ -1,236 +0,0 @@ --- {{{ Misc widgets -dofile(configdir .. "/widgets/leds.lua") -dofile(configdir .. "/widgets/volume.lua") - -if awful.util.file_readable(homedir .. "/.custom/awesome/awesompd.lua") then - awesompd = true - dofile(configdir .. "/widgets/awesompd.lua") -end --- }}} - ---{{---| Text clock widget |------------------------------------------------------------------------------ - -mytextclock = awful.widget.textclock({ align = "right" }) - ---{{---| Systray widget |------------------------------------------------------------------------------ - -mysystray = widget({ type = "systray" }) - ---{{---| Chat widget |------------------------------------------------------------------------------ - -chaticon = widget ({type = "imagebox" }) -chaticon.image = image(beautiful.widget_chat) -chaticon:buttons(awful.util.table.join(awful.button({ }, 1, -function () awful.util.spawn_with_shell(chat) end))) - ---{{---| Mail widget |------------------------------------------------------------------------------ - -mailicon = widget ({type = "imagebox" }) -mailicon.image = image(beautiful.widget_mail) -mailicon:buttons(awful.util.table.join(awful.button({ }, 1, -function () awful.util.spawn_with_shell(mailmutt) end))) - ---{{---| Music widget |----------------------------------------------------------------------------- - -music = widget ({type = "imagebox" }) -music.image = image(beautiful.widget_music) -music:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.util.spawn_with_shell(musicplr) end), - awful.button({ modkey }, 1, function () awful.util.spawn_with_shell("ncmpcpp toggle") end), - awful.button({ }, 3, function () couth.notifier:notify( couth.alsa:setVolume('Master','toggle')) end), - awful.button({ }, 4, function () couth.notifier:notify( couth.alsa:setVolume('PCM','2dB+')) end), - awful.button({ }, 5, function () couth.notifier:notify( couth.alsa:setVolume('PCM','2dB-')) end), - awful.button({ }, 4, function () couth.notifier:notify( couth.alsa:setVolume('Master','2dB+')) end), - awful.button({ }, 5, function () couth.notifier:notify( couth.alsa:setVolume('Master','2dB-')) end))) - ---{{---| TaskWarrior widget |----------------------------------------------------------------------- - ---task_warrior = blingbling.task_warrior.new(beautiful.widget_task) ---task_warrior:set_task_done_icon(beautiful.task_done_icon) ---task_warrior:set_task_icon(beautiful.task_icon) ---task_warrior:set_project_icon(beautiful.project_icon) - ---{{---| MEM widget |------------------------------------------------------------------------------- - -memwidget = widget({ type = "textbox" }) -vicious.register(memwidget, vicious.widgets.mem, '<span background="#777E76" font="Terminus 12"> <span font="Terminus 9" color="#EEEEEE" background="#777E76">$2MB </span></span>', 13) -memicon = widget ({type = "imagebox" }) -memicon.image = image(beautiful.widget_mem) - ---{{---| CPU / sensors widget |--------------------------------------------------------------------- - ---cpuwidget = widget({ type = "textbox" }) ---vicious.register(cpuwidget, vicious.widgets.cpu, ---'<span background="#4B696D" font="Terminus 12"> <span font="Terminus 9" color="#DDDDDD">$2% <span color="#888888">·</span> $3% </span></span>', 3) ---cpuicon = widget ({type = "imagebox" }) ---cpuicon.image = image(beautiful.widget_cpu) ---sensors = widget({ type = "textbox" }) ---vicious.register(sensors, vicious.widgets.sensors) ---tempicon = widget ({type = "imagebox" }) ---tempicon.image = image(beautiful.widget_temp) ---blingbling.popups.htop(cpuwidget, ---{ title_color = beautiful.notify_font_color_1, ---user_color = beautiful.notify_font_color_2, ---root_color = beautiful.notify_font_color_3, ---terminal = "terminal --geometry=130x56-10+26"}) - ---{{---| FS's widget / udisks-glue menu |----------------------------------------------------------- - ---fswidget = widget({ type = "textbox" }) ---vicious.register(fswidget, vicious.widgets.fs, ---'<span background="#D0785D" font="Terminus 12"> <span font="Terminus 9" color="#EEEEEE">${/mnt/storage avail_gb}GB </span></span>', 8) ---udisks_glue = blingbling.udisks_glue.new(beautiful.widget_hdd) ---udisks_glue:set_mount_icon(beautiful.accept) ---udisks_glue:set_umount_icon(beautiful.cancel) ---udisks_glue:set_detach_icon(beautiful.cancel) ---udisks_glue:set_Usb_icon(beautiful.usb) ---udisks_glue:set_Cdrom_icon(beautiful.cdrom) ---awful.widget.layout.margins[udisks_glue.widget] = { top = 0} ---udisks_glue.widget.resize = false - ---{{---| Battery widget |--------------------------------------------------------------------------- - -baticon = widget ({type = "imagebox" }) -baticon.image = image(beautiful.widget_battery) -batwidget = widget({ type = "textbox" }) -vicious.register( batwidget, vicious.widgets.bat, '<span background="#92B0A0" font="Terminus 12"> <span font="Terminus 9" color="#FFFFFF" background="#92B0A0">$1$2% </span></span>', 1, "BAT0" ) - ---{{---| Net widget |------------------------------------------------------------------------------- - -netwidget = widget({ type = "textbox" }) -vicious.register(netwidget, -vicious.widgets.net, -'<span background="#C2C2A4" font="Terminus 12"> <span font="Terminus 9" color="#FFFFFF">${eth0 down_kb} ↓↑ ${eth0 up_kb}</span> </span>', 3) -neticon = widget ({type = "imagebox" }) -neticon.image = image(beautiful.widget_net) -netwidget:buttons(awful.util.table.join(awful.button({ }, 1, -function () awful.util.spawn_with_shell(iptraf) end))) - ---{{---| Normal clock |------------------------------------------------------------------------------- - -clockwidget = widget({ type = "textbox" }) -vicious.register(clockwidget, vicious.widgets.date, -'<span background="#777e76" font="Terminus 12"> <span font="Terminus 9" color="#FFFFFF">%d/%m/%Y %H:%M</span> </span>', 3) - ---{{---| Binary Clock |----------------------------------------------------------------------------- - -binaryclock = {} -binaryclock.widget = widget({type = "imagebox"}) -binaryclock.w = 42 -binaryclock.h = 16 -binaryclock.show_sec = true -binaryclock.color_active = beautiful.binclock_fga -binaryclock.color_bg = beautiful.binclock_bg -binaryclock.color_inactive = beautiful.binclock_fgi -binaryclock.dotsize = math.floor(binaryclock.h / 5) -binaryclock.step = math.floor(binaryclock.dotsize / 3) -binaryclock.widget.image = image.argb32(binaryclock.w, binaryclock.h, nil) -if (binaryclock.show_sec) then binaryclock.timeout = 1 else binaryclock.timeout = 20 end -binaryclock.DEC_BIN = function(IN) -local B,K,OUT,I,D=2,"01","",0 -while IN>0 do -I=I+1 -IN,D=math.floor(IN/B),math.mod(IN,B)+1 -OUT=string.sub(K,D,D)..OUT -end -return OUT -end -binaryclock.paintdot = function(val,shift,limit) -local binval = binaryclock.DEC_BIN(val) -local l = string.len(binval) -local height = 0 -if (l < limit) then -for i=1,limit - l do binval = "0" .. binval end -end -for i=0,limit-1 do -if (string.sub(binval,limit-i,limit-i) == "1") then -binaryclock.widget.image:draw_rectangle(shift, -binaryclock.h - binaryclock.dotsize - height, -binaryclock.dotsize, binaryclock.dotsize, true, binaryclock.color_active) -else -binaryclock.widget.image:draw_rectangle(shift, -binaryclock.h - binaryclock.dotsize - height, -binaryclock.dotsize,binaryclock.dotsize, true, binaryclock.color_inactive) -end -height = height + binaryclock.dotsize + binaryclock.step -end -end -binaryclock.drawclock = function () -binaryclock.widget.image:draw_rectangle(0, 0, binaryclock.w, binaryclock.h, true, binaryclock.color_bg) -local t = os.date("*t") -local hour = t.hour -if (string.len(hour) == 1) then -hour = "0" .. t.hour -end -local min = t.min -if (string.len(min) == 1) then -min = "0" .. t.min -end -local sec = t.sec -if (string.len(sec) == 1) then -sec = "0" .. t.sec -end -local col_count = 6 -if (not binaryclock.show_sec) then col_count = 4 end -local step = math.floor((binaryclock.w - col_count * binaryclock.dotsize) / 8) -binaryclock.paintdot(0 + string.sub(hour, 1, 1), step, 2) -binaryclock.paintdot(0 + string.sub(hour, 2, 2), binaryclock.dotsize + 2 * step, 4) -binaryclock.paintdot(0 + string.sub(min, 1, 1),binaryclock.dotsize * 2 + 4 * step, 3) -binaryclock.paintdot(0 + string.sub(min, 2, 2),binaryclock.dotsize * 3 + 5 * step, 4) -if (binaryclock.show_sec) then -binaryclock.paintdot(0 + string.sub(sec, 1, 1), binaryclock.dotsize * 4 + 7 * step, 3) -binaryclock.paintdot(0 + string.sub(sec, 2, 2), binaryclock.dotsize * 5 + 8 * step, 4) -end -binaryclock.widget.image = binaryclock.widget.image -end -binarytimer = timer { timeout = binaryclock.timeout } -binarytimer:add_signal("timeout", function() -binaryclock.drawclock() -end) -binarytimer:start() - --- binaryclock.widget:buttons(awful.util.table.join( --- awful.button({ }, 1, function () --- end) --- )) - ---{{---| Calendar widget |-------------------------------------------------------------------------- - --- my_cal = blingbling.calendar.new({type = "imagebox", image = beautiful.widget_cal}) --- my_cal:set_cell_padding(4) --- my_cal:set_title_font_size(9) --- my_cal:set_title_text_color("#4F98C1") --- my_cal:set_font_size(9) --- my_cal:set_inter_margin(1) --- my_cal:set_columns_lines_titles_font_size(8) --- my_cal:set_columns_lines_titles_text_color("#d4aa00ff") --- my_cal:set_link_to_external_calendar(true) --{{ <-- popup reminder - ---{{---| Separators widgets |----------------------------------------------------------------------- - -spr = widget({ type = "textbox" }) -spr.text = ' ' -sprd = widget({ type = "textbox" }) -sprd.text = '<span background="#313131" font="Terminus 12"> </span>' -spr3f = widget({ type = "textbox" }) -spr3f.text = '<span background="#777e76" font="Terminus 12"> </span>' -arr1 = widget ({type = "imagebox" }) -arr1.image = image(beautiful.arr1) -arr2 = widget ({type = "imagebox" }) -arr2.image = image(beautiful.arr2) -arr3 = widget ({type = "imagebox" }) -arr3.image = image(beautiful.arr3) -arr4 = widget ({type = "imagebox" }) -arr4.image = image(beautiful.arr4) -arr5 = widget ({type = "imagebox" }) -arr5.image = image(beautiful.arr5) -arr6 = widget ({type = "imagebox" }) -arr6.image = image(beautiful.arr6) -arr7 = widget ({type = "imagebox" }) -arr7.image = image(beautiful.arr7) -arr8 = widget ({type = "imagebox" }) -arr8.image = image(beautiful.arr8) -arr9 = widget ({type = "imagebox" }) -arr9.image = image(beautiful.arr9) -arr0 = widget ({type = "imagebox" }) -arr0.image = image(beautiful.arr0) |