Task switcher
This commit is contained in:
parent
efbe97beea
commit
70af7be8d0
|
@ -47,7 +47,9 @@ end
|
||||||
|
|
||||||
-- {{{ Variable definitions
|
-- {{{ Variable definitions
|
||||||
-- Themes define colours, icons, font and wallpapers.
|
-- Themes define colours, icons, font and wallpapers.
|
||||||
beautiful.init("/home/daan/.config/awesome/theme.lua")
|
if not beautiful.init("/home/daan/.config/awesome/theme.lua") then
|
||||||
|
print("Mr. Theme did an oopsie!")
|
||||||
|
end
|
||||||
beautiful.font = "Hack Nerd Font 9"
|
beautiful.font = "Hack Nerd Font 9"
|
||||||
|
|
||||||
-- This is used later as the default terminal and editor to run.
|
-- This is used later as the default terminal and editor to run.
|
||||||
|
@ -253,16 +255,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_hide_timer = timer({ timeout = 1})
|
|
||||||
|
|
||||||
s.dock_trigger:geometry({ width = 10, height = 10 })
|
s.dock_trigger:geometry({ width = 10, height = 10 })
|
||||||
s.dock_hide_timer:connect_signal("timeout", function() stopgaps(s.mywibox) end )
|
|
||||||
|
|
||||||
s.dock_trigger:connect_signal("mouse::enter", function() startgaps(s.mywibox) end)
|
s.mywibox:connect_signal("mouse::enter", function() start_switcher() end)
|
||||||
s.mywibox:connect_signal("mouse::enter", function() if s.dock_hide_timer.started then s.dock_hide_timer:stop() end end)
|
--s.mywibox:connect_signal("mouse::leave", function() switcher_timer:again() end)
|
||||||
s.mywibox:connect_signal("mouse::leave", function() s.dock_hide_timer:again() end)
|
s.dock_trigger:connect_signal("mouse::enter", function() start_switcher() end)
|
||||||
s.dock_trigger:connect_signal("mouse::enter", function() if s.dock_hide_timer.started then s.dock_hide_timer:stop() end end)
|
--s.dock_trigger:connect_signal("mouse::leave", function() switcher_timer:again() end)
|
||||||
s.dock_trigger:connect_signal("mouse::leave", function() s.dock_hide_timer:again() end)
|
|
||||||
end)
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
@ -274,22 +272,98 @@ root.buttons(gears.table.join(
|
||||||
))
|
))
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
gap_mode = false
|
||||||
|
|
||||||
function togglegaps (dock)
|
function togglegaps (screen, dock)
|
||||||
if beautiful.useless_gap == 10 then stopgaps(dock) else startgaps(dock) end
|
if beautiful.useless_gap == 10 then stopgaps(screen, dock) else startgaps(screen, dock) end
|
||||||
end
|
end
|
||||||
|
|
||||||
function startgaps (dock)
|
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
|
beautiful.useless_gap = 10
|
||||||
dock.visible = true
|
dock.visible = true
|
||||||
|
previous_layout = awful.layout.get(screen)
|
||||||
|
awful.layout.set(awful.layout.suit.fair)
|
||||||
|
print("start")
|
||||||
end
|
end
|
||||||
|
|
||||||
function stopgaps (dock)
|
function stopgaps (screen, dock)
|
||||||
|
if not gap_mode then return else gap_mode = not gap_mode end
|
||||||
beautiful.useless_gap = 0
|
beautiful.useless_gap = 0
|
||||||
dock.visible = false
|
dock.visible = false
|
||||||
|
awful.layout.set(previous_layout)
|
||||||
|
if awful.client.getmaster ~= client.focus then awful.client.setmaster(client.focus) end
|
||||||
|
print("stop")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
switcher_layout = awful.layout.suit.fair
|
||||||
|
switcher_mode = false
|
||||||
|
switcher_timer = timer({ timeout = 1 })
|
||||||
|
switcher_timer:connect_signal("timeout", function () end_switcher() end)
|
||||||
|
layout_table = {}
|
||||||
|
|
||||||
|
function start_switcher ()
|
||||||
|
if switcher_timer.started then switcher_timer:stop() end
|
||||||
|
if switcher_mode == true then return else switcher_mode = true end
|
||||||
|
|
||||||
|
beautiful.useless_gap = 10
|
||||||
|
|
||||||
|
-- Store layout of all tags and set new layout
|
||||||
|
for _, tag in ipairs(root.tags()) do
|
||||||
|
layout_table[tag] = tag.layout
|
||||||
|
tag.layout = switcher_layout
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Enable all bars
|
||||||
|
for s in screen do
|
||||||
|
s.mywibox.visible = true
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, c in ipairs(client.get()) do
|
||||||
|
c.border_width = beautiful.border_width
|
||||||
|
awful.titlebar.show(c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function end_switcher ()
|
||||||
|
if switcher_timer.started then switcher_timer:stop() end
|
||||||
|
if switcher_mode == false then return else switcher_mode = false end
|
||||||
|
|
||||||
|
beautiful.useless_gap = 0
|
||||||
|
|
||||||
|
-- Restore layout of all tags
|
||||||
|
for _, tag in ipairs(root.tags()) do
|
||||||
|
tag.layout = layout_table[tag]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set the master window
|
||||||
|
for _, c in ipairs(client.get()) do
|
||||||
|
awful.client.setslave(c)
|
||||||
|
c.border_width = 0
|
||||||
|
awful.titlebar.hide(c)
|
||||||
|
end
|
||||||
|
|
||||||
|
awful.client.setmaster(client.focus)
|
||||||
|
|
||||||
|
-- Disable all bars
|
||||||
|
for s in screen do
|
||||||
|
s.mywibox.visible = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function toggle_switcher ()
|
||||||
|
if switcher_mode then end_switcher() else start_switcher() end
|
||||||
|
end
|
||||||
|
|
||||||
|
globalbuttons = gears.table.join(
|
||||||
|
awful.button({ }, 1, end_switcher)
|
||||||
|
)
|
||||||
|
|
||||||
-- {{{ Key bindings
|
-- {{{ Key bindings
|
||||||
globalkeys = gears.table.join(
|
globalkeys = gears.table.join(
|
||||||
|
|
||||||
|
@ -319,7 +393,9 @@ globalkeys = gears.table.join(
|
||||||
awful.spawn("xbacklight -dec 5")
|
awful.spawn("xbacklight -dec 5")
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.key({ modkey }, "g", function () for s in screen do togglegaps(s.mywibox); s.dock_hide_timer:stop() end end),
|
--awful.key({ modkey }, "g", function () for s in screen do togglegaps(s, s.mywibox); s.dock_hide_timer:stop() end end),
|
||||||
|
awful.key({ modkey }, "g", toggle_switcher),
|
||||||
|
awful.key({ modkey }, "Tab", function () start_switcher(); awful.client.focus.byidx(1); switcher_timer:again() end),
|
||||||
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
||||||
{description="show help", group="awesome"}),
|
{description="show help", group="awesome"}),
|
||||||
awful.key({ modkey, }, "Left", awful.tag.viewprev,
|
awful.key({ modkey, }, "Left", awful.tag.viewprev,
|
||||||
|
@ -355,14 +431,6 @@ globalkeys = gears.table.join(
|
||||||
{description = "focus the previous screen", group = "screen"}),
|
{description = "focus the previous screen", group = "screen"}),
|
||||||
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
|
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
|
||||||
{description = "jump to urgent client", group = "client"}),
|
{description = "jump to urgent client", group = "client"}),
|
||||||
awful.key({ modkey, }, "Tab",
|
|
||||||
function ()
|
|
||||||
awful.client.focus.history.previous()
|
|
||||||
if client.focus then
|
|
||||||
client.focus:raise()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
{description = "go back", group = "client"}),
|
|
||||||
|
|
||||||
-- Standard program
|
-- Standard program
|
||||||
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
|
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
|
||||||
|
@ -476,6 +544,10 @@ for i = 1, 9 do
|
||||||
if tag then
|
if tag then
|
||||||
tag:view_only()
|
tag:view_only()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if switcher_mode and switcher_timer.started then
|
||||||
|
switcher_timer:again()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
{description = "view tag #"..i, group = "tag"}),
|
{description = "view tag #"..i, group = "tag"}),
|
||||||
-- Toggle tag display.
|
-- Toggle tag display.
|
||||||
|
@ -516,6 +588,7 @@ end
|
||||||
clientbuttons = gears.table.join(
|
clientbuttons = gears.table.join(
|
||||||
awful.button({ }, 1, function (c)
|
awful.button({ }, 1, function (c)
|
||||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||||
|
end_switcher()
|
||||||
end),
|
end),
|
||||||
awful.button({ modkey }, 1, function (c)
|
awful.button({ modkey }, 1, function (c)
|
||||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||||
|
@ -529,6 +602,7 @@ clientbuttons = gears.table.join(
|
||||||
|
|
||||||
-- Set keys
|
-- Set keys
|
||||||
root.keys(globalkeys)
|
root.keys(globalkeys)
|
||||||
|
root.buttons(globalbuttons)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Rules
|
-- {{{ Rules
|
||||||
|
@ -592,6 +666,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
|
||||||
-- 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
|
||||||
|
@ -618,7 +693,9 @@ client.connect_signal("request::titlebars", function(c)
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
|
||||||
awful.titlebar(c) : setup {
|
awful.titlebar(c, {
|
||||||
|
bg_normal = beautiful.border_normal
|
||||||
|
}) : setup {
|
||||||
{ -- Left
|
{ -- Left
|
||||||
awful.titlebar.widget.iconwidget(c),
|
awful.titlebar.widget.iconwidget(c),
|
||||||
buttons = buttons,
|
buttons = buttons,
|
||||||
|
@ -633,17 +710,16 @@ client.connect_signal("request::titlebars", function(c)
|
||||||
layout = wibox.layout.flex.horizontal
|
layout = wibox.layout.flex.horizontal
|
||||||
},
|
},
|
||||||
{ -- Right
|
{ -- Right
|
||||||
awful.titlebar.widget.floatingbutton (c),
|
|
||||||
awful.titlebar.widget.maximizedbutton(c),
|
|
||||||
awful.titlebar.widget.stickybutton (c),
|
|
||||||
awful.titlebar.widget.ontopbutton (c),
|
|
||||||
awful.titlebar.widget.closebutton (c),
|
|
||||||
layout = wibox.layout.fixed.horizontal()
|
layout = wibox.layout.fixed.horizontal()
|
||||||
},
|
},
|
||||||
layout = wibox.layout.align.horizontal
|
layout = wibox.layout.align.horizontal
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||||
|
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||||
|
|
||||||
-- Enable sloppy focus, so that focus follows mouse.
|
-- Enable sloppy focus, so that focus follows mouse.
|
||||||
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})
|
||||||
|
|
|
@ -25,9 +25,9 @@ theme.fg_urgent = "#ffffff"
|
||||||
theme.fg_minimize = "#ffffff"
|
theme.fg_minimize = "#ffffff"
|
||||||
|
|
||||||
theme.useless_gap = dpi(0)
|
theme.useless_gap = dpi(0)
|
||||||
theme.border_width = dpi(0)
|
theme.border_width = dpi(5)
|
||||||
theme.border_normal = "#000000"
|
theme.border_normal = "#4a4a4a"
|
||||||
theme.border_focus = "#535d6c"
|
theme.border_focus = "#75859e"
|
||||||
theme.border_marked = "#91231c"
|
theme.border_marked = "#91231c"
|
||||||
|
|
||||||
-- There are other variable sets
|
-- There are other variable sets
|
||||||
|
@ -71,7 +71,6 @@ theme.menu_width = dpi(100)
|
||||||
--theme.bg_widget = "#cc0000"
|
--theme.bg_widget = "#cc0000"
|
||||||
|
|
||||||
-- Define the image to load
|
-- Define the image to load
|
||||||
--[[
|
|
||||||
theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png"
|
theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png"
|
||||||
theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png"
|
theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png"
|
||||||
|
|
||||||
|
@ -97,8 +96,8 @@ theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar
|
||||||
theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png"
|
theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png"
|
||||||
theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png"
|
theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png"
|
||||||
theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png"
|
theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png"
|
||||||
--]]
|
|
||||||
|
|
||||||
|
--[[
|
||||||
math.randomseed(os.time());
|
math.randomseed(os.time());
|
||||||
-- To guarantee unique random numbers on every platform, pop a few
|
-- To guarantee unique random numbers on every platform, pop a few
|
||||||
for i = 1,10 do
|
for i = 1,10 do
|
||||||
|
@ -125,6 +124,7 @@ function theme.wallpaper ()
|
||||||
for i,v in ipairs(files) do count += 1 end
|
for i,v in ipairs(files) do count += 1 end
|
||||||
return files[math.random(1, count)]
|
return files[math.random(1, count)]
|
||||||
end
|
end
|
||||||
|
]]--
|
||||||
|
|
||||||
-- You can use your own layout icons like this:
|
-- You can use your own layout icons like this:
|
||||||
theme.layout_fairh = themes_path.."default/layouts/fairhw.png"
|
theme.layout_fairh = themes_path.."default/layouts/fairhw.png"
|
||||||
|
|
Loading…
Reference in New Issue