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

Show running branch if not master #1258

Merged
merged 12 commits into from
Feb 10, 2023
Merged

Show running branch if not master #1258

merged 12 commits into from
Feb 10, 2023

Conversation

jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Jan 28, 2023

Another speculative development aid.

This makes it discoverable which branch of Code is running if not master. This can be useful when switching between master and the development branch for comparison and there is no other visual cue. Also for knowing which branch you are currently dogfooding.

For simplicity and compatibility with other apps, the branch is exposed in the window title.

In order for the modified window title to be shown, the project needs to be built with the meson option -Ddevelopment=true.

@jeremypw jeremypw marked this pull request as draft January 28, 2023 19:42
@jeremypw
Copy link
Collaborator Author

Converting to draft while fixing CI (absence of git) issue.

@Marukesu
Copy link
Contributor

Do the branch name is needed? or only a indicative that we are running a development version? i think we can use the .devel css-class for differencing between a development window and a stable one. but that won't say the actual branch this was compiled from.

@jeremypw
Copy link
Collaborator Author

Do the branch name is needed? or only a indicative that we are running a development version? i think we can use the .devel css-class for differencing between a development window and a stable one. but that won't say the actual branch this was compiled from.

For the case of installing and testing a branch of an app when you are working on several branches of that app at once it would be helpful to know which branch is actually installed. However, your solution would be simpler and would not need to be customised for each app.

@jeremypw
Copy link
Collaborator Author

@danirabbit There does not seem to be any simple reliable way to extract the development focus using git (perhaps someone else can find one). The only way I could see would be to analyse the contents of .github/release.yml which would be tricky with meson. The simplest way seems to be to hard code it into the configuration and change it on the rare occasion it is required (release.yml has to be changed in anycase).

@jeremypw
Copy link
Collaborator Author

@Marukesu Would we need a CssProvider for the .devel class? I cannot find this class in the elementary stylesheet.

@Marukesu
Copy link
Contributor

Marukesu commented Feb 2, 2023

@jeremypw for now, i believe. the .devel css-class is defined by Adwaita to be appiled to windows to add "development" styles to it.

if this end being a common pattern in elementary apps, they could be implemented in the elementary stylesheet itself as it is in Adwaita.

For the case of installing and testing a branch of an app when you are working on several branches of that app at once it would be helpful to know which branch is actually installed.

one way to implement the branch name i believe is to put it in the window title/desktop file if built with a -ddevelopment=true meson option, instead of checking if it's a "stable" branch build. if both stable and developement version should run in parallel a different application_id would be needed too.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Feb 2, 2023

@Marukesu Thanks for suggestions! I'll try to implement those.

@jeremypw jeremypw marked this pull request as ready for review February 2, 2023 18:51
src/MainWindow.vala Outdated Show resolved Hide resolved
@Marukesu
Copy link
Contributor

Marukesu commented Feb 2, 2023

one thing i noticed is that the window title don't appears in the dock label. Also, it would be good if we put a label with the title in the header bar when we are in the placeholder view.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Feb 3, 2023

one thing i noticed is that the window title don't appears in the dock label. Also, it would be good if we put a label with the title in the header bar when we are in the placeholder view.

That's a good idea - I'll do that.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Feb 3, 2023

@Marukesu I am not familiar with Plank code. I can see that one way of changing the tooltip would be to generate a different "Name" key in the .desktop file for development versions. This would only work for installed versions however, not if running uninstalled from the terminal. Is there a better way of doing this?

@jeremypw
Copy link
Collaborator Author

jeremypw commented Feb 8, 2023

@Marukesu The latest commit implements the idea of changing the desktop file in order for the tooltip in the dock to display the branch name. This, of course, prevents translation but I assume that is not a problem. Translation occurs as normal when not installing a branch with the development option.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Feb 8, 2023

I can confirm that it is now possible to run a branch instance alongside a master instance.

Copy link
Contributor

@Marukesu Marukesu left a comment

Choose a reason for hiding this comment

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

Code looks good. One thing that could be done in a future PR is allowing not only parallel execution, but parallel installation too.

… This, of course, prevents translation but I assume that is not a problem. Translation occurs as normal when not installing a branch with the development option.

I would assume Code isn't meant to be translated anyway. so yeah, i don't see a problem either.

@jeremypw
Copy link
Collaborator Author

Thanks @Marukesu. I'll merge now and we can refine as required in another PR. I guess for dual installation we will have to generate a desktop file with a different name? Would a single name such as io.elementary.code.devel.desktop suffice? I do not want to clutter the applications directory with a different name for each branch.

@jeremypw jeremypw merged commit 6d31b6b into master Feb 10, 2023
@jeremypw jeremypw deleted the show-running-branch branch February 10, 2023 13:10
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.

None yet

3 participants