gh0stzk / dotfiles

BSPWM environment with 18 themes. With a theme selector to change on the fly.
GNU General Public License v3.0
2.69k stars 201 forks source link

Multi desktop with eww #207

Closed 0xN1nja closed 2 months ago

0xN1nja commented 5 months ago

I have successfully installed the new rices and migrated old themes to the new one. Everything is done now.

However, I'm encountering issues with eww bars of andrea and z0mbi3 rice. The problems lies in the launch_bars function (Theme.sh), where proper iteration over the monitors list is not being performed:

launch_bars() {
    eww -c "${rice_dir}"/bar open --toggle bar
    polybar -q tray -c "${rice_dir}"/bar/polybar_tray.ini &
}

This should have been implemented as you did in other rices (with no eww bar):

for mon in $(polybar --list-monitors | cut -d":" -f1); do
        MONITOR=$mon polybar -q cata-bar -c "${rice_dir}"/config.ini &
done

However, I am unsure how to render eww components on secondary monitors by iterating. After some research, I came across this issue: https://github.com/elkowar/eww/issues/519, where it was suggested that rendering could be extended to the second desktop by passing --screen 1.

Unfortunately, this approach did not yield the desired results; the rendering was either confined to the first monitor and didn't appear on the second monitor.

Whenever I connect an external monitor, the eww bar (with or without --screen 1 flag) displays an odd result (I don't know if it is intended or not):

image

0xN1nja commented 5 months ago

The second issue, though not quite an issue but rather a question; is how the polybar handles the system tray.

Occasionally, I notice that the discord icon (systray) sometimes appears on my primary desktop, while at other times it appears on the secondary one (completely random). After conducting some research, I came across this issue: https://github.com/polybar/polybar/issues/1070.

For example:

image

The left screen is my primary monitor, while the right one is an external monitor.

I am still uncertain whether this behavior is intentional or not.

0xN1nja commented 5 months ago

The third issue is with the introduction of the tray module in polybar, which makes tray-position obsolete.

Its alignment is flawed in some rices; such as in Cristina:

image

So should I stick with the previous option? (the tray-position one)

0xN1nja commented 5 months ago

Last one, is with the 'music' widget, as I am unable to comprehend its functionality:

image

Whenever I try to play something via mpd, it consistently displays the same window.

I am uncertain whether there is a specific action I am required to take; like am I supposed to press something?

0xN1nja commented 5 months ago

Sorry for writing such a lengthy issue 😓

Please take your time and work on it at your own pace. Thank you for your attention to detail and your efforts in addressing them

gh0stzk commented 5 months ago

Of course I'll start from the last to the first.

The problem with the player, are you sure you are using the newest version of the script??? check your local file with this https://github.com/gh0stzk/dotfiles/blob/master/config/bspwm/scripts/MediaControl .

Thats a weird issue, but im guessing you are using old script. Anyways be sure to configure mpd correctly https://github.com/gh0stzk/dotfiles/wiki/MPD-Configuration


About the tray position in cristina, i dont understand, compare your local files with the ones in the repo or maybe you modified, because i dont see the power buttom in your image, maybe you dont remove a "sep" module in config.ini

Must look like this: Shot-2024-03-21-071550


About discord icon in your second monitor or randomly location, Does it happen to you with any icon or just with the discord one???

Beyond that, it could be an expected error since my setup is made for one monitor, although you can configure more monitors https://github.com/gh0stzk/dotfiles/wiki/Two-or-more-monitors-setup still So polybar loads "the same" bar on the other monitors. Your setup should be modified to have another bar in config.ini and that bar is configured specifically for the external monitor. I don't have another monitor, that's why I can't test code or add those types of setups.

In the link you left, there are some scripts and I have seen many more scripts that add the functionality you want. Basically to guide you on the right path, you need to define another polybar within config.ini, that polybar that is equal to the main one but you eliminate the tray module, and in the function that loads the polybar in theme.sh use the code from some script so that if it is the external monitor, that polybar is loaded there without the tray module.


The reason why your desktops were duplicated, from 6 to 12, is due to the WorkSpaces script within the z0mbi3/bar/scripts theme since you are duplicating the bar, the script is being executed 2 times and because of how it works internally, that it is the result.

Again, unfortunately, the workspaces script would have to be modified so that it works with more monitors, but try this, maybe it fix the duplication:

# Listen to bspwm changes
print_workspaces
bspc subscribe desktop node_transfer | while read -r _ ; do
    print_workspaces &
done

Remove the "&" in the last print_workspaces

0xN1nja commented 5 months ago

Thank you for responding so quickly. Yeah, I forgot to copy my latest music script. After copying it, It started working.


Regarding the Cristina rice, I haven't added the power button because it looks a bit odd on the polybar.

I tried adding a separator after the tray in the config.ini, but it didn't work because my main issue is that the icons of apps in the system tray (like Discord and Telegram) are not scaling properly:

image


Regarding the random placement of the systray, this issue occurs with any icon in the system tray; this is how I configured polybar (in every config.ini) as suggested by https://github.com/polybar/polybar/issues/763#issuecomment-331604987:

[bar/emi-bar]
monitor = ${env:MONITOR:}
monitor-strict = false
override-redirect = false
launch_bars() {
    for mon in $(polybar --list-monitors | cut -d":" -f1); do
        MONITOR=$mon polybar -q emi-bar -c "${rice_dir}"/config.ini &
    done
}

Another thing I noticed is that the 'update' module displays available updates on a single screen, while on the other screen, it shows 0 updates.

image

Am I missing something here? Or is it related to Polybar? I will create an issue in the polybar repo then.


I modified the workspace script (both in andrea and z0mbi3), but it didn't work; workspaces were still duplicating.

But the thing is, I want the eww bar to appear on every screen, just like the polybar. Is it possible? I also provided a link in one of my previous comments, https://github.com/elkowar/eww/issues/519, where it was suggested that rendering could be extended to the second desktop by passing --screen 1, but I don't think it is possible to render the bar on both monitors.

gh0stzk commented 5 months ago

about the icons in systray, did you tried to edit in modules.ini the module tray this option: tray-size = 72% change the value, 63% is the default one. that bar is very small, look normal but there is a border, border makes the bar looks bigger but is small for the space for modules.

gh0stzk commented 5 months ago

About your problems with second monitor, is hard for me to help you, because i dont have a second monitor. did u try for eww bar this: in eww.yuck in z0mbi3/bar look for the final of the file

(defwindow bar
    :geometry (geometry :x "15px"
                        :y "0%"
                        :anchor "left center"
                        :height "86%"
                        :width "47px")

    :reserve (struts :distance "5px"
                     :side "left")
    :wm-ignore false
    (bar))

first add monitor 0

(defwindow bar
        :monitor 0
    :geometry (geometry :x "15px"
                        :y "0%"
                        :anchor "left center"
                        :height "86%"
                        :width "47px")

    :reserve (struts :distance "5px"
                     :side "left")
    :wm-ignore false
    (bar))

then copy the code and change windows name and monitor to this

(defwindow bar-external
        :monitor 1
    :geometry (geometry :x "15px"
                        :y "0%"
                        :anchor "left center"
                        :height "86%"
                        :width "47px")

    :reserve (struts :distance "5px"
                     :side "left")
    :wm-ignore false
    (bar))

then in theme.sh try somithing like this

# Show bar on laptop screen
eww open bar --screen 0

# Show bar on external screen if connected
NB_MONITORS=$(hyprctl monitors -j | jq length)
if [ "$NB_MONITORS" -eq "2" ]; then
    ## hyprctl dispatch focusmonitor 1
    eww open bar-external --screen 1
fi

obviously change the hyprctl command for the one in bspwm to list monitors

gh0stzk commented 5 months ago

about the polybar and update script dont know, maybe yes is a bug in polybar, if you reload polybar in second monitor this fix the issue?

0xN1nja commented 5 months ago

Yeah, setting tray-size = 72% works perfectly, even 80% works fine too. But I still prefer rendering the systray in the old way (by not creating a module tray in modules.ini).


And that code snippet works perfectly!

image

I'll extend this in andrea rice as well, and then I'll give you the code after testing.


The only issue in polybar is with the systray and update script; otherwise my config is completely stable (until you push something new). I'll dive deeper and create an issue in the polybar's repo this week.


One last thing; is with padding of next button in andrea rice on the music widget:

image

And also, the check-network script isn't returning the SSID:

image

The SSID for my wifi isn't showing up properly on the bar.

gh0stzk commented 5 months ago

In just a few minutes I am going to push the update that integrates the rofi menu to manage connections, and that error that you mentioned in Andrea that does not return the ssid is corrected.

0xN1nja commented 5 months ago

what about the padding of next button?

gh0stzk commented 5 months ago

what about the padding of next button?

Oh yes, in ~/.config/bspwm/rices/andrea/andy/eww.yuck

on line 148 search for "󰓛 " just remove the extra space in stop buttom, to this "󰓛"

0xN1nja commented 2 months ago

Hey @gh0stzk, regarding the update module issue mentioned in https://github.com/gh0stzk/dotfiles/issues/207#issuecomment-2015833711, I asked the maintainer of polybar and they said that the issue is with the Update script itself:

https://github.com/polybar/polybar/issues/3127

Could you please take a look?

gh0stzk commented 2 months ago

Hey @gh0stzk, regarding the update module issue mentioned in #207 (comment), I asked the maintainer of polybar and they said that the issue is with the Update script itself:

polybar/polybar#3127

Could you please take a look?

Hello, i read the issue, and yes is a "checkupdates" script behaviour, pacman-contrib package is the one who provide that script, the problem is that the script doesnt handle 2 o more petitions at the same time, my script works as expected but to handle your issue, with 2 or more bars i need to think a solution.