diff --git a/LICENSE b/LICENSE
index 0a59d55..1d4df41 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2022 Johannes Findeisen
+Copyright (c) 2023 Johannes Findeisen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Makefile b/Makefile
index b331f3b..d109fbf 100644
--- a/Makefile
+++ b/Makefile
@@ -6,3 +6,12 @@ nonotify:
clean:
rm -f spacetray
+
+all2:
+ $(CC) -Wall -g `pkg-config --cflags --libs gtk+-2.0 --libs appindicator-0.1 --libs libcurl --libs json-c --libs libnotify` -DLIBNOTIFY -o spacetray spacetray.c
+
+nonotify2:
+ $(CC) -Wall -g `pkg-config --cflags --libs gtk+-2.0 --libs appindicator-0.1 --libs libcurl --libs json-c` -o spacetray spacetray.c
+
+clean2:
+ rm -f spacetray2
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..78806bd
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+pycairo==1.25.1
+pygobject==3.46.0
\ No newline at end of file
diff --git a/spacetray.c b/spacetray.c
index 16e7af3..f2681b6 100644
--- a/spacetray.c
+++ b/spacetray.c
@@ -36,7 +36,7 @@ static char *statusurl = "https://www.hamburg.ccc.de/dooris/status.json";
static char *agent = "Spacetray/0.42";
// The delay for polling the dooris service. Adjust this before compiling
-static int delay = 900000; // ms. aka 15 minutes
+static int delay = 1000; // ms. aka 15 minutes
bool door_open = false;
bool old_door_open = false;
@@ -219,7 +219,8 @@ int main(int argc, char **argv) {
//invoke_notification();
- gtk_timeout_add(delay, (GtkFunction)do_it, (gpointer)NULL);
+ //gtk_timeout_add(delay, (GtkFunction)do_it, (gpointer)NULL);
+ guint xxx = g_timeout_add_seconds(1000, (GSourceFunc)do_it, (gpointer)NULL);
gtk_main();
diff --git a/spacetray.iml b/spacetray.iml
new file mode 100644
index 0000000..72fbf47
--- /dev/null
+++ b/spacetray.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spacetray.py b/spacetray.py
new file mode 100755
index 0000000..b1bd32c
--- /dev/null
+++ b/spacetray.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+#
+# Copyright 2023 Johannes Findeisen .
+#
+import gi
+import sys
+gi.require_version('Gtk', '3.0')
+from gi.repository import Gtk
+gi.require_version('AppIndicator3', '0.1')
+from gi.repository import AppIndicator3
+
+
+def menuitem_response(w, buf):
+ print(buf)
+
+
+def exit_app():
+ sys.exit()
+
+
+if __name__ == "__main__":
+ ind = AppIndicator3.Indicator.new("example-simple-client",
+ "indicator-messages",
+ AppIndicator3.IndicatorCategory.APPLICATION_STATUS)
+ ind.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
+ ind.set_attention_icon("indicator-messages-new")
+
+ # create a menu
+ menu = Gtk.Menu()
+
+ # create some sub menus
+ for i in range(3):
+ buf = "Test-sub-menu - %d" % i
+ menu_items = Gtk.MenuItem(buf)
+ menu.append(menu_items)
+
+ # this is where you would connect your menu item up with a function:
+ menu_items.connect("activate", menuitem_response, buf)
+
+ # show the items
+ menu_items.show()
+
+ ind.set_menu(menu)
+
+ Gtk.main()
diff --git a/spacetray2.c b/spacetray2.c
new file mode 100644
index 0000000..3266d77
--- /dev/null
+++ b/spacetray2.c
@@ -0,0 +1,168 @@
+#include
+#include
+
+static void activate_action (GtkAction *action);
+
+static GtkActionEntry entries[] = {
+ { "FileMenu", NULL, "_File" },
+ { "New", "document-new", "_New", "N",
+ "Create a new file", G_CALLBACK (activate_action) },
+ { "Open", "document-open", "_Open", "O",
+ "Open a file", G_CALLBACK (activate_action) },
+ { "Save", "document-save", "_Save", "S",
+ "Save file", G_CALLBACK (activate_action) },
+ { "Quit", "application-exit", "_Quit", "Q",
+ "Exit the application", G_CALLBACK (gtk_main_quit) },
+};
+static guint n_entries = G_N_ELEMENTS (entries);
+
+static const gchar *ui_info =
+""
+" "
+" "
+" "
+" "
+" "
+" "
+" "
+" "
+" "
+"";
+
+static void
+activate_action (GtkAction *action)
+{
+ const gchar *name = gtk_action_get_name (action);
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_CLOSE,
+ "You activated action: \"%s\"",
+ name);
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+
+ gtk_widget_show (dialog);
+}
+
+int main (int argc, char **argv)
+{
+ GtkWidget *window;
+ GtkWidget *menubar;
+ GtkWidget *table;
+ GtkWidget *sw;
+ GtkWidget *contents;
+ GtkWidget *statusbar;
+ GtkWidget *indicator_menu;
+ GtkActionGroup *action_group;
+ GtkUIManager *uim;
+ AppIndicator *indicator;
+ GError *error = NULL;
+
+ gtk_init (&argc, &argv);
+
+ /* main window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "Indicator Demo");
+ gtk_window_set_icon_name (GTK_WINDOW (window), "indicator-messages-new");
+ g_signal_connect (G_OBJECT (window),
+ "destroy",
+ G_CALLBACK (gtk_main_quit),
+ NULL);
+
+ table = gtk_table_new (1, 5, FALSE);
+ gtk_container_add (GTK_CONTAINER (window), table);
+
+ /* Menus */
+ action_group = gtk_action_group_new ("AppActions");
+ gtk_action_group_add_actions (action_group,
+ entries, n_entries,
+ window);
+
+ uim = gtk_ui_manager_new ();
+ g_object_set_data_full (G_OBJECT (window),
+ "ui-manager", uim,
+ g_object_unref);
+ gtk_ui_manager_insert_action_group (uim, action_group, 0);
+ gtk_window_add_accel_group (GTK_WINDOW (window),
+ gtk_ui_manager_get_accel_group (uim));
+
+ if (!gtk_ui_manager_add_ui_from_string (uim, ui_info, -1, &error))
+ {
+ g_message ("Failed to build menus: %s\n", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+
+ menubar = gtk_ui_manager_get_widget (uim, "/ui/MenuBar");
+ gtk_widget_show (menubar);
+ gtk_table_attach (GTK_TABLE (table),
+ menubar,
+ 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
+
+ /* Document */
+ sw = gtk_scrolled_window_new (NULL, NULL);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
+ GTK_SHADOW_IN);
+
+ gtk_table_attach (GTK_TABLE (table),
+ sw,
+ /* X direction */ /* Y direction */
+ 0, 1, 3, 4,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
+ 0, 0);
+
+ gtk_window_set_default_size (GTK_WINDOW (window),
+ 200, 200);
+
+ contents = gtk_text_view_new ();
+ gtk_widget_grab_focus (contents);
+
+ gtk_container_add (GTK_CONTAINER (sw),
+ contents);
+
+
+ /* Create statusbar */
+ statusbar = gtk_statusbar_new ();
+ gtk_table_attach (GTK_TABLE (table),
+ statusbar,
+ /* X direction */ /* Y direction */
+ 0, 1, 4, 5,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
+
+ /* Show the window */
+ gtk_widget_show_all (window);
+
+ /* Indicator */
+ indicator = app_indicator_new ("example-simple-client",
+ "indicator-messages",
+ APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
+
+ indicator_menu = gtk_ui_manager_get_widget (uim, "/ui/IndicatorPopup");
+
+ app_indicator_set_status (indicator, APP_INDICATOR_STATUS_ACTIVE);
+ app_indicator_set_attention_icon (indicator, "indicator-messages-new");
+
+ app_indicator_set_menu (indicator, GTK_MENU (indicator_menu));
+
+ gtk_main ();
+
+ return 0;
+}