[awesome] add lain widgets

This commit is contained in:
Simon Bruder 2019-02-16 21:06:02 +00:00
parent 076196acc0
commit 36611ec0a4
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
12 changed files with 76 additions and 17 deletions

3
.gitmodules vendored
View file

@ -10,3 +10,6 @@
[submodule "home/.nvm"]
path = nvm
url = https://github.com/creationix/nvm
[submodule "home/.config/awesome/lain"]
path = home/.config/awesome/lain
url = https://github.com/lcpz/lain

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -0,0 +1 @@
Subproject commit 013654cd1af4bb69f31c1c641cdb24bd8b7c58df

View file

@ -14,6 +14,10 @@ local hotkeys_popup = require("awful.hotkeys_popup").widget
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
local lain = require("lain")
local widgets = require("widgets")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
@ -199,10 +203,18 @@ awful.screen.connect_for_each_screen(function(s)
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
wibox.widget.systray(),
require("battery"),
require("divider"),
require("sensors"),
require("divider"),
widgets.netdown_icon,
widgets.netdown.widget,
widgets.netup_icon,
widgets.netup.widget,
widgets.mem_icon,
widgets.mem.widget,
widgets.cpu_icon,
widgets.cpu.widget,
widgets.temp_icon,
widgets.temp.widget,
widgets.bat_icon,
widgets.bat.widget,
mytextclock,
s.mylayoutbox,
},

View file

@ -49,11 +49,8 @@ theme.border_width = dpi(0)
theme.border_normal = "#000000"
theme.border_focus = "#535d6c"
theme.wibar_height = 21
theme.tasklist_disable_icon = true
-- Hotkeys popup (Mod+s)
theme.hotkeys_font = "Iosevka sbruder Bold 10"
theme.hotkeys_description_font = "Iosevka sbruder 10"
theme.hotkeys_modifiers_fg = theme.fg_normal
@ -64,7 +61,6 @@ theme.wallpaper = function(s)
end
end
-- Generate taglist squares:
local taglist_square_size = dpi(4)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
taglist_square_size, theme.fg_normal
@ -73,7 +69,6 @@ theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.fg_normal
)
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path .. "default/layouts/fairhw.png"
theme.layout_fairv = themes_path .. "default/layouts/fairvw.png"
theme.layout_floating = themes_path .. "default/layouts/floatingw.png"

View file

@ -1,13 +1,5 @@
local utils = {}
function utils.readfile(command)
local file = io.open(command)
if not file then return nil end
local text = file:read('*all')
file:close()
return text:gsub("^%s*(.-)%s*$", "%1")
end
function utils.file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end

View file

@ -0,0 +1,56 @@
local wibox = require("wibox")
local lain = require("lain")
local markup = lain.util.markup
local theme = require("theme")
local gfs = require("gears.filesystem")
local iconsdir = gfs.get_configuration_dir() .. "icons/"
local widgets = {}
widgets.netdown_icon = wibox.widget.imagebox(iconsdir .. "down.png")
widgets.netdown = lain.widget.net({
settings = function()
widget:set_markup(markup.fontfg(theme.font, theme.colors.green, math.floor(net_now.received+0.5) .. "KiB/s "))
end
})
widgets.netup_icon = wibox.widget.imagebox(iconsdir .. "up.png")
widgets.netup = lain.widget.net({
settings = function()
widget:set_markup(markup.fontfg(theme.font, theme.colors.red, math.floor(net_now.sent+0.5) .. "KiB/s "))
end
})
widgets.mem_icon = wibox.widget.imagebox(iconsdir .. "mem.png")
widgets.mem = lain.widget.mem({
settings = function()
widget:set_markup(markup.fontfg(theme.font, theme.colors.yellow, mem_now.perc .. "% "))
end
})
widgets.cpu_icon = wibox.widget.imagebox(iconsdir .. "cpu.png")
widgets.cpu = lain.widget.cpu({
settings = function()
widget:set_markup(markup.fontfg(theme.font, theme.colors.cyan, cpu_now.usage .. "% "))
end
})
widgets.temp_icon = wibox.widget.imagebox(iconsdir .. "temp.png")
widgets.temp = lain.widget.temp({
settings = function()
widget:set_markup(markup.fontfg(theme.font, theme.colors.magenta, math.floor(coretemp_now) .. "°C "))
end
})
widgets.bat_icon = wibox.widget.imagebox(iconsdir .. "bat.png")
widgets.bat = lain.widget.bat({
settings = function()
state = bat_now.ac_status == 0 and "D" or "C"
widget:set_markup(markup.fontfg(theme.font, theme.fg_normal, state .. bat_now.perc))
end
})
return widgets