Skip to content

Commit 0229d28

Browse files
committed
add dconf key
1 parent b9380cc commit 0229d28

8 files changed

+38
-8
lines changed

data/gschema.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<schemalist>
3+
<schema path="/io/github/ellie_commons/indicator-clipboard/" id="io.github.ellie_commons.indicator-clipboard">
4+
<key name="visible" type="b">
5+
<default>true</default>
6+
<summary>Whether indicator is visible</summary>
7+
<description>Hide indicator if set to false. It is still running, just hidden</description>
8+
</key>
9+
</schema>
10+
</schemalist>

data/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
install_data (
2+
'gschema.xml',
3+
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
4+
rename: meson.project_name() + '.gschema.xml'
5+
)

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
io.github.ellie-commons.wingpanel-indicator-clipboard (1.1.0) jammy; urgency=medium
2+
3+
* Add key to show/hide indicator
4+
5+
-- Stella <teamcons.carrd.co> Fri, 17 Oct 2025 01:09:16 +0300
6+
17
io.github.ellie-commons.wingpanel-indicator-clipboard (1.0.0) jammy; urgency=medium
28

39
* Add deb package
Binary file not shown.
Binary file not shown.

meson.build

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
project(
22
'clipboard-indicator',
33
'vala', 'c',
4-
version: '1.0.0'
4+
version: '1.1.0'
55
)
66

7+
gnome = import('gnome')
78
gettext_name = meson.project_name()
89
i18n = import('i18n')
910

@@ -23,6 +24,8 @@ config_file = configure_file(
2324
configuration: config_data
2425
)
2526

26-
# subdir('data')
27+
subdir('data')
2728
# subdir('po')
2829
subdir('src')
30+
31+
gnome.post_install(glib_compile_schemas: true)

src/HistoryWidget.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class Clipboard.HistoryWidget : Gtk.Box {
4242
// No notifications from clipboard? So poll it periodically for new text
4343
public void wait_for_text () {
4444
var clipboard = Gtk.Clipboard.get_default (Gdk.Display.get_default ());
45-
wait_timeout = Timeout.add_full (Priority.LOW, 500, () => {
45+
wait_timeout = Timeout.add_full (Priority.LOW, 1000, () => {
4646
if (clipboard.wait_is_text_available ()) {
4747
clipboard.request_text ((cb, text) => {
4848
if (text != last_text && !clipboard_text_set.contains (text)) {

src/Indicator.vala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,27 @@
44
*/
55

66
public class Clipboard.Indicator : Wingpanel.Indicator {
7+
private static GLib.Settings settings;
78
private Gtk.Image panel_icon;
89
private HistoryWidget history_widget;
910

1011
public Wingpanel.IndicatorManager.ServerType server_type { get; construct set; }
1112

1213
public Indicator (Wingpanel.IndicatorManager.ServerType indicator_server_type) {
13-
GLib.Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
14-
GLib.Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
15-
1614
Object (code_name: "clipboard",
1715
server_type: indicator_server_type);
1816
}
1917

18+
construct {
19+
Intl.setlocale (LocaleCategory.ALL, "");
20+
Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
21+
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
22+
Intl.textdomain (GETTEXT_PACKAGE);
23+
24+
settings = new GLib.Settings ("io.github.ellie_commons.indicator-clipboard");
25+
settings.bind ("visible", this, "visible", GLib.SettingsBindFlags.DEFAULT);
26+
}
27+
2028
public override Gtk.Widget get_display_widget () {
2129
if (panel_icon == null) {
2230
panel_icon = new Gtk.Image.from_icon_name ("edit-copy-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
@@ -52,8 +60,6 @@ public class Clipboard.Indicator : Wingpanel.Indicator {
5260

5361
public override void closed () {
5462
}
55-
56-
5763
}
5864

5965
public Wingpanel.Indicator? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) {

0 commit comments

Comments
 (0)