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

Make Unity indicator official #184

Closed
holocronweaver opened this issue Sep 11, 2014 · 26 comments
Closed

Make Unity indicator official #184

holocronweaver opened this issue Sep 11, 2014 · 26 comments
Assignees
Labels
companions => companion projects (see #493) design Design discussions and interesting use cases enhancement

Comments

@holocronweaver
Copy link
Contributor

A status icon makes hamster much easier to keep track of.

Currently the only hamster status icon that works in the Unity desktop environment is the hamster indicator (http://www.webupd8.org/2011/07/install-hamster-indicator-time-tracking.html). From what I can tell, it has been abandoned by its creator. Since it is no longer updated for the latest hamster release, Ubuntu is shipping an old version of hamster in its repositories so that the indicator continues to function.

I feel a status icon is critical enough to hamster functionality, and Ubuntu a popular enough distro, that it should be officially supported, either as a separate git repo under projecthamster or within the hamster repo. Doing so would allow Ubuntu to package newer hamster versions (a good thing for both devs and users). Plus it would make it easier for others to improve Unity integration by making contributions.

We could also use this opportunity to fix #156 and finally get Ubuntu support into proper shape. As-is, the git version of Hamster is not very usable on Ubuntu out of the box.

I am willing to do the bulk of the work to make this happen, but want to hear thoughts from the maintainers and community before I proceed.

(BTW, pull request #82 seems to have already integrated the indicator into hamster. May be worth a look.)

@toupeira
Copy link
Contributor

An indicator for Unity would be very welcome, let me know if you need any pointers (still getting acquainted with the codebase myself though). Had a look at #82 but that PR is all over the place...

I think it makes sense to keep this in its own repository, maybe you can start one and when you're ready to submit a PR we'll create it on our side as well.

@riker09
Copy link

riker09 commented Sep 17, 2014

Where's the upvote? I just updated the default version that Ubuntu ships with 14.04 from GitHub and the App is unusable for me in the current state.

@toupeira
Copy link
Contributor

@riker09 yep the current version only targets Gnome Shell and CLI at the moment. Contributions are welcome!

@nchachereau
Copy link

Hi! I started looking into this. A basic hamster-indicator script wouldn't be too difficult to create, and wouldn't need to be "all over the place".

I wrote a basic proof of concept, with "Stop tracking", "Show overview" and "Add earlier activity" working. Starting a new activity is a bit more complicated. Furthermore I'm duplicating code from hamster-cli... a bit of refactoring would help to respect the DRY principle. (Or maybe I should add the indicator code to hamster-cli. I guess I still need to better understand the relations between hamster-cli and the dbus services.)

Which leads me to my question: should I make it work with the trunk or with the last stable? The code has diverged quite a lot since 1.04. Is anyone running "bleeding edge"? toupeira, tbaugis?

@holocronweaver
Copy link
Contributor Author

@nchachereau I would say bleeding edge since there already exists a Unity indicator that works with stable. I am running bleeding edge on Ubuntu without an indicator.

@toupeira
Copy link
Contributor

toupeira commented Nov 7, 2014

@nchachereau I'd also say bleeding edge, it's pretty stable for me and I'm planning to make a 1.05 release before the end of the year (fingers crossed).

What problems are you encountering on implementing "Add activity" vs. "Add earlier activity"? Isn't it pretty much the same, just without an end time?

@nchachereau
Copy link

The distinction between “Add activity” and “Add earlier activity” doesn't make sense with the new GUI in the trunk. I had seen that from the code, but as I hadn't tried it yet, so I was referring to a now obsolete distinction.

Bleeding edge seems stable indeed, but I encountered quite a few bugs. I will report them and/or work on them in the next few weeks.

Regarding the indicator, here are a few thoughts:

  • We need to decide how it should look like and behave: Should it only show the icon? The icon and the duration of the current activity? The duration and the name of the current activity? Alberto Milone's version had hidden preferences for this; should we embrace a similar approach (“Power to the User!”) or decide what's best (“Opinionated Software!”)?

  • What options should its menu include? The old version had:

    hamster_activity_final1

    • Name and Duration of Current activity. A click on it allowed to start a new activity beginning now.
    • Stop tracking
    • Add earlier activity
    • Show overview
    • Preferences
    • Quit

    I would propose keeping the current activity name as a way to add activities, the stop tracking, show overview and quit (which I'd name “Close indicator”, to make it clear that Hamster still runs). I'm not sure about preferences, but since it allows to modify existing activities and categories, it might be useful.

So here is a first prototype: https://gist.github.com/nchachereau/2460d0224b0b9df5b61e

I will propose a pull request when we have decided on the issues above. Unlike what I thought, the amount of code duplicated from hamster-cli is quite small, no need to refactor.

(Source of the image: http://www.albertomilone.com/wordpress/?p=502)

@toupeira
Copy link
Contributor

toupeira commented Nov 8, 2014

Bleeding edge seems stable indeed, but I encountered quite a few bugs. I will report them and/or work on them in the next few weeks.

Thanks!

We need to decide how it should look like and behave: Should it only show the icon? The icon and the duration of the current activity? The duration and the name of the current activity? Alberto Milone's version had hidden preferences for this; should we embrace a similar approach (“Power to the User!”) or decide what's best (“Opinionated Software!”)?

If it's not too much effort I would implement the same options as the shell extension:

project hamster extension_001

The label combines the activity name and duration, which makes sense IMHO since most people probably want either both or just the icon. Also I just noticed that "Icon" displays a blank icon and "Label and icon" displays only the duration, will add another issue for those ;-)

What options should its menu include?

For reference, the Gnome extension looks like this:

selection_002

If you decide to implement the label inside the indicator it would probably make sense to not show it again in the menu, but then you'd need another way to add a new activity.

Regarding "Close indicator", unless this is common in Unity indicators and/or there's no other way to manage indicators, I would leave it out to avoid accidentally removing the indicator.

Regarding "Preferences", I suggest naming it "Tracking Settings" as well.

@nchachereau
Copy link

Thank you for these comments!

Regarding options, application indicators require an icon. I propose following options:

  • Show name of current activity in panel
  • Show duration of current activity in panel
  • Show a different icon when an activity is running

The user would thus be able to mix and match (personally I like seeing the duration, but I usually know what I am doing). The last option comes from the original hamster-appindicator. I'll have to find/create better icons, as the original “glow” icon doesn't look very nice.

(I haven't given much thought about the wording yet. Tell me if you have better ideas, as I am not a native English speaker.)

Regarding "Close indicator", unless this is common in Unity indicators and/or there's no other way to manage indicators, I would leave it out to avoid accidentally removing the indicator.

Well, if I look at the indicators I have, they always have a "Quit" menu entry. They usually are the main or only GUI for the application, so that this option terminates both the indicator and the application (e.g. redshift, which changes the color of the screen; parcellite, a clipboard manager; Dropbox; etc). Quitting by mistake is not a real problem, you just run the application again.

The indicators that do not allow quitting are the “system” indicators such as network-manager, keyboard switching, messaging, sound, ... I'd argue that Hamster does not belong to this category, and that we, as users, may not always want Hamster in our panel.

Thus, the question now becomes: should the Hamster indicator only allow closing it, or really “quitting” also terminating the DBus services and closing any open windows? I still wanted to look into that, but this seems the way to go, as simply starting Hamster again will restart the services as well.

Regarding "Preferences", I suggest naming it "Tracking Settings" as well.

Done.

This is what I have so far:
indicator

Right now, it is still mostly a single python script, but all in all I think it would be: a python script, several icons, a Gsettings schema file, a .desktop launcher file, maybe a Glade UI file for the indicator settings. I think it makes most sense to consider it almost a separate application, just as the Gnome extension also is a separate repo.

How should I proceed to propose a new repository for project hamster?

@toupeira
Copy link
Contributor

I've created a repository at https://github.com/projecthamster/unity-indicator and added your user, welcome to the Project Hamster organization! :-)

Regarding options, application indicators require an icon. I propose following options:

Sounds good! I'd just keep the options short, something like this:

  • Show current activity
  • Show duration
  • Show different icon when active

Thus, the question now becomes: should the Hamster indicator only allow closing it, or really “quitting” also terminating the DBus services and closing any open windows?

I'd say yes if you agree, not sure how to do that though since the hamster CLI doesn't implement it either.

@nchachereau nchachereau self-assigned this Nov 12, 2014
@nchachereau
Copy link

welcome to the Project Hamster organization! :-)

Thanks! 😄

Thus, the question now becomes: should the Hamster indicator only allow closing it, or really “quitting” also terminating the DBus services and closing any open windows?

I'd say yes if you agree, not sure how to do that though since the hamster CLI doesn't implement it either.

Well you can just call the Quit() methods on both services. However, I now have a dilemma. “Close indicator” may not suggest that this will close any open windows. “Quit” may suggest that this will also stop tracking (it won't, nor am I sure it should). Maybe use “Quit” anyway, and users will learn along the way? Offer the choice as a setting, just as there are options to stop tracking on shutdown or when the computer becomes idle?

@toupeira
Copy link
Contributor

Hmm yeah I guess that's just the way Hamster works, so I'd use "Quit" and let it keep tracking, maybe the user even still uses Hamster through the CLI.

@holocronweaver
Copy link
Contributor Author

I think a user option would be preferable. Typically when I close a program, I do not assume its daemon is still running in the background unless I specifically requested it to do so.

@toupeira
Copy link
Contributor

As far as I know there's no daemon left running when you kill the DBus services, but if you don't explicitly mark the last activity as stopped, it will simply stay active when you start Hamster again.

@nchachereau
Copy link

Your contrasting answers nicely capture my dilemma...

As far as I know there's no daemon left running when you kill the DBus services,…

Technically, that's absolutely true. Which is a very good reason to quit the DBus services in the first place. They will restart as soon as they are called anyway.

… but if you don't explicitly mark the last activity as stopped, it will simply stay active when you start Hamster again.

And I think that's what @holocronweaver meant: not the technical meaning of “I do not expect a background process to continue running and take memory space”, but rather “I do not expect the current activity in Hamster to remain active”.

So I implemented an option, it's called “Stop tracking on indicator close” (it is thus similar to “Stop tracking on idle” in the tracking settings). It is enabled by default. The menu item then explicitly reads “Quit and stop tracking”. It just reads “Quit” if you disable the option (but then you know what you're doing).

This is what it looks like:

capture

@holocronweaver: Since you opened this bug, would you mind testing my work?

git clone https://github.com/projecthamster/unity-indicator.git
cd unity-indicator
sudo cp data/hamster-indicator.gschema.xml /usr/share/glib-2.0/schemas/
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
sudo cp data/icons/ubuntu-mono-dark/24x24/* /usr/share/icons/ubuntu-mono-dark/apps/24/
sudo gtk-update-icon-cache /usr/share/icons/ubuntu-mono-dark
./hamster-indicator

(Obviously, this only installs the ubuntu-mono-dark icons; edit as needed. I ended up using the icons from Milone's hamster-appindicator, but replacing the “glow” icons with the standard colored ones.)

Tell me what you think!

Next things on my list:

  • create separate .po files so that we can translate the few strings used.
  • create an installation script. Any advice? We should already think about future packaging, but I don't know anything about this.
  • write a nice README file with installation instructions
  • close this bug
  • implement an enhancement: show recent activities in the menu and allow starting one of them with a single click

@holocronweaver
Copy link
Contributor Author

@nchachereau is correct, I meant continuing activity tracking after the app closes. For some reason I thought a daemon process was involved - no idea why. =)

Anyhow, I tested the indicator. Seems to work great on Ubuntu 14.04. I tried all the available options, one by one, then all at once, and everything seemed to work. The only odd bug I noticed is when I first launched the indicator, the 'Quit' button was not there, but after playing with the options a bit and tracking a few activities, it appeared.

Overall, great job! Thanks so much for getting this done. Exactly what I had in mind. Is there a way I could send a little coin your way?

Sadly I have inexplicably been having trouble with hamster itself (see #197), so I can't be 100% sure everything works with an functional installation.

BTW, your TODO list looks good to me. I don't know anything about packaging, though I could lend a hand by looking it up if no one else here is familiar.

Edit: Actually, I have a requested TODO item that may or may not be related to this project. A global hotkey to open the change activity dialog would be awesome. Win + H is what I currently used, but that opens the overview window, whereas I really want the change activity window.

@nchachereau
Copy link

The only odd bug I noticed is when I first launched the indicator, the 'Quit' button was not there, but after playing with the options a bit and tracking a few activities, it appeared.

I just noticed this as well. Fixed.

Overall, great job! Thanks so much for getting this done. Exactly what I had in mind.

Thanks!! I'm glad you like it.

Is there a way I could send a little coin your way?

Frankly I never looked into this coin thing... just help make Hamster better, that would be awesome!

Took note of your global hotkey wish. It may belong to Hamster itself, however.

@toupeira
Copy link
Contributor

So I implemented an option, it's called “Stop tracking on indicator close” (it is thus similar to “Stop tracking on idle” in the tracking settings). It is enabled by default. The menu item then explicitly reads “Quit and stop tracking”. It just reads “Quit” if you disable the option (but then you know what you're doing).

👍 Sounds like a good solution!

@extraymond
Copy link

Will it be able to use unity's quicklist and badge?
It would be nice to add those, also it is easier to add a indicator I think.

@nchachereau
Copy link

If you have any programming skills, you are welcome to look into this and propose a patch, especially if the code is distinct from the indicator 😄

I may look into this after I finished the indicator itself, but no promises. I find the indicator nice because you do not need an icon in the launcher.

For those wondering, I should be able to finish the indicator in the next week or so.

@extraymond
Copy link

Thx for your hard work~~
I have nearly 0 coding skills... But I can now add some quicklist via
menulibre so I can have "add new activity" from the icon on the launcher.

Indicator seems more powerful, I'm looking forward to try!

Nicolas Chachereau 於 2014年12月24日 19:00 寫道:

If you have any programming skills, you are welcome to look into this
and propose a patch, especially if the code is distinct from the
indicator.

I may look into this after I finished the indicator itself, but no
promises. I find the indicator nice because you do not need an icon in
the launcher.

For those wondering, I should be able to finish the indicator in the
next week or so.


Reply to this email directly or view it on GitHub
#184 (comment).

@einmalfel
Copy link

Is unity-indicator project abandoned? I've posted pull-request more than a month ago but still no response. Does it have any maintainer?

@nchachereau
Copy link

Hi Vasily,

sorry, I've been extremely busy... I'll look into your PR this week-end.

It is great having someone else contributing to the code!

@daytonb
Copy link

daytonb commented May 6, 2015

Any chance this work will also result in a system tray entry for KDE Plasma 5's system tray?

@holocronweaver
Copy link
Contributor Author

@daytonb Unless KDE has a Unity indicator interface, I don't see how it could.

@ederag
Copy link
Collaborator

ederag commented Dec 15, 2018

Further discussions about unity can go to
https://github.com/projecthamster/unity-indicator/issues
And for the rewrite hamster-gtk/unity issues:
https://github.com/projecthamster/hamster-gtk/issues?utf8=%E2%9C%93&q=unity

@ederag ederag closed this as completed Dec 15, 2018
@ederag ederag added companions => companion projects (see #493) design Design discussions and interesting use cases labels Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
companions => companion projects (see #493) design Design discussions and interesting use cases enhancement
Projects
None yet
Development

No branches or pull requests

8 participants