Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------
- -- awesome.lua --
- -- КОНФИГ AWESOME (by SQR218) --
- -- загружается через rc.lua --
- --------------------------------
- --{{{Подгрузка необходимых библиотек
- require("awful")
- require("awful.autofocus")
- require("awful.rules") -- awful, необходимый минимум
- require("beautiful") -- Темы
- require("naughty") -- Уведомления
- require("rodentbane") -- эмулятор мышки (можно убрать)
- --Подгрузка необходимых библиотек}}}
- --{{{Русская локаль
- os.setlocale('ru_RU.UTF-8') --}}}
- --{{{ Переменные (для использования в конфиге)
- awehome = awful.util.getdir("config") .. "/"
- homedir = os.getenv("HOME")
- username = os.getenv("USER")
- terminal = "urxvt"
- editor = os.getenv("EDITOR") or "vi"
- editor_cmd = terminal .. " -e " .. editor
- browser = "uzbl-browser"
- modkey = "Mod4" -- Клавиша модификатор, применяемая почти во всех хоткеях
- myip = "http://example.com" -- Мой IP-адрес
- wallpaperdir = homedir.."/pic/wallpapers" -- В этот каталог положить все "обои"
- alsachan = 'Master' -- Канал ALSA для отображения/регулирования громкости
- netint = 'eth0' -- Сетевой интерфейс
- -- Показывать место на этих дисках (точки монтирования).
- -- Второй параметр - как отображать
- fss = {
- {"/home", "h"},
- {"/media/music", "m"},
- {"/media/torrent", "t"},
- {"/", "/"}
- }
- -- Переменные (для использования в конфиге)}}}
- --{{{Таймеры
- mytimer3 = timer({ timeout = 3 })
- mytimer2 = timer({ timeout = 2 })
- mytimer1800 = timer({ timeout = 1800 })
- mytimer600 = timer({ timeout = 600 })
- --Таймеры}}}
- --{{{Функция смены обоев
- function wpchange()
- awful.util.spawn("awsetbg -r " .. wallpaperdir)
- end
- -- Менять обои каждые 1800 секунд
- mytimer1800:add_signal("timeout", function() wpchange() end)
- --Функция смены обоев}}}
- --{{{тема
- beautiful.init(awehome .. "qliphoth/theme.lua") --}}}
- --{{{layouts
- layouts = {
- awful.layout.suit.floating, --1
- awful.layout.suit.tile, --2
- awful.layout.suit.max, --3
- awful.layout.suit.max.fullscreen, --4
- }
- --layouts}}}
- --{{{Тэги
- tags = {}
- tags[1] = awful.tag({ "c", "b", "o", "m", "g", "t" }, 1, layouts[3])
- awful.layout.set(layouts[2], tags[1][5])
- --Тэги}}}
- --{{{Уведомления
- naughty.config.default_preset.position = "bottom_right"
- naughty.config.default_preset.margin = 4
- naughty.config.default_preset.gap = 1
- naughty.config.default_preset.border_width = 1
- --Уведомления}}}
- --{{{МЕНЮ
- mymainmenu = awful.menu({ items = {
- { "terminal", terminal },
- { "restart", awesome.restart },
- { "quit", awesome.quit },
- }
- })
- --МЕНЮ}}}
- --{{{ВИДЖЕТЫ
- --{{{Лаунчер (главное меню)
- --mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), menu = mymainmenu }) --}}}
- --{{{Трэй
- mysystray = widget({ type = "systray" })--}}}
- --{{{Splitter (разделитель)
- sp = widget({ type = "textbox" })
- sp.text = " | "
- --Splitter (разделитель)}}}
- --{{{Память
- memic = widget({ type = "imagebox", align = "right" })
- memic.image = image( beautiful.memory_icon )
- memwidget = widget({ type = "textbox" })
- function memInfo()
- local free = 0
- local total = 0
- for line in io.lines("/proc/meminfo") do
- for k, v in string.gmatch(line, "([%a]+):[%s]+([%d]+).+") do
- if k == "MemTotal" then total = v
- elseif k == "MemFree" or k == "Buffers" or k == "Cached" then free = v+free
- end
- end
- end
- memwidget.text = " " .. 100-math.floor(free / total * 100) .. "%"
- end
- memInfo()
- mytimer3:add_signal("timeout", function() memInfo() end)
- memic:buttons(awful.util.table.join(
- awful.button({ }, 1, function() awful.util.spawn(terminal.." -e htop") end)
- ))
- --Память}}}
- --{{{Процессор
- cpuic = widget({ type = "imagebox", align = "right" })
- cpuic.image = image( beautiful.cpu_icon )
- cpuwidget = widget({ type = "textbox" })
- function cpuInfo()
- for line in io.lines("/proc/stat") do
- local cpu, newjiffies = string.match(line, "(cpu)\ +(%d+)")
- if cpu and newjiffies then
- if not jiffies then
- jiffies = newjiffies
- end
- cpuwidget.text = string.format(" %02d%%", (newjiffies-jiffies)/4)
- jiffies = newjiffies
- end
- end
- end
- mytimer2:add_signal("timeout", function() cpuInfo() end)
- cpuic:buttons(awful.util.table.join(
- awful.button({ }, 1, function() awful.util.spawn(terminal.." -e htop") end)
- ))
- --Процессор}}}
- --{{{Громкость
- volic = widget({ type = "imagebox", align = "right" })
- volic.image = image( beautiful.volume_icon )
- volwidget = widget({ type = "textbox" })
- function volInfo()
- local f = io.popen(string.format("amixer get '%s'",alsachan)) -- ALSA
- --local f = io.popen("ossmix vmix0-outvol") -- OSS
- local mixer = f:read("*all")
- f:close()
- local volu, mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)")
- --local volu = string.match(mixer, "Value of mixer control.*%s(.*)..*%d+.*")
- volu = tonumber(volu) --*4 --for OSS
- if volu < 40 then volic.image = image( beautiful.vollow_icon ) end
- if volu > 39 and volu < 65 then volic.image = image( beautiful.volmed_icon ) end
- if volu > 64 then volic.image = image( beautiful.volhigh_icon ) end
- if not mute and not volu or mute == "off" then volic.image = image( beautiful.mute_icon ) end
- volwidget.text = volu .. "%"
- end
- mytimer2:add_signal("timeout", function() volInfo() end)
- volic:buttons(awful.util.table.join(
- awful.button({ }, 1, function() awful.util.spawn(string.format("amixer -q set '%s' toggle",alsachan)) volInfo() end),
- awful.button({ }, 3, function() awful.util.spawn(terminal .. " -e alsamixer") end),
- awful.button({ }, 4, function() awful.util.spawn(string.format("amixer set '%s' 2dB+",alsachan)) volInfo() end),
- awful.button({ }, 5, function() awful.util.spawn(string.format("amixer set '%s' 2dB-",alsachan)) volInfo() end)
- --awful.button({ }, 4, function() awful.util.spawn("ossmix -d0 vmix0-outvol -- +1") volInfo() end),
- --awful.button({ }, 5, function() awful.util.spawn("ossmix -d0 vmix0-outvol -- -1") volInfo() end)
- ))
- volInfo()
- --Громкость}}}
- --{{{Джаббер
- chic = widget({ type = "imagebox", align = "right" })
- chic.image = image( beautiful.chat_icon )
- chwidget = widget({ type = "textbox" })
- function chInfo()
- local f = io.popen("cat .mcabber/mcabber.state | wc -l")
- local n = f:read("*all")
- f:close()
- if n == "0\n" then
- chwidget.text = " 0"
- else
- chwidget.text = string.format(' <span color="#FF0000">%s</span>',n)
- end
- end
- chInfo()
- mytimer2:add_signal("timeout", function() chInfo() end)
- --Джаббер}}}
- --{{{Место на дисках
- fsic = widget({ type = "imagebox", align = "right" })
- fsic.image = image( beautiful.disk_icon )
- fswidget = widget({type = "textbox", name = "fswidget", align = "right" })
- ifs = 0
- function fsInfo()
- ifs = ifs+1
- if ifs > #fss then ifs = 1 end
- local f = io.popen('df -kP ' .. fss[ifs][1] ..' | grep -e /')
- local u,space,p = string.match(f:read(), "([%d]+)[%D]+([%d]+)[%D]+([%d]+)%%")
- f:close()
- space = space / 1048576 -- переводим из байт в гигабайты
- fswidget.text = string.format("%s: %.1fGb", fss[ifs][2], space)
- end
- fsInfo()
- mytimer3:add_signal("timeout", function() fsInfo() end)
- fsic:buttons(awful.util.table.join(
- awful.button({ }, 1, function()
- naughty.notify({
- title = "Место на дисках",
- text = awful.util.pread("df -h"),
- timeout = 0, hover_timeout = 0.1
- })
- end)
- ))
- --Место на дисках}}}
- --{{{Активность сети
- netupic = widget({ type = "imagebox", align = "right" })
- netupic.image = image( beautiful.upload_icon )
- netdownic = widget({ type = "imagebox", align = "right" })
- netdownic.image = image(beautiful.download_icon)
- netwidget = widget({ type = "textbox" })
- function netInfo()
- for line in io.lines("/proc/net/dev") do
- local name = string.match(line, "^[%s]?[%s]?[%s]?[%s]?([%w]+):")
- if name == netint then
- local sysnet = "/sys/class/net/" .. name
- arar = tonumber(sysnet.carrier) or 0
- if recvo == nil then
- recvo = tonumber(string.match(line, ":[%s]*([%d]+)"))
- sendo = tonumber(string.match(line,"([%d]+)%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d$"))
- rtime = os.time()
- end
- local recv = tonumber(string.match(line, ":[%s]*([%d]+)"))
- local send = tonumber(string.match(line,"([%d]+)%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d$"))
- local interval = os.time() - rtime > 0 and os.time() - rtime or 1
- rtime = os.time()
- local down = (recv - recvo) / interval / 1024 / 1024
- local up = (send - sendo) / interval / 1024 / 1024
- netwidget.text = string.format(" %.1f | %.1f ",down,up)
- recvo = recv
- sendo = send
- end
- end
- end
- netInfo()
- mytimer2:add_signal("timeout", function() netInfo() end)
- --Активность сети}}}
- --{{{Почта
- mailic = widget({ type = "imagebox", align = "right" })
- mailic.image = image( beautiful.mail_icon )
- mailwidget = widget({ type = "textbox" })
- function mailInfo()
- mbox = "/var/mail/"..username
- local count = { old = 0, total = 0, new = 0 }
- -- Get data from mbox files
- local f = io.open(mbox)
- while true do
- -- Read the mbox line by line, if we are going to read
- -- some *HUGE* folders then switch to reading chunks
- local lines = f:read("*line")
- if not lines then break end
- -- Find all messages
- -- * http://www.jwz.org/doc/content-length.html
- local _, from = string.find(lines, "^From[%s]")
- if from ~= nil then count.total = count.total + 1 end
- -- Read messages have the Status header
- local _, status = string.find(lines, "^Status:[%s]RO$")
- if status ~= nil then count.old = count.old + 1 end
- -- Skip the folder internal data
- local _, int = string.find(lines, "^Subject:[%s].*FOLDER[%s]INTERNAL[%s]DATA")
- if int ~= nil then count.total = count.total - 1 end
- end
- f:close()
- -- Substract total from old to get the new count
- count.new = count.total - count.old
- if count.new>0 then
- mailwidget.text = string.format(' <span color="#FF0000">%s</span>',count.new)
- else
- mailwidget.text = " "..count.new
- end
- --return {count.total, count.old, count.new}
- end
- mailInfo()
- mytimer2:add_signal("timeout", function() mailInfo() end)
- mailic:buttons(awful.util.table.join(
- awful.button({ }, 1, function() awful.util.spawn(terminal.." -e mutt") end)
- ))
- --Почта}}}
- --{{{Часы и календарь
- clockic = widget({ type = "imagebox", align = "right" })
- clockic.image = image( beautiful.time_icon )
- mytextclock = awful.widget.textclock({ align = "right"}, " %d %b, %a %H:%M")
- local calendar = nil
- local offset = 0
- function remove_calendar()
- if calendar ~= nil then
- naughty.destroy(calendar)
- calendar = nil
- offset = 0
- end
- end
- function add_calendar(inc_offset)
- local save_offset = offset
- remove_calendar()
- offset = save_offset + inc_offset
- local datespec = os.date("*t")
- datespec = datespec.year * 12 + datespec.month - 1 + offset
- datespec = (datespec % 12 + 1) .. " " .. math.floor(datespec / 12)
- local cal = awful.util.pread("cal -m " .. datespec)
- cal = string.gsub(cal, "^%s*(.-)%s*$", "%1")
- calendar = naughty.notify({
- title = string.format(os.date("%A, %d.%m.%y")),
- text = string.format("\n" .. cal),
- timeout = 0, hover_timeout = 0.5
- })
- end
- clockic:buttons(awful.util.table.join(
- awful.button({ }, 1, function() add_calendar(0) end),
- awful.button({ }, 3, remove_calendar),
- awful.button({ }, 4, function() add_calendar(-1) end),
- awful.button({ }, 5, function() add_calendar(1) end)
- ))
- --Часы и календарь}}}
- --{{{Now playing (deadbeef)
- music = widget({ type = "imagebox", align = "right" })
- music.image = image( beautiful.music_icon )
- muswidget = widget({type = "textbox", name = "muswidget", align = "right" })
- mytimer2:add_signal("timeout", function()
- local f = io.popen("deadbeef --nowplaying '%a - %t' | "..awehome.."dbunand")
- muswidget.text = " " .. f:read()
- f:close()
- end)
- music:buttons(awful.util.table.join(
- awful.button({ }, 1, function() awful.util.spawn("deadbeef --toggle-pause") end),
- awful.button({ }, 3, function() awful.util.spawn("deadbeef --stop") end),
- awful.button({ }, 4, function() awful.util.spawn("deadbeef --next") end),
- awful.button({ }, 5, function() awful.util.spawn("deadbeef --prev") end)
- ))
- --Now playing (deadbeef)}}}
- --{{{Погода и фаза луны
- weaic = widget({ type = "imagebox", align = "right" })
- moonic = widget({ type = "imagebox", align = "right" })
- weawidget = widget({type = "textbox", name = "weawidget", align = "right" })
- function wInfo()
- local f = io.popen(awehome .. 'sqrwe T')
- local i = io.popen(awehome .. 'sqrwe I')
- local m = io.popen(awehome .. 'sqrwe M')
- weaic.image = image ( awehome.."images/weathericons/"..i:read())
- moonic.image = image ( awehome.."images/moonicons/"..m:read())
- weawidget.text = " " ..f:read().."°C"
- f:close()
- i:close()
- m:close()
- end
- wInfo()
- mytimer600:add_signal("timeout", function() wInfo() end)
- weaic:buttons(awful.util.table.join(
- awful.button({ }, 1, function() awful.util.spawn(browser .. " http://pogoda.yandex.ru/") end)
- ))
- moonic:buttons(awful.util.table.join(
- awful.button({ }, 1, function() awful.util.spawn(browser .. " http://www.astrosystem.ru/AstroSystem/Main/Prognoz/MoonTransits") end)
- ))
- --Погода и фаза луны}}}
- --{{{Тэги
- mytaglist = awful.widget.taglist(1,
- awful.widget.taglist.label.all,
- awful.util.table.join(
- awful.button({ }, 1, awful.tag.viewonly),
- awful.button({ modkey }, 1, awful.client.movetotag),
- awful.button({ }, 3, awful.tag.viewtoggle),
- awful.button({ modkey }, 3, awful.client.toggletag),
- awful.button({ }, 4, awful.tag.viewnext),
- awful.button({ }, 5, awful.tag.viewprev)
- )
- )
- --Тэги}}}
- --{{{виджет "панель задач"
- mytasklist = {}
- mytasklist.buttons = awful.util.table.join(
- awful.button({ }, 1, function (c)
- if not c:isvisible() then
- awful.tag.viewonly(c:tags()[1])
- end
- client.focus = c
- c:raise()
- end),
- awful.button({ }, 3, function ()
- if instance then
- instance:hide()
- instance = nil
- else
- instance = awful.menu.clients({ width=250 })
- end
- end),
- awful.button({ }, 4, function ()
- awful.client.focus.byidx(1)
- if client.focus then client.focus:raise() end
- end),
- awful.button({ }, 5, function ()
- awful.client.focus.byidx(-1)
- if client.focus then client.focus:raise() end
- end))
- mytasklist = awful.widget.tasklist(function(c)
- return awful.widget.tasklist.label.currenttags(c, 1)
- end, mytasklist.buttons)
- --виджет "панель задач"}}}
- --{{{виджет для ввода
- mypromptbox = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })--}}}
- --{{{Виджет для переключения (отображения) лэйаута
- mylayoutbox = awful.widget.layoutbox(1)
- mylayoutbox: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)))
- --Виджет для переключения (отображения) лэйаута}}}
- --ВИДЖЕТЫ}}}
- --{{{ПАНЕЛИ
- --{{{нижняя панель
- mywibox = awful.wibox({ position = "bottom", screen = 1 })
- mywibox.widgets = {
- layout = awful.widget.layout.horizontal.rightleft,
- {
- -- виджеты нижней панели (слева-направо)
- mytaglist,
- mypromptbox, sp,
- moonic, sp,
- weaic, weawidget, sp,
- memic, memwidget, sp,
- cpuic, cpuwidget, sp,
- mailic, mailwidget, sp,
- chic, chwidget, sp,
- volic, volwidget, sp,
- netdownic, netwidget, netupic, sp,
- fsic, fswidget,
- layout = awful.widget.layout.horizontal.leftright,
- },
- {
- -- виджеты нижней панели (справа-налево)
- mysystray,
- mytextclock, clockic, sp,
- muswidget,music,
- layout = awful.widget.layout.horizontal.rightleft,
- },
- }
- --нижняя панель}}}
- --{{{верхняя панель
- mytb = awful.wibox({ position = "top", screen = 1 })
- mytb.widgets = {
- -- виджеты верхней панели (слева-направо)
- mylayoutbox, mytasklist,
- layout = awful.widget.layout.horizontal.leftright,
- }
- --верхняя панель}}}
- --ПАНЕЛИ}}}
- --{{{мышка(раб стол)
- root.buttons(awful.util.table.join(
- awful.button({ }, 3, function () mymainmenu:toggle() end),
- awful.button({ }, 4, awful.tag.viewnext),
- awful.button({ }, 5, awful.tag.viewprev)
- ))
- --мышка(раб стол)}}}
- --{{{КЛАВИАТУРА (хоткеи)
- --{{{global
- globalkeys = awful.util.table.join(
- --{{{тэги
- awful.key({ modkey, }, "Left", awful.tag.viewprev ),
- awful.key({ modkey, }, "Right", awful.tag.viewnext ),
- awful.key({ modkey, }, "Escape", awful.tag.history.restore),
- --тэги}}}
- --{{{переключение окон
- awful.key({ modkey, }, "j",
- function ()
- awful.client.focus.byidx( 1)
- if client.focus then client.focus:raise() end
- end),
- awful.key({ modkey, }, "k",
- function ()
- awful.client.focus.byidx(-1)
- if client.focus then client.focus:raise() end
- end),
- --переключение окон}}}
- --{{{Layout manipulation
- awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
- awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
- awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
- awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
- awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
- awful.key({ modkey, }, "Tab",
- function ()
- awful.client.focus.history.previous()
- if client.focus then
- client.focus:raise()
- end
- end),
- --Layout manipulation}}}
- --{{{Запуск программ
- awful.key({ modkey }, "Return", function () awful.util.spawn(terminal) end),
- awful.key({ modkey }, "F1", function () awful.util.spawn(terminal) end),
- awful.key({ modkey }, "F2", function () awful.util.spawn(browser) end),
- awful.key({ modkey }, "F4", function () awful.util.spawn("deadbeef") end),
- awful.key({ modkey }, "F5", function () awful.util.spawn("gimp") end),
- --Запуск программ}}}
- --{{{Громкость
- awful.key({modkey}, "KP_Up", function () awful.util.spawn(string.format("amixer set '%s' 2dB+",alsachan)) volInfo() end),
- awful.key({modkey}, "KP_Down", function () awful.util.spawn(string.format("amixer set '%s' 2dB-",alsachan)) volInfo() end),
- awful.key({modkey}, "KP_Insert", function () awful.util.spawn(string.format("amixer -q set '%s' toggle",alsachan)) volInfo() end),
- --awful.key({modkey}, "KP_Up", function () awful.util.spawn("ossmix -d0 vmix0-outvol -- +1") volInfo() end),
- --awful.key({modkey}, "KP_Down", function () awful.util.spawn("ossmix -d0 vmix0-outvol -- -1") volInfo() end),
- --Громкость}}}
- --{{{Управление муз. плеером
- awful.key({modkey, }, "KP_Begin", function() awful.util.spawn("deadbeef --toggle-pause") end),
- awful.key({modkey,"Shift" }, "KP_Begin", function() awful.util.spawn("deadbeef --play") end),
- awful.key({modkey, }, "KP_Delete", function() awful.util.spawn("deadbeef --stop") end),
- awful.key({modkey, }, "KP_Left", function() awful.util.spawn("deadbeef --prev") end),
- awful.key({modkey, }, "KP_Right", function() awful.util.spawn("deadbeef --next") end),
- awful.key({modkey,"Control" }, "KP_Begin", function()
- awful.util.spawn("sh -c \"deadbeef --nowplaying '/me слушает %a, песню «%t» с альбома «%b» %y года' | xclip \"")
- end),
- -- awful.key({modkey, }, "XF86AudioPlay", function () awful.util.spawn(terminal .. " -e mocp") end),
- -- awful.key({"" }, "XF86AudioPlay", function () awful.util.spawn("mocp -G") end),
- -- awful.key({"" }, "XF86AudioStop", function () awful.util.spawn("mocp -s") end),
- -- awful.key({"" }, "XF86AudioPrev", function () awful.util.spawn("mocp -r") end),
- -- awful.key({"" }, "XF86AudioNext", function () awful.util.spawn("mocp -f") end),
- --Управление муз. плеером}}}
- --{{{Управление Awesome
- awful.key({ modkey, "Control" }, "r", awesome.restart),
- awful.key({ modkey, "Shift" }, "q", awesome.quit),
- --Управление Awesome}}}
- --{{{Расширять/сужать окошки
- awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
- awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
- awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
- awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
- awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
- awful.key({ modkey, "Contro" }, "l", function () awful.tag.incncol(-1) end),
- --Расширять/сужать окошки}}}
- --{{{Переключение Layout'а
- awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
- awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
- --Переключение Layout'а}}}
- --{{{Prompt
- awful.key({ modkey }, "r", function () mypromptbox:run() end),
- awful.key({ modkey }, "x",
- function ()
- awful.prompt.run({ prompt = "Run Lua code: " },
- mypromptbox.widget,
- awful.util.eval, nil,
- awful.util.getdir("cache") .. "/history_eval")
- end),
- --Prompt}}}
- --{{{разное
- awful.key({ modkey, }, "q", function () rodentbane.start() end), --эмулятор мышки
- awful.key({ modkey, }, "b", function () wpchange() end), --обои менять
- awful.key({ modkey, "Control", "Mod1"}, "l", function () awful.util.spawn("xscreensaver-command -lock") end), --лочить экран
- --разное}}}
- --{{{Скриншот
- awful.key({}, "Print", function()
- awful.util.spawn("\
- scrot '%Y%m%d-%H%M%S-$wx$h.png' -e 'mv $f /srv/http/screen/ &&\
- echo "..myip.."/screen/$f - скриншот, $$[$s/1024]Kb, $wx$h |\
- xclip && notify-send Скриншот $f'\
- ")
- end),
- awful.key({modkey }, "Print", function ()
- awful.util.spawn(awehome.."makemyshot")
- end)
- --Скриншот}}}
- )
- --global}}}
- --{{{client
- clientkeys = awful.util.table.join(
- awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
- awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
- awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
- awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
- awful.key({ modkey, }, "o", awful.client.movetoscreen ),
- awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
- awful.key({ modkey, }, "n", function (c) c.minimized = not c.minimized end),
- awful.key({ modkey, }, "m",
- function (c)
- c.maximized_horizontal = not c.maximized_horizontal
- c.maximized_vertical = not c.maximized_vertical
- end)
- )
- --client}}}
- --{{{Тэги
- -- Compute the maximum number of digit we need, limited to 9
- keynumber = 0
- for s = 1, screen.count() do
- keynumber = math.min(9, math.max(#tags[s], keynumber));
- 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, keynumber do
- globalkeys = awful.util.table.join(globalkeys,
- awful.key({ modkey }, "#" .. i + 9,
- function ()
- local screen = mouse.screen
- if tags[screen][i] then
- awful.tag.viewonly(tags[screen][i])
- end
- end),
- awful.key({ modkey, "Control" }, "#" .. i + 9,
- function ()
- local screen = mouse.screen
- if tags[screen][i] then
- awful.tag.viewtoggle(tags[screen][i])
- end
- end),
- awful.key({ modkey, "Shift" }, "#" .. i + 9,
- function ()
- if client.focus and tags[client.focus.screen][i] then
- awful.client.movetotag(tags[client.focus.screen][i])
- end
- end),
- awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
- function ()
- if client.focus and tags[client.focus.screen][i] then
- awful.client.toggletag(tags[client.focus.screen][i])
- end
- end))
- end
- --Тэги}}}
- --{{{Мышка
- clientbuttons = awful.util.table.join(
- awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
- awful.button({ modkey }, 1, awful.mouse.client.move),
- awful.button({ modkey }, 3, awful.mouse.client.resize))
- --Мышка}}}
- --{{{Set keys
- root.keys(globalkeys)--}}}
- --КЛАВИАТУРА (хоткеи)}}}
- --{{{ПРАВИЛА ДЛЯ ОКОН
- awful.rules.rules = {
- -- Правило для всех окон (далее можно переопределить для конкретных)
- { rule = { },
- properties = { border_width = beautiful.border_width,
- border_color = beautiful.border_normal,
- focus = true,
- keys = clientkeys,
- buttons = clientbuttons,
- tag = tags[1][3] } }, -- по умолчанию открывать все окна не 3-м тэге
- -- Правила для разных приложений
- { rule = { class = "MPlayer" }, properties = { floating = true } },
- { rule = { class = "Uzbl-core" }, properties = { tag = tags[1][2] } },
- { rule = { class = "Firefox" }, properties = { tag = tags[1][2] } },
- { rule = { class = "URxvt" }, properties = { tag = tags[1][1] } },
- { rule = { class = "Deadbeef" }, properties = { tag = tags[1][4] } },
- { rule = { class = "Deluge" }, properties = { tag = tags[1][4] } },
- { rule = { class = "Gimp" }, properties = { tag = tags[1][5] } },
- { rule = { role = "gimp-toolbox" }, properties = { floating = false } }, -- окошко инструментов гимпа встаёт в тайлинг
- }
- --ПРАВИЛА ДЛЯ ОКОН}}}
- --{{{Signals
- --ТУТ ЛУЧШЕ ВСЁ ОСТАВИТЬ КАК ЕСТЬ
- -- Signal function to execute when a new client appears.
- client.add_signal("manage", function (c, startup)
- 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)
- end
- end
- -- Эта строчка, чтобы между терминалами не было пространства
- c.size_hints_honor = false
- end)
- client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
- client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
- --Signals}}}
- --{{{Выполняем при старте Awesome
- --{{{Стартуем таймеры
- mytimer3:start()
- mytimer2:start()
- mytimer1800:start()
- mytimer600:start()
- --Стартуем таймеры}}}
- --{{{Ставим случайные обои
- wpchange() --}}}
- --{{{Автозапуск программ
- -- Не используется. Всё запускается из .xinitrc
- -- ПРИ НЕОБХОДИМОСТИ - РАСКОММЕНТИРОВАТЬ
- --autorunApps = {
- -- "killall unclutter",
- -- "unclutter -idle 3",
- -- "firefox",
- -- "deadbeef",
- --}
- --for app = 1, #autorunApps do
- -- awful.util.spawn(autorunApps[app])
- --end
- --АВТОЗАПУСК}}}
- --Выполняем при старте Awesome}}}
- -- vim: fdm=marker:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement