This commit is contained in:
Johannes Findeisen 2015-12-03 02:09:44 +01:00
commit 265737228e

View file

@ -8,12 +8,11 @@ local beautiful = require("beautiful")
local naughty = require("naughty")
local menubar = require("menubar")
vicious = require("vicious")
local lain = require("lain")
-- require $HOME/.config/awesome/private.lua for including variables that are different on
-- my systems like private.thermal_zone or private.net_device; this makes sure that widgets
-- are displaying the right value... ;)
-- This file needs to exist. You need to explore this if You want to use my widget stuff!
-- This file needs to exist. You need to explore this if you want to use my widget stuff!
require("private")
-- Set programs to autostart. They will only runce once even when reloading awesome.
@ -27,17 +26,17 @@ local autostart = {
}
function file_exists(name)
local f=io.open(name,"r")
local f = io.open(name, "r")
if f~=nil then io.close(f) return true else return false end
end
function run_once(cmd)
findme = cmd
firstspace = cmd:find(" ")
if firstspace then
findme = cmd:sub(0, firstspace-1)
end
awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
findme = cmd
firstspace = cmd:find(" ")
if firstspace then
findme = cmd:sub(0, firstspace-1)
end
awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
end
if awesome.startup_errors then
@ -59,9 +58,9 @@ do
end)
end
beautiful.init(".config/awesome/themes/hanez/theme.lua")
beautiful.init(os.getenv("HOME").."/.config/awesome/themes/hanez/theme.lua")
-- To override the wallpaper provided by the them you can just add a file named
-- To override the wallpaper provided by the theme you can just add a file named
-- ~/images/background.png and then this file will be used as wallpaper. No need
-- to change the theme or this file for that... ;)
name = os.getenv("HOME").."/images/background.png"
@ -149,7 +148,6 @@ engineeringmenu = {
{ "qcad", "/usr/bin/qcad", "/usr/share/pixmaps/qcad_icon.png" },
{ "qucs", "/usr/bin/qucs", "/usr/share/icons/hicolor/48x48/apps/qucs.png" },
}
gamesmenu = {
{ "0 a.d.", "/usr/bin/0ad", "/usr/share/pixmaps/0ad.png" },
{ "gvbam", "/usr/bin/gvbam", "/usr/share/icons/hicolor/48x48/apps/vbam.png" },
@ -251,9 +249,8 @@ mymainmenu = awful.menu({ items = {
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
-- Initialize widgets
local batwidget = wibox.widget.textbox()
vicious.register(batwidget, vicious.widgets.bat, " $1$2% | ", 20, private.battery )
vicious.register(batwidget, vicious.widgets.bat, " $1$2% / ", 20, private.battery )
local netwidget = wibox.widget.textbox()
vicious.register(netwidget, vicious.widgets.net, '<span color="green">⇩${'..private.net_device..' down_kb}</span> / <span color="#C83321">${'..private.net_device..' up_kb}⇧</span> ', 1)
@ -267,18 +264,10 @@ cpuwidget:set_background_color("#222222")
cpuwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 10,0 }, stops = { {0, "#FF5656"}, {0.5, "#88A175"}, {1, "#AECF96" }}})
vicious.register(cpuwidget, vicious.widgets.cpu, "$1")
-- Create a textclock widget
mytextclock = awful.widget.textclock(" %a %b %d, %H:%M:%S ", 1)
-- Calendar
xxx = {}
xxx.cal = "/usr/bin/cal -m"
lain.widgets.calendar:attach(mytextclock, xxx)
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
@ -463,8 +452,6 @@ clientkeys = awful.util.table.join(
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ 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),
awful.key({ modkey, }, "m",
@ -474,12 +461,8 @@ clientkeys = awful.util.table.join(
end)
)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
globalkeys = awful.util.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = mouse.screen
@ -488,7 +471,6 @@ for i = 1, 9 do
awful.tag.viewonly(tag)
end
end),
-- Toggle tag.
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = mouse.screen
@ -497,7 +479,6 @@ for i = 1, 9 do
awful.tag.viewtoggle(tag)
end
end),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
@ -507,7 +488,6 @@ for i = 1, 9 do
end
end
end),
-- Toggle tag.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
@ -524,14 +504,9 @@ clientbuttons = awful.util.table.join(
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize))
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ 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,
@ -539,26 +514,13 @@ awful.rules.rules = {
raise = true,
keys = clientkeys,
buttons = clientbuttons } },
--{ rule = { class = "MPlayer" },
-- properties = { floating = true } },
--{ rule = { class = "pinentry" },
-- properties = { floating = true } },
{ rule = { class = "gimp" },
properties = { floating = true } },
{ rule = { instance = "plugin-container" },
properties = { floating = true } },
--{ rule = { instance = "urxvt" },
-- properties = { floating = true } },
-- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" },
-- properties = { tag = tags[1][2] } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
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) then
@ -567,11 +529,6 @@ client.connect_signal("manage", function (c, startup)
end)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
@ -580,7 +537,6 @@ client.connect_signal("manage", function (c, startup)
local titlebars_enabled = false
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
-- buttons for the titlebar
local buttons = awful.util.table.join(
awful.button({ }, 1, function()
client.focus = c
@ -594,12 +550,10 @@ client.connect_signal("manage", function (c, startup)
end)
)
-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(awful.titlebar.widget.iconwidget(c))
left_layout:buttons(buttons)
-- 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))
@ -607,14 +561,12 @@ client.connect_signal("manage", function (c, startup)
right_layout:add(awful.titlebar.widget.ontopbutton(c))
right_layout:add(awful.titlebar.widget.closebutton(c))
-- The title goes in the middle
local middle_layout = wibox.layout.flex.horizontal()
local title = awful.titlebar.widget.titlewidget(c)
title:set_align("center")
middle_layout:add(title)
middle_layout:buttons(buttons)
-- Now bring it all together
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_right(right_layout)
@ -626,4 +578,3 @@ 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)
-- }}}