Open Clementine-Issue-Importer opened 10 years ago
From saarinen...@gmail.com on May 12, 2013 01:52:23
Problem lies in ui/mainwindow.cpp/MainWindow::ToggleShowHide changing activateWindow() calls to QApplication::setActiveWindow( this ); partially solves the problem but I have to press the tray icon ~4 times before it is restored when doing like the flow above. (Also, settings_.value("hidden").toBool() seems to be false upon startup, so after start I have to press the tray twice to hide it)
The code here seems to have much compability workarounds so I have no idea if this patch works for any other system.
Note that both ToggleShowHide and SetHiddenInTray calls hide() and show().
Attachment: patch.c
From davidsansome on May 12, 2013 18:25:39
Labels: PatchAttached
From thiagope...@gmail.com on August 15, 2013 21:37:34
I can confirm this bug. Fluxbox 1.3.5 with Clementine 1.1.1 on Arch Linux.
How is it possible that this issue still exists 7 years later? XFCE on Ubuntu 20.04. Clementine 1.4.0-rc1 from the snap store.
How is it possible that this issue still exists 7 years later? XFCE on Ubuntu 20.04. Clementine 1.4.0-rc1 from the snap store.
Ping. Let's make that 10 years. XFCE 4.16 Ubuntu 22.04 LTS (Xubuntu) 64-bit
There is no real way to Hide/Show the app from the tray icon, I have to go through the System Volume tray icon to get it to show the main app window.
Looking back at this, I realized I have a similar but different problem. This might also help with Item 5 above from the original poster. (https://github.com/clementine-player/Clementine/issues/3665#issue-24227198) I know it is not a full solution for the OP, but it helps to bring the application back on screen.
I am a developer and may end up modifying the code and fixing this locally. If I figure it out, I'll post back. I was unable to access the attached patch.
Changing this setting solved the problem for me (settings of the Status Notifier Item):
Tested on: XFCE 4.16 Ubuntu 22.04 LTS (Xubuntu) 64-bit
Developer Notes:
How to get it compiling and installing on Ubuntu 22.04 (Xubuntu)
$> git clone https://github.com/clementine-player/Clementine.git && cd Clementine
$> cd bin
$> cmake ..
After running cmake I ran into a few errors for missing libraries, a summary and fix is below:
Error: Could NOT find Protobuf..
Error: Could not find a package configuration file provided by "Qt5X11Extras"..
CMake Error at 3rdparty/qsqlite/CMakeLists.txt:34 (message): Could not find sqlite3
Error's related to Required Libraries:
-- No package 'libcdio' found
-- No package 'libchromaprint' found
-- No package 'gstreamer-1.0' found
-- No package 'gstreamer-app-1.0' found
-- No package 'libgpod-1.0' found
-- No package 'libmtp' found
-- No package 'libmygpo-qt5' found
-- No package 'taglib' found
-- No package 'glew' found
Errors related to Required Support Libraries:
Box support (missing Google sparsehash)
Dropbox support (missing Google sparsehash)
Google Drive support (missing Google sparsehash)
Last.fm support (missing liblastfm)
Seafile support (missing Google sparsehash)
Skydrive support (missing Google sparsehash)
Fix for all of the above, is as follows:
sudo apt-get install libprotobuf-dev protobuf-compiler libqt5x11extras5-dev qttools5-dev libcdio-dev libchromaprint-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgpod-dev libmtp-dev libmygpo-qt-dev libtag1-dev libglew-dev libsqlite3-dev libsparsehash-dev liblastfm5-dev
NOTE: The last two items I don't have the libraries/config for, nor do I own an OSx product to test it on, but I could get my hands on one.
The following components WILL NOT be built:
Crash reporting (disabled in CMake config)
Sparkle integration (missing macOS, Sparkle)
$> make -j8 $> sudo make install
After I had it running I went searching for a fix. I changed the following files. I will reference what I changed with "File:", Before:", and "After:" below. If you want I can push a PR for it. Assuming it somewhat follows existing UI standards. Then, if someone can test it on other platforms or maybe someone will use this information to reply to my comment after they tested it on other platforms. Here are the simple changes I made:
File: Clementine/src/ui/qtsystemtrayicon.cpp
Before:
[104] void QtSystemTrayIcon::SetupMenu(QAction* previous, QAction* play,
[105] QAction* stop, QAction* stop_after,
[106] QAction* next, QAction* mute, QAction* love,
[107] QAction* quit) {
After:
[104] void QtSystemTrayIcon::SetupMenu(QAction* previous, QAction* play,
[105] QAction* stop, QAction* stop_after,
[106] QAction* next, QAction* mute, QAction* show_hide,
[107] QAction* love, QAction* quit) {
File: Clementine/src/ui/qtsystemtrayicon.cpp
Before:
[125] action_mute_->setChecked(mute->isChecked());
[126]
[127] menu_->addSeparator();
After:
[125] action_mute_->setChecked(mute->isChecked());
[126] action_show_hide_ =
[127] menu_->addAction(show_hide->icon(), show_hide->text(), show_hide, SLOT(trigger()));
[128]
[129] menu_->addSeparator();
File: Clementine/src/ui/macsystemtrayicon.h
Before:
[34] void SetupMenu(QAction* previous, QAction* play, QAction* stop,
QAction* stop_after, QAction* next, QAction* mute,
QAction* love, QAction* quit);
After:
[34] void SetupMenu(QAction* previous, QAction* play, QAction* stop,
QAction* stop_after, QAction* next, QAction* mute,
QAction* show_hide, QAction* love, QAction* quit);
File: Clementine/src/ui/macsystemtrayicon.mm
Before:
[165] void MacSystemTrayIcon::SetupMenu(QAction* previous, QAction* play, QAction* stop,
[166] QAction* stop_after, QAction* next, QAction* mute, QAction* love,
[167] QAction* quit) {
After:
[165] void MacSystemTrayIcon::SetupMenu(QAction* previous, QAction* play, QAction* stop,
[166] QAction* stop_after, QAction* next, QAction* mute,
[167] QAction* show_hide, QAction* love, QAction* quit) {
File: Clementine/src/ui/macsystemtrayicon.mm
Before:
[175] SetupMenuItem(mute);
[176] p_->AddSeparator();
After:
[175] SetupMenuItem(mute);
[176] SetupMenuItem(show_hide);
[177] p_->AddSeparator();
File: Clementine/src/ui/mainwindow.cpp
Before:
[825] tray_icon_->SetupMenu(ui_->action_previous_track, ui_->action_play_pause,
[826] ui_->action_stop, ui_->action_stop_after_this_track,
[827] ui_->action_next_track, ui_->action_mute,
[828] ui_->action_love, ui_->action_quit);
After:
[825] tray_icon_->SetupMenu(ui_->action_previous_track, ui_->action_play_pause,
[826] ui_->action_stop, ui_->action_stop_after_this_track,
[827] ui_->action_next_track, ui_->action_mute,
[828] ui_->action_show_hide, ui_->action_love, ui_->action_quit);
File: Clementine/src/ui/systemtrayicon.h
Before:
[34] virtual void SetupMenu(QAction* previous, QAction* play, QAction* stop,
[35] QAction* stop_after, QAction* next, QAction* mute,
[36] QAction* love, QAction* quit) = 0;
After:
[34] virtual void SetupMenu(QAction* previous, QAction* play, QAction* stop,
[35] QAction* stop_after, QAction* next, QAction* mute,
[36] QAction* show_hide, QAction* love, QAction* quit) = 0;
File: Clementine/src/ui/qtsystemtrayicon.cpp
Before:
[38] action_mute_(nullptr),
[39] action_love_(nullptr) {
After:
[38] action_mute_(nullptr),
[39] action_show_hide_(nullptr),
[40] action_love_(nullptr) {
File: Clementine/src/ui/mainwindow.cpp
Before:
[432] connect(ui_->action_mute, SIGNAL(triggered()), app_->player(), SLOT(Mute()));
[433]
[434] #ifdef HAVE_LIBLASTFM
After:
[432] connect(ui_->action_mute, SIGNAL(triggered()), app_->player(), SLOT(Mute()));
[433] connect(ui_->action_show_hide, SIGNAL(triggered()), SLOT(ToggleShowHide()));
[434]
[435] #ifdef HAVE_LIBLASTFM
File: Clementine/src/ui/mainwindow.ui
Before:
[567] <addaction name="action_toggle_show_sidebar"/>
[568] </widget>
After:
[567] <addaction name="action_toggle_show_sidebar"/>
[568] <addaction name="action_show_hide"/>
[569] </widget>
File: Clementine/src/ui/mainwindow.ui
Before:
[879] <string notr="true">Ctrl+M</string>
[880] </property>
[881] </action>
[882] <action name="action_full_library_scan">
[883] <property name="text">
[884] <string>Do a full library rescan</string>
After:
[879] <string notr="true">Ctrl+M</string>
[880] </property>
[881] </action>
[882] <action name="action_show_hide">
[883] <property name="checkable">
[884] <bool>false</bool>
[885] </property>
[886] <property name="text">
[887] <string>Show/Hide Clementine</string>
[888] </property>
[889] </action>
[890] <action name="action_full_library_scan">
[891] <property name="text">
[892] <string>Do a full library rescan</string>
Changing this setting solved the problem for me (settings of the Status Notifier Item):
Unfortunately, I tried this route using the "Status Notifier Items" plugin on my system and it does not work for me.
Also using the "Status Notifier Items" plugin, Clementine doesn't show up as an item in the list for me to even hide. Weird. (another issue for another time)
I also don't have this "Menu is primary action" option you've shown in the above screenshot in the latest version of Ubuntu with the "Indicator" plugin, but I will need to install FluxBox to reproduce the original issue with the app disappearing.
I embedded the option into my Clementine Tray Icon instead. For now, this works for me in Ubuntu 22.04 LTS (Xubuntu) 64-bit
I just spent extensive time in version 1.3.5 of Fluxbox on Ubuntu 22.04 and I'm unable to reproduce this there. Maybe it's still happening in Arch, I'm not sure as I don't run Arch.
Although, I'm still having this same issue in Ubuntu 22.04 using Xfce4. The solution above fixes my issue, but it's going to be up to the Clementine developers to implement window hiding or not in Ubuntu. Hope this helps. If anyone needs a PR, please let me know. ~I'll commit this locally until then.~ I went ahead and pushed a WIP PR.
Potentially related to #2099
XFCE 4.16 on Ubuntu 22.04: right click on the empty space on the app menu where app windows are showing (separator) , there is an option on the bottom of the menu - select Panel > Panel Preferences - and you should see main Panel 0 preferences.
From the tab select Items and you should see Status Tray Plugin there.
Then select settings icon on the bottom of the list area.
... and you should get the menu as the one on the right.
Notice that Menu is primary action
is at the bottom of the window.
From saarinen...@gmail.com on May 10, 2013 11:26:59
What steps will reproduce the problem? 1. Use fluxbox
Original issue: http://code.google.com/p/clementine-player/issues/detail?id=3665