Skip to content

Conversation

@ferman-guzel
Copy link

@ferman-guzel ferman-guzel commented Dec 9, 2025

Overview

This change improves the user experience for non-technical users accessing
Guacamole via tablets or mobile devices, particularly for VNC sessions.

Issue

JIRA: GUACAMOLE-2178

What changed

  • The inputMethod preference is now read exclusively from a browser cookie (GUAC_INPUT_METHOD)
  • LocalStorage is no longer used for storing or restoring inputMethod
  • A helper function getCookie() is added to safely read cookie values
  • Other preferences continue to be persisted in localStorage
  • Console debug logs removed for production readiness

Why

By reading inputMethod from a cookie, users can enter text without
requiring a keyboard or swipe gesture. In our environment, this cookie
is set when redirecting users to the Guacamole UI, making text input
more intuitive and low-effort.

This approach also centralizes control over inputMethod and prevents
user-side overrides via localStorage.

Backward Compatibility

  • If the cookie is not set, inputMethod defaults to TEXT
  • Other preference settings remain unaffected

Notes / Testing

  • Tested on mobile and tablet environments
  • Ensures seamless integration with existing preference storage

@necouchman
Copy link
Contributor

@ferman-guzel Thanks for submitting this PR. Please change the title of the PR to include the GUACAMOLE-2178: prefix.

I'm also going to defer to @mike-jumper on this review, particularly with regard to the introduction of Cookies - we spent some time and effort several years ago removing all of the cookies from Guacamole in favor of the LocalStorage mechanism, and I'm not sure that we want to re-introduce it and what the implications of that may be.

Copy link
Contributor

@necouchman necouchman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a glance it looks pretty straight-forward, and I don't have a lot of concerns other than getting Mike's input on the use of Cookies.

However, your code style needs to conform to the style used throughout the code. Mostly this means:

  • Multi-line comments should be updated to match style used throughout the code.
  • Indentation should follow the existing style (4 spaces per stop).

@ferman-guzel ferman-guzel changed the title Enhance inputMethod handling via cookie for easier text input on mobile devices GUACAMOLE-2178: Enhance inputMethod handling via cookie for easier text input on mobile devices Dec 9, 2025
@ferman-guzel ferman-guzel force-pushed the feature/input-method-from-cookie branch from 66685c0 to fee2fe8 Compare December 9, 2025 12:37
@svogl
Copy link

svogl commented Dec 9, 2025

@ferman-guzel Thanks for submitting this PR. Please change the title of the PR to include the GUACAMOLE-2178: prefix.

I'm also going to defer to @mike-jumper on this review, particularly with regard to the introduction of Cookies - we spent some time and effort several years ago removing all of the cookies from Guacamole in favor of the LocalStorage mechanism, and I'm not sure that we want to re-introduce it and what the implications of that may be.

Let me add some background: We have a few users who are using tablets/phones to remote-access their systems and typically want to change a few settings quickly. Without keyboard it's hard to impossible to give them keyboard input, so the idea is to open a sane default without interaction.
Sorry for the cookie approach, that was a first way forward to make this work; if you can live with query parameters that should be fine as well.
Simon

@necouchman
Copy link
Contributor

@ferman-guzel Thanks for submitting this PR. Please change the title of the PR to include the GUACAMOLE-2178: prefix.
I'm also going to defer to @mike-jumper on this review, particularly with regard to the introduction of Cookies - we spent some time and effort several years ago removing all of the cookies from Guacamole in favor of the LocalStorage mechanism, and I'm not sure that we want to re-introduce it and what the implications of that may be.

Let me add some background: We have a few users who are using tablets/phones to remote-access their systems and typically want to change a few settings quickly. Without keyboard it's hard to impossible to give them keyboard input, so the idea is to open a sane default without interaction. Sorry for the cookie approach, that was a first way forward to make this work; if you can live with query parameters that should be fine as well. Simon

That's helpful, thanks. I'll let Mike comment on it.

-Nick

Enhances the preference service to read the `inputMethod` exclusively
from a browser cookie (`GUAC_INPUT_METHOD`) instead of localStorage.

This allows non-technical users accessing Guacamole via tablets or mobile
devices to enter text with minimal effort, without needing a keyboard or
swipe gestures
@ferman-guzel ferman-guzel force-pushed the feature/input-method-from-cookie branch from fee2fe8 to 1294cdb Compare December 10, 2025 10:20
Copy link
Member

@corentin-soriano corentin-soriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure how accurately this can be implemented, but it would be useful to detect whether the client is using a touchscreen. In that case only, we could automatically force the default input mode to keyboard/mouse if the user hasn’t explicitly selected one.

The administrator could also choose to enable or disable this behavior directly from the interface, without needing to add reverse-proxy rules or anything similar.

@mike-jumper
Copy link
Contributor

I definitely think we shouldn't rely on an externally set cookie to determine core behavior. The webapp should perform its own checks and decide on preference defaults.

While we can't just look at whether touch events are supported (we need to support devices that have both a physical keyboard and a touch screen), there should be other mechanisms we can use to hint at better defaults.

Other options:

  • There may be something we can leverage in the VirtualKeyboard API for some browsers (though we would still have to rely on browser sniffing for others).

  • We try to detect whether the virtual keyboard ever opens up while the user is interacting with the webapp, and attempt to focus the Guacamole.InputSink upon connecting to ensure we can rely on this happening at least once.

    If the virtual keyboard ever opened up, then we should default to mobile-friendly behavior. If it didn't, then no action is needed and having Guacamole.InputSink focused doesn't hurt anything.

@svogl
Copy link

svogl commented Dec 11, 2025

@mike-jumper I'm not happy with cookies here myself, consider this as a functional prototype. The point is that we want to keep our end-users in charge of their devices, they know best what they want. But as they are low-tech, we give them a reasonable default bound to the device they interact with, plus an easy web interface to change this, while enabling them multi-device access (PC/mobile/tablet).

Technical integration - which other options do we have? Is there a way for the webapp or guacd to forward settings from the connection_parameters table? A query parameter would also be straight-forward without storing something on the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants