@ -207,6 +207,33 @@ ShortcutsPart::ShortcutsTracker *GlobalShortcuts::shortcutsTracker() const
return m_shortcutsTracker ;
return m_shortcutsTracker ;
}
}
Latte : : View * GlobalShortcuts : : highestApplicationLauncherView ( const QList < Latte : : View * > & views ) const
{
if ( views . isEmpty ( ) ) {
return nullptr ;
}
Latte : : View * highestPriorityView { nullptr } ;
for ( const auto view : views ) {
if ( view - > interface ( ) - > applicationLauncherHasGlobalShortcut ( ) ) {
highestPriorityView = view ;
break ;
}
}
if ( ! highestPriorityView ) {
for ( const auto view : views ) {
if ( view - > interface ( ) - > containsApplicationLauncher ( ) ) {
highestPriorityView = view ;
break ;
}
}
}
return highestPriorityView ;
}
//! Activate launcher menu through dbus interface
//! Activate launcher menu through dbus interface
void GlobalShortcuts : : activateLauncherMenu ( )
void GlobalShortcuts : : activateLauncherMenu ( )
{
{
@ -221,28 +248,26 @@ void GlobalShortcuts::activateLauncherMenu()
sortedViews = currentLayout - > sortedLatteViews ( ) ;
sortedViews = currentLayout - > sortedLatteViews ( ) ;
}
}
for ( const auto view : sortedViews ) {
Latte : : View * highestPriorityView = highestApplicationLauncherView ( sortedViews ) ;
if ( view - > interface ( ) - > containsApplicationLauncher ( ) ) {
if ( view - > visibility ( ) - > isHidden ( ) & & view - > interface ( ) - > applicationLauncherInPopup ( ) ) {
if ( ! m_hideViews . contains ( view ) ) {
m_hideViews . append ( view ) ;
}
m_lastInvokedAction = m_singleMetaAction ;
if ( highestPriorityView ) {
if ( highestPriorityView - > visibility ( ) - > isHidden ( ) & & highestPriorityView - > interface ( ) - > applicationLauncherInPopup ( ) ) {
if ( ! m_hideViews . contains ( highestPriorityView ) ) {
m_hideViews . append ( highestPriorityView ) ;
}
view - > visibility ( ) - > setBlockHiding ( true ) ;
m_lastInvokedAction = m_singleMetaAction ;
//! delay the execution in order to show first the view
highestPriorityView - > visibility ( ) - > setBlockHiding ( true ) ;
QTimer : : singleShot ( APPLETEXECUTIONDELAY , [ this , view ] ( ) {
view - > toggleAppletExpanded ( view - > interface ( ) - > applicationLauncherId ( ) ) ;
} ) ;
m_hideViewsTimer . start ( ) ;
//! delay the execution in order to show first the view
} else {
QTimer : : singleShot ( APPLETEXECUTIONDELAY , [ this , highestPriorityView ] ( ) {
view- > toggleAppletExpanded ( v iew- > interface ( ) - > applicationLauncherId ( ) ) ;
highestPriorityView- > toggleAppletExpanded ( highestPriorityV iew- > interface ( ) - > applicationLauncherId ( ) ) ;
}
} ) ;
return ;
m_hideViewsTimer . start ( ) ;
} else {
highestPriorityView - > toggleAppletExpanded ( highestPriorityView - > interface ( ) - > applicationLauncherId ( ) ) ;
}
}
}
}
}
}
@ -382,14 +407,8 @@ void GlobalShortcuts::showViews()
}
}
}
}
//! show Meta if it is not already shown for Tasks Latte View
if ( m_corona - > universalSettings ( ) - > kwin_metaForwardedToLatte ( ) ) {
if ( ! viewWithTasks | | ! viewWithTasks - > interface ( ) - > containsApplicationLauncher ( ) ) {
viewWithMeta = highestApplicationLauncherView ( sortedViews ) ;
for ( const auto view : sortedViews ) {
if ( ! viewWithMeta & & m_corona - > universalSettings ( ) - > kwin_metaForwardedToLatte ( ) & & view - > interface ( ) - > containsApplicationLauncher ( ) ) {
viewWithMeta = view ;
break ;
}
}
}
}
bool viewFound { false } ;
bool viewFound { false } ;
@ -399,9 +418,13 @@ void GlobalShortcuts::showViews()
}
}
//! show view that contains tasks plasmoid
//! show view that contains tasks plasmoid
if ( viewWithTasks & & viewWithTasks - > interface ( ) - > showShortcutBadges ( true , true ) ) {
if ( viewWithTasks ) {
viewFound = true ;
viewFound = true ;
bool showMeta = ( viewWithMeta & & ( viewWithMeta = = viewWithTasks ) ) ;
viewWithTasks - > interface ( ) - > showShortcutBadges ( true , showMeta ) ;
if ( ! m_hideViewsTimer . isActive ( ) ) {
if ( ! m_hideViewsTimer . isActive ( ) ) {
m_hideViews . append ( viewWithTasks ) ;
m_hideViews . append ( viewWithTasks ) ;
viewWithTasks - > visibility ( ) - > setBlockHiding ( true ) ;
viewWithTasks - > visibility ( ) - > setBlockHiding ( true ) ;
@ -510,7 +533,7 @@ void GlobalShortcuts::hideViewsTimerSlot()
for ( const auto latteView : m_hideViews ) {
for ( const auto latteView : m_hideViews ) {
latteView - > visibility ( ) - > setBlockHiding ( false ) ;
latteView - > visibility ( ) - > setBlockHiding ( false ) ;
latteView - > interface ( ) - > hideShortcutBadges ( ) ;
latteView - > interface ( ) - > hideShortcutBadges ( ) ;
}
}
}
}
m_hideViews . clear ( ) ;
m_hideViews . clear ( ) ;