Thursday, February 2, 2012

The Hunt for Unobtrusive Chat

Once apon a time, Instant messaging or 'Online Chat' was a primary task on it's own. That is, I remember the days when I would switch on my computer, sign in to 'MSN Messenger' (as it was called back then), have a voice conversation with my father (who was working in England at the time), and then be done with it. However, over the last few years, not only have we started to rely more on it, but it's also become more of a secondary (or even tertiary) task. For example, these days I keep in contact with the rest of the telepathy-kde (or is it kde-telepathy now, or just 'ktp' yet?) team on IRC while I'm developing; talk to my friends (with a steam voice call) while playing a game and so on.

The thing is that, things like that need to be able to be done simultaneously while still maintaining maximum efficiency. Which becomes painfully impossible when you have to switch windows, or the way most IM clients are implemented these days.

So, shortly before joining the Telepathy-KDE team, I set out to figure out what would allow me to talk to someone while doing my work with the minimum overhang (interruptions).

First off, switching windows:
If someone talks to me while I'm typing away at something, and the only way I can respond to them is using my mouse (which would involve moving my hands away from my keyboard, clicking on something and then moving back), I will eventually start slicing my wrists.
So, it has to be a global shortcut with a hotkey.
The best example I've seen of that is Kopete:
     Whenever I saw this Icon on my system tray, I would know someone has said something to me. I hit Ctrl + Shift + I and it would take me to the chat window of that person.




I press it again, and it goes to the next person that said something. I keep doing that till I've responded to everyone.

Now, that was brilliant at propagating a conversation and talking to many people at once. But it still had the problem that once I've responded to everyone, switching back to my work was a pain. Granted, I tried to keep my work in a different virtual desktop (and these days Plasma Activities might handle this reasonably well). But that just wasn't good enough for me as it meant I had to waste time managing all the chat windows and switching desktops.

Next Up: Out of the way
I don't like having a window open just to talk to one person, and having one window with tabs for multiple people is even worse (IMHO). A conversation needs to be easily visible, but not be the main focus of my screen - that should be whatever I'm working on at the time.
Best example of that I've seen is in Gmail: when I check my emails, I can have conversations with my Google Talk contacts at the bottom.

These things were brilliant as they meant my conversations were on-screen, but not hogging up the screen. The problem with them were that they were in the browser, and switching tabs or to another window meant they would go away and were very painful to find again.

So, it will have to sit in my panel, probably as a popup widget.

And...
Right, with those two important points in mind, I set out actually creating a solution.
Here, you can see the (very) early (not quite ready for testing) test version of the plasmoid. Currently, it's implemented as a TelepathyTextObserver, which means that the standard text-ui has to be open for it to work, which makes it rather useless. I'll probably change that in the future, but I'm still waiting on a method to be implemented in Telepathy-Qt to allow for two text handlers to play nice with each other.
If that doesn't magically implemented by someone, I'll probably ship this as a handler meaning if the user has this in their desktop, then the standard text-ui won't show up at all ever.
My original idea was to have this only handle a specific set of contacts (i.e. everyone in your 'Favourites' group) and open the normal text-ui for the rest. This also gave me the idea of having single-user plasmoids, that will be there from the start and handle all message to/from that user, thus effectively allowing you to 'pin' a contact to your panel.

And as you can see in this screenshot, if there are unread messages in a conversation, a little bubble will appear telling how many (just like facebook). I couldn't find any plasma theme element that's in any way logical for it, so for now it's hardcoded red and white. If any plasma devs have any ideas, let me know.

Also, just like kopete, clicking Ctrl + Shift + J (I'll make it configurable when I figure out how) will pop up the next conversation with unread messages. And if you were already at the last one, they'll all go away, leaving you back to your work. 

The last part was that I wanted it to feel tightly 'integrated' so I tried to make it look like the task-manager applet. While it may look like I succeed (to a certain degree) in that screenshot, the moment you use it, you'll notice it behaves differently. As it turns out the task-manager widget is quite complex and not something I can easily reproduce in QML. I have to either wait for the plasma team to eventually port it to QML or make a C++ extension and steal their code. 


So, what do you guys think? 
PS: This is my first 'real' contribution to KDE, so please go easy on your (constructive) criticism. :-)

