Open rohmishra opened 2 years ago
Regardless of what we decide to do with order or layout - I think this is desirable.
I would start this way
Everything else is probably unnecessary for now and might conflict.
Would you like to give it a go?
We can store the counters in gsettings
https://wiki.gnome.org/HowDoI/GSettings https://docs.gtk.org/gio/class.Settings.html
https://github.com/sonnyp/Junction/blob/main/data/re.sonny.Junction.gschema.xml https://github.com/sonnyp/Junction/blob/main/src/common.js
Ill give it a try, lets see what can be done and what would be the best way to do it. Also P.S. it looks like the Makefile never compiles the schemas.
@rohmishra the dev entry point does - https://github.com/sonnyp/Junction/blob/main/re.sonny.Junction#L15
hmm... I got this with make dev; make run-host
so i just ran glib-compile-schemas manually which fixed the issue. I havent changed anything yet cause I am/was busy with something else so I told myself ill take a look at it when i get to it.
GSETTINGS_SCHEMA_DIR=./data ./install/bin/re.sonny.Junction
(gjs:38876): Gjs-CRITICAL **: 15:23:15.447: JS ERROR: Error: GSettings schema re.sonny.Junction not found
_init@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:551:23
@file:///home/rmishra/Projects/Junction/install/share/re.sonny.Junction/common.js:3:25
And now it works without having to install them. IDK what went wrong there but yes it works now 😞
I would start this way
- Keep a counter of app use per resource type
- Always select the app for which the counter is the greatest
about using a simple counter, i think there's a big problem:
.mp4
files, for about 5 months, so the counter is something like +200.mp4
files, and guess what? you love it and now prefer it over app A!.mp4
file +200 times, to make it the new default pre-selected appmy suggestion is to use some math+weights trick to make more recent selection more meaningfull:
// controls the weight of most recent picks.
const lambda = 0.25;
function whenAppIsChoosen(pickedApp) {
maxScore = priorityScore.get(previousAppWithHighestScore);
thisPickWeight = (maxScore * lambda);
previousScoreWeight = priorityScore.get(pickedApp) * (1 - lambda);
priorityScore.set(pickedApp, previousScoreWeight + thisPickWeight +1);
}
there's only one thing that concers me: float/double overflow. so we have one workarround: instead of making the recent picks grow more, we can make all previous picks shrink, like that:
// controls the weight of most recent picks.
const lambda = 0.25;
function whenAppIsChoosen(pickedApp) {
maxScore = priorityScore.get(previousAppWithHighestScore);
thisPickWeight = maxScore * lambda;
previousScoreWeight = priorityScore.get(pickedApp) * (1 - lambda);
thisAppNewScore = previousScoreWeight + thisPickWeight +1;
priorityScore.set(pickedApp, thisAppNewScore);
/* maxScore is always 1, unless thisAppNewScore is the new maxScore
so we only shrink stuff when maxScore is not 1 */
if (maxScore < thisAppNewScore) {
maxScore = thisAppNewScore;
// time to shrink
for(i=0; i<priorityScore.length; i++) {
priorityScore[i] = priorityScore/maxScore;
}
}
}
Thanks, as I said, the counter only approach is just to get started. We are aware it won't be enough.
Before we decide on an algorithm, we need to use the feature and gather feedback.
For example, someone posted a review of Junction in which they praise the fact that selecting an app always pushes it to the list of options https://www.youtube.com/watch?v=rfVd9bhRWxs
No problem! didn't mean to criticize nor anything like that. Just posted some ideas i had (in case it becomes handy).
This is potentially related to #12 and i suggested this idea in the thread over there.
In my experience people usually have one default app that they might wanna use regularly but have different apps installed that they might wanna choose for one time use.
For example:
A nice quality of life improvement in this case would be to automatically select the most frequent (or previously selected) application for that particular type such that instead of having to select the app after hitting enter, you could hit enter twice to open a image in viewer without having to set eog as default.
If you want to use a different app, you can certainly just tap/click the app instead as you do now.
This screenshot might help with how the default view when Junction opens might look. The highlight could potentially be toned down or be a outline instead. as white text on off-white background is a bit harder to read. The highlight the dash uses seems to be visible enough while not being too bright.
Here is how this might work: