Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce56320097 |
17 changed files with 342 additions and 238 deletions
26
.definitions/client.d.lua
Normal file
26
.definitions/client.d.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
---@meta
|
||||||
|
|
||||||
|
---@class client: gearsobject
|
||||||
|
client = {}
|
||||||
|
|
||||||
|
---Commands the character to say "Hello {name}"
|
||||||
|
---@param name string
|
||||||
|
function client.hello(name) end
|
||||||
|
|
||||||
|
--- Get the number of instances.
|
||||||
|
--- @return integer # The number of client objects alive.
|
||||||
|
function client.instances() end
|
||||||
|
--- Set a __index metamethod for all client instances.
|
||||||
|
--- @param cb function The meta-method
|
||||||
|
function client.set_index_miss_handler(cb) end
|
||||||
|
--- Set a __newindex metamethod for all client instances.
|
||||||
|
--- @param cb function The meta-method
|
||||||
|
function client.set_newindex_miss_handler(cb) end
|
||||||
|
|
||||||
|
--- Get all clients into a table.
|
||||||
|
---
|
||||||
|
--- @param screen? integer|screen A screen number to filter clients on.
|
||||||
|
--- @param stacked? boolean Return clients in stacking order? (ordered from
|
||||||
|
--- top to bottom).
|
||||||
|
--- @return table # A table with clients.
|
||||||
|
function client.get(screen, stacked) end
|
||||||
14
.definitions/object.d.lua
Normal file
14
.definitions/object.d.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---@meta
|
||||||
|
|
||||||
|
---@class gearsobject
|
||||||
|
gearsobject = {}
|
||||||
|
---
|
||||||
|
--- Connect to a signal
|
||||||
|
--- @param signal string
|
||||||
|
--- @param handler function
|
||||||
|
function gearsobject.connect_signal(signal, handler) end
|
||||||
|
|
||||||
|
--- Disconnect from a signal
|
||||||
|
--- @param signal string
|
||||||
|
--- @param handler function
|
||||||
|
function gearsobject.disconnect_signal(signal, handler) end
|
||||||
8
.luarc.json
Normal file
8
.luarc.json
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||||
|
"workspace.library": [
|
||||||
|
"/usr/local/share/somewm/lua/",
|
||||||
|
".definitions/"
|
||||||
|
],
|
||||||
|
"runtime.version": "Lua 5.1"
|
||||||
|
}
|
||||||
|
|
@ -5,9 +5,9 @@ local actions = {}
|
||||||
function actions.toggle_naughty()
|
function actions.toggle_naughty()
|
||||||
if naughty.is_suspended() then
|
if naughty.is_suspended() then
|
||||||
naughty.resume()
|
naughty.resume()
|
||||||
naughty.notify({ text = "Notifications enabled", timeout = 2 })
|
naughty.notification({ text = "Notifications enabled", timeout = 2 })
|
||||||
else
|
else
|
||||||
naughty.notify({ text = "Notifications disabled", timeout = 2 })
|
naughty.notification({ text = "Notifications disabled", timeout = 2 })
|
||||||
naughty.suspend()
|
naughty.suspend()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
36
inspect_client.lua
Normal file
36
inspect_client.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
string.lpad = function(str, len, char)
|
||||||
|
if char == nil then char = ' ' end
|
||||||
|
return str .. string.rep(char, len - #str)
|
||||||
|
end
|
||||||
|
|
||||||
|
local properties = {
|
||||||
|
"window",
|
||||||
|
"name", "type", "class", "instance", "role",
|
||||||
|
"pid", "machine",
|
||||||
|
"icon_name", "icon", "icon_sizes",
|
||||||
|
"screen",
|
||||||
|
"hidden", "minimized", "size_hints_honor", "size_hints",
|
||||||
|
"border_width", "border_color",
|
||||||
|
"urgent",
|
||||||
|
"content",
|
||||||
|
"opacity",
|
||||||
|
"ontop", "above", "below",
|
||||||
|
"fullscreen", "maximized", "maximized_horizontal",
|
||||||
|
"maximized_vertical",
|
||||||
|
"transient_for", "modal", "group_window", "leader_window",
|
||||||
|
"valid", "first_tag", "marked", "is_fixed", "floating",
|
||||||
|
"sticky", "focusable", "skip_taskbar", "dockable", "shape",
|
||||||
|
"shape_bounding", "shape_clip", "shape_input",
|
||||||
|
"shape_client_bounding", "shape_client_clip", "startup_id",
|
||||||
|
"x", "y", "width", "height",
|
||||||
|
}
|
||||||
|
|
||||||
|
return function(c)
|
||||||
|
str = "client info:\n------------\n"
|
||||||
|
if (c ~= nil) then for _,prop in ipairs(properties) do
|
||||||
|
if (c[prop] ~= nil) then
|
||||||
|
str = str .. prop:lpad(20) .. "\t" .. tostring(c[prop]) .. "\n"
|
||||||
|
end
|
||||||
|
end end
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
@ -40,7 +40,7 @@ conf.cmd = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Mod-r binding for running programs
|
-- Mod-r binding for running programs
|
||||||
conf.cmd.run = function() awful.util.spawn("dmenu_run -l 10 -y 350") end
|
conf.cmd.run = function() awful.spawn("dmenu_run -l 10 -y 350") end
|
||||||
local menubar = require("menubar")
|
local menubar = require("menubar")
|
||||||
conf.cmd.drun = menubar.show
|
conf.cmd.drun = menubar.show
|
||||||
|
|
||||||
|
|
|
||||||
23
mpd.lua
23
mpd.lua
|
|
@ -26,14 +26,22 @@ local function mpc(command)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function dmenu(opts)
|
local function dmenu(opts)
|
||||||
log.spawn("dmpc -h " .. settings.host .. " -p " .. settings.port .. " " ..
|
log.spawn(
|
||||||
(settings.replace_on_search and "-r" or "-R") .. " " .. opts)
|
"dmpc -h "
|
||||||
|
.. settings.host
|
||||||
|
.. " -p "
|
||||||
|
.. settings.port
|
||||||
|
.. " "
|
||||||
|
.. (settings.replace_on_search and "-r" or "-R")
|
||||||
|
.. " "
|
||||||
|
.. opts
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function notify(stext)
|
local function notify(stext)
|
||||||
if not (naughty == nil) then
|
if not (naughty == nil) then
|
||||||
naughty.notify({
|
naughty.notification({
|
||||||
text= stext
|
text = stext,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -45,7 +53,6 @@ M.set_server = function(host, port)
|
||||||
notify("Using mpd server " .. settings.host .. ":" .. settings.port)
|
notify("Using mpd server " .. settings.host .. ":" .. settings.port)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- {{{ mpd.ctrl submodule
|
-- {{{ mpd.ctrl submodule
|
||||||
|
|
||||||
M.ctrl = {}
|
M.ctrl = {}
|
||||||
|
|
@ -88,7 +95,6 @@ M.prompt.album = function()
|
||||||
dmenu("-A -b")
|
dmenu("-A -b")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
M.prompt.title = function()
|
M.prompt.title = function()
|
||||||
dmenu("-A -b -t")
|
dmenu("-A -b -t")
|
||||||
end
|
end
|
||||||
|
|
@ -103,14 +109,11 @@ end
|
||||||
|
|
||||||
M.prompt.toggle_replace_on_search = function()
|
M.prompt.toggle_replace_on_search = function()
|
||||||
settings.replace_on_search = not settings.replace_on_search
|
settings.replace_on_search = not settings.replace_on_search
|
||||||
notify("MPD prompts now " ..(
|
notify("MPD prompts now " .. (settings.replace_on_search and "replace" or "add to") .. " the playlist")
|
||||||
settings.replace_on_search and "replace" or "add to"
|
|
||||||
).. " the playlist")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
-- vim: set fenc=utf-8 tw=80 foldmethod=marker :
|
-- vim: set fenc=utf-8 tw=80 foldmethod=marker :
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
-- key bindings
|
-- key bindings
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
local conf = require("localconf")
|
local conf = require("localconf")
|
||||||
|
|
||||||
local actions = require("actions")
|
local actions = require("actions")
|
||||||
|
|
@ -23,7 +24,7 @@ lockhl:setup(wibars, "#F2C740", require("beautiful").bg_normal, { Caps = false }
|
||||||
local function mpdserver(host)
|
local function mpdserver(host)
|
||||||
return function()
|
return function()
|
||||||
mpd.set_server(host, "6600")
|
mpd.set_server(host, "6600")
|
||||||
awful.util.spawn("mpd-host set " .. host .. " 6600")
|
awful.spawn("mpd-host set " .. host .. " 6600")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -124,7 +125,7 @@ local notifymap = {
|
||||||
{ "m", binder.spawn("newmails -p"), "Show unread mails" },
|
{ "m", binder.spawn("newmails -p"), "Show unread mails" },
|
||||||
}
|
}
|
||||||
|
|
||||||
local myglobalkeys = awful.util.table.join(
|
local myglobalkeys = gears.table.join(
|
||||||
awful.key({}, "Pause", binder.spawn("rofi -show window")),
|
awful.key({}, "Pause", binder.spawn("rofi -show window")),
|
||||||
awful.key({ modkey }, "w", binder.spawn("rofi -show window")),
|
awful.key({ modkey }, "w", binder.spawn("rofi -show window")),
|
||||||
awful.key({}, "Print", binder.spawn("flameshot gui")),
|
awful.key({}, "Print", binder.spawn("flameshot gui")),
|
||||||
|
|
|
||||||
13
rc.lua
13
rc.lua
|
|
@ -1,10 +1,11 @@
|
||||||
-- If LuaRocks is installed, make sure that packages installed through it are
|
-- If LuaRocks is installed, make sure that packages installed through it are
|
||||||
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||||
pcall(require, "luarocks.loader")
|
--pcall(require, "luarocks.loader")
|
||||||
-- libraries {{{
|
-- libraries {{{
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
|
beautiful.init(gears.filesystem.get_dir("config") .. "/theme.lua")
|
||||||
---@diagnostic disable-next-line: unused-local
|
---@diagnostic disable-next-line: unused-local
|
||||||
--- for debugging
|
--- for debugging
|
||||||
local inspect = require("inspect")
|
local inspect = require("inspect")
|
||||||
|
|
@ -13,10 +14,10 @@ require("awful.autofocus")
|
||||||
require("util.errors")
|
require("util.errors")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
beautiful.init(awful.util.getdir("config") .. "/theme.lua")
|
|
||||||
|
|
||||||
require("tapestry")
|
require("tapestry")
|
||||||
|
|
||||||
|
awful.input.xkb_layout = "us_de"
|
||||||
|
|
||||||
-- {{{ Logging
|
-- {{{ Logging
|
||||||
local log = require("talkative")
|
local log = require("talkative")
|
||||||
log.add_logger(log.loggers.stdio, log.level.DEBUG)
|
log.add_logger(log.loggers.stdio, log.level.DEBUG)
|
||||||
|
|
@ -76,12 +77,12 @@ binder.modal.set_opacity(0.8)
|
||||||
|
|
||||||
binder.add_default_bindings()
|
binder.add_default_bindings()
|
||||||
binder.add_reloadable(tags.create_bindings)
|
binder.add_reloadable(tags.create_bindings)
|
||||||
local mybindings = awful.util.getdir("config") .. "/mybindings.lua"
|
local mybindings = gears.filesystem.get_dir("config") .. "/mybindings.lua"
|
||||||
binder.add_reloadable(function()
|
binder.add_reloadable(function()
|
||||||
return dofile(mybindings)
|
return dofile(mybindings)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
binder.add_bindings(awful.util.table.join(
|
binder.add_bindings(gears.table.join(
|
||||||
awful.key({}, "XF86AudioRaiseVolume", function()
|
awful.key({}, "XF86AudioRaiseVolume", function()
|
||||||
speakerwheel:up()
|
speakerwheel:up()
|
||||||
end),
|
end),
|
||||||
|
|
@ -109,7 +110,7 @@ binder.apply()
|
||||||
require("rules")
|
require("rules")
|
||||||
require("signals")
|
require("signals")
|
||||||
|
|
||||||
local autorun_file = awful.util.getdir("config") .. "/autorun"
|
local autorun_file = gears.filesystem.get_dir("config") .. "/autorun"
|
||||||
if gears.filesystem.file_readable(autorun_file) then
|
if gears.filesystem.file_readable(autorun_file) then
|
||||||
awful.spawn(autorun_file)
|
awful.spawn(autorun_file)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
22
rules.lua
22
rules.lua
|
|
@ -1,8 +1,8 @@
|
||||||
local awful = require("awful")
|
|
||||||
awful.rules = require("awful.rules")
|
|
||||||
local localconf = require("localconf")
|
|
||||||
|
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
local awful = require("awful")
|
||||||
|
local localconf = require("localconf")
|
||||||
|
local ruled = require("ruled")
|
||||||
|
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
local binder = require("separable.binder")
|
local binder = require("separable.binder")
|
||||||
local log = require("talkative")
|
local log = require("talkative")
|
||||||
|
|
@ -11,7 +11,7 @@ local log = require("talkative")
|
||||||
local function popup_urgent(client, message)
|
local function popup_urgent(client, message)
|
||||||
client:connect_signal("property::urgent", function(c)
|
client:connect_signal("property::urgent", function(c)
|
||||||
if c.urgent and not c.focus then
|
if c.urgent and not c.focus then
|
||||||
naughty.notify({ text = message })
|
naughty.notification({ text = message })
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -19,12 +19,12 @@ end
|
||||||
local function keyboard_layer(num)
|
local function keyboard_layer(num)
|
||||||
return function(client)
|
return function(client)
|
||||||
client:connect_signal("focus", function(c)
|
client:connect_signal("focus", function(c)
|
||||||
awful.util.spawn("kontroll-launch set-layer --index " .. num)
|
awful.spawn("kontroll-launch set-layer --index " .. num)
|
||||||
naughty.notify({ text = "kontroll: switching to layer " .. num })
|
naughty.notification({ text = "kontroll: switching to layer " .. num })
|
||||||
end)
|
end)
|
||||||
client:connect_signal("unfocus", function(c)
|
client:connect_signal("unfocus", function(c)
|
||||||
awful.util.spawn("kontroll-launch set-layer --index 0")
|
awful.spawn("kontroll-launch set-layer --index 0")
|
||||||
naughty.notify({ text = "kontroll: switching to base layer" })
|
naughty.notification({ text = "kontroll: switching to base layer" })
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -41,7 +41,7 @@ function startswith(str, start)
|
||||||
return str:sub(1, #start) == start
|
return str:sub(1, #start) == start
|
||||||
end
|
end
|
||||||
|
|
||||||
awful.rules.rules = {
|
ruled.client.append_rules({
|
||||||
-- All clients will match this rule.
|
-- All clients will match this rule.
|
||||||
{
|
{
|
||||||
rule = {},
|
rule = {},
|
||||||
|
|
@ -158,4 +158,4 @@ awful.rules.rules = {
|
||||||
rule = { class = "zenity" },
|
rule = { class = "zenity" },
|
||||||
properties = { ontop = true, floating = true, placement = awful.placement.centered },
|
properties = { ontop = true, floating = true, placement = awful.placement.centered },
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
-- key bindings
|
-- key bindings
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
local conf = require("localconf")
|
local conf = require("localconf")
|
||||||
local modkey = conf.modkey or "Mod4"
|
local modkey = conf.modkey or "Mod4"
|
||||||
|
|
@ -101,12 +102,13 @@ local function screen_in_wrapdir(dir, _screen)
|
||||||
for s = 1, screen.count() do
|
for s = 1, screen.count() do
|
||||||
geomtbl[s] = screen[s].geometry
|
geomtbl[s] = screen[s].geometry
|
||||||
end
|
end
|
||||||
local target = awful.util.get_rectangle_in_direction(dir, geomtbl, screen[sel].geometry)
|
local target = gears.geometry.rectangle.get_in_direction(dir, geomtbl, screen[sel].geometry)
|
||||||
if not target then
|
if not target then
|
||||||
local new_target = sel
|
local new_target = sel
|
||||||
while new_target do
|
while new_target do
|
||||||
target = new_target
|
target = new_target
|
||||||
new_target = awful.util.get_rectangle_in_direction(opposite_dirs[dir], geomtbl, screen[target].geometry)
|
new_target =
|
||||||
|
gears.geometry.rectangle.get_in_direction(opposite_dirs[dir], geomtbl, screen[target].geometry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -114,22 +116,15 @@ local function screen_in_wrapdir(dir, _screen)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function screen_focus_wrapdir(dir)
|
|
||||||
return function()
|
|
||||||
local target = screen_in_wrapdir(dir)
|
|
||||||
awful.screen.focus(target)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function screen_move_client_wrapdir(dir)
|
local function screen_move_client_wrapdir(dir)
|
||||||
return function(c)
|
return function(c)
|
||||||
local target = screen_in_wrapdir(dir)
|
local target = screen_in_wrapdir(dir)
|
||||||
awful.client.movetoscreen(c, target)
|
c:move_to_screen(target)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function binder.add_bindings(keys)
|
function binder.add_bindings(keys)
|
||||||
globalkeys = awful.util.table.join(globalkeys, keys)
|
globalkeys = gears.table.join(globalkeys, keys)
|
||||||
return binder
|
return binder
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -144,11 +139,11 @@ function binder.clear()
|
||||||
end
|
end
|
||||||
|
|
||||||
function binder.apply()
|
function binder.apply()
|
||||||
naughty.notify({ text = "Reloading key bindings" })
|
naughty.notification({ text = "Reloading key bindings" })
|
||||||
local allkeys = awful.util.table.clone(globalkeys)
|
local allkeys = gears.table.clone(globalkeys)
|
||||||
for _, v in pairs(globalkeyfuncs) do
|
for _, v in pairs(globalkeyfuncs) do
|
||||||
local loadedkeys = v()
|
local loadedkeys = v()
|
||||||
allkeys = awful.util.table.join(allkeys, loadedkeys)
|
allkeys = gears.table.join(allkeys, loadedkeys)
|
||||||
end
|
end
|
||||||
root.keys(allkeys)
|
root.keys(allkeys)
|
||||||
end
|
end
|
||||||
|
|
@ -165,7 +160,7 @@ local function client_opacity_set(c, default, max, step)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local clientkeys = awful.util.table.join(
|
local clientkeys = gears.table.join(
|
||||||
awful.key({ modkey, "Shift" }, "f", function(c)
|
awful.key({ modkey, "Shift" }, "f", function(c)
|
||||||
c.fullscreen = not c.fullscreen
|
c.fullscreen = not c.fullscreen
|
||||||
end),
|
end),
|
||||||
|
|
@ -176,7 +171,9 @@ local clientkeys = awful.util.table.join(
|
||||||
awful.key({ modkey, "Control" }, "Return", function(c)
|
awful.key({ modkey, "Control" }, "Return", function(c)
|
||||||
c:swap(awful.client.getmaster())
|
c:swap(awful.client.getmaster())
|
||||||
end),
|
end),
|
||||||
awful.key({ modkey }, "o", awful.client.movetoscreen),
|
awful.key({ modkey }, "o", function(c)
|
||||||
|
c:move_to_screen()
|
||||||
|
end),
|
||||||
awful.key({ modkey, "Shift" }, "h", screen_move_client_wrapdir("left")),
|
awful.key({ modkey, "Shift" }, "h", screen_move_client_wrapdir("left")),
|
||||||
awful.key({ modkey, "Shift" }, "l", screen_move_client_wrapdir("right")),
|
awful.key({ modkey, "Shift" }, "l", screen_move_client_wrapdir("right")),
|
||||||
awful.key({ modkey, "Control" }, "o", function(c)
|
awful.key({ modkey, "Control" }, "o", function(c)
|
||||||
|
|
@ -193,7 +190,7 @@ local clientkeys = awful.util.table.join(
|
||||||
end),
|
end),
|
||||||
awful.key({}, "XF86Calculater", awful.client.movetoscreen),
|
awful.key({}, "XF86Calculater", awful.client.movetoscreen),
|
||||||
awful.key({ modkey }, "i", function(c)
|
awful.key({ modkey }, "i", function(c)
|
||||||
require("naughty").notify({
|
naughty.notification({
|
||||||
text = string.format(
|
text = string.format(
|
||||||
"name: '%s'\nclass: '%s'\ninstance: '%s'\ntype: '%s'\npid: %d",
|
"name: '%s'\nclass: '%s'\ninstance: '%s'\ntype: '%s'\npid: %d",
|
||||||
c["name"],
|
c["name"],
|
||||||
|
|
@ -206,9 +203,9 @@ local clientkeys = awful.util.table.join(
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
|
||||||
root.buttons(awful.util.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev)))
|
root.buttons(gears.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev)))
|
||||||
|
|
||||||
local clientbuttons = awful.util.table.join(
|
local clientbuttons = gears.table.join(
|
||||||
awful.button({}, 1, function(c)
|
awful.button({}, 1, function(c)
|
||||||
if c.name ~= "Onboard" then
|
if c.name ~= "Onboard" then
|
||||||
client.focus = c
|
client.focus = c
|
||||||
|
|
@ -230,14 +227,14 @@ function binder.client.keys()
|
||||||
end
|
end
|
||||||
|
|
||||||
function binder.client.add_buttons(buttons)
|
function binder.client.add_buttons(buttons)
|
||||||
clientbuttons = awful.util.table.join(clientbuttons, buttons)
|
clientbuttons = gears.table.join(clientbuttons, buttons)
|
||||||
end
|
end
|
||||||
|
|
||||||
function binder.client.add_bindings(keys)
|
function binder.client.add_bindings(keys)
|
||||||
clientkeys = awful.util.table.join(clientkeys, keys)
|
clientkeys = gears.table.join(clientkeys, keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
local default_bindings = awful.util.table.join(
|
local default_bindings = gears.table.join(
|
||||||
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
||||||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||||
awful.key({ modkey }, "Return", spawnf(conf.cmd.terminal)),
|
awful.key({ modkey }, "Return", spawnf(conf.cmd.terminal)),
|
||||||
|
|
|
||||||
28
signals.lua
28
signals.lua
|
|
@ -1,15 +1,13 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
local ruled = require("ruled")
|
||||||
|
|
||||||
|
client.connect_signal("request::manage", function(c)
|
||||||
client.connect_signal("manage", function (c)
|
|
||||||
-- 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
|
||||||
|
|
||||||
if awesome.startup and
|
if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
|
||||||
not c.size_hints.user_position
|
|
||||||
and not c.size_hints.program_position then
|
|
||||||
-- Prevent clients from being unreachable after screen count changes.
|
-- Prevent clients from being unreachable after screen count changes.
|
||||||
awful.placement.no_offscreen(c)
|
awful.placement.no_offscreen(c)
|
||||||
end
|
end
|
||||||
|
|
@ -26,18 +24,26 @@ local fixed_clients = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local function may_lose_focus(c)
|
local function may_lose_focus(c)
|
||||||
if c == nil then return true end
|
if c == nil then
|
||||||
return not awful.rules.matches_list(c, fixed_clients)
|
return true
|
||||||
|
end
|
||||||
|
return not ruled.client.matches_list(c, fixed_clients)
|
||||||
end
|
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)
|
||||||
if may_lose_focus(client.focus)
|
if
|
||||||
|
may_lose_focus(client.focus)
|
||||||
and awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
and awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||||
and awful.client.focus.filter(c) then
|
and awful.client.focus.filter(c)
|
||||||
|
then
|
||||||
client.focus = c
|
client.focus = c
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
client.connect_signal("focus", function(c)
|
||||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
c.border_color = beautiful.border_focus
|
||||||
|
end)
|
||||||
|
client.connect_signal("unfocus", function(c)
|
||||||
|
c.border_color = beautiful.border_normal
|
||||||
|
end)
|
||||||
|
|
|
||||||
24
tags.lua
24
tags.lua
|
|
@ -1,11 +1,12 @@
|
||||||
-- tags
|
-- tags
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
local conf = require("localconf")
|
local conf = require("localconf")
|
||||||
local modkey = conf.modkey or "Mod4"
|
local modkey = conf.modkey or "Mod4"
|
||||||
|
|
||||||
local tags = {}
|
local tags = {}
|
||||||
|
|
||||||
awful.layout.layouts = {
|
awful.layout.append_default_layouts({
|
||||||
awful.layout.suit.fair,
|
awful.layout.suit.fair,
|
||||||
awful.layout.suit.fair.horizontal,
|
awful.layout.suit.fair.horizontal,
|
||||||
awful.layout.suit.tile,
|
awful.layout.suit.tile,
|
||||||
|
|
@ -13,13 +14,7 @@ awful.layout.layouts = {
|
||||||
awful.layout.suit.max,
|
awful.layout.suit.max,
|
||||||
awful.layout.suit.max.fullscreen,
|
awful.layout.suit.max.fullscreen,
|
||||||
awful.layout.suit.floating,
|
awful.layout.suit.floating,
|
||||||
-- awful.layout.suit.magnifier,
|
})
|
||||||
-- awful.layout.suit.corner.nw,
|
|
||||||
-- awful.layout.suit.corner.ne,
|
|
||||||
-- awful.layout.suit.corner.sw,
|
|
||||||
-- awful.layout.suit.corner.se,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local function getfunc_viewonly(i)
|
local function getfunc_viewonly(i)
|
||||||
return function()
|
return function()
|
||||||
|
|
@ -91,10 +86,7 @@ end
|
||||||
function tags.setup()
|
function tags.setup()
|
||||||
awful.screen.connect_for_each_screen(function(s)
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
for _, t in ipairs(tagdef) do
|
for _, t in ipairs(tagdef) do
|
||||||
awful.tag.add(t[1], awful.util.table.join(
|
awful.tag.add(t[1], gears.table.join({ screen = s }, t[2] or { layout = defaultlayout(s) }))
|
||||||
{screen = s},
|
|
||||||
t[2] or { layout = defaultlayout(s) }
|
|
||||||
))
|
|
||||||
end
|
end
|
||||||
s.tags[1]:view_only()
|
s.tags[1]:view_only()
|
||||||
end)
|
end)
|
||||||
|
|
@ -113,7 +105,8 @@ function tags.create_bindings()
|
||||||
else --if i > 10 then
|
else --if i > 10 then
|
||||||
k = "F" .. i - 10 -- F keys
|
k = "F" .. i - 10 -- F keys
|
||||||
end
|
end
|
||||||
tagkeys = awful.util.table.join(tagkeys,
|
tagkeys = gears.table.join(
|
||||||
|
tagkeys,
|
||||||
awful.key({ modkey }, k, getfunc_viewonly(i)),
|
awful.key({ modkey }, k, getfunc_viewonly(i)),
|
||||||
awful.key({ modkey, "Control" }, k, getfunc_viewtoggle(i)),
|
awful.key({ modkey, "Control" }, k, getfunc_viewtoggle(i)),
|
||||||
awful.key({ modkey, "Shift" }, k, getfunc_moveto(i)),
|
awful.key({ modkey, "Shift" }, k, getfunc_moveto(i)),
|
||||||
|
|
@ -122,13 +115,14 @@ function tags.create_bindings()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- keys for all tags
|
-- keys for all tags
|
||||||
tagkeys = awful.util.table.join(tagkeys,
|
tagkeys = gears.table.join(
|
||||||
|
tagkeys,
|
||||||
awful.key({ modkey }, "u", awful.client.urgent.jumpto),
|
awful.key({ modkey }, "u", awful.client.urgent.jumpto),
|
||||||
awful.key({ modkey }, "Left", awful.tag.viewprev),
|
awful.key({ modkey }, "Left", awful.tag.viewprev),
|
||||||
awful.key({ modkey }, "Right", awful.tag.viewnext),
|
awful.key({ modkey }, "Right", awful.tag.viewnext),
|
||||||
awful.key({ modkey }, "Escape", awful.tag.history.restore)
|
awful.key({ modkey }, "Escape", awful.tag.history.restore)
|
||||||
)
|
)
|
||||||
return tagkeys;
|
return tagkeys
|
||||||
end
|
end
|
||||||
|
|
||||||
return tags
|
return tags
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 95b709fa483363c894c22e5bf0e3060915e49411
|
Subproject commit ca93752bef7cd662f9a102d3aa05c7b1c6adb4b5
|
||||||
2
tapestry
2
tapestry
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5bb7a7d0510ea1adecf1a175444cdbcca13b7e71
|
Subproject commit fdf23d8580ea94cad21a2221b41931c4289bb74f
|
||||||
|
|
@ -5,9 +5,11 @@ local naughty = require("naughty")
|
||||||
-- Check if awesome encountered an error during startup and fell back to
|
-- Check if awesome encountered an error during startup and fell back to
|
||||||
-- another config (This code will only ever execute for the fallback config)
|
-- another config (This code will only ever execute for the fallback config)
|
||||||
if awesome.startup_errors then
|
if awesome.startup_errors then
|
||||||
naughty.notify({ preset = naughty.config.presets.critical,
|
naughty.notification({
|
||||||
|
preset = naughty.config.presets.critical,
|
||||||
title = "Oops, there were errors during startup!",
|
title = "Oops, there were errors during startup!",
|
||||||
text = awesome.startup_errors })
|
text = awesome.startup_errors,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Handle runtime errors after startup
|
-- Handle runtime errors after startup
|
||||||
|
|
@ -15,12 +17,16 @@ do
|
||||||
local in_error = false
|
local in_error = false
|
||||||
awesome.connect_signal("debug::error", function(err)
|
awesome.connect_signal("debug::error", function(err)
|
||||||
-- Make sure we don't go into an endless error loop
|
-- Make sure we don't go into an endless error loop
|
||||||
if in_error then return end
|
if in_error then
|
||||||
|
return
|
||||||
|
end
|
||||||
in_error = true
|
in_error = true
|
||||||
|
|
||||||
naughty.notify({ preset = naughty.config.presets.critical,
|
naughty.notification({
|
||||||
|
preset = naughty.config.presets.critical,
|
||||||
title = "Oops, an error happened!",
|
title = "Oops, an error happened!",
|
||||||
text = err })
|
text = err,
|
||||||
|
})
|
||||||
in_error = false
|
in_error = false
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
152
widgets.lua
152
widgets.lua
|
|
@ -10,23 +10,23 @@ local gears = require("gears")
|
||||||
local wlist = {}
|
local wlist = {}
|
||||||
|
|
||||||
local mytaglist = {}
|
local mytaglist = {}
|
||||||
mytaglist.buttons = awful.util.table.join(
|
mytaglist.buttons = gears.table.join(
|
||||||
awful.button({}, 1, awful.tag.viewonly),
|
awful.button({}, 1, awful.tag.viewonly),
|
||||||
awful.button({ modkey }, 1, awful.client.movetotag),
|
awful.button({ modkey }, 1, awful.client.movetotag),
|
||||||
awful.button({}, 3, awful.tag.viewtoggle),
|
awful.button({}, 3, awful.tag.viewtoggle),
|
||||||
awful.button({ modkey }, 3, awful.client.toggletag),
|
awful.button({ modkey }, 3, awful.client.toggletag),
|
||||||
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
|
awful.button({}, 4, function(t)
|
||||||
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
|
awful.tag.viewnext(t.screen)
|
||||||
|
end),
|
||||||
|
awful.button({}, 5, function(t)
|
||||||
|
awful.tag.viewprev(t.screen)
|
||||||
|
end)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
local function percentage_overlay(p, color, prefix, suffix)
|
local function percentage_overlay(p, color, prefix, suffix)
|
||||||
return (
|
return ('<span color="%s">%s%d%%%s</span>'):format(color, prefix or "", p, suffix or "")
|
||||||
'<span color="%s">%s%d%%%s</span>'
|
|
||||||
):format(color, prefix or "", p, suffix or "")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function add_bar(s, position, direction, first, second)
|
local function add_bar(s, position, direction, first, second)
|
||||||
local newbar = awful.wibar({
|
local newbar = awful.wibar({
|
||||||
position = position,
|
position = position,
|
||||||
|
|
@ -35,29 +35,33 @@ local function add_bar(s, position, direction, first, second)
|
||||||
width = math.floor(s.dpi / 5),
|
width = math.floor(s.dpi / 5),
|
||||||
})
|
})
|
||||||
|
|
||||||
newbar:setup {
|
newbar:setup({
|
||||||
{
|
{
|
||||||
first,
|
first,
|
||||||
nil,
|
nil,
|
||||||
second,
|
second,
|
||||||
layout = wibox.layout.align.horizontal
|
layout = wibox.layout.align.horizontal,
|
||||||
},
|
},
|
||||||
direction = direction,
|
direction = direction,
|
||||||
widget = wibox.container.rotate
|
widget = wibox.container.rotate,
|
||||||
}
|
})
|
||||||
return newbar
|
return newbar
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.setup(s)
|
function widgets.setup(s)
|
||||||
return {
|
return {
|
||||||
left = function(bottom, top) s.leftwibar = add_bar(s, "left", "east", bottom, top) end,
|
left = function(bottom, top)
|
||||||
right = function(top, bottom) s.rightwibar = add_bar(s, "right", "west", top, bottom) end
|
s.leftwibar = add_bar(s, "left", "east", bottom, top)
|
||||||
|
end,
|
||||||
|
right = function(top, bottom)
|
||||||
|
s.rightwibar = add_bar(s, "right", "west", top, bottom)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.mail(mailboxes, notify_pos, title)
|
function widgets.mail(mailboxes, notify_pos, title)
|
||||||
local widget = wibox.widget.textbox()
|
local widget = wibox.widget.textbox()
|
||||||
local bg = wibox.widget { widget, widget = wibox.container.background }
|
local bg = wibox.widget({ widget, widget = wibox.container.background })
|
||||||
|
|
||||||
local callback = function(widget, args)
|
local callback = function(widget, args)
|
||||||
if args[1] > 0 then
|
if args[1] > 0 then
|
||||||
|
|
@ -81,11 +85,19 @@ end
|
||||||
function widgets.layout(s)
|
function widgets.layout(s)
|
||||||
local mylayoutbox = awful.widget.layoutbox(s)
|
local mylayoutbox = awful.widget.layoutbox(s)
|
||||||
|
|
||||||
mylayoutbox:buttons(awful.util.table.join(
|
mylayoutbox:buttons(gears.table.join(
|
||||||
awful.button({ }, 1, function () awful.layout.inc( 1) end),
|
awful.button({}, 1, function()
|
||||||
awful.button({ }, 3, function () awful.layout.inc(-1) end),
|
awful.layout.inc(1)
|
||||||
awful.button({ }, 4, function () awful.layout.inc( 1) end),
|
end),
|
||||||
awful.button({ }, 5, function () awful.layout.inc(-1) end)
|
awful.button({}, 3, function()
|
||||||
|
awful.layout.inc(-1)
|
||||||
|
end),
|
||||||
|
awful.button({}, 4, function()
|
||||||
|
awful.layout.inc(1)
|
||||||
|
end),
|
||||||
|
awful.button({}, 5, function()
|
||||||
|
awful.layout.inc(-1)
|
||||||
|
end)
|
||||||
))
|
))
|
||||||
return mylayoutbox
|
return mylayoutbox
|
||||||
end
|
end
|
||||||
|
|
@ -95,9 +107,7 @@ function widgets.screennum(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.taglist(s)
|
function widgets.taglist(s)
|
||||||
return awful.widget.taglist(
|
return awful.widget.taglist(s, awful.widget.taglist.filter.noempty, mytaglist.buttons)
|
||||||
s, awful.widget.taglist.filter.noempty, mytaglist.buttons
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.systray(s)
|
function widgets.systray(s)
|
||||||
|
|
@ -109,18 +119,19 @@ function widgets.systray(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function graph_label(graph, label, rotation, fontsize)
|
local function graph_label(graph, label, rotation, fontsize)
|
||||||
return wibox.widget {
|
return wibox.widget({
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
text = label,
|
text = label,
|
||||||
font = beautiful.fontface and (beautiful.fontface .. " " .. (fontsize or 7)) or beautiful.font,
|
font = beautiful.fontface and (beautiful.fontface .. " " .. (fontsize or 7)) or beautiful.font,
|
||||||
widget = wibox.widget.textbox
|
widget = wibox.widget.textbox,
|
||||||
},
|
},
|
||||||
direction = rotation or 'east', widget = wibox.container.rotate
|
direction = rotation or "east",
|
||||||
|
widget = wibox.container.rotate,
|
||||||
},
|
},
|
||||||
graph,
|
graph,
|
||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal,
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.cpu(s)
|
function widgets.cpu(s)
|
||||||
|
|
@ -133,16 +144,16 @@ function widgets.ram(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.graph(s, label, viciouswidget, viciousformat, interval)
|
function widgets.graph(s, label, viciouswidget, viciousformat, interval)
|
||||||
local graph = wibox.widget {
|
local graph = wibox.widget({
|
||||||
width = 60,
|
width = 60,
|
||||||
background_color = beautiful.bg_focus,
|
background_color = beautiful.bg_focus,
|
||||||
color = "linear:0,0:0,20:0,#FF0000:0.3,#FFFF00:0.6," .. beautiful.fg_normal,
|
color = "linear:0,0:0,20:0,#FF0000:0.3,#FFFF00:0.6," .. beautiful.fg_normal,
|
||||||
widget = wibox.widget.graph,
|
widget = wibox.widget.graph,
|
||||||
}
|
})
|
||||||
local overlay = wibox.widget {
|
local overlay = wibox.widget({
|
||||||
align = 'center',
|
align = "center",
|
||||||
widget = wibox.widget.textbox
|
widget = wibox.widget.textbox,
|
||||||
}
|
})
|
||||||
local callback = function(widget, args)
|
local callback = function(widget, args)
|
||||||
overlay.markup = percentage_overlay(args[1], beautiful.bg_normal)
|
overlay.markup = percentage_overlay(args[1], beautiful.bg_normal)
|
||||||
return args[1]
|
return args[1]
|
||||||
|
|
@ -153,39 +164,34 @@ function widgets.graph(s, label, viciouswidget, viciousformat, interval)
|
||||||
return {
|
return {
|
||||||
layout = awful.widget.only_on_screen,
|
layout = awful.widget.only_on_screen,
|
||||||
screen = s and s.index or "primary",
|
screen = s and s.index or "primary",
|
||||||
graph_label(
|
graph_label({
|
||||||
{
|
|
||||||
graph,
|
graph,
|
||||||
overlay,
|
overlay,
|
||||||
layout = wibox.layout.stack
|
layout = wibox.layout.stack,
|
||||||
},
|
}, label, nil, 7),
|
||||||
label,
|
|
||||||
nil,
|
|
||||||
7
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function bar_with_overlay(fg, bg, width, height)
|
local function bar_with_overlay(fg, bg, width, height)
|
||||||
local progress = wibox.widget {
|
local progress = wibox.widget({
|
||||||
max_value = 1,
|
max_value = 1,
|
||||||
color = fg,
|
color = fg,
|
||||||
background_color = bg,
|
background_color = bg,
|
||||||
forced_width = width,
|
forced_width = width,
|
||||||
forced_height = height,
|
forced_height = height,
|
||||||
widget = wibox.widget.progressbar,
|
widget = wibox.widget.progressbar,
|
||||||
}
|
})
|
||||||
|
|
||||||
progress.overlay = wibox.widget {
|
progress.overlay = wibox.widget({
|
||||||
font = beautiful.fontface and (beautiful.fontface .. " " .. 7) or beautiful.font,
|
font = beautiful.fontface and (beautiful.fontface .. " " .. 7) or beautiful.font,
|
||||||
align = 'center',
|
align = "center",
|
||||||
widget = wibox.widget.textbox
|
widget = wibox.widget.textbox,
|
||||||
}
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
progress,
|
progress,
|
||||||
progress.overlay,
|
progress.overlay,
|
||||||
layout = wibox.layout.stack
|
layout = wibox.layout.stack,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -193,10 +199,7 @@ end
|
||||||
function widgets.battery(s)
|
function widgets.battery(s)
|
||||||
local bat1 = bar_with_overlay(beautiful.fg_focus, beautiful.bg_focus, 100, math.floor(s.dpi / 10))
|
local bat1 = bar_with_overlay(beautiful.fg_focus, beautiful.bg_focus, 100, math.floor(s.dpi / 10))
|
||||||
|
|
||||||
local combined_bats = graph_label(
|
local combined_bats = graph_label(bat1, "BAT")
|
||||||
bat1,
|
|
||||||
"BAT"
|
|
||||||
)
|
|
||||||
|
|
||||||
local callback = function(widget, args)
|
local callback = function(widget, args)
|
||||||
if args[2] == 0 then
|
if args[2] == 0 then
|
||||||
|
|
@ -209,9 +212,7 @@ function widgets.battery(s)
|
||||||
else
|
else
|
||||||
widget.background_color = beautiful.bg_focus
|
widget.background_color = beautiful.bg_focus
|
||||||
end
|
end
|
||||||
widget.overlay.markup = percentage_overlay(
|
widget.overlay.markup = percentage_overlay(args[2], beautiful.bg_normal, args[1] .. " ")
|
||||||
args[2], beautiful.bg_normal, args[1] .. " "
|
|
||||||
)
|
|
||||||
return args[2]
|
return args[2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -230,16 +231,23 @@ local tasklist_buttons = gears.table.join(
|
||||||
c:emit_signal("request::activate", "tasklist", { raise = true })
|
c:emit_signal("request::activate", "tasklist", { raise = true })
|
||||||
end
|
end
|
||||||
end),
|
end),
|
||||||
awful.button({ }, 3, function() awful.menu.client_list({ theme = { width = 250 } }) end),
|
awful.button({}, 3, function()
|
||||||
awful.button({ }, 4, function() awful.client.focus.byidx(1) end),
|
awful.menu.client_list({ theme = { width = 250 } })
|
||||||
awful.button({ }, 5, function() awful.client.focus.byidx(-1) end))
|
end),
|
||||||
|
awful.button({}, 4, function()
|
||||||
|
awful.client.focus.byidx(1)
|
||||||
|
end),
|
||||||
|
awful.button({}, 5, function()
|
||||||
|
awful.client.focus.byidx(-1)
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
|
||||||
-- display a taskbar
|
-- display a taskbar
|
||||||
-- `when` is a function taking the current screen, that is called on the given signal, and should return true if the
|
-- `when` is a function taking the current screen, that is called on the given signal, and should return true if the
|
||||||
-- taskbar should be shown.
|
-- taskbar should be shown.
|
||||||
-- If signal and when are not given, the taskbar will be visible on tags with "max" layout
|
-- If signal and when are not given, the taskbar will be visible on tags with "max" layout
|
||||||
function widgets.dynamic_taskbar(s, signal, when)
|
function widgets.dynamic_taskbar(s, signal, when)
|
||||||
s.mytasklist = awful.widget.tasklist {
|
s.mytasklist = awful.widget.tasklist({
|
||||||
screen = s,
|
screen = s,
|
||||||
filter = awful.widget.tasklist.filter.currenttags,
|
filter = awful.widget.tasklist.filter.currenttags,
|
||||||
style = {
|
style = {
|
||||||
|
|
@ -253,32 +261,32 @@ function widgets.dynamic_taskbar(s, signal, when)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ id = 'icon_role',
|
{ id = "icon_role", widget = wibox.widget.imagebox },
|
||||||
widget = wibox.widget.imagebox, },
|
|
||||||
margins = 2,
|
margins = 2,
|
||||||
widget = wibox.container.margin,
|
widget = wibox.container.margin,
|
||||||
},
|
},
|
||||||
{ id = 'text_role',
|
{ id = "text_role", widget = wibox.widget.textbox },
|
||||||
widget = wibox.widget.textbox, },
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
layout = wibox.layout.fixed.horizontal,
|
||||||
},
|
},
|
||||||
left = 20,
|
left = 20,
|
||||||
right = 15,
|
right = 15,
|
||||||
widget = wibox.container.margin
|
widget = wibox.container.margin,
|
||||||
},
|
},
|
||||||
id = 'background_role',
|
id = "background_role",
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
s.taskbar = awful.wibar({
|
s.taskbar = awful.wibar({
|
||||||
position = "top",
|
position = "top",
|
||||||
screen = s,
|
screen = s,
|
||||||
opacity = 0.8,
|
opacity = 0.8,
|
||||||
height = math.floor(s.dpi / 4),
|
height = math.floor(s.dpi / 4),
|
||||||
widget = s.mytasklist
|
widget = s.mytasklist,
|
||||||
})
|
})
|
||||||
|
|
||||||
local condition = when or function(s) return awful.layout.get(s).name == "max" end
|
local condition = when or function(s)
|
||||||
|
return awful.layout.get(s).name == "max"
|
||||||
|
end
|
||||||
s:connect_signal(signal or "tag::history::update", function()
|
s:connect_signal(signal or "tag::history::update", function()
|
||||||
s.taskbar.visible = condition(s)
|
s.taskbar.visible = condition(s)
|
||||||
end)
|
end)
|
||||||
|
|
@ -290,4 +298,8 @@ function widgets.update(name)
|
||||||
vicious.force(wlist)
|
vicious.force(wlist)
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(widgets, { __call = function(_, ...) return widgets.setup(...) end })
|
return setmetatable(widgets, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return widgets.setup(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue