mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 14:43:09 +00:00
simple kwin script for a fullscreen switcher
This commit is contained in:
parent
add3efbe9a
commit
bdb4821376
4 changed files with 140 additions and 0 deletions
|
|
@ -47,6 +47,9 @@ install(DIRECTORY compositor/
|
|||
kpackage_install_package(phonebook org.kde.phone.phonebook genericqml)
|
||||
install(FILES phonebook/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.phonebook.desktop)
|
||||
|
||||
install( DIRECTORY kwinmultitasking/ DESTINATION ${DATA_INSTALL_DIR}/kwin/scripts/org.kde.phone.multitasking )
|
||||
install( FILES kwinmultitasking/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME kwin-script-org.kde.phone.multitasking.desktop )
|
||||
|
||||
add_subdirectory(bin)
|
||||
#add_subdirectory(services)
|
||||
add_subdirectory(settingsmodules)
|
||||
|
|
|
|||
39
kwinmultitasking/contents/ui/main.qml
Normal file
39
kwinmultitasking/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/********************************************************************
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2015 Marco MArtin <mart@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
Loader {
|
||||
id: mainItemLoader
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: workspace
|
||||
onCurrentDesktopChanged: {
|
||||
if (!mainItemLoader.item) {
|
||||
mainItemLoader.source = "switcher.qml";
|
||||
}
|
||||
mainItemLoader.item.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
79
kwinmultitasking/contents/ui/switcher.qml
Normal file
79
kwinmultitasking/contents/ui/switcher.qml
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012, 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
import QtQuick 2.0;
|
||||
import QtQuick.Window 2.0;
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore;
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents;
|
||||
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons;
|
||||
import org.kde.kwin 2.0 as KWin;
|
||||
|
||||
PlasmaCore.Dialog {
|
||||
id: dialog
|
||||
location: PlasmaCore.Types.Floating
|
||||
visible: false
|
||||
flags: Qt.X11BypassWindowManagerHint
|
||||
backgroundHints: PlasmaCore.Dialog.NoBackground
|
||||
|
||||
mainItem: Item {
|
||||
width: workspace.virtualScreenSize.width
|
||||
height: workspace.virtualScreenSize.height
|
||||
|
||||
PlasmaComponents.Button {
|
||||
z: 99
|
||||
text: "close"
|
||||
onClicked: dialog.visible = false;
|
||||
}
|
||||
GridView {
|
||||
id: view
|
||||
anchors.fill: parent
|
||||
cellWidth: units.gridUnit * 20
|
||||
cellHeight: units.gridUnit * 20 // (view.width / view.height)
|
||||
model: KWin.ClientModel {
|
||||
id: clientModel
|
||||
exclusions: KWin.ClientModel.NotAcceptingFocusExclusion
|
||||
}
|
||||
delegate: MouseArea {
|
||||
width: view.cellWidth
|
||||
height: view.cellHeight
|
||||
PlasmaComponents.ToolButton {
|
||||
anchors.right: parent.right
|
||||
iconSource: "window-close"
|
||||
flat: false
|
||||
onClicked: model.client.closeWindow()
|
||||
visible: model.client.closeable
|
||||
}
|
||||
KWin.ThumbnailItem {
|
||||
anchors.fill: parent
|
||||
//parentWindow: dialog.windowId
|
||||
client: model.client
|
||||
brightness: (index == view.currentIndex) ? 1.0 : 0.4
|
||||
}
|
||||
onClicked: {
|
||||
workspace.activeClient = model.client
|
||||
dialog.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
KWin.registerWindow(dialog);
|
||||
}
|
||||
}
|
||||
19
kwinmultitasking/metadata.desktop
Normal file
19
kwinmultitasking/metadata.desktop
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[Desktop Entry]
|
||||
Name=Phone multitask
|
||||
Comment=Multitasking user interface fpr Phone devices
|
||||
|
||||
Icon=preferences-system-windows-script-test
|
||||
|
||||
X-Plasma-API=declarativescript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-KWin-Exclude-Listing=false
|
||||
|
||||
X-KDE-PluginInfo-Author=Marco Martin
|
||||
X-KDE-PluginInfo-Email=mart@kde.org
|
||||
X-KDE-PluginInfo-Name=org.kde.phone.multitasking
|
||||
X-KDE-PluginInfo-Version=1.0
|
||||
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-ServiceTypes=KWin/Script
|
||||
Type=Service
|
||||
Loading…
Reference in a new issue