Small wibar on second screen

This commit is contained in:
Thomas Forgione 2024-06-22 18:18:46 +02:00
parent e77eb7ac26
commit 2293f28643
1 changed files with 103 additions and 45 deletions

148
rc.lua
View File

@ -259,54 +259,112 @@ awful.screen.connect_for_each_screen(function(s)
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
-- Create the wibox -- Create the wibox
local wibar_width = s.geometry.width / 4
local wibar_height = 15 local wibar_height = 15
s.mywibox = wibox({ if s == screen.primary then
x = s.geometry.x + s.geometry.width - wibar_width, local wibar_width = s.geometry.width / 5
y = s.geometry.y + s.geometry.height - wibar_height, local wibar_height = 15
width = wibar_width, s.mywibox = wibox({
height = wibar_height, x = s.geometry.x + s.geometry.width - wibar_width,
expand = true, y = s.geometry.y + s.geometry.height - wibar_height,
visible = true, width = wibar_width,
ontop = true, height = wibar_height,
screen = s expand = true,
}) visible = true,
ontop = true,
screen = s
})
s.textclock = awful.widget.textclock(" %a %d %b %H:%M ") s.textclock = awful.widget.textclock(" %a %d %b %H:%M ")
calendar({position = "bottom_right"}):attach(s.textclock) calendar({position = "bottom_right"}):attach(s.textclock)
-- Add widgets to the wibox s.mywibox:setup {
s.mywibox:setup { layout = wibox.layout.align.horizontal,
layout = wibox.layout.align.horizontal, { -- Left widgets
{ -- Left widgets layout = wibox.layout.fixed.horizontal,
layout = wibox.layout.fixed.horizontal, -- mylauncher,
-- mylauncher, s.mytaglist,
s.mytaglist, },
}, s.mytasklist, -- Middle widget
s.mytasklist, -- Middle widget { -- Right widgets
{ -- Right widgets layout = wibox.layout.fixed.horizontal,
layout = wibox.layout.fixed.horizontal, -- delimiter,
-- delimiter, -- email_widget.icon,
-- email_widget.icon, -- delimiter2,
-- delimiter2, -- email_widget.widget,
-- email_widget.widget, -- delimiter,
delimiter, ram_widget,
ram_widget, -- delimiter2,
delimiter2, cpu_widget,
cpu_widget, -- delimiter,
delimiter, volume_widget,
volume_widget, -- delimiter2,
-- delimiter2, -- volume_bar_widget,
-- volume_bar_widget, -- delimiter,
delimiter, battery_widget,
battery_widget, -- delimiter,
delimiter, -- mykeyboardlayout,
mykeyboardlayout, wibox.widget.systray(),
wibox.widget.systray(), s.textclock,
s.textclock, s.mylayoutbox,
s.mylayoutbox, },
}, }
} else
-- Light wibox for secondary screen
local wibar_width = 200
s.mywibox = wibox({
x = s.geometry.x + s.geometry.width - wibar_width,
y = s.geometry.y + s.geometry.height - wibar_height,
width = wibar_width,
height = wibar_height,
expand = true,
visible = true,
ontop = true,
screen = s
})
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
-- mylauncher,
s.mytaglist,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
s.mylayoutbox,
},
}
end
s.detect = gears.timer {
timeout = 0.35,
callback = function ()
if (mouse.screen ~= s) or
(mouse.coords().y < s.geometry.y + s.geometry.height - wibar_height)
then
s.mywibox.visible = false
s.detect:stop()
end
end
}
s.enable_wibar = function ()
s.mywibox.visible = true
if not s.detect.started then
s.detect:start()
end
end
s.activation_zone = wibox ({
x = s.geometry.x, y = s.geometry.y + s.geometry.height - 1,
opacity = 0.0, width = s.geometry.width, height = 1,
screen = s, input_passthrough = false, visible = true,
ontop = true, type = "dock",
})
s.activation_zone:connect_signal("mouse::enter", function ()
s.enable_wibar()
end)
-- update_background_widget(s) -- update_background_widget(s)