Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal not accepting keyboard input in Windows 10 #8045

Closed
bsalmeida opened this issue Oct 26, 2020 · 50 comments
Closed

Terminal not accepting keyboard input in Windows 10 #8045

bsalmeida opened this issue Oct 26, 2020 · 50 comments
Assignees
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.

Comments

@bsalmeida
Copy link

Environment

Windows version: 19041.572
Windows Terminal version: 1.3.2651.0

Steps to reproduce

Launch Terminal
Attempt to type anything

Expected behavior

Characters show up on the screen.

Actual behavior

Nothing happens. It's as if I have no keyboard attached.

Additional info

Using Windows Remote Desktop.
Right-click on mouse pastes text.
No "de-bloating" software installed (neither MSI Afterburner).
"Touch Keyboard and Handwriting Service" is enabled and running.
I've read #4448, and as it suggests, I'm filling out a new issue.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 26, 2020
@zadjii-msft
Copy link
Member

Huh, that's weird, this is the first time I'm hearing of this bug with the Touch Keyboard and Handwriting Service enabled, and also the first time Remote Desktop has been involved.

By any chance can you paste copied text by right-clicking in the Terminal?

I've also got another theory that this is due to the whole scanCode=0 thing, but debugging that is a little more involved, so let's start with the right-clicking

@zadjii-msft zadjii-msft added Area-Input Related to input processing (key presses, mouse, etc.) Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Product-Terminal The new Windows Terminal. labels Oct 27, 2020
@bsalmeida
Copy link
Author

@zadjii-msft Yes. I can paste text by right-clicking as I've mentioned in the Additional Info section.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Oct 27, 2020
@BerhorShadowbuckle
Copy link

BerhorShadowbuckle commented Oct 27, 2020

I have the same issue, I can paste text with a mouse, but I can't type anything with keyboard, also I don't use remote desktop.

Windows Terminal
Version: 1.3.2651.0

@zadjii-msft
Copy link
Member

Ah sorry, I missed that. By any chance, are you using the on-screen keyboard to input text? That's another variable to try and help isolate the problem.

I'm gonna cc @lhecker, who's been working in this area recently, and also @miniksa who I think actually uses Remote Desktop to his work machine to see if he can repro this as well.


@BerhorShadowbuckle For the record, can you confirm you have the "Touch Keyboard and Handwriting Service" enabled?

@lhecker
Copy link
Member

lhecker commented Oct 27, 2020

@zadjii-msft If it's related to the scanCode issues (I bet it is), then it'll probably be fixed with #7900.

@bsalmeida
Copy link
Author

@zadjii-msft I'm not using the virtual keyboard, but it doesn't work anyway.

@miniksa
Copy link
Member

miniksa commented Oct 27, 2020

Ah sorry, I missed that. By any chance, are you using the on-screen keyboard to input text? That's another variable to try and help isolate the problem.

I'm gonna cc @lhecker, who's been working in this area recently, and also @miniksa who I think actually uses Remote Desktop to his work machine to see if he can repro this as well.

@BerhorShadowbuckle For the record, can you confirm you have the "Touch Keyboard and Handwriting Service" enabled?

I do work all day through Remote Desktop and I do not have an input issue. I do have the "Touch Keyboard and Handwriting Service" enabled at all levels of my remote connection.

@zadjii-msft
Copy link
Member

I've just tested this out with my remote desktop connection as well and can't repro this on 1.3.2651.0, so there's gotta be something else we're missing here.

@zadjii-msft zadjii-msft added Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Oct 27, 2020
@Quraian

This comment has been minimized.

@flyshadowhan

This comment has been minimized.

@zadjii-msft
Copy link
Member

zadjii-msft commented Oct 30, 2020

@ anyone who comes to this thread because their keyboard input isn't working: I'm gonna need you to confirm that the "Touch Keyboard and Handwriting Panel" service is running before posting in this thread. You can check that with the command

sc query TabletInputService

Which should get you something like:
image

If it's not running, and you start it, please make sure to reboot your PC before trying the Terminal again. For instructions how to do that, see: #8130 (comment).

ONLY IF the service is running and keyboard input isn't working should you post in this thread, especially with any details of things that might be unique about your setup. If you don't confirm the service is running, I'm just gonna mark your comment as an off topic dupe of the discussion in #4448.

