how to configure gnome to use only one specific keyboard layout on lock screen? - gnome

for lock screen, gnome uses keyboard layout that was last used before locking the screen. Is there a possibility to configure gnome in such a way that it will always switch keyboard layout to some specific value for lock screen?
Example, how it works now: You have two layouts configured, en and abc. You've been entering some text using keyboard layout abc and then locked the screen by hitting Meta + L or placing your computer into sleep mode. Reaching lock screen, you find your keyboard layout is abc. You switch it to en and enter your password, unlock the screen and see that your active gnome desktop keyboard layout is abc.
Desired: You have two layouts configured, en and abc. You've been entering some text using keyboard layout abc and then locked the screen by hitting Meta + L or placing your computer into sleep mode. Reaching lock screen, you find your keyboard layout is en, because you managed to somehow configure gnome (or use some lock screen activation scripts/hooks?) to always switch to en for lock screen. Desktop keyboard layout after unlocking could be retained (abc), but this is of no importance in scope of given question.

found it!
Gnome Settings → Region & Language → Input sources section. Click on the «Login screen» button to modify input sources relevant to Login screen. The button itself resides on the window decoration bar and is "hidden openly", hard to find visually.

You can install g3kb-switch to control current keyboard layout in GNOME from command line. To change keyboard layout to English on Lock Screen automatically, you can use a script (put it in GNOME autostart):
#!/bin/bash
dbus-monitor --session "type=signal,interface=org.gnome.ScreenSaver" |
while read MSG; do
MSG_STAT=`echo $MSG | grep boolean | awk '{print $2}'`
if [[ "$MSG_STAT" == "true" ]]; then
echo "Screen locking actions"
gdbus call --session --dest org.gnome.Shell --object-path /org/g3kbswitch/G3kbSwitch --method org.g3kbswitch.G3kbSwitch.Set 0
fi
done
GNOME disables all extensions on Lock Screen activation for security reasons. So, you need to remove everything from disable() method in ~/.local/share/gnome-shell/extensions/g3kb-switch#g3kb-switch.org/extension.js as written here, then reboot.

Related

Windows touch keyboard appearing in controls without text input

In MFC, how do I stop the touch keyboard from appearing when selecting controls without text inputs? Specifically, CComboBox-derived and original CListBox controls. The issue occurs in a large C++ application for touchscreen tablets running Windows 10. Bizarrely, selecting any CEdit control in the application solves the issue until the application restarts.
I've been looking at InputScope, AutomationPeer, and even killing the keyboard process TabTip.exe after it appears, but none of these prevent the keyboard from showing in the first place.
A previous solution involved changing the "Automatically show touch keyboard" registry setting SOFTWARE\Microsoft\TabletTip\1.7\EnableDesktopModeAutoInvoke on focus change, but alerting the touch keyboard with SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE) added unacceptable delay to the UI.

How can I get the WID via bash which window the mouse pointer is over?

The question refers to:
Linux Ubuntu, with Cinnamon desktop
Several program windows can be displayed on a desktop.
How can I get the WID via bash which window the mouse pointer is over?
I cannot test this at the moment, but maybe xdotool offers a way to get the window under the mouse cursor. From man xdotool:
getmouselocation [--shell]
Outputs the x, y, screen, and window id of the mouse cursor.
I assume the mentioned window id belongs to the window under the mouse cursor. To retrieve it, use
declare "$(xdotool getmouselocation --shell | grep WINDOW)"
echo "$WINDOW"
The window id can then be used in other tools like xwininfo -id <wdid> to get more information.

Enabling keyboard shortcuts to confirm Dialogs in AppleScript

