jiriks74 / presence.nvim

Discord Rich Presence for Neovim
GNU General Public License v3.0
23 stars 6 forks source link

[FEAT]: Support discovering tool/language by file contents #44

Open daUnknownCoder opened 5 months ago

daUnknownCoder commented 5 months ago

Are you on the latest version?

Have you tried it with default config?

Description

I wonder if you have used hyprland or not (the infamous wayland tiling window manager that does not sacrifice on its looks)

so the filetype is hypr and the directory it is stored in is ~/.config/hypr and all files have an extension .conf so what happens is, i want to set the Hyprland Logo in Rich Presence when I am editing my Hyprland config, i tried setting

conf = { "Hyprland", "https://styles.redditmedia.com/t5_6sciw0/styles/communityIcon_h3cvittvupi91.png" }

which works, but it shows the Hyprland logo for every .conf file, like mpd.conf, some filetypes excluded (like kitty.conf, which has the kitty logo) so the other i have tried is setting hypr = {...}, hyprlang = {...}, so the thing is Hyprland's config has official tree-sitter support too (https://github.com/tree-sitter-grammars/tree-sitter-hyprlang?tab=readme-ov-file)

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

OS information

6.7.9-arch1-1 (Hyprland)

Steps to reproduce

It doesnt work so?

Logs


[presence.nvim] Setting up plugin for linux
[presence.nvim] Using XDG runtime path: /run/user/1000/app/com.discordapp.Discord
[presence.nvim] Using Discord IPC socket path: /run/user/1000/app/com.discordapp.Discord/discord-ipc-0
[presence.nvim] Checking Discord IPC socket at /run/user/1000/app/com.discordapp.Discord/discord-ipc-0...
[presence.nvim] Using id 99aaaa7a-6a4a-4372-a167-a142a33b7d25
[presence.nvim] Completed plugin setup
[presence.nvim] Getting nvim socket paths...
[presence.nvim] Executing command: `ss -lx|grep -E ".+nvim.+"`
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Handling FocusGained event...
[presence.nvim] Connecting to Discord...
[presence.nvim] Connected to Discord
[presence.nvim] Authorizing with Discord...
[presence.nvim] Wrote message to pipe
[presence.nvim] Authorized with Discord for daunknownguy
[presence.nvim] Parsed filename hyprland.conf with conf extension
[presence.nvim] Getting project name for /home/daUnknownCoder/.config/hypr...
[presence.nvim] Not a git repository, skipping...
[presence.nvim] Setting activity for /home/daUnknownCoder/.config/hypr/hyprland.conf...
[presence.nvim] Using file asset: { "Configuration file", "config" }
[presence.nvim] No project detected
[presence.nvim] Sync activity to all peers...
[presence.nvim] Setting Discord activity...
[presence.nvim] Wrote message to pipe
[presence.nvim] Set activity in Discord for hyprland.conf
[presence.nvim] Handling FocusGained event...
[presence.nvim] Activity already set for /home/daUnknownCoder/.config/hypr/hyprland.conf, skipping...

Aditional info

with hypr = {...} or hyprland = {...} image

with conf = {...} image

jiriks74 commented 5 months ago

Hello, fist of all I tool the liberty to convert this to a feature request. Some language not supported is not a bug so this should be a feature request. Please use the appropriate form next time.


To your request: I have not, nor planned to, use hyprland.

Currently there's no support for resolving a language by it's contents. Right now everything is based on the file extension.

Resolving language by folder path is nonsense and would be hard to do since the config files can be at different places on different distributions. It would be a hack that I think I'm not willing to do, unless someone shows me a good solution.

Using file contents wouldn't be easy either as I'd likely have to implement something like a parser for every supported language/config file so that it could be recognized.

Considering that I'm doing this for free while studying college I don't have the time to do this. It probably won't be solved in the near future, if at all, but I'm willing to leave this open if someone else has input.


You could do something like a bodge and make a private git repo for this. Then you could have something like Working on hyprland-config with Editing xy.conf. The icon would still be the conf.

daUnknownCoder commented 5 months ago

Can i do a custom folder setting? somthing like:

custom = {
  "~/.config/hypr" = { "Hyprland", "<image-url>" },
  "~/.config/mpv" = { "MPV", "<image-url>" },
}

it would be fun to implement this, if you aren't free, drop a message in this issue, and the folder/file link where these things, are defined, Thank You @jiriks74 for dropping this plugin, now i can flex to my peers, that i am doing a big job...

jiriks74 commented 5 months ago

@daUnknownCoder I took over the project so I'm not fully familiar with it yet (I'm working on it).

[!Important]

AFAIK there's no way to do what you want.

If you'd like to add something like you suggested:

custom = {
  "~/.config/hypr" = { "Hyprland", "<image-url>" },
  "~/.config/mpv" = { "MPV", "<image-url>" },
}

Someone would need to implement such functionality. Sadly I am not able to work on this RN.