Closed aoki closed 7 years ago
I like this for it's simplicity, but what if there's a process that's similar, but doesn't exactly match? I think it's nice if there's a way to match processes that are related, no? Although, fuzzy finding does't work that well either.
For example, nodes
would get matched with node
even though it's not explicitly listed in the icon classes array.
Problem with this regex is that for example it'll also match with a folder namned node.
@henrikdahl good point.
What about this?
It'll still flash the process icon though. When you cd node folder it'll change title for a millisecond to sites: cd node
which matches.
It is a very difficult problem... 🤔 How to get process name position in a title using regex pattern (or fuzzy matching)..
One of the proposal, write config for the process position using regex. However position eval and replacement for keyword too hard. Not quite... 😢
We write config like a below.
PROCESS_NAME
is process name position in a title.
tabIcons: {
processNameRegex: '(?:[\\W]+|^)PROCESS_NAME(?:[\\W]+|$)'
}
Load config and evaluate with eval
(However, I don't like eval...).
> var config = '(?:[\\W]+|^)PROCESS_NAME(?:[\\W]+|$)'
undefined
> var regexText = config.replace('PROCESS_NAME', '(${e})')
undefined
> regexText
"(?:[\W]+|^)(${e})(?:[\W]+|$)"
> eval(`var f = (e) => { return new RegExp(\`${regexText}\`, \'i\'); }`)
undefined
> f
(e) => { return new RegExp(`(?:[\W]+|^)(${e})(?:[\W]+|$)`, 'i'); }
> f('foo')
/(?:[W]+|^)(foo)(?:[W]+|$)/i
Any chance of getting this merged?
This should be fixed with hyper-tab-icons@1.1.3
now. See here: https://github.com/dfrankland/hyper-tab-icons#configtabiconsprocessnameregex
I have same problem(#17). This PR is not configurable.
I use pure prompt. It shows process name at the after
—
when I adopt regex instead of atom/fuzzaldrin. I think don't need fuzzy matching.This regex
(?:[\W]+|^)(PROCESS_NAME)(?:[\W]+|$)
match below cases. In this case PROCESS_NAME is 'foo'.Please close this PR If you don't need.