I am looking for a way to allow a user to complete a Dialog entry using keyboard shortcuts. Is this possible?
Other questions have discussed assigning shortcuts to the options in an AppleScript dialog box, but not to the "Continue"/"Okay" etc. button.
The main difficulty is that I'm using a multi-line text entry form, so the Enter button simply creates a new line, instead of targeting the default button as it would conventionally. I'm hoping cmdenter can be assigned to the default button instead.
The line of script defining the dialog in question is:
set theResponse to display dialog "Enter tasks:" default answer "
" buttons {"Cancel", "Continue"} default button "Continue"
Running your AppleScript code from Script Editor on a US English MacBook Pro, whether or not something is typed in, fnenter presses the Continue button.
The same keyboard shortcut works on an US English Apple Magic Keyboard when connected to the MacBook Pro and I'd assume any US English Mac it was connected to would do the same. I only have the MacBook Pro to test with at the moment.
In macOS, by default, pressing the tab key in this use case will not move between the controls as the controlling setting in System Preferences > Keyboard > Shortcuts is not set to allow it to act on all controls.
You must select one of the following options, depending on the version of macOS one is running, in order to use the tab key on all controls.
If you see:
Full Keyboard Access: In windows and dialogs, press Tab to move keyboard focus between:
(•) Text boxed and lists only
( ) All Controls
Select: (•) All Controls
If you see:
[] Use keyboard navigation to move between controls
Press the Tab key to move focus forward and Shift Tab to move focus backward.
Check: [√] Use keyboard navigation to move between controls
With this done, one can then use tabtabenter to press the continue button, with the dialog box produced by the code shown in the OP.
Side Note: One can also try fncommandenter as that was necessary from within a VMware macOS Catalina virtual machine that I also tested in.
⌘-Enter (on the numeric keypad) presses Continue
If you are in a multiline text field, hit the Tab key so that focus is on some element other than the text field. Then the Enter key should route properly to the dialog's default close button.

Block keyboard for embedded xterm, in PyQt4

I'm trying to embed xterm in a PyQt application window for tailing a log file. However, I want to block keyboard input from the user in the embedded terminal, so that they don't, for example, press CTRL-C or CTRL-D, and kill the process.
I'm able to embed the terminal just fine. Is there a setting for xterm or PyQt that can be used to block user input? I want this to be a read-only terminal, that just displays the content of the log file.
I've searched the manpage for xterm, and haven't found anything.
The way to approach this would be to construct a transparent (actually "uncolored") window which overlays the embedded xterm window.
There is an example described in Basic X Window keyboard and mouse input blocking which is essentially a screensaver written in Python. For lower-level (X documentation) on window properties, the links in How to prevent an X Window from receiving user input? may be useful to you.
The main problems to solve would be (in your program) how to ensure that the overlaid window comes on top, and of course how to keep it transparent (since that diverges from the example). The latter is more complicated:
Transparent window in Xwindow parent
Empty or transparent window with Xlib showing border lines only

screen command to persistently enable menu at bottom

I am using the Linux Screen Utility to open more than 2 windows in my Putty terminal. Usually while running a screen session a
Ctrl+A Ctrl+W
gives us a list of window at the bottom of the screen.
I have two questions:
I wanted to know if there is a way to persistently keep this menu at the bottom of the screen.
How to give name to each window? Ideally when we execute
screen -S screen_name
the screen_name should appear in the menu. I can only find
0.csh 1.csh 2.csh
in the menu. can this be changed to
0.debug_screen 1.editor 2.games
I have following lines in my .screenrc (found in Short Tip: GNU Screen with proper scroll, session management support):
caption always # activates window caption
caption string '%{= wk}[ %{k}%H %{k}][%= %{= wk}%?%-Lw%?%{r}(%{r}%n*%f%t%?(%u)%?%{r})%{k}%?%+Lw%?%?%= %{k}][%{b} %Y-%m-%d %{k}%c %{k}]'
A description of those cryptic identifiers can be found in the screen manpage, section STRING ESCAPES.
Btw.: Instead of caption you can also use hardstatus (which is displayed only once at the bottom line if you use split screens).
Windows can be renamed using C-a A (see again screen manpage, section Commands).
I have the following line in my .screenrc which gives me a caption line at the bottom of the screen:
screen $SHELL -c 'screen -X caption always "%{= RW} $STY | %c:%s `date +%Z` | host:%H | load:%l | escape:CTRL-U "'
This gives me the following:
%{= RW} <== White text on red background
$STY <== Name of the screen session e.g. "4169.debug_screen"
%c:%s <== The time in 24 hour format with seconds
`date +%Z` <== The timezone the server is configured to
host:%H <== The hostname of the server
load:%l <== The current load averages of the server
escape:CTRL-U <== A textual reminder that the screen escape key is set to CTRL-U (not CTRL-A)
I use different colour backgrounds on different machines so I remember if I'm on a production or development server - red for production to remind me to be even more careful than usual.
To get the list of screens running including names I just type 'screen -ls' (which I've aliased to 'scls').

Resources