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

Tray has weird click behaviour #613

Closed
ToxicMushroom opened this issue May 31, 2024 · 12 comments · Fixed by #780
Closed

Tray has weird click behaviour #613

ToxicMushroom opened this issue May 31, 2024 · 12 comments · Fixed by #780
Labels
bug Something isn't working
Milestone

Comments

@ToxicMushroom
Copy link

Describe the bug
Double clicking on tray icons does not close the tray popup again.
Triple clicking does but only if enough time passed.
Quadrupple clicking seems to always close it again x), or I'm too slow.

The other modules don't show this behavior and their popups go away on the second click as expected. (e.g. sound, time/calendar, notifications)

To Reproduce
Steps to reproduce the behavior:

  1. Have tray module
  2. Have something in the tray
  3. Click fast twice on tray icon
  4. Menu didn't close again

Expected behavior
Menu closes on second click.

System information:

  • Distro: arch
  • Compositor: sway 1.9
  • Ironbar version: ironbar 0.16.0-pre

Configuration

Config
anchor_to_edges = true
height = 42
position = "top"
icon_theme = "Papirus-Dark"

[[start]]
type = "workspaces"
all_monitors = false
on_scroll_up = "swaymsg workspace prev_on_output"
on_scroll_down = "swaymsg workspace next_on_output"

[[end]]
type = "music"
player_type = "mpd"
music_dir = "/home/merlijn/Music"

#[end.truncate]
#mode = "end"
#max_length = 100

[[end]]
type = "music"
player_type = "mpd"
truncate = "end"


[[end]]
type = "sys_info"
format = [
    "  {cpu_percent}% | {temp_c:k10temp-Tccd1}°C",
    "  {memory_used} / {memory_total} GB ({memory_percent}%)",
    "󰋊 {disk_used:/} / {disk_total:/} GB ({disk_percent:/}%)",
    "󰓢 {net_down:enp5s0} / {net_up:enp5s0} Mbps",
]

[end.interval]
memory = 30
cpu = 1
temps = 5
disks = 300
networks = 3

[[end]]
type = "volume"
format = "{icon} {percentage}%"
max_volume = 100

[end.icons]
volume_high = "󰕾"
volume_medium = "󰖀"
volume_low = "󰕿"
muted = "󰝟"

[end.truncate]
mode = "end"
length = 50


[[end]]
type = "clock"

[[end]]
type = "tray"
direction = "left_to_right"

[[end]]
type = "notifications"
show_count = true

