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, layout = wibox.layout.align.horizontal,
{ -- Left widgets { -- Left widgets
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist, s.mytaglist,
s.mypromptbox, s.mypromptbox,
}, },
@ -258,9 +257,9 @@ awful.screen.connect_for_each_screen(function(s)
s.dock_trigger:geometry({ width = 10, height = 10 }) s.dock_trigger:geometry({ width = 10, height = 10 })
s.mywibox:connect_signal("mouse::enter", function() start_switcher() end) 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::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) 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_layout = awful.layout.suit.fair
switcher_mode = false switcher_mode = false
@ -325,8 +296,7 @@ function start_switcher ()
end end
for _, c in ipairs(client.get()) do for _, c in ipairs(client.get()) do
c.border_width = beautiful.border_width set_borders(c)
awful.titlebar.show(c)
end end
end end
@ -343,22 +313,46 @@ function end_switcher ()
-- Set the master window -- Set the master window
for _, c in ipairs(client.get()) do for _, c in ipairs(client.get()) do
c.border_width = 0 remove_borders(c)
awful.titlebar.hide(c)
end 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 -- Disable all bars
for s in screen do for s in screen do
s.mywibox.visible = false s.mywibox.visible = false
end end
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 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( globalbuttons = gears.table.join(
awful.button({ }, 1, end_switcher) awful.button({ }, 1, end_switcher)
) )
@ -484,22 +478,22 @@ globalkeys = gears.table.join(
-- Menubar -- Menubar
awful.key({ modkey }, "p", function() menubar.show() end, awful.key({ modkey }, "p", function() menubar.show() end,
{description = "show the menubar", group = "launcher"}), {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"}), {description = "launch rofi", group = "launcher"}),
awful.key({ modkey, "Shift" }, "m", awful.key({ modkey, "Shift" }, "m",
function (c) function (c)
awful.spawn("dmenu_script minecraft.sh") rofi_spawn("dmenu_script minecraft.sh")
end , end ,
{description = "Play Minecraft"}), {description = "Play Minecraft"}),
awful.key({ modkey, "Shift" }, "f", awful.key({ modkey, "Shift" }, "f",
function (c) function (c)
awful.spawn("dmenu_script factorio.sh") rofi_spawn("dmenu_script factorio.sh")
end , end ,
{description = "Play Factorio"}), {description = "Play Factorio"}),
awful.key({ modkey, "Shift" }, "g", awful.key({ modkey, "Shift" }, "g",
function (c) function (c)
awful.spawn("dmenu_script lutris.sh") rofi_spawn("dmenu_script lutris.sh")
end , end ,
{description = "Play a Game"}) {description = "Play a Game"})
) )
@ -665,7 +659,7 @@ awful.rules.rules = {
-- {{{ Signals -- {{{ Signals
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c) 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, -- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master. -- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end -- 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 layout = wibox.layout.align.horizontal
} }
end) end)
@ -723,4 +718,13 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
client.connect_signal("mouse::enter", function(c) client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:emit_signal("request::activate", "mouse_enter", {raise = false})
end) end)
client.connect_signal("mouse::move", function(c)
if switcher_mode and switcher_timer.started then
switcher_timer:again()
end
end)
-- }}} -- }}}