mirror of
https://github.com/elenapan/dotfiles.git
synced 2025-12-31 02:55:01 +08:00
Improve widgets when used with multiple monitors
A dimmed screen mask is added to non primary screens when the widget becomes visible. Affected widgets: - App drawer - Dashboard
This commit is contained in:
parent
2a912fc8fe
commit
6fb36b2df2
4 changed files with 43 additions and 25 deletions
|
|
@ -95,16 +95,25 @@ app_drawer.bg = "#00000000"
|
|||
-- app_drawer.bg = beautiful.app_drawer_bg or x.background or "#111111"
|
||||
app_drawer.fg = beautiful.app_drawer_fg or x.foreground or "#FEFEFE"
|
||||
|
||||
-- Create an container box
|
||||
-- local app_drawer_box = wibox.container.background()
|
||||
-- app_drawer_box.bg = app_drawer.bg
|
||||
-- app_drawer_box.shape = gears.shape.rounded_rect
|
||||
-- app_drawer_box.shape_border_radius = 20
|
||||
-- Add app drawer or mask to each screen
|
||||
for s in screen do
|
||||
if s == screen.primary then
|
||||
s.app_drawer = app_drawer
|
||||
else
|
||||
s.app_drawer = helpers.screen_mask(s, beautiful.lock_screen_bg or beautiful.exit_screen_bg or x.background)
|
||||
end
|
||||
end
|
||||
|
||||
local function set_visibility(v)
|
||||
for s in screen do
|
||||
s.app_drawer.visible = v
|
||||
end
|
||||
end
|
||||
|
||||
local app_drawer_grabber
|
||||
function app_drawer_hide()
|
||||
awful.keygrabber.stop(app_drawer_grabber)
|
||||
app_drawer.visible = false
|
||||
set_visibility(false)
|
||||
end
|
||||
|
||||
function app_drawer_show()
|
||||
|
|
@ -134,7 +143,7 @@ function app_drawer_show()
|
|||
end
|
||||
end)
|
||||
|
||||
app_drawer.visible = true
|
||||
set_visibility(true)
|
||||
end
|
||||
|
||||
app_drawer:buttons(gears.table.join(
|
||||
|
|
|
|||
|
|
@ -16,17 +16,26 @@ local screen_width = awful.screen.focused().geometry.width
|
|||
local screen_height = awful.screen.focused().geometry.height
|
||||
|
||||
-- Create the widget
|
||||
dashboard = wibox({visible = false, ontop = true, type = "dock"})
|
||||
dashboard = wibox({visible = false, ontop = true, type = "dock", screen = screen.primary})
|
||||
awful.placement.maximize(dashboard)
|
||||
|
||||
dashboard.bg = beautiful.dashboard_bg or beautiful.exit_screen_bg or beautiful.wibar_bg or "#111111"
|
||||
dashboard.fg = beautiful.dashboard_fg or beautiful.exit_screen_fg or beautiful.wibar_fg or "#FEFEFE"
|
||||
|
||||
-- Create an container box
|
||||
-- local dashboard_box = wibox.container.background()
|
||||
-- dashboard_box.bg = dashboard.bg
|
||||
-- dashboard_box.shape = gears.shape.rounded_rect
|
||||
-- dashboard_box.shape_border_radius = 20
|
||||
-- Add dashboard or mask to each screen
|
||||
for s in screen do
|
||||
if s == screen.primary then
|
||||
s.dashboard = dashboard
|
||||
else
|
||||
s.dashboard = helpers.screen_mask(s, dashboard.bg)
|
||||
end
|
||||
end
|
||||
|
||||
local function set_visibility(v)
|
||||
for s in screen do
|
||||
s.dashboard.visible = v
|
||||
end
|
||||
end
|
||||
|
||||
dashboard:buttons(gears.table.join(
|
||||
-- Middle click - Hide dashboard
|
||||
|
|
@ -684,7 +693,7 @@ dashboard:setup {
|
|||
local dashboard_grabber
|
||||
function dashboard_hide()
|
||||
awful.keygrabber.stop(dashboard_grabber)
|
||||
dashboard.visible = false
|
||||
set_visibility(false)
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -704,5 +713,5 @@ function dashboard_show()
|
|||
dashboard_hide()
|
||||
end
|
||||
end)
|
||||
dashboard.visible = true
|
||||
set_visibility(true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,15 +28,6 @@ local lock_animation_icon = wibox.widget {
|
|||
-- It will not be visible anywhere.
|
||||
local some_textbox = wibox.widget.textbox()
|
||||
|
||||
-- This function adds blurry mask to a screen
|
||||
local function screen_mask(s)
|
||||
local mask = wibox({visible = false, ontop = true, type = "splash", screen = s})
|
||||
awful.placement.maximize(mask)
|
||||
mask.bg = beautiful.lock_screen_bg or "#21252b"
|
||||
mask.fg = beautiful.lock_screen_fg or "#abb2bf"
|
||||
return mask
|
||||
end
|
||||
|
||||
-- Create the lock screen wibox
|
||||
-- Set the type to "splash" and set all "splash" windows to be blurred in your
|
||||
-- compositor configuration file
|
||||
|
|
@ -51,7 +42,7 @@ for s in screen do
|
|||
if s == screen.primary then
|
||||
s.mylockscreen = lock_screen
|
||||
else
|
||||
s.mylockscreen = screen_mask(s)
|
||||
s.mylockscreen = helpers.screen_mask(s, beautiful.lock_screen_bg or beautiful.exit_screen_bg or x.background)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -436,4 +436,13 @@ function helpers.float_and_resize(c, width, height)
|
|||
c:raise()
|
||||
end
|
||||
|
||||
-- Adds a maximized mask to a screen
|
||||
function helpers.screen_mask(s, bg)
|
||||
local mask = wibox({visible = false, ontop = true, type = "splash", screen = s})
|
||||
awful.placement.maximize(mask)
|
||||
mask.bg = bg
|
||||
return mask
|
||||
end
|
||||
|
||||
|
||||
return helpers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue