Compare commits
No commits in common. "somewm" and "master" have entirely different histories.
17 changed files with 236 additions and 340 deletions
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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"
|
||||
}
|
||||
|
|
@ -5,9 +5,9 @@ local actions = {}
|
|||
function actions.toggle_naughty()
|
||||
if naughty.is_suspended() then
|
||||
naughty.resume()
|
||||
naughty.notification({ text = "Notifications enabled", timeout = 2 })
|
||||
naughty.notify({ text = "Notifications enabled", timeout = 2 })
|
||||
else
|
||||
naughty.notification({ text = "Notifications disabled", timeout = 2 })
|
||||
naughty.notify({ text = "Notifications disabled", timeout = 2 })
|
||||
naughty.suspend()
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -40,7 +40,7 @@ conf.cmd = {
|
|||
}
|
||||
|
||||
-- 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")
|
||||
conf.cmd.drun = menubar.show
|
||||
|
||||
|
|
|
|||
33
mpd.lua
33
mpd.lua
|
|
@ -26,22 +26,14 @@ local function mpc(command)
|
|||
end
|
||||
|
||||
local function dmenu(opts)
|
||||
log.spawn(
|
||||
"dmpc -h "
|
||||
.. settings.host
|
||||
.. " -p "
|
||||
.. settings.port
|
||||
.. " "
|
||||
.. (settings.replace_on_search and "-r" or "-R")
|
||||
.. " "
|
||||
.. opts
|
||||
)
|
||||
log.spawn("dmpc -h " .. settings.host .. " -p " .. settings.port .. " " ..
|
||||
(settings.replace_on_search and "-r" or "-R") .. " " .. opts)
|
||||
end
|
||||
|
||||
local function notify(stext)
|
||||
if not (naughty == nil) then
|
||||
naughty.notification({
|
||||
text = stext,
|
||||
naughty.notify({
|
||||
text= stext
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
@ -53,27 +45,28 @@ M.set_server = function(host, port)
|
|||
notify("Using mpd server " .. settings.host .. ":" .. settings.port)
|
||||
end
|
||||
|
||||
|
||||
-- {{{ mpd.ctrl submodule
|
||||
|
||||
M.ctrl = {}
|
||||
|
||||
M.ctrl.toggle = function()
|
||||
M.ctrl.toggle = function ()
|
||||
mpc("toggle")
|
||||
end
|
||||
|
||||
M.ctrl.play = function()
|
||||
M.ctrl.play = function ()
|
||||
mpc("play")
|
||||
end
|
||||
|
||||
M.ctrl.pause = function()
|
||||
M.ctrl.pause = function ()
|
||||
mpc("pause")
|
||||
end
|
||||
|
||||
M.ctrl.next = function()
|
||||
M.ctrl.next = function ()
|
||||
mpc("next")
|
||||
end
|
||||
|
||||
M.ctrl.prev = function()
|
||||
M.ctrl.prev = function ()
|
||||
mpc("prev")
|
||||
end
|
||||
|
||||
|
|
@ -95,6 +88,7 @@ M.prompt.album = function()
|
|||
dmenu("-A -b")
|
||||
end
|
||||
|
||||
|
||||
M.prompt.title = function()
|
||||
dmenu("-A -b -t")
|
||||
end
|
||||
|
|
@ -109,11 +103,14 @@ end
|
|||
|
||||
M.prompt.toggle_replace_on_search = function()
|
||||
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
|
||||
|
||||
-- }}}
|
||||
|
||||
|
||||
return M
|
||||
|
||||
-- vim: set fenc=utf-8 tw=80 foldmethod=marker :
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
-- key bindings
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local conf = require("localconf")
|
||||
|
||||
local actions = require("actions")
|
||||
|
|
@ -24,7 +23,7 @@ lockhl:setup(wibars, "#F2C740", require("beautiful").bg_normal, { Caps = false }
|
|||
local function mpdserver(host)
|
||||
return function()
|
||||
mpd.set_server(host, "6600")
|
||||
awful.spawn("mpd-host set " .. host .. " 6600")
|
||||
awful.util.spawn("mpd-host set " .. host .. " 6600")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -125,7 +124,7 @@ local notifymap = {
|
|||
{ "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({ modkey }, "w", binder.spawn("rofi -show window")),
|
||||
awful.key({}, "Print", binder.spawn("flameshot gui")),
|
||||
|
|
|
|||
13
rc.lua
13
rc.lua
|
|
@ -1,11 +1,10 @@
|
|||
-- If LuaRocks is installed, make sure that packages installed through it are
|
||||
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||
--pcall(require, "luarocks.loader")
|
||||
pcall(require, "luarocks.loader")
|
||||
-- libraries {{{
|
||||
local awful = require("awful")
|
||||
local beautiful = require("beautiful")
|
||||
local gears = require("gears")
|
||||
beautiful.init(gears.filesystem.get_dir("config") .. "/theme.lua")
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
--- for debugging
|
||||
local inspect = require("inspect")
|
||||
|
|
@ -14,9 +13,9 @@ require("awful.autofocus")
|
|||
require("util.errors")
|
||||
-- }}}
|
||||
|
||||
require("tapestry")
|
||||
beautiful.init(awful.util.getdir("config") .. "/theme.lua")
|
||||
|
||||
awful.input.xkb_layout = "us_de"
|
||||
require("tapestry")
|
||||
|
||||
-- {{{ Logging
|
||||
local log = require("talkative")
|
||||
|
|
@ -77,12 +76,12 @@ binder.modal.set_opacity(0.8)
|
|||
|
||||
binder.add_default_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()
|
||||
return dofile(mybindings)
|
||||
end)
|
||||
|
||||
binder.add_bindings(gears.table.join(
|
||||
binder.add_bindings(awful.util.table.join(
|
||||
awful.key({}, "XF86AudioRaiseVolume", function()
|
||||
speakerwheel:up()
|
||||
end),
|
||||
|
|
@ -110,7 +109,7 @@ binder.apply()
|
|||
require("rules")
|
||||
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
|
||||
awful.spawn(autorun_file)
|
||||
end
|
||||
|
|
|
|||
18
rules.lua
18
rules.lua
|
|
@ -1,8 +1,8 @@
|
|||
local beautiful = require("beautiful")
|
||||
local awful = require("awful")
|
||||
awful.rules = require("awful.rules")
|
||||
local localconf = require("localconf")
|
||||
local ruled = require("ruled")
|
||||
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local binder = require("separable.binder")
|
||||
local log = require("talkative")
|
||||
|
|
@ -11,7 +11,7 @@ local log = require("talkative")
|
|||
local function popup_urgent(client, message)
|
||||
client:connect_signal("property::urgent", function(c)
|
||||
if c.urgent and not c.focus then
|
||||
naughty.notification({ text = message })
|
||||
naughty.notify({ text = message })
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
@ -19,12 +19,12 @@ end
|
|||
local function keyboard_layer(num)
|
||||
return function(client)
|
||||
client:connect_signal("focus", function(c)
|
||||
awful.spawn("kontroll-launch set-layer --index " .. num)
|
||||
naughty.notification({ text = "kontroll: switching to layer " .. num })
|
||||
awful.util.spawn("kontroll-launch set-layer --index " .. num)
|
||||
naughty.notify({ text = "kontroll: switching to layer " .. num })
|
||||
end)
|
||||
client:connect_signal("unfocus", function(c)
|
||||
awful.spawn("kontroll-launch set-layer --index 0")
|
||||
naughty.notification({ text = "kontroll: switching to base layer" })
|
||||
awful.util.spawn("kontroll-launch set-layer --index 0")
|
||||
naughty.notify({ text = "kontroll: switching to base layer" })
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
@ -41,7 +41,7 @@ function startswith(str, start)
|
|||
return str:sub(1, #start) == start
|
||||
end
|
||||
|
||||
ruled.client.append_rules({
|
||||
awful.rules.rules = {
|
||||
-- All clients will match this rule.
|
||||
{
|
||||
rule = {},
|
||||
|
|
@ -158,4 +158,4 @@ ruled.client.append_rules({
|
|||
rule = { class = "zenity" },
|
||||
properties = { ontop = true, floating = true, placement = awful.placement.centered },
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
-- key bindings
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
local conf = require("localconf")
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
|
|
@ -102,13 +101,12 @@ local function screen_in_wrapdir(dir, _screen)
|
|||
for s = 1, screen.count() do
|
||||
geomtbl[s] = screen[s].geometry
|
||||
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
|
||||
local new_target = sel
|
||||
while new_target do
|
||||
target = new_target
|
||||
new_target =
|
||||
gears.geometry.rectangle.get_in_direction(opposite_dirs[dir], geomtbl, screen[target].geometry)
|
||||
new_target = awful.util.get_rectangle_in_direction(opposite_dirs[dir], geomtbl, screen[target].geometry)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -116,15 +114,22 @@ local function screen_in_wrapdir(dir, _screen)
|
|||
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)
|
||||
return function(c)
|
||||
local target = screen_in_wrapdir(dir)
|
||||
c:move_to_screen(target)
|
||||
awful.client.movetoscreen(c, target)
|
||||
end
|
||||
end
|
||||
|
||||
function binder.add_bindings(keys)
|
||||
globalkeys = gears.table.join(globalkeys, keys)
|
||||
globalkeys = awful.util.table.join(globalkeys, keys)
|
||||
return binder
|
||||
end
|
||||
|
||||
|
|
@ -139,11 +144,11 @@ function binder.clear()
|
|||
end
|
||||
|
||||
function binder.apply()
|
||||
naughty.notification({ text = "Reloading key bindings" })
|
||||
local allkeys = gears.table.clone(globalkeys)
|
||||
naughty.notify({ text = "Reloading key bindings" })
|
||||
local allkeys = awful.util.table.clone(globalkeys)
|
||||
for _, v in pairs(globalkeyfuncs) do
|
||||
local loadedkeys = v()
|
||||
allkeys = gears.table.join(allkeys, loadedkeys)
|
||||
allkeys = awful.util.table.join(allkeys, loadedkeys)
|
||||
end
|
||||
root.keys(allkeys)
|
||||
end
|
||||
|
|
@ -160,7 +165,7 @@ local function client_opacity_set(c, default, max, step)
|
|||
end
|
||||
end
|
||||
|
||||
local clientkeys = gears.table.join(
|
||||
local clientkeys = awful.util.table.join(
|
||||
awful.key({ modkey, "Shift" }, "f", function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
end),
|
||||
|
|
@ -171,9 +176,7 @@ local clientkeys = gears.table.join(
|
|||
awful.key({ modkey, "Control" }, "Return", function(c)
|
||||
c:swap(awful.client.getmaster())
|
||||
end),
|
||||
awful.key({ modkey }, "o", function(c)
|
||||
c:move_to_screen()
|
||||
end),
|
||||
awful.key({ modkey }, "o", awful.client.movetoscreen),
|
||||
awful.key({ modkey, "Shift" }, "h", screen_move_client_wrapdir("left")),
|
||||
awful.key({ modkey, "Shift" }, "l", screen_move_client_wrapdir("right")),
|
||||
awful.key({ modkey, "Control" }, "o", function(c)
|
||||
|
|
@ -190,7 +193,7 @@ local clientkeys = gears.table.join(
|
|||
end),
|
||||
awful.key({}, "XF86Calculater", awful.client.movetoscreen),
|
||||
awful.key({ modkey }, "i", function(c)
|
||||
naughty.notification({
|
||||
require("naughty").notify({
|
||||
text = string.format(
|
||||
"name: '%s'\nclass: '%s'\ninstance: '%s'\ntype: '%s'\npid: %d",
|
||||
c["name"],
|
||||
|
|
@ -203,9 +206,9 @@ local clientkeys = gears.table.join(
|
|||
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)
|
||||
if c.name ~= "Onboard" then
|
||||
client.focus = c
|
||||
|
|
@ -227,14 +230,14 @@ function binder.client.keys()
|
|||
end
|
||||
|
||||
function binder.client.add_buttons(buttons)
|
||||
clientbuttons = gears.table.join(clientbuttons, buttons)
|
||||
clientbuttons = awful.util.table.join(clientbuttons, buttons)
|
||||
end
|
||||
|
||||
function binder.client.add_bindings(keys)
|
||||
clientkeys = gears.table.join(clientkeys, keys)
|
||||
clientkeys = awful.util.table.join(clientkeys, keys)
|
||||
end
|
||||
|
||||
local default_bindings = gears.table.join(
|
||||
local default_bindings = awful.util.table.join(
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
awful.key({ modkey }, "Return", spawnf(conf.cmd.terminal)),
|
||||
|
|
|
|||
28
signals.lua
28
signals.lua
|
|
@ -1,13 +1,15 @@
|
|||
local awful = require("awful")
|
||||
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,
|
||||
-- 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 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.
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
|
|
@ -24,26 +26,18 @@ local fixed_clients = {
|
|||
}
|
||||
|
||||
local function may_lose_focus(c)
|
||||
if c == nil then
|
||||
return true
|
||||
end
|
||||
return not ruled.client.matches_list(c, fixed_clients)
|
||||
if c == nil then return true end
|
||||
return not awful.rules.matches_list(c, fixed_clients)
|
||||
end
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
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.client.focus.filter(c)
|
||||
then
|
||||
and awful.client.focus.filter(c) then
|
||||
client.focus = c
|
||||
end
|
||||
end)
|
||||
|
||||
client.connect_signal("focus", function(c)
|
||||
c.border_color = beautiful.border_focus
|
||||
end)
|
||||
client.connect_signal("unfocus", function(c)
|
||||
c.border_color = beautiful.border_normal
|
||||
end)
|
||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||
|
|
|
|||
76
tags.lua
76
tags.lua
|
|
@ -1,12 +1,11 @@
|
|||
-- tags
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local conf = require("localconf")
|
||||
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.horizontal,
|
||||
awful.layout.suit.tile,
|
||||
|
|
@ -14,10 +13,16 @@ awful.layout.append_default_layouts({
|
|||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
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)
|
||||
return function()
|
||||
return function ()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
|
|
@ -27,7 +32,7 @@ local function getfunc_viewonly(i)
|
|||
end
|
||||
|
||||
local function getfunc_viewtoggle(i)
|
||||
return function()
|
||||
return function ()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
|
|
@ -37,7 +42,7 @@ local function getfunc_viewtoggle(i)
|
|||
end
|
||||
|
||||
local function getfunc_moveto(i)
|
||||
return function()
|
||||
return function ()
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
|
|
@ -48,7 +53,7 @@ local function getfunc_moveto(i)
|
|||
end
|
||||
|
||||
local function getfunc_clienttoggle(i)
|
||||
return function()
|
||||
return function ()
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
|
|
@ -59,20 +64,20 @@ local function getfunc_clienttoggle(i)
|
|||
end
|
||||
|
||||
local tagdef = {
|
||||
{ "1" },
|
||||
{ "2", { layout = awful.layout.suit.max } },
|
||||
{ "3" },
|
||||
{ "4", { layout = awful.layout.suit.max } },
|
||||
{ "5" },
|
||||
{ "6" },
|
||||
{ "7" },
|
||||
{ "8" },
|
||||
{ "9" },
|
||||
{ "0" },
|
||||
{ "F1", { layout = awful.layout.suit.max } },
|
||||
{ "F2" },
|
||||
{ "F3" },
|
||||
{ "F4", { layout = awful.layout.suit.max } },
|
||||
{"1"},
|
||||
{"2", { layout = awful.layout.suit.max }},
|
||||
{"3"},
|
||||
{"4", { layout = awful.layout.suit.max }},
|
||||
{"5"},
|
||||
{"6"},
|
||||
{"7"},
|
||||
{"8"},
|
||||
{"9"},
|
||||
{"0"},
|
||||
{"F1", { layout = awful.layout.suit.max }},
|
||||
{"F2"},
|
||||
{"F3"},
|
||||
{"F4", { layout = awful.layout.suit.max }},
|
||||
}
|
||||
|
||||
local function defaultlayout(s)
|
||||
|
|
@ -85,8 +90,11 @@ end
|
|||
|
||||
function tags.setup()
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
for _, t in ipairs(tagdef) do
|
||||
awful.tag.add(t[1], gears.table.join({ screen = s }, t[2] or { layout = defaultlayout(s) }))
|
||||
for _,t in ipairs(tagdef) do
|
||||
awful.tag.add(t[1], awful.util.table.join(
|
||||
{screen = s},
|
||||
t[2] or { layout = defaultlayout(s) }
|
||||
))
|
||||
end
|
||||
s.tags[1]:view_only()
|
||||
end)
|
||||
|
|
@ -105,24 +113,22 @@ function tags.create_bindings()
|
|||
else --if i > 10 then
|
||||
k = "F" .. i - 10 -- F keys
|
||||
end
|
||||
tagkeys = gears.table.join(
|
||||
tagkeys,
|
||||
awful.key({ modkey }, k, getfunc_viewonly(i)),
|
||||
awful.key({ modkey, "Control" }, k, getfunc_viewtoggle(i)),
|
||||
awful.key({ modkey, "Shift" }, k, getfunc_moveto(i)),
|
||||
awful.key({ modkey, "Control", "Shift" }, k, getfunc_clienttoggle(i))
|
||||
tagkeys = awful.util.table.join(tagkeys,
|
||||
awful.key( { modkey }, k, getfunc_viewonly(i)),
|
||||
awful.key( { modkey, "Control" }, k, getfunc_viewtoggle(i)),
|
||||
awful.key( { modkey, "Shift" }, k, getfunc_moveto(i)),
|
||||
awful.key( { modkey, "Control", "Shift" }, k, getfunc_clienttoggle(i))
|
||||
)
|
||||
end
|
||||
|
||||
-- keys for all tags
|
||||
tagkeys = gears.table.join(
|
||||
tagkeys,
|
||||
tagkeys = awful.util.table.join(tagkeys,
|
||||
awful.key({ modkey }, "u", awful.client.urgent.jumpto),
|
||||
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)
|
||||
)
|
||||
return tagkeys
|
||||
return tagkeys;
|
||||
end
|
||||
|
||||
return tags
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ca93752bef7cd662f9a102d3aa05c7b1c6adb4b5
|
||||
Subproject commit 95b709fa483363c894c22e5bf0e3060915e49411
|
||||
2
tapestry
2
tapestry
|
|
@ -1 +1 @@
|
|||
Subproject commit fdf23d8580ea94cad21a2221b41931c4289bb74f
|
||||
Subproject commit 5bb7a7d0510ea1adecf1a175444cdbcca13b7e71
|
||||
|
|
@ -5,28 +5,22 @@ local naughty = require("naughty")
|
|||
-- Check if awesome encountered an error during startup and fell back to
|
||||
-- another config (This code will only ever execute for the fallback config)
|
||||
if awesome.startup_errors then
|
||||
naughty.notification({
|
||||
preset = naughty.config.presets.critical,
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, there were errors during startup!",
|
||||
text = awesome.startup_errors,
|
||||
})
|
||||
text = awesome.startup_errors })
|
||||
end
|
||||
|
||||
-- Handle runtime errors after startup
|
||||
do
|
||||
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
|
||||
if in_error then
|
||||
return
|
||||
end
|
||||
if in_error then return end
|
||||
in_error = true
|
||||
|
||||
naughty.notification({
|
||||
preset = naughty.config.presets.critical,
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, an error happened!",
|
||||
text = err,
|
||||
})
|
||||
text = err })
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
|
|
|
|||
168
widgets.lua
168
widgets.lua
|
|
@ -10,23 +10,23 @@ local gears = require("gears")
|
|||
local wlist = {}
|
||||
|
||||
local mytaglist = {}
|
||||
mytaglist.buttons = gears.table.join(
|
||||
awful.button({}, 1, awful.tag.viewonly),
|
||||
awful.button({ modkey }, 1, awful.client.movetotag),
|
||||
awful.button({}, 3, awful.tag.viewtoggle),
|
||||
awful.button({ modkey }, 3, awful.client.toggletag),
|
||||
awful.button({}, 4, function(t)
|
||||
awful.tag.viewnext(t.screen)
|
||||
end),
|
||||
awful.button({}, 5, function(t)
|
||||
awful.tag.viewprev(t.screen)
|
||||
end)
|
||||
mytaglist.buttons = awful.util.table.join(
|
||||
awful.button({ }, 1, awful.tag.viewonly),
|
||||
awful.button({ modkey }, 1, awful.client.movetotag),
|
||||
awful.button({ }, 3, awful.tag.viewtoggle),
|
||||
awful.button({ modkey }, 3, awful.client.toggletag),
|
||||
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
|
||||
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
|
||||
)
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
local function add_bar(s, position, direction, first, second)
|
||||
local newbar = awful.wibar({
|
||||
position = position,
|
||||
|
|
@ -35,33 +35,29 @@ local function add_bar(s, position, direction, first, second)
|
|||
width = math.floor(s.dpi / 5),
|
||||
})
|
||||
|
||||
newbar:setup({
|
||||
newbar:setup {
|
||||
{
|
||||
first,
|
||||
nil,
|
||||
second,
|
||||
layout = wibox.layout.align.horizontal,
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
direction = direction,
|
||||
widget = wibox.container.rotate,
|
||||
})
|
||||
widget = wibox.container.rotate
|
||||
}
|
||||
return newbar
|
||||
end
|
||||
|
||||
function widgets.setup(s)
|
||||
return {
|
||||
left = function(bottom, top)
|
||||
s.leftwibar = add_bar(s, "left", "east", bottom, top)
|
||||
end,
|
||||
right = function(top, bottom)
|
||||
s.rightwibar = add_bar(s, "right", "west", top, bottom)
|
||||
end,
|
||||
left = function(bottom, top) 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
|
||||
|
||||
function widgets.mail(mailboxes, notify_pos, title)
|
||||
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)
|
||||
if args[1] > 0 then
|
||||
|
|
@ -75,7 +71,7 @@ function widgets.mail(mailboxes, notify_pos, title)
|
|||
else
|
||||
bg.visible = false
|
||||
end
|
||||
return "⬓⬓ Unread " .. args[2] .. " / New " .. args[1] .. " "
|
||||
return "⬓⬓ Unread "..args[2].." / New "..args[1].. " "
|
||||
end
|
||||
vicious.register(widget, vicious.widgets.mdir, callback, 60, mailboxes)
|
||||
table.insert(wlist, widget)
|
||||
|
|
@ -85,19 +81,11 @@ end
|
|||
function widgets.layout(s)
|
||||
local mylayoutbox = awful.widget.layoutbox(s)
|
||||
|
||||
mylayoutbox:buttons(gears.table.join(
|
||||
awful.button({}, 1, 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)
|
||||
mylayoutbox:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, 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
|
||||
end
|
||||
|
|
@ -107,7 +95,9 @@ function widgets.screennum(s)
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
function widgets.systray(s)
|
||||
|
|
@ -119,19 +109,18 @@ function widgets.systray(s)
|
|||
end
|
||||
|
||||
local function graph_label(graph, label, rotation, fontsize)
|
||||
return wibox.widget({
|
||||
return wibox.widget {
|
||||
{
|
||||
{
|
||||
text = label,
|
||||
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,
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
})
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
end
|
||||
|
||||
function widgets.cpu(s)
|
||||
|
|
@ -144,16 +133,16 @@ function widgets.ram(s)
|
|||
end
|
||||
|
||||
function widgets.graph(s, label, viciouswidget, viciousformat, interval)
|
||||
local graph = wibox.widget({
|
||||
local graph = wibox.widget {
|
||||
width = 60,
|
||||
background_color = beautiful.bg_focus,
|
||||
color = "linear:0,0:0,20:0,#FF0000:0.3,#FFFF00:0.6," .. beautiful.fg_normal,
|
||||
widget = wibox.widget.graph,
|
||||
})
|
||||
local overlay = wibox.widget({
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
})
|
||||
}
|
||||
local overlay = wibox.widget {
|
||||
align = 'center',
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
local callback = function(widget, args)
|
||||
overlay.markup = percentage_overlay(args[1], beautiful.bg_normal)
|
||||
return args[1]
|
||||
|
|
@ -164,34 +153,39 @@ function widgets.graph(s, label, viciouswidget, viciousformat, interval)
|
|||
return {
|
||||
layout = awful.widget.only_on_screen,
|
||||
screen = s and s.index or "primary",
|
||||
graph_label({
|
||||
graph_label(
|
||||
{
|
||||
graph,
|
||||
overlay,
|
||||
layout = wibox.layout.stack,
|
||||
}, label, nil, 7),
|
||||
layout = wibox.layout.stack
|
||||
},
|
||||
label,
|
||||
nil,
|
||||
7
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
local function bar_with_overlay(fg, bg, width, height)
|
||||
local progress = wibox.widget({
|
||||
local progress = wibox.widget {
|
||||
max_value = 1,
|
||||
color = fg,
|
||||
background_color = bg,
|
||||
forced_width = width,
|
||||
forced_height = height,
|
||||
widget = wibox.widget.progressbar,
|
||||
})
|
||||
}
|
||||
|
||||
progress.overlay = wibox.widget({
|
||||
progress.overlay = wibox.widget {
|
||||
font = beautiful.fontface and (beautiful.fontface .. " " .. 7) or beautiful.font,
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
})
|
||||
align = 'center',
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
return {
|
||||
progress,
|
||||
progress.overlay,
|
||||
layout = wibox.layout.stack,
|
||||
layout = wibox.layout.stack
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -199,9 +193,12 @@ end
|
|||
function widgets.battery(s)
|
||||
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
|
||||
combined_bats:set_visible(false)
|
||||
return ""
|
||||
|
|
@ -212,7 +209,9 @@ function widgets.battery(s)
|
|||
else
|
||||
widget.background_color = beautiful.bg_focus
|
||||
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]
|
||||
end
|
||||
end
|
||||
|
|
@ -224,30 +223,23 @@ function widgets.battery(s)
|
|||
end
|
||||
|
||||
local tasklist_buttons = gears.table.join(
|
||||
awful.button({}, 1, function(c)
|
||||
awful.button({ }, 1, function(c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
c:emit_signal("request::activate", "tasklist", { raise = true })
|
||||
c:emit_signal("request::activate", "tasklist", {raise = true})
|
||||
end
|
||||
end),
|
||||
awful.button({}, 3, function()
|
||||
awful.menu.client_list({ theme = { width = 250 } })
|
||||
end),
|
||||
awful.button({}, 4, function()
|
||||
awful.client.focus.byidx(1)
|
||||
end),
|
||||
awful.button({}, 5, function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end)
|
||||
)
|
||||
awful.button({ }, 3, function() awful.menu.client_list({ theme = { width = 250 } }) end),
|
||||
awful.button({ }, 4, function() awful.client.focus.byidx(1) end),
|
||||
awful.button({ }, 5, function() awful.client.focus.byidx(-1) end))
|
||||
|
||||
-- display a taskbar
|
||||
-- `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.
|
||||
-- If signal and when are not given, the taskbar will be visible on tags with "max" layout
|
||||
function widgets.dynamic_taskbar(s, signal, when)
|
||||
s.mytasklist = awful.widget.tasklist({
|
||||
s.mytasklist = awful.widget.tasklist {
|
||||
screen = s,
|
||||
filter = awful.widget.tasklist.filter.currenttags,
|
||||
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,
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
{ id = "text_role", widget = wibox.widget.textbox },
|
||||
{ id = 'text_role',
|
||||
widget = wibox.widget.textbox, },
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
left = 20,
|
||||
right = 15,
|
||||
widget = wibox.container.margin,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "background_role",
|
||||
id = 'background_role',
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
})
|
||||
}
|
||||
s.taskbar = awful.wibar({
|
||||
position = "top",
|
||||
screen = s,
|
||||
opacity = 0.8,
|
||||
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.taskbar.visible = condition(s)
|
||||
end)
|
||||
|
|
@ -298,8 +290,4 @@ function widgets.update(name)
|
|||
vicious.force(wlist)
|
||||
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