1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2025-01-11 02:08:08 +00:00
awesome-copycats/rc.lua.steamburn

276 lines
7.2 KiB
Plaintext
Raw Normal View History

2013-09-13 19:20:22 +00:00
--[[
Steamburn Awesome WM config 3.0
github.com/copycat-killer
2013-09-13 19:20:22 +00:00
--]]
-- {{{ Required libraries
local gears = require("gears")
local awful = require("awful")
2013-03-27 13:25:02 +00:00
awful.rules = require("awful.rules")
2013-09-13 19:20:22 +00:00
require("awful.autofocus")
local wibox = require("wibox")
local beautiful = require("beautiful")
local naughty = require("naughty")
2013-09-13 19:20:22 +00:00
local lain = require("lain")
2013-08-04 21:39:49 +00:00
-- }}}
2013-03-27 13:25:02 +00:00
-- Error handling
require("myrc.errors")
2013-09-13 19:20:22 +00:00
-- STARTUP apps
require("settings.startup")
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
-- {{{ Variable definitions
-- beautiful init
2013-11-24 15:31:33 +00:00
beautiful.init(os.getenv("HOME") .. "/.config/awesome/themes/steamburn/theme.lua")
2013-03-27 13:25:02 +00:00
-- variables
require("settings.variables")
2013-09-13 19:20:22 +00:00
2014-01-09 13:33:33 +00:00
-- lain
lain.layout.termfair.nmaster = 3
lain.layout.termfair.ncol = 1
-- Tags and layouts
require("settings.tags")
2013-08-04 21:39:49 +00:00
-- }}}
2013-03-27 13:25:02 +00:00
2013-08-04 21:39:49 +00:00
-- {{{ Wallpaper
2014-05-12 02:54:41 +00:00
require("stock.wallpaper")
2013-08-04 21:39:49 +00:00
-- }}}
2013-09-13 19:20:22 +00:00
-- {{{ Menu
2013-08-04 21:39:49 +00:00
require("freedesktop/freedesktop")
-- }}}
2013-03-27 13:25:02 +00:00
2013-08-04 21:39:49 +00:00
-- {{{ Wibox
2013-09-13 19:20:22 +00:00
markup = lain.util.markup
gray = "#94928F"
-- Textclock
mytextclock = awful.widget.textclock(" %H:%M ")
-- Calendar
lain.widgets.calendar:attach(mytextclock)
2014-01-09 13:33:33 +00:00
-- Mail IMAP check
aimailwidget = lain.widgets.imap({
2013-09-13 19:20:22 +00:00
timeout = 180,
server = "server",
mail = "mail",
password = "keyring get mail",
settings = function()
mail = ""
count = ""
if mailcount > 0 then
2014-01-09 13:33:33 +00:00
mail = "Mail "
2013-09-13 19:20:22 +00:00
count = mailcount .. " "
end
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
widget:set_markup(markup(gray, mail) .. count)
end
})
-- MPD
mpdwidget = lain.widgets.mpd({
settings = function()
artist = mpd_now.artist .. " "
title = mpd_now.title .. " "
if mpd_now.state == "pause" then
artist = "mpd "
title = "paused "
elseif mpd_now.state == "stop" then
artist = ""
title = ""
end
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
widget:set_markup(markup(gray, artist) .. title)
end
})
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
-- CPU
cpuwidget = lain.widgets.sysload({
settings = function()
widget:set_markup(markup(gray, " Cpu ") .. load_1 .. " ")
end
})
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
-- MEM
memwidget = lain.widgets.mem({
settings = function()
widget:set_markup(markup(gray, " Mem ") .. mem_now.used .. " ")
2013-03-27 13:25:02 +00:00
end
2013-09-13 19:20:22 +00:00
})
2014-01-09 13:33:33 +00:00
-- /home fs
fshomeupd = lain.widgets.fs({
partition = "/home"
})
2013-09-13 19:20:22 +00:00
-- Battery
batwidget = lain.widgets.bat({
settings = function()
bat_perc = bat_now.perc
if bat_perc == "N/A" then bat_perc = "Plug" end
widget:set_markup(markup(gray, " Bat ") .. bat_perc .. " ")
end
2013-09-13 19:20:22 +00:00
})
-- Net checker
netwidget = lain.widgets.net({
settings = function()
if net_now.state == "up" then net_state = "On"
else net_state = "Off" end
widget:set_markup(markup(gray, " Net ") .. net_state .. " ")
2013-03-27 13:25:02 +00:00
end
2013-09-13 19:20:22 +00:00
})
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
-- ALSA volume
volumewidget = lain.widgets.alsa({
settings = function()
header = " Vol "
vlevel = volume_now.level
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
if volume_now.status == "off" then
vlevel = vlevel .. "M "
2013-03-27 13:25:02 +00:00
else
2013-09-13 19:20:22 +00:00
vlevel = vlevel .. " "
2013-03-27 13:25:02 +00:00
end
2013-09-13 19:20:22 +00:00
widget:set_markup(markup(gray, header) .. vlevel)
end
})
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
-- Weather
yawn = lain.widgets.yawn(123456)
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
-- Separators
first = wibox.widget.textbox(markup.font("Tamsyn 4", " "))
spr = wibox.widget.textbox(' ')
2013-03-27 13:25:02 +00:00
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
2013-09-13 19:20:22 +00:00
txtlayoutbox = {}
2014-05-11 23:58:00 +00:00
require("stock.taglist")
require("stock.tasklist")
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
-- Writes a string representation of the current layout in a textbox widget
function updatelayoutbox(layout, s)
local screen = s or 1
local txt_l = beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(screen))] or ""
layout:set_text(txt_l)
end
2013-09-13 19:20:22 +00:00
for s = 1, screen.count() do
2013-03-27 13:25:02 +00:00
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()
2013-09-13 19:20:22 +00:00
-- Create a textbox widget which will contains a short string representing the
-- layout we're using. We need one layoutbox per screen.
txtlayoutbox[s] = wibox.widget.textbox(beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
awful.tag.attached_connect_signal(s, "property::selected", function ()
updatelayoutbox(txtlayoutbox[s], s)
end)
awful.tag.attached_connect_signal(s, "property::layout", function ()
updatelayoutbox(txtlayoutbox[s], s)
end)
txtlayoutbox[s]:buttons(awful.util.table.join(
awful.button({}, 1, function() awful.layout.inc(layouts, 1) end),
awful.button({}, 3, function() awful.layout.inc(layouts, -1) end),
awful.button({}, 4, function() awful.layout.inc(layouts, 1) end),
awful.button({}, 5, function() awful.layout.inc(layouts, -1) end)))
2013-03-27 13:25:02 +00:00
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
2013-09-13 19:20:22 +00:00
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s, height = 18 })
2013-09-13 19:20:22 +00:00
-- Widgets that are aligned to the left
2013-03-27 13:25:02 +00:00
local left_layout = wibox.layout.fixed.horizontal()
2013-09-13 19:20:22 +00:00
left_layout:add(first)
2013-03-27 13:25:02 +00:00
left_layout:add(mytaglist[s])
2013-09-13 19:20:22 +00:00
left_layout:add(spr)
left_layout:add(txtlayoutbox[s])
left_layout:add(spr)
2013-03-27 13:25:02 +00:00
left_layout:add(mypromptbox[s])
2013-09-13 19:20:22 +00:00
-- Widgets that are aligned to the right
2013-03-27 13:25:02 +00:00
local right_layout = wibox.layout.fixed.horizontal()
if s == 1 then right_layout:add(wibox.widget.systray()) end
right_layout:add(spr)
right_layout:add(mpdwidget)
2013-09-13 19:20:22 +00:00
--right_layout:add(mailwidget)
right_layout:add(cpuwidget)
2013-03-27 13:25:02 +00:00
right_layout:add(memwidget)
right_layout:add(batwidget)
right_layout:add(netwidget)
right_layout:add(volumewidget)
right_layout:add(mytextclock)
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_middle(mytasklist[s])
layout:set_right(right_layout)
2013-03-27 13:25:02 +00:00
2013-09-13 19:20:22 +00:00
mywibox[s]:set_widget(layout)
2013-03-27 13:25:02 +00:00
end
2013-08-04 21:39:49 +00:00
-- }}}
-- Bindings
require("settings.binds")
2013-08-04 21:39:49 +00:00
-- {{{ Key bindings
globalkeys = awful.util.table.join(globalkeys,
2013-03-27 13:25:02 +00:00
-- Show/Hide Wibox
awful.key({ modkey }, "b", function ()
2013-09-13 19:20:22 +00:00
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
2013-03-27 13:25:02 +00:00
end),
2013-03-30 21:34:54 +00:00
-- Widgets popups
2013-09-13 19:20:22 +00:00
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
2014-01-09 13:33:33 +00:00
awful.key({ altkey, }, "h", function () fshomeupd.show(7) end),
2013-09-13 19:20:22 +00:00
awful.key({ altkey, }, "w", function () yawn.show(7) end),
-- ALSA volume control
awful.key({ altkey }, "Up",
function ()
awful.util.spawn("amixer -q set Master 1%+")
volumewidget.update()
end),
awful.key({ altkey }, "Down",
function ()
awful.util.spawn("amixer -q set Master 1%-")
volumewidget.update()
end),
awful.key({ altkey }, "m",
function ()
awful.util.spawn("amixer -q set Master playback toggle")
volumewidget.update()
end),
awful.key({ altkey, "Control" }, "m",
function ()
awful.util.spawn("amixer -q set Master playback 100%")
volumewidget.update()
2014-05-11 23:05:24 +00:00
end)
2013-03-27 13:25:02 +00:00
)
-- Set keys
root.keys(globalkeys)
2013-08-04 21:39:49 +00:00
-- }}}
2013-03-27 13:25:02 +00:00
-- Rules
require("settings.rules")
2013-03-27 13:25:02 +00:00
-- Signals
2014-05-11 23:17:50 +00:00
require("stock.signals")