diff --git a/awesome/icons/ac.png b/awesome/icons/ac.png deleted file mode 100755 index 272b832..0000000 Binary files a/awesome/icons/ac.png and /dev/null differ diff --git a/awesome/icons/bat.png b/awesome/icons/bat.png deleted file mode 100755 index bd63927..0000000 Binary files a/awesome/icons/bat.png and /dev/null differ diff --git a/awesome/icons/clock.png b/awesome/icons/clock.png deleted file mode 100755 index 22aef71..0000000 Binary files a/awesome/icons/clock.png and /dev/null differ diff --git a/awesome/icons/cpu.png b/awesome/icons/cpu.png deleted file mode 100755 index e3794ca..0000000 Binary files a/awesome/icons/cpu.png and /dev/null differ diff --git a/awesome/icons/dish.png b/awesome/icons/dish.png deleted file mode 100755 index c71499b..0000000 Binary files a/awesome/icons/dish.png and /dev/null differ diff --git a/awesome/icons/fs.png b/awesome/icons/fs.png deleted file mode 100755 index 1c1b13e..0000000 Binary files a/awesome/icons/fs.png and /dev/null differ diff --git a/awesome/icons/info/batcharge.png b/awesome/icons/info/batcharge.png new file mode 100644 index 0000000..ece4511 Binary files /dev/null and b/awesome/icons/info/batcharge.png differ diff --git a/awesome/icons/info/batempty.png b/awesome/icons/info/batempty.png new file mode 100644 index 0000000..0af7a1c Binary files /dev/null and b/awesome/icons/info/batempty.png differ diff --git a/awesome/icons/info/batfull.png b/awesome/icons/info/batfull.png new file mode 100644 index 0000000..c493bcd Binary files /dev/null and b/awesome/icons/info/batfull.png differ diff --git a/awesome/icons/info/bathigh.png b/awesome/icons/info/bathigh.png new file mode 100644 index 0000000..3e58940 Binary files /dev/null and b/awesome/icons/info/bathigh.png differ diff --git a/awesome/icons/info/batlow.png b/awesome/icons/info/batlow.png new file mode 100644 index 0000000..ef936fb Binary files /dev/null and b/awesome/icons/info/batlow.png differ diff --git a/awesome/icons/info/batmid.png b/awesome/icons/info/batmid.png new file mode 100644 index 0000000..9a97f3d Binary files /dev/null and b/awesome/icons/info/batmid.png differ diff --git a/awesome/icons/info/cpu.png b/awesome/icons/info/cpu.png new file mode 100644 index 0000000..1a55bc0 Binary files /dev/null and b/awesome/icons/info/cpu.png differ diff --git a/awesome/icons/info/download.png b/awesome/icons/info/download.png new file mode 100644 index 0000000..d998083 Binary files /dev/null and b/awesome/icons/info/download.png differ diff --git a/awesome/icons/info/mem.png b/awesome/icons/info/mem.png new file mode 100644 index 0000000..d0af32f Binary files /dev/null and b/awesome/icons/info/mem.png differ diff --git a/awesome/icons/info/upload.png b/awesome/icons/info/upload.png new file mode 100644 index 0000000..c7ffe52 Binary files /dev/null and b/awesome/icons/info/upload.png differ diff --git a/awesome/icons/info/volhigh.png b/awesome/icons/info/volhigh.png new file mode 100644 index 0000000..16a6196 Binary files /dev/null and b/awesome/icons/info/volhigh.png differ diff --git a/awesome/icons/info/vollow.png b/awesome/icons/info/vollow.png new file mode 100644 index 0000000..379e3f3 Binary files /dev/null and b/awesome/icons/info/vollow.png differ diff --git a/awesome/icons/info/volmute.png b/awesome/icons/info/volmute.png new file mode 100644 index 0000000..24e6cde Binary files /dev/null and b/awesome/icons/info/volmute.png differ diff --git a/awesome/icons/mail.png b/awesome/icons/mail.png deleted file mode 100755 index 25021f5..0000000 Binary files a/awesome/icons/mail.png and /dev/null differ diff --git a/awesome/icons/mem.png b/awesome/icons/mem.png deleted file mode 100755 index d04ee11..0000000 Binary files a/awesome/icons/mem.png and /dev/null differ diff --git a/awesome/icons/net_down.png b/awesome/icons/net_down.png deleted file mode 100755 index 09433b1..0000000 Binary files a/awesome/icons/net_down.png and /dev/null differ diff --git a/awesome/icons/net_up.png b/awesome/icons/net_up.png deleted file mode 100755 index 395d014..0000000 Binary files a/awesome/icons/net_up.png and /dev/null differ diff --git a/awesome/icons/note.png b/awesome/icons/note.png deleted file mode 100755 index 2f41eb3..0000000 Binary files a/awesome/icons/note.png and /dev/null differ diff --git a/awesome/icons/note_on.png b/awesome/icons/note_on.png deleted file mode 100755 index 264d2c8..0000000 Binary files a/awesome/icons/note_on.png and /dev/null differ diff --git a/awesome/icons/spkr.png b/awesome/icons/spkr.png deleted file mode 100755 index 80c20b0..0000000 Binary files a/awesome/icons/spkr.png and /dev/null differ diff --git a/awesome/icons/svgs/batcharge.svg b/awesome/icons/svgs/batcharge.svg new file mode 100644 index 0000000..5339947 --- /dev/null +++ b/awesome/icons/svgs/batcharge.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/batempty.svg b/awesome/icons/svgs/batempty.svg new file mode 100644 index 0000000..75c8e32 --- /dev/null +++ b/awesome/icons/svgs/batempty.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/batfull.svg b/awesome/icons/svgs/batfull.svg new file mode 100644 index 0000000..8f148ce --- /dev/null +++ b/awesome/icons/svgs/batfull.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/bathigh.svg b/awesome/icons/svgs/bathigh.svg new file mode 100644 index 0000000..dceb31f --- /dev/null +++ b/awesome/icons/svgs/bathigh.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/batlow.svg b/awesome/icons/svgs/batlow.svg new file mode 100644 index 0000000..d67f0f3 --- /dev/null +++ b/awesome/icons/svgs/batlow.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/batmid.svg b/awesome/icons/svgs/batmid.svg new file mode 100644 index 0000000..ee4a497 --- /dev/null +++ b/awesome/icons/svgs/batmid.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/cpu.svg b/awesome/icons/svgs/cpu.svg new file mode 100644 index 0000000..9c82de5 --- /dev/null +++ b/awesome/icons/svgs/cpu.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/download.svg b/awesome/icons/svgs/download.svg new file mode 100644 index 0000000..6829959 --- /dev/null +++ b/awesome/icons/svgs/download.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/mem.svg b/awesome/icons/svgs/mem.svg new file mode 100644 index 0000000..e15b96a --- /dev/null +++ b/awesome/icons/svgs/mem.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/svg_to_png.py b/awesome/icons/svgs/svg_to_png.py new file mode 100755 index 0000000..7ce9bc5 --- /dev/null +++ b/awesome/icons/svgs/svg_to_png.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import pathlib +from cairosvg import svg2png +from PIL import Image, ImageOps + +for svg in pathlib.Path('.').glob('*.svg'): + print(f'Converting {svg.name}...', end='') + png = svg.with_suffix('.png') + svg2png(url=str(svg), write_to=str(png), output_width=12, output_height=12) + with Image.open(png) as img: + img.load() + border_img = ImageOps.expand(img, 4, (0, 0, 0, 0)) + border_img.save(png) + print(' Done') diff --git a/awesome/icons/svgs/upload.svg b/awesome/icons/svgs/upload.svg new file mode 100644 index 0000000..44aa945 --- /dev/null +++ b/awesome/icons/svgs/upload.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/volhigh.svg b/awesome/icons/svgs/volhigh.svg new file mode 100644 index 0000000..ae0ff13 --- /dev/null +++ b/awesome/icons/svgs/volhigh.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/vollow.svg b/awesome/icons/svgs/vollow.svg new file mode 100644 index 0000000..59ecfbd --- /dev/null +++ b/awesome/icons/svgs/vollow.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/svgs/volmute.svg b/awesome/icons/svgs/volmute.svg new file mode 100644 index 0000000..9d5b8b8 --- /dev/null +++ b/awesome/icons/svgs/volmute.svg @@ -0,0 +1 @@ + diff --git a/awesome/icons/temp.png b/awesome/icons/temp.png deleted file mode 100755 index 6c8f8bd..0000000 Binary files a/awesome/icons/temp.png and /dev/null differ diff --git a/awesome/theme.lua b/awesome/theme.lua index 2b0347f..8fe6ddf 100644 --- a/awesome/theme.lua +++ b/awesome/theme.lua @@ -54,20 +54,19 @@ theme.menu_fg_normal = '#aaaaaa' theme.menu_fg_focus = '#ff8c00' theme.menu_bg_normal = '#050505dd' theme.menu_bg_focus = '#050505dd' -theme.widget_temp = theme.confdir .. '/icons/temp.png' -theme.widget_uptime = theme.confdir .. '/icons/ac.png' -theme.widget_cpu = theme.confdir .. '/icons/cpu.png' -theme.widget_weather = theme.confdir .. '/icons/dish.png' -theme.widget_fs = theme.confdir .. '/icons/fs.png' -theme.widget_mem = theme.confdir .. '/icons/mem.png' -theme.widget_note = theme.confdir .. '/icons/note.png' -theme.widget_note_on = theme.confdir .. '/icons/note_on.png' -theme.widget_netdown = theme.confdir .. '/icons/net_down.png' -theme.widget_netup = theme.confdir .. '/icons/net_up.png' -theme.widget_mail = theme.confdir .. '/icons/mail.png' -theme.widget_batt = theme.confdir .. '/icons/bat.png' -theme.widget_clock = theme.confdir .. '/icons/clock.png' -theme.widget_vol = theme.confdir .. '/icons/spkr.png' +theme.widget_cpu = theme.confdir .. '/icons/info/cpu.png' +theme.widget_mem = theme.confdir .. '/icons/info/mem.png' +theme.widget_netdown = theme.confdir .. '/icons/info/download.png' +theme.widget_netup = theme.confdir .. '/icons/info/upload.png' +theme.widget_bat_charge = theme.confdir .. '/icons/info/batcharge.png' +theme.widget_bat_empty = theme.confdir .. '/icons/info/batempty.png' +theme.widget_bat_low = theme.confdir .. '/icons/info/batlow.png' +theme.widget_bat_mid = theme.confdir .. '/icons/info/batmid.png' +theme.widget_bat_high = theme.confdir .. '/icons/info/bathigh.png' +theme.widget_bat_full = theme.confdir .. '/icons/info/batfull.png' +theme.widget_vol_mute = theme.confdir .. '/icons/info/volmute.png' +theme.widget_vol_low = theme.confdir .. '/icons/info/vollow.png' +theme.widget_vol_high = theme.confdir .. '/icons/info/volhigh.png' theme.taglist_squares_sel = theme.confdir .. '/icons/square_a.png' theme.taglist_squares_unsel = theme.confdir .. '/icons/square_b.png' theme.tasklist_plain_task_name = true @@ -112,77 +111,65 @@ theme.tasklist_bg_minimize = '#4d4d4d' local markup = lain.util.markup --- Textclock -os.setlocale(os.getenv('LANG')) -- to localize the clock -local clockicon = wibox.widget.imagebox(theme.widget_clock) -local mytextclock = - wibox.widget.textclock(markup('#7788af', '%A %d %B ') .. markup('#ab7367', '>') .. markup('#de5e1e', ' %H:%M ')) -mytextclock.font = theme.font +local function build_widget_list(widgets) + local out = {} + local last_bg = 'alpha' --- Calendar -theme.cal = lain.widget.cal({ - attach_to = { mytextclock }, - notification_preset = { - font = 'Monospace 10', - fg = theme.fg_normal, - bg = theme.bg_normal, - }, -}) + for _, widget in pairs(widgets) do + table.insert(out, lain.util.separators.arrow_left(last_bg, widget.bg)) --- / fs -local fsicon = wibox.widget.imagebox(theme.widget_fs) -theme.fs = lain.widget.fs({ - notification_preset = { font = 'Monospace 10', fg = theme.fg_normal }, - settings = function() - -- luacheck: max line length 150, globals widget fs_now - widget:set_markup( - markup.fontfg( - theme.font, - '#80d9d8', - fs_now['/'].percentage - .. '% (' - .. string.format('%.3f', fs_now['/'].free) - .. ' ' - .. fs_now['/'].units - .. ' left)' - ) - ) - end, -}) -theme.fs.widget:buttons(gears.table.join(awful.button({}, 1, function() - awful.spawn('Thunar') -end))) + local bg_widget = wibox.widget.background(wibox.container.margin(widget.widget, 5, 5), widget.bg) + bg_widget.fg = '#111111' + table.insert(out, bg_widget) --- CPU -local cpuicon = wibox.widget.imagebox(theme.widget_cpu) -local cpu = lain.widget.cpu({ - settings = function() - -- luacheck: globals widget cpu_now - widget:set_markup(markup.fontfg(theme.font, '#e33a6e', cpu_now.usage .. '% ')) - end, -}) + last_bg = widget.bg + end -local optional = {} - --- Coretemp -if settings['show_temp'] == true then - local tempicon = wibox.widget.imagebox(theme.widget_temp) - local temp = lain.widget.temp({ - settings = function() - -- luacheck: globals widget coretemp_now - widget:set_markup(markup.fontfg(theme.font, '#f1af5f', coretemp_now .. '°C ')) - end, - }) - table.insert(optional, tempicon) - table.insert(optional, temp) + return out end --- Battery +local info_widgets = {} + +-- > Net +local netdowninfo = wibox.widget.textbox() +local netupinfo = lain.widget.net({ + settings = function() + -- luacheck: globals widget net_now + widget:set_text(net_now.sent) + netdowninfo:set_text(net_now.received) + end, +}) + +table.insert(info_widgets, { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netdown), netdowninfo), + bg = '#87af5f' +}) +table.insert(info_widgets, { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netup), netupinfo.widget), + bg = '#e54c62' +}) +-- < Net + +-- > Battery if settings['show_battery'] == true then - local baticon = wibox.widget.imagebox(theme.widget_batt) + local baticon = wibox.widget.imagebox(nil) local bat = lain.widget.bat({ settings = function() -- luacheck: globals widget bat_now + if bat_now.ac_status == 1 or bat_now.perc == 'N/A' then + baticon:set_image(theme.widget_bat_charge) + elseif bat_now.perc < 5 then + baticon:set_image(theme.widget_bat_empty) + elseif bat_now.perc < 15 then + baticon:set_image(theme.widget_bat_low) + elseif bat_now.perc < 50 then + baticon:set_image(theme.widget_bat_mid) + elseif bat_now.perc < 95 then + baticon:set_image(theme.widget_bat_high) + else + baticon:set_image(theme.widget_bat_full) + end + local perc = bat_now.perc ~= 'N/A' and bat_now.perc .. '%' or bat_now.perc if bat_now.ac_status == 1 then @@ -192,53 +179,126 @@ if settings['show_battery'] == true then widget:set_markup(markup.fontfg(theme.font, theme.fg_normal, perc .. ' ')) end, }) - table.insert(optional, baticon) - table.insert(optional, bat) + table.insert(info_widgets, { + widget = wibox.layout.fixed.horizontal(baticon, bat.widget), + bg = '#e54c62' + }) end +-- < Battery --- ALSA volume -local volicon = wibox.widget.imagebox(theme.widget_vol) -theme.volume = lain.widget.alsa({ +-- > ALSA volume +local volumeicon = wibox.widget.imagebox(nil) +local volume = lain.widget.alsa({ settings = function() -- luacheck: globals widget volume_now if volume_now.status == 'off' then - volume_now.level = volume_now.level .. 'M' + volumeicon:set_image(theme.widget_vol_mute) + volume_now.level = 'M ' .. volume_now.level + elseif volume_now.level == 0 then + volumeicon:set_image(theme.widget_vol_mute) + elseif volume_now.level <= 50 then + volumeicon:set_image(theme.widget_vol_low) + else + volumeicon:set_image(theme.widget_vol_high) end - widget:set_markup(markup.fontfg(theme.font, '#7493d2', volume_now.level .. '% ')) + widget:set_text(' ' .. volume_now.level .. '%') end, }) -theme.volume.widget:buttons(awful.util.table.join( + +local volumebuttons = awful.util.table.join( + awful.button({}, 1, function() -- left click + os.execute(string.format('%s set %s toggle', volume.cmd, volume.togglechannel or volume.channel)) + volume.update() + end), awful.button({}, 4, function() - os.execute(string.format('%s set %s 1%%+', theme.volume.cmd, theme.volume.channel)) - theme.volume.update() + os.execute(string.format('%s set %s 1%%+', volume.cmd, volume.channel)) + volume.update() end), awful.button({}, 5, function() - os.execute(string.format('%s set %s 1%%-', theme.volume.cmd, theme.volume.channel)) - theme.volume.update() + os.execute(string.format('%s set %s 1%%-', volume.cmd, volume.channel)) + volume.update() end) -)) +) --- Net -local netdownicon = wibox.widget.imagebox(theme.widget_netdown) -local netdowninfo = wibox.widget.textbox() -local netupicon = wibox.widget.imagebox(theme.widget_netup) -local netupinfo = lain.widget.net({ - settings = function() - -- luacheck: globals widget net_now - widget:set_markup(markup.fontfg(theme.font, '#e54c62', net_now.sent .. ' ')) - netdowninfo:set_markup(markup.fontfg(theme.font, '#87af5f', net_now.received .. ' ')) - end, +volume.widget:buttons(volumebuttons) +volumeicon:buttons(volumebuttons) + +table.insert(info_widgets, { + widget = wibox.layout.fixed.horizontal(volumeicon, volume.widget), + bg = '#7493d2' }) +-- < ALSA volume --- MEM -local memicon = wibox.widget.imagebox(theme.widget_mem) +-- > MEM local memory = lain.widget.mem({ settings = function() -- luacheck: globals widget mem_now - widget:set_markup(markup.fontfg(theme.font, '#e0da37', mem_now.used .. 'M ')) + widget:set_text(mem_now.used .. 'M') end, }) +table.insert(info_widgets, { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_mem), memory.widget), + bg = '#e0da37' +}) +-- < MEM + +-- > CPU +local cpu = lain.widget.cpu({ + settings = function() + -- luacheck: globals widget cpu_now + widget:set_markup(cpu_now.usage .. '%') + end, +}) +table.insert(info_widgets, { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_cpu), cpu.widget), + bg = '#e33a6e' +}) +-- < CPU + +-- > fs +local fs = lain.widget.fs({ + notification_preset = { font = 'Monospace 10', fg = theme.fg_normal }, + settings = function() + -- luacheck: max line length 150, globals widget fs_now + widget:set_text( + fs_now['/'].percentage + .. '% (' + .. string.format('%.3f', fs_now['/'].free) + .. ' ' + .. fs_now['/'].units + .. ' left)' + ) + end, +}) +fs.widget:buttons(gears.table.join(awful.button({}, 1, function() + awful.spawn('Thunar') +end))) +table.insert(info_widgets, { + widget = fs.widget, + bg = '#80d9d8' +}) +-- < fs + +-- > Textclock +os.setlocale(os.getenv('LANG')) -- to localize the clock +--local clockicon = wibox.widget.imagebox(theme.widget_clock) +local mytextclock = wibox.widget.textclock('%I:%M %a %d.%m') +mytextclock.font = theme.font + +lain.widget.cal({ + attach_to = { mytextclock }, + notification_preset = { + font = 'Monospace 10', + fg = theme.fg_normal, + bg = theme.bg_normal, + }, +}) +table.insert(info_widgets, { + widget = mytextclock, + bg = '#7788af' +}) +-- < Textclock -- MPD --[[ @@ -271,6 +331,8 @@ theme.mpd = lain.widget.mpd({ ]] -- +local final_info_widgets = build_widget_list(info_widgets) + function theme.at_screen_connect(s) -- Quake application s.quake = lain.util.quake({ app = awful.util.terminal }) @@ -338,7 +400,7 @@ function theme.at_screen_connect(s) widget = wibox.container.background, }, }) - s.mytasklist = wibox.container.margin(s.mytasklist, 20, 20, 1, 1) + s.mytasklist = wibox.container.margin(s.mytasklist, 10, 10, 0, 0) -- Create the wibox s.mywibox = @@ -360,39 +422,9 @@ function theme.at_screen_connect(s) gears.table.join( { -- Right widgets layout = wibox.layout.fixed.horizontal, - wibox.widget.systray(), - --mailicon, - --theme.mail.widget, - { - { - { - layout = wibox.layout.fixed.horizontal, - netdownicon, - netdowninfo, - netupicon, - netupinfo.widget, - }, - halign = 'right', - widget = wibox.container.place, - }, - width = 120, - strategy = 'exact', - layout = wibox.layout.constraint, - }, - volicon, - theme.volume.widget, - memicon, - memory.widget, - cpuicon, - cpu.widget, - fsicon, - theme.fs.widget, + wibox.container.margin(wibox.widget.systray(), 0, 5) }, - optional, - { - clockicon, - mytextclock, - } + final_info_widgets ), }) end