-
Notifications
You must be signed in to change notification settings - Fork 39
Language widget for panel #301
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
base: master
Are you sure you want to change the base?
Conversation
Implemented IPC-client + language widget based on it |
@ammen99, better?)) |
Hi! I haven't checked the PR carefully yet but I suppose it should use UPD: also please fix the formatting. |
int inotify_css_fd; | ||
wf::config::config_manager_t config; | ||
zwf_shell_manager_v2 *wf_shell_manager = nullptr; | ||
WayfireIPC *ipc = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest making WayfireIPC
a singleton so that it won't be initialized until needed.
I usually do it like this:
WayfireIPC
doesn't have a public ctor- has private
static std::weak_ptr<WayfireIPC> instance_
- has public
static std::shared_ptr<WayfireIPC> Instance()
which simply returnsinstance_.lock()
- has public
static std::shared_ptr<WayfireIPC> Open()
(or something, maybe you will come up with a better name) which initialize theinstance_
if it's expired
Instance()
should be called in reload_widgets
so that we don't close-and-open the socket on every reload.
Probably Lock()
would be a better name for Instance()
, but I would still call it Instance
for consistency with existing singletons.
See https://github.com/WayfireWM/wf-shell/blob/master/src/panel/widgets/tray/watcher.hpp#L18-L31 and https://github.com/WayfireWM/wf-shell/blob/master/src/panel/panel.cpp#L268.
|
||
class WayfireIPC | ||
{ | ||
int socket_fd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using Gio
's SocketClient
instead of handling it manually? I believe it would simplify the code.
Adds language widget displaying current keyboard layout language.
