Skip to content

Commit 60e4a77

Browse files
authored
Merge pull request #15 from grafov/sway-support
Add support for Wayland/Sway
2 parents c2fe955 + 3047823 commit 60e4a77

File tree

10 files changed

+396
-164
lines changed

10 files changed

+396
-164
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.PHONY: build
2+
build:
3+
go build -compiler gccgo -gccgoflags "-lX11" shift-shift.go

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ What is it and why?
22
===================
33

44
This utility allows you switch keyboard groups in X Window in the most
5-
ergonomic way (in my view :).
5+
ergonomic way (in my view :).
66
I think keys for switching keyboard layouts should be:
77

88
1. Dedicated.
@@ -29,7 +29,7 @@ keys. But when you press Shift with other keys then it applied as
2929
modifier key.
3030

3131
I not found out of the box solution how to setup X to use Shifts as
32-
standalone keys. Also I used two keyboards in same time (notebok internal and USB plugged)
32+
standalone keys. Also I used two keyboards in same time (notebok internal and USB plugged)
3333
and was need to switch layouts on both of them. So I wrote this utility.
3434

3535
So `shift-shift` has features:
@@ -38,7 +38,15 @@ So `shift-shift` has features:
3838
* RShift pressed standalone locks X to group2 layout
3939
* Layout switched on all keyboards simultaneously
4040

41-
You need customize layout groups in your X config or with `setxkbmap`.
41+
You need customize layout groups in your X to
42+
43+
44+
45+
46+
47+
48+
49+
cconfig or with `setxkbmap`.
4250

4351
About code
4452
==========
@@ -56,25 +64,25 @@ Install
5664

5765
Binding of `evdev` for Go used so before build you need:
5866

59-
go get github.com/gvalkov/golang-evdev/evdev
67+
go get github.com/gvalkov/golang-evdev/evdev
6068

6169
Then as usual:
6270

63-
go build
71+
go build
6472

65-
Of course you need Go environment installed for build.
73+
Of course you need Go environment installed for build.
6674
And as program uses Xlib through cgo interface then you need `xlib-devel`
6775
installed.
6876

6977
Usage
7078
=====
7179

72-
$ sudo shift-shift -h
73-
Usage of shift-shift:
74-
-list=false: list all devices listened by evdev
75-
-match="keyboard": string used to match keyboard device
76-
-print=false: print pressed keys
77-
-quiet=false: be silent
80+
$ sudo shift-shift -h
81+
Usage of shift-shift:
82+
-list=false: list all devices listened by evdev
83+
-match="keyboard": string used to match keyboard device
84+
-print=false: print pressed keys
85+
-quiet=false: be silent
7886

7987
On start program find devices where name contains "keyboard" string. It assume there
8088
are keyboard devices. You may customize this by set your own string with `-match` arg.
@@ -85,9 +93,13 @@ Got list of all input devices with `list` arg.
8593
For autostart run it somewhere after X started with your account. I use `~/.bash_profile` for
8694
this.
8795

88-
sudo pidof shift-shift >/dev/null || sudo shift-shift -quiet >/dev/null &
96+
sudo pidof shift-shift >/dev/null || sudo shift-shift -quiet >/dev/null &
8997

9098
Thanks
9199
======
92100

93101
Thanks to people who contributed bugfixes and improvements for `shift-shift`.
102+
103+
104+
todo add ref to
105+
https://github.com/nmukhachev/sway-xkb-switcher

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/grafov/shift-shift
2+
3+
go 1.20
4+
5+
require github.com/gvalkov/golang-evdev v0.0.0-20220815104727-7e27d6ce89b6

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/gvalkov/golang-evdev v0.0.0-20220815104727-7e27d6ce89b6 h1:K9b8efT9f1NkITNgNAm2A1LuoamhG4pAhXVjz5Sfa5Q=
2+
github.com/gvalkov/golang-evdev v0.0.0-20220815104727-7e27d6ce89b6/go.mod h1:SAzVFKCRezozJTGavF3GX8MBUruETCqzivVLYiywouA=

0 commit comments

Comments
 (0)