Bug 73591 - launching kmail in tray
Summary: launching kmail in tray
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.6.50
Platform: unspecified Linux
: NOR wishlist with 381 votes (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 82086 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-27 11:34 UTC by cerebro84
Modified: 2009-05-19 04:08 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
--keep-mainwindow and session management (6.55 KB, patch)
2007-09-30 14:09 UTC, Luke-Jr
Details
Store main window visibility in session config (1.59 KB, patch)
2007-10-01 09:25 UTC, Luke-Jr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cerebro84 2004-01-27 11:34:55 UTC
Version:           1.6.50 (using KDE 3.2.90 (CVS >= 20040117), compiled sources)
Compiler:          gcc version 3.3.1 (Mandrake Linux 9.2 3.3.1-4mdk)
OS:          Linux (i686) release 2.6.2-rc1

I have a permanent internet connection, so I'd want to launch kmail everytime I log into KDE. But there's no option to launch kmail in system tray, but just in a window, so I need to hide it everytime by clicking the system tray icon. I'd want, so, a command line option to directly hide the window into the tray, like kmail --tray, or an option to run kmail hidden everytime i run it.
Comment 1 Malte S. Stretz 2004-06-08 11:46:56 UTC
*** Bug 82086 has been marked as a duplicate of this bug. ***
Comment 2 Ron 2004-08-06 04:39:07 UTC
Expanding on this; I have kmail running and in the tray and when i logout and log back in it starts and goes full screen and is also in the tray.  If it is in the tray when you logout when you log back in it shouldn't pop up full screen.
Comment 3 Florian 2004-09-03 12:21:04 UTC
And a little "got Mail from ..." sign when Mail arrives.
Comment 4 David Faure 2004-09-03 12:23:45 UTC
> And a little "got Mail from ..." sign when Mail arrives.
If that's a request, it's already available in kmail-1.7 (kdepim-3.3), when using "detailed new mail notification"
and "passive popup" in the "Other Actions" dialog.

Comment 5 cerebro84 2004-09-03 13:04:07 UTC
It tells just where the new mails are put into (e.g. inbox, trash ecc) not who are they from

Comment 6 David Faure 2004-09-03 13:16:13 UTC
> It tells just where the new mails are put into (e.g. inbox, trash ecc) not who are they from
That would be too much info for a small popup. I often get 20 mails at a time, think of
the size of the popup needed to give out 20 From fields.
Solution: create more subfolders with filters depending on who sent the mail :)

Comment 7 Haris Kouzinopoulos 2004-09-21 13:53:34 UTC
what is the status of this wish? I really like a feature like this (to start minimised to tray like kopete does). It is very annoying to have to minimise kmail by hand every time kde starts
Comment 8 cerebro84 2004-09-22 18:55:48 UTC
*** This bug has been confirmed by popular vote. ***
Comment 9 Daniel H. Peger 2004-11-04 11:42:53 UTC
I also tried to start kmail with

kstart --iconify --windowclass kmail /path/to/kmail

but nothing changed and kmail still comes up at full size. The option "--tosystray" also made no difference.
Comment 10 David Faure 2004-11-04 12:14:49 UTC
kontact --iconify works though (I implemented it in CVS HEAD)
 
Comment 11 cerebro84 2004-11-04 12:51:05 UTC
Why not using the same code for kmail as well?

Comment 12 David Faure 2004-11-04 13:54:41 UTC
> Why not using the same code for kmail as well?
Because kstart should work :)

This fixes it.

