-
-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
209 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
|
||
#include <gtkmm.h> | ||
#include <json/json.h> | ||
#include <tuple> | ||
#include <dbus-status-notifier-watcher.h> | ||
#include "modules/sni/item.hpp" | ||
|
||
namespace waybar::modules::SNI { | ||
|
||
class Host { | ||
public: | ||
Host(const Json::Value&, const std::function<void(std::unique_ptr<Item>&)>&, | ||
const std::function<void(std::unique_ptr<Item>&)>&); | ||
~Host(); | ||
private: | ||
void busAcquired(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring); | ||
void nameAppeared(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring, const Glib::ustring&); | ||
void nameVanished(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring); | ||
static void proxyReady(GObject*, GAsyncResult*, gpointer); | ||
static void registerHost(GObject*, GAsyncResult*, gpointer); | ||
static void itemRegistered(SnWatcher*, const gchar*, gpointer); | ||
static void itemUnregistered(SnWatcher*, const gchar*, gpointer); | ||
|
||
std::tuple<std::string, std::string> getBusNameAndObjectPath(const std::string); | ||
void addRegisteredItem(std::string service); | ||
|
||
std::vector<std::unique_ptr<Item>> items_; | ||
const std::string bus_name_; | ||
const std::string object_path_; | ||
std::size_t bus_name_id_; | ||
std::size_t watcher_id_; | ||
GCancellable* cancellable_ = nullptr; | ||
SnWatcher* watcher_ = nullptr; | ||
const Json::Value &config_; | ||
std::function<void(std::unique_ptr<Item>&)> on_add_; | ||
std::function<void(std::unique_ptr<Item>&)> on_remove_; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,47 @@ | ||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> | ||
<node> | ||
<interface name="org.kde.StatusNotifierItem"> | ||
<interface name='org.kde.StatusNotifierItem'> | ||
<annotation name="org.gtk.GDBus.C.Name" value="Item" /> | ||
<property name="Category" type="s" access="read"/> | ||
<property name="Id" type="s" access="read"/> | ||
<property name="Title" type="s" access="read"/> | ||
<property name="Status" type="s" access="read"/> | ||
<property name="WindowId" type="i" access="read"/> | ||
<property name="Menu" type="o" access="read" /> | ||
|
||
<!-- main icon --> | ||
<!-- names are preferred over pixmaps --> | ||
<property name="IconName" type="s" access="read" /> | ||
<property name="IconThemePath" type="s" access="read" /> | ||
|
||
<!-- struct containing width, height and image data--> | ||
<!-- implementation has been dropped as of now --> | ||
<property name="IconPixmap" type="a(iiay)" access="read" /> | ||
|
||
<!-- not used in ayatana code, no test case so far --> | ||
<property name="OverlayIconName" type="s" access="read"/> | ||
<property name="OverlayIconPixmap" type="a(iiay)" access="read" /> | ||
|
||
<!-- Requesting attention icon --> | ||
<property name="AttentionIconName" type="s" access="read"/> | ||
|
||
<!--same definition as image--> | ||
<property name="AttentionIconPixmap" type="a(iiay)" access="read" /> | ||
|
||
<!-- tooltip data --> | ||
<!-- unimplemented as of now --> | ||
<!--(iiay) is an image--> | ||
<property name="ToolTip" type="(sa(iiay)ss)" access="read" /> | ||
|
||
|
||
<!-- interaction: actually, we do not use them. --> | ||
<method name="Activate"> | ||
<arg name="x" type="i" direction="in"/> | ||
<arg name="y" type="i" direction="in"/> | ||
<method name='ContextMenu'> | ||
<arg type='i' direction='in' name='x'/> | ||
<arg type='i' direction='in' name='y'/> | ||
</method> | ||
<method name="SecondaryActivate"> | ||
<arg name="x" type="i" direction="in"/> | ||
<arg name="y" type="i" direction="in"/> | ||
<method name='Activate'> | ||
<arg type='i' direction='in' name='x'/> | ||
<arg type='i' direction='in' name='y'/> | ||
</method> | ||
<method name="Scroll"> | ||
<arg name="delta" type="i" direction="in"/> | ||
<arg name="dir" type="s" direction="in"/> | ||
<method name='SecondaryActivate'> | ||
<arg type='i' direction='in' name='x'/> | ||
<arg type='i' direction='in' name='y'/> | ||
</method> | ||
|
||
<!-- Signals: the client wants to change something in the status--> | ||
<signal name="NewTitle"></signal> | ||
<signal name="NewIcon"></signal> | ||
<signal name="NewIconThemePath"> | ||
<arg type="s" name="icon_theme_path" direction="out" /> | ||
</signal> | ||
<signal name="NewAttentionIcon"></signal> | ||
<signal name="NewOverlayIcon"></signal> | ||
<signal name="NewToolTip"></signal> | ||
<signal name="NewStatus"> | ||
<arg name="status" type="s" /> | ||
</signal> | ||
|
||
<!-- ayatana labels --> | ||
<!-- These are commented out because GDBusProxy would otherwise require them, | ||
but they are not available for KDE indicators | ||
--> | ||
<!--<signal name="XAyatanaNewLabel"> | ||
<arg type="s" name="label" direction="out" /> | ||
<arg type="s" name="guide" direction="out" /> | ||
<method name='Scroll'> | ||
<arg type='i' direction='in' name='delta'/> | ||
<arg type='s' direction='in' name='orientation'/> | ||
</method> | ||
<signal name='NewTitle'/> | ||
<signal name='NewIcon'/> | ||
<signal name='NewAttentionIcon'/> | ||
<signal name='NewOverlayIcon'/> | ||
<signal name='NewToolTip'/> | ||
<signal name='NewStatus'> | ||
<arg type='s' name='status'/> | ||
</signal> | ||
<property name="XAyatanaLabel" type="s" access="read" /> | ||
<property name="XAyatanaLabelGuide" type="s" access="read" />--> | ||
|
||
|
||
</interface> | ||
<property name='Category' type='s' access='read'/> | ||
<property name='Id' type='s' access='read'/> | ||
<property name='Title' type='s' access='read'/> | ||
<property name='Status' type='s' access='read'/> | ||
<property name='WindowId' type='u' access='read'/> | ||
<property name='IconThemePath' type='s' access='read'/> | ||
<property name='IconName' type='s' access='read'/> | ||
<property name='IconPixmap' type='a(iiay)' access='read'/> | ||
<property name='OverlayIconName' type='s' access='read'/> | ||
<property name='OverlayIconPixmap' type='a(iiay)' access='read'/> | ||
<property name='AttentionIconName' type='s' access='read'/> | ||
<property name='AttentionIconPixmap' type='a(iiay)' access='read'/> | ||
<property name='AttentionMovieName' type='s' access='read'/> | ||
<property name='ToolTip' type='(sa(iiay)ss)' access='read'/> | ||
<property name='Menu' type='o' access='read'/> | ||
<property name='ItemIsMenu' type='b' access='read'/> | ||
</interface> | ||
</node> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.