From de1473b8a3677023e398f245f4314877beb28745 Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Thu, 17 Oct 2019 13:13:00 +0200 Subject: [PATCH] Better UX --- .config/awesome/rc.lua | 48 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 33302a0..7422a9b 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -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:geometry({ width = 3, height = 3 }) - s.topwibox:connect_signal("mouse::enter", function() start_switcher() end) - s.topwibox:connect_signal("mouse::leave", function() switcher_timer:again() end) - s.bottomwibox:connect_signal("mouse::enter", function() start_switcher() end) - s.bottomwibox:connect_signal("mouse::leave", function() switcher_timer:again() end) - s.dock_trigger:connect_signal("mouse::enter", function() start_switcher() end) - s.dock_trigger:connect_signal("mouse::leave", function() switcher_timer:again() end) + s.topwibox:connect_signal("mouse::enter", function() enable_bars() end) + s.topwibox:connect_signal("mouse::leave", function() bar_timer:again() end) + s.bottomwibox:connect_signal("mouse::enter", function() enable_bars() end) + s.bottomwibox:connect_signal("mouse::leave", function() bar_timer:again() end) + s.dock_trigger:connect_signal("mouse::enter", function() enable_bars() end) + s.dock_trigger:connect_signal("mouse::leave", function() bar_timer:again() end) end) -- }}} @@ -518,6 +518,9 @@ switcher_layout = awful.layout.suit.fair switcher_mode = false switcher_timer = timer({ timeout = 1 }) 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 = {} previous_tags = {} @@ -534,13 +537,12 @@ function start_switcher () tag.selected = true end - -- Enable all bars 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 end + enable_bars() + for _, c in ipairs(client.get()) do set_borders(c) end @@ -573,21 +575,35 @@ function end_switcher () end end - -- Disable all bars - for s in screen do - s.topwibox.visible = false - s.bottomwibox.visible = false - end + disable_bars() previous_tags = {} - - --rofi_kill() end function toggle_switcher () if switcher_mode then end_switcher() else start_switcher() 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) c.border_width = beautiful.border_width awful.titlebar.show(c)