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

Implement Tray Icons #1234

Merged
merged 8 commits into from
Jun 14, 2017
Merged

Implement Tray Icons #1234

merged 8 commits into from
Jun 14, 2017

Conversation

4e554c4c
Copy link
Contributor

@4e554c4c 4e554c4c commented Jun 8, 2017

There are still issues with this commit, mostly in dealing with xembedsniproxy. It creates dummy windows for placing XEmbed items which sway renders even though it shouldn't. Also xembedsniproxy is a super buggy program, so there still may be undiscovered problems with it.

This commit implements the StatusNotifierItem protocol, and enables
swaybar to show tray icons. It also uses xembedsniproxy in order to
communicate with xembed applications.
The tray is completely optional, and can be disabled on compile time
with the enable-tray option. Or on runtime with the bar config option
tray_output none.

Overview of changes:
In swaybar very little is changed outside the tray subfolder except
that all events are now polled in event_loop.c, this creates no
functional difference.

Six bar configuration options were added, these are detailed in
sway-bar(5)

The tray subfolder is where all protocol implementation takes place and
is organised as follows:

tray/sni_watcher.c:
This file contains the StatusNotifierWatcher. It keeps track of
items and hosts and reports when they come or go.
tray/tray.c
This file contains the StatusNotifierHost. It keeps track of
sway's version of the items and represents the tray itself.
tray/sni.c
This file contains the StatusNotifierItem struct and all
communication with individual items.
tray/icon.c
This file implements the icon theme protocol. It allows for
finding icons by name, rather than by pixmap.
tray/dbus.c
This file allows for asynchronous DBus communication.

Note: Package maintainers sholud add xembedsniproxy and libdbus as optional dependencies of sway.

See #986 #343

This commit implements the StatusNotifierItem protocol, and enables
swaybar to show tray icons. It also uses `xembedsniproxy` in order to
communicate with xembed applications.
The tray is completely optional, and can be disabled on compile time
with the `enable-tray` option. Or on runtime with the bar config option
`tray_output none`.

Overview of changes:
In swaybar very little is changed outside the tray subfolder except
that all events are now polled in `event_loop.c`, this creates no
functional difference.

Six bar configuration options were added, these are detailed in
sway-bar(5)

The tray subfolder is where all protocol implementation takes place and
is organised as follows:

tray/sni_watcher.c:
	This file contains the StatusNotifierWatcher. It keeps track of
	items and hosts and reports when they come or go.
tray/tray.c
	This file contains the StatusNotifierHost. It keeps track of
	sway's version of the items and represents the tray itself.
tray/sni.c
	This file contains the StatusNotifierItem struct and all
	communication with individual items.
tray/icon.c
	This file implements the icon theme protocol. It allows for
	finding icons by name, rather than by pixmap.
tray/dbus.c
	This file allows for asynchronous DBus communication.

See #986 #343
@ddevault
Copy link
Contributor

ddevault commented Jun 8, 2017

One commit ;_;

swaybar/bar.c Outdated
}
tray_width -= icon_width;
}
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this into another file?

swaybar/bar.c Outdated
_exit(EXIT_FAILURE);
}
}
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving this as well, just have a tray upkeep function that checks this and refires it if not running

swaybar/bar.c Outdated
/* Start xembedsniproxy */
spawn_xembed_sni_proxy();
}
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one too, just make it a simple

#ifdef ENABLE_TRAY
    init_tray();
#endif

Then make init_tray do all this work. Try to limit the tray code in this file to simple calls to another function.

swaybar/render.c Outdated
tray_width -= tray_padding;
}

no_tray:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here. Move it all into a separate function in another file.

@ddevault
Copy link
Contributor

ddevault commented Jun 8, 2017

Problems I noticed while testing:

  • SNI works quite well, nice job. The exception is that I can't seem to select context menu items that are occluded by other windows. Does the compositor need to do something special to let them keep focus? (i.e. open konversation's context menu and try to use any option that is displayed on top of another window, such as the konversation main window). Clicking outside of the context menu also doesn't seem to close it, and should. Making sure the context menu windows are getting focus should fix both of these issues.
  • xembed doesn't work at all for me. The issues with it need to be ironed out or it needs to be removed before I'm comfortable merging this.

@ddevault
Copy link
Contributor

ddevault commented Jun 8, 2017

I also pushed a commit fixing up the cairo blending operator so that partially transparent icons wouldn't overwrite the background.

Calvin Lee added 2 commits June 7, 2017 21:32
Remove tray code from bar.c and render.c
The unique name was not copied out of the wire marshalled DBus message
data so `sni_uniq_cmp` would always match against junk data.
@ddevault
Copy link
Contributor

Status?

@4e554c4c
Copy link
Contributor Author

Still working on getting tray windows working, pretty much everything else is in order.

Xembed support is premature in sway and should be postponed. This commit
only removes swaybar starting xembedsniproxy, if users would like, they
can still start xembedsniproxy manually, however there will be no
official support.
@ddevault
Copy link
Contributor

Should I hold off on rc1 for this?

@4e554c4c
Copy link
Contributor Author

4e554c4c commented Jun 14, 2017

I'd say not, unless you really want it there. I can't work on this 100% right now, so it might be good to delay things. Also I'm not even sure if it'd be good to release sni support without xembed included. People who don't know the difference will probably file reports.

@ddevault
Copy link
Contributor

I'm okay with shipping SNI support alone, we already get plenty of stupid support requets and I doubt this will add much. I'll have a look at this in the morning and see if I can clean it up and still feel good about it.

@ddevault
Copy link
Contributor

ddevault commented Jun 14, 2017

Spent some time poking on this. Results: focus is working good enough for now. Also I figured out what was wrong with the firefox address bar dropdown and fixed that. Going to include this in the next release and maybe iterate on it a bit during rc's to fix the edge cases.

@ddevault ddevault merged commit eb6e38c into swaywm:master Jun 14, 2017
@4e554c4c
Copy link
Contributor Author

Thanks!

@4e554c4c
Copy link
Contributor Author

I'll continue work on xembed, hopefully we can have that in the next release.

@ddevault ddevault mentioned this pull request Jun 15, 2017
@kellpossible kellpossible mentioned this pull request Aug 21, 2017
19 tasks
@nemanjan00
Copy link

Any progress?

@ddevault
Copy link
Contributor

Yep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants