Bug 26058 - moving systray icons around
Summary: moving systray icons around
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kicker
Classification: Plasma
Component: systemtray (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: Aaron J. Seigo
URL:
Keywords:
: 49753 54455 88446 98436 113621 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-05-23 08:03 UTC by erayo
Modified: 2009-09-07 23:58 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description erayo 2001-05-23 07:48:03 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kicker
Version:           1.1 (using KDE 2.1.2 )
Severity:          wishlist
Installed from:    Debian Package 4:2.1.2-2 (testing/unstable)
Compiler:          gcc version 2.95.4 20010319 (Debian prerelease)
OS:                Linux 2.4.4 i686
OS/Compiler notes: 

would like to be able to move and thus set the positions of system dock elements. as a matter of fact what makes these so different than an applet from a user's point of view? 

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 Stephan Binner 2003-03-15 13:19:26 UTC
*** Bug 49753 has been marked as a duplicate of this bug. ***
Comment 2 Stephan Binner 2003-03-15 13:25:02 UTC
*** Bug 54455 has been marked as a duplicate of this bug. ***
Comment 3 Richard Hartmann 2003-03-15 13:59:38 UTC
so, let's just hope we gain enough momentum so that someone will actually do something about this. We should also vote for this wishlistitem so it gets a higher rating  RichiH 
Comment 4 Peter Williams 2003-04-09 07:42:16 UTC
I'd really like to see one of the desktop click settings be able to bring up a list of the 
docked apps.  I use the docked apps quite a bit, and it would be cool just to find an 
empty spot to click instead of having to mouse all the way to the panel. 
 
Pete W 
Comment 5 Aaron J. Seigo 2004-09-24 18:39:53 UTC
*** Bug 88446 has been marked as a duplicate of this bug. ***
Comment 6 Kevin Goeser 2004-09-24 20:40:17 UTC
From the dupe:
- Somehow store the order of the icons (e.g. using their neighbours), they should always appear in the same order

I really liked to see this, espacially that the icons always have the same neighbours (as as they are there).
Comment 7 monstermunch 2005-02-10 17:47:38 UTC
This system tray patch does this: http://www.kde-apps.org/content/show.php?content=17732

You can give each tray item an integer priority (lower number for left position, higher for right) as well as setting if it is hidden or not. Works quite well and you just need to add an integer field next to the boolean hide field in the config GUI.
Comment 8 Stefan Borggraefe 2006-05-27 18:34:37 UTC
*** Bug 113621 has been marked as a duplicate of this bug. ***
Comment 9 Lubos Lunak 2006-10-13 18:44:20 UTC
*** Bug 98436 has been marked as a duplicate of this bug. ***
Comment 10 Lubos Lunak 2006-10-13 18:49:42 UTC
SVN commit 595237 by lunakl:

Sorting of systray items. Not for 3.5.x for now, but the patch
is at http://ktown.kde.org/~seli/patches/systray_order.diff .
FEATURE: 26058



 M  +37 -17    systemtrayapplet.cpp  
 M  +1 -0      systemtrayapplet.h  


--- trunk/KDE/kdebase/workspace/kicker/applets/systemtray/systemtrayapplet.cpp #595236:595237
@@ -210,13 +210,12 @@
     connect(m_settingsDialog, SIGNAL(finished()), this, SLOT(settingsDialogFinished()));
 
     m_iconSelector = new KActionSelector(m_settingsDialog);
-    m_iconSelector->setAvailableLabel(i18n("Visible icons:"));
-    m_iconSelector->setSelectedLabel(i18n("Hidden icons:"));
-    m_iconSelector->setShowUpDownButtons(false);
+    m_iconSelector->setAvailableLabel(i18n("Hidden icons:"));
+    m_iconSelector->setSelectedLabel(i18n("Visible icons:"));
     m_settingsDialog->setMainWidget(m_iconSelector);
 
-    QListWidget *shownListWidget = m_iconSelector->availableListWidget();
-    QListWidget *hiddenListWidget = m_iconSelector->selectedListWidget();
+    QListWidget *hiddenListWidget = m_iconSelector->availableListWidget();
+    QListWidget *shownListWidget = m_iconSelector->selectedListWidget();
 
     TrayEmbedList::const_iterator it = m_shownWins.begin();
     TrayEmbedList::const_iterator itEnd = m_shownWins.end();
@@ -263,20 +262,16 @@
     conf->setGroup("HiddenTrayIcons");
     QString name;
 
-    // use the following snippet of code someday to implement ordering
-    // of icons
-    //
-    // m_visibleIconList.clear();
-    // QListBoxItem* item = m_iconSelector->availableListBox()->firstItem();
-    // for (; item; item = item->next())
-    // {
-    //    m_visibleIconList.append(item->text());
-    // }
-    // conf->writeEntry("Visible", m_visibleIconList);
-    // selection.clear();
+    m_sortOrderIconList.clear();
+    QList<QListWidgetItem*> list = m_iconSelector->availableListWidget()->findItems(QString("*"), Qt::MatchRegExp);
+    foreach (QListWidgetItem* item, list)
+    {
+        m_sortOrderIconList.append(item->text());
+    }
+    conf->writeEntry("SortOrder", m_sortOrderIconList);
 
     m_hiddenIconList.clear();
-    QList<QListWidgetItem*> list = m_iconSelector->selectedListWidget()->findItems(QString("*"), Qt::MatchRegExp);
+    list = m_iconSelector->availableListWidget()->findItems(QString("*"), Qt::MatchRegExp);
     foreach (QListWidgetItem* item, list)
     {
         m_hiddenIconList.append(item->text());
@@ -525,6 +520,31 @@
             (*emb)->hide();
         }
     }
+    
+    QMap< TrayEmbed*, QString > names; // cache names
+    for( TrayEmbedList::const_iterator it = m_shownWins.begin();
+         it != m_shownWins.end();
+         ++it )
+        names[ *it ] = KWin::windowInfo((*it)->containerWinId(),NET::WMName).name();
+    TrayEmbedList newList;
+    for( QStringList::const_iterator it1 = m_sortOrderIconList.begin();
+         it1 != m_sortOrderIconList.end();
+         ++it1 ) {
+        for( TrayEmbedList::iterator it2 = m_shownWins.begin();
+             it2 != m_shownWins.end();
+             ) {
+            if( names[ *it2 ] == *it1 ) {
+                newList.append( *it2 ); // don't bail out, there may be multiple ones
+                it2 = m_shownWins.erase( it2 );
+            } else
+                ++it2;
+        }
+    }
+    for( TrayEmbedList::const_iterator it = m_shownWins.begin();
+         it != m_shownWins.end();
+         ++it )
+        newList.append( *it ); // append unsorted items
+    m_shownWins = newList;
 }
 
 void SystemTrayApplet::toggleExpanded()
--- trunk/KDE/kdebase/workspace/kicker/applets/systemtray/systemtrayapplet.h #595236:595237
@@ -89,6 +89,7 @@
     TrayEmbedList m_shownWins;
     TrayEmbedList m_hiddenWins;
     QStringList m_hiddenIconList;
+    QStringList m_sortOrderIconList;
     KWinModule *kwin_module;
     Atom net_system_tray_selection;
     Atom net_system_tray_opcode;
Comment 11 Richard Hartmann 2006-10-14 12:04:35 UTC
thanks!
Comment 12 Lubos Lunak 2006-10-17 17:06:52 UTC
SVN commit 596456 by lunakl:

Fix loading of the config for sorting of systray items.
Use window class rather than window name for identifying,
as the first one is more stable (e.g. no i18n).
Patch at http://ktown.kde.org/~seli/patches/systray_order.diff
updated as well.
CCBUG: 26058



 M  +40 -8     systemtrayapplet.cpp  


--- trunk/KDE/kdebase/workspace/kicker/applets/systemtray/systemtrayapplet.cpp #596455:596456
@@ -259,22 +259,46 @@
     }
 
     KConfig *conf = config();
-    conf->setGroup("HiddenTrayIcons");
-    QString name;
 
+    // Save the sort order and hidden status using the window class (WM_CLASS) rather
+    // than window name (caption) - window name is i18n-ed, so it's for example
+    // not possible to create default settings.
+    // For backwards compatibility, name is kept as it is, class is preceded by '/'.
+    QMap< QString, QString > windowNameToClass;
+    for( TrayEmbedList::ConstIterator it = m_shownWins.begin();
+         it != m_shownWins.end();
+         ++it ) {
+        KWin::WindowInfo info = KWin::windowInfo( (*it)->containerWinId(), NET::WMName, NET::WM2WindowClass);
+        windowNameToClass[ info.name() ] = '/' + info.windowClassClass();
+    }
+    for( TrayEmbedList::ConstIterator it = m_hiddenWins.begin();
+         it != m_hiddenWins.end();
+         ++it ) {
+        KWin::WindowInfo info = KWin::windowInfo( (*it)->containerWinId(), NET::WMName, NET::WM2WindowClass);
+        windowNameToClass[ info.name() ] = '/' + info.windowClassClass();
+    }
+
+    conf->setGroup("SortedTrayIcons");
     m_sortOrderIconList.clear();
     QList<QListWidgetItem*> list = m_iconSelector->availableListWidget()->findItems(QString("*"), Qt::MatchRegExp);
     foreach (QListWidgetItem* item, list)
     {
-        m_sortOrderIconList.append(item->text());
+        if( windowNameToClass.contains(item->text()))
+            m_sortOrderIconList.append(windowNameToClass[item->text()]);
+        else
+            m_sortOrderIconList.append(item->text());
     }
     conf->writeEntry("SortOrder", m_sortOrderIconList);
 