[end.icons]
closed_none = "󰍥"
closed_some = "󱥂"
closed_dnd = "󱅯"
open_none = "󰍡"
open_some = "󱥁"
open_dnd = "󱅮"
Styles
@define-color color_bg alpha(#2d2d2d, 0.7);
@define-color color_bg_dark alpha(#1c1c1c, 0.7);
@define-color color_border alpha(#424242, 0.7);
@define-color color_border_active alpha(#6699cc, 0.7);
@define-color color_text #ffffff;
@define-color color_urgent #8f0a0a;

/* -- base styles -- */

* {
    font-family: CaskaydiaCove Nerd Font, sans-serif;
    font-size: 16px;
    text-shadow: none;
    border: none;
    border-radius: 0;
    opacity: 1.0;
}

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

button, label {
    box-shadow: none;
    background: none;
    background-color: rgba(0, 0, 0, 0);
    color: @color_text;
}

button:hover {
    background-color: @color_bg_dark;
}

scale trough {
    min-width: 1px;
    min-height: 2px;
}

#bar {
    border-top: 1px solid @color_border;
    background-color: @color_bg;
    background-image: none;
    box-shadow: none;
}

.popup {
    border: 1px solid @color_border;
    padding: 1em;
}


/* -- clipboard -- */

.clipboard {
    margin-left: 5px;
    font-size: 1.1em;
}

.popup-clipboard .item {
    padding-bottom: 0.3em;
    border-bottom: 1px solid @color_border;
}

.popup-clipboard {
    background-color: @color_bg;
}


/* -- clock -- */

.clock {
    font-weight: bold;
    margin-left: 5px;
}

.popup-clock .calendar-clock {
    color: @color_text;
    font-size: 2.5em;
    padding-bottom: 0.1em;
}

.popup-clock {
    background-color: @color_bg;
    color: @color_text;
}

.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;
}

/* notifications */

.notifications .count {
    font-size: 0.6rem;
    background-color: @color_text;
    color: @color_bg;
    border-radius: 100%;
    margin-right: 3px;
    margin-top: 3px;
    padding-left: 4px;
    padding-right: 4px;
    opacity: 0.7;
}

/* -- script -- */

.script {
    padding-left: 10px;
}


/* -- sys_info -- */

.sysinfo {
    margin-left: 10px;
}

.sysinfo .item {
    margin-left: 5px;
}


/* -- tray -- */

.tray {
    background-color: rgba(0,0,0,0);
    margin-left: 10px;
}
.tray menu {
    background-color: rgba(0,0,0, 0.7);
    padding: 8px 0;
}
/* Overrides the label text just for the tray */
.tray label {
    /* color: black; */
}

/* -- volume -- */

.popup-volume .device-box {
    border-right: 1px solid @color_border;
}

.popup-volume {
    background-color: @color_bg;
}

/* -- power -- */

.popup-upower {
    background-color: @color_bg;
}

/* -- workspaces -- */

.workspaces .item.focused {
    box-shadow: inset 0 -3px;
    background-color: @color_bg_dark;
}

.workspaces .item:hover {
    box-shadow: inset 0 -3px;
}
@ToxicMushroom ToxicMushroom added the bug Something isn't working label May 31, 2024
@JakeStanger
Copy link
Owner

This behaviour should be down to GTK, as the tray uses actual menu widgets instead of a separate window like the other popups. I'll see if I can work around the strange behaviour though

@JakeStanger
Copy link
Owner

Finally getting round to clearing through the backlog. I'm not actually able to replicate this one, although I'm also not sure I can do anything about it from googling (I give GTK a sub-menu for the menu widget, it does the rest).

Are you able to demo the issue at all?

@rein1410
Copy link

What I also notice that clicking on one of the tray menu options with two different mouse buttons won't do anyting

Example:
I have Brave on the tray
I right click the Brave icon and the menu opens
I left click on 'About Brave' and it won't do anything

What works is:
I right click the Brave icon and the menu opens
I right click on 'About Brave' and it opens the about page

@ToxicMushroom
Copy link
Author

Finally getting round to clearing through the backlog. I'm not actually able to replicate this one, although I'm also not sure I can do anything about it from googling (I give GTK a sub-menu for the menu widget, it does the rest).

Are you able to demo the issue at all?

I'd happily demo it if I was able to install again
cargo install ironbar

error[E0432]: unresolved import `nix::fcntl::OFlag`
 --> /home/merlijn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/offer.rs:3:5
  |
3 | use nix::fcntl::OFlag;
  |     ^^^^^^^^^^^^^^^^^ no `OFlag` in `fcntl`

error[E0432]: unresolved import `nix::unistd::pipe2`
    --> /home/merlijn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/offer.rs:4:26
     |
4    | use nix::unistd::{close, pipe2};
     |                          ^^^^^
     |                          |
     |                          no `pipe2` in `unistd`
     |                          help: a similar name exists in the module: `pipe`
     |
note: found an item that was configured out
    --> /home/merlijn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.27.1/src/unistd.rs:1233:8
     |
1233 | pub fn pipe2(flags: OFlag) -> Result<(RawFd, RawFd)> {
     |        ^^^^^
     = note: the item is gated behind the `fs` feature

error[E0432]: unresolved imports `nix::fcntl::fcntl`, `nix::fcntl::F_GETPIPE_SZ`, `nix::fcntl::F_SETPIPE_SZ`
   --> /home/merlijn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/mod.rs:13:18
    |
13  | use nix::fcntl::{fcntl, F_GETPIPE_SZ, F_SETPIPE_SZ};
    |                  ^^^^^  ^^^^^^^^^^^^  ^^^^^^^^^^^^ no `F_SETPIPE_SZ` in `fcntl`
    |                  |      |
    |                  |      no `F_GETPIPE_SZ` in `fcntl`
    |                  no `fcntl` in `fcntl`
    |
    = help: consider importing this module instead:
            nix::fcntl
note: found an item that was configured out
   --> /home/merlijn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.27.1/src/fcntl.rs:509:8
    |
509 | pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
    |        ^^^^^
    = note: the item is gated behind the `fs` feature

error[E0308]: mismatched types
   --> /home/merlijn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/compositor/hyprland.rs:156:51
    |
156 |                     let name = get_workspace_name(workspace_type);
    |                                ------------------ ^^^^^^^^^^^^^^ expected `WorkspaceType`, found `WorkspaceDestroyedEventData`
    |                                |
    |                                arguments to this function are incorrect
    |
note: function defined here
   --> /home/merlijn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/compositor/hyprland.rs:247:4
    |
247 | fn get_workspace_name(name: WorkspaceType) -> String {
    |    ^^^^^^^^^^^^^^^^^^ -------------------

Some errors have detailed explanations: E0308, E0432.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `ironbar` (bin "ironbar") due to 4 previous errors
error: failed to compile `ironbar v0.15.1`, intermediate artifacts can be found at `/tmp/cargo-installQywNGM`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
cargo install ironbar  523.98s user 37.21s system 994% cpu 56.444 total

@ToxicMushroom
Copy link
Author

After messing around with the my toolchain and doing cargo build on the latest commit it built so I'll try in a bit

@ToxicMushroom
Copy link
Author

ToxicMushroom commented Aug 5, 2024

Can't reproduce on hyprland, On hyprland after closing a built in module however the bar goes out of focus.. so you can click the bar again until you move 1px, really weird

@ToxicMushroom
Copy link
Author

ToxicMushroom commented Aug 5, 2024

I'm clicking on both items as fast as I can, works perfectly on the calendar module
sway:
https://github.com/user-attachments/assets/8d3a93df-3ff0-4753-90be-4a46b0bdf29b

@ToxicMushroom
Copy link
Author

ToxicMushroom commented Aug 5, 2024

And hyprland as I previously mentioned has perfect tray clicking, but the bar becomes unfocused
https://github.com/user-attachments/assets/6b3f7236-b6d8-4d03-9767-c8e1e44f6dc2

@JakeStanger JakeStanger added this to the 0.16.1 milestone Aug 10, 2024
@JakeStanger
Copy link
Owner

I can confirm I can replicate this, works as intended on Hyprland but not on Sway. Annoyingly on Waybar (via libdbusmenu I think?) it works properly on both so this is something I'll need to fix.

I can see what's happening - the popup menu is stealing focus, so you have to click back on Ironbar to regain its focus. I've no idea how to tackle that yet though.

@JakeStanger
Copy link
Owner

JakeStanger commented Nov 16, 2024

I'd be interested to know with #779 implemented whether this still occurs, as I've just switched to libdbusmenu-gtk3.

@ToxicMushroom
Copy link
Author

Still occurs yes

@JakeStanger
Copy link
Owner

Got it.

Ended up pretty much translating Waybar but seems the intended GTK menu widgets cause this, whereas bodging it with a generic EventBox sorts it. Weird.

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.

3 participants