You are not logged in.

#1 2022-05-28 07:52:32

yusuf
Member
Registered: 2022-01-15
Posts: 110

How do I make my own Awesome WM Widget?

How do I make my own Awesome WM Widget? I want to make a todo list. I am not afraid of learning Lua. Here is a quickly made mockup:
https://imgur.com/ePIJwPd
You can see that it is a simplified version of the default settings of Awesome, where I have added a box icon and a menu (adjusted to the side to fit it in). I could do the Todo handling  myself but how, would I have Awesome display it?

Offline

#2 2022-05-28 14:37:09

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: How do I make my own Awesome WM Widget?

Definitely looks doable. You probably won't need super advanced lua, but you'll want to know the basics at least. Once you're familiar with the basics, check out the Awesome API documentation. On your wibar, you'll have an awful.widget.launcher or even just an awful.widget.textbox, and assign it buttons which open or close the widget for the todo list. That'll probably be something like an awful.popup; inside that you'll have a more sophisticated widget layout so check out the info on the widget system and declarative layouts; the entire list will have a vertical layout, but inside that there'll be containers for each item with a horizontal layout, with a wibox.widget.textbox and wibox.widget.checkbox (and then probably an awful.widget.prompt for the last one).

You may need to add some kind of means for removing items from the list, unless you want it to grow forever; maybe by right clicking on the textbox for the item or something?

And presumably you want this persistent between boots so you'll want to save the data on change and reload when needed, but I gather you've got that part figured out?

Offline

#3 2022-05-28 16:51:12

yusuf
Member
Registered: 2022-01-15
Posts: 110

Re: How do I make my own Awesome WM Widget?

I try to copy this sample from https://awesomewm.org/doc/api/documenta … ut.md.html but it does not show anything:

local bg = wibox.container.background()
bg:set_bg("#ff0000")

local tb1 = wibox.widget.textbox()
local tb2 = wibox.widget.textbox("bar")

tb1:set_text("foo")
tb2:set_text("bar")

local l = wibox.layout.fixed.vertical()
l:add(tb1)
l:add(tb2)

bg:set_widget(l)

Offline

#4 2022-05-28 18:47:04

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: How do I make my own Awesome WM Widget?

Why would it? You didn't put it anywhere. Where would you like it to show up?

E.g., if you are using something like the default config, you could put it in the wibar. Just add "bg" where you want it to show up:

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,
        bg, -- WIDGET ADDED HERE
        mykeyboardlayout,
        wibox.widget.systray(),
        mytextclock,
        s.mylayoutbox,
    },
}

Last edited by frabjous (2022-05-28 18:47:59)

Offline

#5 2022-05-29 04:33:39

yusuf
Member
Registered: 2022-01-15
Posts: 110

Re: How do I make my own Awesome WM Widget?

Added it just before the keyboard config thing, but it didn't show up.

Offline

#6 2022-05-29 13:16:05

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: How do I make my own Awesome WM Widget?

It should have. If you post your config at a pastebin site and link here, I'll take a look.

Offline

#7 2022-05-29 15:08:44

yusuf
Member
Registered: 2022-01-15
Posts: 110

Re: How do I make my own Awesome WM Widget?

Offline

Board footer

Powered by FluxBB