LBCrion/sfwbar

help with winops menu configuration

Closed this issue · 3 comments

Hi LBCrion. I'm on sfwbar 1.0_beta14. I created ~/.config/sfwbar/winops.widget because I like to have the "Close" option appear first. The file looks like this:

function("ToggleMinimize") {
  [!Minimized] Minimize
  [Minimized] UnMinimize
}

function("ToggleMaximize") {
  [!Maximized] Maximize
  [Maximized] UnMaximize
}

menu("winops") {
  item("close", Close );
  item("focus", Focus );
  item("(un)minimize", Function "ToggleMinimize" );
  item("(un)maximize", Function "ToggleMaximize" );
}

This results in a winops widget that looks like this:
winops

There are two cosmetic problems with the menu, which I'd like to fix if possible (presumably with configuration tweaks):

  1. Eliminate the duplicate menu entries
  2. Make the menu the same width as the application's taskbar button

Can these issues be fixed? If so, can you please help me figure out how? Many thanks.

The items are most likely duplicated because they are added to the menu twice. Either your widget is included twice in the config somewhere or it's included in addition to the default winops.widget. Function and Menu constructs are appending the items to functions and menus rather than replacing them. This is done intentionally to allow dynamic building of menus one item at a time.

Making the menu width line up with the taskbar item is harder. The only realistic way to achieve it to lock the width of the taskbar items (using min-width and -GtkWidget-max-width properties set to the same value) and then set min-width of the menu to the same width in CSS.

For the later, I just added naming of menu CSS nodes, so you can change CSS for it using #winops using the latest git version.

Either your widget is included twice in the config somewhere

Oops, that was the problem. Including the widget only once made the duplicate menu entries disappear.

Making the menu width line up with the taskbar item is harder. The only realistic way to achieve it to lock the width of the taskbar items (using min-width and -GtkWidget-max-width properties set to the same value) and then set min-width of the menu to the same width in CSS.

Well, it seems the hard part is done--width of taskbar items had already been locked by using the combination of properties you mentioned. The issue is that menu settings in css section seem to ignore the min-width property.

I tried changing this part of ~/.config/sfwbar/sfwbar.config from this

menu {
  background-color: black;
  border: 1px solid @borders;
  padding: 3px;'  
}

to this:

menu {
  background-color: black;
  border: 1px solid @borders;
  padding: 3px;'  
  min-width: 150px;
}

and it has no effect on width of winops widget. Do I need latest git for the above to work as intended? The winops menu is the only menu I currently use, so I shouldn't need #winops, right?

Ooooh. min-width: 150px; needs to be a property of menuitem for it to work. Now it's working as intended. Thank you SO much!

sfwbar rocks so much that I pity the competition.