-
-
Notifications
You must be signed in to change notification settings - Fork 77
Implemented search history for application plugin #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
That sounds amazing! |
|
Any update on this useful feature? |
Kirottu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the PR is quite old, it needs a rebase for me to try it out. Alongside with the other comments that should be addressed.
| pub fn load() -> Self { | ||
|
|
||
| let path = format!( | ||
| "{}/.cache/anyrun-applications-history", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ~/.cache/anyrun/applications-history in line with what the nix-run plugin uses.
|
|
||
| let path = format!( | ||
| "{}/.cache/anyrun-applications-history", | ||
| env::var("HOME").expect("Unable to determine HOME directory") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer $XDG_CACHE_HOME, and use $HOME/.cache as a fallback.
| desktop_actions: false, | ||
| max_entries: 5, | ||
| terminal: None, | ||
| history_size: 50, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be an optional, in a way that None will disable the history alltogether.
|
|
||
| State { config, entries } | ||
| let history = history::History::load(); | ||
| println!("Loaded {} history entries", history.count()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be eprintln!("[applications] ...", ...);
| let mut score = (app_score * 25 + keyword_score) - entry.offset; | ||
| let history_score = state.history.get_entry_info(entry).map(|(index, count)| { | ||
| let recency_bias = i64::max(5-index as i64, 0); | ||
| (count as i64 + recency_bias) * 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the weighting has changed recently, this likely needs different weighting to make it work properly.
|
Hi, i did a rebase recently for my personal fork which includes this feature. I first want to make some improvements on this because the current algorithm is quite naive. |
Issue #14 discussed this feature before, but the branch the maintainer mentioned is out of date by 74 commits.
This pull request implements recency bias into the applications plugin, meaning recently / commonly searched applications will be prioritized. The history file is stored in
$HOME/.cache/anyrun-applications-history. The maximum number of entries can be changed in the config file usinghistory_size(see README.md).Recency bias is only applied if the other score components are not 0 (to prevent unrelated results showing up) and when the input field is empty.