You are not logged in.

#1 2019-05-27 11:31:14

Saggitarius
Member
Registered: 2019-05-26
Posts: 3

AwesomeWM API questions

Hi,

A few questions:


* Are screen's myprompt, mylayoutbox, mytaglist, mytasklist, and mywibox special properties? I don't see them listed in the docs. Can I rename these properties (e.g. myprompt => theprompt)?

Also can I instead of:

s.mywibox = awful.wibar({ position = "top", screen = s })

s.mywibox:setup {
...
}

write:

local mywibox = awful.wibar({ position = "top", screen = s })

mywibox:setup {
...
}

? Is it really necessary to assign the return value of awful.wibar({ position = "top", screen = s }) to s.mywibox?

* By default, my rc.lua file contains this snippet of code:

awful.screen.connect_for_each_screen(function(s)
    -- Wallpaper
    set_wallpaper(s)

    -- Each screen has its own tag table.
    awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])

    -- Create a promptbox for each screen
    s.mypromptbox = awful.widget.prompt()
    -- Create an imagebox widget which will contain an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    s.mylayoutbox = awful.widget.layoutbox(s)
    s.mylayoutbox:buttons(gears.table.join(
                           awful.button({ }, 1, function () awful.layout.inc( 1) end),
                           awful.button({ }, 3, function () awful.layout.inc(-1) end),
                           awful.button({ }, 4, function () awful.layout.inc( 1) end),
                           awful.button({ }, 5, function () awful.layout.inc(-1) end)))
    -- Create a taglist widget
    s.mytaglist = awful.widget.taglist {
        screen  = s,
        filter  = awful.widget.taglist.filter.all,
        buttons = taglist_buttons
    }

    -- Create a tasklist widget
    s.mytasklist = awful.widget.tasklist {
        screen  = s,
        filter  = awful.widget.tasklist.filter.currenttags,
        buttons = tasklist_buttons
    }

    -- Create the wibox
    s.mywibox = awful.wibar({ position = "top", screen = s })

    -- Add widgets to the wibox
    s.mywibox:setup {
        layout = wibox.layout.align.horizontal,
        { -- Left widgets
            layout = wibox.layout.fixed.horizontal,
            mylauncher,
            s.mytaglist,
            s.mypromptbox,
        },
        s.mytasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,
            mykeyboardlayout,
            wibox.widget.systray(),
            mytextclock,
            s.mylayoutbox,
        },
    }
end)

If I want to add 10px margin around the wibox (wibar), should I create a margin, add wibar to the margin, and set s.mywibox to the margin:

local wibar = awful.wibar({
     position = "top", 
     screen = s 
})

local wibarmargin =  wibox.container.margin({
    widget = wibar,
    left   = 10,
    top    = 10,
    right  = 10,
    bottom = 10
})

s.mywibox = wibarmargin

wibar:setup {
    layout = wibox.layout.align.horizontal,
    { -- Left widgets
        layout = wibox.layout.fixed.horizontal,
        mylauncher,
        s.mytaglist,
        s.mypromptbox,
    },
    s.mytasklist, -- Middle widget
    { -- Right widgets
        layout = wibox.layout.fixed.horizontal,
        mykeyboardlayout,
        wibox.widget.systray(),
        mytextclock,
        s.mylayoutbox,
    },
}

? Is it allowed to set s.mywibox to wibox.container.margin? Or should I do something like this instead:

s.mywibox = awful.wibar({ position = "top", screen = s })

s.mywibox:setup {
    widget = wibox.container.margin,
    left   = 10,
    top    = 10,
    right  = 10,
    bottom = 10,
    {
        layout = wibox.layout.align.horizontal,
        { -- Left widgets
            layout = wibox.layout.fixed.horizontal,
            mylauncher,
            s.mytaglist,
            s.mypromptbox,
        },
        s.mytasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,
            mykeyboardlayout,
            wibox.widget.systray(),
            mytextclock,
            s.mylayoutbox,
        },
    }
}

? Also from an API point of view, why does awful.wibar take some parameters in the constructor and others in the setup method? Is it valid to pass everything to the constructor like this:

s.mywibox = awful.wibar({ 
    position = "top", 
    screen = s,
    widget = wibox.container.margin,
    left   = 10,
    top    = 10,
    right  = 10,
    bottom = 10,
    {
        layout = wibox.layout.align.horizontal,
        { -- Left widgets
            layout = wibox.layout.fixed.horizontal,
            mylauncher,
            s.mytaglist,
            s.mypromptbox,
        },
        s.mytasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,
            mykeyboardlayout,
            wibox.widget.systray(),
            mytextclock,
            s.mylayoutbox,
        },
    }
})

Thanks in advance.

Last edited by Saggitarius (2019-05-27 11:47:30)


Regards,
Leonhard Saggitarius Euler

Offline

#2 2019-05-27 11:43:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,530
Website

Re: AwesomeWM API questions

Please edit your title to represent your problem or question.  You should, at least, mention awesomeWM in the title - and probably in your post as it can only currently be inferred that this is what API you are talking about.

Also note that you should only have one topic/question per post.

https://wiki.archlinux.org/index.php/Co … ow_to_post


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2019-05-27 11:48:45

Saggitarius
Member
Registered: 2019-05-26
Posts: 3

Re: AwesomeWM API questions

Sorry, for some reason I thought I am on an Awesome WM forum. roll

Trilby wrote:

Please edit your title to represent your problem or question.  You should, at least, mention awesomeWM in the title - and probably in your post as it can only currently be inferred that this is what API you are talking about.

Also note that you should only have one topic/question per post.

https://wiki.archlinux.org/index.php/Co … ow_to_post


Regards,
Leonhard Saggitarius Euler

Offline

#4 2019-05-28 09:28:51

Kirill Bugaev
Member
Registered: 2018-08-03
Posts: 173

Re: AwesomeWM API questions

@Saggitarius, the main idea of s.* entries (if I understand it correct way) is that it binds to particular screen. eg. if they are named identically for each screen it is may be more convenient to manipulate with them. Why do you ask questions where you can just check your guesses?

Last edited by Kirill Bugaev (2019-05-28 09:41:32)

Offline

Board footer

Powered by FluxBB