38 comments:

  1. I love the concept, and also making it look like an entry in the taskbar is a great idea imo.
    Looking forward to trying this out.

    ReplyDelete
    Replies
    1. Cheers. And if you're brave enough, it just got merged to ktp-text-ui in git. But I warn you most of the code was written after 2AM and I'm sure the amount of bugs would reflect that ;-)

      Delete
  2. In this sense, I think the GNOME project have done a great job incorporating chat windows as just another notification in GNOME Shell. I love that concept for it is smart and non-intrusive, allowing me to reply/ignore chats without that implying any action from me.

    In that sense, I think that plasma widget outfit is the way to go, but tighter integration would probably be required.

    Great work nevertheless, keep it up!

    ReplyDelete
    Replies
    1. I replied to this 2 comments down:
      http://blog.lasath.org/2011/12/hunt-for-unobtrusive-chat.html?showComment=1328191088551#c1170948073976113588

      Delete
  3. I'm really glad that you're thinking about this from the ground up, and look forward to seeing how this develops. This is important for KDE.

    ReplyDelete
  4. Isn't this a notification which would qualify it for inclusion into the former "systray". Afaik it can contain widgets and so it would be perfect match wouldn't it?

    It should only appear after someone wrote you a message and the rest of the time it should be hidden by default.

    Beside of that: great progress and definately the right direction :)

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. I replied to this 2 comments down:
      http://blog.lasath.org/2011/12/hunt-for-unobtrusive-chat.html?showComment=1328191088551#c1170948073976113588

      Delete
  5. Yeah, as friesoft and Chema Martín, I thought the same thing: sit those plasmoids at the notification area, as other plasmoids do (device notifier, network management, battery and some others). As Chema Martín, this also reminded me of gnome3's "notification chat" (made up this name right now ;) -- if you haven't, look at it at http://gnome.org/gnome-3 scrolling it down to "Integrated Messaging") but I'm not sure kde will let you add a textbox there instead of buttons (as we have for kopete, for example) but, if it will, that would be great! Your plasmoid would work just as it is (clicking an icon reveals a chat with a textbox and it counts unread messages) but, if you can chat from notification, it's one less interaction (user don't have to click the notification to see another window -- or plasmoid popup -- just to say something and having to dismiss it manually), typing something or not, it will go away by itself.

    It's a really good idea, just needs to get some rough edges polished (really, having another window open just for it to work is a no go).

    Keep on that!

    ReplyDelete
    Replies
    1. I had this idea long before I saw GNOME3, I was just slow in getting it off the ground.
      And yes, a while ago I tried to embed it directly in a notification, but KNotfy flatly refused. Chances are that the plasma devs aren't going to add a way for me to do so anytime soon because (as Dario explained to me during the Sprint) KNotify was designed to show the user passive notifications with minimum interaction. That's why they don't get focused by default and why they don't have hotkeys or Mnemonics for the action buttons etc.

      As for what friesoft and Chema Martín said about the systray, I see merit in that too. But once again I'm not sure how to go about from a technical perspective. I don't think systray allows you to add and remove embedded widgets dynamically. IIRC it needs to be a single Plasma::PopupApplet with a special option in it's .desktop file for it to be embeddable.

      I'll try to have a chat with the plasma devs on IRC when I have time to see if they have any suggestions. But so far I don't think either of those ideas are actually doable.

      Delete
    2. Well, as I said and you confirmed, from those 2 ideas, sadly only the one about having those chat icons at the notification area is doable. I'm also not sure how (but I see a few plasmoids that do, as I mentioned before and just remembered one that's not default from plasma: Message Indicator, from kubuntu -- http://agateau.wordpress.com/2009/09/18/indicators-notifications-and-co/ , which today can be at notification area) but I guess plasma devs would give a hand (or at least take a chat with Aurélien, I guess he'll help).

      Anyway, even if notifications are poorly interactive, if your plasmoids (one for each chat, as I understand from your text) sit at notification area and popup when someone says something, the effect would be quite the same.

      Delete
    3. Hello, again!

      Don't know if you've spoken to Aurélien or even if you've read that post I mentioned, where he shows his plasmoid indicator (again, I'm not suggesting you to use indicators, I'm pointing out that he created this plasmoid which is embeddable at notification area, so you could make contact to get some help).

      But, still, this is something else I've found, which is about desktop scripting but may ring a bell or give a trace, anyway: http://techbase.kde.org/KDE_System_Administration/PlasmaDesktopScripting#Add_a_widget_to_systemtray

      Keep on!

      Cheers

      Delete
    4. Wow, I've been busy fixing bugs, implementing the features I promised and overall getting the plasmoid to a 'usable' state. Sorry I completely forgot to respond to this.

      From what I've seen of indicators (which is mostly what I read in the first link you posted), I don't think I can make an indicator which you can directly reply from.

      But as your second Idea, if that Javascript API works, might be doable. Right now, I ditched the one plasmoid per chat option (too difficult to implement). But I'll eventually implement it, and then I could probably write something that'll add a plasmoid to the systray on an incoming conversation.

      Delete
  6. Hi, thanks for this entry. I'd like to have something specific but similar: in-app chat for users.

    ReplyDelete
    Replies
    1. I don't quite understand what you mean by that...

      Delete
  7. Would the shortcut just pop up the 1st chat with unseen messages? What if you have multiple people having messaged you? I guess it would be very nice if it scrolled through (with the main key, eg. J) the contacts while holding down the helper keys (eg. ctrl+alt) just like alt+tab scrolls through tasks, and maybe aligning the contacts with unanswered messages as first ones.
    Or was it already your idea? :)

    ReplyDelete
    Replies
    1. It behaves much like Kopete does at the moment - It cycles through in one direction.
      i.e. when you press it the first time, it pops up widget of the first person that messaged you. When you press it again, it'll pop up the widget of the next one, and so on. Except unlike Kopete, once you've read the chats of everyone, pressing it again will cause all of them to go away.
      It didn't occur for me to allow a way to cycle backwards, but to be honest I didn't think it was necessary.

      Delete
  8. Hi, thanks for your contribution. These are important details to look for!

    It occurred to me, doesn't Kopete support tabbed chats?
    That's how we've partially solved this problem in KMess.

    Secondly, the task bar notification thing is brilliant! It actually also exists in a slightly different way on OS X, as system-wide service (every application, like mail or skype can put a status/counter on their dock icon) and it works really sweet. Not sure KDE should use exactly the same though. Like Will commented before, it's good to see something thought from the ground up!

    ReplyDelete
  9. Love this new concept! Can't wait to try it out

    I hope I understood the concept correctly: Every time you get a new message a new icon appears in your panel and you can have some favourite contacts, whose icon is always shown (similar to the Facebook chat).

    You guys rock!

    ReplyDelete
    Replies
    1. Yes, that's pretty much the concept. Except the having people always shown part isn't implemented yet, and this can't run if normal text-ui isn't running + 9000 other bugs.

      But I think it'll get there one day :)

      Delete
  10. I have been wanting this for months, partly due to my love for plasma and partly because it fits beautifully with the rest of the workspace. keep up the good work :)

    ReplyDelete
  11. This would be wonderful. I've always loved the way Google Talk works on Chromebooks, in Google+, and in Gmail, and I've always wondered why it couldn't work like that on my desktop. This looks really good and I'm looking forward to giving it a try.

    Nice work.

    ReplyDelete
  12. I wonder whether we could make it just like the gmail one?
    If there is some difficult in implement it inside the tray, why not simply put it outside the tray as a standalone plasmoid? Just like another taskbar. Dynamic changing icons number won't cause too much trouble for plasma panel, since tray, task bar already do this.

    And you could also implement something like "pin to task", to have add contacts which is not in the list but chatting to the bar.

    ReplyDelete
    Replies
    1. Well, this currently _is_ a standalone plasmoid that mimics the appearance of the task-manager applet.

      And I was thinking of creating a separate plasmoid that only handled one contact (that the user can add separately). But I think I like your idea of 'pin to task' better because it would be easier to implement.

      Delete
  13. IMHO if you want something fast that works mostly only with the keyboard, why not try a tilling wm, like awesome and/or having a dual head setup?

    I use both of these solutions. I have a secondary screen just for secondary stuff like email client,chat(pidgin), downloads and so on, so what's really important stays on the primary screen.

    I suggested tilling wm since its typically more 'virtual desktop' oriented with all the desktops/tabs you can have. For what I saw, you could easily configure the WM to open the IM client in one desktop, and when someone talks you could just jump to it(for me for example I just press WIN+{DesktopNumber} and that's it).. you would still have a tray icon notifying you but all the windows would be in the right place. The same applyes to email clients and so on..

    ReplyDelete
    Replies
    1. I've had dual screens for years now, but I never felt it solved this problem. I always keep browsers/pdfs and stuff I 'read' from on my left monitor and I stuff I 'write' to (word processors/IDEs) on my right. This is critical to my workflow as it means I can read documentation while I'm coding (and the likes) without switching windows.
      Therefore, secondary tasks like chat and monitoring downloads have no place in the foreground of either monitor (IMHO).

      I tried tiling for a little bit. Not a titling WM per se, but rather I accidentally enabled some of KWin's crazy titling features. I was never a very big fan of titling - my monitors are only 22" and I like having that space for my work. The problem with using virtual desktops was that I had to manage what was where. At one point I had scripts and window rules to automatically put windows in the right places. But it just kept getting more and more complex and (I felt) starting taking me away from my goal, as my preferred method of switching windows was with the 'Present Windows' effect.

      Bottom line: Yes, your suggestion would work, but I felt this plasmoid was a little more 'complete' for my needs. And I HOPE it will be useful for more people as it takes a little less work.
      Plus I think this would allow me to integrate with plasma activities better (eventually).

      Delete
  14. I like the concept. I suggest you to set a global shortcut to minimize any window (through the system settings, global shortcuts for the Kwin component). I use a global shortcut to open Kopete chat and them minimize the chat window with the other shortcut, so I can easily switch back to my work

    ReplyDelete
    Replies
    1. I tried this a while ago. But it had the problem that if chat windows were already open in another virtual desktop, it would switch there instead of opening up. And I usually don't remember what desktop I was in when I finish replying, so I end up having to cycle through them which was a pain.

      Delete
  15. Yes! Ever since experiencing this in Gnome Shell, then hearing about the kde-telepathy project, I always dreamed/hoped for something similar. While this doesn't completely bring about the fluid, cohesive approach enjoyed in Gnome Shell's empathy integration, I think that this is a major step forward into making chats just an event and not necessarily a separate activity. When this gets refined and such hopefully I won't have to ignore the urgent chats just because I'm in the middle of typing and don't want to move away from my current work.

    ReplyDelete
  16. I will go easy :D. +1. Loving the concept. Keep it lean. Thumbs up.

    ReplyDelete
  17. This is AWESOME! I'm a huge user of virtual desktops AND activities and I STILL find this would be really useful to get a quick message out and get back to work rather than going to my chat virtual desktop in my main activity.

    ReplyDelete
  18. This is really kool idea this feature already implemented in Gnome-Shell and I really like to see it in KDE asap good luck and thumbs up! :)

    ReplyDelete
  19. This is it, hopefully all those things you need get ready and we can get such a plasmoid... I don't think it would take long for it to become a must for most people using KDE.

    ReplyDelete
  20. because some of the articles on this blog, I can get insight about how my job. Thanks writer.
    obat herbal alergi gatal
    obat tradisional pembesaran prostat
    cara menghilangkan gatal kemaluan

    ReplyDelete
  21. This blog is so stunningly outstanding. Left its readers in the awe.
    Phone Number for Base Chat in Germany

    ReplyDelete
  22. You can play every kind of card and table game variations and stay casino games change often on the site. Players will not be disenchanted on the range of games and different features on the casino. Justspin Casino is all about ongoing deposit bonuses and free spins to get you 솔카지노 started.

    ReplyDelete