Code Monkey home page Code Monkey logo

Comments (1)

Aire-One avatar Aire-One commented on May 27, 2024

Hello @saevarb,

I did some poking around to understand what's going on here.

[...] but only in the beginning. Hiding it and then clicking again correctly respects screen boundaries.

Basically, when you click on the widget, a timer is started to regularly "query" all the data and draw/update the widget displayed in the popup. The very first time the popup is visible, the timer has never run before, hence the widget is empty and Awesome tries to place a { width = 1, heigth = 1 } popup.

As a little experiment, if I change the following code

popup:move_next_to(mouse.current_widget_geometry)
-- Restart the timer, when the popup becomes visible
-- Emit the signal to start the timer directly and not wait the timeout first
popup_timer:start()
popup_timer:emit_signal("timeout")

with a delayed call for the popup:move_next_to (0,5 so that the timer callback has enough time to complete the work once)

                            -- popup:move_next_to(mouse.current_widget_geometry)
                            gears.timer {
                                timeout = 0.5,
                                single_shot = true,
                                autostart = true,
                                callback = function()
                                    popup:move_next_to(mouse.current_widget_geometry)
                                end,
                            }
                            -- Restart the timer, when the popup becomes visible
                            -- Emit the signal to start the timer directly and not wait the timeout first
                            popup_timer:start()
                            popup_timer:emit_signal("timeout")

The popup is correctly place from the first call!

This is NOT the solution you are looking for, but at least it points out the real issue. This timer logic was introduced with PR #246, so CC @atopion :)

I think the path forward is to separate the UI logic from the business logic. AKA the popup_timer:connect_signal('timeout' callback shouldn't be building the widget, but only updating the values. With this kind of separation, it's easier to have a "first draw" with default values to initialize the popup content.

from awesome-wm-widgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.