AlphaTechnolog / dotfiles

A repository that contains a collection of various rices that i made over the time
MIT License
736 stars 34 forks source link

attempt to compare number with nil #19

Closed N0c7u4 closed 1 year ago

N0c7u4 commented 1 year ago

As soon as the environment starts, multiple notifications are generated that never stop saying...

Cannot Detect App An Error Happened attempt to compare number with nil

i am using arch linux

                   -`                    n0c7u4@4n70n10 
                  .o+`                   -------------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: PS63 Modern 8RD REV:1.0 
               `+oooooo:                 Kernel: 6.1.4-arch1-1 
               -+oooooo+:                Uptime: 2 hours, 12 mins 
             `/:-:++oooo+:               Packages: 718 (pacman) 
            `/++++/+++++++:              Shell: bash 5.1.16 
           `/++++++++++++++:             Resolution: 1920x1080, 1920x1080 
          `/+++ooooooooooooo/`           WM: awesome 
         ./ooosssso++osssssso+`          Theme: decay # or dark_decay, or light_decay [GTK3] 
        .oossssso-````/ossssss+`         Terminal: kitty 
       -osssssso.      :ssssssso.        CPU: Intel i7-8565U (8) @ 4.600GHz 
      :osssssss/        osssso+++.       GPU: Intel WhiskeyLake-U GT2 [UHD Graphics 620] 
     /ossssssss/        +ssssooo/-       GPU: NVIDIA GeForce GTX 1050 Ti Max-Q 
   `/ossssso+/:-        -:/+osssso+-     Memory: 14817MiB / 15839MiB 
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/                           
 .`                                 `/                           

screenshot-TXG5Ry

Thank you very much for your attention, I would really appreciate your help

N0c7u4 commented 1 year ago

/usr/share/awesome/lib/wibox/widget/textbox.lua:171: bad argument #2 to 'parse_markup' (string expected, got nill)

you can debug the error says it is hosted here

N0c7u4 commented 1 year ago

I had the same error again but the solution I found is not possible, it seems that it was not correct

N0c7u4 commented 1 year ago

I have observed in the parts of the .config where the awesome folder is located, the times that the code uses the set_markup_silently() function and I comment them to see what changes there are, this does not make any changes, it remains the same...

The part of the code in the address where it says that the error is is the following...

--- Set the text of the textbox.(with
-- [Pango markup](https://docs.gtk.org/Pango/pango_markup.html)).
--
-- @tparam string text The text to set. This can contain pango markup (e.g.
--   `<b>bold</b>`). You can use `gears.string.escape` to escape
--   parts of it.
-- @method set_markup_silently
-- @treturn[1] boolean true
-- @treturn[2] boolean false
-- @treturn[2] string Error message explaining why the markup was invalid.
function textbox:set_markup_silently(text)
    if self._private.markup == text then
        return true
    end

    local attr, parsed = Pango.parse_markup(text, -1, 0)
    -- In case of error, attr is false and parsed is a GLib.Error instance.
    if not attr then
         return false, parsed.message or tostring(parsed)
    end

    self._private.markup = text
    self._private.layout.text = parsed
    self._private.layout.attributes = attr
    self:emit_signal("widget::redraw_needed")
    self:emit_signal("widget::layout_changed")
    self:emit_signal("property::markup", text)
    return true
 end
AlphaTechnolog commented 1 year ago

Hello, thanks for the investigation on the source code, although, that code you got was internal of the awesomewm code itself so it's not mine... the problem could be generated due to dependencies that aren't found in some scripts like in the ones used in the dashboard, per example, volume, temperature, etc, what shell are you using? as i saw, this setup could fail when using some shells like fish, which have another syntax that's not rlly similar to the bash one. can you check if the script of the volume and the temperature one are throwing errors?

cd ~/.config/awesome
./scripts/temp.sh
./scripts/volume.sh get

also, to see the logs that awesomewm is showing in console, you can try by using xephyr, that log will be useful to me to identify what's going on there xd.

As i saw you're using archlinux, you can install it by using.

sudo pacman -S xorg-x11-server-Xephyr

Then execute the next commands and gimme the output produced by Xephyr.

Xephyr -br -ac -noreset -screen 1366x768 :1 &
DISPLAY=:1 awesome
N0c7u4 commented 1 year ago

Thank you for answering because the error is not critical, since my temporary solution was to comment the lines that generate this repetitive notification between lines 7 and 14 of your notifications.lua code... but this is not a solution...

Before the request to verify the volume and temperature codes, they are fine, I raise and lower the volume correctly and the temperature is displayed on the dashboard properly, I also did what you asked me to test the codes and they do not throw any errors. .

To your other request this is the result...

in this section it is repeated constantly...

error: attempt to compare number with nil
2023-02-06 06:15:28 W: awesome: luaA_dofunction:78: error while running function!
stack traceback:
[C]: in function 'math.min'
/usr/share/awesome/lib/wibox/widget/slider.lua:381: in function 'wibox.widget.slider.set_value'
(...tail calls...)
...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:47: in function <...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:46>
(...tail calls...)
...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:62: in function <...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:61>
[C]: in field 'emit_signal'
/home/n0c7u4/.config/awesome/signal/volume.lua:17: in function </home/n0c7u4/.config/awesome/signal/volume.lua:16>
(...tail calls...)
/usr/share/awesome/lib/awful/spawn.lua:491: in function </usr/share/awesome/lib/awful/spawn.lua:485>
[C]: in function 'xpcall'
/usr/share/awesome/lib/gears/protected_call.lua:41: in function </usr/share/awesome/lib/gears/protected_call.lua:40>
(...tail calls...)
/usr/share/awesome/lib/awful/spawn.lua:591: in upvalue 'done'
/usr/share/awesome/lib/awful/spawn.lua:606: in function </usr/share/awesome/lib/awful/spawn.lua:598>
error: attempt to compare number with nil
2023-02-06 06:15:31 W: awesome: luaA_dofunction:78: error while running function!
stack traceback:
[C]: in function 'math.min'
/usr/share/awesome/lib/wibox/widget/slider.lua:381: in function 'wibox.widget.slider.set_value'
(...tail calls...)
...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:47: in function <...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:46>
(...tail calls...)
...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:62: in function <...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:61>
[C]: in field 'emit_signal'
/home/n0c7u4/.config/awesome/signal/volume.lua:17: in function </home/n0c7u4/.config/awesome/signal/volume.lua:16>
(...tail calls...)
error: attempt to compare number with nil
2023-02-06 06:15:34 W: awesome: luaA_dofunction:78: error while running function!
stack traceback:
[C]: in function 'math.min'
/usr/share/awesome/lib/wibox/widget/slider.lua:381: in function 'wibox.widget.slider.set_value'
(...tail calls...)
...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:47: in function <...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:46>
(...tail calls...)
...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:62: in function <...n0c7u4/.config/awesome/ui/dashboard/modules/controls.lua:61>
[C]: in field 'emit_signal'
/home/n0c7u4/.config/awesome/signal/volume.lua:17: in function </home/n0c7u4/.config/awesome/signal/volume.lua:16>
(...tail calls...)

It is worth clarifying that I uncommented the lines that I had commented again so that the repetitive error notification does not appear, therefore they must appear and they did appear in the last executed command that you requested...

on the other hand if someone sees this and wants to check the install command on arch linux is slightly different from the suggestion given...

sudo pacman -S xorg-server-xephyr

i made some changes since i wrote so now my distro is with another shell

imagen

AlphaTechnolog commented 1 year ago

Hello again, sorry for late response, i was kinda busy with exams lol... well this looks very strange, because it looks like it can't get the output of the volume signal, and this usually happen when it can't execute the volume.sh script because one of the next two reasons:

so my questions here are, are u using something like pipewire? the volume.sh script just works with pulseaudio iirc (sadly, i wanna change this because i figured out that pipewire is so much better and this script don't work at all)

and well, looks like now u're using zsh so it should work ok, but can you show me the output of the ./scripts/volume.sh get script? i wanna see if there is something diff there and on my system

in fact this issue is strange tbh :sweat_smile: cuz something in your end looks ok, but this is still failing LOL

quiltedstars commented 1 year ago

Having the exact same issue on void. Pulseaudio is my audio control, and running the scripts nets no errors. scripts/volume.sh tells me the value of my current sound volume (58). However, I'm also getting errors about the brightness function 'emit_signal'. So maybe my issue isn't with audio but with brightness. Will do some more looking

quiltedstars commented 1 year ago

Aha! Xephyr is no longer spitting out errors after I installed light (which tbf I thought wouldn't work on my computer, and maybe it doesn't, but it certainly satisfies the dotfiles). @St3v3n-4n4 I fixed the issues by installing playerctl, jq, jq-devel, and light. Don't know if that will help you.

AlphaTechnolog commented 1 year ago

Aha! Xephyr is no longer spitting out errors after I installed light (which tbf I thought wouldn't work on my computer, and maybe it doesn't, but it certainly satisfies the dotfiles). @St3v3n-4n4 I fixed the issues by installing playerctl, jq, jq-devel, and light. Don't know if that will help you.

oh so you stopped from getting the error notification?

quiltedstars commented 1 year ago

Aha! Xephyr is no longer spitting out errors after I installed light (which tbf I thought wouldn't work on my computer, and maybe it doesn't, but it certainly satisfies the dotfiles). @St3v3n-4n4 I fixed the issues by installing playerctl, jq, jq-devel, and light. Don't know if that will help you.

oh so you stopped from getting the error notification?

Yep! It's so perfect now. Thank you so much for creating such a beautiful theme.

N0c7u4 commented 1 year ago

if I have playerctl, jq and light installed, and the problem continues

quiltedstars commented 1 year ago

@St3v3n-4n4 Do you have the development version of jq installed? It also looks like the issue is likely with the volume part. I don't have pactl, but do you have all audio controls and drivers installed? Double check that devel versions (if available) are installed, I often find that is an issue.

N0c7u4 commented 1 year ago

I'm not using pipewire I'm using pulseaudio

this is the script, it works fine for me, the volume goes up and down

#!/usr/bin/env bash

SINK=$(pactl list short sinks | sed -e 's,^\\([0-9][0-9]*\\)[^0-9].*,\\1,' | head -n 1 | awk '{print $1}');

get () {
    pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | awk '{print $5}' | tr '%' ' ' | xargs
}

mute () {
    pactl set-sink-mute $SINK toggle
}

if [[ $1 == "get" ]]; then
    get
fi

if [[ $1 == "mute" ]]; then
    mute
fi

the command you told me to use returns nothing

./scripts/volume.sh get

It is that it is very strange, because everything works fine, only the error notification comes out constantly, my master solution was to deactivate it :v but it is not a solution anyway

N0c7u4 commented 1 year ago

the version I have is jq-1.6-4

quiltedstars commented 1 year ago

@St3v3n-4n4 The script for volume should return the value of your current volume. Mine is 19. If it's not returning a number, then even though you can adjust the slider, I don't think the module is working. And again, jq-1.6-4 is fine, but I also installed the development version. I think I have both alsa and pulse installed (I don't have pipewire installed, but pactl is the ctrl for pulse), maybe you could see if installing the alsa-pulse joint package thing works? Else I could see if there's an easy way to disable the audio widget.

quiltedstars commented 1 year ago

Okay, possible lead, @St3v3n-4n4 @AlphaTechnolog : When I run the side widget and adjust my volume, the header of the notification on the top right screen says Xfce Volume Control as the header. Could the issue be that somehow the widget is looking for xfce4-mixer?

N0c7u4 commented 1 year ago

okay yes, I'm seeing that the volume.sh script doesn't work, but set-volume.sh does, since the slider does work

N0c7u4 commented 1 year ago

but if mute works, in that script only mute works

quiltedstars commented 1 year ago

So likely it's not actually changing the volume? Running ./scripts/set-volume.sh get returns invalid volume specification (as it should). Can you run pactl --help?

N0c7u4 commented 1 year ago
bash set-volumen.sh 50

in this way you lower the volume to 50%

if it works for me

pactl --help
N0c7u4 commented 1 year ago

of the code, the truth is about to read it and looking at where it is called in the vs code, I think that set-volume is the one that is called when the volume bar is moved on the dashboard

N0c7u4 commented 1 year ago

I think it should be noted but if I don't make myself understood well it's because I use a translator, I speak Spanish

quiltedstars commented 1 year ago

Set-volume is called, but volume.sh is what is causing problems. Does 'pactl list sinks' work?

N0c7u4 commented 1 year ago

if it returns the following

Destino #0
    Estado: SUSPENDED
    Nombre: alsa_output.pci-0000_00_1f.3.analog-stereo
    Descripción: Audio Interno Estéreo analógico
    Controlador: module-alsa-card.c
    Especificación de muestra: s16le 2ch 48000Hz
    Mapa de canales: front-left,front-right
    Módulo propietario: 6
    Silencio: no
    Volumen: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
           balance 0,00
    Volumen base: 65536 / 100% / 0,00 dB
    Fuente que lo monitoriza: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
    Latencia: 0 usec, configurados 0 usec
    Indicadores: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
    Propiedades:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "ALC298 Analog"
        alsa.id = "ALC298 Analog"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.long_card_name = "HDA Intel PCH at 0xa4410000 irq 155"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1f.3"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "9dc8"
        device.product.name = "Cannon Point-LP High Definition Audio Controller"
        device.form_factor = "internal"
        device.string = "front:0"
        device.buffering.buffer_size = "352800"
        device.buffering.fragment_size = "176400"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Estéreo analógico"
        device.description = "Audio Interno Estéreo analógico"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    Puertos:
        analog-output-speaker: Speakers (tipo: Altavoz, prioridad: 10000, disponibilidad desconocida)
        analog-output-headphones: Headphones (tipo: Auriculares, prioridad: 9900, No disponible)
    Puerto Activo: analog-output-speaker
    Formatos:
        pcm
quiltedstars commented 1 year ago

Hmm, shows same as mine (besides minor device variations). Can you run the actual shell in the terminal? pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | awk '{print $5}' | tr '%' ' ' | xargs

N0c7u4 commented 1 year ago

if nothing returns me

I know that this is not interesting in the subject, but the truth is that the dotfile is very cool

awesomeGIF

quiltedstars commented 1 year ago

I think it might be because your computer is in Spanish!! Looking at what the file is calling, it's saying to output the result that comes after the word "Volume", but on your pactl list sinks it's "Volumen" instead. Could you try changing your global language locale to English and see if that helps?

N0c7u4 commented 1 year ago

hehehe What a mistake of mine, and that I changed several parts of the code because I used Spanish and I did not realize that detail, yes that was the error

quiltedstars commented 1 year ago

Hurray!! I'm so glad it's working now

N0c7u4 commented 1 year ago

the same for me, the truth is that it happened to me, I had already taken into account the language thing but this really happened to me, for someone who speaks Spanish the only thing they should change in the scripts is to use the word volumen and not volume

pactl list sinks | grep '^[[:space:]]Volumen:' | head -n $(( $SINK + 1 )) | tail -n 1 | awk '{print $5}' | tr '%' ' ' | xargs
N0c7u4 commented 1 year ago

Thank you very much for helping me. The truth is that for this problem I investigated for two full days to make it something very simple. @quiltedstars @AlphaTechnolog

quiltedstars commented 1 year ago

I'm glad to be able to help, and thank you for being patient in figuring out how to fix it rather than just giving up!

N0c7u4 commented 1 year ago

That's how Linux is, that's why I like it even though it sounds masochistic

AlphaTechnolog commented 1 year ago

Hey sorry for very late response, i was very busy with the job so :c

anyways, glad to see that you'all solved the problem successfully, right? imma close the issue, but if some of you thing that it should still be opened, feel free to reopen again