Aylur / dotfiles

My personal config files
Other
2.44k stars 127 forks source link

eww widget got deallocated #27

Closed fr13ndxd closed 1 year ago

fr13ndxd commented 1 year ago

my eww logs get spammed with

Caused by: Couldn't upgrade reference, widget got deallocated 2023-06-08T12:25:30.373Z ERROR eww::error_handling_ctx > Error while updating UI after state change

& media player doesnt work

when i run the init:

sh $HOME/.config/eww/scripts/init           1 ✘
 2023-06-08T12:36:56.273Z INFO  eww > Initializing Eww server. (/run/user/1000/eww-server_a998a4d5bb250fd2)
Run `eww logs` to see any errors while editing your configuration.
 2023-06-08T12:36:56.275Z INFO  eww::server > Loading paths: config-dir: /home/fr13nd/.config/eww, ipc-socket: /run/user/1000/eww-server_a998a4d5bb250fd2, log-file: /home/fr13nd/.cache/eww_a998a4d5bb250fd2.log

error: referenced unknown widget `desktop`
   ┌─ ./setups/leftbar.yuck:17:49
   │
17 │                         :anchor "bottom right")(desktop))
   │                                                 ─────── Used here

Cache directory: /home/fr13nd/.cache/aylur/

(myshell:465330): Gjs-CRITICAL **: 14:36:56.886: JS ERROR: GLib.SpawnError: Failed to execute child process “eww” (Argument list too long)
_output@file:///home/fr13nd/.config/eww/scripts/myshell/main.js:98:50
vfunc_activate/<@file:///home/fr13nd/.config/eww/scripts/myshell/main.js:71:28
vfunc_activate@file:///home/fr13nd/.config/eww/scripts/myshell/main.js:71:10
App@file:///home/fr13nd/.config/eww/scripts/myshell/main.js:61:14
main@file:///home/fr13nd/.config/eww/scripts/myshell/main.js:133:5
@file:///home/fr13nd/.config/eww/scripts/myshell/myshell:46:5
thyeun commented 1 year ago

will this related to the media player appear or not? it sound related too. polkit-gnome and polkit-kde look same to me.

fr13ndxd commented 1 year ago

well for media player and null icons too

fr13ndxd commented 1 year ago

try polkit-kde as hyprland recommends it

thyeun commented 1 year ago

my setting different, as below

exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP

if disable the polkit-gnome, my eww still work, only that media player not show out. =.=

fr13ndxd commented 1 year ago

well i have aylur dotfiles and polkit-kde and media player and all icons show now

thyeun commented 1 year ago

show me your hyprland.conf setting for the polkit? =.=

fr13ndxd commented 1 year ago

image (dont ask me why i have the &´s here)

thyeun commented 1 year ago

no different to me.

D3vil0p3r commented 1 year ago

Same. I have a theory. Here the problem of icons should be related to a race condition issue (I think). When the environment starts, Hyprland Aylur configuration startup.conf runs:

~/.config/eww/scripts/init

This file runs myshell script that has the task to set those icons. The content of init is:

#!/usr/bin/env bash

pkill eww
pkill myshell
eww daemon

# HDMI=$(hyprctl monitors -j | jq .[1].name)
# if [[ $HDMI == '"HDMI-A-1"' ]]; then
#     # open both monitor stuff
# else
#     # open main monitror stuff
# fi

eww open bar
# eww open dock
eww open desktop
eww open notifications_popup
# eww inspector

$HOME/.config/eww/scripts/myshell/./myshell --eww --file

So, it runs the eww daemon, open the elements of our desktop, and at the end runs myshell --eww --file. Normally, when myshell is run, it should set icons.

If you go now, after the initialization, to run myshell --eww --file you could get:

Cache directory: /home/myuser/.cache/aylur/
Another Notification Daemon is already running!

Since myshell is run at the end of init, it means one thing imho:

Sometimes myshell is able to run correctly because there is no this "Another Notification Daemon" so it can run cleanly and set the icons. Other times, during the initialization, this strange "Notification Daemon" starts before myshell is running, and it causes myshell to get that message, so it cannot run and cannot set the icons. @Aylur my theory is right?

