mut-ex / awesome-wm-slidebar

an easy to use, configurable, multi-purpose, animated widget bar written in Lua for Awesome WM
MIT License
24 stars 0 forks source link

Currently getting two slidebars when screen = s #3

Open jonaburg opened 3 years ago

jonaburg commented 3 years ago

I currently have two monitors, where i am trying to only have the slidebar active on one of them. I'm not able to bind the screen to anything besides s or nil, where nil presents only one the main screen (with tags and such that aren't representative of my screen 1), and s presents both slidebars on screen 1, 1 where i expect it, and the other with a slight offset. Is there some other parameter I should pass in to limit only the slidebar on screen 1?

jonaburg commented 3 years ago

Sorry this was a little inaccurate of a description because my desires have somewhat changed. I managed to hack around it with gears.timer.delayed_call() and setting the bar as a function for only when screen = 1. However this is not so clean, and ultimately I would like it to behave accordingly on all monitors regardless of the screen index. If you have any suggestions i'd be more excited to hear! Awesome work by the way, really digging it!

mut-ex commented 3 years ago

I am sorry I think I need some more clarification. Do you only want one slidebar, and it should be on screen 1?

If you are setting it up within awful.screen.connect_for_each_screen(function(s) end), you can make the creation conditional upon s.index == 1. Correct me if I am misunderstanding.

Glad you like it. I have been working on a more general, flexible animation system which would actually really simplify having a sliding bar.

jonaburg commented 3 years ago

Apologies for being unclear! I would ideally like all screens to have their own slidebar available. What ends up happening for me at the moment is that when I by default have them for all, each bar tends to end up on 1 screen somewhere with strange offsets, instead of being at the designated position. I'll attach an image of a comment later in the day as an example of what I'm experiencing, together with a snippit of how i'm instantiating this script, if there's a straightforward solution that'd be awesome, but if not, then I'd be happy to wait for the more flexible animation system which may one day deprecate this :)

A separate but potentially shorter request if you don't mind pointing me to a solution: I've been trying to add a connect_signal somewhere in your code, to start the 'show' event on a keybind's emitted_signal, so that when I press mod4 for example, the slidebar comes up, and goes down when mod4 is released. I can't find out where in the code to add this signal, because I can't understand the logic. I was initially thinking it might be at about relating to the connect_signals(o) function, but couldn't figure it out at any rate, I kind of added the signal everywhere and things just wouldn't work (likely that I just didn't understand the logic of the script). Any help in this would be greatly appreciated!

mut-ex commented 3 years ago

Sorry for not responding sooner. Could you share the part of your code where you are instantiating the slidebar? That would really help! I I am going to try to replicate this anyhow with a second monitor.

The way I wrote the show and hide logic was to cover a bunch of corner cases. Like instantly stopping the slide out if you move your mouse away. So it checks the position of the mouse.

If you are OK with losing that 'feature' what you can do is remove lines 43 to 45, 54 to 56, 70 to 72, and 82 to 84.

Then, you can copy the logic for the activator mouse::enter callback (lines 163 to 169) and call that on Mod4 press. And copy the logic for slidebar mouse::leave callback (lines 189 to 196) and call that on Mod4 release. You can add that code for the keybinding within the connect_signals(o) function towards the end. I think that should do the trick.

jonaburg commented 3 years ago

Nono not at all, thank you for even replying! I'm sorry about this delay now since you've been quite punctual ;) Those alterations helped a bunch in the case of now using a button to control the slidebar behavior - thanks!

In the case of trying to instantiate a sliding bar per each of my 2 screens (with the functionality of the tags of that screen being displayed), this is the code I was running:


mytagbar = tagbar {
  bg = tagbarcolor,
  screen = s,
  position = "bottom",
  size = 80,
  ontop = true,
  -- size_activator = 5,
  -- show_delay = 0.25,
  hide_delay = 0.2,
  easing = 70,
  delta = 10,
}
mytagbar:setup {
  layout = wibox.layout.align.horizontal,
    { -- Left widgets
      layout = wibox.layout.fixed.horizontal,
      s.mytag2,
      s.mypromptbox,
    },
    { -- Right widgets
      layout = wibox.layout.fixed.horizontal,
      s.mylayoutbox,
    },
}

Which yielded the following results on screen 1: look (The bottom bar is the 'tagbar' from screen[1], and the smaller 'tagbar' is from screen[2])

When changing to screen = nil in the configuration, I will get only 1 slidebar widget on screen 1 with the tags from screen 2, ( but no slidebar widget on screen 2). If you have any idea why this is happening I'd love to hear them!

Thanks!