LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1342|回复: 4

xcompmgr & awesome

[复制链接]
发表于 2009-11-25 16:13:11 | 显示全部楼层 |阅读模式
怎么配置才能用xcompmgr使awesome的wibox透明?
   现在只会配置固定程序的透明

这是我的配置
awesome-3.4.1


  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. require("vicious")
  10. require("obvious.volume_alsa")

  11. -- {{{ Variable definitions
  12. -- Themes define colours, icons, and wallpapers
  13. beautiful.init( "/home/shom/.config/awesome/default_theme/theme.lua")

  14. -- This is used later as the default terminal and editor to run.
  15. terminal = "urxvtc"
  16. editor = os.getenv("EDITOR") or "vim"
  17. editor_cmd = terminal .. " -e " .. editor

  18. -- Default modkey.
  19. -- Usually, Mod4 is the key with a logo between Control and Alt.
  20. -- If you do not like this or do not have such a key,
  21. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  22. -- However, you can use another modifier like Mod1, but it may interact with others.
  23. modkey = "Mod1"

  24. -- Table of layouts to cover with awful.layout.inc, order matters.
  25. layouts =
  26. {
  27.     awful.layout.suit.tile,
  28. --    awful.layout.suit.tile.left,
  29. --    awful.layout.suit.tile.bottom,
  30. --    awful.layout.suit.tile.top,
  31.     awful.layout.suit.fair,
  32. --    awful.layout.suit.fair.horizontal,
  33. --    awful.layout.suit.spiral,
  34.     awful.layout.suit.spiral.dwindle,
  35.     awful.layout.suit.max,
  36. --    awful.layout.suit.max.fullscreen,
  37. --    awful.layout.suit.magnifier,
  38.     awful.layout.suit.floating
  39. }
  40. -- }}}

  41. -- {{{ Tags
  42. -- Define a tag table which hold all screen tags.
  43. tags = {}
  44. for s = 1, screen.count() do
  45.     -- Each screen has its own tag table.
  46.     tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s)
  47. end
  48. -- }}}

  49. -- {{{ Menu
  50. -- Create a laucher widget and a main menu
  51. myawesomemenu = {
  52.    { "manual", terminal .. " -e man awesome" },
  53.    { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
  54.    { "restart", awesome.restart },
  55.    { "quit", awesome.quit }
  56. }

  57. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
  58.                                     { "open terminal", terminal }
  59.                                   }
  60.                         })

  61. mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
  62.                                      menu = mymainmenu })
  63. -- }}}

  64. -- {{{ Wibox
  65. spacer    = widget({ type = "textbox" })
  66. separator = widget({ type = "textbox" })
  67. spacer.text     = " "
  68. separator.text  = "|"

  69. memwidget = awful.widget.progressbar()
  70. memwidget:set_width(5)
  71. memwidget:set_height(18)
  72. memwidget:set_vertical(true)
  73. memwidget:set_background_color("#494B4F")
  74. memwidget:set_border_color(nil)
  75. memwidget:set_color("#AECF96")
  76. memwidget:set_gradient_colors({ "#AECF96", "#88A175", "#FF5656" })
  77. vicious.register(memwidget, vicious.widgets.mem, "$1", 5)

  78. cpuwidget = awful.widget.progressbar()
  79. cpuwidget:set_width(5)
  80. cpuwidget:set_height(18)
  81. cpuwidget:set_vertical(true)
  82. cpuwidget:set_background_color("#494B4F")
  83. cpuwidget:set_border_color(nil)
  84. cpuwidget:set_color("#AECF96")
  85. cpuwidget:set_gradient_colors({ "#AECF96", "#88A175", "#FF5656" })
  86. vicious.register(cpuwidget, vicious.widgets.cpu, "$1", 1)

  87. obvious.volume_alsa("Master", "PCM")

  88. -- Create a textclock widget
  89. mytextclock = awful.widget.textclock({ align = "right" })

  90. -- Create a systray
  91. mysystray = widget({ type = "systray" })

  92. -- Create a wibox for each screen and add it
  93. mywibox = {}
  94. mypromptbox = {}
  95. mylayoutbox = {}
  96. mytaglist = {}
  97. mytaglist.buttons = awful.util.table.join(
  98.                     awful.button({ }, 1, awful.tag.viewonly),
  99.                     awful.button({ modkey }, 1, awful.client.movetotag),
  100.                     awful.button({ }, 3, awful.tag.viewtoggle),
  101.                     awful.button({ modkey }, 3, awful.client.toggletag),
  102.                     awful.button({ }, 4, awful.tag.viewnext),
  103.                     awful.button({ }, 5, awful.tag.viewprev)
  104.                     )
  105. mytasklist = {}
  106. mytasklist.buttons = awful.util.table.join(
  107.                      awful.button({ }, 1, function (c)
  108.                                               if not c:isvisible() then
  109.                                                   awful.tag.viewonly(c:tags()[1])
  110.                                               end
  111.                                               client.focus = c
  112.                                               c:raise()
  113.                                           end),
  114.                      awful.button({ }, 3, function ()
  115.                                               if instance then
  116.                                                   instance:hide()
  117.                                                   instance = nil
  118.                                               else
  119.                                                   instance = awful.menu.clients({ width=250 })
  120.                                               end
  121.                                           end),
  122.                      awful.button({ }, 4, function ()
  123.                                               awful.client.focus.byidx(1)
  124.                                               if client.focus then client.focus:raise() end
  125.                                           end),
  126.                      awful.button({ }, 5, function ()
  127.                                               awful.client.focus.byidx(-1)
  128.                                               if client.focus then client.focus:raise() end
  129.                                           end))

  130. for s = 1, screen.count() do
  131.     -- Create a promptbox for each screen
  132.     mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  133.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  134.     -- We need one layoutbox per screen.
  135.     mylayoutbox[s] = awful.widget.layoutbox(s)
  136.     mylayoutbox[s]:buttons(awful.util.table.join(
  137.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  138.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  139.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  140.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  141.     -- Create a taglist widget
  142.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)

  143.     -- Create a tasklist widget
  144.     mytasklist[s] = awful.widget.tasklist(function(c)
  145.                                               return awful.widget.tasklist.label.currenttags(c, s)
  146.                                           end, mytasklist.buttons)

  147.     -- Create the wibox
  148.     mywibox[s] = awful.wibox({ position = "top", height = 18, screen = s })

  149.     -- Add widgets to the wibox - order matters
  150.     mywibox[s].widgets = {
  151.         {
  152.             mylauncher,
  153.             mytaglist[s],
  154.             spacer,
  155.             obvious.volume_alsa(),
  156.             spacer,
  157.             cpuwidget,
  158.             spacer,
  159.             memwidget,
  160.             spacer,
  161.             mypromptbox[s],
  162.             layout = awful.widget.layout.horizontal.leftright
  163.         },
  164.         mylayoutbox[s],
  165.         mytextclock,
  166.         s == 1 and mysystray or nil,
  167.         mytasklist[s],
  168.         separator,
  169.         layout = awful.widget.layout.horizontal.rightleft
  170.     }
  171. end
  172. -- }}}

  173. -- {{{ Mouse bindings
  174. root.buttons(awful.util.table.join(
  175.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  176.     awful.button({ }, 4, awful.tag.viewnext),
  177.     awful.button({ }, 5, awful.tag.viewprev)
  178. ))
  179. -- }}}

  180. -- {{{ Key bindings
  181. globalkeys = awful.util.table.join(
  182.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  183.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  184.     awful.key({ modkey,           }, "Tab", awful.tag.history.restore),

  185.     awful.key({ modkey,           }, "j",
  186.         function ()
  187.             awful.client.focus.byidx( 1)
  188.             if client.focus then client.focus:raise() end
  189.         end),
  190.     awful.key({ modkey,           }, "k",
  191.         function ()
  192.             awful.client.focus.byidx(-1)
  193.             if client.focus then client.focus:raise() end
  194.         end),
  195.     awful.key({ modkey,           }, "w", function () mymainmenu:show(true)        end),

  196.     -- Layout manipulation
  197.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  198.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  199.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  200.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  201.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  202. --    awful.key({ modkey,           }, "Escape",
  203. --        function ()
  204. --            awful.client.focus.history.previous()
  205. --            if client.focus then
  206. --                client.focus:raise()
  207. --            end
  208. --        end),

  209.     -- Standard program
  210.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  211.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  212.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),

  213.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  214.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  215.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  216.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  217.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  218.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  219.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  220.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),

  221.     -- Applications
  222.     awful.key({ modkey,           }, "r",     function () awful.util.spawn("gmrun")     end),
  223.     awful.key({ modkey,           }, "f",     function () awful.util.spawn("pcmanfm")   end),
  224.     awful.key({ modkey,           }, "z",     function () awful.util.spawn("xlock -mode \
  225.     puzzle -fg green -echokeys -echokey *") end),
  226.     awful.key({ modkey,           }, "p",     function () awful.util.spawn("dmenu_run  \
  227.     -i -b -nb '#000000' -nf '#FFFFFF' -sb '#FFFFFF' -sf '#000000'") end),

  228.     -- Prompt
  229.     awful.key({ modkey },            "F1",     function () mypromptbox[mouse.screen]:run() end),
  230.     awful.key({ modkey }, "F2",
  231.               function ()
  232.                   awful.prompt.run({ prompt = "Run Lua code: " },
  233.                   mypromptbox[mouse.screen].widget,
  234.                   awful.util.eval, nil,
  235.                   awful.util.getdir("cache") .. "/history_eval")
  236.               end)
  237. )


  238. clientkeys = awful.util.table.join(
  239.     awful.key({ modkey, "Shift"   }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  240.     awful.key({ modkey,           }, "c",      function (c) c:kill()                         end),
  241.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  242.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  243.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  244.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  245.     awful.key({ modkey,           }, "n",      function (c) c.minimized = not c.minimized    end),
  246.     awful.key({ modkey,           }, "m",
  247.         function (c)
  248.             c.maximized_horizontal = not c.maximized_horizontal
  249.             c.maximized_vertical   = not c.maximized_vertical
  250.         end)
  251. )

  252. -- Compute the maximum number of digit we need, limited to 9
  253. keynumber = 0
  254. for s = 1, screen.count() do
  255.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  256. end

  257. -- Bind all key numbers to tags.
  258. -- Be careful: we use keycodes to make it works on any keyboard layout.
  259. -- This should map on the top row of your keyboard, usually 1 to 9.
  260. for i = 1, keynumber do
  261.     globalkeys = awful.util.table.join(globalkeys,
  262.         awful.key({ modkey }, "#" .. i + 9,
  263.                   function ()
  264.                         local screen = mouse.screen
  265.                         if tags[screen][i] then
  266.                             awful.tag.viewonly(tags[screen][i])
  267.                         end
  268.                   end),
  269.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  270.                   function ()
  271.                       local screen = mouse.screen
  272.                       if tags[screen][i] then
  273.                           awful.tag.viewtoggle(tags[screen][i])
  274.                       end
  275.                   end),
  276.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  277.                   function ()
  278.                       if client.focus and tags[client.focus.screen][i] then
  279.                           awful.client.movetotag(tags[client.focus.screen][i])
  280.                       end
  281.                   end),
  282.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  283.                   function ()
  284.                       if client.focus and tags[client.focus.screen][i] then
  285.                           awful.client.toggletag(tags[client.focus.screen][i])
  286.                       end
  287.                   end))
  288. end

  289. clientbuttons = awful.util.table.join(
  290.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  291.     awful.button({ modkey }, 1, awful.mouse.client.move),
  292.     awful.button({ modkey }, 3, awful.mouse.client.resize))

  293. -- Set keys
  294. root.keys(globalkeys)
  295. -- }}}

  296. -- {{{ Rules
  297. awful.rules.rules = {
  298.     -- All clients will match this rule.
  299.     { rule = { },
  300.       properties = { border_width = beautiful.border_width,
  301.                      border_color = beautiful.border_normal,
  302.                      focus = true,
  303.                      keys = clientkeys,
  304.                      buttons = clientbuttons } },
  305.     { rule = { class = "MPlayer" },
  306.       properties = { floating = true } },
  307.     { rule = { class = "pinentry" },
  308.       properties = { floating = true } },
  309.     { rule = { class = "gimp" },
  310.       properties = { floating = true } },
  311.     -- Set Firefox to always map on tags number 2 of screen 1.
  312.     -- { rule = { class = "Firefox" },
  313.     --   properties = { tag = tags[1][2] } },
  314. }
  315. -- }}}

  316. -- {{{ Signals
  317. -- Signal function to execute when a new client appears.
  318. client.add_signal("manage", function (c, startup)
  319.     -- Add a titlebar
  320.     -- awful.titlebar.add(c, { modkey = modkey })

  321.     -- Enable sloppy focus
  322.     c:add_signal("mouse::enter", function(c)
  323.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  324.             and awful.client.focus.filter(c) then
  325.             client.focus = c
  326.         end
  327.     end)

  328.     if not startup then
  329.         -- Set the windows at the slave,
  330.         -- i.e. put it at the end of others instead of setting it master.
  331.         -- awful.client.setslave(c)

  332.         -- Put windows in a smart way, only if they does not set an initial position.
  333.         if not c.size_hints.user_position and not c.size_hints.program_position then
  334.             awful.placement.no_overlap(c)
  335.             awful.placement.no_offscreen(c)
  336.         end
  337.         c.size_hints_honor = false
  338.     end
  339. end)

  340. client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  341. client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  342. -- }}}


  343. awful.hooks.focus.register(function (c)
  344.   if not awful.client.ismarked(c) then
  345.      c.border_color = beautiful.border_focus
  346.     if c.class == "URxvt" then c.opacity = 0.6 end
  347.    end
  348. end)
复制代码
发表于 2010-1-14 11:22:15 | 显示全部楼层
目前不行,只能在theme设定bg_normal的颜色,#00000000就可以了,pseudo transparent
回复 支持 反对

使用道具 举报

发表于 2010-1-16 22:25:43 | 显示全部楼层
建议不要用xcompmgr ,比较难用 -_-
回复 支持 反对

使用道具 举报

发表于 2010-1-18 08:59:08 | 显示全部楼层
平铺wm真/假透明本来就差别不大,因为Z轴上大多只有一个窗口。

另外,真透明对优美的壁纸是一种糟蹋...

个人愚见
回复 支持 反对

使用道具 举报

发表于 2010-1-18 09:07:17 | 显示全部楼层
实在是受不了xcompmgr带来的响应迟缓性能下降。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表