thyeun commented 1 year ago

@D3vil0p3r Totally agree, that is the reason i have to manually trigger myshell again. it should trigger after everything finish (let make it everything finish as one cycle), but some how, this so call one cycle cant finish it, than something been trigger early.

D3vil0p3r commented 1 year ago

Another problem Im getting often is: when I open the App Launcher (by Super + R), and it appears on the center, sometimes I search for an application, for example Brave browser, and when I double click on it, the application opens, but the application launcher window does not close itself, it remains opened, even if I change workspace and if I try to killactive, it remains. I can open other apps by it but the focus remains on the application launcher and my only solution is to reboot. Did you get at least one time this strange behavior? It happens to me often.

thyeun commented 1 year ago

@D3vil0p3r For the apps, yes, i get it also, but for me, it might because my old laptop less RAM issue, that why i didn care it so much.

my laptop still is Intel Gen-2 with 8Gb RAM. =.= hehehehehe

D3vil0p3r commented 1 year ago

@D3vil0p3r For the apps, yes, i get it also, but for me, it might because my old laptop less RAM issue, that why i didn care it so much.

my laptop still is Intel Gen-2 with 8Gb RAM. =.= hehehehehe

I dont think it is due to your old laptop. I have a MSI GL63 laptop that is good in performance (with an Intel Integrated GPU and NVIDIA RTX) and 8 GB of RAM.

Aylur commented 1 year ago

I don't think polkit has anything to do with this. myshell is a notification daemon aswell, and running it twice is not handled so if you run it twice you will get Another Notification Daemon is already running! because another instance of myshell is already running. There is no race condition. The init script is sequential not concurrent, eww is already running when myshell is launched. You can check this behaviour by

#run the init
~/.config/eww/scripts/init
#open another terminal
#check state, everything should be set
eww state
#reload eww
eww reload
#check state and see that the variables were reset
eww state
#if you run myshell again, it will not function as expected, because there is another instance already running
#this should output the Another Notification Daemon is already running! message
~/.config/eww/scripts/myshell/myshell

if you have any issue just run the init script. It will reload everything and you will see the logs if there is any problem.

thyeun commented 1 year ago

@D3vil0p3r But it not happen to all people that been using, only me until now, my media player from beginning till today, never ever appear one time. =.=

thyeun commented 1 year ago

@Aylur No issue inside log file until today. that why i blame my old laptop, not perform well. hehehehe

Aylur commented 1 year ago

Another problem Im getting often is: when I open the App Launcher (by Super + R), and it appears on the center, sometimes I search for an application, for example Brave browser, and when I double click on it, the application opens, but the application launcher window does not close itself, it remains opened, even if I change workspace and if I try to killactive, it remains. I can open other apps by it but the focus remains on the application launcher and my only solution is to reboot. Did you get at least one time this strange behavior? It happens to me often.

killactive won't do anything, because it is a layershell window not a regular one. If you click outside of the box it should disappear or if you hit enter while the entry has focus it should launch the first app in the list then close the window. I can't make it disappear when ESC is pressed, it is just a limitation of Eww.

thyeun commented 1 year ago

@Aylur can the dbus of mpris.mediaplayer, keep refresh till it find a player (run it at the background)?

Aylur commented 1 year ago

@Aylur can the dbus of mpris.mediaplayer, keep refresh till it find a player (run it at the background)?

I am not sure what you are reffering to. If you first launch myshell it will run a query of the available dbus interfaces and if it finds an mpris one it will attach to it. After this it will start listening on the /org/freedesktop/DBus interface which will signal if an mpris interface appeared or disappeared. There is no polling it is all event based.

Aylur commented 1 year ago

@thyeun do this

have a media player open then

#open a terminal and run
~/.config/eww/scripts/init

#open another terminal and run
eww get media | jq

what is the output?

thyeun commented 1 year ago

@Aylur Image below

Screenshot_2023-06-12-01-14-56_13371

thyeun commented 1 year ago

@Aylur It cant continue to run eww get media | jg, i have to ctrl + c only can continue

