It's mostly useful to be able to hide the virtual keyboard like we do in Plasma Mobile from the bottom panel, should probably replace the SNI from KWin.wilder-5.24
parent
a3734c74f8
commit
fb47508554
6 changed files with 120 additions and 1 deletions
@ -0,0 +1,2 @@ |
||||
#! /usr/bin/env bash |
||||
$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.manageinputmethod.pot |
||||
@ -0,0 +1,95 @@ |
||||
/* |
||||
* SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0-or-later |
||||
*/ |
||||
|
||||
import QtQuick 2.1 |
||||
import QtQuick.Layouts 1.1 |
||||
|
||||
import org.kde.plasma.plasmoid 2.0 |
||||
import org.kde.plasma.core 2.0 as PlasmaCore |
||||
import org.kde.plasma.components 3.0 as PlasmaComponents3 |
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras |
||||
import org.kde.plasma.workspace.keyboardlayout 1.0 as Keyboards |
||||
import org.kde.kquickcontrolsaddons 2.0 |
||||
|
||||
Item { |
||||
id: root |
||||
property var overlays: [] |
||||
|
||||
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation |
||||
Plasmoid.fullRepresentation: Plasmoid.compactRepresentation |
||||
Plasmoid.compactRepresentation: PlasmaCore.IconItem { |
||||
source: plasmoid.icon |
||||
active: compactMouse.containsMouse |
||||
overlays: root.overlays |
||||
|
||||
MouseArea { |
||||
id: compactMouse |
||||
anchors.fill: parent |
||||
hoverEnabled: true |
||||
onClicked: if (!Keyboards.KWinVirtualKeyboard.available) { |
||||
root.action_settings() |
||||
} else if (Keyboards.KWinVirtualKeyboard.visible) { |
||||
Keyboards.KWinVirtualKeyboard.active = false |
||||
} else { |
||||
Keyboards.KWinVirtualKeyboard.enabled = !Keyboards.KWinVirtualKeyboard.enabled |
||||
} |
||||
} |
||||
} |
||||
|
||||
Component.onCompleted: { |
||||
plasmoid.setAction("settings", i18nc("Opens the system settings module", "Configure Virtual Keyboards..."), |
||||
"settings-configure") |
||||
} |
||||
|
||||
function action_settings() { |
||||
KCMShell.openSystemSettings("kcm_virtualkeyboard"); |
||||
} |
||||
|
||||
states: [ |
||||
State { |
||||
name: "available" |
||||
when: !Keyboards.KWinVirtualKeyboard.available |
||||
PropertyChanges { |
||||
target: plasmoid |
||||
icon: "input-keyboard-virtual-off" |
||||
toolTipSubText: i18n("Virtual Keyboard: unavailable") |
||||
status: PlasmaCore.Types.PassiveStatus |
||||
} |
||||
PropertyChanges { target: root; overlays: [ "emblem-unavailable" ] } |
||||
}, |
||||
State { |
||||
name: "disabled" |
||||
when: Keyboards.KWinVirtualKeyboard.available && !Keyboards.KWinVirtualKeyboard.enabled |
||||
PropertyChanges { |
||||
target: plasmoid |
||||
icon: "input-keyboard-virtual-off" |
||||
toolTipSubText: i18n("Virtual Keyboard: disabled") |
||||
status: PlasmaCore.Types.ActiveStatus |
||||
} |
||||
PropertyChanges { target: root; overlays: [] } |
||||
}, |
||||
State { |
||||
name: "visible" |
||||
when: Keyboards.KWinVirtualKeyboard.available && Keyboards.KWinVirtualKeyboard.visible |
||||
PropertyChanges { target: plasmoid |
||||
icon: "arrow-down" |
||||
toolTipSubText: i18n("Virtual Keyboard: visible") |
||||
status: PlasmaCore.Types.ActiveStatus |
||||
} |
||||
PropertyChanges { target: root; overlays: [] } |
||||
}, |
||||
State { |
||||
name: "idle" |
||||
when: Keyboards.KWinVirtualKeyboard.available && Keyboards.KWinVirtualKeyboard.enabled && !Keyboards.KWinVirtualKeyboard.visible |
||||
PropertyChanges { target: plasmoid |
||||
icon: "input-keyboard-virtual-on" |
||||
toolTipSubText: i18n("Virtual Keyboard: enabled") |
||||
status: PlasmaCore.Types.PassiveStatus |
||||
} |
||||
PropertyChanges { target: root; overlays: [] } |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
[Desktop Entry] |
||||
Name=Input Method |
||||
Comment=Manage your Input Methods |
||||
|
||||
Icon=input-keyboard-virtual |
||||
Type=Service |
||||
X-KDE-ServiceTypes=Plasma/Applet |
||||
|
||||
X-Plasma-API=declarativeappletscript |
||||
X-Plasma-MainScript=ui/manage-inputmethod.qml |
||||
|
||||
X-KDE-PluginInfo-Author=Aleix Pol Gonzalez |
||||
X-KDE-PluginInfo-Email=aleixpol@kde.org |
||||
X-KDE-PluginInfo-Name=org.kde.plasma.manage-inputmethod |
||||
X-KDE-PluginInfo-Version=3.0 |
||||
X-KDE-PluginInfo-Website=https://plasma.kde.org/ |
||||
X-KDE-PluginInfo-Category=Accessibility |
||||
X-KDE-PluginInfo-License=GPL-2.0+ |
||||
X-KDE-PluginInfo-EnabledByDefault=true |
||||
X-KDE-FormFactors=tablet,handset,desktop |
||||
Loading…
Reference in new issue