Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Standard awesome library
- local gears = require("gears")
- local awful = require("awful")
- awful.rules = require("awful.rules")
- require("awful.autofocus")
- -- Widget and layout library
- local wibox = require("wibox")
- local vicious = require("vicious")
- -- Theme handling library
- local beautiful = require("beautiful")
- -- Notification library
- local naughty = require("naughty")
- local menubar = require("menubar")
- -- Lain
- local lain = require("lain")
- local lain_custom_mpd = require("lain_custom.mpd")
- local sysinfo = require("lain_custom.sysinfo")
- -- local drop = require("scratchdrop")
- -- {{{ Error handling
- -- Check if awesome encountered an error during startup and fell back to
- -- another config (This code will only ever execute for the fallback config)
- 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)
- -- Make sure we don't go into an endless error loop
- 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
- -- Themes define colours, icons, and wallpapers
- beautiful.init("/home/gregory/.config/awesome/themes/20131205/theme.lua")
- -- This is used later as the default terminal and editor to run.
- terminal = "termite"
- editor = os.getenv("EDITOR") or "nano"
- editor_gui = "bluefish"
- editor_cmd = editor_gui
- --editor_cmd = terminal .. " -e " .. editor_gui
- -- Default modkey.
- -- Usually, Mod4 is the key with a logo between Control and Alt.
- -- If you do not like this or do not have such a key,
- -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
- -- However, you can use another modifier like Mod1, but it may interact with others.
- modkey = "Mod4"
- -- Table of layouts to cover with awful.layout.inc, order matters.
- local layouts =
- {
- awful.layout.suit.floating, --1
- awful.layout.suit.tile, --2
- awful.layout.suit.tile.left, --3
- awful.layout.suit.tile.bottom, --4
- awful.layout.suit.tile.top, --5
- awful.layout.suit.fair, --6
- awful.layout.suit.fair.horizontal, --7
- awful.layout.suit.spiral, --8
- awful.layout.suit.spiral.dwindle, --9
- awful.layout.suit.max, --10
- awful.layout.suit.max.fullscreen, --11
- awful.layout.suit.magnifier, --12
- lain.layout.uselesstile, --13
- lain.layout.uselesstile.left, --14
- lain.layout.uselessfair, --15
- lain.layout.uselesspiral --16
- }
- -- }}}
- -- {{{ Wallpaper
- -- if beautiful.wallpaper then
- -- for s = 1, screen.count() do
- -- gears.wallpaper.maximized(beautiful.wallpaper, s, true)
- -- end
- -- end
- -- }}}
- -- {{{ Tags
- -- Define a tag table which hold all screen tags.
- tags = {
- settings = {
- { names = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII" },
- layout = { layouts[13], layouts[1], layouts[13], layouts[13], layouts[14], layouts[14], layouts[1], layouts[13], layouts[13], layouts[13], layouts[13], layouts[13], layouts[13] }
- },
- { names = { "I", "II", "III", "IV", "V" },
- layout = { layouts[13], layouts[13], layouts[13], layouts[13], layouts[13] }
- }}}
- -- ●
- for s = 1, screen.count() do
- tags[s] = awful.tag(tags.settings[s].names, s, tags.settings[s].layout)
- end
- -- {{{ Menu
- -- Create a laucher widget and a main menu
- myawesomemenu = {
- { "manual", terminal .. " -e man awesome" },
- { "edit config", editor_cmd .. " " .. awesome.conffile },
- { "restart", awesome.restart },
- { "quit", awesome.quit }
- }
- myappmenu_accessories = {
- { "Calculator", "galculator"},
- }
- myappmenu_texteditors = {
- { "Mousepad", "mousepad"},
- { "Bluefish", "bluefish"},
- }
- myappmenu_office = {
- { "Abiword", "abiword"},
- { "Gnumeric", "gnumeric"},
- }
- myappmenu_graphics = {
- { "Gimp", "gimp" },
- }
- myappmenu_audiovideo = {
- { "Soundconverter", "soundconverter" },
- }
- myappmenu_network = {
- { "Deluge", "deluge" },
- { "Pidgin", "pidgin" },
- { "Hotot", "hotot-gtk3" },
- }
- myapplicationsmenu = {
- { "Accessories", myappmenu_accessories },
- { "Text Editors", myappmenu_texteditors },
- { "Office", myappmenu_office },
- { "Games", nil },
- { "Financial", nil },
- { "Graphics", myappmenu_graphics },
- { "Audio/Video", myappmenu_audiovideo },
- { "Network", myappmenu_network },
- }
- mymenu_finance = {
- { "Ledger" , "gnucash --name=gnucashmain"},
- {nil,nil},
- { "Refresh Ledger Analysis", "termite -e \"java -jar /home/gregory/bin/java/GnucashJasperReporting.jar && read\"" },
- {nil,nil},
- { "PDF Ledger Analysis", "llpp /mnt/warehouse/documents/financial/reports/GnuCashBatchExportPostgreSQL.pdf" },
- { "HTML Ledger Analysis", nil}
- }
- mymenu_imagemanagement = {
- { "My Photos" , "shotwell -d /mnt/warehouse/multimedia/images/photographs/db_app/shotwell_db/personal/"},
- { "Family Photos", "shotwell -d /mnt/warehouse/multimedia/images/photographs/db_app/shotwell_db/family/" },
- { "Wallpaper", "shotwell -d /mnt/warehouse/multimedia/images/photographs/db_app/shotwell_db/wallpaper/"},
- }
- mysystemmenu = {
- { "Desktop Wallpaper", "nitrogen --sort=alpha" },
- { "nVidia Settings", "nvidia-settings" },
- { "ALSA Mixer", "gnome-alsamixer"},
- { "VirtualBox Machines", "VirtualBox" },
- { nil, nil},
- { "Systemd Administration", "systemadm"},
- { nil, nil},
- { "Awesome WM Configuration", editor_cmd .. " " .. awesome.conffile },
- { "GTk Appearance", "lxappearance"},
- { "Conky Configuration", editor_cmd .. " /home/gregory/config/conky/conky-awesome-detail.conf "},
- }
- mymainmenu = awful.menu(
- { items = {
- { "Internet", "firefox" },
- { "Internet (Tor)", "tor-browser-en" },
- { "E-Mail", "thunderbird" },
- { "Terminal", terminal },
- { "Notes (zim)", "zim" },
- { "Music", "sonata" },
- { "Calculator", "galculator" },
- { "Task Manager","lxtask" },
- { "PostgreSQL Administration", "pgadmin3" },
- { nil, nil },
- { "VM - Windows 7", "VBoxManage startvm \"Windows 7\"" },
- { "VM - Linux", "VBoxManage startvm \"Linux\"" },
- { nil, nil },
- { "Eclipse", "eclipse" },
- { "Spring Tool Suite", "/opt/springsource/sts-3.4.0.RELEASE/STS" },
- { "Jasper iReport", "/opt/iReport-5.1.0/bin/ireport"},
- { nil,nil },
- { "Finance", mymenu_finance },
- { "Image Management", mymenu_imagemanagement },
- { nil, nil },
- { "Home", "thunar /home/gregory"},
- { "Scripts", "thunar /home/gregory/scripts"},
- { "Downloads", "thunar /mnt/warehouse/staging/incoming"},
- { nil, nil },
- { "Applications", myapplicationsmenu },
- { "System", mysystemmenu },
- { nil, nil },
- { "Restart WM", awesome.restart },
- { "Quit", awesome.quit }
- },
- theme = {width = 250}
- })
- mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
- menu = mymainmenu })
- -- Menubar configuration
- menubar.utils.terminal = terminal -- Set the terminal for applications that require it
- -- }}}
- -- {{{ Wibox
- markup = lain.util.markup
- white = beautiful.fg_focus
- gray = "#858585"
- -- Initiate all the widgets
- -- Space
- space = wibox.widget.textbox()
- space:set_text(' ')
- divider = wibox.widget.textbox()
- divider:set_text('|')
- iwidget = wibox.widget.imagebox()
- iwidget:fit(10,10)
- iwidget:set_resize(true)
- iwidget:set_image(beautiful.widget_info03)
- sysinfo.update()
- iwidget:connect_signal("mouse::enter", function() sysinfo.show() end )
- iwidget:connect_signal("mouse::leave", function() sysinfo.hide() end )
- cpuwidget = wibox.widget.textbox()
- vicious.register(cpuwidget, vicious.widgets.cpu, "CPU $1%")
- memwidget = lain.widgets.mem({
- settings = function()
- timeout = 7
- widget:set_markup(" MEM " .. (string.format("%." .. (2 or 0) .. "f", ((mem_now.free + mem_now.buf + mem_now.cache)/1000))) .. "G ")
- end
- })
- netwidget = wibox.widget.textbox()
- vicious.register(netwidget, vicious.widgets.net, 'NET: ${enp3s0 down_kb} / ${enp3s0 up_kb}', 3)
- volwidget = wibox.widget.textbox()
- vicious.register(volwidget, vicious.widgets.volume, "VOL: $1% ", 2, "PCM -M -c 0")
- volwidget:buttons(awful.util.table.join(
- awful.button({ }, 1, function () awful.util.spawn("amixer -q set Master toggle", false) end),
- awful.button({ }, 3, function () awful.util.spawn("termite -e alsamixer", true) end),
- awful.button({ }, 4, function () awful.util.spawn("amixer -q set PCM 2dB+", false) end),
- awful.button({ }, 5, function () awful.util.spawn("amixer -q set PCM 2dB-", false) end)
- ))
- -- Initialize MPD Icon / Widget
- mpdwidget = lain_custom_mpd({
- music_dir = "/mnt/warehouse/multimedia/audio/music",
- cover_size = 150,
- default_art = os.getenv("HOME") .. "/mpd/nocoverart.jpg",
- settings = function()
- -- mpd_notification_preset.fg = white
- mpd_notification_preset.title = ""
- mpd_notification_preset.text = string.format("%s\n%s\n%s\n%s\n%s", mpd_now.title, mpd_now.artist, mpd_now.album, mpd_now.track, mpd_now.date)
- mpd_notification_preset.width = 500
- mpd_notification_preset.timeout = 2
- artist = mpd_now.artist
- album = mpd_now.album
- track = mpd_now.track
- title = mpd_now.title
- time = mpd_now.time
- spos = mpd_now.spos
- slen = mpd_now.slen
- if mpd_now.state == "play" then
- widget:set_markup(artist .. " (" .. album .. " " .. track .. ") " .. title .. " (" .. spos .. "/" .. slen .. ")")
- else
- artist = ""
- album = ""
- track = ""
- title = ""
- time = ""
- spos = ""
- slen = ""
- if mpd_now.state == "pause" then
- widget:set_markup("MPD: Paused")
- end
- if mpd_now.state == "stop" then
- widget:set_markup("MPD: Stopped")
- end
- end
- end
- })
- -- /home fs
- --fshome = lain.widgets.fs({
- -- partition = "/home",
- -- settings = function()
- -- fs_notification_preset.fg = white
- -- fs_notification_preset.font = "Droid Sans Mono 8"
- -- fs_header = ""
- -- fs_p = ""
- -- --if fs_now.used >= 90 then
- -- fs_header = " Hdd "
- -- fs_p = fs_now.used
- -- --end
- -- widget:set_markup(markup(gray, fs_header) .. markup(white, fs_p))
- -- end
- --})
- mytextclock = awful.widget.textclock(" %a %b %d %I:%M ", 61)
- -- Set up a Calendar to be called when you hover over the mytextclock widget
- local calendar = nil
- function remove_calendar()
- if calendar ~= nil then
- naughty.destroy(calendar)
- calendar = nil
- end
- end
- function add_calendar()
- remove_calendar()
- local cal = awful.util.pread("cal -3m ")
- cal = string.gsub(cal, "^%s*(.-)%s*$", "%1")
- calendar = naughty.notify({text = string.format('<span font_desc="%s">%s</span>', "Droid Sans Mono Bold 9", "\n" .. cal), timeout = 0, hover_timeout = 0.5, width = 470, })
- end
- mytextclock:connect_signal("mouse::enter", function() add_calendar() end )
- mytextclock:connect_signal("mouse::leave", function() remove_calendar() end )
- -- Custom Functions
- -- Create a wibox for each screen and add it
- mywibox = {}
- mywiboxsystem = {}
- mywiboxmusic = {}
- mywiboxtasklist = {}
- 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({ }, 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
- -- Create a promptbox for each screen
- mypromptbox[s] = awful.widget.prompt()
- -- Create an imagebox widget which will contains an icon indicating which layout we're using.
- -- We need one layoutbox per screen.
- 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)))
- -- 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)
- -- Create the wibox
- mywibox[s] = awful.wibox({ position = "top", screen = s })
- -- Widgets that are aligned to the left
- local left_layout = wibox.layout.fixed.horizontal()
- left_layout:add(mylauncher)
- left_layout:add(mytaglist[s])
- left_layout:add(mypromptbox[s])
- -- Widgets that are aligned to the right
- local right_layout = wibox.layout.fixed.horizontal()
- if s == 1 then
- --right_layout:add(mpdicon)
- --right_layout:add(fshome)
- right_layout:add(mpdwidget)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(volwidget)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(netwidget)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(memwidget)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(cpuwidget)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(iwidget)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(wibox.widget.systray())
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(space)
- right_layout:add(mytextclock)
- end
- right_layout:add(mylayoutbox[s])
- -- Now bring it all together (with the tasklist in the middle)
- local layout = wibox.layout.align.horizontal()
- layout:set_left(left_layout)
- layout:set_right(right_layout)
- mywibox[s]:set_widget(layout)
- -- Create the wibox for the tasklist
- mywiboxtasklist[s] = awful.wibox({ position = "bottom", screen = s, ontop = true })
- local layout = wibox.layout.align.horizontal()
- layout:set_middle(mytasklist[s])
- mywiboxtasklist[s]:set_widget(layout)
- 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({ modkey, }, "Tab",
- function ()
- awful.client.focus.history.previous()
- if client.focus then
- client.focus:raise()
- end
- end),
- -- Standard program
- awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) 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({ "Mod1", }, "Tab",
- function ()
- -- awful.client.focus.history.previous()
- awful.client.focus.byidx(-1)
- if client.focus then
- client.focus:raise()
- end
- end),
- awful.key({ "Mod1", "Shift" }, "Tab",
- function ()
- -- awful.client.focus.history.previous()
- awful.client.focus.byidx(1)
- if client.focus then
- client.focus:raise()
- end
- end),
- -- MPD
- awful.key({ modkey, }, "KP_Subtract", function () awful.util.spawn("mpc volume -2") end),
- awful.key({ modkey, }, "KP_Add", function () awful.util.spawn("mpc volume +2") end),
- awful.key({ modkey, }, "Next", function () awful.util.spawn("mpc next") end),
- awful.key({ modkey, }, "Prior", function () awful.util.spawn("mpc prev") end),
- awful.key({ modkey, }, "Home", function () awful.util.spawn("mpc toggle") end),
- awful.key({ modkey, }, "End", function () awful.util.spawn("mpc stop") end),
- -- Prompt
- awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
- awful.key({ modkey }, "x",
- function ()
- awful.prompt.run({ prompt = "Run Lua code: " },
- mypromptbox[mouse.screen].widget,
- awful.util.eval, nil,
- awful.util.getdir("cache") .. "/history_eval")
- end),
- -- Menubar
- awful.key({ modkey }, "p", function() menubar.show() end)
- )
- 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, }, "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",
- function (c)
- c.maximized_horizontal = not c.maximized_horizontal
- c.maximized_vertical = not c.maximized_vertical
- end)
- )
- -- Compute the maximum number of digit we need, limited to 9
- keynumber = 0
- for s = 1, screen.count() do
- keynumber = math.min(13, 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)
- -- }}}
- -- {{{ Rules
- awful.rules.rules = {
- -- All clients will match this rule.
- { rule = { },
- properties = { border_width = beautiful.border_width,
- border_color = beautiful.border_normal,
- focus = awful.client.focus.filter,
- keys = clientkeys,
- buttons = clientbuttons } },
- { rule = { class = "Conky" },
- -- properties = { floating = true, sticky = false, ontop = true, focusable = true },
- properties = { floating = true, sticky = false, ontop = true, focusable = true,
- function(z)
- --z:geometry({ width=400, height=800 })
- awful.placement.centered(z,nil)
- end }
- },
- { rule = { class = "MPlayer" },
- properties = { floating = true } },
- { rule = { class = "pinentry" },
- properties = { floating = true } },
- { rule = { class = "gimp" },
- properties = { floating = true } },
- { rule = { class = "Galculator" },
- properties = { floating = true } },
- --[[ { rule = { class = "Conky" },
- properties = { tag = tags[1][1], border_width = 0 },
- -- source: http://stackoverflow.com/questions/5120399/setting-windows-layout-for-a-specific-application-in-awesome-wm
- callback = function (c)
- local cl_width = 445 -- width of buddy list window
- local def_left = false -- default placement. note: you have to restart
- -- pidgin for changes to take effect
- local scr_area = screen[c.screen].workarea
- local cl_strut = c:struts()
- local geometry = nil
- -- adjust scr_area for this client's struts
- if cl_strut ~= nil then
- if cl_strut.left ~= nil and cl_strut.left > 0 then
- geometry = {x=scr_area.x-cl_strut.left, y=scr_area.y,
- width=cl_strut.left}
- elseif cl_strut.right ~= nil and cl_strut.right > 0 then
- geometry = {x=scr_area.x+scr_area.width, y=scr_area.y,
- width=cl_strut.right}
- end
- end
- -- scr_area is unaffected, so we can use the naive coordinates
- if geometry == nil then
- if def_left then
- c:struts({left=cl_width, right=0})
- geometry = {x=scr_area.x, y=scr_area.y,
- width=cl_width}
- else
- c:struts({right=cl_width, left=0})
- geometry = {x=scr_area.x+scr_area.width-cl_width, y=scr_area.y,
- width=cl_width}
- end
- end
- c:geometry(geometry)
- end
- }, ]]--
- { rule = { type = "normal", class = "Thunderbird" },
- properties = { tag = tags[1][2], floating = false } },
- -- Set what should be the Thunderbird password dialog to float
- { rule = { type = "dialog", class = "Thunderbird" },
- properties = { floating = true } },
- { rule = { class = "Pidgin", role = "buddy_list" },
- -- source: http://stackoverflow.com/questions/5120399/setting-windows-layout-for-a-specific-application-in-awesome-wm
- properties = { tag = tags[1][3], floating = true, maximized_vertical = true, maximized_horizontal = false },
- callback = function (c)
- local cl_width = 250 -- width of buddy list window
- local def_left = true -- default placement. note: you have to restart
- -- pidgin for changes to take effect
- local scr_area = screen[c.screen].workarea
- local cl_strut = c:struts()
- local geometry = nil
- -- adjust scr_area for this client's struts
- if cl_strut ~= nil then
- if cl_strut.left ~= nil and cl_strut.left > 0 then
- geometry = {x=scr_area.x-cl_strut.left, y=scr_area.y,
- width=cl_strut.left}
- elseif cl_strut.right ~= nil and cl_strut.right > 0 then
- geometry = {x=scr_area.x+scr_area.width, y=scr_area.y,
- width=cl_strut.right}
- end
- end
- -- scr_area is unaffected, so we can use the naive coordinates
- if geometry == nil then
- if def_left then
- c:struts({left=cl_width, right=0})
- geometry = {x=scr_area.x, y=scr_area.y,
- width=cl_width}
- else
- c:struts({right=cl_width, left=0})
- geometry = {x=scr_area.x+scr_area.width-cl_width, y=scr_area.y,
- width=cl_width}
- end
- end
- c:geometry(geometry)
- end
- },
- { rule = { class = "Firefox" },
- properties = { tag = tags[1][4] } },
- { rule = { class = "Sonata" },
- properties = { tag = tags[1][5] } },
- -- Gnucash must be started with --name gnucashmain for these to work
- { rule = { name = "GnuCash", class = "Gnucash", instance = "gnucashmain" },
- properties = { tag = tags[1][6], floating = true, maximized = false } },
- { rule = { name = "Username and Password", class = "Gnucash", instance = "gnucashmain" },
- properties = { tag = tags[1][6], floating = true } },
- { rule = { name = "postgres://gregory@localhost/gnucash_production - Accounts - GnuCash", class = "Gnucash", instance = "gnucashmain" },
- properties = { tag = tags[1][6], floating = false } },
- { rule = { name = "pgAdmin III" },
- properties = { tag = tags[1][7], floating = false } },
- { rule = { class = "Thunar" },
- properties = { tag = tags[1][10], floating = false, switchtotag = true } },
- { rule = { class = "Thunar", type = "dialog" },
- properties = { tag = tags[1][10], floating = true } },
- { rule = { class = "Zim" },
- properties = { tag = tags[1][13], floating = false, switchtotag = true } },
- }
- -- }}}
- -- {{{ 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
- 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("unfocus", function(c) c.border_color = beautiful.border_normal end)
- -- }}}
Advertisement
Add Comment
Please, Sign In to add comment