mattburchett

My Awesome RC.LUA

Jun 11th, 2011
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 28.20 KB | None | 0 0
  1. -- -- NOVA Awesome Setup -- --
  2. -- -- Created by Matt Burchett -- --
  3. -- -- Fri, 2010/06/10 -- --
  4.  
  5. -- -- LIBRARY REQUIREMENTS -- --
  6. -- -- THERE MAY BE LIBRARIES COMMENTED OUT THAT ARE CURRENTLY OUT OF USE -- --
  7. require("awful")            -- Standard Awesome Library
  8. require("awful.autofocus")      -- Standard Awesome Library
  9. require("awful.rules")          -- Standard Awesome Library
  10. require("beautiful")            -- Theme Handling Library
  11. require("naughty")          -- Notification Library
  12. require("vicious")          -- Dynamic Widget Library
  13. --require("lib/mpd")            -- MPD Library
  14. --require("awesompd")           -- AWESOMPD Library
  15.  
  16. -- -- APP AUTOSTART -- --
  17. awful.util.spawn_with_shell("volwheel")
  18. awful.util.spawn_with_shell("dropboxd")
  19. awful.util.spawn_with_shell("mpd")
  20. awful.util.spawn_with_shell("wmname LG3D")
  21.  
  22. -- -- VARIABLE DEFINITIONS -- --
  23.  
  24. -- -- SPECIFY THEME LOCATION (CONSISTS OF COLOURS, ICONS, AND WALLPAPERS) -- --
  25. beautiful.init("/home/burchettm/.config/awesome/themes/awesomeo/theme.lua")
  26.  
  27. -- -- SPECIFY DEFAULT APPLICATIONS -- --
  28. terminal = "sakura"         -- Specify Default Terminal
  29. editor = os.getenv("EDITOR") or "vim"
  30. editor_cmd = terminal .. " -e " .. editor
  31. modkey = "Mod4" -- Set ModKey to Windows Key, use xmodmap to change
  32.  
  33. -- -- LAYOUTS -- --
  34. layouts =
  35. {
  36.     awful.layout.suit.floating,
  37.     awful.layout.suit.tile,
  38.     awful.layout.suit.tile.left,
  39.     awful.layout.suit.tile.bottom,
  40.     awful.layout.suit.tile.top,
  41.     awful.layout.suit.fair,
  42.     awful.layout.suit.fair.horizontal,
  43.     awful.layout.suit.spiral,
  44.     awful.layout.suit.spiral.dwindle,
  45.     awful.layout.suit.max,
  46.     awful.layout.suit.max.fullscreen,
  47.     awful.layout.suit.magnifier
  48. }
  49.  
  50. -- -- TAGS --  --
  51. -- Define a tag table which hold all screen tags.
  52. tags = {}
  53. for s = 1, screen.count() do
  54.     -- Each screen has its own tag table.
  55.     tags[s] = awful.tag({ "work", "term", "www", "chat", "media", "social" }, s,
  56.  { layouts[1], layouts[2], layouts[1],          -- Tags: 1, 2, 3
  57.    layouts[1], layouts[1], layouts[1],          --       4, 5 ,6
  58.    layouts[1], layouts[1], layouts[1]           --       7, 8, 9
  59.  })
  60. end
  61.  
  62. -- -- MENU -- --
  63.  
  64. myawesomemenu = {
  65.    { "Manual", terminal .. " -e man awesome" },
  66.    { "Edit Config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
  67.    { "Restart", awesome.restart },
  68.    { "Quit", awesome.quit }
  69. }
  70.  
  71. myaccessoriesmenu = {
  72.    { "Android Notifier Desktop", "/usr/share/android-notifier-desktop/run.sh" },
  73.    { "Application Finder", "xfce4-appfinder" },
  74.    { "Archive Manager", "file-roller" },
  75.    { "Avant Window Navigator", "avant-window-navigator" },
  76.    { "Disk Utility", "palimpsest" },
  77.    { "DOSBOX Emulator", "dosbox" },
  78.    { "gShot", "gshot" },
  79.    { "gVim", "gvim" },
  80.    { "LXDE Image Viewer", "gpicview" },
  81.    { "KeePassX", "keepassx" },
  82.    { "LXTerminal", "lxtermnal" },
  83.    { "Mousepad", "mousepad" },
  84.    { "Orage Globaltime", "globaltime" },
  85.    { "PCManFM File Manager", "pcmanfm" },
  86.    { "Root Terminal", "gksu -l gnome-terminal" },
  87.    { "Sakura", "sakura" },
  88.    { "Screenshot", "xfce4-screenshooter" },
  89.    { "Sensor Viewer", "xfce4-sensors" },
  90.    { "Squeeze", "squeeze" },
  91.    { "Terminator", "terminator" },
  92.    { "Virus Scanner", "clamtk" },
  93.    { "Xarchiver", "xarchiver" }
  94. }
  95.  
  96. myarchmenu = {
  97.    { "AUR", "xdg-open http://aur.archlinux.org" },
  98.    { "Bugs", "xdg-open http://bugs.archlinux.org" },
  99.    { "Developers", "xdg-open http://www.archlinux.org/developers/" },
  100.    { "Documentation", "xdg-open http://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide" },
  101.    { "Donate", "xdg-open http://www.archlinux.org/donate/" },
  102.    { "Forum", "xdg-open http://bbs.archlinux.org" },
  103.    { "Homepage", "xdg-open http://repos.archlinux.org" },
  104.    { "SVN", "xdg-open http://repos.archlinux.org" },
  105.    { "Schwag", "xdg-open http://www.zazzle.com/archlinux/" },
  106.    { "Wiki", "xdg-open http://wiki.archlinux.org" }
  107. }
  108.  
  109. mygamesmenu = {
  110.    { "Alien Arena", "alienarena" },
  111.    { "America's Army 3", "env WINEPREFIX='/home/burchettm/.wineprefix/Steam' wine winebrowser steam://rungameid/13140" },
  112.    { "Ceiling Fan Man", "env WINEPREFIX='/home/burchettm/.wineprefix/SFGames' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/SFGames/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/Skyfall/Ceiling\\ Fan\\ Man/Play\\ Ceiling\\ Fan\\ Man.lnk" },
  113.    { "Ceiling Fan Man II", "env WINEPREFIX='/home/burchettm/.wineprefix/SFGames' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/SFGames/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/Skyfall/Ceiling\\ Fan\\ Man\\ II\\ Demo/Play\\ Ceiling\\ Fan\\ Man\\ II.lnk" },
  114.    { "Curse Client", "env WINEPREFIX='/home/burchettm/.wineprefix/Curse' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Curse/dosdevices/c:/users/Public/Start\\ Menu/Programs/Curse/Curse\\ Client.lnk" },
  115.    { "Fallout 3", "env WINEPREFIX='/home/burchettm/.wineprefix/Fallout3' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Fallout3/dosdevices/c:/users/Public/Start\\ Menu/Programs/Bethesda\\ Softworks/Fallout\\ 3/Fallout\\ 3.lnk" },
  116.    { "Frets on Fire", "fretsonfire" },
  117.    { "GCFScape", "env WINEPREFIX='/home/burchettm/.wine' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wine/dosdevices/c:/users/Public/Start\\ Menu/Programs/GCFScape/GCFScape.lnk" },
  118.    { "GTA San Andreas", "env WINEPREFIX='/home/burchettm/.wineprefix/GTASA' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/GTASA/dosdevices/c:/users/Public/Start\\ Menu/Programs/Rockstar\\ Games/GTA\\ San\\ Andreas/Play\\ GTA\\ San\\ Andreas.lnk" },
  119.    { "Imprudence", "/usr/bin/imprudence-secondlife" },
  120.    { "Infiltration", "env WINEPREFIX='/home/burchettm/.wineprefix/UT' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/UT/dosdevices/c:/users/Public/Start\\ Menu/Programs/SentryStudios/Infiltration/Play\\ Infiltration.lnk" },
  121.    { "LinCity-NG", "lincity-ng" },
  122.    { "MaNGOLin", "/home/burchettm/Apps/MaNGOLin/MaNGOLin" },
  123.    { "MCEdit", "python26 -O '/home/burchettm/Apps/MCEdit-linux/MCEditData/mcedit.pyo'" },
  124.    { "Minecraft", "minecraft" },
  125.    { "Oblivion", "env WINEPREFIX='/home/burchettm/.wineprefix/Oblivion' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Oblivion/dosdevices/c:/users/Public/Start\\ Menu/Programs/Bethesda\\ Softworks/Oblivion/Oblivion.lnk" },
  126.    { "PlayOnLinux", "playonlinux" },
  127.    { "Second Life", "/usr/bin/secondlife" },
  128.    { "SimCity 4 Deluxe", "env WINEPREFIX='home/burchettm/.wineprefix/SimCity4' wine '/home/burchettm/.wineprefix/SimCity4/drive_c/Program Files/Maxis/SimCity 4 Deluxe/Apps/SimCity 4.exe' -intro:off -customresolution:enabled -r1920x1080x32" },
  129.    { "SLiteChat", "env WINEPREFIX='/home/burchettm/.wine' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wine/dosdevices/c:/users/Public/Start\\ Menu/Programs/SLiteChat\\ for\\ Windows/SLiteChat\\ -\\ Text-based\\ IM\\ client\\ for\\ Second\\ Life.lnk" },
  130.    { "Soldier of Fortune", "env WINEPREFIX='/home/burchettm/.wineprefix/SOF' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/SOF/dosdevices/c:/users/Public/Start\\ Menu/Programs/Raven\\ Software/Soldier\\ of\\ Fortune\\ Platinum/Soldier\\ of\\ Fortune\\ Platinum.lnk" },
  131.    { "Snowglobe 1.3", "snowglobe" },
  132.    { "Steam", "env WINEPREFIX='/home/burchettm/.wineprefix/Steam' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Steam/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/Steam/Steam.lnk" },
  133.    { "Strike Force 181", "env WINEPREFIX='/home/burchettm/.wineprefix/UT' wine C:\\\\unrealtournament\\\\System\\\\Strike\\ Force.exe" },
  134.    { "SuperTuxKart", "/usr/bin/supertuxkart --log=file" },
  135.    { "PyLoTRO", "pylotro" },
  136.    { "UT2004", "env WINEPREFIX='/home/burchettm/.wineprefix/UT' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/UT/dosdevices/c:/users/Public/Start\\ Menu/Programs/Unreal\\ Tournament\\ 2004/Play\\ UT2004.lnk" },
  137.    { "UTGOTY", "env WINEPREFIX='/home/burchettm/.wineprefix/UT' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/UT/dosdevices/c:/users/Public/Start\\ Menu/Programs/Unreal\\ Tournament\\ G.O.T.Y.\\ Edition/Play\\ Unreal\\ Tournament.lnk" },
  138.    { "World of Padman", "worldofpadman" },
  139.    { "WoW-Cataclysm", "wine '/media/Terabyte/WoW-Cataclysm/Launcher.exe" },
  140.    { "WoW-PTR", "env WINEPREFIX='/home/burchettm/.wine' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wine/dosdevices/c:/users/Public/Start\\ Menu/Programs/World\\ of\\ Warcraft\\ Public\\ Test/World\\ of\\ Warcraft.lnk" },
  141.    { "WoW-WotLK", "wine '/media/Terabyte/WoW-WoTLK/Wow.exe'" }
  142. }
  143.  
  144. mygraphicsmenu = {
  145.    { "Adobe ImageReady 7.0", "env WINEPREFIX='/home/burchettm/.wineprefix/Adobe' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Adobe/dosdevices/c:/users/Public/Start\\ Menu/Programs/Adobe\\ ImageReady\\ 7.0.lnk" },
  146.    { "Adobe PhotoShop 7.0", "env WINEPREFIX='/home/burchettm/.wineprefix/Adobe' wine '/home/burchettm/.wineprefix/Adobe/drive_c/Program Files/Adobe/Photoshop 7.0/Photoshop.exe'" },
  147.    { "Dreamweaver 8", "env WINEPREFIX='/home/burchettm/.wineprefix/Adobe' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Adobe/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/Macromedia/Macromedia\\ Dreamweaver\\ 8.lnk" },
  148.    { "IconsExtract", "env WINEPREFIX='/home/burchettm/.wine' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wine/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/NirSoft\\ IconsExtract/IconsExtract.lnk" },
  149.    { "GIMP", "gimp-2.6" },
  150.    { "LXDE Image Viewer", "gpicview" },
  151.    { "MCEdit", "python26 -O '/home/burchettm/Apps/MCEdit-linux/MCEditData/mcedit.pyo'" },
  152.    { "MS Paint", "env WINEPREFIX='/home/burchettm/.wine' wine '/home/burchettm/.wine/drive_c/windows/mspaint.exe'" },
  153.    { "Ristretto Photo Viewer", "ristretto" }
  154. }
  155.  
  156. myinternetmenu = {
  157.    { "Avahi SSH", "/usr/bin/bssh" },
  158.    { "Avahi VNC", "/usr/bin/bvnc" },
  159.    { "Chromium", "chromium" },
  160.    { "Curse Client", "env WINEPREFIX='/home/burchettm/.wineprefix/Curse' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Curse/dosdevices/c:/users/Public/Start\\ Menu/Programs/Curse/Curse\\ Client.lnk" },
  161.    { "Deluge", "deluge-gtk" },
  162.    { "Dropbox", "/opt/dropbox/dropboxd" },
  163.    { "FileZilla", "filezilla" },
  164.    { "Links", "xlinks -g" },
  165.    { "Mangler", "mangler" },
  166.    { "Midori", "midori" },
  167.    { "Mitter", "/usr/bin/mitter" },
  168.    { "MS RDP", "env WINEPREFIX='/home/burchettm/.wine' wine '/home/burchettm/.wine/drive_c/Program Files/RDP/mstsc.exe'" },
  169.    { "NeverNote", "/usr/share/nevernote/nevernote.sh" },
  170.    { "Opera", "/usr/bin/opera" },
  171.    { "Pidgin", "pidgin" },
  172.    { "qBittorent", "qbittorrent" },
  173.    { "QuickSynergy", "quicksynergy" },
  174.    { "SeaMonkey", "seamonkey" },
  175.    { "Skype", "skype" },
  176.    { "TeamSpeak 3", "/usr/bin/teamspeak3" },
  177.    { "TeamViewer", "/opt/teamviewer/teamviewer/6/bin/teamviewer" },
  178.    { "Thunderbird", "thunderbird" },
  179.    { "Transmission", "transmission-gtk" },
  180.    { "Turpial", "turpial" },
  181.    { "TweetDeck", "adobe-air /opt/tweetdeck/tweetdeck.air" },
  182.    { "WhizNet", "env WINEPREFIX='/home/burchettm/.wineprefix/Whizkid' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Whizkid/dosdevices/c:/users/Public/Start\\ Menu/Programs/Whizkid\\ Online/WhizNet/WhizNet.lnk" }
  183. }
  184.  
  185. myofficemenu = {
  186.    { "Dictionary", "xfce4-dict" },
  187.    { "Orage Calendar", "orage" },
  188.    { "Orage Globaltime", "globaltime" },
  189.    { "PDF Viewer", "epdfview" }
  190. }
  191.  
  192. myprogrammingmenu = {
  193.    { "Android SDK", "android" },
  194.    { "CMake", "cmake-gui" },
  195.    { "Dreamweaver 8", "env WINEPREFIX='/home/burchettm/.wineprefix/Adobe' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/Adobe/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/Macromedia/Macromedia\\ Dreamweaver\\ 8.lnk" },
  196.    { "Glade", "glade" },
  197.    { "Google Gadget Designer", "/usr/bin/ggl-gtk -sa -nd -gp /usr/share/google-gadgets/designer.gg" },
  198.    { "Qt Assistant", "/usr/bin/assistant" },
  199.    { "Qt Designer", "/usr/bin/designer" },
  200.    { "Qt Linguist", "/usr/bin/linguist" }
  201. }
  202.  
  203. mysoundmenu = {
  204.    { "AcetoneISO", "acetoneiso" },
  205.    { "Audacious", "audacious" },
  206.    { "Cheese", "cheese" },
  207.    { "dvd::rip", "/usr/bin/vendor_perl/dvdrip" },
  208.    { "EasyTAG", "easytag" },
  209.    { "Ex Falso", "exfalso" },
  210.    { "GNOME MPlayer", "gnome-mplayer" },
  211.    { "GNOME MPC", "gmpc" },
  212.    { "Goggles Music Manger", "gogglesmm" },
  213.    { "GTK-RecordMyDesktop", "gtk-recordmydesktop" },
  214.    { "HandBrake", "ghb" },
  215.    { "Last.FM", "lastfm" },
  216.    { "Mixer", "xfce4-mixer" },
  217.    { "Nero Linux", "nero" },
  218.    { "Nero Linux Express", "neroexpress" },
  219.    { "Pithos", "pithos" },
  220.    { "QT V4L2 Tester", "qv4l2" },
  221.    { "Quod Libet", "quodlibet" },
  222.    { "Sonata", "sonata" },
  223.    { "VLC", "vlc" },
  224.    { "VolWheel", "volwheel" },
  225.    { "Webcam Application", "wxcam" },
  226.    { "XBMC", "xbmc" },
  227.    { "Xfburn", "xfburn" }
  228. }
  229.  
  230. mysystemtoolsmenu = {
  231.    { "Avahi Zeroconf", "/usr/bin/avahi-discover" },
  232.    { "Bulk Rename", "/usr/lib/Thunar/ThunarBulkRename" },
  233.    { "Cairo-Dock", "cairo-dock -c" },
  234.    { "GLX-Dock", "cairo-dock -o" },
  235.    { "GParted", "gksu /usr/sbin/gparted" },
  236.    { "LXDE Task Manager", "lxtask" },
  237.    { "Manage Printing", "/usr/bin/xdg-open http://localhost:631/" },
  238.    { ".NET 1.1 Configuration", "env WINEPREFIX='/home/burchettm/.wineprefix/SOF' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/SOF/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/Administrative\\ Tools/Microsoft\\ .NET\\ Framework\\ 1.1\\ Configuration.lnk" },
  239.    { ".NET 1.1 Wizards", "env WINEPREFIX='/home/burchettm/.wineprefix/SOF' wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/burchettm/.wineprefix/SOF/dosdevices/c:/users/burchettm/Start\\ Menu/Programs/Administrative\\ Tools/Microsoft\\ .NET\\ Framework\\ 1.1\\ Wizards.lnk" },
  240.    { "RXVT-Unicode", "urxvt" },
  241.    { "Terminal", "terminal" },
  242.    { "Thunar", "Thunar" },
  243.    { "UNetBootIn", "/usr/bin/unetbootin" },
  244.    { "VMware Player", "/usr/bin/vmplayer" },
  245.    { "VMware Workstation", "/usr/bin/vmware" },
  246.    { "VirtualBox", "VirtualBox" },
  247.    { "Virtual Network Editor", "/usr/bin/vmware-netcfg" },
  248.    { "Wireshark", "Wireshark" },
  249.    { "XFCE Task Manager", "xfce4-taskmanager" }
  250. }
  251.  
  252. mymainmenu = awful.menu({ items = { { " ", " " },
  253.                                     { "Opera", "opera" },
  254.                                     { "Pidgin", "pidgin" },
  255.                                     { "Skype", "skype" },
  256.                                     { "Sonata", "sonata" },
  257.                                     { "TeamSpeak3", "teamspeak3" },
  258.                                     { "Terminal", "sakura" },
  259.                                     { "Turpial", "turpial" },
  260.                                     { " ", " " },
  261.                                     { "Accessories", myaccessoriesmenu, beautiful.menu_accessories },
  262.                                     { "Arch Linux" , myarchmenu, beautiful.arch_icon },
  263.                                     { "Games", mygamesmenu, beautiful.menu_games },
  264.                                     { "Graphics", mygraphicsmenu, beautiful.menu_graphics },
  265.                                     { "Internet", myinternetmenu, beautiful.menu_internet },
  266.                                     { "Office", myofficemenu, beautiful.menu_office },
  267.                                     { "Programming", myprogrammingmenu, beautiful.menu_programming },
  268.                                     { "Sound & Video", mysoundmenu, beautiful.menu_sound },
  269.                                     { "System Tools", mysystemtoolsmenu, beautiful.menu_system },
  270.                                     { " ", " " },
  271.                                     { "Awesome", myawesomemenu, beautiful.awesome_icon }
  272.                                   }
  273.                         })
  274.  
  275. mylauncher = awful.widget.launcher({ image = image(beautiful.arch_icon),
  276.                                      menu = mymainmenu })
  277.  
  278. -- -- WIBOXES -- --
  279.  
  280. mywibox = {}
  281. mypromptbox = {}
  282. mylayoutbox = {}
  283. mytaglist = {}
  284. mytaglist.buttons = awful.util.table.join(
  285.                     awful.button({ }, 1, awful.tag.viewonly),
  286.                     awful.button({ modkey }, 1, awful.client.movetotag),
  287.                     awful.button({ }, 3, awful.tag.viewtoggle),
  288.                     awful.button({ modkey }, 3, awful.client.toggletag),
  289.                     awful.button({ }, 4, awful.tag.viewnext),
  290.                     awful.button({ }, 5, awful.tag.viewprev)
  291.                     )
  292. mytasklist = {}
  293. mytasklist.buttons = awful.util.table.join(
  294.                      awful.button({ }, 1, function (c)
  295.                                               if not c:isvisible() then
  296.                                                   awful.tag.viewonly(c:tags()[1])
  297.                                               end
  298.                                               client.focus = c
  299.                                               c:raise()
  300.                                           end),
  301.                      awful.button({ }, 3, function ()
  302.                                               if instance then
  303.                                                   instance:hide()
  304.                                                   instance = nil
  305.                                               else
  306.                                                   instance = awful.menu.clients({ width=250 })
  307.                                               end
  308.                                           end),
  309.                      awful.button({ }, 4, function ()
  310.                                               awful.client.focus.byidx(1)
  311.                                               if client.focus then client.focus:raise() end
  312.                                           end),
  313.                      awful.button({ }, 5, function ()
  314.                                               awful.client.focus.byidx(-1)
  315.                                               if client.focus then client.focus:raise() end
  316.                                           end))
  317.  
  318. for s = 1, screen.count() do
  319.     -- Create a promptbox for each screen
  320.     mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  321.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  322.  
  323.     -- We need one layoutbox per screen.
  324.     mylayoutbox[s] = awful.widget.layoutbox(s)
  325.     mylayoutbox[s]:buttons(awful.util.table.join(
  326.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  327.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  328.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  329.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  330. -- WIDGETS --
  331.  
  332. -- TEXT CLOCK --
  333. mytextclock = awful.widget.textclock({ align = "right" }, " %a, %Y/%m/%d | %H:%M:%S ", 1)
  334.  
  335. -- SYSTRAY --
  336. mysystray = widget({ type = "systray" })
  337.  
  338. -- MPD --
  339. -- Initialize Widget
  340. --mpdwidget = widget({ type = "textbox" })
  341. --  Register widget
  342. --vicious.register(mpdwidget, vicious.widgets.mpd,
  343. --    function (widget, args)
  344. --        if args["{state}"] == "Stop" then
  345. --           return "MPD - Stopped "
  346. --        else
  347. --           return args["{Artist}"]..' - '.. args["{Title}"]
  348. --        end
  349. --   end, 10)
  350.  
  351. -- TAG LIST --
  352.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  353.  
  354. -- TASKLIST --
  355.     mytasklist[s] = awful.widget.tasklist(function(c)
  356.                                               return awful.widget.tasklist.label.currenttags(c, s)
  357.                                           end, mytasklist.buttons)
  358.  
  359. -- TOP BOX --
  360.     mywibox[s] = awful.wibox({ position = "top", screen = s })
  361.     -- Add widgets to the wibox - order matters
  362.     mywibox[s].widgets = {
  363.         {
  364.             mylauncher,
  365.             mytaglist[s],
  366.             mypromptbox[s],
  367.             layout = awful.widget.layout.horizontal.leftright
  368.         },
  369.         mylayoutbox[s],
  370.         mytextclock,
  371.         s == 1 and mysystray or nil,
  372.         mytasklist[s],
  373.         layout = awful.widget.layout.horizontal.rightleft
  374.     }
  375. end
  376.  
  377. -- BOTTOM BOX --
  378.  
  379. --infobox[s] = awful.wibox({ position = "bottom", screen = s })
  380. --infobox[s].widgets = {
  381. --  mpdwidget, layout = awful.widget.layout.horizontal.leftright, }
  382.  
  383. -- -- BINDINGS -- --
  384.  
  385. -- MOUSE --
  386. root.buttons(awful.util.table.join(
  387.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  388.     awful.button({ }, 4, awful.tag.viewnext),
  389.     awful.button({ }, 5, awful.tag.viewprev)
  390. ))
  391.  
  392. -- KEYBOARD --
  393. globalkeys = awful.util.table.join(
  394.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  395.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  396.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  397.     awful.key({ modkey,           }, "j",
  398.         function ()
  399.             awful.client.focus.byidx( 1)
  400.             if client.focus then client.focus:raise() end
  401.         end),
  402.     awful.key({ modkey,           }, "k",
  403.         function ()
  404.             awful.client.focus.byidx(-1)
  405.             if client.focus then client.focus:raise() end
  406.         end),
  407.     awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),
  408.  
  409.     -- User Added Keybindings
  410.     awful.key({}, "Print", function () awful.util.spawn("scrotshooter") end),
  411.     awful.key({}, "Alt_Sys_Req", function () awful.util.spawn("scrotshooter-aprint") end),
  412.     awful.key({}, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 5%+") end),
  413.     awful.key({}, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 5%-") end),
  414.     awful.key({}, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle") end),
  415.  
  416.  
  417.     -- Layout manipulation
  418.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  419.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  420.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  421.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  422.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  423.     awful.key({ modkey,           }, "Tab",
  424.         function ()
  425.             awful.client.focus.history.previous()
  426.             if client.focus then
  427.                 client.focus:raise()
  428.             end
  429.         end),
  430.  
  431.     -- Standard program
  432.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  433.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  434.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  435.  
  436.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  437.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  438.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  439.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  440.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  441.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  442.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  443.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  444.  
  445.     -- Prompt
  446.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  447.  
  448.     awful.key({ modkey }, "x",
  449.               function ()
  450.                   awful.prompt.run({ prompt = "Run Lua code: " },
  451.                   mypromptbox[mouse.screen].widget,
  452.                   awful.util.eval, nil,
  453.                   awful.util.getdir("cache") .. "/history_eval")
  454.               end)
  455. )
  456.  
  457. clientkeys = awful.util.table.join(
  458.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  459.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  460.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  461.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  462.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  463.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  464.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  465.     awful.key({ modkey,           }, "n",      function (c) c.minimized = not c.minimized    end),
  466.     awful.key({ modkey,           }, "m",
  467.         function (c)
  468.             c.maximized_horizontal = not c.maximized_horizontal
  469.             c.maximized_vertical   = not c.maximized_vertical
  470.         end)
  471. )
  472.  
  473. -- Compute the maximum number of digit we need, limited to 9
  474. keynumber = 0
  475. for s = 1, screen.count() do
  476.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  477. end
  478.  
  479. -- Bind all key numbers to tags.
  480. -- Be careful: we use keycodes to make it works on any keyboard layout.
  481. -- This should map on the top row of your keyboard, usually 1 to 9.
  482. for i = 1, keynumber do
  483.     globalkeys = awful.util.table.join(globalkeys,
  484.         awful.key({ modkey }, "#" .. i + 9,
  485.                   function ()
  486.                         local screen = mouse.screen
  487.                         if tags[screen][i] then
  488.                             awful.tag.viewonly(tags[screen][i])
  489.                         end
  490.                   end),
  491.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  492.                   function ()
  493.                       local screen = mouse.screen
  494.                       if tags[screen][i] then
  495.                           awful.tag.viewtoggle(tags[screen][i])
  496.                       end
  497.                   end),
  498.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  499.                   function ()
  500.                       if client.focus and tags[client.focus.screen][i] then
  501.                           awful.client.movetotag(tags[client.focus.screen][i])
  502.                       end
  503.                   end),
  504.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  505.                   function ()
  506.                       if client.focus and tags[client.focus.screen][i] then
  507.                           awful.client.toggletag(tags[client.focus.screen][i])
  508.                       end
  509.                   end))
  510. end
  511.  
  512. clientbuttons = awful.util.table.join(
  513.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  514.     awful.button({ modkey }, 1, awful.mouse.client.move),
  515.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  516.  
  517. -- Set keys
  518. root.keys(globalkeys)
  519.  
  520. -- -- RULES -- --
  521.  
  522. awful.rules.rules = {
  523.     -- All clients will match this rule.
  524.     { rule = { },
  525.       properties = { border_width = beautiful.border_width,
  526.                      border_color = beautiful.border_normal,
  527.                      focus = true,
  528.                      keys = clientkeys,
  529.                      buttons = clientbuttons } },
  530.     { rule = { class = "MPlayer" },
  531.       properties = { floating = true } },
  532.     { rule = { class = "pinentry" },
  533.       properties = { floating = true } },
  534.     { rule = { class = "gimp" },
  535.       properties = { floating = true } },
  536.     { rule = { class = "Opera" }, properties = { tag = tags[1][3] } },
  537.     { rule = { class = "Pidgin" }, properties = { tag = tags[1][4] } },
  538.     { rule = { class = "Skype" }, properties = { tag = tags[1][4] } },
  539.     { rule = { class = "Sonata" }, properties = { tag = tags[1][5] } },
  540.     { rule = { class = "Turpial" }, properties = { tag = tags[1][6] } },
  541.     -- Set Firefox to always map on tags number 2 of screen 1.
  542.     -- { rule = { class = "Firefox" },
  543.     --   properties = { tag = tags[1][2] } },
  544. }
  545.  
  546. -- -- SIGNALS -- --
  547.  
  548. -- Signal function to execute when a new client appears.
  549. client.add_signal("manage", function (c, startup)
  550.     -- Add a titlebar
  551.     -- awful.titlebar.add(c, { modkey = modkey })
  552.  
  553.     -- Enable sloppy focus
  554.     c:add_signal("mouse::enter", function(c)
  555.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  556.             and awful.client.focus.filter(c) then
  557.             client.focus = c
  558.         end
  559.     end)
  560.  
  561.     if not startup then
  562.         -- Set the windows at the slave,
  563.         -- i.e. put it at the end of others instead of setting it master.
  564.         -- awful.client.setslave(c)
  565.  
  566.         -- Put windows in a smart way, only if they does not set an initial position.
  567.         if not c.size_hints.user_position and not c.size_hints.program_position then
  568.             awful.placement.no_overlap(c)
  569.             awful.placement.no_offscreen(c)
  570.         end
  571.     end
  572. end)
Advertisement
Add Comment
Please, Sign In to add comment