Update to Awesome 4.0
Configuration works mostly identical to previous state. Some exceptions: - Minor changes in tag names (removed unicode symbols), as they are now referenced by name in the rules. - Calendar module is not yet ported and not loaded. - Scratch terminal on F12 key currently moves to bottom of the screen after first opening. Probably will be reimplemented using the new extended awful.spawn API. - awsetbg util writes different wallpaperrc (preexisting wallpaperrc is ignored, as the filename now includes .lua)
This commit is contained in:
parent
457f474a2c
commit
a43b908350
|
@ -7,15 +7,17 @@ beautiful.init(awful.util.getdir("config") .. "/theme.lua")
|
||||||
local wallpaperrc = awful.util.getdir("config") .. "/wallpaperrc"
|
local wallpaperrc = awful.util.getdir("config") .. "/wallpaperrc"
|
||||||
local f=io.open(wallpaperrc,"r")
|
local f=io.open(wallpaperrc,"r")
|
||||||
if f~=nil then
|
if f~=nil then
|
||||||
io.close(f)
|
io.close(f)
|
||||||
dofile(wallpaperrc)
|
require("wallpaperrc")
|
||||||
elseif beautiful.wallpaper then
|
screen.connect_signal("property::geometry", set_wallpaper)
|
||||||
f = io.open(beautiful.wallpaper)
|
else if beautiful.wallpaper then
|
||||||
if f ~= nil then
|
f = io.open(beautiful.wallpaper)
|
||||||
io.close(f)
|
if f ~= nil then
|
||||||
for s = 1, screen.count() do
|
io.close(f)
|
||||||
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
screen.connect_signal("property::geometry", function(s)
|
||||||
end
|
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
13
awsetbg
13
awsetbg
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
WALLPAPERRC=$(awesome-client <<<'return awful.util.getdir("config") .. "/wallpaperrc"' | sed -e 's/.*string "\(.*\)"/\1/')
|
WALLPAPERRC=$(awesome-client <<<'return require("awful").util.getdir("config") .. "/wallpaperrc.lua"' | sed -e 's/.*string "\(.*\)"/\1/')
|
||||||
|
|
||||||
mode="-f"
|
mode="-f"
|
||||||
|
|
||||||
|
@ -73,12 +73,13 @@ require('gears').wallpaper.${method}(\"${wall}\",s${extra_args})
|
||||||
end" | awesome-client
|
end" | awesome-client
|
||||||
|
|
||||||
if [[ -n "$update" ]]; then
|
if [[ -n "$update" ]]; then
|
||||||
echo "-- wallpaperrc generated by awsetbg
|
echo "-- wallpaperrc generated by awsetbg
|
||||||
|
gears = require(\"gears\")
|
||||||
|
function set_wallpaper(s)
|
||||||
local wall=\"${wall}\"
|
local wall=\"${wall}\"
|
||||||
local f = io.open(wall, \"r\")
|
local f = io.open(wall, \"r\")
|
||||||
if f~= nil then
|
if f~= nil then
|
||||||
for s = 1, screen.count() do
|
gears.wallpaper.${method}(wall,s${extra_args})
|
||||||
require('gears').wallpaper.${method}(wall,s${extra_args})
|
end
|
||||||
end
|
end" > $WALLPAPERRC
|
||||||
end" > $WALLPAPERRC
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -8,7 +8,7 @@ local mb = binder.modal
|
||||||
|
|
||||||
local mpd = require("separable.mpd")
|
local mpd = require("separable.mpd")
|
||||||
local scratch = require("scratch")
|
local scratch = require("scratch")
|
||||||
local calendar = require("separable.calendar")
|
--local calendar = require("separable.calendar")
|
||||||
|
|
||||||
local myglobalkeys = {}
|
local myglobalkeys = {}
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ local reloadmap = {
|
||||||
end, desc = "Bindings" },
|
end, desc = "Bindings" },
|
||||||
}
|
}
|
||||||
|
|
||||||
local calendarmap = {
|
--local calendarmap = {
|
||||||
o = { func = function() calendar:next() end, desc = "Next" },
|
-- o = { func = function() calendar:next() end, desc = "Next" },
|
||||||
i = { func = function() calendar:prev() end, desc = "Prev" },
|
-- i = { func = function() calendar:prev() end, desc = "Prev" },
|
||||||
onClose = function() calendar:hide() end
|
-- onClose = function() calendar:hide() end
|
||||||
}
|
--}
|
||||||
|
|
||||||
|
|
||||||
local myglobalkeys = awful.util.table.join(
|
local myglobalkeys = awful.util.table.join(
|
||||||
|
@ -111,17 +111,17 @@ local myglobalkeys = awful.util.table.join(
|
||||||
|
|
||||||
awful.key({ }, "XF86AudioPlay", mpd.ctrl.toggle),
|
awful.key({ }, "XF86AudioPlay", mpd.ctrl.toggle),
|
||||||
awful.key({ }, "XF86AudioNext", mpd.ctrl.next),
|
awful.key({ }, "XF86AudioNext", mpd.ctrl.next),
|
||||||
awful.key({ }, "XF86AudioPrev", mpd.ctrl.prev),
|
awful.key({ }, "XF86AudioPrev", mpd.ctrl.prev)
|
||||||
|
|
||||||
--}}}
|
--}}}
|
||||||
|
|
||||||
-- calendar {{{
|
-- calendar {{{
|
||||||
awful.key({ modkey }, "y",
|
--awful.key({ modkey }, "y",
|
||||||
function()
|
--function()
|
||||||
calendar:show()
|
-- calendar:show()
|
||||||
mb.grab(calendarmap, "Calendar", true)
|
-- mb.grab(calendarmap, "Calendar", true)
|
||||||
end
|
--end
|
||||||
)
|
--)
|
||||||
--}}}
|
--}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
28
rc.lua
28
rc.lua
|
@ -1,11 +1,11 @@
|
||||||
-- libraries {{{
|
-- libraries {{{
|
||||||
awful = require("awful")
|
local awful = require("awful")
|
||||||
awful.rules = require("awful.rules")
|
require("awful.autofocus")
|
||||||
require("awful.autofocus")
|
--require("autobeautiful")
|
||||||
beautiful = require("autobeautiful")
|
beautiful = require("autobeautiful")
|
||||||
naughty = require("naughty")
|
naughty = require("naughty")
|
||||||
conf = require("localconf")
|
conf = require("localconf")
|
||||||
require("errors")
|
require("errors")
|
||||||
inspect = require("lib.inspect")
|
inspect = require("lib.inspect")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ tags.setup()
|
||||||
-- {{{ widgets
|
-- {{{ widgets
|
||||||
widgets = require("widgets")
|
widgets = require("widgets")
|
||||||
for s = 1, screen.count() do
|
for s = 1, screen.count() do
|
||||||
local ltop = widgets.layout(s, "left", "top")
|
local ltop = widgets.container(s, "left", "top")
|
||||||
local rtop = widgets.layout(s, "right", "top")
|
local rtop = widgets.container(s, "right", "top")
|
||||||
local lbottom = widgets.layout(s, "left", "bottom")
|
local lbottom = widgets.container(s, "left", "bottom")
|
||||||
local rbottom = widgets.layout(s, "right", "bottom")
|
local rbottom = widgets.container(s, "right", "bottom")
|
||||||
|
|
||||||
local clock = widgets.add.clock("clock", ltop)
|
local clock = widgets.add.clock("clock", ltop)
|
||||||
|
|
||||||
|
@ -67,11 +67,7 @@ binder.apply()
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ rules
|
require("rules")
|
||||||
rules = require("rules")
|
|
||||||
rules.setup()
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
require("signals")
|
require("signals")
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
392
rules.lua
392
rules.lua
|
@ -1,235 +1,169 @@
|
||||||
local rules = { mt={} }
|
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local tags = tags
|
awful.rules = require("awful.rules")
|
||||||
|
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local binder = binder or require("separable.binder")
|
local binder = binder or require("separable.binder")
|
||||||
|
|
||||||
local rule_screen = 1
|
-- create a notification when given client becomes urgent
|
||||||
|
local function popup_urgent(client, message)
|
||||||
local function popup_urgent(message)
|
client:connect_signal("property::urgent", function (c)
|
||||||
return function(client)
|
if c.urgent and not c.focus then
|
||||||
client:connect_signal("property::urgent", function (c)
|
naughty.notify({ text=message })
|
||||||
if c.urgent and not c.focus then
|
end
|
||||||
naughty.notify({ text=message })
|
end)
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setup(self)
|
awful.rules.rules = {
|
||||||
awful.rules.rules = {
|
-- All clients will match this rule.
|
||||||
-- All clients will match this rule.
|
{
|
||||||
{
|
rule = { },
|
||||||
rule = { },
|
properties = {
|
||||||
properties = {
|
border_width = beautiful.border_width,
|
||||||
border_width = beautiful.border_width,
|
border_color = beautiful.border_normal,
|
||||||
border_color = beautiful.border_normal,
|
focus = awful.client.focus.filter,
|
||||||
focus = awful.client.focus.filter,
|
raise = true,
|
||||||
raise = true,
|
minimized = false,
|
||||||
minimized = false,
|
size_hints_honor = false,
|
||||||
size_hints_honor = false,
|
keys = binder.client.keys(),
|
||||||
keys = binder.client.keys(),
|
buttons = binder.client.buttons(),
|
||||||
buttons = binder.client.buttons(),
|
screen = awful.screen.preferred,
|
||||||
},
|
placement = awful.placement.no_overlap+awful.placement.no_offscreen
|
||||||
-- print name and class of new windows for debugging purposes
|
},
|
||||||
callback = function(c)
|
-- print name and class of new windows for debugging purposes
|
||||||
print("-----------\nnew client\n")
|
callback = function(c)
|
||||||
if (c["name"] ~= nil) then
|
print("-----------\nnew client\n")
|
||||||
print("name: " .. c["name"])
|
if (c["name"] ~= nil) then
|
||||||
end
|
print("name: " .. c["name"])
|
||||||
if (c["class"] ~= nil) then
|
end
|
||||||
print("class: " .. c["class"])
|
if (c["class"] ~= nil) then
|
||||||
end
|
print("class: " .. c["class"])
|
||||||
end
|
end
|
||||||
},
|
end
|
||||||
{
|
},
|
||||||
rule = { class = "Passprompt" },
|
{
|
||||||
properties = { ontop = true, focus = true}
|
rule = { class = "Passprompt" },
|
||||||
},
|
properties = { ontop = true, focus = true}
|
||||||
{
|
},
|
||||||
rule = { class = "Sm" },
|
{
|
||||||
properties = {
|
rule = { class = "Sm" },
|
||||||
floating = true,
|
properties = {
|
||||||
size_hints_honor = true,
|
floating = true,
|
||||||
-- --ontop = true,
|
size_hints_honor = true,
|
||||||
fullscreen = true,
|
-- --ontop = true,
|
||||||
-- border_width = 0
|
fullscreen = true,
|
||||||
}
|
-- border_width = 0
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
rule_any = { class = {
|
{
|
||||||
"pinentry", "Passprompt", "MPlayer"
|
rule_any = { class = {
|
||||||
}},
|
"pinentry", "Passprompt", "MPlayer"
|
||||||
properties = { floating = true, size_hints_honor = true }
|
}},
|
||||||
},
|
properties = { floating = true, size_hints_honor = true }
|
||||||
{
|
},
|
||||||
rule = { class = "Firefox", instance = "Navigator" },
|
{
|
||||||
properties = {
|
rule = { class = "Firefox", instance = "Navigator" },
|
||||||
tag = tags[rule_screen][2],
|
properties = {
|
||||||
floating = false, minimized = false
|
screen = 1, tag = "2",
|
||||||
},
|
floating = false, minimized = false
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
rule_any = { class = {"Pidgin"}, instance = {"Weechat"} },
|
{
|
||||||
properties = {
|
rule_any = { class = {"Pidgin"}, instance = {"Weechat"} },
|
||||||
tag = tags[rule_screen][3], opacity = 0.8
|
properties = {
|
||||||
},
|
tag = "3", opacity = 0.8
|
||||||
callback = popup_urgent("new chat message")
|
},
|
||||||
},
|
callback = function(c) popup_urgent(c, "new chat message") end
|
||||||
{
|
},
|
||||||
rule = { role = "buddy_list" },
|
{
|
||||||
callback = awful.client.setmaster
|
rule = { role = "buddy_list" },
|
||||||
},
|
callback = awful.client.setmaster
|
||||||
{
|
},
|
||||||
rule = { class = "Eclipse" },
|
{
|
||||||
properties = {
|
rule = { class = "Eclipse" },
|
||||||
float = false
|
properties = {
|
||||||
}
|
float = false
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
rule = { class = "Steam", name = "Friends" },
|
{
|
||||||
properties = {
|
rule = { class = "Steam", name = "Friends" },
|
||||||
tag = tags[rule_screen][3],
|
properties = {
|
||||||
},
|
tag = "3"
|
||||||
callback = awful.client.setmaster
|
},
|
||||||
},
|
callback = awful.client.setmaster
|
||||||
{
|
},
|
||||||
rule = { class = "Steam", name = "Chat" },
|
{
|
||||||
properties = {
|
rule = { class = "Steam", name = "Chat" },
|
||||||
tag = tags[rule_screen][3],
|
properties = {
|
||||||
},
|
tag = "3"
|
||||||
callback = awful.client.setslave
|
},
|
||||||
},
|
callback = awful.client.setslave
|
||||||
{
|
},
|
||||||
rule = { class = "Steam", name = "Steam" },
|
{
|
||||||
properties = {
|
rule = { class = "Steam", name = "Steam" },
|
||||||
tag = tags[rule_screen][11],
|
properties = {
|
||||||
}
|
tag = "F1"
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
rule = { class = "Telegram" },
|
{
|
||||||
properties = {
|
rule = { class = "Telegram" },
|
||||||
tag = tags[rule_screen][3],
|
properties = {
|
||||||
},
|
tag = "3"
|
||||||
callback = awful.client.setslave
|
},
|
||||||
},
|
callback = awful.client.setslave
|
||||||
{
|
},
|
||||||
rule_any = { role ={ "conversation" }, instance = { "Weechat" } },
|
{
|
||||||
callback = awful.client.setslave
|
rule_any = { role ={ "conversation" }, instance = { "Weechat" } },
|
||||||
},
|
callback = awful.client.setslave
|
||||||
{
|
},
|
||||||
rule = { class = "Irssi"},
|
{
|
||||||
properties = {
|
rule = { class = "Irssi"},
|
||||||
tag = tags[rule_screen][3]
|
properties = {
|
||||||
} ,
|
tag = "3"
|
||||||
callback = awful.client.setslave
|
} ,
|
||||||
},
|
callback = awful.client.setslave
|
||||||
{
|
},
|
||||||
rule = { class = "Claws-mail" },
|
{
|
||||||
properties = {
|
rule = { instance = "Gmutt" },
|
||||||
tag = tags[rule_screen][4]
|
properties = {
|
||||||
}
|
tag = "4"
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
rule = { instance = "Gmutt" },
|
{
|
||||||
properties = {
|
rule = { class = "Gmpc" },
|
||||||
tag = tags[rule_screen][4]
|
properties = {
|
||||||
}
|
tag = "6"
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
rule = { instance = "Gcanto" },
|
{
|
||||||
properties = {
|
rule = { class = "Pdfpc" },
|
||||||
tag = tags[rule_screen][5]
|
properties = {
|
||||||
}
|
size_hints_honor = true,
|
||||||
},
|
float = true,
|
||||||
{
|
fullscreen = true
|
||||||
rule = { instance = "Gncmpcpp" },
|
}
|
||||||
properties = {
|
},
|
||||||
tag = tags[rule_screen][6]
|
{
|
||||||
}
|
rule = { class = "Dmenu" },
|
||||||
},
|
properties = {
|
||||||
{
|
opacity = 0.8
|
||||||
rule = { class = "Gmpc" },
|
}
|
||||||
properties = {
|
},
|
||||||
tag = tags[rule_screen][6]
|
{
|
||||||
}
|
rule = { class = "URxvt" },
|
||||||
},
|
properties = {
|
||||||
{
|
opacity = 0.8
|
||||||
rule = { class = "Deluge" },
|
}
|
||||||
properties = {
|
},
|
||||||
tag = tags[rule_screen][7]
|
{
|
||||||
}
|
rule = { class = "Gvim" },
|
||||||
},
|
properties = {
|
||||||
{
|
opacity = 0.8
|
||||||
rule = { class = "Pdfpc" },
|
}
|
||||||
properties = {
|
},
|
||||||
size_hints_honor = true,
|
{
|
||||||
float = true,
|
rule = { instance = "Awesomelog" },
|
||||||
fullscreen = true
|
properties = {
|
||||||
}
|
tag = "F4"
|
||||||
},
|
}
|
||||||
{
|
}
|
||||||
rule = { class = "Cellwriter" },
|
}
|
||||||
properties = {
|
|
||||||
tag = tags[rule_screen][1],
|
|
||||||
ontop = true,
|
|
||||||
size_hints_honor = true,
|
|
||||||
float = true,
|
|
||||||
sticky = true,
|
|
||||||
fullscreen = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule = { class = "Xhtop" },
|
|
||||||
properties = {
|
|
||||||
tag = tags[rule_screen][22]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule = { class = "Dmenu" },
|
|
||||||
properties = {
|
|
||||||
opacity = 0.8
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule = { class = "URxvt" },
|
|
||||||
properties = {
|
|
||||||
opacity = 0.8
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule = { class = "Gvim" },
|
|
||||||
properties = {
|
|
||||||
opacity = 0.8
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule = { class = "feh", name = "timetable" },
|
|
||||||
properties = {
|
|
||||||
tag = tags[rule_screen][13],
|
|
||||||
skip_taskbar = true,
|
|
||||||
type = desktop,
|
|
||||||
focusable = false,
|
|
||||||
border_width = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule = { instance = "Awesomelog" },
|
|
||||||
properties = {
|
|
||||||
tag = tags[rule_screen][14]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule = { class = "GLSlideshow" },
|
|
||||||
properties = {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
rules.setup = setup
|
|
||||||
|
|
||||||
rules.mt.__call = setup
|
|
||||||
|
|
||||||
return setmetatable(rules, rules.mt)
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
local modalbind = {}
|
local modalbind = {}
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
local inited = false
|
local inited = false
|
||||||
local modewidget = {}
|
local modewidget = {}
|
||||||
local modewibox = { screen = -1 }
|
local modewibox = { screen = nil }
|
||||||
local nesting = 0
|
local nesting = 0
|
||||||
|
|
||||||
--local functions
|
--local functions
|
||||||
|
@ -22,17 +24,168 @@ for key, value in pairs(defaults) do
|
||||||
settings[key] = value
|
settings[key] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local aliases = {}
|
||||||
|
aliases[" "] = "Space"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function getXOffset(s, position)
|
||||||
|
local offset = 0
|
||||||
|
if type(position) == "table" then
|
||||||
|
offset = position.x + s.geometry.x
|
||||||
|
elseif position == "topleft" or position == "bottomleft" then
|
||||||
|
offset = s.geometry.x
|
||||||
|
elseif position == "topright" or position == "bottomright" then
|
||||||
|
offset = s.geometry.x + s.geometry.width - modewibox[s].width
|
||||||
|
end
|
||||||
|
return offset + settings.x_offset
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function getYOffset(s,position)
|
||||||
|
local offset = 0
|
||||||
|
if type(position) == "table" then
|
||||||
|
offset = position.y + s.geometry.y
|
||||||
|
elseif position == "topleft" or position == "topright" then
|
||||||
|
offset = s.geometry.y
|
||||||
|
elseif position == "bottomleft" or position == "bottomright" then
|
||||||
|
offset = s.geometry.y + s.geometry.height - modewibox[s].height
|
||||||
|
end
|
||||||
|
return offset + settings.y_offset
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_default(s, position)
|
||||||
|
local minwidth, minheight = modewidget[s]:fit({dpi=96}, s.geometry.width,
|
||||||
|
s.geometry.height)
|
||||||
|
modewibox[s].width = minwidth + 1;
|
||||||
|
modewibox[s].height = math.max(settings.height, minheight)
|
||||||
|
|
||||||
|
-- modewibox[s].width = 250
|
||||||
|
-- modewibox[s].height = 550
|
||||||
|
|
||||||
|
local pos = position or "bottomleft"
|
||||||
|
modewibox[s].x = getXOffset(s, pos)
|
||||||
|
modewibox[s].y = getYOffset(s, pos)
|
||||||
|
end
|
||||||
|
|
||||||
local function update_settings()
|
local function update_settings()
|
||||||
for s, value in ipairs(modewibox) do
|
for s, value in pairs(modewibox) do
|
||||||
value.border_width = settings.border_width
|
value.border_width = settings.border_width
|
||||||
set_default(s)
|
set_default(s)
|
||||||
value.opacity = settings.opacity
|
value.opacity = settings.opacity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local aliases = {}
|
|
||||||
aliases[" "] = "Space"
|
|
||||||
|
|
||||||
|
local function ensure_init()
|
||||||
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
|
modewidget[s] = wibox.widget.textbox()
|
||||||
|
modewidget[s]:set_align("left")
|
||||||
|
if beautiful.fontface then
|
||||||
|
modewidget[s]:set_font(beautiful.fontface .. " " .. (beautiful.fontsize + 4))
|
||||||
|
end
|
||||||
|
|
||||||
|
modewibox[s] = wibox({
|
||||||
|
fg = beautiful.fg_normal,
|
||||||
|
bg = beautiful.bg_normal,
|
||||||
|
border_width = settings.border_width,
|
||||||
|
border_color = beautiful.bg_focus,
|
||||||
|
screen = s
|
||||||
|
})
|
||||||
|
|
||||||
|
local modelayout = {}
|
||||||
|
modelayout[s] = wibox.layout.fixed.horizontal()
|
||||||
|
modelayout[s]:add(modewidget[s])
|
||||||
|
modewibox[s]:set_widget(modelayout[s]);
|
||||||
|
set_default(s)
|
||||||
|
modewibox[s].visible = false
|
||||||
|
modewibox[s].ontop = true
|
||||||
|
|
||||||
|
-- Widgets for prompt wibox
|
||||||
|
modewibox[s].widgets = {
|
||||||
|
modewidget[s],
|
||||||
|
layout = wibox.layout.fixed.horizontal
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function show_box(s, map, name)
|
||||||
|
modewibox.screen = s
|
||||||
|
local label = "<b>" .. name .. "</b>"
|
||||||
|
if settings.show_options then
|
||||||
|
for key, mapping in pairs(map) do
|
||||||
|
if key ~= "onClose" then
|
||||||
|
label = label .. "\n<b>" .. key .. "</b>"
|
||||||
|
if type(mapping) == "table" then
|
||||||
|
label = label .. "\t" .. (mapping.desc or "???")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
modewidget[s]:set_markup(label)
|
||||||
|
modewibox[s].visible = true
|
||||||
|
set_default(s)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function hide_box()
|
||||||
|
local s = modewibox.screen
|
||||||
|
if s ~= nil then modewibox[s].visible = false end
|
||||||
|
end
|
||||||
|
|
||||||
|
function grab(keymap, name, stay_in_mode)
|
||||||
|
if name then
|
||||||
|
show_box(mouse.screen, keymap, name)
|
||||||
|
nesting = nesting + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
keygrabber.run(function(mod, key, event)
|
||||||
|
if key == "Escape" then
|
||||||
|
if keymap["onClose"] then
|
||||||
|
keymap["onClose"]()
|
||||||
|
end
|
||||||
|
keygrabber.stop()
|
||||||
|
nesting = 0
|
||||||
|
hide_box();
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
if event == "release" then return true end
|
||||||
|
|
||||||
|
if aliases[key] then
|
||||||
|
key = aliases[key]
|
||||||
|
end
|
||||||
|
|
||||||
|
if keymap[key] then
|
||||||
|
keygrabber.stop()
|
||||||
|
if type(keymap[key]) == "table" then
|
||||||
|
keymap[key].func()
|
||||||
|
else
|
||||||
|
keymap[key]()
|
||||||
|
end
|
||||||
|
if stay_in_mode then
|
||||||
|
grab(keymap, name, true)
|
||||||
|
else
|
||||||
|
nesting = nesting - 1
|
||||||
|
if nesting < 1 then hide_box() end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print("Unmapped key: \"" .. key .. "\"")
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
modalbind.grab = grab
|
||||||
|
|
||||||
|
function grabf(keymap, name, stay_in_mode)
|
||||||
|
return function() grab(keymap, name, stay_in_mode) end
|
||||||
|
end
|
||||||
|
modalbind.grabf = grabf
|
||||||
|
|
||||||
|
function modebox() return modewibox[mouse.screen] end
|
||||||
|
modalbind.modebox = modebox
|
||||||
|
|
||||||
--- Change the opacity of the modebox.
|
--- Change the opacity of the modebox.
|
||||||
-- @param amount opacity between 0.0 and 1.0, or nil to use default
|
-- @param amount opacity between 0.0 and 1.0, or nil to use default
|
||||||
|
@ -100,155 +253,5 @@ function set_show_options(bool)
|
||||||
end
|
end
|
||||||
modalbind.set_show_options = set_show_options
|
modalbind.set_show_options = set_show_options
|
||||||
|
|
||||||
|
ensure_init()
|
||||||
local function getXOffset(s, position)
|
|
||||||
local offset = 0
|
|
||||||
if type(position) == "table" then
|
|
||||||
offset = position.x + screen[s].geometry.x
|
|
||||||
elseif position == "topleft" or position == "bottomleft" then
|
|
||||||
offset = screen[s].geometry.x
|
|
||||||
elseif position == "topright" or position == "bottomright" then
|
|
||||||
offset = screen[s].geometry.x + screen[s].geometry.width - modewibox[s].width
|
|
||||||
end
|
|
||||||
return offset + settings.x_offset
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local function getYOffset(s,position)
|
|
||||||
local offset = 0
|
|
||||||
if type(position) == "table" then
|
|
||||||
offset = position.y + screen[s].geometry.y
|
|
||||||
elseif position == "topleft" or position == "topright" then
|
|
||||||
offset = screen[s].geometry.y
|
|
||||||
elseif position == "bottomleft" or position == "bottomright" then
|
|
||||||
offset = screen[s].geometry.y + screen[s].geometry.height - modewibox[s].height
|
|
||||||
end
|
|
||||||
return offset + settings.y_offset
|
|
||||||
end
|
|
||||||
|
|
||||||
local function set_default(s, position)
|
|
||||||
local minwidth, minheight = modewidget[s]:fit(screen[s].geometry.width,
|
|
||||||
screen[s].geometry.height)
|
|
||||||
modewibox[s].width = minwidth + 1;
|
|
||||||
modewibox[s].height = math.max(settings.height, minheight)
|
|
||||||
|
|
||||||
local pos = position or "bottomleft"
|
|
||||||
modewibox[s].x = getXOffset(s, pos)
|
|
||||||
modewibox[s].y = getYOffset(s, pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function ensure_init()
|
|
||||||
if inited then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
inited = true
|
|
||||||
for s = 1, screen.count() do
|
|
||||||
modewidget[s] = wibox.widget.textbox()
|
|
||||||
modewidget[s]:set_align("left")
|
|
||||||
if beautiful.fontface then
|
|
||||||
modewidget[s]:set_font(beautiful.fontface .. " " .. (beautiful.fontsize + 4))
|
|
||||||
end
|
|
||||||
|
|
||||||
modewibox[s] = wibox({
|
|
||||||
fg = beautiful.fg_normal,
|
|
||||||
bg = beautiful.bg_normal,
|
|
||||||
border_width = settings.border_width,
|
|
||||||
border_color = beautiful.bg_focus,
|
|
||||||
screen = s
|
|
||||||
})
|
|
||||||
|
|
||||||
local modelayout = {}
|
|
||||||
modelayout[s] = wibox.layout.fixed.horizontal()
|
|
||||||
modelayout[s]:add(modewidget[s])
|
|
||||||
modewibox[s]:set_widget(modelayout[s]);
|
|
||||||
set_default(s)
|
|
||||||
modewibox[s].visible = false
|
|
||||||
modewibox[s].ontop = true
|
|
||||||
|
|
||||||
-- Widgets for prompt wibox
|
|
||||||
modewibox[s].widgets = {
|
|
||||||
modewidget[s],
|
|
||||||
layout = wibox.layout.fixed.horizontal
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function show_box(s, map, name)
|
|
||||||
ensure_init()
|
|
||||||
modewibox.screen = s
|
|
||||||
local label = "<b>" .. name .. "</b>"
|
|
||||||
if settings.show_options then
|
|
||||||
for key, mapping in pairs(map) do
|
|
||||||
if key ~= "onClose" then
|
|
||||||
label = label .. "\n<b>" .. key .. "</b>"
|
|
||||||
if type(mapping) == "table" then
|
|
||||||
label = label .. "\t" .. (mapping.desc or "???")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
modewidget[s]:set_markup(label)
|
|
||||||
modewibox[s].visible = true
|
|
||||||
set_default(s)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function hide_box()
|
|
||||||
local s = modewibox.screen
|
|
||||||
if s ~= -1 then modewibox[s].visible = false end
|
|
||||||
end
|
|
||||||
|
|
||||||
function grab(keymap, name, stay_in_mode)
|
|
||||||
if name then
|
|
||||||
show_box(mouse.screen, keymap, name)
|
|
||||||
nesting = nesting + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
keygrabber.run(function(mod, key, event)
|
|
||||||
if key == "Escape" then
|
|
||||||
if keymap["onClose"] then
|
|
||||||
keymap["onClose"]()
|
|
||||||
end
|
|
||||||
keygrabber.stop()
|
|
||||||
nesting = 0
|
|
||||||
hide_box();
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
if event == "release" then return true end
|
|
||||||
|
|
||||||
if aliases[key] then
|
|
||||||
key = aliases[key]
|
|
||||||
end
|
|
||||||
|
|
||||||
if keymap[key] then
|
|
||||||
keygrabber.stop()
|
|
||||||
if type(keymap[key]) == "table" then
|
|
||||||
keymap[key].func()
|
|
||||||
else
|
|
||||||
keymap[key]()
|
|
||||||
end
|
|
||||||
if stay_in_mode then
|
|
||||||
grab(keymap, name, true)
|
|
||||||
else
|
|
||||||
nesting = nesting - 1
|
|
||||||
if nesting < 1 then hide_box() end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print("Unmapped key: \"" .. key .. "\"")
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
modalbind.grab = grab
|
|
||||||
|
|
||||||
function grabf(keymap, name, stay_in_mode)
|
|
||||||
return function() grab(keymap, name, stay_in_mode) end
|
|
||||||
end
|
|
||||||
modalbind.grabf = grabf
|
|
||||||
|
|
||||||
function modebox() return modewibox[mouse.screen] end
|
|
||||||
modalbind.modebox = modebox
|
|
||||||
|
|
||||||
return modalbind
|
return modalbind
|
||||||
|
|
89
signals.lua
89
signals.lua
|
@ -1,69 +1,38 @@
|
||||||
local awful = awful
|
local awful = require("awful")
|
||||||
local beautiful = beautiful
|
local beautiful = beautiful
|
||||||
|
|
||||||
client.connect_signal("manage", function (c, startup)
|
|
||||||
-- Enable sloppy focus
|
|
||||||
c:connect_signal("mouse::enter", function(c)
|
|
||||||
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
|
||||||
and awful.client.focus.filter(c)
|
|
||||||
and not(
|
|
||||||
client.focus ~= nil
|
|
||||||
and client.focus.class == "jetbrains-idea"
|
|
||||||
and c.class == "jetbrains-idea"
|
|
||||||
and client.focus.type == "dialog"
|
|
||||||
) then
|
|
||||||
client.focus = c
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not startup then
|
client.connect_signal("manage", function (c)
|
||||||
-- Set the windows at the slave,
|
--c:connect_signal("mouse::enter", function(c)
|
||||||
-- i.e. put it at the end of others instead of setting it master.
|
-- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||||
awful.client.setslave(c)
|
-- and awful.client.focus.filter(c)
|
||||||
|
-- and not(
|
||||||
|
-- client.focus ~= nil
|
||||||
|
-- and client.focus.class == "jetbrains-idea"
|
||||||
|
-- and c.class == "jetbrains-idea"
|
||||||
|
-- and client.focus.type == "dialog"
|
||||||
|
-- ) then
|
||||||
|
-- client.focus = c
|
||||||
|
-- end
|
||||||
|
--end)
|
||||||
|
|
||||||
-- Put windows in a smart way, only if they does not set an initial position.
|
-- Set the windows at the slave,
|
||||||
if not c.size_hints.user_position and not c.size_hints.program_position then
|
-- i.e. put it at the end of others instead of setting it master.
|
||||||
awful.placement.no_overlap(c)
|
-- if not awesome.startup then awful.client.setslave(c) end
|
||||||
awful.placement.no_offscreen(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
|
||||||
|
end)
|
||||||
|
|
||||||
local titlebars_enabled = false
|
-- Enable sloppy focus, so that focus follows mouse.
|
||||||
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
|
client.connect_signal("mouse::enter", function(c)
|
||||||
-- Widgets that are aligned to the left
|
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||||
local left_layout = wibox.layout.fixed.horizontal()
|
and awful.client.focus.filter(c) then
|
||||||
left_layout:add(awful.titlebar.widget.iconwidget(c))
|
client.focus = c
|
||||||
|
|
||||||
-- Widgets that are aligned to the right
|
|
||||||
local right_layout = wibox.layout.fixed.horizontal()
|
|
||||||
right_layout:add(awful.titlebar.widget.floatingbutton(c))
|
|
||||||
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
|
|
||||||
right_layout:add(awful.titlebar.widget.stickybutton(c))
|
|
||||||
right_layout:add(awful.titlebar.widget.ontopbutton(c))
|
|
||||||
right_layout:add(awful.titlebar.widget.closebutton(c))
|
|
||||||
|
|
||||||
-- The title goes in the middle
|
|
||||||
local title = awful.titlebar.widget.titlewidget(c)
|
|
||||||
title:buttons(awful.util.table.join(
|
|
||||||
awful.button({ }, 1, function()
|
|
||||||
client.focus = c
|
|
||||||
c:raise()
|
|
||||||
awful.mouse.client.move(c)
|
|
||||||
end),
|
|
||||||
awful.button({ }, 3, function()
|
|
||||||
client.focus = c
|
|
||||||
c:raise()
|
|
||||||
awful.mouse.client.resize(c)
|
|
||||||
end)
|
|
||||||
))
|
|
||||||
|
|
||||||
-- Now bring it all together
|
|
||||||
local layout = wibox.layout.align.horizontal()
|
|
||||||
layout:set_left(left_layout)
|
|
||||||
layout:set_right(right_layout)
|
|
||||||
layout:set_middle(title)
|
|
||||||
|
|
||||||
awful.titlebar(c):set_widget(layout)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
150
tags.lua
150
tags.lua
|
@ -3,103 +3,105 @@ local awful = require("awful")
|
||||||
local conf = conf
|
local conf = conf
|
||||||
local modkey = conf.modkey or "Mod4"
|
local modkey = conf.modkey or "Mod4"
|
||||||
|
|
||||||
local tags={ mt={} }
|
local tags={}
|
||||||
|
|
||||||
|
awful.layout.layouts = {
|
||||||
|
awful.layout.suit.fair,
|
||||||
|
awful.layout.suit.fair.horizontal,
|
||||||
|
awful.layout.suit.tile,
|
||||||
|
awful.layout.suit.tile.bottom,
|
||||||
|
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)
|
local function getfunc_viewonly(i)
|
||||||
return function ()
|
return function ()
|
||||||
local screen = mouse.screen
|
local screen = awful.screen.focused()
|
||||||
if tags[screen][i] then
|
local tag = screen.tags[i]
|
||||||
awful.tag.viewonly(tags[screen][i])
|
if tag then
|
||||||
|
tag:view_only()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getfunc_viewtoggle(i)
|
local function getfunc_viewtoggle(i)
|
||||||
return function ()
|
return function ()
|
||||||
local screen = mouse.screen
|
local screen = awful.screen.focused()
|
||||||
if tags[screen][i] then
|
local tag = screen.tags[i]
|
||||||
awful.tag.viewtoggle(tags[screen][i])
|
if tag then
|
||||||
|
awful.tag.viewtoggle(tag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getfunc_moveto(i)
|
local function getfunc_moveto(i)
|
||||||
return function ()
|
return function ()
|
||||||
if client.focus and tags[client.focus.screen][i] then
|
if client.focus then
|
||||||
awful.client.movetotag(tags[client.focus.screen][i])
|
local tag = client.focus.screen.tags[i]
|
||||||
|
if tag then
|
||||||
|
client.focus:move_to_tag(tag)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getfunc_clienttoggle(i)
|
local function getfunc_clienttoggle(i)
|
||||||
return function ()
|
return function ()
|
||||||
if client.focus and tags[client.focus.screen][i] then
|
if client.focus then
|
||||||
awful.client.toggletag(tags[client.focus.screen][i])
|
local tag = client.focus.screen.tags[i]
|
||||||
|
if tag then
|
||||||
|
client.focus:toggle_tag(tag)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local defaultsetup = {
|
local tagdef = {
|
||||||
{"1:⚙"},
|
{"1"},
|
||||||
{ name = "2:⌘", layout = awful.layout.suit.max },
|
{"2", { layout = awful.layout.suit.max }},
|
||||||
{ name = "3:☻", layout = awful.layout.suit.tile, mwfact = 0.20, ncol = 2, nmaster = 2},
|
{"3", {
|
||||||
{ name = "4:✉", layout = awful.layout.suit.max },
|
layout = awful.layout.suit.tile,
|
||||||
{"5:☑"},
|
master_width_factor = 0.20,
|
||||||
{"6:♫"},
|
column_count = 2,
|
||||||
{"7:☣"},
|
master_count = 2
|
||||||
{"8:☕"},
|
}},
|
||||||
{"9:⚂"},
|
{"4", { layout = awful.layout.suit.max }},
|
||||||
{"0:☠"},
|
{"5"},
|
||||||
{ name = "F1:☭", layout = awful.layout.suit.max },
|
{"6"},
|
||||||
{"F2:♚"},
|
{"7"},
|
||||||
{"F3:♛"},
|
{"8"},
|
||||||
{"F4:♜"}--,
|
{"9"},
|
||||||
-- {"F5:♝"},
|
{"0"},
|
||||||
-- {"F6:♞"},
|
{"F1", { layout = awful.layout.suit.max }},
|
||||||
-- {"F7:♟"},
|
{"F2"},
|
||||||
-- {"F8:⚖"},
|
{"F3"},
|
||||||
-- {"F9:⚛"},
|
{"F4", { layout = awful.layout.suit.max }},
|
||||||
-- {"F10:⚡"},
|
|
||||||
-- {"F11:⚰"},
|
|
||||||
-- {"F12:⚙"}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local list = {}
|
function tags.setup()
|
||||||
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
function tags.setup(setuptable)
|
for _,t in ipairs(tagdef) do
|
||||||
local setup = setuptable or defaultsetup
|
awful.tag.add(t[1], awful.util.table.join(
|
||||||
for s = 1, screen.count() do
|
{screen = s},
|
||||||
list[s] = {}
|
t[2] or { layout = awful.layout.layouts[1] }
|
||||||
for i, t in ipairs(setup) do
|
))
|
||||||
local layout = t.layout or conf.default_layout or awful.layout.suit.fair
|
|
||||||
local name = t.name or t[1]
|
|
||||||
list[s][i] = awful.tag.new({name}, s, layout)[1];
|
|
||||||
list[s][i].selected = false
|
|
||||||
if(t.mwfact) then
|
|
||||||
awful.tag.setmwfact(t.mwfact,list[s][i])
|
|
||||||
end
|
|
||||||
if(t.ncol) then
|
|
||||||
awful.tag.setncol(t.ncol,list[s][i])
|
|
||||||
end
|
|
||||||
if(t.nmaster) then
|
|
||||||
awful.tag.setnmaster(t.nmaster,list[s][i])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
list[s][1].selected = true
|
s.tags[1]:view_only()
|
||||||
end
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tags.create_bindings()
|
function tags.create_bindings()
|
||||||
-- Compute the maximum number of digit we need, limited to 22
|
|
||||||
keynumber = 0
|
|
||||||
for s = 1, screen.count() do
|
|
||||||
keynumber = math.min(22, math.max(#(list[s]), keynumber));
|
|
||||||
end
|
|
||||||
|
|
||||||
local tagkeys = {}
|
local tagkeys = {}
|
||||||
|
|
||||||
-- Bind all key numbers to tags, using keycodes
|
-- Bind all number keys and F-keys to tags
|
||||||
for i = 1, keynumber do
|
for i = 1, 21 do
|
||||||
if i < 10 then
|
if i < 10 then
|
||||||
k = "#" .. i + 9 -- number keys 1-9
|
k = "#" .. i + 9 -- number keys 1-9
|
||||||
elseif i == 10 then
|
elseif i == 10 then
|
||||||
|
@ -108,23 +110,21 @@ function tags.create_bindings()
|
||||||
k = "F" .. i - 10 -- F keys
|
k = "F" .. i - 10 -- F keys
|
||||||
end
|
end
|
||||||
tagkeys = awful.util.table.join(tagkeys,
|
tagkeys = awful.util.table.join(tagkeys,
|
||||||
awful.key( { modkey }, k, getfunc_viewonly(i)),
|
awful.key( { modkey }, k, getfunc_viewonly(i)),
|
||||||
awful.key( { modkey, "Control" }, k, getfunc_viewtoggle(i)),
|
awful.key( { modkey, "Control" }, k, getfunc_viewtoggle(i)),
|
||||||
awful.key( { modkey, "Shift" }, k, getfunc_moveto(i)),
|
awful.key( { modkey, "Shift" }, k, getfunc_moveto(i)),
|
||||||
awful.key( { modkey, "Control", "Shift" }, k, getfunc_clienttoggle(i))
|
awful.key( { modkey, "Control", "Shift" }, k, getfunc_clienttoggle(i))
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- keys for all tags
|
-- keys for all tags
|
||||||
tagkeys = awful.util.table.join(tagkeys,
|
tagkeys = awful.util.table.join(tagkeys,
|
||||||
awful.key({ modkey }, "u", awful.client.urgent.jumpto),
|
awful.key({ modkey }, "u", awful.client.urgent.jumpto),
|
||||||
awful.key({ modkey }, "Left", awful.tag.viewprev ),
|
awful.key({ modkey }, "Left", awful.tag.viewprev ),
|
||||||
awful.key({ modkey }, "Right", awful.tag.viewnext ),
|
awful.key({ modkey }, "Right", awful.tag.viewnext ),
|
||||||
awful.key({ modkey }, "Escape", awful.tag.history.restore)
|
awful.key({ modkey }, "Escape", awful.tag.history.restore)
|
||||||
)
|
)
|
||||||
return tagkeys;
|
return tagkeys;
|
||||||
end
|
end
|
||||||
|
|
||||||
tags.mt.__index = list
|
return tags
|
||||||
tags.mt.__newindex = list
|
|
||||||
return setmetatable(tags, tags.mt)
|
|
||||||
|
|
10
theme.lua
10
theme.lua
|
@ -1,6 +1,7 @@
|
||||||
-- {{{ Main
|
-- {{{ Main
|
||||||
theme = {}
|
theme = {}
|
||||||
theme.wallpaper = "~/.wallpaper"
|
theme.wallpaper = "~/.wallpaper"
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
-- {{{ Styles
|
-- {{{ Styles
|
||||||
theme.fontface = "Dina"
|
theme.fontface = "Dina"
|
||||||
|
@ -17,10 +18,11 @@ theme.bg_urgent = "#DA4E4E"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Borders
|
-- {{{ Borders
|
||||||
theme.border_width = "2"
|
theme.useless_gap = 0
|
||||||
theme.border_normal = "#3F3F3F"
|
theme.border_width = 2
|
||||||
theme.border_focus = "#AAAAFF"
|
theme.border_normal = "#3f3f3f"
|
||||||
theme.border_marked = "#CC9393"
|
theme.border_focus = "#aaaaff"
|
||||||
|
theme.border_marked = "#cc9393"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Titlebars
|
-- {{{ Titlebars
|
||||||
|
|
141
widgets.lua
141
widgets.lua
|
@ -3,6 +3,7 @@ local vicious = require("vicious")
|
||||||
local modkey = conf.modkey or "Mod4"
|
local modkey = conf.modkey or "Mod4"
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local tag = require("awful.tag")
|
local tag = require("awful.tag")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
local widgets = { add = {} }
|
local widgets = { add = {} }
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -10,8 +11,8 @@ local widgets = { add = {} }
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local wlist = {}
|
local wlist = {}
|
||||||
local bars = {}
|
local bars = {}
|
||||||
local leftwibox = {}
|
local leftwibar = {}
|
||||||
local rightwibox = {}
|
local rightwibar = {}
|
||||||
|
|
||||||
local mytaglist = {}
|
local mytaglist = {}
|
||||||
mytaglist.buttons = awful.util.table.join(
|
mytaglist.buttons = awful.util.table.join(
|
||||||
|
@ -28,64 +29,64 @@ awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- setup {{{
|
-- setup {{{
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function setup() -- {{{
|
local function setup()
|
||||||
for s = 1, screen.count() do
|
for s = 1, screen.count() do
|
||||||
wlist[s]={}
|
wlist[s]={}
|
||||||
bars[s]={}
|
bars[s]={}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Create the wibox
|
-- Create the wibar
|
||||||
leftwibox[s] = awful.wibox({
|
leftwibar[s] = awful.wibar({
|
||||||
position = "left",
|
position = "left",
|
||||||
screen = s,
|
screen = s,
|
||||||
width = 18
|
width = 18
|
||||||
})
|
})
|
||||||
rightwibox[s] = awful.wibox({
|
rightwibar[s] = awful.wibar({
|
||||||
position = "right",
|
position = "right",
|
||||||
screen = s,
|
screen = s,
|
||||||
width = 18
|
width = 18
|
||||||
})
|
})
|
||||||
|
|
||||||
-- {{{ create layouts
|
-- {{{ create containers
|
||||||
local left_bottom_layout = wibox.layout.fixed.horizontal()
|
local left_bottom_container = wibox.layout.fixed.horizontal()
|
||||||
local left_top_layout = wibox.layout.fixed.horizontal()
|
local left_top_container = wibox.layout.fixed.horizontal()
|
||||||
|
|
||||||
local left_layout = wibox.layout.align.horizontal()
|
local left_container = wibox.layout.align.horizontal()
|
||||||
left_layout:set_left(left_bottom_layout)
|
left_container:set_left(left_bottom_container)
|
||||||
left_layout:set_right(left_top_layout)
|
left_container:set_right(left_top_container)
|
||||||
|
|
||||||
local right_bottom_layout = wibox.layout.fixed.horizontal()
|
local right_bottom_container = wibox.layout.fixed.horizontal()
|
||||||
local right_top_layout = wibox.layout.fixed.horizontal()
|
local right_top_container = wibox.layout.fixed.horizontal()
|
||||||
|
|
||||||
local right_layout = wibox.layout.align.horizontal()
|
local right_container = wibox.layout.align.horizontal()
|
||||||
right_layout:set_left(right_top_layout)
|
right_container:set_left(right_top_container)
|
||||||
right_layout:set_right(right_bottom_layout)
|
right_container:set_right(right_bottom_container)
|
||||||
--}}}
|
--}}}
|
||||||
|
|
||||||
|
|
||||||
-- {{{ rotate layouts and add to wibox
|
-- {{{ rotate containers and add to wibox
|
||||||
local leftrotate = wibox.layout.rotate()
|
local leftrotate = wibox.container.rotate()
|
||||||
leftrotate:set_direction('east')
|
leftrotate:set_direction('east')
|
||||||
leftrotate:set_widget(left_layout)
|
leftrotate:set_widget(left_container)
|
||||||
leftwibox[s]:set_widget(leftrotate)
|
leftwibar[s]:set_widget(leftrotate)
|
||||||
|
|
||||||
local rightrotate = wibox.layout.rotate()
|
local rightrotate = wibox.container.rotate()
|
||||||
rightrotate:set_direction('west')
|
rightrotate:set_direction('west')
|
||||||
rightrotate:set_widget(right_layout)
|
rightrotate:set_widget(right_container)
|
||||||
rightwibox[s]:set_widget(rightrotate)
|
rightwibar[s]:set_widget(rightrotate)
|
||||||
--}}}
|
--}}}
|
||||||
|
|
||||||
|
|
||||||
bars[s] = {}
|
bars[s] = {}
|
||||||
bars[s].left = {}
|
bars[s].left = {}
|
||||||
bars[s].left.bottom = left_bottom_layout
|
bars[s].left.bottom = left_bottom_container
|
||||||
bars[s].left.top = left_top_layout
|
bars[s].left.top = left_top_container
|
||||||
bars[s].right = {}
|
bars[s].right = {}
|
||||||
bars[s].right.bottom = right_bottom_layout
|
bars[s].right.bottom = right_bottom_container
|
||||||
bars[s].right.top = right_top_layout
|
bars[s].right.top = right_top_container
|
||||||
end
|
end
|
||||||
end -- }}}
|
end
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -95,7 +96,7 @@ end -- }}}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- force update of a widget
|
-- force update of a widget
|
||||||
local function update(widgetname, index) -- {{{
|
local function update(widgetname, index)
|
||||||
for s = 1, screen.count() do
|
for s = 1, screen.count() do
|
||||||
if wlist[s] ~= nil and wlist[s][widgetname] ~= nil then
|
if wlist[s] ~= nil and wlist[s][widgetname] ~= nil then
|
||||||
if index ~= nil then
|
if index ~= nil then
|
||||||
|
@ -109,13 +110,13 @@ end
|
||||||
--}}}
|
--}}}
|
||||||
widgets.update = update
|
widgets.update = update
|
||||||
|
|
||||||
-- get layout for adding widgets
|
-- get container for adding widgets
|
||||||
local function get_layout(screen, bar, align) --{{{
|
local function get_container(screen, bar, align)
|
||||||
if bars[screen][bar] == nil then return nil end
|
if bars[screen][bar] == nil then return nil end
|
||||||
|
|
||||||
return {screen = screen, layout = bars[screen][bar][align]}
|
return {screen = screen, container = bars[screen][bar][align]}
|
||||||
end --}}}
|
end
|
||||||
widgets.layout = get_layout
|
widgets.container = get_container
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -133,21 +134,21 @@ local hide = function(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function wrap_and_add(name, parent, widget, callback_widget)
|
local function wrap_and_add(name, parent, widget, callback_widget)
|
||||||
local container = wibox.layout.margin(widget)
|
local container = wibox.container.margin(widget)
|
||||||
container.widget = widget
|
container.widget = widget
|
||||||
container.show = show
|
container.show = show
|
||||||
container.hide = hide
|
container.hide = hide
|
||||||
|
|
||||||
wlist[parent.screen][name] = callback_widget == nil and widget or callback_widget
|
wlist[parent.screen][name] = callback_widget == nil and widget or callback_widget
|
||||||
parent.layout:add(container)
|
parent.container:add(container)
|
||||||
return container
|
return container
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- mail widget
|
-- mail widget
|
||||||
local function mailwidget(name, parent, mailboxes, notify_pos, title) --{{{
|
local function mailwidget(name, parent, mailboxes, notify_pos, title)
|
||||||
local widget = wibox.widget.textbox()
|
local widget = wibox.widget.textbox()
|
||||||
local bg = wibox.widget.background()
|
local bg = wibox.container.background()
|
||||||
bg:set_widget(widget)
|
bg:set_widget(widget)
|
||||||
|
|
||||||
local container = wrap_and_add(name, parent, bg, widget)
|
local container = wrap_and_add(name, parent, bg, widget)
|
||||||
|
@ -159,16 +160,16 @@ local function mailwidget(name, parent, mailboxes, notify_pos, title) --{{{
|
||||||
position = notify_pos or "top_left"
|
position = notify_pos or "top_left"
|
||||||
|
|
||||||
})
|
})
|
||||||
bg:set_bg(theme.bg_urgent)
|
bg:set_bg(beautiful.bg_urgent)
|
||||||
bg:set_fg(theme.fg_urgent)
|
bg:set_fg(beautiful.fg_urgent)
|
||||||
container:show()
|
container:show()
|
||||||
elseif args[2] > 0 then
|
elseif args[2] > 0 then
|
||||||
bg:set_bg(theme.bg_focus)
|
bg:set_bg(beautiful.bg_focus)
|
||||||
bg:set_fg(theme.fg_focus)
|
bg:set_fg(beautiful.fg_focus)
|
||||||
container:show()
|
container:show()
|
||||||
else
|
else
|
||||||
bg:set_bg(theme.bg_normal)
|
bg:set_bg(beautiful.bg_normal)
|
||||||
bg:set_fg(theme.fg_normal)
|
bg:set_fg(beautiful.fg_normal)
|
||||||
container:hide()
|
container:hide()
|
||||||
end
|
end
|
||||||
return "⬓⬓ Unread "..args[2].." / New "..args[1].. " "
|
return "⬓⬓ Unread "..args[2].." / New "..args[1].. " "
|
||||||
|
@ -180,21 +181,29 @@ end
|
||||||
widgets.add.mail = mailwidget
|
widgets.add.mail = mailwidget
|
||||||
|
|
||||||
-- text clock
|
-- text clock
|
||||||
local function clockwidget(name, parent) -- {{{
|
local function clockwidget(name, parent)
|
||||||
return wrap_and_add(name, parent, awful.widget.textclock())
|
return wrap_and_add(name, parent, wibox.widget.textclock())
|
||||||
end
|
end
|
||||||
--}}}
|
--}}}
|
||||||
widgets.add.clock = clockwidget
|
widgets.add.clock = clockwidget
|
||||||
|
|
||||||
-- layoutbox
|
-- containerbox
|
||||||
local function layoutwidget(parent) -- {{{
|
local function layoutwidget(parent)
|
||||||
return wrap_and_add("layout", parent, awful.widget.layoutbox(s))
|
local mylayoutbox = awful.widget.layoutbox(s)
|
||||||
|
|
||||||
|
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 wrap_and_add("layout", parent, mylayoutbox);
|
||||||
end
|
end
|
||||||
--}}}
|
--}}}
|
||||||
widgets.add.layout_indicator = layoutwidget
|
widgets.add.layout_indicator = layoutwidget
|
||||||
|
|
||||||
-- taglist
|
-- taglist
|
||||||
local function taglistwidget(name, parent) --{{{
|
local function taglistwidget(name, parent)
|
||||||
local filter_urgentonly = function(t, args)
|
local filter_urgentonly = function(t, args)
|
||||||
for k, c in pairs(t:clients()) do
|
for k, c in pairs(t:clients()) do
|
||||||
if c.urgent then return true end
|
if c.urgent then return true end
|
||||||
|
@ -203,25 +212,25 @@ local function taglistwidget(name, parent) --{{{
|
||||||
end
|
end
|
||||||
-- Create a taglist widget
|
-- Create a taglist widget
|
||||||
return wrap_and_add(name, parent,
|
return wrap_and_add(name, parent,
|
||||||
awful.widget.taglist(parent.screen, awful.widget.taglist.filter.noempty, mytaglist.buttons)
|
awful.widget.taglist(parent.screen, awful.widget.taglist.filter.noempty, mytaglist.buttons)
|
||||||
)
|
)
|
||||||
end --}}}
|
end --}}}
|
||||||
widgets.add.taglist = taglistwidget
|
widgets.add.taglist = taglistwidget
|
||||||
|
|
||||||
-- system tray
|
-- system tray
|
||||||
-- not using a name argument, because only one systray is allowed
|
-- not using a name argument, because only one systray is allowed
|
||||||
local function systraywidget(parent) --{{{
|
local function systraywidget(parent)
|
||||||
if (wlist["systray"] ~= nil) then
|
if (wlist["systray"] ~= nil) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
wlist["systray"] = wibox.widget.systray()
|
wlist["systray"] = wibox.widget.systray()
|
||||||
parent.layout:add(wlist["systray"])
|
parent.container:add(wlist["systray"])
|
||||||
return wlist["systray"]
|
return wlist["systray"]
|
||||||
end --}}}
|
end --}}}
|
||||||
widgets.add.systray = systraywidget
|
widgets.add.systray = systraywidget
|
||||||
|
|
||||||
-- cpu usage
|
-- cpu usage
|
||||||
local function cpuwidget(name, parent) --{{{
|
local function cpuwidget(name, parent)
|
||||||
local cpu = wrap_and_add(name, parent, wibox.widget.textbox())
|
local cpu = wrap_and_add(name, parent, wibox.widget.textbox())
|
||||||
vicious.register(wlist[parent.screen][name], vicious.widgets.cpu, "CPU: $1%")
|
vicious.register(wlist[parent.screen][name], vicious.widgets.cpu, "CPU: $1%")
|
||||||
return cpu
|
return cpu
|
||||||
|
@ -229,22 +238,22 @@ end --}}}
|
||||||
widgets.add.cpu = cpuwidget
|
widgets.add.cpu = cpuwidget
|
||||||
|
|
||||||
-- battery
|
-- battery
|
||||||
local function batterywidget(name, parent, batname) --{{{
|
local function batterywidget(name, parent, batname)
|
||||||
local widget = wibox.widget.textbox()
|
local widget = wibox.widget.textbox()
|
||||||
local bg = wibox.widget.background()
|
local bg = wibox.container.background()
|
||||||
bg:set_widget(widget)
|
bg:set_widget(widget)
|
||||||
vicious.register(widget, vicious.widgets.bat, function (widget, args)
|
vicious.register(widget, vicious.widgets.bat, function (widget, args)
|
||||||
if args[2] == 0 then return ""
|
if args[2] == 0 then return ""
|
||||||
else
|
else
|
||||||
if args[2] < 15 then
|
if args[2] < 15 then
|
||||||
bg:set_bg(theme.bg_urgent)
|
bg:set_bg(beautiful.bg_urgent)
|
||||||
bg:set_fg(theme.fg_urgent)
|
bg:set_fg(beautiful.fg_urgent)
|
||||||
else
|
else
|
||||||
bg:set_bg(theme.bg_normal)
|
bg:set_bg(beautiful.bg_normal)
|
||||||
bg:set_fg(theme.fg_normal)
|
bg:set_fg(beautiful.fg_normal)
|
||||||
end
|
end
|
||||||
return name .. ": " ..
|
return name .. ": " ..
|
||||||
args[1]..args[2].."% - "..args[3]
|
args[1]..args[2].."% - "..args[3]
|
||||||
end
|
end
|
||||||
end, 61, batname)
|
end, 61, batname)
|
||||||
widgets.update(name)
|
widgets.update(name)
|
||||||
|
@ -253,7 +262,7 @@ end --}}}
|
||||||
widgets.add.battery = batterywidget
|
widgets.add.battery = batterywidget
|
||||||
|
|
||||||
-- wireless status
|
-- wireless status
|
||||||
local function wifiwidget(name, parent, interface) --{{{
|
local function wifiwidget(name, parent, interface)
|
||||||
local wifi = wrap_and_add(name, parent, wibox.widget.textbox())
|
local wifi = wrap_and_add(name, parent, wibox.widget.textbox())
|
||||||
vicious.register(wlist[parent.screen][name], vicious.widgets.wifi,
|
vicious.register(wlist[parent.screen][name], vicious.widgets.wifi,
|
||||||
"WLAN ${ssid} @ ${sign}dBm, Q:${link}/70", 31, interface)
|
"WLAN ${ssid} @ ${sign}dBm, Q:${link}/70", 31, interface)
|
||||||
|
@ -272,13 +281,13 @@ local spacer = wibox.widget.textbox()
|
||||||
spacer:set_text(" ")
|
spacer:set_text(" ")
|
||||||
|
|
||||||
-- manual spacing between widgets
|
-- manual spacing between widgets
|
||||||
local function spacerwidget(parent) --{{{
|
local function spacerwidget(parent)
|
||||||
parent.layout:add(spacer)
|
parent.container:add(spacer)
|
||||||
end --}}}
|
end --}}}
|
||||||
widgets.add.spacer = spacerwidget
|
widgets.add.spacer = spacerwidget
|
||||||
|
|
||||||
-- change appearance of spacers
|
-- change appearance of spacers
|
||||||
local function spacertext(text) --{{{
|
local function spacertext(text)
|
||||||
spacer:set_text(text)
|
spacer:set_text(text)
|
||||||
end --}}}
|
end --}}}
|
||||||
widgets.set_spacer_text = spacertext
|
widgets.set_spacer_text = spacertext
|
||||||
|
|
Loading…
Reference in a new issue