Advertisement
Guest User

cac2s

a guest
Dec 20th, 2010
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.60 KB | None | 0 0
  1. -- Standard awesome library
  2. require("awful")
  3. require("awful.autofocus")
  4. require("awful.rules")
  5. -- Theme handling library
  6. require("beautiful")
  7. -- Notification library
  8. require("naughty")
  9.  
  10. require("shifty")
  11. require("vicious")
  12.  
  13. -- {{{ Variable definitions
  14. -- Themes define colours, icons, and wallpapers
  15. beautiful.init(awful.util.getdir("config") .. "/theme/theme.lua")
  16.  
  17. -- This is used later as the default terminal and editor to run.
  18. terminal       = "urxvt"
  19. terminal_fixed = terminal .. " -name urxvt_fixed"
  20. browser        = "thunar"
  21. web            = "x-www-browser"
  22. mail           = "icedove"
  23. editor         = os.getenv("EDITOR") or "vim"
  24. editor_cmd     = terminal .. " -e " .. editor
  25.  
  26. -- win
  27. modkey = "Mod4"
  28. -- alt
  29. modkey2 = "Mod1"
  30. -- }}}
  31.  
  32. -- {{{ Table of layouts to cover with awful.layout.inc, order matters.
  33. layouts =
  34. {
  35.     awful.layout.suit.max,
  36.     awful.layout.suit.tile.left,
  37.     awful.layout.suit.fair.horizontal,
  38.     awful.layout.suit.tile.bottom,
  39.     awful.layout.suit.magnifier,
  40. --    awful.layout.suit.tile,
  41. --    awful.layout.suit.tile.top,
  42. --    awful.layout.suit.fair,
  43. --    awful.layout.suit.floating,
  44. --    awful.layout.suit.spiral,
  45. --    awful.layout.suit.spiral.dwindle,
  46. --    awful.layout.suit.max.fullscreen,
  47. }
  48. -- }}}
  49.  
  50. -- {{{ Shifty configuration
  51.  
  52. -- tag settings
  53. shifty.config.tags = {
  54.     ["1.web"]      = { position = 1,  spawn = web,     nopopup = true,                layout = awful.layout.suit.max              },
  55.     ["2.gajim"]    = { position = 2,  spawn = "gajim", nopopup = true, mwfact = 0.24, layout = awful.layout.suit.tile.left,       },
  56.     ["3.skype"]    = { position = 3,  spawn = "skype", nopopup = true, mwfact = 0.24, layout = awful.layout.suit.tile.left,       },
  57.     ["4.files"]    = { position = 4,  spawn = browser,                                layout = awful.layout.suit.max,             },
  58.     ["5.mail"]     = { position = 5,  spawn = mail,    nopopup = true,                layout = awful.layout.suit.max,             },
  59.     ["6.view"]     = { position = 6,                                                  layout = awful.layout.suit.mx,              },
  60.     ["9.term"]     = { position = 9,  spawn = terminal_fixed,                         layout = awful.layout.suit.max,             },
  61.     ["gimp"]       = { position = 10,                                  mwfact = 0.25, layout = awful.layout.suit.tile,            },
  62.     ["qemu"]       = { position = 96,                                                 layout = awful.layout.suit.max,             },
  63.     ["burn"]       = { position = 97,                                                 layout = awful.layout.suit.fair.horizontal, },
  64.     ["downloads"]  = { position = 98,                                                 layout = awful.layout.suit.fair.horizontal, },
  65.     ["relax-fm"]   = { position = 99,                                                 layout = awful.layout.suit.fair.horizontal, },
  66. }
  67.  
  68. clientbuttons = awful.util.table.join(
  69.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  70.     awful.button({ modkey }, 1, awful.mouse.client.move),
  71.     awful.button({ modkey }, 3, awful.mouse.client.resize)
  72. )
  73.  
  74. -- client settings (order here matters, early rules will be applied first)
  75. shifty.config.apps = {
  76.          { match = { "Supertux" }, honorsizehints = false, slave = true, float = true, intrusive = true,                 },
  77.          { match = { "URxvt" }, honorsizehints = false, slave = true, float = true, intrusive = true,                    },
  78.          { match = { "Sonata" },                     slave = true, float = true, intrusive = true,                       },
  79.          { match = { "Firefox","Iceweasel",                                                            tag = "1.web"     },
  80.          { match = { "Gajim.py" },                   slave = true,  float = true,                      tag = "2.gajim"   },
  81.              { match = { "roster" },                 slave = false, float = false                                        },
  82.              { match = { "messages" },                              float = false                                        },
  83.          { match = { "Skype" },                      slave = true,  float = true,                      tag = "3.skype"   },
  84.              { match = { "Skype.*(Beta)" },          slave = false, float = false,                                       },
  85.              { match = { "Skype.*чат" },                            float = false,                                       },
  86.          { match = { "Thunar" },                                                                       tag = "4.files"   },
  87.          { match = { "Thunderbird","Icedove" },                                                        tag = "5.mail"    },
  88.          { match = { "Evince", "Geeqie" },                                                             tag = "6.view"    },
  89.          { match = { "MPlayer" },                                   float = true,                      tag = "6.view"    },
  90.          { match = { "urxvt_fixed" },                               float = false, intrusive = false,  tag = "9.term"    },
  91.          { match = { "Gimp.*" },                     slave = true,  float = true,                      tag = "gimp"      },
  92.              { match = { "gimp%-toolbox" },          slave = false, float = false,                                       },
  93.              { match = { "gimp%-image%-window" },                   float = false,                                       },
  94.          { match = { "Xfburn" },                                                                       tag = "burn"      },
  95.          { match = { "aria2c" },                                    float = false, intrusive = false,  tag = "downloads" },
  96.          { match = { "" },                         buttons = clientbuttons },
  97. }
  98.  
  99. -- tag defaults
  100. shifty.config.defaults = {
  101.   exclusive = true,
  102.   layout = awful.layout.suit.max,
  103.   mwfact = 0.50,
  104.   ncol = 1,
  105.   persist = false,
  106. }
  107.  
  108. shifty.init()
  109. --- }}}
  110.  
  111. -- {{{ Menu
  112. -- Create a laucher widget and a main menu
  113. myawesomemenu = {
  114.    { "manual", terminal .. " -e man awesome" },
  115.    { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
  116.    { "restart", awesome.restart },
  117.    { "quit", awesome.quit }
  118. }
  119.  
  120. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
  121.                                     { "open terminal", terminal }
  122.                                   }
  123.                         })
  124. -- }}}
  125.  
  126. -- {{{ Wibox
  127. colorWidgetFg = "#999999"
  128.  
  129. -- Divider
  130. textDivider = widget({ type = "textbox" })
  131. textDivider.width = 25
  132. textDivider.align = "center"
  133. textDivider.text = '<span color="#666666">::</span>'
  134.  
  135. --------------------
  136. ---- TOP PANEL -----
  137. --------------------
  138. -- Systray
  139. --mysystray = widget({ type = "systray" })
  140.  
  141. -- Volume
  142. textVolume = widget({ type = "textbox" })
  143. textVolume.bg_image = image(awful.util.getdir("config") .. "/icons/vol.png")
  144. textVolume.bg_align = "left"
  145. textVolume.align = "right"
  146. vicious.cache(vicious.widgets.volume)
  147. vicious.register(textVolume, vicious.widgets.volume,
  148.                 function (widget, args)
  149.                     if args[2] == "♫" then
  150.                         return '   ' .. string.format("%02d", args[1]) .. '<span color="' .. colorWidgetFg .. '">%</span>'
  151.                     else
  152.                         return '   <span color="' .. theme.bg_urgent .. '">' .. string.format("%02d", args[1]) .. '%</span>'
  153.                     end
  154.                 end,
  155.                 5, "PCM")
  156. textVolume:buttons(awful.util.table.join(
  157.     awful.button({ }, 2,
  158.         function ()
  159.             awful.util.spawn("amixer -q sset PCM toggle")
  160.             vicious.force({ textVolume })
  161.         end
  162.     ),
  163.     awful.button({ }, 4,
  164.         function ()
  165.             awful.util.spawn("amixer -q sset PCM 1%+")
  166.             vicious.force({ textVolume })
  167.         end
  168.     ),
  169.     awful.button({ }, 5,
  170.         function ()
  171.             awful.util.spawn("amixer -q sset PCM 1%-")
  172.             vicious.force({ textVolume })
  173.         end
  174.     )
  175. ))
  176.  
  177. -- Keyboard layout
  178. textKbLayout = widget ({ type = "textbox" })
  179. textKbLayout.width = 28
  180. textKbLayout.bg = theme.bg_normal
  181. dbus.request_name("session", "ru.gentoo.kbdd")
  182. dbus.add_match("session", "interface='ru.gentoo.kbdd',member='layoutChanged'")
  183. textKbLayout.text = ' <span color="#ffffff">' .. 'Eng' .. '</span>'
  184. dbus.add_signal("ru.gentoo.kbdd",
  185.                 function(...)
  186.                     local data = {...}
  187.                     local layout = data[2]
  188.                     lts = {[0] = "Eng", [1] = "Рус"}
  189.                     textKbLayout.text = ' <span color="#ffffff">' .. lts[layout] .. '</span>'
  190.                     if layout == 0 then
  191.                         textKbLayout.bg = theme.bg_normal
  192.                     else
  193.                         textKbLayout.bg = theme.bg_focus
  194.                     end
  195.                 end)
  196.  
  197. -- Clock
  198. textClock = widget({ type = "textbox" })
  199. local function fnClockUpdate()
  200.     textClock.text = '<span color="' .. colorWidgetFg .. '">' .. awful.util.pread('echo -n $(date +"%d [%a]")')  .. '</span>' .. ' ' .. awful.util.pread('echo -n $(date +"%H:%M")') .. ' '
  201. end
  202. fnClockUpdate()
  203. textClock_timer = timer({ timeout = 10})
  204. textClock_timer:add_signal("timeout", function () fnClockUpdate() end)
  205. textClock_timer:start()
  206.  
  207. --------------------
  208. --- BOTTOM PANEL ---
  209. --------------------
  210. -- MPD
  211. textMPD = widget({ type = "textbox" })
  212. textMPD.bg_image = image(awful.util.getdir("config") .. "/icons/phones.png")
  213. textMPD.bg_align = "left"
  214. textMPD.align = "left"
  215. textMPD.width = 500
  216. vicious.register(textMPD, vicious.widgets.mpd,
  217.                 function (widget, args)
  218.                     stringMPD = awful.util.escape(awful.util.pread('cat /tmp/mpd-status/state'))
  219.                     if args["{state}"] == 'Stop' then
  220.                         stringMPD = '<span color="' .. colorWidgetFg .. '">' .. stringMPD .. '</span>'
  221.                     elseif args["{state}"] == 'Pause' then
  222.                         stringMPD = '<span color="' .. colorWidgetFg .. '">' .. stringMPD .. '</span>'
  223.                     end
  224.                     return '   ' .. stringMPD
  225.                 end, 1)
  226. textMPD:buttons(awful.util.table.join(
  227.     awful.button({ }, 2,
  228.         function ()
  229.             awful.util.spawn("/usr/bin/mpc -q toggle")
  230.             vicious.force({ textMPD })
  231.         end
  232.     ),
  233.     awful.button({ }, 4,
  234.         function ()
  235.             awful.util.spawn("/usr/bin/mpc -q next")
  236.             vicious.force({ textMPD })
  237.         end
  238.     ),
  239.     awful.button({ }, 5,
  240.         function ()
  241.             awful.util.spawn("/usr/bin/mpc -q prev")
  242.             vicious.force({ textMPD })
  243.         end
  244.     )
  245. ))
  246. -- CPU
  247. textCPU = widget({ type = "textbox" })
  248. textCPU.bg_image = image(awful.util.getdir("config") .. "/icons/cpu.png")
  249. textCPU.bg_align = "left"
  250. textCPU.align = "right"
  251. vicious.register(textCPU, vicious.widgets.cpu,
  252.                 function (widget, args)
  253.                     return '   ' .. string.format("%02d", args[1]) .. '<span color="' .. colorWidgetFg .. '">%</span>'
  254.                 end,
  255.                 2)
  256.  
  257. -- Memory
  258. textMemory = widget({ type = "textbox" })
  259. textMemory.bg_image = image(awful.util.getdir("config") .. "/icons/mem.png")
  260. textMemory.bg_align = "left"
  261. textMemory.align = "right"
  262. vicious.register(textMemory, vicious.widgets.mem,
  263.                 function (widget, args)
  264.                     return '   ' .. string.format("%02d", args[1]) .. '<span color="' .. colorWidgetFg .. '">% [' .. args[2] .. 'M]</span>'
  265.                 end,
  266.                 2)
  267.  
  268. -- Disk
  269. textDisk = widget({ type = "textbox" })
  270. textDisk.bg_image = image(awful.util.getdir("config") .. "/icons/disk.png")
  271. textDisk.bg_align = "left"
  272. textDisk.align = "right"
  273. vicious.register(textDisk, vicious.widgets.fs, '   <span color="' .. colorWidgetFg .. '">root:</span>${/ used_p}<span color="' .. colorWidgetFg .. '">% home:</span>${/home used_p}<span color="' .. colorWidgetFg .. '">% data:</span>${/mnt/data used_p}<span color="' .. colorWidgetFg .. '">%</span>', 5)
  274.  
  275. -- Divider
  276. textEndPanel = widget({ type = "textbox" })
  277. textEndPanel.width = 2
  278.  
  279. -- Create a wibox for each screen and add it
  280. mywibox_top = {}
  281. mywibox_bottom = {}
  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=400 })
  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.     -- We need one layoutbox per screen.
  324.     mylayoutbox[s] = awful.widget.layoutbox(s)
  325.     mylayoutbox[s]:buttons(awful.util.table.join(
  326.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  327.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  328.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  329.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  330.     -- Create a taglist widget
  331.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  332.  
  333.     -- Create a tasklist widget
  334. --    mytasklist[s] = awful.widget.tasklist(function(c)
  335. --                                              return awful.widget.tasklist.label.currenttags(c, s)
  336. --                                          end, mytasklist.buttons)
  337.     mytasklist[s] = awful.widget.tasklist(function(c)
  338.                                               local text, bg, status_image, icon =
  339.                                                   awful.widget.tasklist.label.currenttags(c, s)
  340.                                               return nil, nil, nil, c.icon
  341.                                           end, mytasklist.buttons)
  342.     -- Create the wibox
  343.     mywibox_top[s] = awful.wibox({ position = "top", height = "16", screen = s })
  344.     mywibox_bottom[s] = awful.wibox({ position = "bottom", height = "16", screen = s })
  345.     -- Add widgets to the wibox - order matters
  346.     mywibox_top[s].widgets = {
  347.         {
  348.             mytaglist[s],
  349.             mypromptbox[s],
  350.             layout = awful.widget.layout.horizontal.leftright
  351.         },
  352.         textClock,
  353.         textDivider,
  354.         textKbLayout,
  355.         textDivider,
  356.         textVolume,
  357.         textDivider,
  358.         layout = awful.widget.layout.horizontal.rightleft
  359.     }
  360.  
  361.     mywibox_bottom[s].widgets = {
  362.         textEndPanel,
  363.         mylayoutbox[s],
  364.         textDivider,
  365.         textDisk,
  366.         textDivider,
  367.         textMemory,
  368.         textDivider,
  369.         textCPU,
  370.         textDivider,
  371.         --s == 1 and mysystray or nil,
  372.         {
  373.             textMPD,
  374.             --textDivider,
  375.             --mytasklist[s],
  376.             layout = awful.widget.layout.horizontal.leftright
  377.         },
  378.         layout = awful.widget.layout.horizontal.rightleft
  379.     }
  380. end
  381. -- }}}
  382.  
  383. -- {{{ Mouse bindings
  384. root.buttons(awful.util.table.join(
  385.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  386.     awful.button({ }, 4, awful.tag.viewnext),
  387.     awful.button({ }, 5, awful.tag.viewprev)
  388. ))
  389. -- }}}
  390.  
  391. -- {{{ Key bindings
  392. globalkeys = awful.util.table.join(
  393.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  394.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  395.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  396.  
  397.     awful.key({ modkey,           }, "j",
  398.         function ()
  399.             awful.client.focus.byidx( 1)
  400.             if client.focus then client.focus:raise() end
  401.         end),
  402.     awful.key({ modkey,           }, "k",
  403.         function ()
  404.             awful.client.focus.byidx(-1)
  405.             if client.focus then client.focus:raise() end
  406.         end),
  407.     awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),
  408.  
  409.     -- Layout manipulation
  410.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  411.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  412.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  413.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  414.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  415.     awful.key({ modkey,           }, "Tab",
  416.         function ()
  417.             awful.client.focus.history.previous()
  418.             if client.focus then
  419.                 client.focus:raise()
  420.             end
  421.         end),
  422.  
  423.     -- Standard program
  424.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  425.     awful.key({ modkey, "Shift"   }, "Return", function () awful.util.spawn(terminal_fixed) end),
  426.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  427.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  428.  
  429.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  430.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  431.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  432.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  433.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  434.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  435.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  436.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  437.  
  438.     -- Prompt
  439.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  440.  
  441.     awful.key({ modkey            },            "x",
  442.               function ()
  443.                   awful.prompt.run({ prompt = "Run Lua code: " },
  444.                   mypromptbox[mouse.screen].widget,
  445.                   awful.util.eval, nil,
  446.                   awful.util.getdir("cache") .. "/history_eval")
  447.               end),
  448.     -- scrot
  449.     awful.key({                   }, "Print",       function () awful.util.spawn('sh -c ~/scripts/scrotrc-png.sh') end),
  450.     awful.key({          "Shift"  }, "Print",       function () awful.util.spawn('sh -c ~/scripts/scrotrc-jpg.sh') end),
  451.     awful.key({ modkey2,          }, "Print",       function () awful.util.spawn('sh -c ~/scripts/scrotrc-focused-png.sh') end),
  452.     awful.key({ modkey2, "Shift"  }, "Print",       function () awful.util.spawn('sh -c ~/scripts/scrotrc-focused-jpg.sh') end),
  453.     -- Shifty
  454.     awful.key({ modkey, "Shift"   }, "Left",        shifty.shift_prev),
  455.     awful.key({ modkey, "Shift"   }, "Right",       shifty.shift_next),
  456.     --awful.key({ modkey,           }, "t",           function() shifty.add({ rel_index = 1 }) end),
  457.     --awful.key({ modkey, "Control" }, "t",           function() shifty.add({ rel_index = 1, nopopup = true }) end),
  458.     --awful.key({ modkey,           }, "e",           shifty.rename),
  459.     awful.key({ modkey,           }, "d",           shifty.del),
  460.     nil
  461. )
  462.  
  463. clientkeys = awful.util.table.join(
  464.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  465.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  466.     awful.key({ modkey, "Control" }, "space",
  467.         function (c)
  468.             awful.client.floating.set(c, not awful.client.floating.get(c))
  469.             -- Always on top for floating windows
  470.             c.ontop = not c.ontop
  471.         end),
  472.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  473.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  474.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  475.     awful.key({ modkey, "Shift"   }, "t",      function (c) c.ontop = not c.ontop            end),
  476.     awful.key({ modkey,           }, "n",      function (c) c.minimized = not c.minimized    end),
  477.     awful.key({ modkey,           }, "m",
  478.         function (c)
  479.             c.maximized_horizontal = not c.maximized_horizontal
  480.             c.maximized_vertical   = not c.maximized_vertical
  481.         end)
  482. )
  483.  
  484. -- bindings / global / shifty.getpos
  485. for i=1, ( shifty.config.maxtags or 9 ) do
  486.   globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey }, i,
  487.   function ()
  488.     local t = awful.tag.viewonly(shifty.getpos(i))
  489.   end))
  490.   globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey, "Control" }, i,
  491.   function ()
  492.     local t = shifty.getpos(i)
  493.     t.selected = not t.selected
  494.   end))
  495.   globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey, "Control", "Shift" }, i,
  496.   function ()
  497.     if client.focus then
  498.       awful.client.toggletag(shifty.getpos(i))
  499.     end
  500.   end))
  501.   -- move clients to other tags
  502.   globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey, "Shift" }, i,
  503.     function ()
  504.       if client.focus then
  505.         local t = shifty.getpos(i)
  506.         awful.client.movetotag(t)
  507.         awful.tag.viewonly(t)
  508.       end
  509.     end))
  510. end
  511.  
  512. -- Set keys
  513. root.keys(globalkeys)
  514. shifty.config.globalkeys = globalkeys
  515. shifty.config.clientkeys = clientkeys
  516. -- }}}
  517.  
  518. -- {{{ Signals
  519. -- Signal function to execute when a new client appears.
  520. client.add_signal("manage", function (c, startup)
  521.     -- Add a titlebar
  522.     -- awful.titlebar.add(c, { modkey = modkey })
  523.  
  524.     -- Always on top for floating windows
  525.     c.ontop = awful.client.floating.get(c)
  526.  
  527.     -- Enable sloppy focus
  528.     c:add_signal("mouse::enter", function(c)
  529.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  530.             and awful.client.focus.filter(c) then
  531.             client.focus = c
  532.         end
  533.     end)
  534.  
  535.     if not startup then
  536.         -- Set the windows at the slave,
  537.         -- i.e. put it at the end of others instead of setting it master.
  538.         -- awful.client.setslave(c)
  539.  
  540.         -- Put windows in a smart way, only if they does not set an initial position.
  541.         if not c.size_hints.user_position and not c.size_hints.program_position then
  542.             awful.placement.no_overlap(c)
  543.             awful.placement.no_offscreen(c)
  544.         end
  545.     end
  546. end)
  547.  
  548. client.add_signal("focus", function(c)
  549.                                c.border_color = beautiful.border_focus
  550.                                --fnKbLayoutUpdate()
  551.                            end)
  552. client.add_signal("unfocus", function(c)
  553.                                c.border_color = beautiful.border_normal
  554.                                --fnKbLayoutUpdate()
  555.                            end)
  556.  
  557. awful.util.spawn_with_shell(awful.util.getdir("config") .. "/autorun.sh")
  558.  
  559. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement