Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Focused module is not always display the currently focused window #488

Closed
bluebyt opened this issue Mar 10, 2024 · 19 comments · Fixed by #556
Closed

The Focused module is not always display the currently focused window #488

bluebyt opened this issue Mar 10, 2024 · 19 comments · Fixed by #556
Labels
bug Something isn't working

Comments

@bluebyt
Copy link

bluebyt commented Mar 10, 2024

Describe the bug
The Focused module is not always display the currently focused window, sometime the module is blank even if the window is focused

To Reproduce
Steps to reproduce the behavior:

  1. Navigate between windows

Expected behavior
Focused on the windows all the time

System information:

  • Distro: Arch Linux
  • Compositor: Wayfire, Hyprland
  • Ironbar version: 0.15.0-pre

In the video you can see that I try Wayfire, Hyprland and at the end I compared the Window focus module with Waybar.
https://streamable.com/7xzbwu

Configuration

Config
let {
    $tray = { type = "tray" }
  $clock = {
    type = "clock"
    format = "%a, %H:%M:%S"
   // format = "%d/%m/%Y %H:%M"
  }
  
    $focused = {
      type = "focused"
      show_icon = true
      show_title = true
      icon_size = 24
      icon_theme = "Tela-circle-nord" 
      truncate.mode = "end"
      truncate.max_length = 25
    }
    
    $SysInfo = { 
    type = "sys_info"
    interval.temps = 3
    interval.disks = 300
    interval.memory = 30
    interval.cpu = 1
    interval.networks = 3
      
     format = [
      " {temp_c:coretemp-Package-id-0}°C "
      " {disk_free:/}GB "
      " {memory_percent}% "
      " {cpu_percent}% "
 //   "󰓢 {net_down:enp4s0} / {net_up:enp4s0} Mbps"
    ]
    }

    $cava = {
        transition_type = "slide_end"
        transition_duration = 750
        name = "cava"
        type = "script"
        mode = "watch"
        cmd = "/home/bluebyt/.config/ironbar/scripts/cava2"
   }
  

   $mpris = {
        type = "music"
        player_type = "mpris"
        on_click_middle = "playerctl play-pause"
        on_scroll_up = "playerctl volume +5"
        on_scroll_down = "playerctl volume -5"

    }

    $mpd_local = { 
         type = "music" 
         player_type = "mpd" music_dir = "/home/bluebyt/Music"                 
         truncate.mode = "end" 
         truncate.max_length = 100 
         }
         
    $mpd_server = { 
         type = "music" 
         player_type = "mpd" 
         host =   "127.0.0.1:6600" 
         truncate = "end" 
         }

    $volume = {
        transition_type = "slide_end"
        transition_duration = 350
        type = "custom"
        bar = [ 
            {
                type = "slider"
                class = "scale"
                length = 100
                max = 100
                on_change = "!wpctl set-volume @DEFAULT_SINK@ $0%"
                on_scroll_down = "wpctl set-volume @DEFAULT_SINK@ 2%-"
                on_scroll_up = "wpctl set-volume @DEFAULT_SINK@ 2%+"
                on_click_right = "pavucontrol"
                value = "100:/home/bluebyt/.config/ironbar/scripts/volume"
                tooltip = "{{/home/bluebyt/.config/ironbar/scripts/volume}}%"
            }
        ]
    }

    $workspace = {
        type = "workspaces"
        sort = "alphanumeric"
        on_scroll_up = "hyprctl dispatch workspace -1"
        on_scroll_down = "hyprctl dispatch workspace +1"
    }
    $wlogout = {
        type = "custom"
        bar = [ 
            {
                type = "button"
                name = "wlogout"
                class = "wlogout"
                label = ""
                on_click = "!~/.config/ironbar/scripts/wlogout"
            }
        ]
    }
    
    $pacman = {
        type = "custom"
        bar = [ 
            {
                type = "label"
                name = "pacman"
                class = "pacman"
                label = " {{90000:checkupdates | wc -l}}"
                }
        ]
    }
    
    $start = [ $mpd_local ]
    $center = [ $focused ]
    $end = [ $volume $pacman $SysInfo $clock $wlogout]
}
in {
        icon_theme = "Tela-circle-nord"
        position = "top"
        start = $start
        center = $center
        end = $end
}
Styles
@define-color color_bg #2e3440;
@define-color color_bg_dark #292e39;
@define-color color_border #424242;
@define-color color_border_active #b48ead;
@define-color color_text #5e81ac;
@define-color color_urgent #bf616a;

.container {
  font-family: Roboto Mono SemiBold;
  font-weight: bold;
  font-size: 20px;
}

#cava {
  font-family: renogare;
}

.clock {
  font-size: 10px;
  font-weight: normal;
  padding: 0px 10px 0px 10px;
  background: linear-gradient(45deg, rgb(235,203,139) 0%, rgb(208,135,112) 50%, rgb(180, 142, 173) 100%);
  background-size: 300% 300%;
  animation: gradient 2s ease infinite;
  text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.377);
  box-shadow: rgba(0, 0, 0, 0.288) 2px 2px 5px 2px;
  border-radius: 16px;
  margin: 10px 10px 10px 10px;
  font-family: Roboto Mono SemiBold;
}

.clock_date {
  font-family: Roboto Mono SemiBold;
  font-weight: normal;
  font-size: 18px;
  color: rgb(94,129,172);
}


.background {
  background-color: rgba(0, 0, 0, 0)
}

/* base */
.sysinfo .item,
.script,
.tray {
  padding: 0px 10px;
  margin-top: 10px;
  margin-bottom: 10px;
  margin-right: 10px;
  border-radius: 15px;
  background: #88c0d0;
  color: #4c566a;
  box-shadow: rgba(0, 0, 0, 0.116) 2px 2px 5px 2px;
}

.wlogout {
  padding: 0px 10px;
  margin-top: 10px;
  margin-bottom: 10px;
  margin-right: 10px;
  border-radius: 15px;
  background: #a3be8c;
  color: #4c566a;
  font-size: 24px;
  box-shadow: rgba(0, 0, 0, 0.116) 2px 2px 5px 2px;
}

.pacman {
  padding: 0px 10px;
  margin-top: 10px;
  margin-bottom: 10px;
  margin-right: 10px;
  border-radius: 15px;
  background: #a3be8c;
  color: #4c566a;
  font-size: 20px;
  box-shadow: rgba(0, 0, 0, 0.116) 2px 2px 5px 2px;
}

.scale,
.internet,
.script {
  transition: all 0.5s cubic-bezier(0.5, 1, 0.89, 1);
  margin-top: 10px;
  margin-bottom: 10px;
  margin-right: 10px;
  padding-right: 20px;
  padding-left: 20px;
  padding-bottom: 3px;
  box-shadow: rgba(0, 0, 0, 0.288) 2px 2px 5px 2px;
  text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.377);
  border-radius: 15px;
  background: rgb(180,142,173);
  background: linear-gradient(45deg, rgba(180,142,173,1) 0%, rgba(180,142,173,1) 43%, rgba(129,161,193,1) 80%, rgba(94,129,172,1)100%);
  background-size: 300% 300%;
  animation: gradient 5s ease infinite;
  color: #fff;
}


scale trough {
  border-radius: 16px;
  background-color: #E7D4CB;
  box-shadow: 0 2px 3px 2px rgba(00, 00, 00, 0.4);
  min-height: 10px;
  min-width: 70px;
  margin: 0px 5px 10px 10px;
}

scale value {
  color: #77a5bf;
  font-size: 0px;
}

scale trough highlight {
  background-image: linear-gradient(to right, #afcee0 30%, #92B6F4 50%, #77a5bf 100%);
  border-radius: 10px;
  background-color: #afcee0;
}

.focused {
  color: rgb(76,86,106);
  font-size: 20px;
  padding: 0px 10px 0px 10px;
  margin: 10px 10px 10px 0px;
  background: rgb(94,129,172);
  background: linear-gradient(45deg, rgb(129,161,193) 0%, rgb(180,142,173) 43%, rgb(163,190,140) 100%);
  background-size: 300% 300%;
  animation: gradient 5s ease infinite;
  border-radius: 16px;
}


/* cpu */
.sysinfo .item:nth-child(odd) {
  background: rgb(143,188,187);
  background: linear-gradient(52deg, rgba(180,142,173,1) 0%, rgba(136,192,208,1) 32%, 	rgba(129,161,193,1) 72%, rgba(163,190,140,1) 100%);
  background-size: 300% 300%;
  animation: gradient 20s ease infinite;
  text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.377);
  /* background-color: #b4befe; */
  color: #4c566a;
}

.music,
.clock {
  margin-top: 10px;
  margin-bottom: 10px;
  margin-right: 10px;
  padding-right: 20px;
  padding-left: 20px;
  padding-bottom: 3px;
  box-shadow: rgba(0, 0, 0, 0.288) 2px 2px 5px 2px;
  text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.377);
  border: none;
  border-radius: 15px;
  font-size: 20px;
  background: rgb(202, 158, 230);
  background: linear-gradient(45deg, rgba(202, 158, 230, 1) 0%, rgba(245, 194, 231, 1) 43%, rgba(180, 190, 254, 1) 80%, rgba(137, 180, 250, 1) 100%);
  background-size: 300% 300%;
  animation: gradient 10s ease infinite;
  color: #fff;
}

/* -- music -- */

.music .contents


.popup-music

