Giter Site home page Giter Site logo

xkb-switch's People

Contributors

akorb avatar alexandersolovyov avatar andrey2805 avatar benibela avatar brs-brs avatar dmgk avatar happyfacade avatar ierton avatar lyokha avatar morxa avatar nekr0z avatar sergei-mironov avatar sonuishaq67 avatar szaszm avatar tvladyslav avatar zvezdochiot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xkb-switch's Issues

Group vs layout disambiguation

It seems that this tool uses the word "group" to refer to what xkb calls "layout", which are complete keybard mapping. Here's the—admittedly confusing—definition of a group from the XKB Configuration Guide (emphasis mine):

You can use multi-layouts xkb configuration. What does it mean? Basically it allows to load up to four different keyboard layouts at a time. Each such layout would reside in its own group. The groups (unlike complete keyboard remapping) can be switched very fast from one to another by a combination of keys.

It would be very interesting if this tool could also change groups, as xkb's group-changing mechanism is somewhat limited (it requires you to reserve a key for only this purpose) and doesn't seem to be accessible from setxkbmap. If this isn't an option, then maybe the docs could adopt the xkb terminology ("layout").

xkb-switch doesn't show keyboard variant anymore

Hey!

I recently upgraded from version 20150826-3 to version 20150826-4 of xkb-switch via the Arch User Repository (the xkb-switch-git package), and some behaviour has changed in an unexpected way. In particular, xkb-switch doesn't seem to output the keyboard layout variant anymore.

Before the update, calling xkb-switch with no arguments would output us or us(intl) depending on which layout I was using. Now, xkb-switch outputs just us regardless of what layout I'm actually using at the moment. I just want to use xkb-switch to tell me the current layout variant, I don't actually use it to change the layout.

For reference, here is my xorg keyboard configuration:

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,us"
        Option "XkbVariant" ",intl"
        Option "XkbOptions" "ctrl:nocaps, grp:alt_shift_toggle"
EndSection

Is there any way of getting xkb-switch to output the current layout variant again?

Thanks in advance for the help!

How to send switch layout?

I have some question to the usage
Firstly I set my keyboard layouts through setxkbmap
setxkbmap -layout 'us,de,bg' -variant ' , ,phonetic'
setxkbmap -option 'grp:alt_caps_toggle'

Than I call
xkb-switch -s "de( )"

and I can write switch and I can switch between us and bg. When I want, I can quickly call xkb-switch -s "de( )" and get it. This is clear.
Is it possible to bind some script to a key, so I can can switch between en and bg without opening a terminal? It there a better way, than running the xkb-group.sh, finding it's pid and writing to stdin?

Add option to print layouts in uppercase

It would be nice if there is an option to print the layouts in uppercase, as it looks better on some panels and status bars.

I made a modification of longwait function which transforms the string characters to uppercase.

if(m_lwait_u) {
  while(true) {
    xkb.wait_event();
    xkb.build_layout(syms);
    syms_collected = true;
    string su = syms.at(xkb.get_group());
    transform(su.begin(), su.end(), su.begin(), ::toupper); 
    cout << su << endl;
  }
}

./xkb-switch -l lists only current lauout in use

./xkb-switch -l
us

Why does it not list all available layouts on my stem like de, fr, en .... ?

uname -a Linux t-MS-7C90 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

user local xkb configuration not recognized

After

xkbcomp -I"$XDG_CONFIG_HOME/xkb" "$XDG_CONFIG_HOME/xkb/map" "$DISPLAY"

with"$XDG_CONFIG_HOME/xkb/map" reading, say


xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_symbols   { include "pc+us(intl):1+ru(phonetic):2+inet(evdev)"	};
	xkb_geometry  { include "pc(pc105)"     };
};

then neither setxkbmap -query nor xkbswitch -l shows the loaded layouts, but instead those loaded on system startup, but they can be switched to.
Does someone know why?

Error while loading shared libraries

I am getting the following error on Ubuntu 20.04 when running the command

xkb-switch: error while loading shared libraries: libxkbswitch.so.1: cannot open shared object file: No such file or directory

Recent releases missing from github?

Hello,

I notice that the github releases page (currently 1.6.0) does not follow the version numbers from the git (1.8.5). Are you not planning to use the release feature of github anymore?

Can't change to any layout

I've built the latest master (6cd4da9). I'm on Xubuntu 18.04 using i3. Had to sudo apt install libsigc++-2.0-dev libxkbfile-dev for a successful build.
Problem is, I can't change the layout from us to anything:

./xkb-switch -s ir
xkb-switch: /home/pooya/tools/utility/xkb-switch-i3/src/XKbSwitch.cpp:221: Condition i!=syms.end() failed. Group 'ir' is not supported by current layout. Try xkb-switch -l.
xkb-switch: layouts: [us]

de or ru also yields similar result.

./xkb-switch -l
us

Here is the script I use to change layouts:

#!/bin/bash

CURR_LANG="$(setxkbmap -query | grep layout | tr -s ' ' | cut -d ' ' -f2)"

US="us"
IR="ir"

if [[ "$CURR_LANG" == "$US" ]]
then
    setxkbmap ir
else
    setxkbmap us
fi
λ ./xkb-switch -d
[DEBUG] xkb-switch version 1.8.1
[DEBUG] layout: us
[DEBUG] variant: <empty>
us

λ ./xkb-switch -d
[DEBUG] xkb-switch version 1.8.1
[DEBUG] layout: ir
[DEBUG] variant: <empty>
ir

Am I using the program correctly?

Can't build the program on ubuntu 18.04

I tried to build the program on ubuntu 18.04 using this instruction
https://github.com/ierton/xkb-switch#installing

sudo apt update
cd ~/Downloads
mkdir xkb-switch
tar -xvzf xkb-switch-1.6.0.tar.gz -C xkb-switch 
cd xkb-switch/xkb-switch-1.6.0
mkdir build && cd build
sudo apt install cmake
cmake ..

but got the following error:

CMake Error at /usr/share/cmake-3.10/Modules/FindX11.cmake:429 (message):
  Could not find X11
Call Stack (most recent call first):
  CMakeLists.txt:11 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
See also "/home/rom/Downloads/xkb-switch/xkb-switch-1.6.0/build/CMakeFiles/CMakeOutput.log".

Could you help me, please?

Symbol lookup error with vim-xkbswitch

With last updates to xkbswitch the vim-xkbswitch plugin crashes with the following error:

vim: symbol lookup error: /usr/local/lib/libxkbswitch.so: undefined symbol: _ZN2kb6parse2ERKSsRKSt6vectorISsSaISsEE

Also, is it still true that you are going to stop maintaining this project?

Add option to show variant

Hello,

Not really an issue, but a feature request.
Could you add an option to show layout variant as well as layout?
Preferably in a way that works with -W flag.

Libcalls failing when xkb-switch is compiled with `-O2` flag

When xkb-switch is compiled with -O2 flag, libcalls from Vim fail to correctly change the layout when going from insert mode back to normal. There are no error messages in Vim during execution.

See vim-xkbswitch #27 for related discussion.

Since the problem is quite vague, here's the screencast that demonstrates the issue: xkb-switch problems

Generally the change of execution behavior with -O2 indicates of some issues with the source code.

Question: Is `xkb-switch -x' option still available?

I assume you have removed the -x option at some point.
Still, wanted to clarify, since Readme says:

Xkb-switch contains some testing facilities, please include output of `xkb-switch -x' command in the report.

I wanted to use this feature to investigate another issue (possibly not event with xkb-switch, tbh)

p.s. I use version 1.4.0

Terminating with std::out_of_range

Fox xkb_symbols string like pc+us+ru(winkeys):2+ua(winkeys):3+inet(evdev)+group(toggle)

running with non-first group active produces error

terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check

It seems that symbols followed by '(' should not be ignored unconditionally like they do since 42abcc0.

ibus keylayouts ignored

Nowadays you can define additional keyboard layouts in ibus: screenshot - 01072016 - 05 34 31 pm

xkb-switch ignores those and can only list the non-ibus layouts (de(nodeadkeys) and us(altgr-intl) in the example)

make fails

> git clone
> build && cd build
> cmake ..
> make
Scanning dependencies of target xkb-switch
[ 16%] Building CXX object CMakeFiles/xkb-switch.dir/XKbSwitch.cpp.o
[ 33%] Building CXX object CMakeFiles/xkb-switch.dir/XKeyboard.cpp.o
/home/dell/Desktop/xkb-switch/XKeyboard.cpp:19:37: fatal error: X11/extensions/XKBrules.h: No such file or directory
compilation terminated.
CMakeFiles/xkb-switch.dir/build.make:86: recipe for target 'CMakeFiles/xkb-switch.dir/XKeyboard.cpp.o' failed
make[2]: *** [CMakeFiles/xkb-switch.dir/XKeyboard.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/xkb-switch.dir/all' failed
make[1]: *** [CMakeFiles/xkb-switch.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Bug when use xkb-switch in xbindkeys

Hello everyone !
I develop analog PuntoSwitcher for Windows. It is OpenSwitcher and its github here OpenSwitcher.
I faced with a problem when I use xkb-switch in xbindkeys. At first run xbindkeys key combination Ctr+Alt script run correctly but i another cases it doesnt work. Without xkb-switch xbindkeys key combination Ctr+Alt script run normaly.
Code here:

$HOME/.xbindkeysrc

# Activate OpenSwitcher
# To read about how to customise read `man xbindkeys`
# To read where is keys see #include <X11/keysym.h>
"openswitcher.sh"
Control + Alt_L

/usr/local/bin/openswitcher.sh

# sleep 0.5
xkb-switch -n
sleep 0.5
xsel | sudo openswitcher

uname -a
Linux MyDebian 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27) x86_64 GNU/Linux

layout group cannot contain digits

goodchar() precludes digits, so a group containing a digit won't be recognized.

I stumbled upon this because I defined my own keymap, to which I appended a number.

I understand that "normal people" won't encounter this bug, but perhaps it's worth mentioning this in the README for the sake of abnormal people...

How to enable C++ 11 for correct build?

How can I enable C++ 11 support for build? Is there a working version of commands cmake and/or make commands with options? I am trying to make RPM package for Rosa Linux R8, using cmake v3.5.2 and gcc v4.9.4. It seems, the simplest way is to edit CMakeLists.txt:
change CMAKE_MINIMUM_REQUIRED(VERSION 2.6) to version 3.1, and add a string (that works only for cmake 3.1 and higher) after project's name and version definition

set(CMAKE_CXX_STANDARD 11)

Doesn't recognise second group, causing range check failure

Reproduce:

  • Activate this keymap with xkbcomp my $DISPLAY
  • Switch language (alt+caps or super+menu)
  • Run ./xkb-switch

Expected:

xkb-switch/build $ ./xkb-switch
ru

Got:

xkb-switch/build $ ./xkb-switch 
xkb-switch: vector::_M_range_check: __n (which is 1) >= this->size() (which is 1)
xkb-switch: layouts: [us]

(Exit code 2)

OS: Mint 19 tara

-W flag behaves wrong

I expect it to output a name right from the start and not to wait for a change. It would be useful in i3blocks with 'persist' interval.

Regolith i3

Hello! Thank you very much for this plugin. I tried everything but this one, it seems very close to solution. I am using Regolith i3 and I tried https://github.com/zebradil/xkb-switch-i3 it tracks only window language, and doesn't track when I change language.
And the xkb-group.sh us ru shows:
trap: SIGINT: bad trap
trap: SIGTERM: bad trap
There xkb-switch v. 1.8.1

When I am trying your plugin v. 1.8.5

./xkb-switch -d
[DEBUG] xkb-switch version 1.8.5
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:110: raw layout string "us,ru,us"
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:111: raw variant string ",,"
[DEBUG] layout: us,ru,us
[DEBUG] variant: ,,
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:127: layout "us", variant ""
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:136: ... accepting with id #0
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:127: layout "ru", variant ""
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:136: ... accepting with id #1
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:127: layout "us", variant ""
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:136: ... accepting with id #2
/home/lastgosu/work/xkb-switch/src/XKeyboard.cpp:127: layout "", variant ""

./xkb-switch -l
us
ru
us

./xkb-switch -W and -w is working

./xkb-switch -n not working

Test is failing.

Thank you for any help.
Ubuntu 21.04 Regolith i3 1.6
Layouts ru-us
On Gnome Ubuntu everything is the same except the test, it is passing.

xkb-switch not switching with gnome 3.20

After a fresh install of Debian 9 (stretch), with Gnome 3.20, xkb-switch compiles and seems to run fine, but it actually does nothing:

$ xkb-switch 
'us(dvp)'
$ xkb-switch -s 'fr(bepo)'
$ xkb-switch 
'us(dvp)'
$ xkb-switch -n
$ xkb-switch 
'us(dvp)'

Here are two interesting outputs:

$ cat /etc/default/keyboard
XKBLAYOUT=us,fr,fr
XKBVARIANT=dvp,bepo,oss
BACKSPACE=guess

$ xkb-switch -l
us(dvp)
fr(bepo)
fr(latin9)
fr(oss)

.. are they not unconsistent? Could it cause a crash? Any idea what may be going wrong? It used to work just fine with Debian 8 (jessie) and Gnome 3.14.

Add option to show a fancy name of the layout

I work with typo layouts so I see 'us+typo' and 'ru:2+typo' instead of usual 'us' and 'ru'. I wrote a program that behaves like xkb-switch with -W flag but prints 'English (US)' and 'Russian'. Those names are available from the Xlib itself, you do not need to write any additional strings. Could you please add a flag for that?

Problem when installing as user

Hello, when i install it as user, i run make DESTDIR=$HOME/.local install, i get this

[ 50%] Built target xkbswitch
[ 83%] Built target xkb-switch
[100%] Built target man_xkb-switch_1
Install the project...
-- Install configuration: ""
-- Up-to-date: /home/kalium/.local/usr/local/bin/xkb-switch
-- Up-to-date: /home/kalium/.local/usr/local/lib/libxkbswitch.so.2.0.1
-- Up-to-date: /home/kalium/.local/usr/local/lib/libxkbswitch.so.2
-- Up-to-date: /home/kalium/.local/usr/local/lib/libxkbswitch.so
-- Up-to-date: /home/kalium/.local/usr/local/share/man/man1/xkb-switch.1.gz

which is strange. shouldn't it be

...
-- Up-to-date: /home/kalium/.local/bin/xkb-switch
-- Up-to-date: /home/kalium/.local/lib/libxkbswitch.so.2.0.1
-- Up-to-date: /home/kalium/.local/lib/libxkbswitch.so.2
-- Up-to-date: /home/kalium/.local/lib/libxkbswitch.so
-- Up-to-date: /home/kalium/.local/share/man/man1/xkb-switch.1.gz

is that a problem? or it should be like this?
Thanks very much

What versioning are we use

I think it's time to define versioning principles for this project. Is version number maintained only by project's owner or contributors must change it themselves? When to change release version, for each successful build or when any issue is closed? When to change minor version? Maybe when an issue closed or only when API is changed? What means the major version?

I propose to include this information into README.

Use standard C procedures for handling command-line arguments

We need replace homegrown command-line arguments parser with getopt or alike. The goal is to make xkb-switch CLI handling more standard. For example, now it doesn't process 'tightly coupled' one-letter flags, like -ld instead of -l -d. Getopt family of functions could do it.

Contributions are welcome here.

  1. Locate the loop which parses command line arguements in XKbSwitch.cpp
  2. Rewrite it using getopt family of C functions
  3. Adjust linking libraries in CMakeLists.txt if required
  4. Make sure that ./test.sh still prints OK
  5. Send me a pull request

Please, do not introduce non-standard dependencies like boost. Use stdlib C or C++ < 11 tools.

Manpage error: ignoring bogus filename

If I build and install this program from source I get the following error when running man xkb-switch.1:

  man: warning: /usr/local/man/man1/xkb-switch.1.gzip: ignoring bogus filename

I will make a pull request to fix this issue.

Bug when use xkb-switch and emulates key presses

Hello everyone, I faced with a problem when I use xkb-switch in my project OpenSwitcher I tried several tests but result shows that problem appears exactly after using xkb-switch. OpenSwitcher uses actkbd to run when Ctr_L+Alt_L combination is pesses

Test 1 in script/openswitcher.sh

#!/bin/bash
xkb-switch -n
sleep 1
xsel -o | sudo openswitcher --verbose --device "$(input-device-info.sh)"
  1. I select text "text"
  2. I press default for my program Ctr_L+Alt_L combination and it changed text to "еуче"
  3. I press second time keys combination and nothing happens.(And so on)

Result: text changed only at first time.

Test 2 in script/openswitcher.sh

#!/bin/bash
#xkb-switch -n
#sleep 1
xsel -o | sudo openswitcher --verbose --device "$(input-device-info.sh)"
  1. I select text "text"
  2. I press default for my program Ctr_L+Alt_L combination and it dont changed text (as expected) to "еуче"
  3. I press second time keys combination and it repeat case 2. If i dont select text it prints (as expected) previous text.
    Result: all (as expected) work Ok.

Issue with multiple Keyboard layout configured...

Hi,
I have an issue when I'm configuring multiple keyboard at the same time. (with only 1 keyboard, it's always ok)

Actually, I'm using xkb-switch just to know which keyboard is the ACTIVE one, but in some case it return the wrong keyboard:
Configured : German, French, US-Intl
Default one: French

xkb-switch is always giving to me the active one, even when I switch with shortcut CTRL-SHIFT... Perfect...

BUT:
Configured : German, French, US-Intl
Default one: German

kxb-switch is not correct... He is mixing French and US-Intl:
Active keyboard: German --> xkb-result : de
Active keyboard: French --> xkb-result : US-Intl
Active keyboard: US-Intl --> xkb-result : fr(winkeys)

Os: Ubuntu 10.04 / XFCE / ARM CPU

No way to set variant

I don't know how to set variant. There's no documentation on it. I'd like to use colemak_dh, but there's no way for me to specify this to xkb-switch or xkb-group.sh

Can MIT license be used instead of GPL?

GPL is too strict of a license for some purposes: many companies disallow using any GPL open-source libraries. I would like to create in the future a derived project, and I would like to use MIT license for it. But GPL does not allow to do such thing (I would have to use GPL). Is there any possibility for xkb-switch to switch to a less strict license?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.