Risu / Tiled-Quicklaunch

Plasma Menu Widget for KDE
https://store.kde.org/p/1319588/
GNU General Public License v2.0
3 stars 3 forks source link

Close the PopUp #4

Closed servitecbaires closed 3 years ago

servitecbaires commented 3 years ago

Hello, my name is Martin! Your work is great! I wonder if the popup could close by clicking on a blank space or hitting Esc key. This is because I want to set the size to fullscreen, so there is no out-boundaries place to click for closing. Thanks for your work and time.

Operating System: Kubuntu 20.04 KDE Plasma Version: 5.18.5 KDE Frameworks Version: 5.68.0 Qt Version: 5.12.8 Kernel Version: 5.8.0-55-generic

Risu commented 3 years ago

Try this: in /home/USERNAME/.local/share/plasma/plasmoids/risu.tiled.quicklaunch/contents/ui/Popup.qml insert between lines 143/144:

    Keys.onPressed: {
        if (event.key == Qt.Key_Escape) {
            plasmoid.expanded = false
            popup.visible = false
        }
    }

and after line 161 (by counting when file is unedited by previous insert):

    Component.onCompleted: {
        forceActiveFocus()
    }

Restart plasma or system after changes. Please test this changes thoroughly and if this not breaking anything I will commit and update.

servitecbaires commented 3 years ago

Hi! Thanks for your fast reply!

  1. hitting Esc key itś working great ok!
  2. clicking on blank space (tiles locked or unlocked), still doing nothing. I don't know if you changed that. Thanks again! Your widget is the best launcher.
Risu commented 3 years ago

I don't know what you mean by blank space. It's outside widget? Check plasma-applet-tiledmenu by zren first how it behave.

servitecbaires commented 3 years ago

I mean the empty space inside the widget where isn't any tile.

Risu commented 3 years ago

And what supposed it should doing? Right click should work. I would be irritated if left click would close anything in the system.

servitecbaires commented 3 years ago

Sorry! Maybe my English sucks! I wonder if left clicking on an empty space inside the popup could close the popup like Esc key (you implemented successfully with the code lines added above!!). For empty space, I'm trying to mean any place inside the popup where isn't a tile: the background of the popup. What is this for? Just want to resize the popup to fullscreen, so I thinked in a way to close it like others fullscreen launchers do. Thanks again!!!

Risu commented 3 years ago

In TileGrid.qml: Replace in line 443 MouseArea with:

    MouseArea {
        anchors.fill: parent
        acceptedButtons: Qt.LeftButton | Qt.RightButton
        onClicked: {
            if (mouse.button == Qt.RightButton) {
                cellContextMenu.cellX = cellItem.modelX
                cellContextMenu.cellY = cellItem.modelY
                var pos = mapToItem(scrollItem, mouse.x, mouse.y) // cellContextMenu is a child of scrollItem
                cellContextMenu.open(pos.x, pos.y)
            }
            if (mouse.button == Qt.LeftButton) {
                popup.visible = !popup.visible
            }
        }

But I am not gonna commit this into repository. I would not know if app is launched or I have missed the tile.

servitecbaires commented 3 years ago

It works like charm!!! IMHO, it is very difficult to miss a tile, because they are highlighted on hover and the Tile Margin is set 5px by default (and you can change it to 0px if you want!! But, if you want to close the QuickLaunch (e.g. because you regret to open an app), you only have to "click your way out", fast and easy, like the other lauhchers (but this is far best than any other!!!).

I highly recommend to commit this feature that improves the UX, but it's up on you, of course.

Thanks again!

Risu commented 3 years ago

When you receive updated version via auto updates go to "Configure Tiled Quicklaunch..." - > "Import/Export layout" and at the end change "popupDismissOnLeftClick": from false to true.