+    conf->setGroup("HiddenTrayIcons");
     m_hiddenIconList.clear();
     list = m_iconSelector->availableListWidget()->findItems(QString("*"), Qt::MatchRegExp);
     foreach (QListWidgetItem* item, list)
     {
-        m_hiddenIconList.append(item->text());
+        if( windowNameToClass.contains(item->text()))
+            m_hiddenIconList.append(windowNameToClass[item->text()]);
+        else
+            m_hiddenIconList.append(item->text());
     }
     conf->writeEntry("Hidden", m_hiddenIconList);
     conf->sync();
@@ -411,6 +435,8 @@
 
     conf->setGroup("HiddenTrayIcons");
     m_hiddenIconList = conf->readEntry("Hidden", QStringList() );
+    conf->setGroup("SortedTrayIcons");
+    m_sortOrderIconList = conf->readListEntry("SortOrder", QStringList());
 }
 
 void SystemTrayApplet::systemTrayWindowAdded( WId w )
@@ -499,6 +525,8 @@
 bool SystemTrayApplet::shouldHide(WId w)
 {
     return m_hiddenIconList.contains(KWin::windowInfo(w,NET::WMName).name());
+    return m_hiddenIconList.contains(KWin::windowInfo(w,NET::WMName).name())
+        || m_hiddenIconList.contains('/'+KWin::windowInfo(w,0,NET::WM2WindowClass).windowClassClass());
 }
 
 void SystemTrayApplet::updateVisibleWins()
@@ -521,11 +549,15 @@
         }
     }
     
-    QMap< TrayEmbed*, QString > names; // cache names
+    QMap< TrayEmbed*, QString > names; // cache names and classes
+    QMap< TrayEmbed*, QString > classes;
     for( TrayEmbedList::const_iterator it = m_shownWins.begin();
          it != m_shownWins.end();
-         ++it )
-        names[ *it ] = KWin::windowInfo((*it)->containerWinId(),NET::WMName).name();
+         ++it ) {
+        KWin::WindowInfo info = KWin::windowInfo((*it)->containerWinId(),NET::WMName,NET::WM2WindowClass);
+        names[ *it ] = info.name();
+        classes[ *it ] = '/'+info.windowClassClass();
+    }
     TrayEmbedList newList;
     for( QStringList::const_iterator it1 = m_sortOrderIconList.begin();
          it1 != m_sortOrderIconList.end();
@@ -533,7 +565,7 @@
         for( TrayEmbedList::iterator it2 = m_shownWins.begin();
              it2 != m_shownWins.end();
              ) {
-            if( names[ *it2 ] == *it1 ) {
+            if( (*it1).startsWith("/") ? classes[ *it2 ] == *it1 : names[ *it2 ] == *it1 ) {
                 newList.append( *it2 ); // don't bail out, there may be multiple ones
                 it2 = m_shownWins.erase( it2 );
             } else
Comment 13 Richard Hartmann 2007-07-15 17:36:18 UTC
Did this make its way into KDE, in the meantime? I just checked 3.5.7 and found no way to change the order of the items.
Comment 14 Maciej Pilichowski 2008-02-14 20:30:27 UTC
Could someone please reopen this report, because it is not fixed for sure -- KDE 3.5.8.
Comment 15 Richard Hartmann 2008-02-14 22:09:12 UTC
Reopen as per Maciej's request. The issue is not solved in current 3.5. From what I hear, 3.5.9 is highly likely to see the light of day, so this could still be done.

If people think it unlikely that this will work soonish, feel free to re-close.


That all being said, I do have KDE4 handy right now, so I can not check if it applies to KDE4, as well.
Comment 16 Richard Hartmann 2008-02-14 22:10:07 UTC
I assumed verifying this would re-open, as well. Sorry for the extra noise.
Comment 17 FiNeX 2009-09-07 23:58:49 UTC
Kicker is no more mantained and all bugs/wishes will not be fixed/implemented in KDE3. A list of the most interesting/unresolved issues which is still valid for KDE4 has been created. Before reopening old kicker bugs on KDE4 Plasma, please try the new KDE 4.3.1, check the current behaviour and, only if you find new bugs or if you need a particular feature, open a new bug report.

Remember that KDE 4 is a full rewrite of KDE 3 so some old features will not be re-implemented because the behaviour has be changed a lot on some sides.

Thanks for the comprehension and enjoy the new KDE 4!

-- 
FiNeX & D. Andres