More fixes

This commit is contained in:
Daan Vanoverloop 2019-08-29 06:54:25 +02:00
parent 7cea6a69e6
commit 006062aaa7
1 changed files with 45 additions and 41 deletions

View File

@ -234,7 +234,6 @@ awful.screen.connect_for_each_screen(function(s)
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
@ -258,9 +257,9 @@ awful.screen.connect_for_each_screen(function(s)
s.dock_trigger:geometry({ width = 10, height = 10 })
s.mywibox:connect_signal("mouse::enter", function() start_switcher() end)
--s.mywibox:connect_signal("mouse::leave", function() switcher_timer:again() end)
s.mywibox: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.dock_trigger:connect_signal("mouse::leave", function() switcher_timer:again() end)
end)
-- }}}
@ -272,34 +271,6 @@ root.buttons(gears.table.join(
))
-- }}}
gap_mode = false
function togglegaps (screen, dock)
if beautiful.useless_gap == 10 then stopgaps(screen, dock) else startgaps(screen, dock) end
end
previous_layout = awful.layout.suit.spiral.dwindle
function startgaps (screen, dock)
if gap_mode then return else gap_mode = not gap_mode end
beautiful.useless_gap = 10
dock.visible = true
previous_layout = awful.layout.get(screen)
awful.layout.set(awful.layout.suit.fair)
print("start")
end
function stopgaps (screen, dock)
if not gap_mode then return else gap_mode = not gap_mode end
beautiful.useless_gap = 0
dock.visible = false
awful.layout.set(previous_layout)
if awful.client.getmaster ~= client.focus then awful.client.setmaster(client.focus) end
print("stop")
end
switcher_layout = awful.layout.suit.fair
switcher_mode = false
@ -325,8 +296,7 @@ function start_switcher ()
end
for _, c in ipairs(client.get()) do
c.border_width = beautiful.border_width
awful.titlebar.show(c)
set_borders(c)
end
end
@ -343,22 +313,46 @@ function end_switcher ()
-- Set the master window
for _, c in ipairs(client.get()) do
c.border_width = 0
awful.titlebar.hide(c)
remove_borders(c)
end
client.focus:swap(awful.client.getmaster())
-- Set focused client as master
if client.focus then client.focus:swap(awful.client.getmaster()) end
-- Disable all bars
for s in screen do
s.mywibox.visible = false
end
rofi_kill()
end
function toggle_switcher ()
if switcher_mode then end_switcher() else start_switcher() end
end
function set_borders (c)
c.border_width = beautiful.border_width
awful.titlebar.show(c)
end
function remove_borders (c)
c.border_width = 0
awful.titlebar.hide(c)
end
rofi_pid = nil
function rofi_spawn (command)
rofi_kill()
rofi_pid = awful.spawn(command)
end
function rofi_kill ()
if rofi_pid then awful.spawn("kill "..rofi_pid) end
end
globalbuttons = gears.table.join(
awful.button({ }, 1, end_switcher)
)
@ -484,22 +478,22 @@ globalkeys = gears.table.join(
-- Menubar
awful.key({ modkey }, "p", function() menubar.show() end,
{description = "show the menubar", group = "launcher"}),
awful.key({ modkey }, "d", function() awful.spawn("rofi -show run") end,
awful.key({ modkey }, "d", function() rofi_spawn("rofi -show run") end,
{description = "launch rofi", group = "launcher"}),
awful.key({ modkey, "Shift" }, "m",
function (c)
awful.spawn("dmenu_script minecraft.sh")
rofi_spawn("dmenu_script minecraft.sh")
end ,
{description = "Play Minecraft"}),
awful.key({ modkey, "Shift" }, "f",
function (c)
awful.spawn("dmenu_script factorio.sh")
rofi_spawn("dmenu_script factorio.sh")
end ,
{description = "Play Factorio"}),
awful.key({ modkey, "Shift" }, "g",
function (c)
awful.spawn("dmenu_script lutris.sh")
rofi_spawn("dmenu_script lutris.sh")
end ,
{description = "Play a Game"})
)
@ -665,7 +659,7 @@ awful.rules.rules = {
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
c.border_width = 0
if switcher_mode then set_borders(c) else remove_borders(c) end
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
@ -713,6 +707,7 @@ client.connect_signal("request::titlebars", function(c)
},
layout = wibox.layout.align.horizontal
}
end)
@ -723,4 +718,13 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false})
end)
client.connect_signal("mouse::move", function(c)
if switcher_mode and switcher_timer.started then
switcher_timer:again()
end
end)
-- }}}