awesome/rc.lua
changeset 8 0eae48be1d62
parent 7 03125e413ae3
child 11 7226709dc4c4
equal deleted inserted replaced
7:03125e413ae3 8:0eae48be1d62
    43 -- Uncommment this for a lighter theme
    43 -- Uncommment this for a lighter theme
    44 theme_path = "/usr/share/awesome/themes/sky/theme.lua"
    44 theme_path = "/usr/share/awesome/themes/sky/theme.lua"
    45 
    45 
    46 -- This is used later as the default terminal and editor to run.
    46 -- This is used later as the default terminal and editor to run.
    47 terminal = "x-terminal-emulator"
    47 terminal = "x-terminal-emulator"
       
    48 -- terminal = "terminology"
    48 editor = os.getenv("EDITOR") or "editor"
    49 editor = os.getenv("EDITOR") or "editor"
    49 editor_cmd = terminal .. " -e " .. editor
    50 editor_cmd = terminal .. " -e " .. editor
    50 browser = "iceweasel"
    51 browser = "iceweasel"
    51 mail = "icedove"
    52 mail = "icedove"
    52 musicplayer = "ario"
    53 musicplayer = "ario"
    53 monitor = "gnome-system-monitor"
    54 monitor = "gnome-system-monitor"
    54 filemanager = "pcmanfm"
    55 filemanager = "pcmanfm"
    55 lookup = "pcmanfm -f"
    56 lookup = "pcmanfm -f"
    56 calculator = "galculator"
    57 calculator = "galculator"
       
    58 -- Logout method
       
    59 -- logout = awesome.quit
       
    60 logout = my.mkspawn("obsession-logout")
    57 
    61 
    58 -- Default modkey.
    62 -- Default modkey.
    59 -- Usually, Mod4 is the key with a logo between Control and Alt.
    63 -- Usually, Mod4 is the key with a logo between Control and Alt.
    60 -- If you do not like this or do not have such a key, I suggest you to remap
    64 -- If you do not like this or do not have such a key, I suggest you to remap
    61 -- Mod4 to another key using xmodmap or other tools.  However, you can use
    65 -- Mod4 to another key using xmodmap or other tools.  However, you can use
    87    }
    91    }
    88 
    92 
    89 -- Define if we want to use titlebar on all applications.
    93 -- Define if we want to use titlebar on all applications.
    90 use_titlebar = true
    94 use_titlebar = true
    91 
    95 
       
    96 -- Remove the focus follow mouse install by shifty.
       
    97 shifty.config.sloppy = false
       
    98 
    92 -- Shifty configured tags.
    99 -- Shifty configured tags.
    93 shifty.config.tags = {
   100 shifty.config.tags = {
    94    w1 = {
   101    w1 = {
    95       layout    = awful.layout.suit.tile,
   102       layout    = awful.layout.suit.tile,
    96       mwfact    = 0.60,
   103       mwfact    = 0.60,
   103    web = {
   110    web = {
   104       layout      = awful.layout.suit.tile.bottom,
   111       layout      = awful.layout.suit.tile.bottom,
   105       mwfact      = 0.65,
   112       mwfact      = 0.65,
   106       exclusive   = true,
   113       exclusive   = true,
   107       max_clients = 1,
   114       max_clients = 1,
   108       position    = 4,
   115       position    = 2,
   109       spawn       = browser,
   116       spawn       = browser,
   110    },
   117    },
   111    mail = {
   118    mail = {
   112       layout    = awful.layout.suit.tile,
   119       layout    = awful.layout.suit.tile,
   113       mwfact    = 0.55,
   120       mwfact    = 0.55,
   114       exclusive = false,
   121       exclusive = false,
   115       position  = 5,
   122       position  = 3,
   116       spawn     = mail,
   123       spawn     = mail,
   117       slave     = true
   124       slave     = true
       
   125    },
       
   126    steam = {
       
   127       layout      = awful.layout.suit.float,
       
   128       mwfact      = 0.65,
       
   129       exclusive   = true,
       
   130       spawn       = "steam",
       
   131       position    = 4,
   118    },
   132    },
   119    media = {
   133    media = {
   120       layout    = awful.layout.suit.float,
   134       layout    = awful.layout.suit.float,
   121       exclusive = false,
   135       exclusive = false,
   122       position  = 8,
   136       position  = 5,
   123       spawn     = musicplayer
   137       spawn     = musicplayer
   124    },
   138    },
   125    office = {
   139    office = {
   126       layout   = awful.layout.suit.tile,
   140       layout   = awful.layout.suit.tile,
   127       position = 9,
   141       position = 6,
   128    },
       
   129    steam = {
       
   130       layout      = awful.layout.suit.max,
       
   131       mwfact      = 0.65,
       
   132       exclusive   = true,
       
   133       spawn       = "steam",
       
   134       position    = 6,
       
   135    },
   142    },
   136 }
   143 }
   137 
   144 
   138 -- SHIFTY: application matching rules
   145 -- SHIFTY: application matching rules
   139 -- order here matters, early rules will be applied first
   146 -- order here matters, early rules will be applied first
   206    {
   213    {
   207       match = { "Steam" },
   214       match = { "Steam" },
   208       tag = "steam",
   215       tag = "steam",
   209    },
   216    },
   210    {
   217    {
       
   218       match = { "kupfer.py" },
       
   219       slave = true,
       
   220    },
       
   221    {
   211       match = {""},
   222       match = {""},
   212       buttons = awful.util.table.join(
   223       buttons = awful.util.table.join(
   213          awful.button({}, 1, function (c) client.focus = c; c:raise() end),
   224          awful.button({}, 1, function (c) client.focus = c; c:raise() end),
   214          awful.button({modkey}, 1, function(c)
   225          awful.button({modkey}, 1, function(c)
   215                client.focus = c
   226                client.focus = c
   216                c:raise()
   227                c:raise()
   217                awful.mouse.client.move(c)
   228                awful.mouse.client.move(c)
       
   229                -- awful.mouse.client.dragtotag.border(c)
       
   230                -- awful.mouse.client.dragtotag.widget(c)
   218          end),
   231          end),
   219          awful.button({modkey}, 3, awful.mouse.client.resize)
   232          awful.button({modkey}, 3, awful.mouse.client.resize)
   220       )
   233       )
   221    },
   234    },
   222 }
   235 }
   228 --                 new (unconfigured) tags?
   241 --                 new (unconfigured) tags?
   229 --  * guess_position: as above, but for position parameter
   242 --  * guess_position: as above, but for position parameter
   230 --  * run : function to exec when shifty creates a new tag
   243 --  * run : function to exec when shifty creates a new tag
   231 --  * all other parameters (e.g. layout, mwfact) follow awesome's tag API
   244 --  * all other parameters (e.g. layout, mwfact) follow awesome's tag API
   232 shifty.config.defaults = {
   245 shifty.config.defaults = {
   233    layout = awful.layout.suit.tile.bottom,
   246    layout = awful.layout.suit.tile,
   234    ncol = 1,
   247    ncol = 1,
   235    mwfact = 0.60,
   248    mwfact = 0.60,
   236    floatBars = true,
   249    floatBars = true,
   237    guess_name = true,
   250    guess_name = true,
   238    guess_position = true,
   251    guess_position = true,
   386             my.mkinteractive(function() shifty.add({nopopup = true}) end)),
   399             my.mkinteractive(function() shifty.add({nopopup = true}) end)),
   387    my.make_key("Up", "View prev",
   400    my.make_key("Up", "View prev",
   388             function () awful.tag.viewprev(); return true; end),
   401             function () awful.tag.viewprev(); return true; end),
   389    my.make_key("Down", "View next", 
   402    my.make_key("Down", "View next", 
   390             function () awful.tag.viewnext(); return true; end),
   403             function () awful.tag.viewnext(); return true; end),
   391    my.make_key("Shift+Up", "Move tag left", 
   404    my.make_key("Shift+Up", "Move tag right", 
   392             function()
   405             function()
   393                local t = awful.tag.selected()
   406                local t = awful.tag.selected()
   394                local s = awful.util.cycle(screen.count(), t.screen + 1)
   407                local s = awful.util.cycle(screen.count(), t.screen + 1)
   395                awful.tag.history.restore()
   408                awful.tag.history.restore()
   396                t = shifty.tagtoscr(s, t)
   409                t = shifty.tagtoscr(s, t)
   397                awful.tag.viewonly(t)
   410                awful.tag.viewonly(t)
   398                return true
   411                return true
   399    end),
   412    end),
   400    my.make_key("Shift+Right", "Move tag left", 
   413    my.make_key("Shift+Down", "Move tag left", 
   401             function()
   414             function()
   402                local t = awful.tag.selected()
   415                local t = awful.tag.selected()
   403                local s = awful.util.cycle(screen.count(), t.screen + 1)
   416                local s = awful.util.cycle(screen.count(), t.screen - 1)
   404                awful.tag.history.restore()
   417                awful.tag.history.restore()
   405                t = shifty.tagtoscr(s, t)
   418                t = shifty.tagtoscr(s, t)
   406                awful.tag.viewonly(t)
   419                awful.tag.viewonly(t)
   407                return true
   420                return true
   408    end),
   421    end),
   416    -- my.make_key("k", "Kill all clients", 
   429    -- my.make_key("k", "Kill all clients", 
   417    --             function () 
   430    --             function () 
   418    --                for client.
   431    --                for client.
   419    --                my.kill_all(function (c)
   432    --                my.kill_all(function (c)
   420    my.make_key("r", "Restart", awesome.restart),
   433    my.make_key("r", "Restart", awesome.restart),
   421    my.make_key("q", "Quit", awesome.quit),
   434    my.make_key("q", "Quit", logout),
   422    my.make_key("t", "Terminal", my.mkspawn(terminal)),
   435    my.make_key("t", "Terminal", my.mkspawn(terminal)),
       
   436    my.make_key("f", "Toggle sloppy mouse", my.sloppy_toggle)
   423 }
   437 }
   424 
   438 
   425 local layout_keys = {
   439 local layout_keys = {
   426    my.make_key("Right", "Focus right",
   440    my.make_key("Right", "Focus right",
   427             function () awful.client.focus.bydirection("right"); return true end),
   441             function () awful.client.focus.bydirection("right"); return true end),
   588 for i = 1, (shifty.config.maxtags or #number_row) do
   602 for i = 1, (shifty.config.maxtags or #number_row) do
   589    local k = number_row[i-1]
   603    local k = number_row[i-1]
   590    globalkeys = awful.util.table.join(
   604    globalkeys = awful.util.table.join(
   591       globalkeys,
   605       globalkeys,
   592       awful.key({modkey}, k, function()
   606       awful.key({modkey}, k, function()
   593             local t =  awful.tag.viewonly(shifty.getpos(i))
   607             local t =  awful.tag.viewonly(shifty.getpos(i-1))
   594       end),
   608       end),
   595       awful.key({modkey, "Control"}, k, function()
   609       awful.key({modkey, "Control"}, k, function()
   596             local t = shifty.getpos(i)
   610             local t = shifty.getpos(i-1)
   597             t.selected = not t.selected
   611             t.selected = not t.selected
   598       end),
   612       end),
   599       awful.key({modkey, "Control", "Shift"}, k, function()
   613       awful.key({modkey, "Control", "Shift"}, k, function()
   600             if client.focus then
   614             if client.focus then
   601                awful.client.toggletag(shifty.getpos(i))
   615                awful.client.toggletag(shifty.getpos(i-1))
   602             end
   616             end
   603       end),
   617       end),
   604       -- move clients to other tags
   618       -- move clients to other tags
   605       awful.key({modkey, "Shift"}, k, function()
   619       awful.key({modkey, "Shift"}, k, function()
   606             if client.focus then
   620             if client.focus then
   607                t = shifty.getpos(i)
   621                t = shifty.getpos(i-1)
   608                awful.client.movetotag(t)
   622                awful.client.movetotag(t)
   609                awful.tag.viewonly(t)
   623                awful.tag.viewonly(t)
   610             end
   624             end
   611    end))
   625    end))
   612 end
   626 end
   627 -- keychains.start(5)
   641 -- keychains.start(5)
   628 
   642 
   629 -- Hook function to execute when focusing a client.
   643 -- Hook function to execute when focusing a client.
   630 client.add_signal("focus", 
   644 client.add_signal("focus", 
   631                   function(c)
   645                   function(c)
       
   646                      -- my.notify_error("Client focus:\n" .. debug.traceback())
   632                      if not awful.client.ismarked(c) then
   647                      if not awful.client.ismarked(c) then
   633                         c.border_color = beautiful.border_focus
   648                         c.border_color = beautiful.border_focus
   634                         c.opacity = 1.0
   649                         c.opacity = 1.0
   635                      end
   650                      end
   636 end)
   651 end)
   641                         c.border_color = beautiful.border_normal
   656                         c.border_color = beautiful.border_normal
   642                         c.opacity = 0.8
   657                         c.opacity = 0.8
   643                      end
   658                      end
   644 end)
   659 end)
   645 
   660 
       
   661 my.sloppy_install(0.5)