Monthly Archives: January 2019

Citrix always change default keyboard / input layout after login

I’m using Chinese input layout in my VDI, so usually I delete all other input layout.
And I found that every time when I login to my VDI via company’s laptop, my VDI’s default keyboard input layout will be changed to English (US), and I have to remove it again and again.

At beginning I thought it’s a windows bug, so I spent lots of time to check MS article to fix the problem…No fix…

And today I found that this issue is caused by Citrix not by Windows… Citrix introduced a new feature named “keyboard layout synchronization” in version 7.16. You can refer to below link:

https://docs.citrix.com/en-us/citrix-workspace-app-for-windows/configure.html#keyboard-layout-and-language-bar

To disable this feature,

On client: use local keyboard layout. Receiver side: select Advanced Preferences > Local keyboard layout setting > No
On VDA disable the keyboard layout sync feature.
For this open registry editor and navigate to HKLM\Software\Citrix\ICA\IcaIme
Add a new DWORD key called DisableKeyboardSync and set the value to 1 and reboot the VDA

Disable Firefox 65+ urlbar/address bar suggestion popups

According to https://bugzilla.mozilla.org/show_bug.cgi?id=1502392, browser.urlbar.autocomplete.enabled pref is no more used in Firefox 65.
So you can’t set below pref to false to disable the annoying Firefox address bar/url bar popups.

browser.urlbar.autocomplete.enabled
browser.urlbar.suggest.bookmark;false
browser.urlbar.suggest.history;false
browser.urlbar.suggest.searches

The only way to disable the popup is to use userChrome.css to control Firefox User interface.
Add below line to userChrome.css, done.

#PopupAutoCompleteRichResult {
	display: none!important;
} 

Powershell comparison: $null on the left

When I write powershell scripts, I always use below method to check whether variable is null or not.

if ($variable -eq $null) {
}

When I use VScode, VScode suggested me to put $null to left. Why?

Check below example:

$object = @(1, $null, 2, $null)

# "not safe" comparison with $null, perhaps a mistake
if ($object -eq $null) {
	# -eq gets @($null, $null) which is evaluated to $true by if
	'This is called.'
}

# safe comparison with $null
if ($null -eq $object) {
	'This is not called.'
}

So, the right way to compare is always put $null on the left side.

if ($null-eq $variable) {
}