mirror of
https://github.com/lcpz/awesome-copycats.git
synced 2024-12-22 19:22:32 +00:00
switched from scratchdrop to quake; #108
This commit is contained in:
parent
5c42eb7064
commit
f68d57d4fa
|
@ -30,7 +30,6 @@ local orig = {
|
|||
-- Return tags with stuff on them, mark others hidden
|
||||
function gettags(screen)
|
||||
local tags = {}
|
||||
|
||||
for k, t in ipairs(capi.screen[screen]:tags()) do
|
||||
if t.selected or #t:clients() > 0 then
|
||||
awful.tag.setproperty(t, "hide", false)
|
||||
|
|
2
lain
2
lain
|
@ -1 +1 @@
|
|||
Subproject commit c9ed5d4f802701348ee3b1039c1bbb18a91526a1
|
||||
Subproject commit 14a3f6689ba5f3d189aa8d47f857dab1ffa2a3e7
|
153
quake/init.lua
Normal file
153
quake/init.lua
Normal file
|
@ -0,0 +1,153 @@
|
|||
-- Quake-like console on top
|
||||
-- Original:
|
||||
-- https://awesomewm.org/wiki/Drop-down_terminal#Another_solution
|
||||
|
||||
-- Similar to:
|
||||
-- http://git.sysphere.org/awesome-configs/tree/scratch/drop.lua
|
||||
-- but uses a different implementation. The main difference is that we
|
||||
-- are able to detect the Quake console from its name.
|
||||
|
||||
-- If you have a rule like "awful.client.setslave" for your terminals,
|
||||
-- ensure you use an exception for QuakeConsole1. Otherwise, you may
|
||||
-- run into problems with focus.
|
||||
|
||||
local awful = require("awful")
|
||||
local capi = { client = client,
|
||||
mouse = mouse,
|
||||
screen = screen,
|
||||
timer = timer }
|
||||
local string = string
|
||||
|
||||
local pairs = pairs
|
||||
local setmetatable = setmetatable
|
||||
|
||||
module("quake")
|
||||
|
||||
local QuakeConsole = {}
|
||||
|
||||
-- Display console
|
||||
function QuakeConsole:display()
|
||||
-- First, we locate the client
|
||||
local client = nil
|
||||
local i = 0
|
||||
for c in awful.client.iterate(function (c)
|
||||
-- c.name may be changed!
|
||||
return c.instance == self.name
|
||||
end, nil, self.screen)
|
||||
do
|
||||
i = i + 1
|
||||
if i == 1 then
|
||||
client = c
|
||||
else
|
||||
-- Additional matching clients, let's remove the sticky bit
|
||||
-- which may persist between awesome restarts. We don't close
|
||||
-- them as they may be valuable. They will just turn into
|
||||
-- normal clients.
|
||||
c.sticky = false
|
||||
c.ontop = false
|
||||
c.above = false
|
||||
end
|
||||
end
|
||||
|
||||
if not client and not self.visible then return end
|
||||
|
||||
if not client then
|
||||
-- The client does not exist, we spawn it
|
||||
awful.util.spawn(self.app .. " " .. string.format(self.argname, self.name),
|
||||
false, self.screen)
|
||||
return
|
||||
end
|
||||
|
||||
-- Resize
|
||||
awful.client.floating.set(client, true)
|
||||
client.border_width = 0
|
||||
client.size_hints_honor = false
|
||||
client:geometry(self.geometry)
|
||||
|
||||
-- Sticky and on top
|
||||
client.ontop = true
|
||||
client.above = true
|
||||
client.skip_taskbar = true
|
||||
client.sticky = true
|
||||
|
||||
-- This is not a normal window, don't apply any specific keyboard stuff
|
||||
client:buttons({})
|
||||
client:keys({})
|
||||
|
||||
-- Toggle display
|
||||
if self.visible then
|
||||
client.hidden = false
|
||||
client:raise()
|
||||
client:tags({awful.tag.selected(self.screen)})
|
||||
capi.client.focus = client
|
||||
else
|
||||
client.hidden = true
|
||||
local ctags = client:tags()
|
||||
for i, t in pairs(ctags) do
|
||||
ctags[i] = nil
|
||||
end
|
||||
client:tags(ctags)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Create a console
|
||||
function QuakeConsole:new(config)
|
||||
local conf = config or {}
|
||||
|
||||
conf.app = conf.app or "xterm" -- application to spawn
|
||||
conf.name = conf.name or "QuakeDD" -- window name
|
||||
conf.argname = conf.argname or "-name %s" -- how to specify window name
|
||||
conf.visible = conf.visible or false -- initially not visible
|
||||
conf.screen = conf.screen or capi.mouse.screen
|
||||
|
||||
-- If width or height <= 1 this is a proportion of the workspace
|
||||
wibox_height = conf.wibox_height or 18 -- statusbar weight
|
||||
height = conf.height or 0.25 -- height
|
||||
width = conf.width or 1 -- width
|
||||
vert = conf.vert or "top" -- top, bottom or center
|
||||
horiz = conf.horiz or "center" -- left, right or center
|
||||
|
||||
-- Compute size
|
||||
local geom = capi.screen[conf.screen].workarea
|
||||
if width <= 1 then width = geom.width * width end
|
||||
if height <= 1 then height = geom.height * height end
|
||||
local x, y
|
||||
if horiz == "left" then x = geom.x
|
||||
elseif horiz == "right" then x = geom.width + geom.x - width
|
||||
else x = geom.x + (geom.width - width)/2 end
|
||||
if vert == "top" then y = geom.y
|
||||
elseif vert == "bottom" then y = geom.height + geom.y - height
|
||||
else y = geom.y + (geom.height - height)/2 end
|
||||
conf.geometry = { x = x, y = y + wibox_height, width = width-2, height = height }
|
||||
|
||||
local console = setmetatable(conf, { __index = QuakeConsole })
|
||||
capi.client.connect_signal("manage", function(c)
|
||||
if c.instance == console.name and c.screen == console.screen then
|
||||
console:display()
|
||||
end
|
||||
end)
|
||||
capi.client.connect_signal("unmanage", function(c)
|
||||
if c.instance == console.name and c.screen == console.screen then
|
||||
console.visible = false
|
||||
end
|
||||
end)
|
||||
|
||||
-- "Reattach" currently running quake application. This is in case awesome is restarted.
|
||||
local reattach = capi.timer { timeout = 0 }
|
||||
reattach:connect_signal("timeout", function()
|
||||
reattach:stop()
|
||||
console:display()
|
||||
end)
|
||||
reattach:start()
|
||||
|
||||
return console
|
||||
end
|
||||
|
||||
-- Toggle the console
|
||||
function QuakeConsole:toggle()
|
||||
self.visible = not self.visible
|
||||
self:display()
|
||||
end
|
||||
|
||||
setmetatable(_M, { __call = function(_, ...) return QuakeConsole:new(...) end })
|
|
@ -13,7 +13,7 @@ awful.rules = require("awful.rules")
|
|||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local drop = require("scratchdrop")
|
||||
local quake = require("quake")
|
||||
local lain = require("lain")
|
||||
-- }}}
|
||||
|
||||
|
@ -76,6 +76,12 @@ local layouts = {
|
|||
lain.layout.uselesstile.left,
|
||||
lain.layout.uselesstile.top
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal })
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -325,8 +331,8 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ altkey }, "p", function() os.execute("screenshot") end),
|
||||
|
||||
-- Tag browsing
|
||||
awful.key({ modkey }, "Left", awful.tag.viewprev ),
|
||||
awful.key({ modkey }, "Right", awful.tag.viewnext ),
|
||||
awful.key({ modkey }, "Left", awful.tag.viewprev),
|
||||
awful.key({ modkey }, "Right", awful.tag.viewnext),
|
||||
awful.key({ modkey }, "Escape", awful.tag.history.restore),
|
||||
|
||||
-- Non-empty tag browsing
|
||||
|
@ -411,7 +417,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -566,9 +572,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -640,12 +643,13 @@ client.connect_signal("manage", function (c, startup)
|
|||
end
|
||||
end)
|
||||
|
||||
-- No border for maximized clients
|
||||
-- No border for maximized or single clients
|
||||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -653,23 +657,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
|
||||
-- No borders with only one visible client
|
||||
elseif #clients == 1 or layout == "max" then
|
||||
c.border_width = 0
|
||||
else
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -13,7 +13,7 @@ awful.rules = require("awful.rules")
|
|||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local drop = require("scratchdrop")
|
||||
local quake = require("quake")
|
||||
local lain = require("lain")
|
||||
local eminent = require("eminent")
|
||||
-- }}}
|
||||
|
@ -87,6 +87,12 @@ local layouts = {
|
|||
lain.layout.centerfair,
|
||||
lain.layout.uselesspiral.dwindle
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal })
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -483,7 +489,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -639,9 +645,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -717,8 +720,10 @@ end)
|
|||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
-- no borders if only 1 client visible
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -726,23 +731,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
|
||||
-- No borders with only one visible client
|
||||
elseif #clients == 1 or layout == "max" then
|
||||
c.border_width = 0
|
||||
else
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -13,7 +13,7 @@ awful.rules = require("awful.rules")
|
|||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local drop = require("scratchdrop")
|
||||
local quake = require("quake")
|
||||
local lain = require("lain")
|
||||
-- }}}
|
||||
|
||||
|
@ -76,6 +76,12 @@ local layouts = {
|
|||
lain.layout.uselesstile.left,
|
||||
lain.layout.uselesstile.top
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal })
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -410,7 +416,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -565,9 +571,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -629,12 +632,13 @@ client.connect_signal("manage", function (c, startup)
|
|||
end
|
||||
end)
|
||||
|
||||
-- No border for maximized clients
|
||||
-- No border for maximized or single clients
|
||||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -642,23 +646,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
|
||||
-- No borders with only one visible client
|
||||
elseif #clients == 1 or layout == "max" then
|
||||
c.border_width = 0
|
||||
else
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
33
rc.lua.holo
33
rc.lua.holo
|
@ -12,7 +12,7 @@ awful.rules = require("awful.rules")
|
|||
require("awful.autofocus")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local quake = require("quake")
|
||||
local drop = require("scratchdrop")
|
||||
local lain = require("lain")
|
||||
-- }}}
|
||||
|
@ -77,6 +77,12 @@ local layouts = {
|
|||
lain.layout.uselesstile.left,
|
||||
lain.layout.uselesstile.top
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal, wibox_height = 32})
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -550,7 +556,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -704,9 +710,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -778,12 +781,13 @@ client.connect_signal("manage", function (c, startup)
|
|||
end
|
||||
end)
|
||||
|
||||
-- No border for maximized clients
|
||||
-- No border for maximized or single clients
|
||||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -791,23 +795,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
|
||||
-- No borders with only one visible client
|
||||
elseif #clients == 1 or layout == "max" then
|
||||
c.border_width = 0
|
||||
else
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -13,7 +13,7 @@ awful.rules = require("awful.rules")
|
|||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local drop = require("scratchdrop")
|
||||
local quake = require("quake")
|
||||
local lain = require("lain")
|
||||
-- }}}
|
||||
|
||||
|
@ -82,6 +82,12 @@ local layouts = {
|
|||
awful.layout.suit.spiral.dwindle,
|
||||
awful.layout.suit.max,
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal })
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -502,7 +508,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -657,9 +663,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -731,12 +734,13 @@ client.connect_signal("manage", function (c, startup)
|
|||
end
|
||||
end)
|
||||
|
||||
-- No border for maximized clients
|
||||
-- No border for maximized or single clients
|
||||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -744,27 +748,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
-- No borders with only one humanly visible client
|
||||
if layout == "max" then
|
||||
c.border_width = 0
|
||||
elseif awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
elseif #clients == 1 then
|
||||
clients[1].border_width = 0
|
||||
if layout ~= "max" then
|
||||
awful.client.moveresize(0, 0, 2, 0, clients[1])
|
||||
end
|
||||
else
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -13,7 +13,7 @@ awful.rules = require("awful.rules")
|
|||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local drop = require("scratchdrop")
|
||||
local quake = require("quake")
|
||||
local lain = require("lain")
|
||||
-- }}}
|
||||
|
||||
|
@ -79,6 +79,12 @@ local layouts = {
|
|||
awful.layout.suit.fair,
|
||||
awful.layout.suit.fair.horizontal,
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal })
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -203,18 +209,22 @@ fswidget = lain.widgets.fs({
|
|||
baticon = wibox.widget.imagebox(beautiful.widget_battery)
|
||||
batwidget = lain.widgets.bat({
|
||||
settings = function()
|
||||
if bat_now.ac_status == 1 then
|
||||
widget:set_markup(" AC ")
|
||||
baticon:set_image(beautiful.widget_ac)
|
||||
return
|
||||
elseif tonumber(bat_now.perc) <= 5 then
|
||||
baticon:set_image(beautiful.widget_battery_empty)
|
||||
elseif tonumber(bat_now.perc) <= 15 then
|
||||
baticon:set_image(beautiful.widget_battery_low)
|
||||
if bat_now.status ~= "N/A" then
|
||||
if bat_now.ac_status == 1 then
|
||||
widget:set_markup(" AC ")
|
||||
baticon:set_image(beautiful.widget_ac)
|
||||
return
|
||||
elseif tonumber(bat_now.perc) <= 5 then
|
||||
baticon:set_image(beautiful.widget_battery_empty)
|
||||
elseif tonumber(bat_now.perc) <= 15 then
|
||||
baticon:set_image(beautiful.widget_battery_low)
|
||||
else
|
||||
baticon:set_image(beautiful.widget_battery)
|
||||
end
|
||||
widget:set_markup(" " .. bat_now.perc .. "% ")
|
||||
else
|
||||
baticon:set_image(beautiful.widget_battery)
|
||||
baticon:set_image(beautiful.widget_ac)
|
||||
end
|
||||
widget:set_markup(" " .. bat_now.perc .. "% ")
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -469,7 +479,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -623,9 +633,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -697,12 +704,13 @@ client.connect_signal("manage", function (c, startup)
|
|||
end
|
||||
end)
|
||||
|
||||
-- No border for maximized clients
|
||||
-- No border for maximized or single clients
|
||||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -710,23 +718,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
|
||||
-- No borders with only one visible client
|
||||
elseif #clients == 1 or layout == "max" then
|
||||
c.border_width = 0
|
||||
else
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -13,7 +13,7 @@ awful.rules = require("awful.rules")
|
|||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local drop = require("scratchdrop")
|
||||
local quake = require("quake")
|
||||
local lain = require("lain")
|
||||
-- }}}
|
||||
|
||||
|
@ -83,6 +83,12 @@ local layouts = {
|
|||
lain.layout.termfair,
|
||||
lain.layout.uselesspiral.dwindle
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal })
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -167,7 +173,7 @@ mpdwidget = lain.widgets.mpd({
|
|||
fshome = lain.widgets.fs({
|
||||
partition = "/home",
|
||||
settings = function()
|
||||
fs_notification_preset.fg = white
|
||||
notification_preset.fg = white
|
||||
|
||||
hdd = ""
|
||||
p = ""
|
||||
|
@ -415,7 +421,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -571,9 +577,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -645,12 +648,13 @@ client.connect_signal("manage", function (c, startup)
|
|||
end
|
||||
end)
|
||||
|
||||
-- No border for maximized clients
|
||||
-- No border for maximized or single clients
|
||||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -658,23 +662,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
|
||||
-- No borders with only one visible client
|
||||
elseif #clients == 1 or layout == "max" then
|
||||
c.border_width = 0
|
||||
else
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -13,7 +13,7 @@ awful.rules = require("awful.rules")
|
|||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local drop = require("scratchdrop")
|
||||
local quake = require("quake")
|
||||
local lain = require("lain")
|
||||
-- }}}
|
||||
|
||||
|
@ -81,6 +81,12 @@ local layouts = {
|
|||
lain.layout.termfair,
|
||||
lain.layout.uselesspiral.dwindle
|
||||
}
|
||||
|
||||
-- quake terminal
|
||||
local quakeconsole = {}
|
||||
for s = 1, screen.count() do
|
||||
quakeconsole[s] = quake({ app = terminal })
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
|
@ -426,7 +432,7 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
|
||||
-- Dropdown terminal
|
||||
awful.key({ modkey, }, "z", function () drop(terminal) end),
|
||||
awful.key({ modkey, }, "z", function () quakeconsole[mouse.screen]:toggle() end),
|
||||
|
||||
-- Widgets popups
|
||||
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
||||
|
@ -581,9 +587,6 @@ awful.rules.rules = {
|
|||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
size_hints_honor = false } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.99 } },
|
||||
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
|
||||
|
@ -655,12 +658,13 @@ client.connect_signal("manage", function (c, startup)
|
|||
end
|
||||
end)
|
||||
|
||||
-- No border for maximized clients
|
||||
-- No border for maximized or single clients
|
||||
client.connect_signal("focus",
|
||||
function(c)
|
||||
if c.maximized_horizontal == true and c.maximized_vertical == true then
|
||||
c.border_color = beautiful.border_normal
|
||||
else
|
||||
c.border_width = 0
|
||||
elseif #awful.client.visible(mouse.screen) > 1 then
|
||||
c.border_width = beautiful.border_width
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
end)
|
||||
|
@ -668,23 +672,18 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||
-- }}}
|
||||
|
||||
-- {{{ Arrange signal handler
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
|
||||
for s = 1, screen.count() do screen[s]:connect_signal("arrange",
|
||||
function ()
|
||||
local clients = awful.client.visible(s)
|
||||
local layout = awful.layout.getname(awful.layout.get(s))
|
||||
|
||||
if #clients > 0 then -- Fine grained borders and floaters control
|
||||
if #clients > 0 then
|
||||
for _, c in pairs(clients) do -- Floaters always have borders
|
||||
if awful.client.floating.get(c) or layout == "floating" then
|
||||
c.border_width = beautiful.border_width
|
||||
|
||||
-- No borders with only one visible client
|
||||
elseif #clients == 1 or layout == "max" then
|
||||
c.border_width = 0
|
||||
else
|
||||
c.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -1,133 +0,0 @@
|
|||
-------------------------------------------------------------------
|
||||
-- Drop-down applications manager for the awesome window manager
|
||||
-------------------------------------------------------------------
|
||||
-- Coded by: * Lucas de Vries <lucas@glacicle.com>
|
||||
-- Hacked by: * Adrian C. (anrxc) <anrxc@sysphere.org>
|
||||
-- Licensed under the WTFPL version 2
|
||||
-- * http://sam.zoy.org/wtfpl/COPYING
|
||||
-------------------------------------------------------------------
|
||||
-- To use this module add:
|
||||
-- local scratchdrop = require("scratchdrop")
|
||||
-- to the top of your rc.lua, and call it from a keybinding:
|
||||
-- scratchdrop(prog, vert, horiz, width, height, sticky, screen)
|
||||
--
|
||||
-- Parameters:
|
||||
-- prog - Program to run; "urxvt", "gmrun", "thunderbird"
|
||||
-- vert - Vertical; "bottom", "center" or "top" (default)
|
||||
-- horiz - Horizontal; "left", "right" or "center" (default)
|
||||
-- width - Width in absolute pixels, or width percentage
|
||||
-- when <= 1 (1 (100% of the screen) by default)
|
||||
-- height - Height in absolute pixels, or height percentage
|
||||
-- when <= 1 (0.25 (25% of the screen) by default)
|
||||
-- sticky - Visible on all tags, false by default
|
||||
-- screen - Screen (optional), mouse.screen by default
|
||||
-------------------------------------------------------------------
|
||||
|
||||
-- Grab environment
|
||||
local pairs = pairs
|
||||
local awful = require("awful")
|
||||
local setmetatable = setmetatable
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
client = client,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- Scratchdrop: drop-down applications manager for the awesome window manager
|
||||
local scratchdrop = {} -- module scratch.drop
|
||||
|
||||
local dropdown = {}
|
||||
|
||||
-- Create a new window for the drop-down application when it doesn't
|
||||
-- exist, or toggle between hidden and visible states when it does
|
||||
function toggle(prog, vert, horiz, width, height, sticky, screen)
|
||||
vert = vert or "top"
|
||||
horiz = horiz or "center"
|
||||
width = width or 1
|
||||
height = height or 0.25
|
||||
sticky = sticky or false
|
||||
screen = screen or capi.mouse.screen
|
||||
|
||||
-- Determine signal usage in this version of awesome
|
||||
local attach_signal = capi.client.connect_signal or capi.client.add_signal
|
||||
local detach_signal = capi.client.disconnect_signal or capi.client.remove_signal
|
||||
|
||||
if not dropdown[prog] then
|
||||
dropdown[prog] = {}
|
||||
|
||||
-- Add unmanage signal for scratchdrop programs
|
||||
attach_signal("unmanage", function (c)
|
||||
for scr, cl in pairs(dropdown[prog]) do
|
||||
if cl == c then
|
||||
dropdown[prog][scr] = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if not dropdown[prog][screen] then
|
||||
spawnw = function (c)
|
||||
dropdown[prog][screen] = c
|
||||
|
||||
-- Scratchdrop clients are floaters
|
||||
awful.client.floating.set(c, true)
|
||||
|
||||
-- Client geometry and placement
|
||||
local screengeom = capi.screen[screen].workarea
|
||||
|
||||
if width <= 1 then width = screengeom.width * width end
|
||||
if height <= 1 then height = screengeom.height * height end
|
||||
|
||||
if horiz == "left" then x = screengeom.x
|
||||
elseif horiz == "right" then x = screengeom.width - width
|
||||
else x = screengeom.x+(screengeom.width-width)/2 end
|
||||
|
||||
if vert == "bottom" then y = screengeom.height + screengeom.y - height
|
||||
elseif vert == "center" then y = screengeom.y+(screengeom.height-height)/2
|
||||
else y = screengeom.y - screengeom.y end
|
||||
|
||||
-- Client properties
|
||||
c:geometry({ x = x, y = y + mywibox[mouse.screen].height, width = width - 2, height = height })
|
||||
c.ontop = true
|
||||
c.above = true
|
||||
c.skip_taskbar = true
|
||||
if sticky then c.sticky = true end
|
||||
if c.titlebar then awful.titlebar.remove(c) end
|
||||
|
||||
c:raise()
|
||||
capi.client.focus = c
|
||||
detach_signal("manage", spawnw)
|
||||
end
|
||||
|
||||
-- Add manage signal and spawn the program
|
||||
attach_signal("manage", spawnw)
|
||||
awful.util.spawn(prog, false)
|
||||
else
|
||||
-- Get a running client
|
||||
c = dropdown[prog][screen]
|
||||
|
||||
-- Switch the client to the current workspace
|
||||
if c:isvisible() == false then c.hidden = true
|
||||
awful.client.movetotag(awful.tag.selected(screen), c)
|
||||
end
|
||||
|
||||
-- Focus and raise if hidden
|
||||
if c.hidden then
|
||||
-- Make sure it is centered
|
||||
--if vert == "center" then awful.placement.center_vertical(c) end
|
||||
--if horiz == "center" then awful.placement.center_horizontal(c) end
|
||||
c.hidden = false
|
||||
c:raise()
|
||||
capi.client.focus = c
|
||||
else -- Hide and detach tags if not
|
||||
c.hidden = true
|
||||
local ctags = c:tags()
|
||||
for i, t in pairs(ctags) do
|
||||
ctags[i] = nil
|
||||
end
|
||||
c:tags(ctags)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return setmetatable(scratchdrop, { __call = function(_, ...) return toggle(...) end })
|
Loading…
Reference in a new issue