summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/astal/gtk3/src/widget/circularprogress.vala63
l---------[-rw-r--r--]lib/astal/gtk4/gir.py59
l---------[-rw-r--r--]lib/astal/io/gir.py59
-rw-r--r--lib/gir.py3
-rw-r--r--lib/hyprland/hyprland.vala18
-rw-r--r--lib/hyprland/monitor.vala24
-rw-r--r--lib/mpris/cli.vala4
-rw-r--r--lib/mpris/ifaces.vala2
-rw-r--r--lib/mpris/player.vala6
-rw-r--r--lib/notifd/notification.vala4
-rw-r--r--lib/powerprofiles/cli.vala49
l---------lib/powerprofiles/gir.py1
-rw-r--r--lib/powerprofiles/meson.build44
-rw-r--r--lib/powerprofiles/power-profiles.vala109
-rw-r--r--lib/tray/meson.build2
15 files changed, 231 insertions, 216 deletions
diff --git a/lib/astal/gtk3/src/widget/circularprogress.vala b/lib/astal/gtk3/src/widget/circularprogress.vala
index a3ecdf1..df1635d 100644
--- a/lib/astal/gtk3/src/widget/circularprogress.vala
+++ b/lib/astal/gtk3/src/widget/circularprogress.vala
@@ -44,26 +44,53 @@ public class Astal.CircularProgress : Gtk.Bin {
set_css_name("circular-progress");
}
+ public override Gtk.SizeRequestMode get_request_mode() {
+ if(get_child() != null) return get_child().get_request_mode();
+ return Gtk.SizeRequestMode.HEIGHT_FOR_WIDTH;
+ }
+
public override void get_preferred_height(out int minh, out int nath) {
- var val = get_style_context().get_property("min-height", Gtk.StateFlags.NORMAL);
- if (val.get_int() <= 0) {
- minh = 40;
- nath = 40;
+ if(get_child() != null) {
+ int minw, natw;
+ get_child().get_preferred_height(out minh, out nath);
+ get_child().get_preferred_width(out minw, out natw);
+
+ minh = int.max(minw, minh);
+ nath = int.max(natw, nath);
}
+ var w_val = get_style_context().get_property("min-width", Gtk.StateFlags.NORMAL);
+ var h_val = get_style_context().get_property("min-height", Gtk.StateFlags.NORMAL);
+ minh = int.max(w_val.get_int(), minh);
+ nath = int.max(w_val.get_int(), nath);
+ minh = int.max(h_val.get_int(), minh);
+ nath = int.max(h_val.get_int(), nath);
+ }
- minh = val.get_int();
- nath = val.get_int();
+ public override void get_preferred_height_for_width(int width, out int minh, out int nath) {
+ minh = width;
+ nath = width;
}
public override void get_preferred_width(out int minw, out int natw) {
- var val = get_style_context().get_property("min-width", Gtk.StateFlags.NORMAL);
- if (val.get_int() <= 0) {
- minw = 40;
- natw = 40;
+ if(get_child() != null) {
+ int minh, nath;
+ get_child().get_preferred_height(out minh, out nath);
+ get_child().get_preferred_width(out minw, out natw);
+
+ minw = int.max(minw, minh);
+ natw = int.max(natw, nath);
}
+ var w_val = get_style_context().get_property("min-width", Gtk.StateFlags.NORMAL);
+ var h_val = get_style_context().get_property("min-height", Gtk.StateFlags.NORMAL);
+ minw = int.max(w_val.get_int(), minw);
+ natw = int.max(w_val.get_int(), natw);
+ minw = int.max(h_val.get_int(), minw);
+ natw = int.max(h_val.get_int(), natw);
+ }
- minw = val.get_int();
- natw = val.get_int();
+ public override void get_preferred_width_for_height(int height, out int minw, out int natw) {
+ minw = height;
+ natw = height;
}
private double to_radian(double percentage) {
@@ -115,6 +142,12 @@ public class Astal.CircularProgress : Gtk.Bin {
Gtk.Allocation allocation;
get_allocation(out allocation);
+ if (get_child() != null) {
+ get_child().size_allocate(allocation);
+ propagate_draw(get_child(), cr);
+ }
+
+
var styles = get_style_context();
var width = allocation.width;
var height = allocation.height;
@@ -195,12 +228,6 @@ public class Astal.CircularProgress : Gtk.Bin {
cr.arc(end_x, end_y, fg_stroke / 2, 0, 0 - 0.01);
cr.fill();
}
-
- if (get_child() != null) {
- get_child().size_allocate(allocation);
- propagate_draw(get_child(), cr);
- }
-
return true;
}
}
diff --git a/lib/astal/gtk4/gir.py b/lib/astal/gtk4/gir.py
index 9ef680f..16a3a64 100644..120000
--- a/lib/astal/gtk4/gir.py
+++ b/lib/astal/gtk4/gir.py
@@ -1,58 +1 @@
-"""
-Vala's generated gir does not contain comments,
-so we use valadoc to generate them. However, they are formatted
-for valadoc and not gi-docgen so we need to fix it.
-"""
-
-import xml.etree.ElementTree as ET
-import html
-import sys
-import subprocess
-
-
-def fix_gir(name: str, gir: str, out: str):
- namespaces = {
- "": "http://www.gtk.org/introspection/core/1.0",
- "c": "http://www.gtk.org/introspection/c/1.0",
- "glib": "http://www.gtk.org/introspection/glib/1.0",
- }
- for prefix, uri in namespaces.items():
- ET.register_namespace(prefix, uri)
-
- tree = ET.parse(gir)
- root = tree.getroot()
-
- for doc in root.findall(".//doc", namespaces):
- if doc.text:
- doc.text = (
- html.unescape(doc.text).replace("<para>", "").replace("</para>", "")
- )
-
- if (inc := root.find("c:include", namespaces)) is not None:
- inc.set("name", f"{name}.h")
- else:
- print("no c:include tag found", file=sys.stderr)
- exit(1)
-
- tree.write(out, encoding="utf-8", xml_declaration=True)
-
-
-def valadoc(name: str, gir: str, args: list[str]):
- cmd = ["valadoc", "-o", "docs", "--package-name", name, "--gir", gir, *args]
- try:
- subprocess.run(cmd, check=True, text=True, capture_output=True)
- except subprocess.CalledProcessError as e:
- print(e.stderr, file=sys.stderr)
- exit(1)
-
-
-if __name__ == "__main__":
- name = sys.argv[1]
- in_out = sys.argv[2].split(":")
- args = sys.argv[3:]
-
- gir = in_out[0]
- out = in_out[1] if len(in_out) > 1 else gir
-
- valadoc(name, gir, args)
- fix_gir(name, gir, out)
+../../gir.py \ No newline at end of file
diff --git a/lib/astal/io/gir.py b/lib/astal/io/gir.py
index 9ef680f..16a3a64 100644..120000
--- a/lib/astal/io/gir.py
+++ b/lib/astal/io/gir.py
@@ -1,58 +1 @@
-"""
-Vala's generated gir does not contain comments,
-so we use valadoc to generate them. However, they are formatted
-for valadoc and not gi-docgen so we need to fix it.
-"""
-
-import xml.etree.ElementTree as ET
-import html
-import sys
-import subprocess
-
-
-def fix_gir(name: str, gir: str, out: str):
- namespaces = {
- "": "http://www.gtk.org/introspection/core/1.0",
- "c": "http://www.gtk.org/introspection/c/1.0",
- "glib": "http://www.gtk.org/introspection/glib/1.0",
- }
- for prefix, uri in namespaces.items():
- ET.register_namespace(prefix, uri)
-
- tree = ET.parse(gir)
- root = tree.getroot()
-
- for doc in root.findall(".//doc", namespaces):
- if doc.text:
- doc.text = (
- html.unescape(doc.text).replace("<para>", "").replace("</para>", "")
- )
-
- if (inc := root.find("c:include", namespaces)) is not None:
- inc.set("name", f"{name}.h")
- else:
- print("no c:include tag found", file=sys.stderr)
- exit(1)
-
- tree.write(out, encoding="utf-8", xml_declaration=True)
-
-
-def valadoc(name: str, gir: str, args: list[str]):
- cmd = ["valadoc", "-o", "docs", "--package-name", name, "--gir", gir, *args]
- try:
- subprocess.run(cmd, check=True, text=True, capture_output=True)
- except subprocess.CalledProcessError as e:
- print(e.stderr, file=sys.stderr)
- exit(1)
-
-
-if __name__ == "__main__":
- name = sys.argv[1]
- in_out = sys.argv[2].split(":")
- args = sys.argv[3:]
-
- gir = in_out[0]
- out = in_out[1] if len(in_out) > 1 else gir
-
- valadoc(name, gir, args)
- fix_gir(name, gir, out)
+../../gir.py \ No newline at end of file
diff --git a/lib/gir.py b/lib/gir.py
index a0a81dc..66cbcfd 100644
--- a/lib/gir.py
+++ b/lib/gir.py
@@ -9,6 +9,7 @@ import html
import sys
import subprocess
import re
+import os
# valac fails on gi-docgen compliant markdown
@@ -47,7 +48,7 @@ def fix_gir(name: str, gir: str, out: str):
def valadoc(name: str, gir: str, args: list[str]):
- cmd = ["valadoc", "-o", "docs", "--package-name", name, "--gir", gir, *args]
+ cmd = [os.getenv("VALADOC", "valadoc"), "-o", "docs", "--package-name", name, "--gir", gir, *args]
try:
subprocess.run(cmd, check=True, text=True, capture_output=True)
except subprocess.CalledProcessError as e:
diff --git a/lib/hyprland/hyprland.vala b/lib/hyprland/hyprland.vala
index ea95cab..17c426c 100644
--- a/lib/hyprland/hyprland.vala
+++ b/lib/hyprland/hyprland.vala
@@ -381,20 +381,15 @@ public class Hyprland : Object {
break;
case "openwindow":
- var addr = args[1].split(",")[0];
- var client = new Client();
- _clients.insert(addr, client);
yield sync_clients();
yield sync_workspaces();
- client_added(client);
- notify_property("clients");
break;
case "closewindow":
_clients.get(args[1]).removed();
_clients.remove(args[1]);
- client_removed(args[1]);
yield sync_workspaces();
+ client_removed(args[1]);
notify_property("clients");
break;
@@ -426,6 +421,17 @@ public class Hyprland : Object {
minimize(get_client(argv[0]), argv[1] == "0");
break;
+ // first event that signals a new window not openwindow
+ case "windowtitlev2":
+ var addr = args[1].split(",")[0];
+ var client = new Client();
+ _clients.insert(addr, client);
+ yield sync_clients();
+ yield sync_workspaces();
+ client_added(client);
+ notify_property("clients");
+ break;
+
case "windowtitle":
yield sync_clients();
break;
diff --git a/lib/hyprland/monitor.vala b/lib/hyprland/monitor.vala
index d7b8028..6c46142 100644
--- a/lib/hyprland/monitor.vala
+++ b/lib/hyprland/monitor.vala
@@ -1,5 +1,4 @@
-namespace AstalHyprland {
-public class Monitor : Object {
+public class AstalHyprland.Monitor : Object {
public signal void removed ();
public int id { get; private set; }
@@ -20,6 +19,7 @@ public class Monitor : Object {
public int reserved_left { get; private set; }
public int reserved_right { get; private set; }
public double scale { get; private set; }
+ public Transform transform { get; private set; }
public bool focused { get; private set; }
public bool dpms_status { get; private set; }
public bool vrr { get; private set; }
@@ -43,6 +43,7 @@ public class Monitor : Object {
x = (int)obj.get_int_member("x");
y = (int)obj.get_int_member("y");
scale = obj.get_double_member("scale");
+ transform = (Transform)obj.get_int_member("transform");
focused = obj.get_boolean_member("focused");
dpms_status = obj.get_boolean_member("dpmsStatus");
vrr = obj.get_boolean_member("vrr");
@@ -67,5 +68,22 @@ public class Monitor : Object {
public void focus() {
Hyprland.get_default().dispatch("focusmonitor", id.to_string());
}
-}
+
+ public enum Transform {
+ NORMAL = 0,
+ /** rotate by 90° counter clockwise */
+ ROTATE_90_DEG = 1,
+ /** rotate by 180° */
+ ROTATE_180_DEG = 2,
+ /** rotate by 270° counter clockwise */
+ ROTATE_270_DEG = 3,
+ /** mirror both axis */
+ FLIPPED = 4,
+ /** flip and rotate by 90° */
+ FLIPPED_ROTATE_90_DEG = 5,
+ /** flip and rotate by 180° */
+ FLIPPED_ROTATE_180_DEG = 6,
+ /** flip and rotate by 270° */
+ FLIPPED_ROTATE_270_DEG = 7,
+ }
}
diff --git a/lib/mpris/cli.vala b/lib/mpris/cli.vala
index b71def9..7e15c6e 100644
--- a/lib/mpris/cli.vala
+++ b/lib/mpris/cli.vala
@@ -179,7 +179,7 @@ int main(string[] argv) {
Json.Node to_json(Player p) {
var uris = new Json.Builder().begin_array();
- foreach (var uri in p.supported_uri_schemas)
+ foreach (var uri in p.supported_uri_schemes)
uris.add_string_value(uri);
uris.end_array();
@@ -189,7 +189,7 @@ Json.Node to_json(Player p) {
.set_member_name("available").add_boolean_value(p.available)
.set_member_name("identity").add_string_value(p.identity)
.set_member_name("entry").add_string_value(p.entry)
- .set_member_name("supported_uri_schemas").add_value(uris.get_root())
+ .set_member_name("supported_uri_schemes").add_value(uris.get_root())
.set_member_name("loop_status").add_string_value(p.loop_status.to_string())
.set_member_name("shuffle_status").add_string_value(p.shuffle_status.to_string())
.set_member_name("rate").add_double_value(p.rate)
diff --git a/lib/mpris/ifaces.vala b/lib/mpris/ifaces.vala
index 298a288..8755723 100644
--- a/lib/mpris/ifaces.vala
+++ b/lib/mpris/ifaces.vala
@@ -21,7 +21,7 @@ private interface AstalMpris.IMpris : PropsIface {
public abstract bool has_track_list { get; }
public abstract string identity { owned get; }
public abstract string desktop_entry { owned get; }
- public abstract string[] supported_uri_schemas { owned get; }
+ public abstract string[] supported_uri_schemes { owned get; }
public abstract string[] supported_mime_types { owned get; }
}
diff --git a/lib/mpris/player.vala b/lib/mpris/player.vala
index 2050f61..c69eb21 100644
--- a/lib/mpris/player.vala
+++ b/lib/mpris/player.vala
@@ -87,7 +87,7 @@ public class AstalMpris.Player : Object {
* Almost every media player will include support for the "file" scheme.
* Other common schemes are "http" and "rtsp".
*/
- public string[] supported_uri_schemas { owned get; private set; }
+ public string[] supported_uri_schemes { owned get; private set; }
/**
* The mime-types supported by the player.
@@ -160,7 +160,7 @@ public class AstalMpris.Player : Object {
}
/**
- * uri scheme should be an element of [[email protected]:supported_uri_schemas]
+ * uri scheme should be an element of [[email protected]:supported_uri_schemes]
* and the mime-type should match one of the elements of [[email protected]:supported_mime_types].
*
* @param uri Uri of the track to load.
@@ -425,7 +425,7 @@ public class AstalMpris.Player : Object {
// has_track_list = proxy.has_track_list;
identity = proxy.identity;
entry = proxy.desktop_entry;
- supported_uri_schemas = proxy.supported_uri_schemas;
+ supported_uri_schemes = proxy.supported_uri_schemes;
supported_mime_types = proxy.supported_mime_types;
if (position >= 0)
diff --git a/lib/notifd/notification.vala b/lib/notifd/notification.vala
index 29c6c56..c28138f 100644
--- a/lib/notifd/notification.vala
+++ b/lib/notifd/notification.vala
@@ -142,9 +142,11 @@ public class AstalNotifd.Notification : Object {
return 0;
var v = hints.get(hint);
- if (v.get_type_string() == "b")
+ // daemon uses byte as per spec
+ if (v.get_type_string() == "y")
return v.get_byte();
+ // proxy uses int64 from json
if (v.get_type_string() == "x")
return (uint8)v.get_int64();
diff --git a/lib/powerprofiles/cli.vala b/lib/powerprofiles/cli.vala
index 7be01d2..1e5cc70 100644
--- a/lib/powerprofiles/cli.vala
+++ b/lib/powerprofiles/cli.vala
@@ -56,16 +56,16 @@ int main(string[] argv) {
if (daemonize) {
var loop = new MainLoop();
- stdout.printf("%s\n", profiles.to_json_string());
+ stdout.printf("%s\n", to_json_string(profiles));
stdout.flush();
profiles.notify.connect(() => {
- stdout.printf("%s\n", profiles.to_json_string());
+ stdout.printf("%s\n", to_json_string(profiles));
stdout.flush();
});
profiles.profile_released.connect(() => {
- stdout.printf("%s\n", profiles.to_json_string());
+ stdout.printf("%s\n", to_json_string(profiles));
stdout.flush();
});
@@ -73,8 +73,49 @@ int main(string[] argv) {
}
if (set == null && !daemonize) {
- stdout.printf("%s\n", profiles.to_json_string());
+ stdout.printf("%s\n", to_json_string(profiles));
}
return 0;
}
+
+string to_json_string(AstalPowerProfiles.PowerProfiles profiles) {
+ var acts = new Json.Builder().begin_array();
+ foreach (var action in profiles.actions) {
+ acts.add_string_value(action);
+ }
+
+ var active_holds = new Json.Builder().begin_array();
+ foreach (var action in profiles.active_profile_holds) {
+ active_holds.add_value(new Json.Builder()
+ .begin_object()
+ .set_member_name("application_id").add_string_value(action.application_id)
+ .set_member_name("profile").add_string_value(action.profile)
+ .set_member_name("reason").add_string_value(action.reason)
+ .end_object()
+ .get_root());
+ }
+
+ var profs = new Json.Builder().begin_array();
+ foreach (var prof in profiles.profiles) {
+ profs.add_value(new Json.Builder()
+ .begin_object()
+ .set_member_name("profie").add_string_value(prof.profile)
+ .set_member_name("driver").add_string_value(prof.driver)
+ .set_member_name("cpu_driver").add_string_value(prof.cpu_driver)
+ .set_member_name("platform_driver").add_string_value(prof.platform_driver)
+ .end_object()
+ .get_root());
+ }
+
+ return Json.to_string(new Json.Builder()
+ .begin_object()
+ .set_member_name("active_profile").add_string_value(profiles.active_profile)
+ .set_member_name("icon_name").add_string_value(profiles.icon_name)
+ .set_member_name("performance_degraded").add_string_value(profiles.performance_degraded)
+ .set_member_name("actions").add_value(acts.end_array().get_root())
+ .set_member_name("active_profile_holds").add_value(active_holds.end_array().get_root())
+ .set_member_name("profiles").add_value(profs.end_array().get_root())
+ .end_object()
+ .get_root(), false);
+}
diff --git a/lib/powerprofiles/gir.py b/lib/powerprofiles/gir.py
new file mode 120000
index 0000000..b5b4f1d
--- /dev/null
+++ b/lib/powerprofiles/gir.py
@@ -0,0 +1 @@
+../gir.py \ No newline at end of file
diff --git a/lib/powerprofiles/meson.build b/lib/powerprofiles/meson.build
index d0fe78f..cd8cc2b 100644
--- a/lib/powerprofiles/meson.build
+++ b/lib/powerprofiles/meson.build
@@ -39,32 +39,38 @@ deps = [
dependency('json-glib-1.0'),
]
-sources = [
- config,
+sources = [config] + files(
'power-profiles.vala',
-]
+)
if get_option('lib')
lib = library(
meson.project_name(),
sources,
dependencies: deps,
+ vala_args: ['--vapi-comments'],
vala_header: meson.project_name() + '.h',
vala_vapi: meson.project_name() + '-' + api_version + '.vapi',
- vala_gir: gir,
version: meson.project_version(),
install: true,
- install_dir: [true, true, true, true],
+ install_dir: [true, true, true],
)
- import('pkgconfig').generate(
- lib,
- name: meson.project_name(),
- filebase: meson.project_name() + '-' + api_version,
- version: meson.project_version(),
- subdirs: meson.project_name(),
- requires: deps,
- install_dir: get_option('libdir') / 'pkgconfig',
+ pkgs = []
+ foreach dep : deps
+ pkgs += ['--pkg=' + dep.name()]
+ endforeach
+
+ gir_tgt = custom_target(
+ gir,
+ command: [find_program('python3'), files('gir.py'), meson.project_name(), gir]
+ + pkgs
+ + sources,
+ input: sources,
+ depends: lib,
+ output: gir,
+ install: true,
+ install_dir: get_option('datadir') / 'gir-1.0',
)
custom_target(
@@ -77,10 +83,20 @@ if get_option('lib')
],
input: lib,
output: typelib,
- depends: lib,
+ depends: [lib, gir_tgt],
install: true,
install_dir: get_option('libdir') / 'girepository-1.0',
)
+
+ import('pkgconfig').generate(
+ lib,
+ name: meson.project_name(),
+ filebase: meson.project_name() + '-' + api_version,
+ version: meson.project_version(),
+ subdirs: meson.project_name(),
+ requires: deps,
+ install_dir: get_option('libdir') / 'pkgconfig',
+ )
endif
if get_option('cli')
diff --git a/lib/powerprofiles/power-profiles.vala b/lib/powerprofiles/power-profiles.vala
index ab98505..a104d2e 100644
--- a/lib/powerprofiles/power-profiles.vala
+++ b/lib/powerprofiles/power-profiles.vala
@@ -16,11 +16,17 @@ private interface IPowerProfiles : DBusProxy {
}
public PowerProfiles get_default() {
+ /** Gets the default singleton PowerProfiles instance. */
return PowerProfiles.get_default();
}
+/**
+ * Client for [[https://freedesktop-team.pages.debian.net/power-profiles-daemon/gdbus-org.freedesktop.UPower.PowerProfiles.html|PowerProfiles]].
+ */
public class PowerProfiles : Object {
private static PowerProfiles instance;
+
+ /** Gets the default singleton PowerProfiles instance. */
public static PowerProfiles get_default() {
if (instance == null)
instance = new PowerProfiles();
@@ -52,19 +58,34 @@ public class PowerProfiles : Object {
}
}
+ /**
+ * The type of the currently active profile.
+ * It might change automatically if a profile is held,
+ * using the [[email protected]_profile] method.
+ */
public string active_profile {
owned get { return proxy.active_profile; }
set { proxy.active_profile = value; }
}
+ /**
+ * Return a named icon based [[email protected]:active_profile].
+ */
public string icon_name {
owned get { return @"power-profile-$active_profile-symbolic"; }
}
+ /**
+ * List of the "actions" implemented in the running daemon.
+ * This can used to figure out whether particular functionality is available in the daemon.
+ */
public string[] actions {
owned get { return proxy.actions.copy(); }
}
+ /**
+ * List of dictionaries representing the current profile holds.
+ */
public Hold[] active_profile_holds {
owned get {
Hold[] holds = new Hold[proxy.active_profile_holds.length];
@@ -80,14 +101,21 @@ public class PowerProfiles : Object {
}
}
+ /**
+ * This will be set if the performance power profile is running in degraded mode,
+ * with the value being used to identify the reason for that degradation.
+ * Possible values are:
+ * - "lap-detected" (the computer is sitting on the user's lap)
+ * - "high-operating-temperature" (the computer is close to overheating)
+ * - "" (the empty string, if not performance is not degraded)
+ */
public string performance_degraded {
owned get { return proxy.performance_degraded; }
}
- public string performance_inhibited {
- owned get { return proxy.performance_degraded; }
- }
-
+ /**
+ * List of each profile.
+ */
public Profile[] profiles {
owned get {
Profile[] profs = new Profile[proxy.profiles.length];
@@ -104,12 +132,31 @@ public class PowerProfiles : Object {
}
}
+ /**
+ * The version of the power-profiles-daemon software.
+ */
public string version {
owned get { return proxy.version; }
}
+ /**
+ * Emitted when the profile is released because
+ * [[email protected]:active_profile] was manually changed.
+ * This will only be emitted to the process that originally called
+ * [[email protected]_profile].
+ */
public signal void profile_released (uint cookie);
+ /**
+ * This forces the passed profile (either 'power-saver' or 'performance')
+ * to be activated until either the caller quits,
+ * [[email protected]_profile] is called,
+ * or the [[email protected]:active_profile] is changed by the user.
+ * When conflicting profiles are requested to be held,
+ * the 'power-saver' profile will be activated in preference to the 'performance' profile.
+ * Those holds will be automatically cancelled if the user manually switches to another profile,
+ * and the [[email protected]::profile_released] signal will be emitted.
+ */
public int hold_profile(string profile, string reason, string application_id) {
try {
return (int)proxy.hold_profile(profile, reason, application_id);
@@ -119,6 +166,9 @@ public class PowerProfiles : Object {
}
}
+ /**
+ * This removes the hold that was set on a profile.
+ */
public void release_profile(uint cookie) {
try {
proxy.release_profile(cookie);
@@ -126,54 +176,21 @@ public class PowerProfiles : Object {
critical(error.message);
}
}
-
- public string to_json_string() {
- var acts = new Json.Builder().begin_array();
- foreach (var action in actions) {
- acts.add_string_value(action);
- }
-
- var active_holds = new Json.Builder().begin_array();
- foreach (var action in active_profile_holds) {
- active_holds.add_value(new Json.Builder()
- .begin_object()
- .set_member_name("application_id").add_string_value(action.application_id)
- .set_member_name("profile").add_string_value(action.profile)
- .set_member_name("reason").add_string_value(action.reason)
- .end_object()
- .get_root());
- }
-
- var profs = new Json.Builder().begin_array();
- foreach (var prof in profiles) {
- profs.add_value(new Json.Builder()
- .begin_object()
- .set_member_name("profie").add_string_value(prof.profile)
- .set_member_name("driver").add_string_value(prof.driver)
- .set_member_name("cpu_driver").add_string_value(prof.cpu_driver)
- .set_member_name("platform_driver").add_string_value(prof.platform_driver)
- .end_object()
- .get_root());
- }
-
- return Json.to_string(new Json.Builder()
- .begin_object()
- .set_member_name("active_profile").add_string_value(active_profile)
- .set_member_name("icon_name").add_string_value(icon_name)
- .set_member_name("performance_degraded").add_string_value(performance_degraded)
- .set_member_name("performance_inhibited").add_string_value(performance_inhibited)
- .set_member_name("actions").add_value(acts.end_array().get_root())
- .set_member_name("active_profile_holds").add_value(active_holds.end_array().get_root())
- .set_member_name("profiles").add_value(profs.end_array().get_root())
- .end_object()
- .get_root(), false);
- }
}
public struct Profile {
+ /**
+ * Will be one of:
+ * - "power-saver" (battery saving profile)
+ * - "balanced" (the default profile)
+ * - "performance" (a profile that does not care about noise or battery consumption)
+ */
public string profile;
public string cpu_driver;
public string platform_driver;
+ /**
+ * Identifies the power-profiles-daemon backend code used to implement the profile.
+ */
public string driver;
}
diff --git a/lib/tray/meson.build b/lib/tray/meson.build
index fbb6672..fbf2f98 100644
--- a/lib/tray/meson.build
+++ b/lib/tray/meson.build
@@ -76,7 +76,7 @@ if get_option('lib')
c_args: dbusmenu_cflags.split(' '),
link_args: dbusmenu_libs.split(' '),
install: true,
- install_dir: true,
+ install_dir: [true, true, true]
)
pkgs = ['--pkg', 'DbusmenuGtk3-0.4', '--pkg', 'Dbusmenu-0.4']