Compare commits
10 Commits
d2f76bc78e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34b678e020 | ||
|
|
44ab8019bc | ||
|
|
5babd2e2bc | ||
|
|
9410017416 | ||
|
|
d738d4937f | ||
|
|
8464403fca | ||
|
|
ee40c1c42c | ||
|
|
1e248a903d | ||
|
|
497a6bd76c | ||
|
|
76dab2fd42 |
14
.luarc.json
Normal file
14
.luarc.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"diagnostics.globals": [
|
||||||
|
"awesome",
|
||||||
|
"client",
|
||||||
|
"root",
|
||||||
|
"screen",
|
||||||
|
"tag",
|
||||||
|
"mouse",
|
||||||
|
],
|
||||||
|
"workspace.library": [
|
||||||
|
"/usr/bin/awesome",
|
||||||
|
"/usr/bin/awesome/lain"
|
||||||
|
],
|
||||||
|
}
|
||||||
28
bindings/client_buttons.lua
Normal file
28
bindings/client_buttons.lua
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
local gears = require("gears")
|
||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
local clientbuttons = gears.table.join(
|
||||||
|
awful.button({}, 1, function(c)
|
||||||
|
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||||
|
end),
|
||||||
|
awful.button({ RC.vars.modkey }, 1, function(c)
|
||||||
|
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||||
|
awful.mouse.client.move(c)
|
||||||
|
end),
|
||||||
|
awful.button({ RC.vars.modkey }, 3, function(c)
|
||||||
|
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||||
|
awful.mouse.client.resize(c)
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
|
||||||
|
return clientbuttons
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
56
bindings/client_keys.lua
Normal file
56
bindings/client_keys.lua
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
local gears = require("gears")
|
||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
local clientkeys = gears.table.join(
|
||||||
|
awful.key({ RC.vars.modkey }, "f", function(c)
|
||||||
|
c.fullscreen = not c.fullscreen
|
||||||
|
c:raise()
|
||||||
|
end, { description = "toggle fullscreen", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "c", function(c)
|
||||||
|
c:kill()
|
||||||
|
end, { description = "close", group = "client" }),
|
||||||
|
awful.key(
|
||||||
|
{ RC.vars.modkey, "Control" },
|
||||||
|
"space",
|
||||||
|
awful.client.floating.toggle,
|
||||||
|
{ description = "toggle floating", group = "client" }
|
||||||
|
),
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "Return", function(c)
|
||||||
|
c:swap(awful.client.getmaster())
|
||||||
|
end, { description = "move to master", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "o", function(c)
|
||||||
|
c:move_to_screen()
|
||||||
|
end, { description = "move to screen", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "t", function(c)
|
||||||
|
c.ontop = not c.ontop
|
||||||
|
end, { description = "toggle keep on top", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "n", function(c)
|
||||||
|
-- The client currently has the input focus, so it cannot be
|
||||||
|
-- minimized, since minimized clients can't have the focus.
|
||||||
|
c.minimized = true
|
||||||
|
end, { description = "minimize", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "m", function(c)
|
||||||
|
c.maximized = not c.maximized
|
||||||
|
c:raise()
|
||||||
|
end, { description = "(un)maximize", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "m", function(c)
|
||||||
|
c.maximized_vertical = not c.maximized_vertical
|
||||||
|
c:raise()
|
||||||
|
end, { description = "(un)maximize vertically", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "m", function(c)
|
||||||
|
c.maximized_horizontal = not c.maximized_horizontal
|
||||||
|
c:raise()
|
||||||
|
end, { description = "(un)maximize horizontally", group = "client" })
|
||||||
|
)
|
||||||
|
|
||||||
|
return clientkeys
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
14
bindings/global_buttons.lua
Normal file
14
bindings/global_buttons.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
local gears = require("gears")
|
||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
return gears.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev))
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
186
bindings/global_keys.lua
Normal file
186
bindings/global_keys.lua
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
local gears = require("gears")
|
||||||
|
local awful = require("awful")
|
||||||
|
local menubar = require("menubar")
|
||||||
|
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
local globalkeys = gears.table.join(
|
||||||
|
awful.key({ RC.vars.modkey }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }),
|
||||||
|
|
||||||
|
awful.key({ RC.vars.modkey }, "j", function()
|
||||||
|
awful.client.focus.byidx(1)
|
||||||
|
end, { description = "focus next by index", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "k", function()
|
||||||
|
awful.client.focus.byidx(-1)
|
||||||
|
end, { description = "focus previous by index", group = "client" }),
|
||||||
|
|
||||||
|
-- Layout manipulation
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "j", function()
|
||||||
|
awful.client.swap.byidx(1)
|
||||||
|
end, { description = "swap with next client by index", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "k", function()
|
||||||
|
awful.client.swap.byidx(-1)
|
||||||
|
end, { description = "swap with previous client by index", group = "client" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "j", function()
|
||||||
|
awful.screen.focus_relative(1)
|
||||||
|
end, { description = "focus the next screen", group = "screen" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "k", function()
|
||||||
|
awful.screen.focus_relative(-1)
|
||||||
|
end, { description = "focus the previous screen", group = "screen" }),
|
||||||
|
awful.key(
|
||||||
|
{ RC.vars.modkey },
|
||||||
|
"u",
|
||||||
|
awful.client.urgent.jumpto,
|
||||||
|
{ description = "jump to urgent client", group = "client" }
|
||||||
|
),
|
||||||
|
awful.key({ RC.vars.modkey }, "Tab", function()
|
||||||
|
awful.client.focus.history.previous()
|
||||||
|
if client.focus then
|
||||||
|
client.focus:raise()
|
||||||
|
end
|
||||||
|
end, { description = "go back", group = "client" }),
|
||||||
|
|
||||||
|
-- Standard program
|
||||||
|
awful.key({ RC.vars.modkey }, "Return", function()
|
||||||
|
awful.spawn(RC.vars.terminal)
|
||||||
|
end, { description = "open a terminal", group = "launcher" }),
|
||||||
|
awful.key(
|
||||||
|
{ RC.vars.modkey, "Control" },
|
||||||
|
"r",
|
||||||
|
awesome.restart,
|
||||||
|
{ description = "reload awesome", group = "awesome" }
|
||||||
|
),
|
||||||
|
|
||||||
|
awful.key({ RC.vars.modkey }, "l", function()
|
||||||
|
awful.tag.incmwfact(0.05)
|
||||||
|
end, { description = "increase master width factor", group = "layout" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "h", function()
|
||||||
|
awful.tag.incmwfact(-0.05)
|
||||||
|
end, { description = "decrease master width factor", group = "layout" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "h", function()
|
||||||
|
awful.tag.incnmaster(1, nil, true)
|
||||||
|
end, { description = "increase the number of master clients", group = "layout" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "l", function()
|
||||||
|
awful.tag.incnmaster(-1, nil, true)
|
||||||
|
end, { description = "decrease the number of master clients", group = "layout" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "h", function()
|
||||||
|
awful.tag.incncol(1, nil, true)
|
||||||
|
end, { description = "increase the number of columns", group = "layout" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "l", function()
|
||||||
|
awful.tag.incncol(-1, nil, true)
|
||||||
|
end, { description = "decrease the number of columns", group = "layout" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "space", function()
|
||||||
|
awful.layout.inc(1)
|
||||||
|
end, { description = "select next", group = "layout" }),
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "space", function()
|
||||||
|
awful.layout.inc(-1)
|
||||||
|
end, { description = "select previous", group = "layout" }),
|
||||||
|
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "n", function()
|
||||||
|
local c = awful.client.restore()
|
||||||
|
-- Focus restored client
|
||||||
|
if c then
|
||||||
|
c:emit_signal("request::activate", "key.unminimize", { raise = true })
|
||||||
|
end
|
||||||
|
end, { description = "restore minimized", group = "client" }),
|
||||||
|
|
||||||
|
-- Prompt
|
||||||
|
awful.key({ RC.vars.modkey }, "r", function()
|
||||||
|
awful.spawn("rofi -show run")
|
||||||
|
end, { description = "run prompt", group = "launcher" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "w", function()
|
||||||
|
awful.spawn("rofi -show window")
|
||||||
|
end, { description = "window prompt", group = "launcher" }),
|
||||||
|
awful.key({ RC.vars.modkey }, "[", function()
|
||||||
|
awful.spawn("rofi -show power-menu -modi power-menu:rofi-power-menu")
|
||||||
|
end, { description = "power menu", group = "launcher" }),
|
||||||
|
|
||||||
|
awful.key({}, "XF86AudioRaiseVolume", function()
|
||||||
|
awful.spawn("pamixer -i 5")
|
||||||
|
end, { description = "raise volume", group = "media" }),
|
||||||
|
awful.key({}, "XF86AudioLowerVolume", function()
|
||||||
|
awful.spawn("pamixer -d 5")
|
||||||
|
end, { description = "lower volume", group = "media" }),
|
||||||
|
awful.key({}, "XF86AudioMute", function()
|
||||||
|
awful.spawn("pamixer -t")
|
||||||
|
end, { description = "toggle mute", group = "media" }),
|
||||||
|
|
||||||
|
awful.key({}, "XF86MonBrightnessUp", function()
|
||||||
|
awful.spawn("light -A 5")
|
||||||
|
end, { description = "raise brightness", group = "system" }),
|
||||||
|
awful.key({}, "XF86MonBrightnessDown", function()
|
||||||
|
awful.spawn("light -U 5")
|
||||||
|
end, { description = "lower brightness", group = "system" }),
|
||||||
|
|
||||||
|
awful.key({}, "Play", function()
|
||||||
|
awful.spawn("playerctl play-pause")
|
||||||
|
end, { description = "play/pause media", group = "media" }),
|
||||||
|
awful.key({}, "Next", function()
|
||||||
|
awful.spawn("playerctl next")
|
||||||
|
end, { description = "next media", group = "media" }),
|
||||||
|
awful.key({}, "Prior", function()
|
||||||
|
awful.spawn("playerctl previous")
|
||||||
|
end, { description = "previous media", group = "media" }),
|
||||||
|
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "r", function()
|
||||||
|
awful.spawn("firefox")
|
||||||
|
end, { description = "launch browser", group = "launcher" }),
|
||||||
|
|
||||||
|
awful.key({ RC.vars.modkey }, "b", function()
|
||||||
|
require("statusbar.bottom.widgets").get_battery_widget().toggle_percentage()
|
||||||
|
end, { description = "toggle battery percent", group = "system" })
|
||||||
|
)
|
||||||
|
|
||||||
|
for i = 1, 6 do
|
||||||
|
globalkeys = gears.table.join(
|
||||||
|
globalkeys,
|
||||||
|
-- View tag only.
|
||||||
|
awful.key({ RC.vars.modkey }, "#" .. i + 9, function()
|
||||||
|
local screen = awful.screen.focused()
|
||||||
|
local tag = screen.tags[i]
|
||||||
|
if tag then
|
||||||
|
tag:view_only()
|
||||||
|
end
|
||||||
|
end, { description = "view tag #" .. i, group = "tag" }),
|
||||||
|
-- Toggle tag display.
|
||||||
|
awful.key({ RC.vars.modkey, "Control" }, "#" .. i + 9, function()
|
||||||
|
local screen = awful.screen.focused()
|
||||||
|
local tag = screen.tags[i]
|
||||||
|
if tag then
|
||||||
|
awful.tag.viewtoggle(tag)
|
||||||
|
end
|
||||||
|
end, { description = "toggle tag #" .. i, group = "tag" }),
|
||||||
|
-- Move client to tag.
|
||||||
|
awful.key({ RC.vars.modkey, "Shift" }, "#" .. i + 9, function()
|
||||||
|
if client.focus then
|
||||||
|
local tag = client.focus.screen.tags[i]
|
||||||
|
if tag then
|
||||||
|
client.focus:move_to_tag(tag)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, { description = "move focused client to tag #" .. i, group = "tag" }),
|
||||||
|
-- Toggle tag on focused client.
|
||||||
|
awful.key({ RC.vars.modkey, "Control", "Shift" }, "#" .. i + 9, function()
|
||||||
|
if client.focus then
|
||||||
|
local tag = client.focus.screen.tags[i]
|
||||||
|
if tag then
|
||||||
|
client.focus:toggle_tag(tag)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, { description = "toggle focused client on tag #" .. i, group = "tag" })
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
return globalkeys
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
8
bindings/init.lua
Normal file
8
bindings/init.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
local _M = {
|
||||||
|
global_buttons = require("bindings.global_buttons"),
|
||||||
|
client_buttons = require("bindings.client_buttons"),
|
||||||
|
global_keys = require("bindings.global_keys"),
|
||||||
|
client_keys = require("bindings.client_keys"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return _M
|
||||||
30
deco/layoutbox.lua
Normal file
30
deco/layoutbox.lua
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get(s)
|
||||||
|
local layoutbox = awful.widget.layoutbox(s)
|
||||||
|
layoutbox: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)
|
||||||
|
))
|
||||||
|
|
||||||
|
return layoutbox
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
30
deco/screens.lua
Normal file
30
deco/screens.lua
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
local taglist = require("deco.taglist")
|
||||||
|
local tasklist = require("deco.tasklist")
|
||||||
|
local layoutbox = require("deco.layoutbox")
|
||||||
|
local wallpaper = require("deco.wallpaper")
|
||||||
|
|
||||||
|
local bottom_statusbar = require("statusbar.bottom.statusbar")
|
||||||
|
local top_statusbar = require("statusbar.top.statusbar")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.setup()
|
||||||
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
|
wallpaper(s)
|
||||||
|
|
||||||
|
s.layoutbox = layoutbox(s)
|
||||||
|
s.taglist = taglist(s)
|
||||||
|
s.tasklist = tasklist(s)
|
||||||
|
|
||||||
|
top_statusbar(s)
|
||||||
|
bottom_statusbar(s)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable(_M, {
|
||||||
|
__call = function()
|
||||||
|
return _M.setup()
|
||||||
|
end,
|
||||||
|
})
|
||||||
121
deco/taglist.lua
Normal file
121
deco/taglist.lua
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local lain = require("lain")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get(s)
|
||||||
|
local taglist_buttons = gears.table.join(
|
||||||
|
awful.button({}, 1, function(t)
|
||||||
|
t:view_only()
|
||||||
|
end),
|
||||||
|
awful.button({ RC.vars.modkey }, 1, function(t)
|
||||||
|
if client.focus then
|
||||||
|
client.focus:move_to_tag(t)
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
awful.button({}, 3, awful.tag.viewtoggle),
|
||||||
|
awful.button({ RC.vars.modkey }, 3, function(t)
|
||||||
|
if client.focus then
|
||||||
|
client.focus:toggle_tag(t)
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
awful.button({}, 4, function(t)
|
||||||
|
awful.tag.viewnext(t.screen)
|
||||||
|
end),
|
||||||
|
awful.button({}, 5, function(t)
|
||||||
|
awful.tag.viewprev(t.screen)
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
|
||||||
|
local separators = lain.util.separators
|
||||||
|
|
||||||
|
local arrl_dl = separators.arrow_right(beautiful.taglist_separator, "alpha")
|
||||||
|
local arrl_ld = separators.arrow_right("alpha", beautiful.taglist_separator)
|
||||||
|
|
||||||
|
return awful.widget.taglist({
|
||||||
|
screen = s,
|
||||||
|
filter = awful.widget.taglist.filter.all,
|
||||||
|
style = {
|
||||||
|
shape = gears.shape.powerline,
|
||||||
|
},
|
||||||
|
layout = {
|
||||||
|
spacing = 10,
|
||||||
|
spacing_widget = arrl_ld,
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
},
|
||||||
|
widget_template = {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
arrl_dl,
|
||||||
|
{
|
||||||
|
{
|
||||||
|
id = "icon_role",
|
||||||
|
widget = wibox.widget.imagebox,
|
||||||
|
},
|
||||||
|
margins = 2,
|
||||||
|
widget = wibox.container.margin,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
id = "index_role",
|
||||||
|
widget = wibox.widget.textbox,
|
||||||
|
},
|
||||||
|
margins = 3,
|
||||||
|
widget = wibox.container.margin,
|
||||||
|
},
|
||||||
|
bg = beautiful.taglist_bg_tag,
|
||||||
|
shape = gears.shape.circle,
|
||||||
|
widget = wibox.container.background,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{
|
||||||
|
id = "icon_role",
|
||||||
|
widget = wibox.widget.imagebox,
|
||||||
|
},
|
||||||
|
margins = 2,
|
||||||
|
widget = wibox.container.margin,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = "text_role",
|
||||||
|
widget = wibox.widget.textbox,
|
||||||
|
},
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
},
|
||||||
|
right = 10,
|
||||||
|
widget = wibox.container.margin,
|
||||||
|
},
|
||||||
|
id = "background_role",
|
||||||
|
widget = wibox.container.background,
|
||||||
|
-- Add support for hover colors and an index label
|
||||||
|
create_callback = function(self, c3, index, objects) --luacheck: no unused args
|
||||||
|
self:get_children_by_id("index_role")[1].markup = "<b> " .. index .. " </b>"
|
||||||
|
self:connect_signal("mouse::enter", function()
|
||||||
|
if self.bg ~= "#33cc3355" then
|
||||||
|
self.backup = self.bg
|
||||||
|
self.has_backup = true
|
||||||
|
end
|
||||||
|
self.bg = "#33cc3355"
|
||||||
|
end)
|
||||||
|
self:connect_signal("mouse::leave", function()
|
||||||
|
if self.has_backup then
|
||||||
|
self.bg = self.backup
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
update_callback = function(self, c3, index, objects) --luacheck: no unused args
|
||||||
|
self:get_children_by_id("index_role")[1].markup = "<b> " .. index .. " </b>"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
buttons = taglist_buttons,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
36
deco/tasklist.lua
Normal file
36
deco/tasklist.lua
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get(s)
|
||||||
|
local tasklist_buttons = gears.table.join(
|
||||||
|
awful.button({}, 1, function(c)
|
||||||
|
if c == client.focus then
|
||||||
|
c.minimized = true
|
||||||
|
else
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
return awful.widget.tasklist({
|
||||||
|
screen = s,
|
||||||
|
filter = awful.widget.tasklist.filter.currenttags,
|
||||||
|
buttons = tasklist_buttons,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
40
deco/titlebar.lua
Normal file
40
deco/titlebar.lua
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
return function(c)
|
||||||
|
-- buttons for the titlebar
|
||||||
|
local buttons = gears.table.join(
|
||||||
|
awful.button({}, 1, function()
|
||||||
|
c:emit_signal("request::activate", "titlebar", { raise = true })
|
||||||
|
awful.mouse.client.move(c)
|
||||||
|
end),
|
||||||
|
awful.button({}, 3, function()
|
||||||
|
c:emit_signal("request::activate", "titlebar", { raise = true })
|
||||||
|
awful.mouse.client.resize(c)
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
|
||||||
|
awful.titlebar(c):setup({
|
||||||
|
{ -- Left
|
||||||
|
awful.titlebar.widget.iconwidget(c),
|
||||||
|
buttons = buttons,
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
},
|
||||||
|
{ -- Middle
|
||||||
|
{ -- Title
|
||||||
|
align = "center",
|
||||||
|
widget = awful.titlebar.widget.titlewidget(c),
|
||||||
|
},
|
||||||
|
buttons = buttons,
|
||||||
|
layout = wibox.layout.flex.horizontal,
|
||||||
|
},
|
||||||
|
{ -- Right
|
||||||
|
awful.titlebar.widget.minimizebutton(c),
|
||||||
|
awful.titlebar.widget.maximizedbutton(c),
|
||||||
|
awful.titlebar.widget.closebutton(c),
|
||||||
|
layout = wibox.layout.fixed.horizontal(),
|
||||||
|
},
|
||||||
|
layout = wibox.layout.align.horizontal,
|
||||||
|
})
|
||||||
|
end
|
||||||
21
deco/wallpaper.lua
Normal file
21
deco/wallpaper.lua
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
local beautiful = require("beautiful")
|
||||||
|
local gears = require("gears")
|
||||||
|
|
||||||
|
local _W = {}
|
||||||
|
|
||||||
|
function _W.set_wallpaper(s)
|
||||||
|
local wallpaper = beautiful.wallpaper
|
||||||
|
|
||||||
|
if type(wallpaper) == "function" then
|
||||||
|
wallpaper = wallpaper(s)
|
||||||
|
end
|
||||||
|
gears.wallpaper.maximized(wallpaper, s, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
screen.connect_signal("property::geometry", _W.set_wallpaper)
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _W.set_wallpaper(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
1
lain
Submodule
1
lain
Submodule
Submodule lain added at 88f5a8abd2
10
main/init.lua
Normal file
10
main/init.lua
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
local _M = {
|
||||||
|
error_handling = require("main.error_handling"),
|
||||||
|
rules = require("main.rules"),
|
||||||
|
layouts = require("main.layouts"),
|
||||||
|
tags = require("main.tags"),
|
||||||
|
signals = require("main.signals"),
|
||||||
|
user_vars = require("main.user_vars"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return _M
|
||||||
22
main/layouts.lua
Normal file
22
main/layouts.lua
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
local _L = {}
|
||||||
|
|
||||||
|
_L = {
|
||||||
|
awful.layout.suit.tile,
|
||||||
|
awful.layout.suit.fair,
|
||||||
|
awful.layout.suit.max,
|
||||||
|
awful.layout.suit.floating,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _L
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
83
main/rules.lua
Normal file
83
main/rules.lua
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get(clientkeys, clientbuttons)
|
||||||
|
local _R = {
|
||||||
|
{
|
||||||
|
rule = {},
|
||||||
|
properties = {
|
||||||
|
border_width = beautiful.border_width,
|
||||||
|
border_color = beautiful.border_normal,
|
||||||
|
focus = awful.client.focus.filter,
|
||||||
|
raise = true,
|
||||||
|
keys = clientkeys,
|
||||||
|
buttons = clientbuttons,
|
||||||
|
screen = awful.screen.preferred,
|
||||||
|
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Floating clients.
|
||||||
|
{
|
||||||
|
rule_any = {
|
||||||
|
instance = {
|
||||||
|
"DTA",
|
||||||
|
"copyq",
|
||||||
|
"pinentry",
|
||||||
|
},
|
||||||
|
class = {
|
||||||
|
"Arandr",
|
||||||
|
"Blueman-manager",
|
||||||
|
"Gpick",
|
||||||
|
"Kruler",
|
||||||
|
"MessageWin",
|
||||||
|
"Sxiv",
|
||||||
|
"Tor Browser",
|
||||||
|
"Wpa_gui",
|
||||||
|
"veromix",
|
||||||
|
"xtightvncviewer",
|
||||||
|
},
|
||||||
|
name = {
|
||||||
|
"Event Tester",
|
||||||
|
},
|
||||||
|
role = {
|
||||||
|
"AlarmWindow",
|
||||||
|
"ConfigManager",
|
||||||
|
"pop-up",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
properties = {
|
||||||
|
floating = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Add titlebars to normal clients and dialogs
|
||||||
|
{
|
||||||
|
rule_any = {
|
||||||
|
type = { "normal", "dialog" },
|
||||||
|
},
|
||||||
|
properties = {
|
||||||
|
titlebars_enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
rule = { instance = "Firefox" },
|
||||||
|
properties = {
|
||||||
|
screen = 1,
|
||||||
|
tag = RC.tags[2],
|
||||||
|
titlebars_enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return _R
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
19
main/signals.lua
Normal file
19
main/signals.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local titlebar = require("deco.titlebar")
|
||||||
|
|
||||||
|
-- Signal function to execute when a new client appears.
|
||||||
|
client.connect_signal("manage", function(c)
|
||||||
|
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
|
||||||
|
end)
|
||||||
|
|
||||||
|
client.connect_signal("request::titlebars", titlebar)
|
||||||
|
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)
|
||||||
37
main/tags.lua
Normal file
37
main/tags.lua
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
local _T = {}
|
||||||
|
|
||||||
|
local tags = {
|
||||||
|
"Terminal",
|
||||||
|
"Web",
|
||||||
|
"Code",
|
||||||
|
"Junk",
|
||||||
|
"Music",
|
||||||
|
"Chat",
|
||||||
|
}
|
||||||
|
|
||||||
|
local layouts = {
|
||||||
|
RC.layouts[1],
|
||||||
|
RC.layouts[2],
|
||||||
|
RC.layouts[3],
|
||||||
|
RC.layouts[4],
|
||||||
|
RC.layouts[4],
|
||||||
|
RC.layouts[4],
|
||||||
|
}
|
||||||
|
|
||||||
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
|
_T[s] = awful.tag(tags, s, layouts)
|
||||||
|
end)
|
||||||
|
|
||||||
|
return _T
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
@@ -1,11 +1,26 @@
|
|||||||
local _V = {}
|
local awful = require("awful")
|
||||||
|
|
||||||
_V = {
|
local _M = {}
|
||||||
terminal = "alacritty",
|
|
||||||
editor = os.getenv("EDITOR") or "nvim",
|
|
||||||
editor_cmd = _V.terminal .. " -e " .. _V.editor,
|
|
||||||
modkey = "Mod4",
|
|
||||||
wallpaper = os.getenv("HOME") .. "/.config/awesome/theme/background.jpg",
|
|
||||||
}
|
|
||||||
|
|
||||||
return _V
|
function _M.get()
|
||||||
|
local _V = {}
|
||||||
|
|
||||||
|
awful.spawn.with_shell("picom -b")
|
||||||
|
awful.spawn.with_shell("nm-applet")
|
||||||
|
|
||||||
|
_V = {
|
||||||
|
terminal = "alacritty",
|
||||||
|
editor = os.getenv("EDITOR") or "nvim",
|
||||||
|
modkey = "Mod4",
|
||||||
|
wallpaper = os.getenv("HOME") .. "/.config/awesome/theme/background.jpg",
|
||||||
|
}
|
||||||
|
_V.editor_cmd = _V.terminal .. " -e " .. _V.editor
|
||||||
|
|
||||||
|
return _V
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
530
rc.lua
530
rc.lua
@@ -2,529 +2,27 @@
|
|||||||
-- 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")
|
||||||
|
|
||||||
local gears = require("gears")
|
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local wibox = require("wibox")
|
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local menubar = require("menubar")
|
|
||||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
|
||||||
require("awful.autofocus")
|
require("awful.autofocus")
|
||||||
require("main.error_handling")
|
|
||||||
|
|
||||||
beautiful.init(require("theme"))
|
local main = require("main")
|
||||||
|
local bindings = require("bindings")
|
||||||
|
local theme = require("theme")
|
||||||
|
local screen = require("deco.screens")
|
||||||
|
|
||||||
|
beautiful.init(theme)
|
||||||
|
|
||||||
RC = {}
|
RC = {}
|
||||||
RC.vars = require("main.user_vars")
|
RC.vars = main.user_vars()
|
||||||
|
RC.layouts = main.layouts()
|
||||||
|
RC.tags = main.tags()
|
||||||
|
|
||||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
awful.layout.layouts = RC.layouts
|
||||||
awful.layout.layouts = {
|
|
||||||
awful.layout.suit.tile,
|
|
||||||
awful.layout.suit.fair,
|
|
||||||
awful.layout.suit.floating,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- {{{ Menu
|
screen()
|
||||||
-- Create a launcher widget and a main menu
|
|
||||||
myawesomemenu = {
|
|
||||||
{
|
|
||||||
"hotkeys",
|
|
||||||
function()
|
|
||||||
hotkeys_popup.show_help(nil, awful.screen.focused())
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ "manual", RC.vars.terminal .. " -e man awesome" },
|
|
||||||
{ "edit config", RC.vars.editor_cmd .. " " .. awesome.conffile },
|
|
||||||
{ "restart", awesome.restart },
|
|
||||||
{
|
|
||||||
"quit",
|
|
||||||
function()
|
|
||||||
awesome.quit()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
mymainmenu = awful.menu({
|
|
||||||
items = {
|
|
||||||
{ "awesome", myawesomemenu, beautiful.awesome_icon },
|
|
||||||
{ "open terminal", RC.vars.terminal },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
|
|
||||||
|
|
||||||
-- Menubar configuration
|
|
||||||
menubar.utils.terminal = RC.vars.terminal -- Set the terminal for applications that require it
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- Keyboard map indicator and switcher
|
|
||||||
mykeyboardlayout = awful.widget.keyboardlayout()
|
|
||||||
|
|
||||||
-- {{{ Wibar
|
|
||||||
-- Create a textclock widget
|
|
||||||
mytextclock = wibox.widget.textclock()
|
|
||||||
|
|
||||||
-- Create a wibox for each screen and add it
|
|
||||||
local taglist_buttons = gears.table.join(
|
|
||||||
awful.button({}, 1, function(t)
|
|
||||||
t:view_only()
|
|
||||||
end),
|
|
||||||
awful.button({ RC.vars.modky }, 1, function(t)
|
|
||||||
if client.focus then
|
|
||||||
client.focus:move_to_tag(t)
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
awful.button({}, 3, awful.tag.viewtoggle),
|
|
||||||
awful.button({ RC.vars.modky }, 3, function(t)
|
|
||||||
if client.focus then
|
|
||||||
client.focus:toggle_tag(t)
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
awful.button({}, 4, function(t)
|
|
||||||
awful.tag.viewnext(t.screen)
|
|
||||||
end),
|
|
||||||
awful.button({}, 5, function(t)
|
|
||||||
awful.tag.viewprev(t.screen)
|
|
||||||
end)
|
|
||||||
)
|
|
||||||
|
|
||||||
local tasklist_buttons = gears.table.join(
|
|
||||||
awful.button({}, 1, function(c)
|
|
||||||
if c == client.focus then
|
|
||||||
c.minimized = true
|
|
||||||
else
|
|
||||||
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)
|
|
||||||
)
|
|
||||||
|
|
||||||
local function set_wallpaper(s)
|
|
||||||
gears.wallpaper.maximized(RC.vars.wallpaper, s, true)
|
|
||||||
-- Wallpaper
|
|
||||||
-- if beautiful.wallpaper then
|
|
||||||
-- local wallpaper = beautiful.wallpaper
|
|
||||||
-- -- If wallpaper is a function, call it with the screen
|
|
||||||
-- if type(wallpaper) == "function" then
|
|
||||||
-- wallpaper = wallpaper(s)
|
|
||||||
-- end
|
|
||||||
-- gears.wallpaper.maximized(wallpaper, s, true)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
|
||||||
screen.connect_signal("property::geometry", set_wallpaper)
|
|
||||||
|
|
||||||
awful.screen.connect_for_each_screen(function(s)
|
|
||||||
-- Wallpaper
|
|
||||||
set_wallpaper(s)
|
|
||||||
|
|
||||||
-- Each screen has its own tag table.
|
|
||||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
|
|
||||||
|
|
||||||
-- Create a promptbox for each screen
|
|
||||||
s.mypromptbox = awful.widget.prompt()
|
|
||||||
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
|
|
||||||
-- We need one layoutbox per screen.
|
|
||||||
s.mylayoutbox = awful.widget.layoutbox(s)
|
|
||||||
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)
|
|
||||||
))
|
|
||||||
-- Create a taglist widget
|
|
||||||
s.mytaglist = awful.widget.taglist({
|
|
||||||
screen = s,
|
|
||||||
filter = awful.widget.taglist.filter.all,
|
|
||||||
buttons = taglist_buttons,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Create a tasklist widget
|
|
||||||
s.mytasklist = awful.widget.tasklist({
|
|
||||||
screen = s,
|
|
||||||
filter = awful.widget.tasklist.filter.currenttags,
|
|
||||||
buttons = tasklist_buttons,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Create the wibox
|
|
||||||
s.mywibox = awful.wibar({ position = "top", screen = s })
|
|
||||||
|
|
||||||
-- Add widgets to the wibox
|
|
||||||
s.mywibox:setup({
|
|
||||||
layout = wibox.layout.align.horizontal,
|
|
||||||
{ -- Left widgets
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
mylauncher,
|
|
||||||
s.mytaglist,
|
|
||||||
s.mypromptbox,
|
|
||||||
},
|
|
||||||
s.mytasklist, -- Middle widget
|
|
||||||
{ -- Right widgets
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
mykeyboardlayout,
|
|
||||||
wibox.widget.systray(),
|
|
||||||
mytextclock,
|
|
||||||
s.mylayoutbox,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- {{{ Mouse bindings
|
|
||||||
root.buttons(gears.table.join(
|
|
||||||
awful.button({}, 3, function()
|
|
||||||
mymainmenu:toggle()
|
|
||||||
end),
|
|
||||||
awful.button({}, 4, awful.tag.viewnext),
|
|
||||||
awful.button({}, 5, awful.tag.viewprev)
|
|
||||||
))
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- {{{ Key bindings
|
|
||||||
globalkeys = gears.table.join(
|
|
||||||
awful.key({ RC.vars.modky }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }),
|
|
||||||
awful.key({ RC.vars.modky }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }),
|
|
||||||
awful.key({ RC.vars.modky }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }),
|
|
||||||
awful.key({ RC.vars.modky }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }),
|
|
||||||
|
|
||||||
awful.key({ RC.vars.modky }, "j", function()
|
|
||||||
awful.client.focus.byidx(1)
|
|
||||||
end, { description = "focus next by index", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky }, "k", function()
|
|
||||||
awful.client.focus.byidx(-1)
|
|
||||||
end, { description = "focus previous by index", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky }, "w", function()
|
|
||||||
mymainmenu:show()
|
|
||||||
end, { description = "show main menu", group = "awesome" }),
|
|
||||||
|
|
||||||
-- Layout manipulation
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "j", function()
|
|
||||||
awful.client.swap.byidx(1)
|
|
||||||
end, { description = "swap with next client by index", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "k", function()
|
|
||||||
awful.client.swap.byidx(-1)
|
|
||||||
end, { description = "swap with previous client by index", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "j", function()
|
|
||||||
awful.screen.focus_relative(1)
|
|
||||||
end, { description = "focus the next screen", group = "screen" }),
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "k", function()
|
|
||||||
awful.screen.focus_relative(-1)
|
|
||||||
end, { description = "focus the previous screen", group = "screen" }),
|
|
||||||
awful.key(
|
|
||||||
{ RC.vars.modky },
|
|
||||||
"u",
|
|
||||||
awful.client.urgent.jumpto,
|
|
||||||
{ description = "jump to urgent client", group = "client" }
|
|
||||||
),
|
|
||||||
awful.key({ RC.vars.modky }, "Tab", function()
|
|
||||||
awful.client.focus.history.previous()
|
|
||||||
if client.focus then
|
|
||||||
client.focus:raise()
|
|
||||||
end
|
|
||||||
end, { description = "go back", group = "client" }),
|
|
||||||
|
|
||||||
-- Standard program
|
|
||||||
awful.key({ RC.vars.modky }, "Return", function()
|
|
||||||
awful.spawn(RC.vars.terminal)
|
|
||||||
end, { description = "open a terminal", group = "launcher" }),
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
|
|
||||||
|
|
||||||
awful.key({ RC.vars.modky }, "l", function()
|
|
||||||
awful.tag.incmwfact(0.05)
|
|
||||||
end, { description = "increase master width factor", group = "layout" }),
|
|
||||||
awful.key({ RC.vars.modky }, "h", function()
|
|
||||||
awful.tag.incmwfact(-0.05)
|
|
||||||
end, { description = "decrease master width factor", group = "layout" }),
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "h", function()
|
|
||||||
awful.tag.incnmaster(1, nil, true)
|
|
||||||
end, { description = "increase the number of master clients", group = "layout" }),
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "l", function()
|
|
||||||
awful.tag.incnmaster(-1, nil, true)
|
|
||||||
end, { description = "decrease the number of master clients", group = "layout" }),
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "h", function()
|
|
||||||
awful.tag.incncol(1, nil, true)
|
|
||||||
end, { description = "increase the number of columns", group = "layout" }),
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "l", function()
|
|
||||||
awful.tag.incncol(-1, nil, true)
|
|
||||||
end, { description = "decrease the number of columns", group = "layout" }),
|
|
||||||
awful.key({ RC.vars.modky }, "space", function()
|
|
||||||
awful.layout.inc(1)
|
|
||||||
end, { description = "select next", group = "layout" }),
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "space", function()
|
|
||||||
awful.layout.inc(-1)
|
|
||||||
end, { description = "select previous", group = "layout" }),
|
|
||||||
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "n", function()
|
|
||||||
local c = awful.client.restore()
|
|
||||||
-- Focus restored client
|
|
||||||
if c then
|
|
||||||
c:emit_signal("request::activate", "key.unminimize", { raise = true })
|
|
||||||
end
|
|
||||||
end, { description = "restore minimized", group = "client" }),
|
|
||||||
|
|
||||||
-- Prompt
|
|
||||||
awful.key({ RC.vars.modky }, "r", function()
|
|
||||||
awful.screen.focused().mypromptbox:run()
|
|
||||||
end, { description = "run prompt", group = "launcher" }),
|
|
||||||
|
|
||||||
awful.key({ RC.vars.modky }, "x", function()
|
|
||||||
awful.prompt.run({
|
|
||||||
prompt = "Run Lua code: ",
|
|
||||||
textbox = awful.screen.focused().mypromptbox.widget,
|
|
||||||
exe_callback = awful.util.eval,
|
|
||||||
history_path = awful.util.get_cache_dir() .. "/history_eval",
|
|
||||||
})
|
|
||||||
end, { description = "lua execute prompt", group = "awesome" }),
|
|
||||||
-- Menubar
|
|
||||||
awful.key({ RC.vars.modky }, "p", function()
|
|
||||||
menubar.show()
|
|
||||||
end, { description = "show the menubar", group = "launcher" })
|
|
||||||
)
|
|
||||||
|
|
||||||
clientkeys = gears.table.join(
|
|
||||||
awful.key({ RC.vars.modky }, "f", function(c)
|
|
||||||
c.fullscreen = not c.fullscreen
|
|
||||||
c:raise()
|
|
||||||
end, { description = "toggle fullscreen", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "c", function(c)
|
|
||||||
c:kill()
|
|
||||||
end, { description = "close", group = "client" }),
|
|
||||||
awful.key(
|
|
||||||
{ RC.vars.modky, "Control" },
|
|
||||||
"space",
|
|
||||||
awful.client.floating.toggle,
|
|
||||||
{ description = "toggle floating", group = "client" }
|
|
||||||
),
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "Return", function(c)
|
|
||||||
c:swap(awful.client.getmaster())
|
|
||||||
end, { description = "move to master", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky }, "o", function(c)
|
|
||||||
c:move_to_screen()
|
|
||||||
end, { description = "move to screen", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky }, "t", function(c)
|
|
||||||
c.ontop = not c.ontop
|
|
||||||
end, { description = "toggle keep on top", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky }, "n", function(c)
|
|
||||||
-- The client currently has the input focus, so it cannot be
|
|
||||||
-- minimized, since minimized clients can't have the focus.
|
|
||||||
c.minimized = true
|
|
||||||
end, { description = "minimize", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky }, "m", function(c)
|
|
||||||
c.maximized = not c.maximized
|
|
||||||
c:raise()
|
|
||||||
end, { description = "(un)maximize", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "m", function(c)
|
|
||||||
c.maximized_vertical = not c.maximized_vertical
|
|
||||||
c:raise()
|
|
||||||
end, { description = "(un)maximize vertically", group = "client" }),
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "m", function(c)
|
|
||||||
c.maximized_horizontal = not c.maximized_horizontal
|
|
||||||
c:raise()
|
|
||||||
end, { description = "(un)maximize horizontally", group = "client" })
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Bind all key numbers to tags.
|
|
||||||
-- Be careful: we use keycodes to make it work on any keyboard layout.
|
|
||||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
|
||||||
for i = 1, 9 do
|
|
||||||
globalkeys = gears.table.join(
|
|
||||||
globalkeys,
|
|
||||||
-- View tag only.
|
|
||||||
awful.key({ RC.vars.modky }, "#" .. i + 9, function()
|
|
||||||
local screen = awful.screen.focused()
|
|
||||||
local tag = screen.tags[i]
|
|
||||||
if tag then
|
|
||||||
tag:view_only()
|
|
||||||
end
|
|
||||||
end, { description = "view tag #" .. i, group = "tag" }),
|
|
||||||
-- Toggle tag display.
|
|
||||||
awful.key({ RC.vars.modky, "Control" }, "#" .. i + 9, function()
|
|
||||||
local screen = awful.screen.focused()
|
|
||||||
local tag = screen.tags[i]
|
|
||||||
if tag then
|
|
||||||
awful.tag.viewtoggle(tag)
|
|
||||||
end
|
|
||||||
end, { description = "toggle tag #" .. i, group = "tag" }),
|
|
||||||
-- Move client to tag.
|
|
||||||
awful.key({ RC.vars.modky, "Shift" }, "#" .. i + 9, function()
|
|
||||||
if client.focus then
|
|
||||||
local tag = client.focus.screen.tags[i]
|
|
||||||
if tag then
|
|
||||||
client.focus:move_to_tag(tag)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, { description = "move focused client to tag #" .. i, group = "tag" }),
|
|
||||||
-- Toggle tag on focused client.
|
|
||||||
awful.key({ RC.vars.modky, "Control", "Shift" }, "#" .. i + 9, function()
|
|
||||||
if client.focus then
|
|
||||||
local tag = client.focus.screen.tags[i]
|
|
||||||
if tag then
|
|
||||||
client.focus:toggle_tag(tag)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, { description = "toggle focused client on tag #" .. i, group = "tag" })
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
clientbuttons = gears.table.join(
|
|
||||||
awful.button({}, 1, function(c)
|
|
||||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
|
||||||
end),
|
|
||||||
awful.button({ RC.vars.modky }, 1, function(c)
|
|
||||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
|
||||||
awful.mouse.client.move(c)
|
|
||||||
end),
|
|
||||||
awful.button({ RC.vars.modky }, 3, function(c)
|
|
||||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
|
||||||
awful.mouse.client.resize(c)
|
|
||||||
end)
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Set keys
|
-- Set keys
|
||||||
root.keys(globalkeys)
|
root.buttons(bindings.global_buttons())
|
||||||
-- }}}
|
root.keys(bindings.global_keys())
|
||||||
|
awful.rules.rules = main.rules(bindings.client_keys(), bindings.client_buttons())
|
||||||
-- {{{ Rules
|
|
||||||
-- Rules to apply to new clients (through the "manage" signal).
|
|
||||||
awful.rules.rules = {
|
|
||||||
-- All clients will match this rule.
|
|
||||||
{
|
|
||||||
rule = {},
|
|
||||||
properties = {
|
|
||||||
border_width = beautiful.border_width,
|
|
||||||
border_color = beautiful.border_normal,
|
|
||||||
focus = awful.client.focus.filter,
|
|
||||||
raise = true,
|
|
||||||
keys = clientkeys,
|
|
||||||
buttons = clientbuttons,
|
|
||||||
screen = awful.screen.preferred,
|
|
||||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Floating clients.
|
|
||||||
{
|
|
||||||
rule_any = {
|
|
||||||
instance = {
|
|
||||||
"DTA", -- Firefox addon DownThemAll.
|
|
||||||
"copyq", -- Includes session name in class.
|
|
||||||
"pinentry",
|
|
||||||
},
|
|
||||||
class = {
|
|
||||||
"Arandr",
|
|
||||||
"Blueman-manager",
|
|
||||||
"Gpick",
|
|
||||||
"Kruler",
|
|
||||||
"MessageWin", -- kalarm.
|
|
||||||
"Sxiv",
|
|
||||||
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
|
|
||||||
"Wpa_gui",
|
|
||||||
"veromix",
|
|
||||||
"xtightvncviewer",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Note that the name property shown in xprop might be set slightly after creation of the client
|
|
||||||
-- and the name shown there might not match defined rules here.
|
|
||||||
name = {
|
|
||||||
"Event Tester", -- xev.
|
|
||||||
},
|
|
||||||
role = {
|
|
||||||
"AlarmWindow", -- Thunderbird's calendar.
|
|
||||||
"ConfigManager", -- Thunderbird's about:config.
|
|
||||||
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
|
|
||||||
},
|
|
||||||
},
|
|
||||||
properties = { floating = true },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Add titlebars to normal clients and dialogs
|
|
||||||
{ rule_any = { type = { "normal", "dialog" } }, properties = { titlebars_enabled = true } },
|
|
||||||
|
|
||||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
|
||||||
-- { rule = { class = "Firefox" },
|
|
||||||
-- properties = { screen = 1, tag = "2" } },
|
|
||||||
}
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- {{{ Signals
|
|
||||||
-- Signal function to execute when a new client appears.
|
|
||||||
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
|
|
||||||
-- Prevent clients from being unreachable after screen count changes.
|
|
||||||
awful.placement.no_offscreen(c)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
|
||||||
client.connect_signal("request::titlebars", function(c)
|
|
||||||
-- buttons for the titlebar
|
|
||||||
local buttons = gears.table.join(
|
|
||||||
awful.button({}, 1, function()
|
|
||||||
c:emit_signal("request::activate", "titlebar", { raise = true })
|
|
||||||
awful.mouse.client.move(c)
|
|
||||||
end),
|
|
||||||
awful.button({}, 3, function()
|
|
||||||
c:emit_signal("request::activate", "titlebar", { raise = true })
|
|
||||||
awful.mouse.client.resize(c)
|
|
||||||
end)
|
|
||||||
)
|
|
||||||
|
|
||||||
awful.titlebar(c):setup({
|
|
||||||
{ -- Left
|
|
||||||
awful.titlebar.widget.iconwidget(c),
|
|
||||||
buttons = buttons,
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
},
|
|
||||||
{ -- Middle
|
|
||||||
{ -- Title
|
|
||||||
align = "center",
|
|
||||||
widget = awful.titlebar.widget.titlewidget(c),
|
|
||||||
},
|
|
||||||
buttons = buttons,
|
|
||||||
layout = wibox.layout.flex.horizontal,
|
|
||||||
},
|
|
||||||
{ -- Right
|
|
||||||
awful.titlebar.widget.floatingbutton(c),
|
|
||||||
awful.titlebar.widget.maximizedbutton(c),
|
|
||||||
awful.titlebar.widget.stickybutton(c),
|
|
||||||
awful.titlebar.widget.ontopbutton(c),
|
|
||||||
awful.titlebar.widget.closebutton(c),
|
|
||||||
layout = wibox.layout.fixed.horizontal(),
|
|
||||||
},
|
|
||||||
layout = wibox.layout.align.horizontal,
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Enable sloppy focus, so that focus follows mouse.
|
|
||||||
client.connect_signal("mouse::enter", function(c)
|
|
||||||
c:emit_signal("request::activate", "mouse_enter", { raise = false })
|
|
||||||
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)
|
|
||||||
-- }}}
|
|
||||||
|
|||||||
17
statusbar/bottom/statusbar.lua
Normal file
17
statusbar/bottom/statusbar.lua
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
return function(s)
|
||||||
|
local widgets = require("statusbar.bottom.widgets")
|
||||||
|
|
||||||
|
-- Create the wibox
|
||||||
|
s.bottom_wibox = awful.wibar({ position = "bottom", screen = s })
|
||||||
|
|
||||||
|
-- Add widgets to the wibox
|
||||||
|
s.bottom_wibox:setup({
|
||||||
|
layout = wibox.layout.align.horizontal,
|
||||||
|
s.taglist, -- Left widgets
|
||||||
|
nil,
|
||||||
|
widgets(s)
|
||||||
|
})
|
||||||
|
end
|
||||||
33
statusbar/bottom/widgets.lua
Normal file
33
statusbar/bottom/widgets.lua
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
local wibox = require("wibox")
|
||||||
|
local widgets = require("widgets")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
_M.battery_widget = widgets.battery(false)
|
||||||
|
_M.volume_widget = widgets.volume()
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
return {
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
spacing = 7,
|
||||||
|
spacing_widget = wibox.widget.separator({
|
||||||
|
orientation = "vertical",
|
||||||
|
color = "#333",
|
||||||
|
thickness = 2,
|
||||||
|
span_ratio = 0.75,
|
||||||
|
}),
|
||||||
|
_M.volume_widget,
|
||||||
|
_M.battery_widget,
|
||||||
|
widgets.text_clock(),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function _M.get_battery_widget()
|
||||||
|
return _M.battery_widget
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable(_M, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
17
statusbar/top/statusbar.lua
Normal file
17
statusbar/top/statusbar.lua
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
local widgets = require("statusbar.top.widgets")
|
||||||
|
|
||||||
|
return function(s)
|
||||||
|
-- Create the wibox
|
||||||
|
s.top_wibox = awful.wibar({ position = "top", screen = s })
|
||||||
|
|
||||||
|
-- Add widgets to the wibox
|
||||||
|
s.top_wibox:setup({
|
||||||
|
layout = wibox.layout.align.horizontal,
|
||||||
|
nil,
|
||||||
|
s.tasklist, -- Middle widget
|
||||||
|
widgets(s), -- Right widgets
|
||||||
|
})
|
||||||
|
end
|
||||||
19
statusbar/top/widgets.lua
Normal file
19
statusbar/top/widgets.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
local wibox = require("wibox")
|
||||||
|
local separator = require("widgets.separator")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get(s)
|
||||||
|
return {
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
wibox.widget.systray(),
|
||||||
|
separator,
|
||||||
|
s.layoutbox,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 MiB |
38
theme/elements.lua
Normal file
38
theme/elements.lua
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
local gmc = require("theme.gmc")
|
||||||
|
local xresources = require("beautiful.xresources")
|
||||||
|
local dpi = xresources.apply_dpi
|
||||||
|
|
||||||
|
local elements = {}
|
||||||
|
|
||||||
|
elements.font = "sans 8"
|
||||||
|
|
||||||
|
elements.useless_gap = dpi(3)
|
||||||
|
elements.border_width = dpi(2)
|
||||||
|
|
||||||
|
elements.border_normal = gmc.color["green300"] .. "11"
|
||||||
|
elements.border_focus = gmc.color["green800"] .. "11"
|
||||||
|
elements.border_marked = gmc.color["green500"] .. "11"
|
||||||
|
|
||||||
|
elements.bg_normal = gmc.color["white"] .. "44"
|
||||||
|
elements.bg_focus = gmc.color["green200"] .. "44"
|
||||||
|
elements.bg_urgent = gmc.color["orange900"] .. "44"
|
||||||
|
elements.bg_minimize = gmc.color["grey500"] .. "44"
|
||||||
|
elements.bg_systray = gmc.color["grey800"] .. "44"
|
||||||
|
|
||||||
|
elements.systray_icon_spacing = dpi(5)
|
||||||
|
|
||||||
|
elements.fg_normal = gmc.color["black"]
|
||||||
|
elements.fg_focus = gmc.color["white"]
|
||||||
|
elements.fg_urgent = gmc.color["white"]
|
||||||
|
elements.fg_minimize = gmc.color["white"]
|
||||||
|
|
||||||
|
elements.taglist_bg_focus = gmc.color["green400"] .. "44"
|
||||||
|
elements.taglist_fg_focus = gmc.color["white"]
|
||||||
|
elements.taglist_separator = gmc.color["green300"]
|
||||||
|
elements.taglist_bg_tag = gmc.color["green600"] .. "88"
|
||||||
|
|
||||||
|
elements.tasklist_bg_normal = gmc.color["green300"] .. "44"
|
||||||
|
elements.tasklist_bg_focus = gmc.color["green800"] .. "44"
|
||||||
|
elements.tasklist_fg_focus = gmc.color["black"]
|
||||||
|
|
||||||
|
return elements
|
||||||
144
theme/gmc.lua
Normal file
144
theme/gmc.lua
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
local _M = {}
|
||||||
|
|
||||||
|
-- google material colors
|
||||||
|
-- https://material.io/guidelines/style/color.html
|
||||||
|
|
||||||
|
-- Associative Array (Hash)
|
||||||
|
|
||||||
|
_M.color = {
|
||||||
|
['white'] = '#ffffff',
|
||||||
|
['black'] = '#000000',
|
||||||
|
|
||||||
|
['grey50'] = '#fafafa',
|
||||||
|
['grey100'] = '#f5f5f5',
|
||||||
|
['grey200'] = '#eeeeee',
|
||||||
|
['grey300'] = '#e0e0e0',
|
||||||
|
['grey400'] = '#bdbdbd',
|
||||||
|
['grey500'] = '#9e9e9e',
|
||||||
|
['grey600'] = '#757575',
|
||||||
|
['grey700'] = '#616161',
|
||||||
|
['grey800'] = '#424242',
|
||||||
|
['grey900'] = '#212121',
|
||||||
|
|
||||||
|
['red50'] = '#ffebee',
|
||||||
|
['red100'] = '#ffcdd2',
|
||||||
|
['red200'] = '#ef9a9a',
|
||||||
|
['red300'] = '#e57373',
|
||||||
|
['red400'] = '#ef5350',
|
||||||
|
['red500'] = '#f44336',
|
||||||
|
['red600'] = '#e53935',
|
||||||
|
['red700'] = '#d32f2f',
|
||||||
|
['red800'] = '#c62828',
|
||||||
|
['red900'] = '#b71c1c',
|
||||||
|
['redA100'] = '#ff8a80',
|
||||||
|
['redA200'] = '#ff5252',
|
||||||
|
['redA400'] = '#ff1744',
|
||||||
|
['redA700'] = '#d50000',
|
||||||
|
|
||||||
|
['pink50'] = '#fce4ec',
|
||||||
|
['pink100'] = '#f8bbd0',
|
||||||
|
['pink200'] = '#f48fb1',
|
||||||
|
['pink300'] = '#f06292',
|
||||||
|
['pink400'] = '#ec407a',
|
||||||
|
['pink500'] = '#e91e63',
|
||||||
|
['pink600'] = '#d81b60',
|
||||||
|
['pink700'] = '#c2185b',
|
||||||
|
['pink800'] = '#ad1457',
|
||||||
|
['pink900'] = '#880e4f',
|
||||||
|
['pinkA100'] = '#ff80ab',
|
||||||
|
['pinkA200'] = '#ff4081',
|
||||||
|
['pinkA400'] = '#f50057',
|
||||||
|
['pinkA700'] = '#c51162',
|
||||||
|
|
||||||
|
['blue50'] = '#e3f2fd',
|
||||||
|
['blue100'] = '#bbdefb',
|
||||||
|
['blue200'] = '#90caf9',
|
||||||
|
['blue300'] = '#64b5f6',
|
||||||
|
['blue400'] = '#42a5f5',
|
||||||
|
['blue500'] = '#2196f3',
|
||||||
|
['blue600'] = '#1e88e5',
|
||||||
|
['blue700'] = '#1976d2',
|
||||||
|
['blue800'] = '#1565c0',
|
||||||
|
['blue900'] = '#0d47a1',
|
||||||
|
['blueA100'] = '#82b1ff',
|
||||||
|
['blueA200'] = '#448aff',
|
||||||
|
['blueA400'] = '#2979ff',
|
||||||
|
['blueA700'] = '#2962ff',
|
||||||
|
|
||||||
|
['yellow50'] = '#fffde7',
|
||||||
|
['yellow100'] = '#fff9c4',
|
||||||
|
['yellow200'] = '#fff59d',
|
||||||
|
['yellow300'] = '#fff176',
|
||||||
|
['yellow400'] = '#ffee58',
|
||||||
|
['yellow500'] = '#ffeb3b',
|
||||||
|
['yellow600'] = '#fdd835',
|
||||||
|
['yellow700'] = '#fbc02d',
|
||||||
|
['yellow800'] = '#f9a825',
|
||||||
|
['yellow900'] = '#f57f17',
|
||||||
|
['yellowA100'] = '#ffff8d',
|
||||||
|
['yellowA200'] = '#ffff00',
|
||||||
|
['yellowA400'] = '#ffea00',
|
||||||
|
['yellowA700'] = '#ffd600',
|
||||||
|
|
||||||
|
['teal50'] = '#e0f2f1',
|
||||||
|
['teal100'] = '#b2dfdb',
|
||||||
|
['teal200'] = '#80cbc4',
|
||||||
|
['teal300'] = '#4db6ac',
|
||||||
|
['teal400'] = '#26a69a',
|
||||||
|
['teal500'] = '#009688',
|
||||||
|
['teal600'] = '#00897b',
|
||||||
|
['teal700'] = '#00796b',
|
||||||
|
['teal800'] = '#00695c',
|
||||||
|
['teal900'] = '#004d40',
|
||||||
|
['tealA100'] = '#a7ffeb',
|
||||||
|
['tealA200'] = '#64ffda',
|
||||||
|
['tealA400'] = '#1de9b6',
|
||||||
|
['tealA700'] = '#00bfa5',
|
||||||
|
|
||||||
|
['green50'] = '#e8f5e9',
|
||||||
|
['green100'] = '#c8e6c9',
|
||||||
|
['green200'] = '#a5d6a7',
|
||||||
|
['green300'] = '#81c784',
|
||||||
|
['green400'] = '#66bb6a',
|
||||||
|
['green500'] = '#4caf50',
|
||||||
|
['green600'] = '#43a047',
|
||||||
|
['green700'] = '#388e3c',
|
||||||
|
['green800'] = '#2e7d32',
|
||||||
|
['green900'] = '#1b5e20',
|
||||||
|
['greenA100'] = '#b9f6ca',
|
||||||
|
['greenA200'] = '#69f0ae',
|
||||||
|
['greenA400'] = '#00e676',
|
||||||
|
['greenA700'] = '#00c853',
|
||||||
|
|
||||||
|
['orange50'] = '#fff3e0',
|
||||||
|
['orange100'] = '#ffe0b2',
|
||||||
|
['orange200'] = '#ffcc80',
|
||||||
|
['orange300'] = '#ffb74d',
|
||||||
|
['orange400'] = '#ffa726',
|
||||||
|
['orange500'] = '#ff9800',
|
||||||
|
['orange600'] = '#fb8c00',
|
||||||
|
['orange700'] = '#f57c00',
|
||||||
|
['orange800'] = '#ef6c00',
|
||||||
|
['orange900'] = '#e65100',
|
||||||
|
['orangeA100'] = '#ffd180',
|
||||||
|
['orangeA200'] = '#ffab40',
|
||||||
|
['orangeA400'] = '#ff9100',
|
||||||
|
['orangeA700'] = '#ff6d00',
|
||||||
|
|
||||||
|
['deepOrange50'] = '#fbe9e7',
|
||||||
|
['deepOrange100'] = '#ffccbc',
|
||||||
|
['deepOrange200'] = '#ffab91',
|
||||||
|
['deepOrange300'] = '#ff8a65',
|
||||||
|
['deepOrange400'] = '#ff7043',
|
||||||
|
['deepOrange500'] = '#ff5722',
|
||||||
|
['deepOrange600'] = '#f4511e',
|
||||||
|
['deepOrange700'] = '#e64a19',
|
||||||
|
['deepOrange800'] = '#d84315',
|
||||||
|
['deepOrange900'] = '#bf360c',
|
||||||
|
['deepOrangeA100'] = '#ff9e80',
|
||||||
|
['deepOrangeA200'] = '#ff6e40',
|
||||||
|
['deepOrangeA400'] = '#ff3d00',
|
||||||
|
['deepOrangeA700'] = '#dd2c00'
|
||||||
|
}
|
||||||
|
|
||||||
|
return _M
|
||||||
134
theme/init.lua
134
theme/init.lua
@@ -1,129 +1,23 @@
|
|||||||
---------------------------
|
local awful = require("awful")
|
||||||
-- Default awesome theme --
|
local gears = require("gears")
|
||||||
---------------------------
|
awful.util = require("awful.util")
|
||||||
|
|
||||||
local theme_assets = require("beautiful.theme_assets")
|
|
||||||
local xresources = require("beautiful.xresources")
|
|
||||||
local dpi = xresources.apply_dpi
|
|
||||||
|
|
||||||
local gfs = require("gears.filesystem")
|
|
||||||
local themes_path = gfs.get_themes_dir()
|
|
||||||
|
|
||||||
local theme = {}
|
local theme = {}
|
||||||
|
|
||||||
theme.font = "sans 8"
|
local elements = require("theme.elements")
|
||||||
|
theme = gears.table.join(theme, elements)
|
||||||
|
|
||||||
theme.bg_normal = "#222222"
|
local layout_icons = require("theme.layout_icons")
|
||||||
theme.bg_focus = "#535d6c"
|
theme = gears.table.join(theme, layout_icons)
|
||||||
theme.bg_urgent = "#ff0000"
|
|
||||||
theme.bg_minimize = "#444444"
|
|
||||||
theme.bg_systray = theme.bg_normal
|
|
||||||
|
|
||||||
theme.fg_normal = "#aaaaaa"
|
local titlebar = require("theme.titlebar")
|
||||||
theme.fg_focus = "#ffffff"
|
theme = gears.table.join(theme, titlebar)
|
||||||
theme.fg_urgent = "#ffffff"
|
|
||||||
theme.fg_minimize = "#ffffff"
|
|
||||||
|
|
||||||
theme.useless_gap = dpi(0)
|
local widgets = require("theme.widgets")
|
||||||
theme.border_width = dpi(1)
|
theme = gears.table.join(theme, widgets)
|
||||||
theme.border_normal = "#000000"
|
|
||||||
theme.border_focus = "#535d6c"
|
|
||||||
theme.border_marked = "#91231c"
|
|
||||||
|
|
||||||
-- There are other variable sets
|
theme.icon_theme = "Arc"
|
||||||
-- overriding the default one when
|
theme.font = "JetBrainsMono Nerd Font Mono 10"
|
||||||
-- defined, the sets are:
|
theme.wallpaper = os.getenv("HOME") .. "/Pictures/background.jpg"
|
||||||
-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
|
|
||||||
-- tasklist_[bg|fg]_[focus|urgent]
|
|
||||||
-- titlebar_[bg|fg]_[normal|focus]
|
|
||||||
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
|
|
||||||
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
|
|
||||||
-- prompt_[fg|bg|fg_cursor|bg_cursor|font]
|
|
||||||
-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font]
|
|
||||||
-- Example:
|
|
||||||
--theme.taglist_bg_focus = "#ff0000"
|
|
||||||
|
|
||||||
-- Generate taglist squares:
|
|
||||||
local taglist_square_size = dpi(4)
|
|
||||||
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
|
|
||||||
taglist_square_size, theme.fg_normal
|
|
||||||
)
|
|
||||||
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
|
|
||||||
taglist_square_size, theme.fg_normal
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Variables set for theming notifications:
|
|
||||||
-- notification_font
|
|
||||||
-- notification_[bg|fg]
|
|
||||||
-- notification_[width|height|margin]
|
|
||||||
-- notification_[border_color|border_width|shape|opacity]
|
|
||||||
|
|
||||||
-- Variables set for theming the menu:
|
|
||||||
-- menu_[bg|fg]_[normal|focus]
|
|
||||||
-- menu_[border_color|border_width]
|
|
||||||
theme.menu_submenu_icon = themes_path.."default/submenu.png"
|
|
||||||
theme.menu_height = dpi(15)
|
|
||||||
theme.menu_width = dpi(100)
|
|
||||||
|
|
||||||
-- You can add as many variables as
|
|
||||||
-- you wish and access them by using
|
|
||||||
-- beautiful.variable in your rc.lua
|
|
||||||
--theme.bg_widget = "#cc0000"
|
|
||||||
|
|
||||||
-- Define the image to load
|
|
||||||
theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png"
|
|
||||||
theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png"
|
|
||||||
|
|
||||||
theme.titlebar_minimize_button_normal = themes_path.."default/titlebar/minimize_normal.png"
|
|
||||||
theme.titlebar_minimize_button_focus = themes_path.."default/titlebar/minimize_focus.png"
|
|
||||||
|
|
||||||
theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png"
|
|
||||||
theme.titlebar_ontop_button_focus_inactive = themes_path.."default/titlebar/ontop_focus_inactive.png"
|
|
||||||
theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png"
|
|
||||||
theme.titlebar_ontop_button_focus_active = themes_path.."default/titlebar/ontop_focus_active.png"
|
|
||||||
|
|
||||||
theme.titlebar_sticky_button_normal_inactive = themes_path.."default/titlebar/sticky_normal_inactive.png"
|
|
||||||
theme.titlebar_sticky_button_focus_inactive = themes_path.."default/titlebar/sticky_focus_inactive.png"
|
|
||||||
theme.titlebar_sticky_button_normal_active = themes_path.."default/titlebar/sticky_normal_active.png"
|
|
||||||
theme.titlebar_sticky_button_focus_active = themes_path.."default/titlebar/sticky_focus_active.png"
|
|
||||||
|
|
||||||
theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png"
|
|
||||||
theme.titlebar_floating_button_focus_inactive = themes_path.."default/titlebar/floating_focus_inactive.png"
|
|
||||||
theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png"
|
|
||||||
theme.titlebar_floating_button_focus_active = themes_path.."default/titlebar/floating_focus_active.png"
|
|
||||||
|
|
||||||
theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar/maximized_normal_inactive.png"
|
|
||||||
theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png"
|
|
||||||
theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png"
|
|
||||||
theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png"
|
|
||||||
|
|
||||||
theme.wallpaper = themes_path.."default/background.png"
|
|
||||||
|
|
||||||
-- You can use your own layout icons like this:
|
|
||||||
theme.layout_fairh = themes_path.."default/layouts/fairhw.png"
|
|
||||||
theme.layout_fairv = themes_path.."default/layouts/fairvw.png"
|
|
||||||
theme.layout_floating = themes_path.."default/layouts/floatingw.png"
|
|
||||||
theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png"
|
|
||||||
theme.layout_max = themes_path.."default/layouts/maxw.png"
|
|
||||||
theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png"
|
|
||||||
theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png"
|
|
||||||
theme.layout_tileleft = themes_path.."default/layouts/tileleftw.png"
|
|
||||||
theme.layout_tile = themes_path.."default/layouts/tilew.png"
|
|
||||||
theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png"
|
|
||||||
theme.layout_spiral = themes_path.."default/layouts/spiralw.png"
|
|
||||||
theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png"
|
|
||||||
theme.layout_cornernw = themes_path.."default/layouts/cornernww.png"
|
|
||||||
theme.layout_cornerne = themes_path.."default/layouts/cornernew.png"
|
|
||||||
theme.layout_cornersw = themes_path.."default/layouts/cornersww.png"
|
|
||||||
theme.layout_cornerse = themes_path.."default/layouts/cornersew.png"
|
|
||||||
|
|
||||||
-- Generate Awesome icon:
|
|
||||||
theme.awesome_icon = theme_assets.awesome_icon(
|
|
||||||
theme.menu_height, theme.bg_focus, theme.fg_focus
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Define the icon theme for application icons. If not set then the icons
|
|
||||||
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
|
|
||||||
theme.icon_theme = nil
|
|
||||||
|
|
||||||
return theme
|
return theme
|
||||||
|
|||||||
23
theme/layout_icons.lua
Normal file
23
theme/layout_icons.lua
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
local gfs = require("gears.filesystem")
|
||||||
|
local theme_path = gfs.get_themes_dir()
|
||||||
|
|
||||||
|
local icons = {}
|
||||||
|
|
||||||
|
icons.layout_fairh = theme_path .. "zenburn/layouts/fairh.png"
|
||||||
|
icons.layout_fairv = theme_path .. "zenburn/layouts/fairv.png"
|
||||||
|
icons.layout_floating = theme_path .. "zenburn/layouts/floating.png"
|
||||||
|
icons.layout_magnifier = theme_path .. "zenburn/layouts/magnifier.png"
|
||||||
|
icons.layout_max = theme_path .. "zenburn/layouts/max.png"
|
||||||
|
icons.layout_fullscreen = theme_path .. "zenburn/layouts/fullscreen.png"
|
||||||
|
icons.layout_tilebottom = theme_path .. "zenburn/layouts/tilebottom.png"
|
||||||
|
icons.layout_tileleft = theme_path .. "zenburn/layouts/tileleft.png"
|
||||||
|
icons.layout_tile = theme_path .. "zenburn/layouts/tile.png"
|
||||||
|
icons.layout_tiletop = theme_path .. "zenburn/layouts/tiletop.png"
|
||||||
|
icons.layout_spiral = theme_path .. "zenburn/layouts/spiral.png"
|
||||||
|
icons.layout_dwindle = theme_path .. "zenburn/layouts/dwindle.png"
|
||||||
|
icons.layout_cornernw = theme_path .. "zenburn/layouts/cornernw.png"
|
||||||
|
icons.layout_cornerne = theme_path .. "zenburn/layouts/cornerne.png"
|
||||||
|
icons.layout_cornersw = theme_path .. "zenburn/layouts/cornersw.png"
|
||||||
|
icons.layout_cornerse = theme_path .. "zenburn/layouts/cornerse.png"
|
||||||
|
|
||||||
|
return icons
|
||||||
20
theme/titlebar.lua
Normal file
20
theme/titlebar.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
local gmc = require("theme.gmc")
|
||||||
|
local icon_path = "/usr/share/icons/Papirus-Dark/22x22"
|
||||||
|
|
||||||
|
local titlebar = {}
|
||||||
|
|
||||||
|
titlebar.titlebar_fg_normal = gmc.color["black"]
|
||||||
|
titlebar.titlebar_fg_focus = gmc.color["green100"]
|
||||||
|
|
||||||
|
titlebar.titlebar_close_button_normal = icon_path .. "/actions/window-close.svg"
|
||||||
|
titlebar.titlebar_close_button_focus = icon_path .. "/actions/window-close.svg"
|
||||||
|
|
||||||
|
titlebar.titlebar_minimize_button_normal = icon_path .. "/actions/list-remove.svg"
|
||||||
|
titlebar.titlebar_minimize_button_focus = icon_path .. "/actions/list-remove.svg"
|
||||||
|
|
||||||
|
titlebar.titlebar_maximized_button_normal_inactive = icon_path .. "/actions/list-add.svg"
|
||||||
|
titlebar.titlebar_maximized_button_focus_inactive = icon_path .. "/actions/list-add.svg"
|
||||||
|
titlebar.titlebar_maximized_button_normal_active = icon_path .. "/actions/go-bottom.svg"
|
||||||
|
titlebar.titlebar_maximized_button_focus_active = icon_path .. "/actions/go-bottom.svg"
|
||||||
|
|
||||||
|
return titlebar
|
||||||
29
theme/widgets.lua
Normal file
29
theme/widgets.lua
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
local gmc = require("theme.gmc")
|
||||||
|
local icon_path = "/usr/share/icons/Papirus-Dark/22x22"
|
||||||
|
|
||||||
|
local widgets = {}
|
||||||
|
|
||||||
|
function widgets.battery_icon(icon)
|
||||||
|
icon = icon or "battery-missing"
|
||||||
|
return icon_path .. "/panel/" .. icon:gsub("'", "") .. ".svg"
|
||||||
|
end
|
||||||
|
|
||||||
|
widgets.battery_text_color_charging = gmc.color["green900"]
|
||||||
|
widgets.battery_text_color_full = gmc.color["green900"]
|
||||||
|
widgets.battery_text_color_medium = gmc.color["yellow900"]
|
||||||
|
widgets.battery_text_color_low = gmc.color["orange900"]
|
||||||
|
widgets.battery_text_color_critical = gmc.color["red900"]
|
||||||
|
|
||||||
|
widgets.clock_icon = icon_path .. "/actions/clock.svg"
|
||||||
|
widgets.clock_text_color = gmc.color["black"]
|
||||||
|
widgets.clock_date_color = gmc.color["green300"]
|
||||||
|
|
||||||
|
widgets.net_internt_connected_icon = icon_path .. "/status/network-wireless-connected.svg"
|
||||||
|
widgets.net_internt_disconnected_icon = icon_path .. "/status/network-wireless-disconnected.svg"
|
||||||
|
|
||||||
|
widgets.volume_high_icon = icon_path .. "/panel/audio-volume-high.svg"
|
||||||
|
widgets.volume_medium_icon = icon_path .. "/panel/audio-volume-medium.svg"
|
||||||
|
widgets.volume_low_icon = icon_path .. "/panel/audio-volume-low.svg"
|
||||||
|
widgets.volume_muted_icon = icon_path .. "/panel/audio-volume-muted.svg"
|
||||||
|
|
||||||
|
return widgets
|
||||||
85
widgets/battery.lua
Normal file
85
widgets/battery.lua
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.update(stdout)
|
||||||
|
local bat_now = {
|
||||||
|
present = "N/A",
|
||||||
|
state = "N/A",
|
||||||
|
warninglevel = "N/A",
|
||||||
|
energy = "N/A",
|
||||||
|
energyfull = "N/A",
|
||||||
|
energyrate = "N/A",
|
||||||
|
voltage = "N/A",
|
||||||
|
percentage = "N/A",
|
||||||
|
capacity = "N/A",
|
||||||
|
icon = "N/A",
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v in stdout:gmatch("([%a]+[%a|-]+):%s*([%a|%d|']+[,|%a|%d|'|-]+)") do
|
||||||
|
if k == "present" then
|
||||||
|
bat_now.present = v
|
||||||
|
elseif k == "state" then
|
||||||
|
bat_now.state = v
|
||||||
|
elseif k == "warning-level" then
|
||||||
|
bat_now.warninglevel = v
|
||||||
|
elseif k == "energy" then
|
||||||
|
bat_now.energy = v:gsub(",", ".") -- Wh
|
||||||
|
elseif k == "energy-full" then
|
||||||
|
bat_now.energyfull = v:gsub(",", ".") -- Wh
|
||||||
|
elseif k == "energy-rate" then
|
||||||
|
bat_now.energyrate = v:gsub(",", ".") -- W
|
||||||
|
elseif k == "voltage" then
|
||||||
|
bat_now.voltage = v:gsub(",", ".") -- V
|
||||||
|
elseif k == "percentage" then
|
||||||
|
bat_now.percentage = tonumber(v) -- %
|
||||||
|
elseif k == "capacity" then
|
||||||
|
bat_now.capacity = v:gsub(",", ".") -- %
|
||||||
|
elseif k == "icon-name" then
|
||||||
|
bat_now.icon = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return bat_now
|
||||||
|
end
|
||||||
|
|
||||||
|
function _M.get(show_percentage)
|
||||||
|
_M.show_percentage = show_percentage or true
|
||||||
|
local battery = awful.widget.watch(
|
||||||
|
{
|
||||||
|
awful.util.shell,
|
||||||
|
"-c",
|
||||||
|
"upower -i /org/freedesktop/UPower/devices/battery_BAT0 | sed -n '/present/,/icon-name/p'",
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
function(widget, stdout)
|
||||||
|
local bat_now = _M.update(stdout)
|
||||||
|
|
||||||
|
local icon = wibox.widget.imagebox(beautiful.battery_icon(bat_now.icon) or beautiful.battery_icon_full)
|
||||||
|
local text = wibox.widget.textbox(bat_now.percentage .. "%")
|
||||||
|
|
||||||
|
widget.children = {
|
||||||
|
(_M.show_percentage and text) or wibox.widget.textbox(),
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
wibox.widget {
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
battery.toggle_percentage = function()
|
||||||
|
_M.show_percentage = not _M.show_percentage
|
||||||
|
battery:emit_signal("widget::redraw_needed")
|
||||||
|
end
|
||||||
|
|
||||||
|
return battery
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
7
widgets/init.lua
Normal file
7
widgets/init.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
battery = require("widgets.battery"),
|
||||||
|
volume = require("widgets.volume"),
|
||||||
|
separator = require("widgets.separator"),
|
||||||
|
text_clock = require("widgets.text_clock"),
|
||||||
|
net_widget = require("widgets.net_widgets").wireless({interface="wlp2s0", popup_position = "bottom_right"}),
|
||||||
|
}
|
||||||
1
widgets/net_widgets
Submodule
1
widgets/net_widgets
Submodule
Submodule widgets/net_widgets added at 13bc07b875
3
widgets/separator.lua
Normal file
3
widgets/separator.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
return wibox.widget.textbox(" | ")
|
||||||
32
widgets/text_clock.lua
Normal file
32
widgets/text_clock.lua
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
local lain = require("lain")
|
||||||
|
local markup = lain.util.markup
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.get(icon)
|
||||||
|
if not icon then
|
||||||
|
icon = wibox.widget.imagebox(beautiful.clock_icon)
|
||||||
|
end
|
||||||
|
|
||||||
|
local clock = awful.widget.textclock(
|
||||||
|
markup(beautiful.clock_date_color, "%A %B %d ")
|
||||||
|
.. markup(beautiful.clock_text_color, ">")
|
||||||
|
.. markup(beautiful.clock_text_color, " %I:%M %p ")
|
||||||
|
)
|
||||||
|
|
||||||
|
return wibox.widget({
|
||||||
|
icon,
|
||||||
|
clock,
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
68
widgets/volume.lua
Normal file
68
widgets/volume.lua
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
function _M.update(stdout)
|
||||||
|
local vol_now = {
|
||||||
|
volume = "N/A",
|
||||||
|
muted = "N/A",
|
||||||
|
icon = "N/A",
|
||||||
|
}
|
||||||
|
|
||||||
|
vol_now.volume = stdout:gsub("%s+", "")
|
||||||
|
vol_now.volume = vol_now.volume:gsub("%%", "")
|
||||||
|
if vol_now.volume == "muted" then
|
||||||
|
vol_now.muted = true
|
||||||
|
vol_now.volume = -1
|
||||||
|
else
|
||||||
|
vol_now.volume = tonumber(vol_now.volume)
|
||||||
|
vol_now.muted = false
|
||||||
|
end
|
||||||
|
|
||||||
|
if vol_now.muted or vol_now.volume == 0 then
|
||||||
|
vol_now.icon = beautiful.volume_muted_icon
|
||||||
|
elseif vol_now.volume >= 66 then
|
||||||
|
vol_now.icon = beautiful.volume_high_icon
|
||||||
|
elseif vol_now.volume >= 33 then
|
||||||
|
vol_now.icon = beautiful.volume_medium_icon
|
||||||
|
else
|
||||||
|
vol_now.icon = beautiful.volume_low_icon
|
||||||
|
end
|
||||||
|
|
||||||
|
return vol_now
|
||||||
|
end
|
||||||
|
|
||||||
|
function _M.get()
|
||||||
|
local volume = awful.widget.watch(
|
||||||
|
{
|
||||||
|
awful.util.shell,
|
||||||
|
"-c",
|
||||||
|
"pamixer --get-volume-human",
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
function(widget, stdout)
|
||||||
|
local vol_now = _M.update(stdout)
|
||||||
|
|
||||||
|
local icon = wibox.widget.imagebox(vol_now.icon)
|
||||||
|
local text = wibox.widget.textbox(vol_now.volume .. "% ")
|
||||||
|
|
||||||
|
widget.children = {
|
||||||
|
text,
|
||||||
|
icon,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
wibox.widget({
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
return volume
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable({}, {
|
||||||
|
__call = function(_, ...)
|
||||||
|
return _M.get(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user