Open AnirudhG07 opened 1 week ago
I have implemented add tags, removing specific tags, removing all tags functionality and set new tags functionality. @sxyazi pls take a look. The might run slow as expected since tag function itself takes time to tag files. ~Also hovered file cant be tagged yet.~
I am facing an issue in displaying the tags in UI in the status, beside permissions. This function is inside my mactags.yazi/init.lua
I would like to call it to get the tags and display at the bottom.
local function setup()
local files = selected_files()
-- assert, #files == 1, since it is hovered
local cmd_args = "tag -l " .. files[1]
local success, output = commad_runner(cmd_args) -- this command gives me tags of a file/folder
if not success then
return false
end
local target = output.stdout:gsub("\n$", "")
local tagset = target:match("%s+(.*)"):gsub(",%s*", ","). -- this is for formatting the output in desired format
local tag_table = {}
-- assumes tags are correct since we are displaying now
for tag in tagset:gmatch("([^,]+)") do
local tag_char = Reverse_color_mapping[tag] -- to get the single character tag
table.insert(tag_table, tag_char)
end
local tags = reorder_string(table.concat(tag_table, ""))
return tags -- "rgbiw" format is successfully obtained
end
Can someone share how I can call this in main init.lua
to display(coloured) at the bottom?
display(coloured) at the bottom?
Are you referring to the left of permissions or the right?
Yeah so, Since these are tags so keeping them next to the file name didnt appear neat to me. So at the bottom beside permissions seemed appropriate. They can be either left or right, doesnt matter. I will prefer right. By coloured I mean, as mentioned in my repo, I have single chars assigned, so if each symbol can be coloured like permissions ones, it would be better.
@sxyazi I was wondering about color schemes, and when I was digging more about mactags, I thought we should allow the users to choose color themselves for a tag. Also the names can also change apart from red yellow, etc. So I have configured the settings for that.
How do you propose we should allow them to set a color? Should we make a seperate configuration editable file for it or you have a better idea?
If we're aiming for something like macOS tags, I think placing them before or after the filename would make more sense as putting them in the status bar would require hovering over a file and only seeing that file's tag.
Anyway, I'll create a PR later to add APIs for adding components to both the filename and status bar. As for colors, you can use any hex color code or one of the terminal's 16 colors, https://yazi-rs.github.io/docs/configuration/theme#types.color
yes its fine.
Ill be adding another key in tag name, like r = { tag = "red", priority = 1, color = "#hex"}
, that way it would be easier to fill the color of the tag.
I made a PR for it, still lack a lot of work to do, feel free to track it at https://github.com/sxyazi/yazi/pull/1257
Ok sure. the UI part of mactags can be done after these changes are fixed.
Please describe the problem you're trying to solve
Hoping to get macOS like file tagging implemented in yazi. This feature request was yet to be done(according to pinned issue) neither I could find a issue related to it.
Would you be willing to contribute this feature?
Describe the solution you'd like
So there is this tool called
tag
which you can download using Homebrew. So I am trying to implement this slowly and it is far away from being completed. I am working here: https://github.com/AnirudhG07/mactags.yazi I am trying to implement the TODO's I have written.Additional context
I would like some external helping hand from everyone, hence I put this issue.