Compare commits

..

No commits in common. "somewm" and "master" have entirely different histories.

17 changed files with 236 additions and 340 deletions

View file

@ -1,26 +0,0 @@
---@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

View file

@ -1,14 +0,0 @@
---@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

View file

@ -1,8 +0,0 @@
{
"$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"
}

View file

@ -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.notification({ text = "Notifications enabled", timeout = 2 }) naughty.notify({ text = "Notifications enabled", timeout = 2 })
else else
naughty.notification({ text = "Notifications disabled", timeout = 2 }) naughty.notify({ text = "Notifications disabled", timeout = 2 })
naughty.suspend() naughty.suspend()
end end
end end

View file

@ -1,36 +0,0 @@
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

View file

@ -40,7 +40,7 @@ conf.cmd = {
} }
-- Mod-r binding for running programs -- Mod-r binding for running programs
conf.cmd.run = function() awful.spawn("dmenu_run -l 10 -y 350") end conf.cmd.run = function() awful.util.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

33
mpd.lua
View file

@ -26,22 +26,14 @@ local function mpc(command)
end end
local function dmenu(opts) local function dmenu(opts)
log.spawn( log.spawn("dmpc -h " .. settings.host .. " -p " .. settings.port .. " " ..
"dmpc -h " (settings.replace_on_search and "-r" or "-R") .. " " .. opts)
.. 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.notification({ naughty.notify({
text = stext, text= stext
}) })
end end
end end
@ -53,27 +45,28 @@ 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 = {}
M.ctrl.toggle = function() M.ctrl.toggle = function ()
mpc("toggle") mpc("toggle")
end end
M.ctrl.play = function() M.ctrl.play = function ()
mpc("play") mpc("play")
end end
M.ctrl.pause = function() M.ctrl.pause = function ()
mpc("pause") mpc("pause")
end end
M.ctrl.next = function() M.ctrl.next = function ()
mpc("next") mpc("next")
end end
M.ctrl.prev = function() M.ctrl.prev = function ()
mpc("prev") mpc("prev")
end end
@ -95,6 +88,7 @@ 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
@ -109,11 +103,14 @@ 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 " .. (settings.replace_on_search and "replace" or "add to") .. " the playlist") notify("MPD prompts now " ..(
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 :

View file

@ -1,6 +1,5 @@
-- 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")
@ -24,7 +23,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.spawn("mpd-host set " .. host .. " 6600") awful.util.spawn("mpd-host set " .. host .. " 6600")
end end
end end
@ -125,7 +124,7 @@ local notifymap = {
{ "m", binder.spawn("newmails -p"), "Show unread mails" }, { "m", binder.spawn("newmails -p"), "Show unread mails" },
} }
local myglobalkeys = gears.table.join( local myglobalkeys = awful.util.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
View file

@ -1,11 +1,10 @@
-- 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")
@ -14,9 +13,9 @@ require("awful.autofocus")
require("util.errors") require("util.errors")
-- }}} -- }}}
require("tapestry") beautiful.init(awful.util.getdir("config") .. "/theme.lua")
awful.input.xkb_layout = "us_de" require("tapestry")
-- {{{ Logging -- {{{ Logging
local log = require("talkative") local log = require("talkative")
@ -77,12 +76,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 = gears.filesystem.get_dir("config") .. "/mybindings.lua" local mybindings = awful.util.getdir("config") .. "/mybindings.lua"
binder.add_reloadable(function() binder.add_reloadable(function()
return dofile(mybindings) return dofile(mybindings)
end) end)
binder.add_bindings(gears.table.join( binder.add_bindings(awful.util.table.join(
awful.key({}, "XF86AudioRaiseVolume", function() awful.key({}, "XF86AudioRaiseVolume", function()
speakerwheel:up() speakerwheel:up()
end), end),
@ -110,7 +109,7 @@ binder.apply()
require("rules") require("rules")
require("signals") require("signals")
local autorun_file = gears.filesystem.get_dir("config") .. "/autorun" local autorun_file = awful.util.getdir("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

View file

@ -1,8 +1,8 @@
local beautiful = require("beautiful")
local awful = require("awful") local awful = require("awful")
awful.rules = require("awful.rules")
local localconf = require("localconf") local localconf = require("localconf")
local ruled = require("ruled")
local beautiful = require("beautiful")
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.notification({ text = message }) naughty.notify({ 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.spawn("kontroll-launch set-layer --index " .. num) awful.util.spawn("kontroll-launch set-layer --index " .. num)
naughty.notification({ text = "kontroll: switching to layer " .. num }) naughty.notify({ text = "kontroll: switching to layer " .. num })
end) end)
client:connect_signal("unfocus", function(c) client:connect_signal("unfocus", function(c)
awful.spawn("kontroll-launch set-layer --index 0") awful.util.spawn("kontroll-launch set-layer --index 0")
naughty.notification({ text = "kontroll: switching to base layer" }) naughty.notify({ 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
ruled.client.append_rules({ awful.rules.rules = {
-- All clients will match this rule. -- All clients will match this rule.
{ {
rule = {}, rule = {},
@ -158,4 +158,4 @@ ruled.client.append_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 },
}, },
}) }

View file

@ -1,6 +1,5 @@
-- 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"
@ -102,13 +101,12 @@ 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 = gears.geometry.rectangle.get_in_direction(dir, geomtbl, screen[sel].geometry) local target = awful.util.get_rectangle_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 = new_target = awful.util.get_rectangle_in_direction(opposite_dirs[dir], geomtbl, screen[target].geometry)
gears.geometry.rectangle.get_in_direction(opposite_dirs[dir], geomtbl, screen[target].geometry)
end end
end end
@ -116,15 +114,22 @@ 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)
c:move_to_screen(target) awful.client.movetoscreen(c, target)
end end
end end
function binder.add_bindings(keys) function binder.add_bindings(keys)
globalkeys = gears.table.join(globalkeys, keys) globalkeys = awful.util.table.join(globalkeys, keys)
return binder return binder
end end
@ -139,11 +144,11 @@ function binder.clear()
end end
function binder.apply() function binder.apply()
naughty.notification({ text = "Reloading key bindings" }) naughty.notify({ text = "Reloading key bindings" })
local allkeys = gears.table.clone(globalkeys) local allkeys = awful.util.table.clone(globalkeys)
for _, v in pairs(globalkeyfuncs) do for _, v in pairs(globalkeyfuncs) do
local loadedkeys = v() local loadedkeys = v()
allkeys = gears.table.join(allkeys, loadedkeys) allkeys = awful.util.table.join(allkeys, loadedkeys)
end end
root.keys(allkeys) root.keys(allkeys)
end end
@ -160,7 +165,7 @@ local function client_opacity_set(c, default, max, step)
end end
end end
local clientkeys = gears.table.join( local clientkeys = awful.util.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),
@ -171,9 +176,7 @@ local clientkeys = gears.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", function(c) awful.key({ modkey }, "o", awful.client.movetoscreen),
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)
@ -190,7 +193,7 @@ local clientkeys = gears.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)
naughty.notification({ require("naughty").notify({
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"],
@ -203,9 +206,9 @@ local clientkeys = gears.table.join(
end) end)
) )
root.buttons(gears.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev))) root.buttons(awful.util.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev)))
local clientbuttons = gears.table.join( local clientbuttons = awful.util.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
@ -227,14 +230,14 @@ function binder.client.keys()
end end
function binder.client.add_buttons(buttons) function binder.client.add_buttons(buttons)
clientbuttons = gears.table.join(clientbuttons, buttons) clientbuttons = awful.util.table.join(clientbuttons, buttons)
end end
function binder.client.add_bindings(keys) function binder.client.add_bindings(keys)
clientkeys = gears.table.join(clientkeys, keys) clientkeys = awful.util.table.join(clientkeys, keys)
end end
local default_bindings = gears.table.join( local default_bindings = awful.util.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)),

View file

@ -1,13 +1,15 @@
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 not c.size_hints.user_position and not c.size_hints.program_position then if awesome.startup and
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
@ -24,26 +26,18 @@ local fixed_clients = {
} }
local function may_lose_focus(c) local function may_lose_focus(c)
if c == nil then if c == nil then return true end
return true return not awful.rules.matches_list(c, fixed_clients)
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 if may_lose_focus(client.focus)
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) and awful.client.focus.filter(c) then
then
client.focus = c client.focus = c
end end
end) end)
client.connect_signal("focus", function(c) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
c.border_color = beautiful.border_focus client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
end)
client.connect_signal("unfocus", function(c)
c.border_color = beautiful.border_normal
end)

View file

@ -1,12 +1,11 @@
-- 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.append_default_layouts({ awful.layout.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,
@ -14,10 +13,16 @@ awful.layout.append_default_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 ()
local screen = awful.screen.focused() local screen = awful.screen.focused()
local tag = screen.tags[i] local tag = screen.tags[i]
if tag then if tag then
@ -27,7 +32,7 @@ local function getfunc_viewonly(i)
end end
local function getfunc_viewtoggle(i) local function getfunc_viewtoggle(i)
return function() return function ()
local screen = awful.screen.focused() local screen = awful.screen.focused()
local tag = screen.tags[i] local tag = screen.tags[i]
if tag then if tag then
@ -37,7 +42,7 @@ local function getfunc_viewtoggle(i)
end end
local function getfunc_moveto(i) local function getfunc_moveto(i)
return function() return function ()
if client.focus then if client.focus then
local tag = client.focus.screen.tags[i] local tag = client.focus.screen.tags[i]
if tag then if tag then
@ -48,7 +53,7 @@ local function getfunc_moveto(i)
end end
local function getfunc_clienttoggle(i) local function getfunc_clienttoggle(i)
return function() return function ()
if client.focus then if client.focus then
local tag = client.focus.screen.tags[i] local tag = client.focus.screen.tags[i]
if tag then if tag then
@ -59,20 +64,20 @@ local function getfunc_clienttoggle(i)
end end
local tagdef = { local tagdef = {
{ "1" }, {"1"},
{ "2", { layout = awful.layout.suit.max } }, {"2", { layout = awful.layout.suit.max }},
{ "3" }, {"3"},
{ "4", { layout = awful.layout.suit.max } }, {"4", { layout = awful.layout.suit.max }},
{ "5" }, {"5"},
{ "6" }, {"6"},
{ "7" }, {"7"},
{ "8" }, {"8"},
{ "9" }, {"9"},
{ "0" }, {"0"},
{ "F1", { layout = awful.layout.suit.max } }, {"F1", { layout = awful.layout.suit.max }},
{ "F2" }, {"F2"},
{ "F3" }, {"F3"},
{ "F4", { layout = awful.layout.suit.max } }, {"F4", { layout = awful.layout.suit.max }},
} }
local function defaultlayout(s) local function defaultlayout(s)
@ -85,8 +90,11 @@ 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], gears.table.join({ screen = s }, t[2] or { layout = defaultlayout(s) })) awful.tag.add(t[1], awful.util.table.join(
{screen = s},
t[2] or { layout = defaultlayout(s) }
))
end end
s.tags[1]:view_only() s.tags[1]:view_only()
end) end)
@ -105,24 +113,22 @@ 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 = gears.table.join( tagkeys = awful.util.table.join(tagkeys,
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)), awful.key( { modkey, "Control", "Shift" }, k, getfunc_clienttoggle(i))
awful.key({ modkey, "Control", "Shift" }, k, getfunc_clienttoggle(i))
) )
end end
-- keys for all tags -- keys for all tags
tagkeys = gears.table.join( tagkeys = awful.util.table.join(tagkeys,
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 ca93752bef7cd662f9a102d3aa05c7b1c6adb4b5 Subproject commit 95b709fa483363c894c22e5bf0e3060915e49411

@ -1 +1 @@
Subproject commit fdf23d8580ea94cad21a2221b41931c4289bb74f Subproject commit 5bb7a7d0510ea1adecf1a175444cdbcca13b7e71

View file

@ -5,28 +5,22 @@ 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.notification({ naughty.notify({ preset = naughty.config.presets.critical,
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
do 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 if in_error then return end
return
end
in_error = true in_error = true
naughty.notification({ naughty.notify({ preset = naughty.config.presets.critical,
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

View file

@ -10,23 +10,23 @@ local gears = require("gears")
local wlist = {} local wlist = {}
local mytaglist = {} local mytaglist = {}
mytaglist.buttons = gears.table.join( mytaglist.buttons = awful.util.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.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
awful.tag.viewnext(t.screen) awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
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 ('<span color="%s">%s%d%%%s</span>'):format(color, prefix or "", p, suffix or "") return (
'<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,33 +35,29 @@ 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) left = function(bottom, top) s.leftwibar = add_bar(s, "left", "east", bottom, top) end,
s.leftwibar = add_bar(s, "left", "east", bottom, top) right = function(top, bottom) s.rightwibar = add_bar(s, "right", "west", top, bottom) end
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
@ -75,7 +71,7 @@ function widgets.mail(mailboxes, notify_pos, title)
else else
bg.visible = false bg.visible = false
end end
return "⬓⬓ Unread " .. args[2] .. " / New " .. args[1] .. " " return "⬓⬓ Unread "..args[2].." / New "..args[1].. " "
end end
vicious.register(widget, vicious.widgets.mdir, callback, 60, mailboxes) vicious.register(widget, vicious.widgets.mdir, callback, 60, mailboxes)
table.insert(wlist, widget) table.insert(wlist, widget)
@ -85,19 +81,11 @@ end
function widgets.layout(s) function widgets.layout(s)
local mylayoutbox = awful.widget.layoutbox(s) local mylayoutbox = awful.widget.layoutbox(s)
mylayoutbox:buttons(gears.table.join( mylayoutbox:buttons(awful.util.table.join(
awful.button({}, 1, function() awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.layout.inc(1) awful.button({ }, 3, function () awful.layout.inc(-1) end),
end), awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({}, 3, function() awful.button({ }, 5, function () awful.layout.inc(-1) end)
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
@ -107,7 +95,9 @@ function widgets.screennum(s)
end end
function widgets.taglist(s) function widgets.taglist(s)
return awful.widget.taglist(s, awful.widget.taglist.filter.noempty, mytaglist.buttons) return awful.widget.taglist(
s, awful.widget.taglist.filter.noempty, mytaglist.buttons
)
end end
function widgets.systray(s) function widgets.systray(s)
@ -119,19 +109,18 @@ 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", direction = rotation or 'east', widget = wibox.container.rotate
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)
@ -144,16 +133,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]
@ -164,34 +153,39 @@ 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
@ -199,9 +193,12 @@ 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(bat1, "BAT") local combined_bats = graph_label(
bat1,
"BAT"
)
local callback = function(widget, args) local callback = function (widget, args)
if args[2] == 0 then if args[2] == 0 then
combined_bats:set_visible(false) combined_bats:set_visible(false)
return "" return ""
@ -212,7 +209,9 @@ 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(args[2], beautiful.bg_normal, args[1] .. " ") widget.overlay.markup = percentage_overlay(
args[2], beautiful.bg_normal, args[1] .. " "
)
return args[2] return args[2]
end end
end end
@ -224,30 +223,23 @@ function widgets.battery(s)
end end
local tasklist_buttons = gears.table.join( local tasklist_buttons = gears.table.join(
awful.button({}, 1, function(c) awful.button({ }, 1, function(c)
if c == client.focus then if c == client.focus then
c.minimized = true c.minimized = true
else else
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.button({ }, 3, function() awful.menu.client_list({ theme = { width = 250 } }) end),
awful.menu.client_list({ theme = { width = 250 } }) awful.button({ }, 4, function() awful.client.focus.byidx(1) end),
end), awful.button({ }, 5, function() awful.client.focus.byidx(-1) 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 = {
@ -261,32 +253,32 @@ function widgets.dynamic_taskbar(s, signal, when)
{ {
{ {
{ {
{ id = "icon_role", widget = wibox.widget.imagebox }, { id = 'icon_role',
widget = wibox.widget.imagebox, },
margins = 2, margins = 2,
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
{ id = "text_role", widget = wibox.widget.textbox }, { id = 'text_role',
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) local condition = when or function(s) return awful.layout.get(s).name == "max" end
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)
@ -298,8 +290,4 @@ function widgets.update(name)
vicious.force(wlist) vicious.force(wlist)
end end
return setmetatable(widgets, { return setmetatable(widgets, { __call = function(_, ...) return widgets.setup(...) end })
__call = function(_, ...)
return widgets.setup(...)
end,
})