.tray {
  color: rgb(84, 111, 175);
  font-size: 15px;
  padding: 0px 10px 0px 10px;
  margin: 10px 10px 10px 0px;
  background: rgb(238, 190, 190);
  background: linear-gradient(45deg, rgb(244, 219, 214) 0%, rgb(223, 221, 238) 43%, rgb(245, 208, 225) 100%);
  background-size: 300% 300%;
  animation: gradient 5s ease infinite;
  border-radius: 16px;
}

.tray>.passive {
  -gtk-icon-effect: dim;
}

.tray>.needs-attention {
  -gtk-icon-effect: highlight;
  background-color: #eb4d4b;
}

.workspaces {
  font-family: Renogare;
  font-weight: normal;
  font-size: 25px;
  font-weight: normal;
  margin: 10px 0px 0px 20px;
  border-radius: 16px;
}

.workspaces .item {
  box-shadow: rgba(0, 0, 0, 0.116) 2px 2px 5px 2px;
  border: unset;
  background: #fff;
  border-radius: 15px;
  margin: 10px 10px 15px 0px;
  padding: 5px 20px 5px 20px;
  color: #cba6f7;
}

.workspaces .item.focused {
  border: unset;
  font-size: 25px;
  transition: all 0.5s cubic-bezier(0.5, 1, 0.89, 1);
  box-shadow: rgba(0, 0, 0, 0.288) 2px 2px 5px 2px;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.377);
  padding: 5px 10px 5px 10px;
  border-radius: 16px;
  margin: 10px 10px 15px 0px;
  background: rgb(202, 158, 230);
  background: linear-gradient(45deg, rgba(202, 158, 230, 1) 0%, rgba(245, 194, 231, 1) 43%, rgba(180, 190, 254, 1) 80%, rgba(137, 180, 250, 1) 100%);
  background-size: 300% 300%;
  animation: gradient 10s ease infinite;
  color: #fff;
}


@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}


tooltip.background {
  background-color: rgba(00, 00, 00, 0.5);
  font-size: 18px;
  border-radius: 10px;
  color: #FDFDFD;
}

tooltip * {
  padding: 4px;
  background-color: transparent;
  color: white;
}

.host tooltip {
  background-color: rgba(255, 00, 00, 0.5);
}

.popup-clock {
  font-weight: bolder;
  background: rgb(46,52,64);
  border-radius: 10px;
}

.popup-clock .calendar-clock {
    color: #5e81ac;
    font-size: 2.5em;
    padding-bottom: 0.1em;
}

.popup-clock .calendar {
    background-color: #2e3440;
    color: @color_text;
    border-radius: 10px
}

.popup-clock .calendar .header {
    padding-top: 1em;
    border-top: 1px solid @color_border;
    font-size: 1.5em;
}

.popup-clock .calendar:selected {
    background-color: @color_border_active;
}
@bluebyt bluebyt added the bug Something isn't working label Mar 10, 2024
@JakeStanger
Copy link
Owner

Thanks for the video, this seems like strange behaviour.

Could you reproduce this please with IRONBAR_LOG=debug set and send the log file? Hopefully only a single example of focusing a window and it not working, then ie changing the tab to fix it should be enough.

@bluebyt
Copy link
Author

bluebyt commented Mar 10, 2024

Where I put this line IRONBAR_LOG=debug ?

@JakeStanger
Copy link
Owner

That's an environment variable. You can for example start Ironbar with

$ IRONBAR_LOG=debug ironbar

@bluebyt
Copy link
Author

bluebyt commented Mar 10, 2024

I start ironbar with IRONBAR_LOG=debug ironbar and now that working as expected! and then I though the problem come from that the way I started ironbar.
Until now I start ironbar from the terminal "$ironbar &" because when I tried to put it in wayfire.ini it does't started.
wayfire.ini
[autostart]
bar = ironbar

I will still investigating the issue.

It seem that every time I think I find a bug that is either my system of something I am doing wrong lol!

@bluebyt
Copy link
Author

bluebyt commented Mar 11, 2024

It seem to happens less frequently. Here the log file.

Log file

@bluebyt
Copy link
Author

bluebyt commented Mar 11, 2024

Sometime when I started Ironbar, I see this message of a crash and the focused module doesn't work, I don't know if it's related to this issue.
I have update the log file, but I dont see any message related to the focused module.
Log file

Also I have installed a VM with wayfire, ironbar, because I want to check if the problem is specific to my system,