Aylur commented 1 year ago

if you ctrl+c you kill the running myshell process that is why I said to open another terminal, but its good enough. Anyway, your issue is still with the app_launcher. Gjs-CRITICAL means that parts of the code will not run.

Aylur commented 1 year ago

Pull my commit and try again.

thyeun commented 1 year ago

The log file will keep increase till now 30Gb, after i try the step as you mentioned

thyeun commented 1 year ago

@Aylur I love you so much, the media player now working and appear automatically, and play-pause also change the icon accordingly.

D3vil0p3r commented 1 year ago

Another problem Im getting often is: when I open the App Launcher (by Super + R), and it appears on the center, sometimes I search for an application, for example Brave browser, and when I double click on it, the application opens, but the application launcher window does not close itself, it remains opened, even if I change workspace and if I try to killactive, it remains. I can open other apps by it but the focus remains on the application launcher and my only solution is to reboot. Did you get at least one time this strange behavior? It happens to me often.

killactive won't do anything, because it is a layershell window not a regular one. If you click outside of the box it should disappear or if you hit enter while the entry has focus it should launch the first app in the list then close the window. I can't make it disappear when ESC is pressed, it is just a limitation of Eww.

It is stucked there, because even if I click outside of the box or hit enter, it does not focus on the other windows and it remains opened. If you want to try to test it, try to press CTRL + R, sometimes launch an application, press again CTRL + R e try to close it.

Aylur commented 1 year ago

What is the output of eww logs and ~/.config/eww/scripts/init when this occurs?

fr13ndxd commented 1 year ago

@D3vil0p3r as the fi in the media player, i think i know why the issue, you probably removed eww open desktop or something from eww/scripts/init, as it happened to me when i removed that eww open desktop

fr13ndxd commented 1 year ago

i dont know why it broke media player but alright

thyeun commented 1 year ago

@FR13NXD the fi appear on the media player, it is codepoint error from ubuntu nerd font. You can change that on the file main.js. On this line 'deafult': '', change the music icon to the correct codepoint from nerd font cheatsheet.

fr13ndxd commented 1 year ago

image so if i add here for example discord, it will show discord icon when i play discord sounds?

fr13ndxd commented 1 year ago

or some other icon like brave browser, or tor browser when im playing songs from it right?

thyeun commented 1 year ago

Let me further explain this.

  1. deafult - is something you can use likevlc, it will fall into this group.
  2. spotify - it is make it only for spotify.
  3. firefox - librewolf also fall into this group.
  4. mpv - any that play under mpv will fall into this group.

you can add extra, but make sure the WM_class or app-ID are same, and you have to add-in some color into the scss

my main.js

export const PlayerIcons = {
    'deafult': '󰎆',
    'spotify': '',
    'firefox': '󰈹',
    'mpv': ''
}

And my color for each player inside bar_widget.scss

.icon{
        &.vlc{ color: $yellow; }
        &.spotify{ color: $green; }
        &.firefox{ color: $orange; }
        &.mpv{ color: $magenta; }
    }