@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Nov 2, 2020
@Onyx-Official

This comment has been minimized.

@lipecss
Copy link

lipecss commented Nov 12, 2020

I have the same issue, I can paste text with a mouse, but I can't type anything with keyboard

image

@zadjii-msft
Copy link
Member

zadjii-msft commented Nov 12, 2020

If you're seeing that the service is running, could you check if ctfmon.exe is also running? Apparently ctfmon.exe is the real important process, which the service is just used to resurrect.

> tasklist /v /fi "imagename eq ctfmon.exe" /fo list

Image Name:   ctfmon.exe
PID:          10828
Session Name: Console
Session#:     1
Mem Usage:    26,536 K
Status:       Running
User Name:    REDMOND\migrie
CPU Time:     0:01:05
Window Title: N/A

image


Dec 2020 update: One user hitting a similar issue (#8142 (comment)) found that they had a bad Group Policy on their machine that would kill ctfmon.exe after a few seconds. So ctfmon.exe would be running, but with an unstable PID.

@joaolucasete
Copy link

joaolucasete commented Nov 17, 2020

I have the same issue. I checked the proposed services and both are running.
image

The problem is solved with that proposed in discussion #4448 . However, other programs are not functioning properly. Example: microsoft whiteboard

@lipecss

This comment has been minimized.

@artshade
Copy link

artshade commented Dec 10, 2021

Looks like the same on Microsoft.WindowsTerminal_1.11.2921.0. No keyboard input works.

@zadjii-msft
Copy link
Member

@F8ER
image

@artshade
Copy link

artshade commented Dec 10, 2021

image

I'm sorry, but... I noticed the warning. The question is what's the main purpose of the service necessity? Is there a requirement to use a handwriting service instead of a general keyboard for a terminal, or is it even possible to use the terminal without a touch screen?

@zadjii-msft
Copy link
Member

I'm OOF right now but see: https://github.com/microsoft/terminal/wiki/Unable-to-type-in-the-Terminal%3F

@artshade
Copy link

artshade commented Dec 10, 2021

...but see...

Thank you. However...

Are you unable to type in the Windows Terminal, but every other application on your system seems to be running fine? Then you might need to manually enable the "Touch, Keyboard, and Handwriting Panel Service" in the OS.
Source: https://github.com/microsoft/terminal/wiki/Unable-to-type-in-the-Terminal%3F

Oh dear... This is something... extraordinary...
A terminal... and... mandatory touch/handwriting...

"I don't like irony and sarcasm very much. But I do like it when you think someone is telling you a joke, and then you discover it's serious" - Jens Lekman

@zadjii-msft
Copy link
Member

You know, that's right, that doc isn't clear enough. I've gone ahead and added

 Are you unable to type in the Windows Terminal, but every other application on your system seems to be running fine? Then you might need to manually enable the "Touch, Keyboard, and Handwriting Panel Service" in the OS. 
+This (admittedly, poorly named) service is in charge of maintaining the modern input stack, which includes _keyboard_ input. 

ctfmon.exe is responsible for touch and handwriting input, yes, but it's also responsible for keyboard input. It's a poorly named service which is probably the root cause of all these issues. I'm sure if they just named it "Modern Input Service", we wouldn't be having these issues 😝

@daiplusplus
Copy link

daiplusplus commented Dec 13, 2021

@zadjii-msft Ever since a particularly nasty bad experience I had with the original CTFMon that came with Office XP (or was it even Office 2000?) I've made it a point to disable that particular Windows Service and, honestly, I've (honestly, literally, and seriously) never had any problems caused by disabling that service until I tried Windows Terminal. And when I did enable the service it made the OSK glitch out.

All other UWP, WinUI, XAML (and MFC, WinForms, WPF, etc) apps work perfectly fine on my machine and handle all input except this Terminal app.

So why does Terminal require it when no other WinUI/UWP app seems to?

@zadjii-msft
Copy link
Member

Honestly, we don't really know. All we know is that XAML Islands (the tech stack that's powering the Terminal) does. Might be something weird about the way that input gets shuttled between a Win32 message loop and a CoreInputSite message pump. It might be something that magically gets fixed by moving off islands to WinUI 3, it might not (that's looking less possible by the day regardless). The expert in the area is @ebadger, he might have some insights, or be able to loop someone else in who can comment more.

@BananaMasterz
Copy link

I'm having the same issue (but in windows 11). I noticed that the Touch Keyboard and Handwriting Panel Service was disabled. I enabled it and set it to automatic, restarted and all good. BUT THEN the next time I restarted the PC the service didn't start and switched back to manual as seen in the screenshot... now every other restart I have to enable the service and restart....

Edition Windows 11 Pro
Version 21H2
Installed on ‎11/‎7/‎2022
OS build 22000.795

image

@rodrigomarquest
Copy link

rodrigomarquest commented Aug 31, 2022

I'm having the same issue (but in windows 11). I noticed that the Touch Keyboard and Handwriting Panel Service was disabled. I enabled it and set it to automatic, restarted and all good. BUT THEN the next time I restarted the PC the service didn't start and switched back to manual as seen in the screenshot... now every other restart I have to enable the service and restart....

Edition Windows 11 Pro Version 21H2 Installed on ‎11/‎7/‎2022 OS build 22000.795

Hello,

Is your workstation standalone or domain joined? do you have any group policy applied (rsop.msc)?
Maybe security tools are disabling some services?

Try putting ctfmon.exe to startup run registry:
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v ctfmon /t REG_SZ /d "C:\Windows\System32\ctfmon.exe" /f

Or copying a ctfmon.exe shortcut to startup folder:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

Checking services in cmd.exe:
sc query tabletinputservice
sc query hidserv

Configuring services for on demand start:
sc config hidserv tabletinputservice= demand
sc config hidserv start= demand

@BananaMasterz
Copy link

I'm having the same issue (but in windows 11). I noticed that the Touch Keyboard and Handwriting Panel Service was disabled. I enabled it and set it to automatic, restarted and all good. BUT THEN the next time I restarted the PC the service didn't start and switched back to manual as seen in the screenshot... now every other restart I have to enable the service and restart....
Edition Windows 11 Pro Version 21H2 Installed on ‎11/‎7/‎2022 OS build 22000.795

Hello,

Is your workstation standalone or domain joined? do you have any group policy applied (rsop.msc)? Maybe security tools are disabling some services?

Try putting ctfmon.exe to startup run registry: REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v ctfmon /t REG_SZ /d "C:\Windows\System32\ctfmon.exe" /f

Or copying a ctfmon.exe shortcut to startup folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

Checking services in cmd.exe: sc query tabletinputservice sc query hidserv

Configuring services for on demand start: sc config hidserv tabletinputservice= demand sc config hidserv start= demand

My workstation is a standalone freshly installed windows too. No antivirus or any security settings other than default windows defender settings.

copying a ctfmon.exe shortcut to startup folder used to work 1 year ago but since I clean installed windows 11 it doesn't work anymore. Even when I manually run ctfmon.exe the issue still exists.

Here's a screenshot of the terminal after running the commands:

image

@rodrigomarquest
Copy link

I'm having the same issue (but in windows 11). I noticed that the Touch Keyboard and Handwriting Panel Service was disabled. I enabled it and set it to automatic, restarted and all good. BUT THEN the next time I restarted the PC the service didn't start and switched back to manual as seen in the screenshot... now every other restart I have to enable the service and restart....
Edition Windows 11 Pro Version 21H2 Installed on ‎11/‎7/‎2022 OS build 22000.795

Hello,
Is your workstation standalone or domain joined? do you have any group policy applied (rsop.msc)? Maybe security tools are disabling some services?
Try putting ctfmon.exe to startup run registry: REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v ctfmon /t REG_SZ /d "C:\Windows\System32\ctfmon.exe" /f
Or copying a ctfmon.exe shortcut to startup folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
Checking services in cmd.exe: sc query tabletinputservice sc query hidserv
Configuring services for on demand start: sc config hidserv tabletinputservice= demand sc config hidserv start= demand

My workstation is a standalone freshly installed windows too. No antivirus or any security settings other than default windows defender settings.

copying a ctfmon.exe shortcut to startup folder used to work 1 year ago but since I clean installed windows 11 it doesn't work anymore. Even when I manually run ctfmon.exe the issue still exists.

Here's a screenshot of the terminal after running the commands:

The both services are running but the "sc config..." must be runned in CMD as Administrator.
You can try this commands to check Windows system files:
sfc /scannow
DISM.exe /Online /Cleanup-image /Scanhealth
DISM.exe /Online /Cleanup-image /Restorehealth

Is WSL working?

image

Check Event Viewer either.

@BananaMasterz
Copy link

I'm having the same issue (but in windows 11). I noticed that the Touch Keyboard and Handwriting Panel Service was disabled. I enabled it and set it to automatic, restarted and all good. BUT THEN the next time I restarted the PC the service didn't start and switched back to manual as seen in the screenshot... now every other restart I have to enable the service and restart....

Edition Windows 11 Pro Version 21H2 Installed on ‎11/‎7/‎2022 OS build 22000.795

image

I did everything in this thread and more and this keeps changing to "manual" instead of "automatic" after every restart... this is infuriating

@BananaMasterz

This comment was marked as outdated.

@mikerains
Copy link

Huh, Windows Terminal was working previously, last month, on my Windows 11 Pro Lenovo, now I have this issue, and having done all of the above, still it refuses to accept keyboard input. Although pressing Ctrl does past my clipboard to the terminal which is weird.

@mikerains
Copy link

Enabling Touch Keyboard has a huge negative side-effect when running Windows 11 on a laptop that has a touchscreen - the service promiscuously opens the onscreen keyboard whenevr I use the touch screen to scroll a window - even though I have a physical keyboard. So now I have this on-screen keyboard popping up on top of what I am trying to read and work with. I have to continually close the OSK. It's like MS asked "what can we do to interrupt the software developer? More than just annoy them, we want to really stop them from being productive... hmm, what if we make the OSK pop-up promiscuously?

So for this reason I am not going to enable Touch Screen service, it makes my laptop UNUSABLE. I would rather just not use Windows Terminal, I'll just keep using CONEMU.

Who is the manager responsible for making OSK pop-up in laptops that have a Physical Keyboard, can you contact them and get them to understand what a bad requirement this is and get them to at least allow a setting to force OSK to never ever pop-up?

@mikerains
Copy link

wait ... if this is the new Modern Input Service, and it requires the Touch Screen Keyboard, then when clients start using this for input, nothing will work unless the Touch Screen service is running? So in order to use Windows, I have to suffer the OSK popping up any time I simply want to scroll a window with my thumb? If this is really so, it will be the end of Windows for me, I will go exclusively Linux in this case.

@ebadger
Copy link

ebadger commented Oct 24, 2022

Enabling Touch Keyboard has a huge negative side-effect when running Windows 11 on a laptop that has a touchscreen - the service promiscuously opens the onscreen keyboard whenevr I use the touch screen to scroll a window - even though I have a physical keyboard. So now I have this on-screen keyboard popping up on top of what I am trying to read and work with. I have to continually close the OSK. It's like MS asked "what can we do to interrupt the software developer? More than just annoy them, we want to really stop them from being productive... hmm, what if we make the OSK pop-up promiscuously?

So for this reason I am not going to enable Touch Screen service, it makes my laptop UNUSABLE. I would rather just not use Windows Terminal, I'll just keep using CONEMU.

Who is the manager responsible for making OSK pop-up in laptops that have a Physical Keyboard, can you contact them and get them to understand what a bad requirement this is and get them to at least allow a setting to force OSK to never ever pop-up?

If you have a touch screen laptop with a fixed hardware keyboard, OEM should be setting a reg key. You can set it yourself if you'd like.

https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-gpiobuttons-convertibleslatemode

Do you have this reg key defined?
HKLM/System/CurrentControlSet/Control/PriorityControl/ConvertibleSlateMode

if not, try setting to 1

@mikerains
Copy link

Hey @ebadger thanks. That key was set to 0, I changed it to 1, and that does stop the OSK. This is a relief as I have not been able to find a solution for this since I adopted Win 11 last year, and I was afraid it would be passed over and never solved. I hope others find this solution, but realy it should be surfaced in Control Panel, on the Touch screen config perhaps.

With this I can leave Touch Screen service running, and not have OSK popup, and Windows Terminal is accepting keystrokes.

Regarding other remedies above, my system's current state is:

My Windows build is Windows 11 21H2 (OS Build 22000.1098)

I added the entry described above, Registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Run
includes an entry with name "ctfmon", type REG_SZ value "C:\Windows\System32\ctfmon.exe"

I do NOT have a shortcut for ctfmon in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

$ sc query tabletinputservice

SERVICE_NAME: tabletinputservice
TYPE : 30 WIN32
STATE : 4 RUNNING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

$ sc query hidserv

SERVICE_NAME: hidserv
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

@jlong-limble
Copy link

I was experiencing issues with the terminal not accepting keyboard or mouse input after resuming from sleep (or whatever the modern equivalent is). In my situation, CTF Loader was taking a lot of CPU. Ending the process in the task manager caused my terminal window to crash, but on launching a new terminal instance it started to accept input again.

@julie777
Copy link

I also have the problem with Windows Terminal not recognizing keyboard input. It was working fine with the touch keyboard service disabled until I restarted today which installed windows updates. Now the terminal doesn't see keyboard input.

I find the explanation about the "modern keyboard input" unlikely given that everything else works fine without the touch keyboard service running.

Here are the newly applied updates

image

@julie777
Copy link

I just started the touche keyboard service and restarted Terminal. It still doesn't accept keyboard input.

@ebadger
Copy link

ebadger commented Nov 10, 2022

I just started the touche keyboard service and restarted Terminal. It still doesn't accept keyboard input.

do you see ctfmon.exe running in your process list?

@BananaMasterz
Copy link

I just started the touche keyboard service and restarted Terminal. It still doesn't accept keyboard input.

Check my comment above. I had the same issue and had to restart every other time I wanted to turn on the PC because starting the service required a restart to be applied.

@connorferster
Copy link

I was experiencing issues with the terminal not accepting keyboard or mouse input after resuming from sleep (or whatever the modern equivalent is). In my situation, CTF Loader was taking a lot of CPU. Ending the process in the task manager caused my terminal window to crash, but on launching a new terminal instance it started to accept input again.

I have a similar experience. I will just be working away on the terminal and then, for some reason, something changes and it no longer accepts keyboard input. I am on a desktop machine and using a physical keyboard.

Restarting Terminal fixes the issue but is a bit frustrating.

@ASKMAGICSHELL
Copy link

Enabling Touch Keyboard has a huge negative side-effect when running Windows 11 on a laptop that has a touchscreen - the service promiscuously opens the onscreen keyboard whenevr I use the touch screen to scroll a window - even though I have a physical keyboard. So now I have this on-screen keyboard popping up on top of what I am trying to read and work with. I have to continually close the OSK. It's like MS asked "what can we do to interrupt the software developer? More than just annoy them, we want to really stop them from being productive... hmm, what if we make the OSK pop-up promiscuously?
So for this reason I am not going to enable Touch Screen service, it makes my laptop UNUSABLE. I would rather just not use Windows Terminal, I'll just keep using CONEMU.
Who is the manager responsible for making OSK pop-up in laptops that have a Physical Keyboard, can you contact them and get them to understand what a bad requirement this is and get them to at least allow a setting to force OSK to never ever pop-up?

If you have a touch screen laptop with a fixed hardware keyboard, OEM should be setting a reg key. You can set it yourself if you'd like.

https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-gpiobuttons-convertibleslatemode

Do you have this reg key defined? HKLM/System/CurrentControlSet/Control/PriorityControl/ConvertibleSlateMode

if not, try setting to 1

You save my life
I login just to give you a thumb up

@eheck-is
Copy link

eheck-is commented Jan 22, 2024

FWIW, my system has a similar problem in Windows 11 (build 22621.3007) on a convertible notebook after waking up from sleep (not always; might have something to do with how long the system has been sleeping and whether the lid is closed, I'm using an external keyboard and monitor). It's not only affecting Windows Terminal (not accepting keyboard input) but also login (have to press Ctrl-Alt-Del to get the login screen), progress display (doesn't show) and refresh (still shows deleted files) in Explorer, Emoji input panel (opens but doesn't show emoji), for example.
TextInputManagementService is always running and set to automatic startup, This discussion made me try killing ctfmon.exe from Task Manager and that actually helped. ctfmon restarted when I opened a new Windows Terminal and everything seems to be working for now.

Edit: Found out that killing the process did mess up the pen functions, but I don't always need those

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests