system resources widget: Make screens it appears on configurable

This commit is contained in:
Alice Gaudon 2019-08-11 23:12:27 +02:00
parent 64d7e9a7b0
commit c9c5755a26
2 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,7 @@ config.windowSwitcher = "rofi -show window -config " .. awful.util.getdir("confi
config.volume_osd_timeout = 2 config.volume_osd_timeout = 2
-- System resources widget -- System resources widget
config.system_resources_widget_screens = { 1, 2 }
config.system_resources_widget_refresh_interval = 1.5 -- In seconds config.system_resources_widget_refresh_interval = 1.5 -- In seconds

11
rc.lua
View File

@ -300,6 +300,15 @@ awful.screen.connect_for_each_screen(function(s)
height = 32 height = 32
}) })
function matchesScreen(screens)
for _, allowedScreen in ipairs(screens) do
if allowedScreen == s.index then
return true
end
end
return false
end
-- Add widgets to the wibox -- Add widgets to the wibox
s.mywibox:setup { s.mywibox:setup {
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
@ -311,7 +320,7 @@ awful.screen.connect_for_each_screen(function(s)
}, },
s.mytasklist, -- Middle widget s.mytasklist, -- Middle widget
{ -- Right widgets { -- Right widgets
s.index == 2 and system_resources_widget.widget or nil, matchesScreen(config.system_resources_widget_screens) and system_resources_widget.widget or nil,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
mykeyboardlayout, mykeyboardlayout,
wibox.widget.systray(), wibox.widget.systray(),