Better UX

This commit is contained in:
Daan Vanoverloop 2019-10-17 13:13:00 +02:00
parent 6ff1a2241d
commit de1473b8a3
1 changed files with 32 additions and 16 deletions

View File

@ -490,12 +490,12 @@ awful.screen.connect_for_each_screen(function(s)
s.dock_trigger = wibox({ bg = "#00000000", opacity = 0, ontop = true, visible = true }) s.dock_trigger = wibox({ bg = "#00000000", opacity = 0, ontop = true, visible = true })
s.dock_trigger:geometry({ width = 3, height = 3 }) s.dock_trigger:geometry({ width = 3, height = 3 })
s.topwibox:connect_signal("mouse::enter", function() start_switcher() end) s.topwibox:connect_signal("mouse::enter", function() enable_bars() end)
s.topwibox:connect_signal("mouse::leave", function() switcher_timer:again() end) s.topwibox:connect_signal("mouse::leave", function() bar_timer:again() end)
s.bottomwibox:connect_signal("mouse::enter", function() start_switcher() end) s.bottomwibox:connect_signal("mouse::enter", function() enable_bars() end)
s.bottomwibox:connect_signal("mouse::leave", function() switcher_timer:again() end) s.bottomwibox:connect_signal("mouse::leave", function() bar_timer:again() end)
s.dock_trigger:connect_signal("mouse::enter", function() start_switcher() end) s.dock_trigger:connect_signal("mouse::enter", function() enable_bars() end)
s.dock_trigger:connect_signal("mouse::leave", function() switcher_timer:again() end) s.dock_trigger:connect_signal("mouse::leave", function() bar_timer:again() end)
end) end)
-- }}} -- }}}
@ -518,6 +518,9 @@ switcher_layout = awful.layout.suit.fair
switcher_mode = false switcher_mode = false
switcher_timer = timer({ timeout = 1 }) switcher_timer = timer({ timeout = 1 })
switcher_timer:connect_signal("timeout", function () end_switcher() end) switcher_timer:connect_signal("timeout", function () end_switcher() end)
bar_timer = timer({ timeout = 1 })
bar_timer:connect_signal("timeout", function () disable_bars() end)
bar_mode = false
layout_table = {} layout_table = {}
previous_tags = {} previous_tags = {}
@ -534,13 +537,12 @@ function start_switcher ()
tag.selected = true tag.selected = true
end end
-- Enable all bars
for s in screen do for s in screen do
s.topwibox.visible = true
s.bottomwibox.visible = true
for k,v in pairs(s.selected_tags) do table.insert(previous_tags, v) end for k,v in pairs(s.selected_tags) do table.insert(previous_tags, v) end
end end
enable_bars()
for _, c in ipairs(client.get()) do for _, c in ipairs(client.get()) do
set_borders(c) set_borders(c)
end end
@ -573,21 +575,35 @@ function end_switcher ()
end end
end end
-- Disable all bars disable_bars()
for s in screen do
s.topwibox.visible = false
s.bottomwibox.visible = false
end
previous_tags = {} previous_tags = {}
--rofi_kill()
end end
function toggle_switcher () function toggle_switcher ()
if switcher_mode then end_switcher() else start_switcher() end if switcher_mode then end_switcher() else start_switcher() end
end end
function enable_bars ()
if bar_timer.started then bar_timer:stop() end
if bar_mode == true then return else bar_mode = true end
for s in screen do
s.topwibox.visible = true
s.bottomwibox.visible = true
end
end
function disable_bars ()
if bar_timer.started then bar_timer:stop() end
if bar_mode == false then return else bar_mode = false end
for s in screen do
s.topwibox.visible = false
s.bottomwibox.visible = false
end
end
function set_borders (c) function set_borders (c)
c.border_width = beautiful.border_width c.border_width = beautiful.border_width
awful.titlebar.show(c) awful.titlebar.show(c)