3

Awesome 3.5.1 に移行する前は、画面の上部に 2 つのパネルがあり (互いに重なり合っているように)、下部には何もありませんでした。この pre-3.5.* を実現するために使用したコードは以下のとおりです。

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

-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
    {
        {
            -- Upper left section
            mylauncher,
            mytaglist[s],
            mypromptbox[s],
            -- My custom widgets, separators etc...
            layout = awful.widget.layout.horizontal.leftright
        },
        {
            -- Upper right section
            mylayoutbox[s],
            mytextclock,
            -- More widgets, separators, etc...
            s == 1 and mysystray or nil,
            layout = awful.widget.layout.horizontal.rightleft
        },
    },
    {
        -- Lower section (only the tasklist)
        mytasklist[s],
    },
    layout = awful.widget.layout.vertical.flex,
    height = mywibox[s].height
}

今、3.5構成で同じことを達成する方法を見つけようとして苦労しています。現時点では、かなり基本的な 1 つのパネル (ほとんどのウィジェットを含む) を上部に使用し、もう 1 つのパネル (タスクリストを含む) を下部に使用しています。コードは以下のとおりです。

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

-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(mylauncher)
left_layout:add(mytaglist[s])
left_layout:add(mypromptbox[s])
-- My custom widgets, separators, etc...

-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
if s == 1 then right_layout:add(wibox.widget.systray()) end
-- My custom widgets, separators, etc...
right_layout:add(mytextclock)
right_layout:add(mylayoutbox[s])

-- Now bring it all together
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_right(right_layout)

local layout2 = wibox.layout.align.horizontal()
layout2:set_middle(mytasklist[s])

mywibox[s]:set_widget(layout)
mywibox2[s]:set_widget(layout2)

私の現在の rc.lua を編集して、上のコードが Awesome 3.4.* で行ったように機能させる方法を誰かが知っているなら、それは大歓迎です。

4

2 に答える 2

2

あなたはこのようなことを試すことができます.それがあなたが望むものを正確に行うかどうかはわかりません.

local const = wibox.layout.constraint()
const:set_widget(layout)
const:set_strategy("exact")
const:set_height(32/2)

local l = wibox.layout.fixed.vertical()
l:add(const)
l:add(mytasklist[s])

mywibox[s]:set_widget(l)

最初に、レイアウト「レイアウト」(一番上に表示されるウィジェット) が常に 16px のサイズになるようにする「制約」レイアウトを作成します。次に、この制約レイアウトをタスクリストの上に積み重ね、結果を wibox に表示します。

このコードの一部は最新バージョンで少し短縮される可能性がありますが、3.5.1 にそれらの便利な引数が既にあるかどうかはわかりません。

于 2013-10-23T20:07:08.143 に答える
0

私は次のコードで同様のことをしました:

wiboxes["top"]=awful.wibox({position="top",height=26})
local top_layout = wibox.layout.fixed.horizontal()
sublayout["cpu"] = wibox.layout.fixed.horizontal()
for i=2,3 do
  sublayout["cpu" .. i] = wibox.layout.fixed.horizontal()
  sublayout["cpu" .. i]:add(graphs["cpu"]..i) -- the graphs table already initialized
  sublayout["cpu" .. i]:add(textboxes["cpu"]..i) -- textboxes table already initialized
  sublayout["cpu"]:add(sublayout["cpu"..i)
end
.....
top_layout:add(sublayout["cpu"])
.....
wiboxes["top"]:set_widget(top_layout)

このコードでは、CPU の使用状況 (すべてのコア) を確認するための 2 つのグラフとテキスト ボックスがあります。最初が上、2 番目が下です。taglist またはその他のウィジェットで動作するはずです。

于 2013-10-21T11:19:55.003 に答える