]> git.rmz.io Git - dotfiles.git/blob - awesome/rc.lua
create utils module, with function to run or kill
[dotfiles.git] / awesome / rc.lua
1 -- Standard awesome library
2 gears = require("gears")
3 awful = require("awful")
4 awful.rules = require("awful.rules")
5 require("awful.autofocus")
6 -- Theme handling library
7 beautiful = require("beautiful")
8 -- Notification library
9 naughty = require("naughty")
10 menubar = require("menubar")
11 -- Pulseaudio widget
12 --local APW = require("apw/widget")
13
14 -- {{{ Error handling
15 -- Check if awesome encountered an error during startup and fell back to
16 -- another config (This code will only ever execute for the fallback config)
17 if awesome.startup_errors then
18 naughty.notify({ preset = naughty.config.presets.critical,
19 title = "Oops, there were errors during startup!",
20 text = awesome.startup_errors })
21 end
22
23 -- Handle runtime errors after startup
24 do
25 local in_error = false
26 awesome.connect_signal("debug::error", function (err)
27 -- Make sure we don't go into an endless error loop
28 if in_error then return end
29 in_error = true
30
31 naughty.notify({ preset = naughty.config.presets.critical,
32 title = "Oops, an error happened!",
33 text = err })
34 in_error = false
35 end)
36 end
37 -- }}}
38
39 -- {{{ Variable definitions
40 -- Themes define colours, icons, and wallpapers
41 beautiful.init("/usr/share/awesome/themes/default/theme.lua")
42
43 -- This is used later as the default terminal and editor to run.
44 terminal = "konsole"
45 editor = os.getenv("EDITOR") or "vim"
46 editor_cmd = terminal .. " -e " .. editor
47
48 -- Default modkey.
49 -- Usually, Mod4 is the key with a logo between Control and Alt.
50 -- If you do not like this or do not have such a key,
51 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
52 -- However, you can use another modifier like Mod1, but it may interact with others.
53 modkey = "Mod4"
54
55 -- Tags
56 require("tags")
57 -- }}}
58
59 -- {{{ Wallpaper
60 if beautiful.wallpaper then
61 for s = 1, screen.count() do
62 gears.wallpaper.maximized(beautiful.wallpaper, s, true)
63 end
64 end
65 -- }}}
66
67 --Menu
68 require("menu")
69
70 -- Topbar
71 require("topbar")
72
73 -- Mouse/Key Bindings
74 require("bindings")
75
76 -- Rules
77 require("rules")
78
79 -- {{{ Signals
80 -- Signal function to execute when a new client appears.
81 client.connect_signal("manage", function (c, startup)
82 -- Enable sloppy focus
83 c:connect_signal("mouse::enter", function(c)
84 if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
85 and awful.client.focus.filter(c) then
86 client.focus = c
87 end
88 end)
89
90 if not startup then
91 -- Set the windows at the slave,
92 -- i.e. put it at the end of others instead of setting it master.
93 -- awful.client.setslave(c)
94
95 -- Put windows in a smart way, only if they does not set an initial position.
96 if not c.size_hints.user_position and not c.size_hints.program_position then
97 awful.placement.no_overlap(c)
98 awful.placement.no_offscreen(c)
99 end
100 end
101 end)
102
103 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
104 client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
105 -- }}}
106
107 -- {{{ Autostart applications
108 require("autostart")
109 -- }}}