+
+function handle_new_autorandr_profile(newprofile)
+ -- The main idea here is that autorandr invokes this via awesome-client
+ -- after switching to a new profile. Awesome will have already set up all
+ -- the screens long before this function is called. Therefore, we just do
+ -- the necessary modifications to the existing screens, and move tags
+ -- around.
+
+ if not newprofile then
+ error("Missing new profile name")
+ end
+
+ naughty.notify({
+ preset = naughty.config.presets.low,
+ title = "New autorandr profile",
+ text = "Reconfiguring for profile <b>" .. newprofile .. "</b>",
+ })
+
+ for s in screen do
+ s:set_profile(newprofile)
+ end
+ move_tags_to_target_screens()
+end
+
+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 = "vrt",
+ init = true,
+ exclusive = true,
+ layout = layouts.maximised,
+ selected = false,
+ exec_once = { "remmina" },
+ instance = { "Remmina" },
+ targets = {
+ "gern/DP-?[12]-1",
+ "gauting/eDP-?1",
+ "toni/eDP-?1",
+ "krafftwerk/DP-?1-1-5",
+ "krafftwerk/DisplayPort-2",
+ "cafe/eDP-?1"
+ },
+ },
+ {
+ name = "irc",
+ init = true,
+ exclusive = true,
+ layout = layouts.tiled,
+ selected = false,
+ exec_once = { terminal .. " -name irc -e env MOSH_TITLE_NOPREFIX=true mosh --family=all -- irc-host tmux new -As irc irssi" },
+ instance = { "irc" },
+ targets = {
+ "gern/DP-?[12]-1",
+ "gauting/eDP-?1",
+ "toni/eDP-?1",
+ "krafftwerk/DP-?1-1-5",
+ "krafftwerk/DisplayPort-2",
+ "cafe/eDP-?1"
+ },
+ },
+ {
+ name = "[]",
+ init = true,
+ exclusive = true,
+ master_count = 0,
+ column_count = 4,
+ layout = layouts.tiled,
+ selected = false,
+ targets = {
+ "gern/DP-?[12]-1",
+ "gauting/eDP-?1",
+ "toni/eDP-?1",
+ "krafftwerk/DP-?1-1-5",
+ "krafftwerk/DisplayPort-2",
+ "cafe/eDP-?1"
+ },
+ },
+ {
+ 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 = {
+ "gern/DP-?[12]-1",
+ "gauting/eDP-?1",
+ "toni/eDP-?1",
+ "krafftwerk/DP-?1-1-6",
+ "krafftwerk/DisplayPort-0",
+ "cafe/eDP-?1"
+ },
+ },
+ {
+ name = "chr",
+ init = true,
+ exclusive = true,
+ layout = layouts.default,
+ exec_once = { "chromium" },
+ class = { "Chromium" },
+ targets = {
+ "gern/DP-?[12]-1",
+ "gauting/eDP-?1",
+ "toni/DP-?2-2",
+ "krafftwerk/DP-?1-1-6",
+ "krafftwerk/DisplayPort-0",
+ "present/HDMI.*",
+ "cafe/eDP-?1"
+ },
+ },
+ {
+ name = "ffx",
+ init = true,
+ exclusive = true,
+ layout = layouts.default,
+ exec_once = { "firefox" },
+ class = { "Firefox" },
+ targets = {
+ "gern/DP-?[12]-1",
+ "gauting/eDP-?1",
+ "toni/DP-?2-2",
+ "krafftwerk/DP-?1-1-6",
+ "krafftwerk/DisplayPort-0",
+ "present/HDMI.*",
+ "cafe/eDP-?1"
+ },
+ },
+})
+
+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 -- }}}
+