Awesome: making a status widget?

Everything about X, Gnome, KDE, ... and everything running on it

Awesome: making a status widget?

Postby bedtime » 2019-02-21 17:51

I would like to make my own status line widget in Awesome window manager. I've done this before some years ago but forgot what I did. The Debian, Arch, and Gentoo instructions on widgets all did not produce results. The best I've got is printing a 'Hello Wibox' in the status area, but I have not been able to change the text.


rc.lua:
Code: Select all
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup").widget


-- {{{ Wibar
-- Create a textclock widget
--mytextclock = wibox.widget.textclock()
mytextclock = wibox.widget.textclock(" %a %b %d %H.%M.%S ", 1)


hellowibox = "Hello Wibox!"
rootwidget  = wibox.widget {     
        {
            markup        = hellowibox,
            widget        = wibox.widget.textbox
        },
        bg     = '#000000',
   fg   = '#00ffff',   --cyan
        layout = wibox.container.background
    }


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

    -- Each screen has its own tag table.
    awful.tag({ "I", "II", "III" }, s, awful.layout.layouts[1])

    -- Create a promptbox for each screen
    s.mypromptbox = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    s.mylayoutbox = awful.widget.layoutbox(s)
    s.mylayoutbox:buttons(awful.util.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(s, awful.widget.taglist.filter.all, taglist_buttons)

    -- Create a tasklist widget
    s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, 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,
            --wibox.widget.systray(),
            mytextclock,
       rootwidget,-- My status widget!
            s.mylayoutbox,
        },
    }
end)
-- }}}


To attempt to run text through the wibar, I enter:
Code: Select all
echo  "hellowidget = 'new text'" | awesome-client


The command is submitted without error but does not change the status.

If anyone has any ideas, it would be much appreciated.
bedtime
 
Posts: 110
Joined: 2012-12-16 19:34

Re: Awesome: making a status widget?

Postby pylkko » 2019-02-23 10:30

Maybe you are following two guides and confusing what needs to be done where. Link the pages that are trying to follow.

Not knowing how it works nor never having used it I find it strange that you would be told to create a widget with a different name than what you then try to adjust later. You are echoing hellowwidget = when you have no hellowwidget to begin with. Where does it say to do this and why? Am I missing something?
User avatar
pylkko
 
Posts: 1526
Joined: 2014-11-06 19:02

Re: Awesome: making a status widget?

Postby bedtime » 2019-02-23 14:25

pylkko wrote:Maybe you are following two guides and confusing what needs to be done where. Link the pages that are trying to follow.

Not knowing how it works nor never having used it I find it strange that you would be told to create a widget with a different name than what you then try to adjust later. You are echoing hellowwidget = when you have no hellowwidget to begin with. Where does it say to do this and why? Am I missing something?

I copied the wrong command that I was testing with. :oops:

It shoud be:
Code: Select all
echo  "rootwidget = 'new text'" | awesome-client


As for where I found it, I've been looking around and could not locate it again. Nonetheless, nothing I have tried has worked. If there is some documentation that a quasi-layman could understand, then that would be great.

As for now, I've got dwm working with status and a bunch of changed code. Seems strange that C++ would be easier to work with than a simple lua config script. :?
bedtime
 
Posts: 110
Joined: 2012-12-16 19:34

Re: Awesome: making a status widget?

Postby Head_on_a_Stick » 2019-02-23 15:04

bedtime wrote:I've got dwm working with status and a bunch of changed code. Seems strange that C++ would be easier to work with than a simple lua config script. :?

Actually dwm uses plain C, suckless hate C++, it is mentioned several times on their stuff that sucks page.

Awesome is a bastard to configure (for me, anyway) but the upstream documentation is very comprehensive:

https://awesomewm.org/doc/api/
User avatar
Head_on_a_Stick
 
Posts: 10368
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Awesome: making a status widget?

Postby bedtime » 2019-02-24 05:01

Actually dwm uses plain C, suckless hate C++, it is mentioned several times on their stuff that sucks page.

Was thinking about C++ whilst I wrote that, so I accidentally typed it.

Awesome is a bastard to configure (for me, anyway) but the upstream documentation is very comprehensive:

https://awesomewm.org/doc/api/

Not just you! :shock:

And yes, the documentation is extremely thorough; but having browsed through it, I find it's either over my head, or I just don't feel like reading through so much. A few years ago I had invested several hours into doing this very thing. It's almost like having to learn a new computing language when really I just want to do a simple task and be done with it. I'd rather invest my time into Awk or C or C++ than learn this bizarre one-off configuration.

But the big thing that really puts me off is that Awesome has changed their configuration a few times, and I can't totally be sure that what I'm reading applies to me. So much code on the net doesn't work due to this.

Anyways, I'm likely going to stick to dwm for now; at least I can depend on the code holding true through the years.
bedtime
 
Posts: 110
Joined: 2012-12-16 19:34


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable