in share/X11/xkb/rules/evdev/lst, I find this set of options for ctrl
ctrl Ctrl key position
ctrl:nocaps Caps Lock as Ctrl
ctrl:lctrl_meta Left Ctrl as Meta
ctrl:swapcaps Swap Ctrl and Caps Lock
ctrl:ac_ctrl At left of 'A'
ctrl:aa_ctrl At bottom left
ctrl:rctrl_ralt Right Ctrl as Right Alt
ctrl:menu_rctrl Menu as Right Ctrl
ctrl:ctrl_ralt Right Alt as Right Ctrl
ctrl:swap_lalt_lctl Swap Left Alt key with Left Ctrl key
ctrl:swap_lwin_lctl Swap Left Win key with Left Ctrl key
ctrl:swap_lalt_lctl_lwin Left Alt as Ctrl, Left Ctrl as Win, Left Win as Alt
Some of them work - if I run setxkbmap -option -option 'ctrl:nocaps', I get the correct behavior. However, some of the others are ignored, for example setxkbmap -option -option 'ctrl:swap_lalt_lctl_lwin'.
One observation I've made is that the ignored options are displayed by setxkbmap -query, but not by setxkbmap -print. Here's a demonstration of this behavior.
$ setxkbmap -option -option ctrl:nocaps
$ setxkbmap -query
rules: evdev
model: pc104
layout: us
variant: colemak
options: ctrl:nocaps
$ setxkbmap -print
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us(colemak)+inet(evdev)+ctrl(nocaps)" };
xkb_geometry { include "pc(pc104)" };
};
$ setxkbmap -option -option ctrl:swap_lalt_lctl_lwin
$ setxkbmap -query
rules: evdev
model: pc104
layout: us
variant: colemak
options: ctrl:swap_lalt_lctl_lwin
$ setxkbmap -print
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us(colemak)+inet(evdev)" };
xkb_geometry { include "pc(pc104)" };
};
I don't know how to dig into this any deeper. Some further environment information is
linux distribution is NixOs
window manager is XMonad, display manager is SLiM, no desktop manager
keyboard layout is colemak (problem persists if I switch to qwerty)
setxkbmap version is 1.3.0 according to the man page
this appears to be because not all of the options listed in the file evdev.lst are also in the neighboring file evdev. I've asked a follow question as to why this is the case at why does the file evdev in /usr/share/X11/xkb/rules not match with evdev.lst?
Perhaps it happens because some options seem to not be compatible with others.
For example, if I set up shift key to unlock the caps lock (-option shift:breaks_caps), and at the same time set up alt-shift to switch between keyboard layouts, then shift no longer unlocks the caps lock. As soon as I change the layout switching combination from alt-shift to say, alt-ctrl, the option shift:breaks_caps reactivates.
Looks like a bug to me.
Related
I have a OnDropFiles handler for a CDialogEx:
void CWeekendMeetingDlg::OnDropFiles(HDROP hDropInfo)
{
__super::OnDropFiles(hDropInfo);
// ...
}
Example in action:
Is it possible to adjust it so that when the cursor is over the CEdit control is shows the caret cursor to give more of an indication of where the data will be inserted?
I'm making a menubar in Tkinter with an accelerator:
menubar = tk.Menu(window)
file_menu = tk.Menu(menubar)
menubar.add_cascade(label='File', menu=file_menu)
window.config(menu=menubar)
file_menu.add_command(label='Open resource pack', command=openPack, accelerator='Cmd+o' if IS_MAC else 'Ctrl+o')
window.bind_all('<M1-o>' if IS_MAC else '<Control-o>', openPack)
file_menu.add_command(label='Copy original pack', command=copyOriginalPack, accelerator='Shift+Cmd+c' if IS_MAC else 'Shift+Ctrl+c')
window.bind_all('<M1-C>' if IS_MAC else '<Control-C>', copyOriginalPack)
But for the Copy original pack option the key combination is Shift + Command + C. The accelerator only shows the key combination in the menubar but doesn't actually run the command, so I have to manually bind to the window.
If I remember correctly, to bind Shift + Command + C I just need to say Control+C and make the C uppercase because of Shift.
But I can't bind Shift. It works if I click the menu option, but the key combo doesn't. It works for the other option, which doesn't have Shift
I fixed it by writing <M1-Shift-c> (note the lowercase c)
Context
I am toggling the presence of the mouse cursor depending on whether or not a mouse is plugged into my Linux system. I have created a solution that works, although sub optimally. My current solution is the following:
Modified WM: I extended a program supplied with my WM, matchbox-remote.c (see original source here), to allow a remote command that changes the cursor in real time. My change is based on this SO answer to a similar question.
Rules for udev: I added two udev rules that call matchbox-remote when a mouse is plugged in or unplugged, with my toggle argument.
Systemd service: I added a oneshot systemd service enables or disables the cursor on boot (depending on whether a mouse is plugged in or not). This addresses an edge-case where X is not yet ready when the udev rules first run.
If you would like to see how I have accomplished each step, move to the bottom where I have numbered sections with the relevant files
Problem
My solution works, but is suboptimal for two reasons:
The mouse cursor is present onscreen for a few seconds after the desktop loads if no mouse is plugged in, because the systemd rule runs after multi-user.target.
The mouse cursor remains present onscreen sometimes after being disabled. It disappears as soon as I interact with a button or other UI element. However, this can be quite annoying.
Attempted fixes
I have tried to do the following to improve my solution:
Reduce latency on boot: I tried to adjust my service file to start earlier in the boot progress. I specifically targeted it to start after xserver-nodm.service. However, this still fails to find the DISPLAY despite me manually setting it as an environment variable.
Disappear mouse pointer on event: I attempted to restart the WM, hoping that this would more seamlessly make the cursor disappear when it was supposed to. Unfortunately, this is a regressive solution as it makes the screen go black for several seconds and is more disruptive.
Conclusion
I would like help in solving the following:
How can I change the cursor in a timely fashion at boot time (Do I need to modify X server or somehow queue events to send once it's reachable?)
How can I ensure a change to the cursor is reflected immediately (as opposed to sometimes waiting until I interact with a UI element)?
More info
Kernel: Linux 5.4.3
Xorg: Version 1.20.5
(1): matchbox-remote.c (in /usr/bin/)
Display *dpy;
...
#include <X11/cursorfont.h>
#include <X11/extensions/Xfixes.h>
...
void set_show_cursor (int show)
{
Window root;
Cursor cursor;
Pixmap bitmap;
XColor color;
static char data[8] = {0};
root = DefaultRootWindow(dpy);
if (!show) {
color.red = color.green = color.blue = 0;
bitmap = xCreateBitmapFromData(dpy, root, data, 8, 8);
cursor = XCreatePixmapCursor(dpy, bitmap, bitmap, &color, &color, 0, 0);
XDefineCursor(dpy, root, cursor);
XFreeCursor(dpy, cursor);
XFreePixmap(dpy, bitmap);
} else {
cursor = XCreateFontCursor(dpy, XC_left_ptr);
XDefineCursor(dpy, root, cursor);
XFreeCursor(dpy, cursor);
}
}
...
static void usage(char *progname) {
...
printf(" -show-cursor [1|0] Enable or disable the cursor\n");
...
}
...
int main (int argc, char* argv[])
{
...
for (i=1; argv[i]; i++) {
...
switch (arg[1])
{
....
case 's':
if (NULL != argv[i+1]) {
set_show_cursor(atoi(argv[i+1]));
}
break;
...
}
}
XSync(dpy, False);
XCloseDisplay(dpy);
}
(2): 98-cursor-toggle.rules (in /etc/udev/rules.d)
SUBSYSTEMS="usb", ACTION=="add", ENV{ID_INPUT_MOUSE}=="1", RUN+="/bin/sh -c 'DISPLAY=:0 /usr/bin/matchbox-remote -show-cursor 1'"
SUBSYSTEMS="usb", ACTION=="remove", ENV{ID_INPUT_MOUSE}=="1", RUN+="/bin/sh -c 'DISPLAY=:0 /usr/bin/matchbox-remote -show-cursor 0'"
(3) cursor-init.service (in /lib/systemd/system)
[Unit]
Description=X11 cursor initialisation
After=multi-user.target
Requires=multi-user.target
[Service]
Type=simple
ExecStart=/bin/sh -c 'DISPLAY=:0 /usr/bin/matchbox-remote -show-cursor $(ls -1 /dev/input/by-*/*-mouse 2>/dev/null | wc -l)'
RemainAfterExit=true
StandardOutput=journal
Restart=on-failure
RestartUSec=500000
[Install]
WantedBy=graphical.target
Just a quick question in order to optimize my workflow / productivity with Sublime Text 3 & Emmet...
So far I am able to (on Mac)
select the opening and closing tag via CMD + Shift + K
select the nested HTML / text of a wrapping attribute via CMD + Shift + A
But what I haven't found out yet is a way to select the opening and closing tag completely (with all possible values) in order to delete the surrounding tags.
To illustrate...
<span style="color: #660066;"><strong>Lorem ipsum dolor sit amed</strong></span>
Running CMD + Shift + K renders this selection:
...which doesn't allow me to instantly delete the code.
Any ideas / hints / workarounds you can think of? I researched both the web and the Sublime Text docs but to no avail...
Thanks & regards!
Highlight the tag you want to remove the opening and closing tags for and try CTRL + SHIFT + ;
That should delete the selected tag and it's closing partner.
The emmet documentation has this as the remove tag shortcut, but states the shortcut is CTRL + SHIFT + K, when infact (on my setup at least), it's CTRL + SHIFT + ; in Sublime Text 3.
If this doesn't work, you should be able to find what the default key binding is by checking your default key bindings file under Preferences > Package Settings > Emmet > Key Bindings - Default. Run a search in this file for "remove_tag" and see what binding is attached to it.
If for some reason it doesn't exist or you'd like to change the binding, you can do so by editing your user key bindings file under Preferences > Package Settings > Emmet > Key Bindings - User.
Simply add:
[
{
"keys": [
"shift+ctrl+;"
],
"args": {
"action": "remove_tag"
},
"command": "run_emmet_action",
"context": [
{
"key": "emmet_action_enabled.remove_tag"
}
]
}
]
I would like to disable Shift Ctrl without disabling other shorcuts like Shift Ctrl A, or Ctrl A, or Shift A.
I have tried multiple combinaison of ^+:: return with and without :
- Up : ^+ Up:: return
- ~ : ~^+ Up:: return
- & : ~^ & ~+ Up:: return
Nothing work. Even when I start my script as admin it doesn work.
I want to rename Shift Ctrl because I have two keyboard languages and pressing Shift Ctrl change it. I already have the shorcut Windows Space so I don't need Shift Ctrl.
I have tried with ahk but I am open to any other way to solve this.
"^" is the modifier symbol for the Control key and "+" for the Shift key.
Modifier symbols are used only in key-combinations for modifying other keys.
Try also
+Ctrl Up:: return
or
Shift & Ctrl Up:: return
EDIT:
You can change or remove the combination that changes the keyboard language on Control panel --> Language, as shown in the comments below.