2024-03-11T22:37:49.046744Z INFO ironbar: 111: Ironbar version 0.15.0-pre
2024-03-11T22:37:49.046764Z INFO ironbar: 112: Starting application
2024-03-11T22:37:49.048504Z ERROR ironbar::logging: 48: The application panicked (crashed).
Message: Failed to send message to channel: "Full(..)"
Location: src/clients/wayland/wlr_foreign_toplevel/mod.rs:82

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
2024-03-11T22:37:49.152512Z WARN ironbar::ipc::server: 31: Socket already exists. Did Ironbar exit abruptly?
2024-03-11T22:37:49.152538Z WARN ironbar::ipc::server: 32: Attempting IPC shutdown to allow binding to address
2024-03-11T22:37:49.152597Z INFO ironbar::ipc::server: 37: Starting IPC on /run/user/1000/ironbar-ipc.sock
2024-03-11T22:37:49.154372Z INFO ironbar::bar: 120: Initializing bar 'bar-24' on 'HDMI-A-1'
2024-03-11T22:37:49.159070Z ERROR ironbar::logging: 48: The application panicked (crashed).
Message: Failed to send message to channel: SendError { .. }
Location: src/clients/wayland/mod.rs:176

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
2024-03-11T22:37:49.161194Z INFO connect: mpd_protocol::connection: 306: connected successfully version="0.23.5"
2024-03-11T22:37:49.162266Z INFO mpd_utils::persistent_client: 65: Connected to 'localhost:6600'

@JakeStanger
Copy link
Owner

You're right, there's nothing related to the focused module in the log. What's interesting though is this:

2024-03-11T22:37:49.046764Z INFO ironbar: 112: Starting application
2024-03-11T22:37:49.048504Z ERROR ironbar::logging: 48: The application panicked (crashed).
Message: Failed to send message to channel: "Full(..)"
Location: src/clients/wayland/wlr_foreign_toplevel/mod.rs:82

Immediately on startup the foreign-toplevel client (which is what listens to application windows, ie required for focused/launcher) crashes trying to send an event. This would mean for some reason the Wayland client stops receiving events, which is a fairly fundamental issue. I'm not sure what would cause that.

Are you compiling Ironbar yourself using a feature set other than the default? Anything out of the normal at all? Do you get this error on sway/hyprland, or is it just Wayfire? I'm wondering if Wayfire has a bugged protocol impl.

@bluebyt
Copy link
Author

bluebyt commented Mar 12, 2024

I compiled with the instruction on the front page:
cargo build --release

Hyprland is broken on my system, I will try it later.

@bluebyt
Copy link
Author

bluebyt commented Mar 14, 2024

The crash doesn't seem to happen after reboot, but I have a lot of problem both with Hyprland and Wayfire.
The video is self-explanatory, even when I have a focused window, the module become blank.

Focused module

If you need more detail let me know.

@JakeStanger
Copy link
Owner

Is that video on Hyprland? Could you send your hyprland.conf please? Seems unlikely it could be anything there given Wayfire had the same issue, but it could be I guess.

@bluebyt
Copy link
Author

bluebyt commented Mar 14, 2024

Yes this is Hyprland. I can record another video with wayfire, the focused become blank, but the behavior is little bit different.
hyprland.conf

@bluebyt
Copy link
Author

bluebyt commented Mar 15, 2024

Hi, Are you able to replicate the issue?

@JakeStanger
Copy link
Owner

I have just given this a go with your ironbar/hyprland config and I am still not able to replicate the issue. For me the focused module works without fault.

I can't see any reason for it to not work for you. If the error in the first log no longer occurs, it should work, but with that error it should stop working entirely anyway, rather than partially as you're seeing.

Is your hardware particular weird/old? Are you running a particularly old version of Hyprland/Wayfire?

@bluebyt
Copy link
Author

bluebyt commented Mar 17, 2024

Then I guess the problem is my system. Hyrland/Wayfire are up to date and my Hardware 2 years old only, nothing special.

@JakeStanger
Copy link
Owner

JakeStanger commented Mar 17, 2024

I'll keep this open for now in case you find anything new, or in case anybody else hits the same issue, but for now I'm all out of ideas so I'm not sure I can do much I'm afraid. It does sound like you've got quite a few system issues - might be worth a refresh and seeing it that helps in general.

@JakeStanger
Copy link
Owner

Hey @bluebyt did you manage to get anywhere with this, or is this still an issue?

@bluebyt
Copy link
Author

bluebyt commented Apr 17, 2024

@JakeStanger I reinstated from scratch my system Arch, Gnome, Wayfire and Hyprland, but still the same issue.
If you want me to try something feel free to ask, I have no clue why the Window module become blank after one or 2 min. even though a Window is still focused.

@JakeStanger
Copy link
Owner

Sorry for the delay on this one. #544 duplicates this issue & I was able to track this down to unfocused window title changes based on the repro info there (you'll spot this coincides with your music changing track). Should finally have a fix in place shortly!

@bluebyt
Copy link
Author

bluebyt commented Apr 24, 2024

Thank you, I'm going to try that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants