mattburchett

Revamped RC.Lua

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