FelipeFTN / Emoji-Copy

šŸ˜„ Emoji copy is a versatile extension designed to simplify emoji selection and clipboard management.
https://extensions.gnome.org/extension/6242/emoji-copy/
GNU General Public License v3.0
95 stars 10 forks source link

(Nix) The extension fails to enable :< #60

Open StellarSt0rm opened 2 weeks ago

StellarSt0rm commented 2 weeks ago

Bug Report

Current Behavior The extension fails to enable. The icon appears, but if i click on it it does nothing, if i use the keyboard shortcut it does nothing either.

Environment

Error Dump

Extension emoji-copy@felipeftn: TypeError: this.db is null

Stack trace:
  query@file:///run/current-system/sw/share/gnome-shell/extensions/emoji-copy@felipeftn/handlers/sql.js:74:17
  select_by_group@file:///run/current-system/sw/share/gnome-shell/extensions/emoji-copy@felipeftn/handlers/sql.js:62:17
  EmojiCategory@file:///run/current-system/sw/share/gnome-shell/extensions/emoji-copy@felipeftn/emojiCategory.js:37:41
  _createAllCategories@file:///run/current-system/sw/share/gnome-shell/extensions/emoji-copy@felipeftn/extension.js:244:33
  enable@file:///run/current-system/sw/share/gnome-shell/extensions/emoji-copy@felipeftn/extension.js:74:10
  async*_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:266:38
  async*_onEnabledExtensionsChanged@resource:///org/gnome/shell/ui/extensionSystem.js:626:24
  _loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:731:18
  createCheckedMethod/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:730:46
  enableExtension@resource:///org/gnome/shell/ui/extensionSystem.js:289:29
  EnableExtension@resource:///org/gnome/shell/ui/shellDBus.js:453:38
  _handleMethodCall@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:329:38
  _wrapJSObject/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:408:34
  @resource:///org/gnome/shell/ui/init.js:21:20
FelipeFTN commented 2 weeks ago

Hello, @StellarSt0rm! Thanks for submitting this issue! :pray:

Wow, that's a pretty strange problem you are facing! Can you take a look if the db file exists in your system? Something like this should do it: file ~/.local/share/gnome-shell/extensions/emoji-copy@felipeftn/data/emojis.db

Also, can you try compiling and installing it locally?

Here are a few instructions:

  1. Clone the repo
  2. Cd into it
  3. Then make debug or make uninstall && make install - Make sure to have all the python requirements for this step: pip install requests :pray:

Also, how do you installed the extension? Was it using some NixOs package manager or something? Or you did it in the classical way, but just installing from the gnome extensions website?

Thanks, I'll wait for you reply.

StellarSt0rm commented 2 weeks ago

I installed via nixpkgs, with environment.systemPackages = with pkgs; [ gnomeExtensions.emoji-copy ]

The emojis.db file exists, in /run/current-system/sw/share/gnome-shell/extensions/emoji-copy@felipeftn/data/emojis.db

I will try to compile locally :)

StellarSt0rm commented 2 weeks ago

Okay, i didnt compile because i found the error: (in ReadDB(), in handlers/sql.js)

const p = GLib.build_filenamev([
    GLib.get_home_dir(),
    ".local",
    "share",
    "gnome-shell",
    "extensions",
    "emoji-copy@felipeftn",
    "data",
    "emojis.db",
  ]);

The version im using has a hardcoded path to emojis.db, but in my system it's in /run/current-system/sw/share/gnome-shell/extensions/emoji-copy@felipeftn/data/emojis.db (as i said before), not in the home directory.

StellarSt0rm commented 2 weeks ago

After some errors, and dealing with hardcoded paths (to bash) in the Makefile, i have built it, for now i will have to have this extension installed the non-nix way (:c), but it works..

(Also, you can close the issue :3)

StellarSt0rm commented 2 weeks ago

Update: I made an override for the package in my config, for anyone else using Nix, you can put this in the "let":

emoji-copy-patch = pkgs.gnomeExtensions.emoji-copy.overrideAttrs (old: rec {
  src = pkgs.fetchurl {
    url = "https://github.com/FelipeFTN/Emoji-Copy/releases/download/v2.2.0/emoji-copy@felipeftn.zip";
    hash = "sha256-q/lWFME2oH2VeMlai5qRE60JTuCa4Bzh18ponTEG7pU=";
    downloadToTemp = true;
    recursiveHash = true;

    postFetch = ''
      ${pkgs.unzip}/bin/unzip $downloadedFile -d $out
    '';
  };
});

then replace gnomeExtensions.emoji-copy with emoji-copy-patch, you will have to manually update the version and hash though... And yes, i wasted like a whole day figuring this out...

Edit: Also, i changed the title to have "Nix" in it for people who have the same problem in the future :) (So if they search "Nix" in the issue it will appear)

@FelipeFTN

FelipeFTN commented 2 weeks ago

Heyy, @StellarSt0rm, Woow nice findings!! šŸŽ‰

To be honest, I know very little about the Nix system and its package manager - I might give it a try soon to learn a bit about it. I would love to see emoji copy having full compability with all Linux distros and Nix seems to be the most exotic of them haha šŸ˜…

But still, that's pretty strange... I remember a guy has already done a better compability with Nix package manager at this PR #51 But your extension doesn't seems to have those changes... can you take a look? šŸ¤”

I'll keep this issue open for a while, I'm really curious about this, I might take a look at the nixpkgs and achieve some conclusion or fix. Maybe we can improve the Makefile to be more compatible with Nix too! What do you think? šŸ’Æ

Screenshot 2024-07-05 at 12 00 08

Here's a change in the handlers/sql.js file from that Pull Request, for better compability with Nix, I don't know why this doesn't work with you šŸ¤”

Also, feel free to share your thoughts over some solution or idea!! šŸ™ I'm planning to take a look at this today, I'll send my updates here!!

StellarSt0rm commented 2 weeks ago

The problem is that the version of the extension in Nixpkgs -version 21,- doesnt have the compatibility fix, what i did with the override is get V23, which does have the fix. I dont think we can do much about it apart from overriding the package in the configuration.nix. Hopefully they update the version in the future -Maybe when GNOME 47 comes out?-

FelipeFTN commented 2 weeks ago

Hello again! @StellarSt0rm šŸ‘‹

Looks like the Nixpkgs have their gnome extensions managed manually over github. So, we need to keep updating it by running the update-extensions.py script, found at: nixpkgs/pkgs/desktops/gnome/extensions/update-extensions.py. And so I did!

Just updated all the extensions in nixpkgs repository and created a Pull Request! :tada:

Hopefully, they are going to approve and merge it, and we can test the extension the properly with nixpkgs!

I thought it would be a good idea to keep this issue open until we can finally test it. I mean, waiting for the Pull Request with the new version of Emoji Copy to be merged and try to install it from nixpkgs. Then we share the results here at this issue. What do you think?

I will let you know when the pull request gets merged, then can you test it? :pray: