Elv13 / radical

An extensible menu subsystem for Awesome WM
223 stars 16 forks source link

Request examples #49

Open deb75 opened 5 years ago

deb75 commented 5 years ago

Hello,

I am trying to use radical as a replacement for awful.menu.

It looks great on the screenshots, would it be possible to show us the code which is behind these screenshots ? Indeed, the wiki is well but examples show always better the way to implement.

It is not important if the examples are not working right out of the box, I would like just to get inspiration from the screenshots.

Regards

Elv13 commented 5 years ago

Which one from the screenshot? In the end they are all here https://github.com/Elv13/awesome-configs/tree/master/customMenu, but that doesn't help much before that config requires a patched Awesome to run (I am slowly merging everything back into Awesome, but my branch of tens of thousands of line ahead of awesome git-master).

deb75 commented 5 years ago

Thanks for the link, I will have a look at the configs.

By the way, I try to build a menu like this :

menu:add_item {
   text = "<span color = \"red\"> some text </span>"
   ...
}

But Pango markup are not interpreted although I put disable_markup = false in the menu general settings.

Am I missing something ?

Regards

deb75 commented 5 years ago

Hi,

Any ideas on how to use pango markups in items ?

Regards

deb75 commented 5 years ago

Hi again,

I am getting stuck on this issue, I would like to use pango markups in text items. It seems possible with radical, however I cannot get a working example. Pango markups are just shown instead of being interpreted.

Thanks in advance for your kind attention.

Regards

Elv13 commented 5 years ago

I am out of town and partially AFK right now, sorry for the email backlog your are stuck in. Can you do a mockup in paint/whatever of what you are trying to do? You usually don't need pango for setting color, there is an fg and bg property on the item and you can set a custom widget if you need multiple colors.

deb75 commented 5 years ago

Hi,

I am trying the following code :

      menu:add_item {
         text = k,
         icon = v.icon,
         fg = "#a10000",
         bg = "#a1a100",
         fg_focus = "#00a100",
         bg_focus = "#00a1a1",
         button1 = function() menu.visible = false end
      }:connect_signal("button::release",function(d,i,b,m)
                          print("bar click released!")
                      end)

The properties fg_focus and bg_focus do work, but fg and bg ones simply do not. If I put these latest properties in the radical.box definition :

   local menu = radical.box {
      style = radical.style.classic,
      item_style = radical.item.style.arrow,
      layout = radical.layout.vertical,
       fg = "#a10000",
       bg = "#a1a100",
      item_height = 100,
      item_width = 400
   }

Then they works, but for all items, I would like them to work for the item itself as I would like some different colors for each items. Why is it not working with items ?

Regards

Elv13 commented 5 years ago

It has been many years. I think I had this problem and I solved it by just adding more states and not using the default one. If I recall, the reason it wasn't trivial to fix was because the default background has to stay transparent for other properties to work. You may try your luck with a patch and a pull request. I have very little time for Awesome right now. The current Radical is also a crude port of code that was originally written for Awesome 3.3, then ported to 3.4, half rewritten in 3.5 and then brute forced into the modern era. Some regressions have appeared during those ports.

It is no secret that I am currently slowly merging most still relevant parts of Radical into Awesome. Apparently the awful.popup (currently called radical.box) pull requests wont make it into 4.3 because I don't have enough time, but they will eventually make it there.

Once it's done, backporting Radical to work on top of all the upstreamed components will probably break the API a bit, but get rid of the weird legacy bugs like this one.

deb75 commented 5 years ago

Hi,

I finally managed to get it working as I wanted by following your advice, I use the used state and set the color for it.

local item = menu:add_item {
         text = "some text",
         icon = "path/to/icon",
         --fg = "#a10000",
         --bg = "#a1a100",
         fg_focus = "#0000a1",
         bg_focus = "#00a1a1",
         fg_used = "#00a100",
         bg_used = "#a1a100",
         button1 = function() menu.visible = false end
      }
      item.state[7] = true
deb75 commented 5 years ago

I found also that :

item.widget:set_bg(v.item_opts.bg or beautiful.bg_normal)
item.widget:set_fg(v.item_opts.fg or beautiful.fg_normal)

also works