+local function initialise_to_autorandr_profile()
+ local profile
+ profile = nil
+
+ local function process_line(line)
+ if profile then return end
+ local match = string.match(line, "^([^%s]+) %(detected%)")
+ if match then
+ profile = match
+ end
+ end
+
+ local function output_done()
+ if not profile then
+ error("autorandr detected no profile")
+ profile = "awesome"
+ end
+ handle_new_autorandr_profile(profile)
+ end
+
+ local function handle_exit(reason, code)
+ if not (reason == "exit" and code == 0) then
+ error("autorandr error: " .. reason .. ": " .. tostring(code))
+ end
+ end
+
+ awful.spawn.with_line_callback('autorandr', {
+ stdout = process_line,
+ output_done = output_done,
+ exit = handle_exit
+ })
+end
+awesome.connect_signal("startup", initialise_to_autorandr_profile)
+-- }}}
+
+-- }}}
+
+-- {{{ Tags
+
+local default_tag = {
+ name = nil,
+ init = true,
+ layout = layouts.default,
+ fallback = true,
+ targets = "primary",
+}
+local default_tags = {}
+for i = 1, 9 do
+ default_tags[i] = {}
+ for k,v in pairs(default_tag) do
+ default_tags[i][k] = v
+ end
+ default_tags[i].name = tostring(i)
+end
+default_tags[1].selected = true
+
+default_tags = gears.table.join(default_tags, {
+ {
+ name = "irc",
+ init = true,
+ exclusive = true,
+ master_width_factor = 0.33,
+ layout = layouts.tiled,
+ selected = true,
+ exec_once = { terminal .. " -name irc -e env MOSH_TITLE_NOPREFIX=true mosh --family=all -- irc-host tmux new -As irc irssi" },
+ instance = { "irc" },
+ targets = { "catalyst1?/eDP-?1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-2" },
+ },
+ {
+ name = "[m]",
+ init = true,
+ exclusive = true,
+ master_width_factor = 0.67,
+ layout = layouts.tiled,
+ selected = false,
+ exec_once = { "revolt" },
+ instance = { "Revolt" },
+ targets = { "catalyst1?/eDP-?1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-2" },
+ },
+ {
+ name = "dflt",
+ init = false,
+ fallback = true,
+ layout = layouts.floating,
+ volatile = true,
+ selected = true,
+ },
+ {
+ name = "cal",
+ init = true,
+ exclusive = true,
+ layout = layouts.default,
+ exec_once = { "thunderbird" },
+ class = { "thunderbird" },
+ targets = { "catalyst1?/DP-?[12]-1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-1" },
+ },
+ {
+ name = "chr",
+ init = true,
+ exclusive = true,
+ layout = layouts.default,
+ exec_once = { "chromium" },
+ class = { "Chromium" },
+ targets = { "catalyst1?/DP-?[12]-1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-1", "present/HDMI.*" },
+ },
+ {
+ name = "ffx",
+ init = true,
+ exclusive = true,
+ layout = layouts.default,
+ exec_once = { "firefox" },
+ class = { "Firefox" },
+ targets = { "catalyst1?/DP-?[12]-1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-1", "present/HDMI.*" },
+ },
+})
+
+if not tyrannical then
+
+for _,t in ipairs(default_tags) do
+ if t.init then
+ t.screen = t.screen or screen.primary
+ t.layout = t.layout or layouts.default
+ local newt = th.add_tag(t.name, t, false)
+ end
+end
+
+else -- {{{ tyrannical is loaded
+tyrannical.settings.default_layout = layouts.default
+tyrannical.settings.master_width_factor = 0.5
+tyrannical.settings.block_children_focus_stealing = true
+tyrannical.settings.group_children = true
+
+tyrannical.tags = default_tags
+
+tyrannical.properties.size_hints_honor = { URxvt = false }
+
+--XX---- Ignore the tag "exclusive" property for the following clients (matched by classes)
+--XX--tyrannical.properties.intrusive = {
+--XX-- "ksnapshot" , "pinentry" , "gtksu" , "kcalc" , "xcalc" ,
+--XX-- "feh" , "Gradient editor", "About KDE" , "Paste Special", "Background color" ,
+--XX-- "kcolorchooser" , "plasmoidviewer" , "Xephyr" , "kruler" , "plasmaengineexplorer",
+--XX--}
+--XX--
+--XX---- Ignore the tiled layout for the matching clients
+--XX--tyrannical.properties.floating = {
+--XX-- "MPlayer" , "pinentry" , "ksnapshot" , "pinentry" , "gtksu" ,
+--XX-- "xine" , "feh" , "kmix" , "kcalc" , "xcalc" ,
+--XX-- "yakuake" , "Select Color$" , "kruler" , "kcolorchooser", "Paste Special" ,
+--XX-- "New Form" , "Insert Picture" , "kcharselect", "mythfrontend" , "plasmoidviewer"
+--XX--}
+--XX--
+--XX---- Make the matching clients (by classes) on top of the default layout
+--XX--tyrannical.properties.ontop = {
+--XX-- "Xephyr" , "ksnapshot" , "kruler"
+--XX--}
+--XX--
+--XX---- Force the matching clients (by classes) to be centered on the screen on init
+--XX--tyrannical.properties.centered = {
+--XX-- "kcalc"
+--XX--}
+end -- }}}
+