Skip to content

Commit 92ba7d9

Browse files
committed
Initial upload
0 parents  commit 92ba7d9

17 files changed

+1438
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/sway_input_config.egg-info/
2+
/build/
3+
/dist/

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Sway Input Configurator
2+
3+
Input devices configurator for [SwayWM](https://swaywm.org/), written in Python and Qt5/PySide2, inspired by [nwg-shell-config](https://github.com/nwg-piotr/nwg-shell-config). It uses standard [libinput](https://www.mankier.com/5/sway-input) options to configure keyboard, touchpad and pointer devices.
4+
5+
![Keyboard settings](https://github.com/Sunderland93/sway-input-config/blob/master/screenshot1.png?raw=true)
6+
7+
![Mouse settings](https://github.com/Sunderland93/sway-input-config/blob/master/screenshot2.png?raw=true)
8+
9+
![Touchpad settings](https://github.com/Sunderland93/sway-input-config/blob/master/screenshot3.png?raw=true)
10+
11+
## Installation:
12+
13+
#### Dependencies (Debian/Ubuntu):
14+
* python3
15+
* python3-pyside2.qtwidgets
16+
* python3-pyside2.qtcore
17+
* python3-pyside2.qtgui
18+
* python3-setuptools
19+
* python3-i3ipc
20+
21+
`git clone https://github.com/Sunderland93/sway-input-config.git`
22+
`cd sway-input-config && sudo ./install.sh`
23+
24+
Add the following lines to your Sway config (usually in `~/.config/sway/config`):
25+
26+
```text
27+
include keyboard
28+
include pointer
29+
include touchpad # if you don't have a touchpad, don't add this line
30+
```
31+
32+
## Settings:
33+
34+
Configuration file is located in `~/.config/sway-input-config/settings`. It's a JSON-file:
35+
```json
36+
{
37+
"keyboard-layout": "us",
38+
"keyboard-variant": "",
39+
"keyboard-shortcut": "",
40+
"keyboard-repeat-delay": 300,
41+
"keyboard-repeat-rate": 40,
42+
"keyboard-capslock": "disabled",
43+
"keyboard-numlock": "disabled",
44+
"pointer-accel-profile": "flat",
45+
"pointer-pointer-accel": 0.0,
46+
"pointer-natural-scroll": "disabled",
47+
"pointer-scroll-factor": 1.0,
48+
"pointer-left-handed": "disabled",
49+
"touchpad-accel-profile": "flat",
50+
"touchpad-pointer-accel": 0.0,
51+
"touchpad-natural-scroll": "disabled",
52+
"touchpad-scroll-factor": 1.0,
53+
"touchpad-scroll-method": "two_finger",
54+
"touchpad-left-handed": "disabled",
55+
"touchpad-tap": "enabled",
56+
"touchpad-tap-button-map": "lrm",
57+
"touchpad-drag": "enabled",
58+
"touchpad-drag-lock": "disabled",
59+
"touchpad-dwt": "enabled",
60+
"touchpad-middle-emulation": "enabled"
61+
}
62+
```
63+
If **settings** file is corrupted or missing, Sway Input Configurator will use the default settings and recreate **settings** file. Config files for keyboard, touchpad and mouse is located in `~/.config/sway/` (`keyboard`, `touchpad` and `pointer` respectively).

install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
python3 setup.py install --optimize=1
4+
cp sway-input-config.desktop /usr/share/applications/
5+
cp sway-input-config.svg /usr/share/pixmaps/

screenshot1.png

27.8 KB
Loading

screenshot2.png

24.8 KB
Loading

screenshot3.png

38.4 KB
Loading

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from importlib.metadata import entry_points
2+
from setuptools import setup, find_packages
3+
4+
setup(
5+
name='sway-input-config',
6+
version='1.0.0',
7+
description='input devices configurator for sway',
8+
license='GPL-3',
9+
author='Aleksey Samoilov',
10+
author_email='[email protected]',
11+
url='https://github.com/Sunderland93/sway-input-config',
12+
packages=find_packages(),
13+
include_package_data=True,
14+
package_data={"": ["data/*"]},
15+
install_requires=[],
16+
entry_points={
17+
'gui_scripts': [
18+
'sway-input-config = sway_input_config.main:main'
19+
]
20+
}
21+
)

sway-input-config.desktop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Sway Input Configurator
4+
Comment=Tool to configure input devices on Sway
5+
Exec=sway-input-config
6+
Icon=sway-input-config
7+
Terminal=false
8+
Categories=Settings;DesktopSettings;

sway-input-config.svg

Lines changed: 1 addition & 0 deletions
Loading

sway_input_config/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

sway_input_config/data/defaults.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"keyboard-layout": "us",
3+
"keyboard-variant": "",
4+
"keyboard-shortcut": "",
5+
"keyboard-repeat-delay": 300,
6+
"keyboard-repeat-rate": 40,
7+
"keyboard-capslock": "disabled",
8+
"keyboard-numlock": "disabled",
9+
"pointer-accel-profile": "flat",
10+
"pointer-pointer-accel": 0.0,
11+
"pointer-natural-scroll": "disabled",
12+
"pointer-scroll-factor": 1.0,
13+
"pointer-left-handed": "disabled",
14+
"touchpad-accel-profile": "flat",
15+
"touchpad-pointer-accel": 0.0,
16+
"touchpad-natural-scroll": "disabled",
17+
"touchpad-scroll-factor": 1.0,
18+
"touchpad-scroll-method": "two_finger",
19+
"touchpad-left-handed": "disabled",
20+
"touchpad-tap": "enabled",
21+
"touchpad-tap-button-map": "lrm",
22+
"touchpad-drag": "enabled",
23+
"touchpad-drag-lock": "disabled",
24+
"touchpad-dwt": "enabled",
25+
"touchpad-middle-emulation": "enabled"
26+
}

sway_input_config/data/logo_sic.png

4.92 KB
Loading

sway_input_config/data/shortcuts.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"Right Alt (while pressed)": "grp:switch",
3+
"Left Alt (while pressed)": "grp:lswitch",
4+
"Left Win (while pressed)": "grp:lwin_switch",
5+
"Right Win (while pressed)": "grp:rwin_switch",
6+
"Any Win (while pressed)": "grp:win_switch",
7+
"Menu (while pressed), Shift+Menu for Menu": "grp:menu_switch",
8+
"Right Ctrl (while pressed)": "grp:rctrl_switch",
9+
"Right Alt": "grp:toggle",
10+
"Left Alt": "grp:lalt_toggle",
11+
"Caps Lock": "grp:caps_toggle",
12+
"Shift+Caps Lock": "grp:shift_caps_toggle",
13+
"Alt+Caps Lock": "grp:alt_caps_toggle",
14+
"Both Shift together": "grp:shifts_toggle",
15+
"Both Alt together": "grp:alts_toggle",
16+
"Both Ctrl together": "grp:ctrls_toggle",
17+
"Ctrl+Shift": "grp:ctrl_shift_toggle",
18+
"Left Ctrl+Left Shift": "grp:lctrl_lshift_toggle",
19+
"Right Ctrl+Right Shift": "grp:rctrl_rshift_toggle",
20+
"Alt+Ctrl": "grp:ctrl_alt_toggle",
21+
"Alt+Shift": "grp:alt_shift_toggle",
22+
"Left Alt+Left Shift": "grp:lalt_lshift_toggle",
23+
"Alt+Space": "grp:alt_space_toggle",
24+
"Menu": "grp:menu_toggle",
25+
"Left Win": "grp:lwin_toggle",
26+
"Win+Space": "grp:win_space_toggle",
27+
"Right Win": "grp:rwin_toggle",
28+
"Left Shift": "grp:lshift_toggle",
29+
"Right Shift": "grp:rshift_toggle",
30+
"Left Ctrl": "grp:lctrl_toggle",
31+
"Right Ctrl": "grp:rctrl_toggle",
32+
"Scroll Lock": "grp:sclk_toggle",
33+
"Left Ctrl+Left Win": "grp:lctrl_lwin_toggle"
34+
}

0 commit comments

Comments
 (0)