Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Awesome: making a status widget?

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Awesome: making a status widget?

#1 Post by bedtime »

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.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Awesome: making a status widget?

#2 Post by pylkko »

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?

bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Re: Awesome: making a status widget?

#3 Post by bedtime »

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. :?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Awesome: making a status widget?

#4 Post by Head_on_a_Stick »

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/
deadbang

bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Re: Awesome: making a status widget?

#5 Post by bedtime »

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.

Post Reply