Index: kmkernel.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmkernel.cpp,v
retrieving revision 1.298.2.18
diff -u -p -r1.298.2.18 kmkernel.cpp
--- kmkernel.cpp        29 Oct 2004 12:02:34 -0000      1.298.2.18
+++ kmkernel.cpp        4 Nov 2004 12:54:03 -0000
@@ -316,14 +316,16 @@ void KMKernel::openReader( bool onlyChec
   if (ktmw) {
     mWin = (KMMainWin *) ktmw;
     activate = !onlyCheck; // existing window: only activate if not --check
+    if ( activate )
+       mWin->show();
   }
   else {
     mWin = new KMMainWin;
-    activate = true; // new window: always activate
+    mWin->show();
+    activate = false; // new window: no explicit activation (#73591)
   }

   if ( activate ) {
-    mWin->show();
     // Activate window - doing this instead of KWin::activateWindow(mWin->winId());
     // so that it also works when called from KMailApplication::newInstance()
 #if defined Q_WS_X11 && ! defined K_WS_QTONLY

Comment 13 David Faure 2004-11-04 14:00:33 UTC
CVS commit by faure: 

Fix for "kstart --iconify --windowclass kmail kmail" as discussed with Seli.

The cases for which this code was added still work (typing kmail while kmail
is running activates it; kmail --check doesn't).
CCBUG: 73591


  M +4 -2      kmkernel.cpp   1.298.2.19


--- kdepim/kmail/kmkernel.cpp  #1.298.2.18:1.298.2.19
@@ -317,12 +317,14 @@ void KMKernel::openReader( bool onlyChec
     mWin = (KMMainWin *) ktmw;
     activate = !onlyCheck; // existing window: only activate if not --check
+    if ( activate )
+       mWin->show();
   }
   else {
     mWin = new KMMainWin;
-    activate = true; // new window: always activate
+    mWin->show();
+    activate = false; // new window: no explicit activation (#73591)
   }
 
   if ( activate ) {
-    mWin->show();
     // Activate window - doing this instead of KWin::activateWindow(mWin->winId());
     // so that it also works when called from KMailApplication::newInstance()


Comment 14 Christoph 2005-02-19 19:29:07 UTC
When starting kmail with "kstart --iconifiy" it shows up in the taskbar.This little snippet only shows the window if the systray is disabled. And makes kmail be only in the systray and nowhere else when started and systray is enabled. (At least for me)
Should be an option. I can make it one if wanted after 3.4

--- kmkernel.cpp        5 Feb 2005 19:17:00 -0000       1.323
+++ kmkernel.cpp        19 Feb 2005 18:20:53 -0000
@@ -323,7 +323,8 @@ void KMKernel::openReader( bool onlyChec
   }
   else {
     mWin = new KMMainWin;
-    mWin->show();
+    if(! GlobalSettings::systemTrayEnabled())
+      mWin->show();
     activate = false; // new window: no explicit activation (#73591)
   }


Cheers Christoph <chris@inferno.nadir.org>
Comment 15 Dylan 2005-02-19 19:50:05 UTC
Have just tried the "kstart --iconify" and find that the icon appears in the systray and on the panel - this leads to the "double clicking" issue reported elsewhere 
Comment 16 Christoph 2005-06-05 00:22:38 UTC
have just tried the "kstart --iconify" and find that kontact exits when clicking the systray icon:

00:12:36 chris@void:~> kontact: Unknown option '-iconify'.
kontact: Use --help to get a list of available command line options.
libkcal: CalendarResources::close
.
.
.


this is the output when clicking on the systray. It started alright using --iconify
Comment 17 Thomas Mader 2006-01-20 02:31:00 UTC
Would also like to see this option implemented in kmail.
Akregator for example has the --hide-mainwindow option for this behavior.
Comment 18 Daniel 2006-06-28 10:11:28 UTC
Will this be implemented? Maybe in KDE4?
Comment 19 DjDarkman 2007-07-22 13:40:32 UTC
I vote for this too, It would be usefull for kmail to behave like kopete when it`s started. But this request looks very old...
Comment 20 Gregory David Bowden 2007-09-20 15:02:05 UTC
I can also confirm this behaviour, the *only* application that shows up when I restore my previous session is KMail. 
Every other program minimizes to the system tray.
Comment 21 Luke-Jr 2007-09-30 04:01:44 UTC
I wrote a patch that adds --hide-mainwindow to KMail and saves/restores the window's visibility with session data. Gregory Bowden sponsored my effort and one of us will post the patch sometime soon.
Comment 22 Luke-Jr 2007-09-30 14:09:48 UTC
Created attachment 21716 [details]
--keep-mainwindow and session management

☺
Comment 23 Gregory David Bowden 2007-09-30 17:26:03 UTC
After a lot of test of the above patch, I can confirm that KMail now supports loading to the system tray without being maxamized on start and when returning from a previously saved session.

I have tested the patch with the latest SVN code from today 30/09/2007 here is the information from svn info . :

svn info .
Path: .
URL: svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/kdepim
Repository Root: svn://anonsvn.kde.org/home/kde
Repository UUID: 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Revision: 719052
Node Kind: directory
Schedule: normal
Last Changed Author: vanrijn
Last Changed Rev: 717734
Last Changed Date: 2007-09-27 14:07:27 +0200 (Thu, 27 Sep 2007)

Regards,

Greg
Comment 24 Allen Winter 2007-10-01 03:07:38 UTC
I can commit this patch to trunk for the upcoming KDE 4.0 release but it has a new feature (command line option) and a new translatable string that make it not possible for the 3.5 series.

Comment 25 Luke-Jr 2007-10-01 08:13:57 UTC
So I need to split out the session part for 3.5?
Comment 26 Luke-Jr 2007-10-01 09:25:40 UTC
Created attachment 21724 [details]
Store main window visibility in session config

This patch ONLY saves the main window visibility state in the session config,
for inclusion in 3.5.x
Comment 27 Igor Poboiko 2009-03-09 19:31:12 UTC
This feature is not yet implemented.. I use KDE 4.2.1
Comment 28 Gregory David Bowden 2009-04-02 14:01:11 UTC
Hi, any news if thsi patch will be added to an upcoming KMail release?
Comment 29 Tim Harris 2009-04-02 14:50:13 UTC
I have a workaround that is acceptable for me. I'm running KDE 4.2
(obviously all instances of kontact here can be replaced by kmail)

I exclude kontact from sessions and I add a script to Autostart to start kontact every time I log in. The shell script contains the following:

kstart --iconify --skiptaskbar kontact

This works to send kontact to the system tray without showing it at all, and it also does not add an entry to the task bar. The only annoying things are that the first time I click on the mail icon after a new login I have to click the mail icon twice, and also that on random occasions (very rarely) kontact will still open full screen.

I probably should be using the -windowclass option but ... once I got it to work I didn't bother playing with more options.

I know people have suggested this kind of solution in previous posts but I just thought I'd add a confirmation of at least 1 user running KDE 4.2 that has a solution.
Comment 30 Luca 2009-05-16 12:52:10 UTC
With 4.2.3 release, this bug seems finally solved.
Comment 31 Allen Winter 2009-05-19 04:08:37 UTC
good. closing then.
thanks for the letting us know.