mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-23 02:08:35 +02:00
quake: add a quake-like console
This commit is contained in:
parent
4f8d580c8f
commit
eef0c6857b
3 changed files with 68 additions and 6 deletions
1
rc.lua
1
rc.lua
|
@ -52,5 +52,6 @@ loadrc("widgets")
|
|||
loadrc("xlock")
|
||||
loadrc("signals")
|
||||
loadrc("rules")
|
||||
loadrc("quake")
|
||||
|
||||
root.keys(config.keys.global)
|
||||
|
|
67
rc/quake.lua
Normal file
67
rc/quake.lua
Normal file
|
@ -0,0 +1,67 @@
|
|||
-- Quake like console on top
|
||||
-- See:
|
||||
-- http://git.sysphere.org/awesome-configs/tree/scratch/drop.lua
|
||||
|
||||
local quake = {} -- List of quake consoles
|
||||
local height = 0.3
|
||||
|
||||
-- When a quake console is closed, remove it from the list
|
||||
client.add_signal("unmanage",
|
||||
function (c)
|
||||
for i, cl in pairs(quake) do
|
||||
if cl == c then
|
||||
quake[i] = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Toggle the console
|
||||
local function toggle()
|
||||
local cscreen = mouse.screen
|
||||
|
||||
if not quake[cscreen] then
|
||||
-- We must spawn a new console
|
||||
|
||||
local function spawn (c)
|
||||
-- We assume that c is our Quake console. 99.9% sure.
|
||||
quake[cscreen] = c
|
||||
|
||||
-- Setup on top
|
||||
awful.client.floating.set(c, true)
|
||||
c.border_width = 0
|
||||
c.size_hints_honor = false
|
||||
local geom = screen[cscreen].workarea
|
||||
c:geometry({ x = geom.x,
|
||||
y = geom.y,
|
||||
width = geom.width,
|
||||
height = geom.height * height })
|
||||
c.ontop = true
|
||||
c.above = true
|
||||
c.skip_taskbar = true
|
||||
c.sticky = true
|
||||
c:raise()
|
||||
client.focus = c
|
||||
|
||||
-- Remove our signal handler
|
||||
client.remove_signal("manage", spawn)
|
||||
end
|
||||
|
||||
client.add_signal("manage", spawn)
|
||||
awful.util.spawn(config.terminal, false)
|
||||
else
|
||||
-- Display an existing console
|
||||
|
||||
c = quake[cscreen]
|
||||
if c.hidden then
|
||||
c.hidden = false
|
||||
c:raise()
|
||||
client.focus = c
|
||||
else
|
||||
c.hidden = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
config.keys.global = awful.util.table.join(
|
||||
config.keys.global,
|
||||
awful.key({ modkey }, "`", toggle))
|
|
@ -42,12 +42,6 @@ for i = 1, #tags do
|
|||
sharetags.tag_move(t, mouse.screen)
|
||||
end
|
||||
awful.tag.viewonly(tags[i])
|
||||
-- Select the master window
|
||||
local m = awful.client.getmaster()
|
||||
if m then
|
||||
client.focus = m
|
||||
m:raise()
|
||||
end
|
||||
end),
|
||||
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
||||
function ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue