kdenlive dazu zu prügeln, dieses gottverdammte GIF richtig ins Projekt zu importieren, hat, glaube ich, doppelt so lange gedauert.

    • bleistift2@sopuli.xyzOP
      link
      fedilink
      Deutsch
      arrow-up
      15
      ·
      edit-2
      11 hours ago

      Ich benutze Linux Mint mit Cinnamon. Die Symbole neben der Uhr heißen Applets.

      Die „4“ ist der Notification-Counter.

      Applets können je Nutzer in ~/.local/share/cinnamon/applets „installiert“ werden, indem man da einfach die richtigen Dateien hinlegt, nämlich:

      1. eine metadata.json
      {
        "version": "0.1.0",
        "uuid": "test-applet",
        "name": "Test Applet",
        "max-instances": 1,
        "description": "Test"
      }
      
      1. eine applet.js (ja, Applets werden in JavaScript (genauer gesagt, Cinnamon-JavaScript, cjs, was ein perfekt un-googlebares Akronym ist) geschrieben). Irgendwoher kommt im Script die globale Variable imports, aus der du Sachen ziehen kannst, die du brauchst, um mit Cinnamon zu interagieren. Für das Applet definierst definierst du eine Klasse, die von imports.ui.applet.Applet.TextApplet, …IconApplet oder …TextIconApplet erbt und gibst sie in einer main-Methode zurück.
      // Defined in /usr/share/cinnamon/js/ui/applet.js
      const Applet = imports.ui.applet;
      // Defined in /usr/share/cinnamon/js/misc/util.js
      const Util = imports.misc.util;
      
      
      class IcingaApplet extends Applet.TextApplet {
      
          UNREAD_URL = 'https://sopuli.xyz/api/v3/user/unread_count'
          JWT = 'denkste'
      
          constructor(orientation, panelHeight, instanceId) {
              super(orientation, panelHeight, instanceId); // Initialize the super class Applet.IconApplet
              this.set_applet_tooltip('Test')
              this.set_applet_label('TT')
              this.get_unread_count()
      
              setInterval(() => {
                  this.get_unread_count()
              }, 60_000)
          }
      
          get_unread_count() {
              Util.spawn_async(['curl', '-H', `Authorization: Bearer ${this.JWT}`, this.UNREAD_URL], (stdout, stderr) => {
                  if (stderr) {
                      global.logWarning(`Error fetching unread count: ${stderr}`);
                      return;
                  }
                  try {
                      const data = JSON.parse(stdout);
                      const unreadCount = data.replies + data.mentions + data.private_messages;
                      this.set_applet_label(unreadCount.toString());
                  } catch (e) {
                      global.logWarning(`Error parsing response: ${e}`);
                  }
              });
          }
      
          on_applet_clicked(event) {
              Util.spawn(['firefox', 'https://sopuli.xyz/inbox'])
          }
      }
      
      // Entry point for Cinnamon. Requires an instance of the applet to be returned.
      function main(metadata, orientation, panelHeight, instanceId) {
          return new IcingaApplet(orientation, panelHeight, instanceId);
      }
      

      Das ganze ist völlig undokumentiert. Ich musste mich an teilweise jahrealten und kaputten Beispielen entlanghangeln. Die wertvollste Ressource für mich war https://billauer.co.il/blog/2018/12/writing-cinnamon-applet/ . Du kannst dir auch die systemweit installierten Applets unter /usr/share/cinnamon/applets anschauen.