if you create wofi player (as i'm doing it also) it will fall into mpv, i'm using it to run under wofi

fr13ndxd commented 1 year ago

alright

fr13ndxd commented 1 year ago

so when i add some app id that can play music, and icon for it and css, it should work and everything will be fine

thyeun commented 1 year ago

make sure it is mpris protocol too. =.=

D3vil0p3r commented 1 year ago

What is the output of eww logs and ~/.config/eww/scripts/init when this occurs?

For reproducing the issue, I just hit SUPER + R multiple times. After the event of the issue, eww logs does not produce additional logs, but it stays with the following info:

 2023-06-11T15:19:19.728Z ERROR eww::error_handling_ctx > The script for the `volume`-variable exited unsuccessfully
 2023-06-11T15:19:22.724Z ERROR eww::error_handling_ctx > The script for the `brightness`-variable exited unsuccessfully
 2023-06-11T15:19:22.731Z ERROR eww::error_handling_ctx > The script for the `volume`-variable exited unsuccessfully
 2023-06-11T15:19:25.732Z ERROR eww::error_handling_ctx > The script for the `brightness`-variable exited unsuccessfully
 2023-06-11T15:19:25.735Z ERROR eww::error_handling_ctx > The script for the `volume`-variable exited unsuccessfully
 2023-06-11T15:19:25.953Z INFO  eww::server             > Shutting down eww daemon...
 2023-06-11T15:19:25.953Z INFO  eww::app                > Received kill command, stopping server!
 2023-06-11T15:19:25.953Z INFO  eww::app                > Closing gtk window notifications_popup
 2023-06-11T15:19:25.953Z INFO  eww::app                > Closing gtk window desktop
 2023-06-11T15:19:25.953Z INFO  eww::app                > Closing gtk window bar

The content of ~/.config/eww/scripts/init is:

#!/usr/bin/env bash

pkill eww
pkill myshell
eww daemon

# HDMI=$(hyprctl monitors -j | jq .[1].name)
# if [[ $HDMI == '"HDMI-A-1"' ]]; then
#     # open both monitor stuff
# else
#     # open main monitror stuff
# fi

eww open bar
# eww open dock
eww open desktop
eww open notifications_popup
# eww inspector

$HOME/.config/eww/scripts/myshell/./myshell --eww --file

The keybinding of SUPER + R is:

bind = SUPER, R, exec, bash ~/.config/eww/scripts/launcher toggle_menu app_launcher

So, there should be some weird element that could create my issue in .config/eww/scripts/launcher:

function toggle_menu {
    MAIN=$(eww get main_monitor)
    hyprctl keyword blurls "remove,gtk-layer-shell"
    STATE=$(eww windows | grep $1$MAIN | awk '{print substr ($0, 0, 1)}')
    if [[ $STATE == '*' ]]; then 
        if [[ $1 == 'powermenu' ]]; then hyprctl keyword blurls "remove,gtk-lay>
        eww close $1$MAIN;
    else
        if [[ $1 == 'powermenu' ]]; then hyprctl keyword blurls "gtk-layer-shel>
        if [[ $1 == 'app_launcher' ]]; then $HOME/.config/eww/scripts/apps quer>
        eww open $1$MAIN;
    fi
}

Could it be a race condition when the SUPER + R is pressed multiple times quickly?

I just note that, if I try to run each command of this function, and on the terminal I run eww get main_monitor, I get:

Variable not found "main_monitor"

and this variable seems to not be defined anywhere.

thyeun commented 1 year ago

Not sure what you all facing. But my log file always stay as empty even that time the media player not appear. Screenshot_2023-06-14-11-14-12_19100

thyeun commented 1 year ago

@D3vil0p3r Are you using rofi or wofi? if you using wofi, from the launcher file, you have to change the line if [[ $1 == 'app_launcher' ]]; then wofi --show drun; fi

And for the main_monitor, try change the line MAIN=$(eww get main_monitor) to MAIN = "", see any help on that.

D3vil0p3r commented 1 year ago

@D3vil0p3r Are you using rofi or wofi? if you using wofi, from the launcher file, you have to change the line if [[ $1 == 'app_launcher' ]]; then wofi --show drun; fi

And for the main_monitor, try change the line MAIN=$(eww get main_monitor) to MAIN = "", see any help on that.

I didn't customize the original files of the repo so I don't know if it uses wofi or rofi. Btw I also changed "MAIN" value but my issue is still there.

Then, what I noted is that, CTRL+C combination that is used for interrupting command execution is not working on this theme despite it is not overridden in the keybind file.

Furthermore, I note that, when I replicate the issue I explained in my previous comment and then I reboot, after reboot, I have two vertical bars... image

And the search app window, instead of showing the lens icon, shows fl, and does not show the kitty small background on it as shown in the README of the repo: image

thyeun commented 1 year ago

@D3vil0p3r You have to modify the variable.scssfile according to your correct path, and change the wallpaper.png or replace it, it is symlink that the reason your kitty not show inside your launcher. =.=

fi in the launcher same case as the media player icon that show fi, it is codepoint error from ubuntu nerd font. you have to replace it from the nerd font cheatsheet with the correct one in the file app_launcher.yuck