Skip to content
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

favoriteApps: initial implementation #1

Open
wants to merge 2 commits into
base: cutie
Choose a base branch
from

Conversation

mathew-dennis
Copy link

@mathew-dennis mathew-dennis commented Jul 24, 2024

add submenu to add and remove favorite apps
include cutie store for persistence
add timer to differentiate short and long presses

Part 2 will be to implement a new panel in cutie home which requires a little bit more work

add submenu to add and remove favorite apps
include cutie store for persistence
add timer to differentiate short and long presses
Copy link
Member

@erikinkinen erikinkinen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, where is the favourites bar? Is that an upcoming PR here? or in cutie-home? or somewhere else?

Edit: Apparently, I cannot read.

src/qml/main.qml Outdated Show resolved Hide resolved
src/qml/main.qml Outdated Show resolved Hide resolved

function saveFavoriteItem(name, iconPath, execCommand) {
let data = favoriteStore.data;
data["favoriteApp-" + name] = { "icon": iconPath, "command": execCommand };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is really no need to prefix it like this. Also, it would make sense the save the full js object (model).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it .. I saw that the add data function only uses these 3 variables to create the deligate item, that's why I did the same.. should I be saving the whole object?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the best way to do this imo would be to save the filename of the desktop file.

So, for example, when adding Firefox from /usr/share/applications/firefox-esr.desktop, the code should add "firefox-esr" to a JavaScript array.

With this, I would rename the store to settings and use data["favoriteApps"] as the array.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intension behind this is to have an extra page in the settings app to manage apps?

Also if we only save the file name then won't we need a lot more code to read the desktop file to get the icon and app name??

(Sorry if I miss understand your idea)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it is just redundant to store all information twice.

With this, it would be easier to remove uninstalled applications from favorites automatically.

In this case, it would be sane to move the desktop file parsing logic to a library.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the .desktop file is phrased and sent to libcutiestore then both all apps and favourite apps are loaded from this store?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the desktop entries would be parsed on the fly. Of favorites, only the file name of the entry is saved. Then, cutie-home would parse the desktop file of this name.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oke, I think I understand now. will come back to this once I am done with cutie-home

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @erikinkinen how hard would it be to move desktop file parsing logic to a library.

replace onReleased with onPressAndHold 
remove timer
move remove fav app menu to cutie-home
@@ -80,6 +101,19 @@ CutieWindow {
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
}

CutieStore {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not initialize this inside the delegate. That would cause it to initialize identical objects for each button which causes a heavy performance impact.

width: launchAppGrid.cellWidth
height: launchAppGrid.cellHeight

property bool longPress: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used anymore as far as I can see.

height: launchAppGrid.cellHeight

property bool longPress: false
property alias menu: menu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be necessary. The identifier menu should be available inside the delegate through the id property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants