brndnmtthws / conky

Light-weight system monitor for X, Wayland (sort of), and other things, too
https://conky.cc
GNU General Public License v3.0
7.31k stars 620 forks source link

[Bug]: $desktop variable not changing when switching desktops Linux Mint #1954

Open devoid1 opened 5 months ago

devoid1 commented 5 months ago

What happened?

i have been upgrading religiously, on 1.21.2 now. running linux mint 21.3. i have an nvidia video card, using nvidia drivers. i noticed suddenly (so i dont know when it started) that the $desktop variable is not changing. if you start conky while on desktop 2 it picks up desktop 2, but that doesnt change when switching desktops.

Version

1.21.2

Which OS/distro are you seeing the problem on?

Ubuntu

Conky config

conky.config = {

    background = true,
    update_interval = 1,
    cpu_avg_samples = 2,
    net_avg_samples = 2,

    override_utf8_locale = true,
    double_buffer = true,

    text_buffer_size = 1280,
    imlib_cache_size = 0,

--############################
-- - Window specifications - #
--############################
    own_window_class = 'Conky',
    own_window = true,
    own_window_type = 'desktop',
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
    border_inner_margin = 0,
    border_outer_margin = 5,

    own_window_transparent = false,
    own_window_argb_visual = true,
    own_window_argb_value = 175,-- semi-transparent

    minimum_width = 275, minimum_height = 275,
    maximum_width = 275,

    alignment = 'top_right',
    xinerama_head = 1,

--########################
-- - Graphics settings - #
--########################
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = true,

    use_xft = true,
    font = 'Liberation Sans:size=11',
    xftalpha = 1,
    total_run_times = 0,
    temperature_unit = 'fahrenheit',
    if_up_strictness = 'address',

--own_window_argb_visual yes
--default_color 656667
    default_shade_color = '#000000',
    default_outline_color = '#828282',

    default_color = '#909090',
    alignment = 'top_right',
    gap_x = 15,
    gap_y = 25,

    uppercase = false,

--########### MPD stuff ################
-- MPD host/port
--  mpd_host = '192.168.1.26',
--  mpd_port = 6600,
--
};

conky.text = [[
S Y S T E M    I N F O   ${goto 170}${font LCDMono:bold:size=11}${color #ddaa00}DESK ${desktop}${font Liberation Sans:size=10}${color #656667}
${color #a0a0a0}${hr}
Host:${color darkgrey}$alignr$nodename${color darkgrey}

Stack trace

No response

Relevant log output

No response

Caellian commented 5 months ago

This line is responsible for updating desktop number. Not related to nvidia.

My guess is that desktop window type doesn't get notified about the change, which is wrong. Not sure what causes this - likely we don't listen for PropertyNotify events when window type is desktop.

I'll be able to take a closer look in a few weeks because I have midterms (so I'm leaving triage), but try changing window type to normal in the meantime if it works (it should work on most DEs/WMs).

devoid1 commented 5 months ago

changing window type to "normal" causes $desktop variable to be updated correctly. ill run it this way for now. if you need testing at a later date i can help.

Caellian commented 5 months ago

@devoid1 thanks for your offer, but this likely won't need testing - if PropertyNotify can be listened to (some events can't in some cases) it should just work.

I'm self assigning this so I remember to fix it, but it's a good first issue and if someone wants to fix it in the meantime feel free to do so.

To fix, you need to select events for PropertyChangeMask on window.root after this line, and then return true before this line in the event handler if ev.window != window.window. I'm 80% sure this will work.

I currently have a bunch of opened PRs I need to cleanup and get merged before opening a new one.