Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gears = require("gears")
- local awful = require("awful")
- awful.rules = require("awful.rules")
- require("awful.autofocus")
- local wibox = require("wibox")
- local beautiful = require("beautiful")
- local naughty = require("naughty")
- local menubar = require("menubar")
- local scratch = require("scratch")
- wicked = require("wicked")
- vicious = require("vicious")
- -- Error handling
- if awesome.startup_errors then
- naughty.notify({ preset = naughty.config.presets.critical,
- title = "Oops, there were errors during startup!",
- text = awesome.startup_errors })
- end
- -- Handle runtime errors after startup
- do
- local in_error = false
- awesome.connect_signal("debug::error", function (err)
- if in_error then return end
- in_error = true
- naughty.notify({ preset = naughty.config.presets.critical,
- title = "Oops, an error happened!",
- text = err })
- in_error = false
- end)
- end
- -- Variable definitions
- beautiful.init("/home/balalaika/.config/awesome/themes/default/theme.lua")
- terminal_large = "urxvt -name large"
- terminal = "urxvt -e tmux -2"
- editor = os.getenv("EDITOR") or "nano"
- editor_cmd = terminal .. " -e " .. editor
- modkey = "Mod4"
- modkey1 = "Mod1"
- -- disable startup-notification globally
- local oldspawn = awful.util.spawn
- awful.util.spawn = function (s)
- oldspawn(s, false)
- end
- -- run_once function -------------------------------------------------------------------------------
- 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 .. ")")
- end
- -- run_once("chromium")
- run_once("transmission-qt -m")
- run_once("parcellite")
- -- Table of layouts to cover with awful.layout.inc, order matters.
- local layouts =
- {
- awful.layout.suit.floating,
- awful.layout.suit.tile,
- -- awful.layout.suit.tile.left,
- -- awful.layout.suit.tile.bottom,
- awful.layout.suit.tile.top,
- --awful.layout.suit.fair,
- awful.layout.suit.fair.horizontal,
- -- awful.layout.suit.spiral,
- -- awful.layout.suit.spiral.dwindle,
- awful.layout.suit.max,
- awful.layout.suit.max.fullscreen
- -- awful.layout.suit.magnifier
- }
- -- Tags
- tags = {
- names = { "~", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "+" },
- layout = { layouts[2], layouts[5], layouts[1], layouts[1], layouts[1], layouts[5], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1] },
- keynum = { "49", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22" },
- }
- for s = 1, screen.count() do
- tags[s] = awful.tag(tags.names, s, tags.layout)
- end
- -- Menu
- myawesomemenu = {
- { "manual", terminal .. " -e man awesome" },
- { "edit config", "urxvt -e gvim /home/balalaika/.config/awesome/rc.lua"},
- { "edit theme", "urxvt -e gvim /home/balalaika/.config/awesome/themes/default/theme.lua"},
- { "restart", awesome.restart },
- { "quit", awesome.quit },
- { "screenshot", "bash /home/balalaika/D/Dropbox/scripts/screenshoter_full" },
- { "set wallpaper (scale)", "bash /home/balalaika/D/Dropbox/scripts/choose_wall_scale", beautiful.wallpaper },
- { "set wallpaper (center)", "bash /home/balalaika/D/Dropbox/scripts/choose_wall_center", beautiful.wallpaper },
- { "reboot", "sudo reboot", beautiful.reboot }
- }
- mywebmenu = {
- { "Chromium", "chromium", beautiful.chromium_icon },
- { "Gmail", "chromium --app=http://gmail.com", beautiful.gmail_icon },
- { "firefox", "firefox", beautiful.firefox_icon }
- }
- mydevmenu = {
- { "Sublime-text", "subl", beautiful.sublime_icon },
- { "Xephyr_awesome", "/home/balalaika/.config/awesome/xephyr" },
- { "Xephyr_restart", "home/balalaika/.config/awesome/xephyr_awesome_restart" }
- }
- mymediamenu = {
- { "Deadbeef", "deadbeef", beautiful.deadbeef_icon }
- }
- mygraphicsmenu = {
- { "Gimp", "gimp", beautiful.gimp_icon },
- { "Gthumb", "gthumb", beautiful.snowman_icon }
- }
- mydocsmenu = {
- { "Okular", "okular", beautiful.okular_icon }
- }
- myvirtmenu = {
- { "winXP", "VirtualBox --startvm win-XP --fullscreen", beautiful.virt_winxp_icon }
- }
- myxfreerdpmenu = {
- { "job_1.1.1.49", "xfreerdp -a 16 --plugin cliprdr 1.1.1.49" },
- { "job_192.168.0.61", "xfreerdp -a 16 --plugin cliprdr 192.168.0.61" }
- }
- mymainmenu = awful.menu({ items = { { "@wesome", myawesomemenu, beautiful.awesome_icon },
- { "web", mywebmenu },
- { "media", mymediamenu },
- { "dev", mydevmenu },
- { "graphics",mygraphicsmenu },
- { "docs", mydocsmenu },
- { "VBox", myvirtmenu },
- { "Rdp", myxfreerdpmenu },
- { "open terminal", terminal }
- }, theme = { width = 150 }
- })
- mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
- menu = mymainmenu })
- menubar.utils.terminal = terminal -- Set the terminal for applications that require it
- -- Spacer
- spacer = wibox.widget.textbox(" ")
- spacer1 = wibox.widget.textbox("::")
- -- ( symbol
- mark1 = wibox.widget.textbox()
- mark1:set_text("(")
- -- ) symbol
- mark2 = wibox.widget.textbox()
- mark2:set_text(")")
- -- [ symbol
- mark3 = wibox.widget.textbox()
- mark3:set_text("[")
- colormark3 = wibox.widget.background()
- colormark3:set_widget(mark3)
- colormark3:set_fg("#B82D2D")
- -- ] symbol
- mark4 = wibox.widget.textbox()
- mark4:set_text("]")
- colormark4 = wibox.widget.background()
- colormark4:set_widget(mark4)
- colormark4:set_fg("#B82D2D")
- -- Create a textclock widget
- mytextclock = wibox.widget.textbox()
- vicious.register(mytextclock, vicious.widgets.date, "%e_%B_%A > %R", 61)
- ----------------------------------------------------------------------------------------------------------
- music = wibox.widget.imagebox("/home/balalaika/.config/awesome/icons/vol.png")
- -- music.image = image( "/home/balalaika/.config/awesome/icons/vol.png" )
- music:buttons(awful.util.table.join(
- awful.button({ }, 3, function () awful.util.spawn("amixer -q set Master mute", false) end),
- awful.button({ }, 4, function () awful.util.spawn("amixer -q set Master 2dB+ unmute", false) end),
- awful.button({ }, 5, function () awful.util.spawn("amixer -q set Master 2dB- unmute", false) end)))
- ----------------------------------------------------------------------------------------------------------
- -- Volume percent
- volumewidget = wibox.widget.textbox()
- vicious.register(volumewidget, vicious.widgets.volume,
- function(widget, args)
- local label = { ["#"] = "O", ["#"] = "M" }
- return args[1]
- end, 1, "Master")
- ---------------------------------------------------------------------------------------------------------
- -- transmission
- --transicon = wibox.widget.imagebox()
- --trans = wibox.widget.textbox()
- --local function script_output()
- --out = awful.util.pread("/home/balalaika/D/Dropbox/development/transmission.py")
- --if out ~= "\n" then
- --transicon:set_image("/home/balalaika/.config/awesome/icons1/download-cloud.png")
- --else
- --out = ""
- --transicon:set_image(nil)
- --end
- --return out
- --end
- --vicious.register(trans, script_output, "$1")
- -- TurnOff
- turnoff_image = wibox.widget.imagebox("/home/balalaika/.config/awesome/icons/system-shutdown.png")
- turnoff_image:fit(8,8)
- turnoff_image:buttons(awful.util.table.join(
- awful.button({ }, 1, function () awful.util.spawn("sudo halt") end)))
- ---------------------------------------------------------------------------------------------------------
- -- Gmail
- mailicon = wibox.widget.imagebox()
- mailwidget = wibox.widget.textbox()
- vicious.register(mailwidget, vicious.widgets.gmail,
- function(widget, args)
- if (args["{count}"] > 0) then
- mailicon:set_image("/home/balalaika/.config/awesome/icons/mail.png")
- mail = args["{count}"] .. ":" .. args["{subject}"]
- if not test or test < args["{count}"] -- play music, only if count biggest 0
- then
- awful.util.spawn_with_shell("mplayer /home/balalaika/.sounds/tutturuu.wav")
- test = args["{count}"]
- else
- test = args["{count}"] end
- else
- mail = ""
- mailicon:set_image(nil)
- test = nil
- end
- return mail
- end, 60)
- mailicon:buttons(awful.util.table.join(
- awful.button({ }, 1, function () awful.util.spawn("chromium --app=http://gmail.com") end)))
- --------------------------------------------------------------------------------------------------------
- -- Cpu graph
- graphwidth = 100
- graphheight = 16
- cpu_background_color = "#222222"
- cpu_gradient_color = "#5431CB"
- cpuicon = wibox.widget.imagebox()
- cpuicon:set_image("/home/balalaika/.config/awesome/icons/cpu.png")
- cpugraph = awful.widget.graph()
- cpugraph:set_width(graphwidth):set_height(graphheight)
- cpugraph:set_border_color(nil)
- -- cpugraph:set_border_color(beautiful.bg_widget)
- cpugraph:set_background_color(cpu_background_color)
- cpugraph:set_color('#5431CB')
- cpugraph:set_stack_colors({ '#AECF96', '#88A175', '#FF5656' })
- vicious.register(cpugraph, vicious.widgets.cpu, "$1")
- ---------------------------------------------------------------------------------------------------------------
- -- LoadAverage
- lawidget = wibox.widget.textbox()
- latimer = timer({ timeout = 5 })
- latimer:connect_signal( "timeout", function()
- local loadavr = awful.util.pread("cat /proc/loadavg| awk '{ print $1 }'")
- lawidget:set_text(loadavr)
- end)
- latimer:start()
- --------------------------------------------------------------------------------------------------------------
- -- DiskSpace
- diskicon = wibox.widget.imagebox("/home/balalaika/.config/awesome/icons/disk.png")
- droot = wibox.widget.textbox()
- dusr = wibox.widget.textbox()
- dhome = wibox.widget.textbox()
- dy = wibox.widget.textbox()
- dw = wibox.widget.textbox()
- dd = wibox.widget.textbox()
- vicious.register(droot, vicious.widgets.fs, -- root
- function(widget, args)
- if tonumber(args["{/ avail_gb}"]) < 5 then
- return "root: " .. "<span color='#FA9E40'>" .. args['{/ avail_gb}'] .." </span>"
- else
- return "root: " .. args["{/ avail_gb}"]
- end
- end,60)
- vicious.register(dusr, vicious.widgets.fs, -- usr
- function(widget, args)
- if tonumber(args["{/usr avail_gb}"]) < 5 then
- return "usr: " .. "<span color='#FA9E40'>" .. args['{/usr avail_gb}'] .." </span>"
- else
- return "usr: " .. args["{/usr avail_gb}"]
- end
- end,60)
- vicious.register(dhome, vicious.widgets.fs, -- home
- function(widget, args)
- if tonumber(args["{/home avail_gb}"]) < 5 then
- return "home: " .. "<span color='#FA9E40'>" .. args['{/home avail_gb}'] .." </span>"
- else
- return "home: " .. args["{/home avail_gb}"]
- end
- end,60)
- vicious.register(dy, vicious.widgets.fs, -- Y
- function(widget, args)
- if tonumber(args["{/home/balalaika/Y avail_gb}"]) < 5 then
- return "Y: " .. "<span color='#FA9E40'>" .. args['{/home/balalaika/Y avail_gb}'] .." </span>"
- else
- return "Y: " .. args["{/home/balalaika/Y avail_gb}"]
- end
- end,60)
- vicious.register(dd, vicious.widgets.fs, -- D
- function(widget, args)
- if tonumber(args["{/home/balalaika/D avail_gb}"]) < 5 then
- return "D: " .. "<span color='#FA9E40'>" .. args['{/home/balalaika/Y avail_gb}'] .." </span>"
- else
- return "D: " .. args["{/home/balalaika/D avail_gb}"]
- end
- end,60)
- --------------------------------------------------------------------------------------------------------------
- -- Create a wibox
- mywibox = {}
- mytopwibox = {}
- mypromptbox = {}
- mylayoutbox = {}
- mytaglist = {}
- mytaglist.buttons = 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, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
- awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
- )
- mytasklist = {}
- mytasklist.buttons = awful.util.table.join(
- awful.button({ }, 1, function (c)
- if c == client.focus then
- c.minimized = true
- else
- -- Without this, the following
- -- :isvisible() makes no sense
- c.minimized = false
- if not c:isvisible() then
- awful.tag.viewonly(c:tags()[1])
- end
- -- This will also un-minimize
- -- the client, if needed
- client.focus = c
- c:raise()
- end
- end),
- awful.button({ }, 2, function (c) c:kill() 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))
- for s = 1, screen.count() do
- mypromptbox[s] = awful.widget.prompt()
- mylayoutbox[s] = awful.widget.layoutbox(s)
- mylayoutbox[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)))
- mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
- mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
- mywibox[s] = awful.wibox({ position = "bottom", height = "16", screen = s })
- mytopwibox[s] = awful.wibox({ position = "top", height = "16", screen = s })
- local left_layout = wibox.layout.fixed.horizontal()
- left_layout:add(mylauncher)
- left_layout:add(spacer)
- left_layout:add(mytaglist[s])
- left_layout:add(mypromptbox[s])
- local right_layout = wibox.layout.fixed.horizontal()
- right_layout:add(mailicon)
- right_layout:add(mailwidget)
- right_layout:add(spacer)
- right_layout:add(diskicon)
- right_layout:add(spacer)
- right_layout:add(colormark3)
- right_layout:add(droot)
- right_layout:add(colormark4)
- right_layout:add(spacer)
- right_layout:add(colormark3)
- right_layout:add(dusr)
- right_layout:add(colormark4)
- right_layout:add(spacer)
- right_layout:add(colormark3)
- right_layout:add(dhome)
- right_layout:add(colormark4)
- right_layout:add(spacer)
- right_layout:add(colormark3)
- right_layout:add(dy)
- right_layout:add(colormark4)
- right_layout:add(spacer)
- -- right_layout:add(colormark3)
- -- right_layout:add(dw)
- -- right_layout:add(colormark4)
- -- right_layout:add(spacer)
- right_layout:add(colormark3)
- right_layout:add(dd)
- right_layout:add(colormark4)
- right_layout:add(spacer)
- right_layout:add(spacer1)
- right_layout:add(spacer)
- right_layout:add(cpuicon)
- right_layout:add(mark1)
- right_layout:add(lawidget)
- right_layout:add(mark2)
- right_layout:add(spacer)
- right_layout:add(cpugraph)
- right_layout:add(spacer)
- right_layout:add(music)
- right_layout:add(spacer)
- right_layout:add(volumewidget)
- right_layout:add(spacer)
- right_layout:add(spacer1)
- right_layout:add(spacer)
- if s == 1 then right_layout:add(wibox.widget.systray()) end
- right_layout:add(spacer)
- right_layout:add(spacer1)
- right_layout:add(spacer)
- right_layout:add(mytextclock)
- right_layout:add(spacer)
- -- right_layout:add(mylayoutbox[s])
- right_layout:add(turnoff_image)
- local layout = wibox.layout.align.horizontal()
- local layout_top = wibox.layout.align.horizontal()
- layout:set_left(left_layout)
- layout:set_right(right_layout)
- layout_top:set_middle(mytasklist[s])
- layout_top:set_right(mylayoutbox[s])
- mytopwibox[s]:set_widget(layout_top)
- mywibox[s]:set_widget(layout)
- end
- ---------------------------------------------------------------------------------------------------------------------------
- -- Run or rise
- function run_or_raise(cmd, properties)
- local clients = client.get()
- local focused = awful.client.next(0)
- local findex = 0
- local matched_clients = {}
- local n = 0
- for i, c in pairs(clients) do
- if match(properties, c) then
- n = n + 1
- matched_clients[n] = c
- if c == focused then
- findex = n
- end
- end
- end
- if n > 0 then
- local c = matched_clients[1]
- if 0 < findex and findex < n then
- c = matched_clients[findex+1]
- end
- local ctags = c:tags()
- if #ctags == 0 then
- local curtag = awful.tag.selected()
- awful.client.movetotag(curtag, c)
- else
- awful.tag.viewonly(ctags[1])
- end
- client.focus = c
- c:raise()
- return
- end
- awful.util.spawn(cmd)
- end
- function match (table1, table2)
- for k, v in pairs(table1) do
- if table2[k] ~= v and not table2[k]:find(v) then
- return false
- end
- end
- return true
- end
- ------------------------------------------------------------------------------------------------------------------------
- -- Mouse bindings
- 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)
- ))
- -- Key bindings
- 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),
- -- awful.key({ modkey, }, "w", function () mymainmenu:show() 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({ modkey1, }, "Tab",
- function ()
- awful.client.focus.byidx(1)
- if client.focus then
- client.focus:raise()
- end
- end),
- -- Standard program
- awful.key({ modkey, "Control" }, "w", function () awful.util.spawn_with_shell("/home/balalaika/D/Dropbox/scripts/choose_wall") end),
- awful.key({ modkey, "Control" }, "d", function () awful.util.spawn_with_shell("/home/balalaika/D/Dropbox/scripts/dmenu_deadbeef") end),
- awful.key({ modkey, }, "F9", function () awful.util.spawn_with_shell("/home/balalaika/D/Dropbox/scripts/screenshoter") end),
- awful.key({ modkey, }, "F8", function () awful.util.spawn_with_shell("/home/balalaika/D/Dropbox/scripts/screenshoter_full") end),
- awful.key({ modkey, "Shift" }, "n", function () awful.util.spawn_with_shell("/home/balalaika/D/Dropbox/development/nowplay") end),
- awful.key({ modkey, }, "F1", function () awful.util.spawn("amixer -q set Master 5dB- unmute") end),
- awful.key({ modkey, }, "F2", function () awful.util.spawn("amixer -q set Master 5dB+ unmute") end),
- awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
- awful.key({ modkey, "Shift" }, "Return", function () awful.util.spawn(terminal_large) end),
- awful.key({ modkey, }, "e", function () scratch.drop("urxvt -name explorer -e tmux -c 'ranger /home/balalaika/Y'", "center", nil, 0.80, 0.90) end),
- awful.key({ modkey, }, "w", function () run_or_raise("chromium", { class = "Chromium-browser" }) end),
- awful.key({ modkey, "Shift" }, "m", function () run_or_raise("deadbeef", { class = "Deadbeef" }) end),
- awful.key({ modkey, "Shift" }, "g", function () run_or_raise("gimp", { class = "Gimp" }) end),
- awful.key({ modkey, }, "F4", function () awful.util.spawn("sudo halt") end),
- awful.key({ modkey, }, "u", function () scratch.drop("urxvt", "up", nil, 0.50, 0.30) end),
- awful.key({ modkey, }, "x", function () run_or_raise("keepassx", { class = "Keepassx" }) end),
- awful.key({ modkey, "Control" }, "r", awesome.restart),
- awful.key({ modkey, "Shift" }, "q", awesome.quit),
- 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, "Control" }, "l", function () awful.tag.incncol(-1) end),
- awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
- awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
- awful.key({ modkey, "Control" }, "n", awful.client.restore),
- awful.key({ modkey, "Shift" }, "t",
- function ()
- local trs = io.popen("trs {=ru} $(xclip -o)")
- local trs_result = trs:read("*a")
- return naughty.notify({ preset = naughty.config.defaults,
- text = trs_result })
- end),
- -- To Do Prompt
- awful.key({ modkey, "Shift" }, "o", function ()
- local todo = awful.util.pread("/home/balalaika/soft/todo/todo.sh ls")
- todo = naughty.notify({
- text = "<b><u>todo</u></b>\n" .. "\n" .. todo,
- timeout = 10
- })
- end),
- awful.key({ modkey }, "r", function () awful.util.spawn("gmrun") end)
- )
- clientkeys = awful.util.table.join(
- awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
- awful.key({ modkey, }, "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, }, "t", function (c) c.ontop = not c.ontop end),
- awful.key({ modkey, }, "n",
- function (c)
- c.minimized = true
- end),
- awful.key({ modkey, }, "m",
- function (c)
- c.maximized_horizontal = not c.maximized_horizontal
- c.maximized_vertical = not c.maximized_vertical
- end)
- )
- keynumber = 0
- for s = 1, screen.count() do
- keynumber = math.min(20, math.max(#tags[s], keynumber))
- end
- for i = 1, keynumber do
- globalkeys = awful.util.table.join(globalkeys,
- awful.key({ modkey }, "#" .. tags.keynum[i],
- function ()
- local screen = mouse.screen
- if tags[screen][i] then
- awful.tag.viewonly(tags[screen][i])
- end
- end),
- awful.key({ modkey, "Shift" }, "#" .. tags.keynum[i],
- function ()
- if client.focus and tags[client.focus.screen][i] then
- awful.client.movetotag(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))
- root.keys(globalkeys)
- ------------------------------------------------------------------------------------------------------------------
- -- Rules
- awful.rules.rules = {
- { rule = { },
- properties = { border_width = beautiful.border_width,
- border_color = beautiful.border_normal,
- focus = awful.client.focus.filter,
- keys = clientkeys,
- buttons = clientbuttons } },
- { rule = { class = "Xephyr" },
- properties = { callback = awful.placement.centered }},
- { rule = { class = "Transmission-qt" },
- properties = { floating = true, callback = awful.placement.centered }},
- { rule = { class = "Keepassx" },
- properties = { floating = true,
- callback = awful.placement.centered }},
- { rule = { class = "Gmrun" },
- properties = { floating = true, callback = function(c) c:geometry({x=600, y=20}) end }},
- { rule = { class = "Chromium-browser" },
- properties = { tag = tags[1][4], border_width = 0 } },
- { rule = { class = "Firefox" },
- properties = { tag = tags[1][4], border_width = 0 } },
- { rule = { class = "feh" },
- properties = { floating = true,
- callback = awful.placement.centered }},
- { rule = { class = "MPlayer" },
- properties = { floating = true, ontop = true } },
- { rule = { class = "pinentry" },
- properties = { floating = true } },
- { rule = { class = "Gimp" },
- properties = { floating = true, tag = tags[1][5], border_width = 0 } },
- { rule = { class = "Deadbeef" },
- properties = { border_width = 0, tag = tags[1][6] } },
- { rule = { class = "Gcolor2" },
- properties = { floating = true, ontop = true }},
- { rule = { class = "Zathura" },
- properties = { maximized_vertical = true, maximized_horizontal = true, border_width = 0 } },
- { rule = { class = "URxvt" },
- properties = { border_width = 0 } },
- { rule = { class = "URxvt", instance = "explorer" },
- properties = { border_width = 4 } },
- { rule = { name = "Save File" },
- properties = { border_width = 4 } },
- { rule = { name = "Select a wallpaper" },
- properties = { border_width = 4, callback = awful.placement.centered } },
- -- { rule = { class = "Tint2" }, properties = { skip_taskbar = true, skip_taglist = true }},
- -- { rule = { class = "VirtualBox" }, name = { "Oracle VM VirtualBox Manager" },
- -- properties = { floating = true, callback = awful.titlebar.add }},
- }
- ---------------------------------------------------------------------------------------------------------------------
- -- Signals
- -- Signal function to execute when a new client appears.
- client.connect_signal("manage", function (c, startup)
- c.size_hints_honor = false
- c:connect_signal("mouse::enter", function(c)
- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
- and awful.client.focus.filter(c) then
- client.focus = c
- end
- 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)
- end
- end
- local titlebars_enabled = false
- if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
- -- Widgets that are aligned to the left
- local left_layout = wibox.layout.fixed.horizontal()
- left_layout:add(awful.titlebar.widget.iconwidget(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)
- client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
- --client.connect_signal("focus",
- --function(c)
- --if c.maximized_horizontal and c.maximized_vertical then
- --c.border_width = "0"
- --c.border_color = beautiful.border_focus
- --else
- --c.border_width = beautiful.border_width
- --c.border_color = beautiful.border_focus
- --end
- --end)
- client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
- -----------------------------------------------------------------------------------------------------------------------
- function autostart(dir)
- if not dir then
- do return nil end
- end
- local fd = io.popen("ls -1 -F " .. dir)
- if not fd then
- do return nil end
- end
- for file in fd:lines() do
- local c= string.sub(file,-1)
- if c=='*' then
- executable = string.sub( file, 1,-2 )
- print("Автозапуск Awesome: Запускается: " .. executable)
- awful.util.spawn_with_shell(dir .. "/" .. executable .. "")
- elseif c=='@' then
- print("Автозапуск Awesome: Игнорируется символьная ссылка: " .. file)
- else
- print ("Автозапуск Awesome: Игнорируется неисполняемый файл " .. file)
- end
- end
- io.close(fd)
- end
- autostart_dir = os.getenv("HOME") .. "/.config/awesome/autorun"
- autostart(autostart_dir)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement