Skip to content

Commit 599afd4

Browse files
committed
Store xkb_layout and xkb_variant in correct values
1 parent e6611ee commit 599afd4

File tree

8 files changed

+229
-18
lines changed

8 files changed

+229
-18
lines changed

debian/changelog

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
sway-input-config (1.1.3-1~kinetic) kinetic; urgency=medium
2+
3+
* Store keyboard layout and variant in
4+
correct values
5+
6+
-- Aleksey Samoilov <[email protected]> Sun, 15 Jan 2023 19:32:23 +0400
7+
8+
sway-input-config (1.1.1-1~kinetic) kinetic; urgency=medium
9+
10+
* Set app_id to "sway-input-config"
11+
12+
-- Aleksey Samoilov <[email protected]> Thu, 06 Oct 2022 12:07:03 +0400
13+
14+
sway-input-config (1.1.0-1~kinetic) kinetic; urgency=medium
15+
16+
* Use setuptools directive to install data_files
17+
* Refactoring mouse tab
18+
* Refactoring touchpad tab
19+
* Added option to set keyboard model
20+
* Fixed bunch of errors from FLAKE8
21+
22+
-- Aleksey Samoilov <[email protected]> Wed, 28 Sep 2022 10:36:58 +0400
23+
24+
sway-input-config (1.1.0-1~kinetic) kinetic; urgency=medium
25+
26+
* Use setuptools directive to install data_files
27+
* Refactoring mouse tab
28+
* Refactoring touchpad tab
29+
* Added option to set keyboard model
30+
* Fixed bunch of errors from FLAKE8
31+
32+
-- Aleksey Samoilov <[email protected]> Wed, 28 Sep 2022 10:33:25 +0400
33+
34+
sway-input-config (1.0.0-1~kinetic) kinetic; urgency=medium
35+
36+
* Initial release. (Closes: #nnnn) <nnnn is the bug number of your ITP>
37+
38+
-- Aleksey Samoilov <[email protected]> Wed, 14 Sep 2022 22:22:12 +0400

debian/control

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Source: sway-input-config
2+
Section: x11
3+
Priority: optional
4+
Maintainer: Aleksey Samoilov <[email protected]>
5+
Rules-Requires-Root: no
6+
Build-Depends:
7+
debhelper-compat (= 13), dh-python, python3-setuptools, python3
8+
Standards-Version: 4.6.1
9+
Homepage: https://github.com/Sunderland93/sway-input-config
10+
11+
Package: sway-input-config
12+
Architecture: any
13+
Depends:
14+
${python3:Depends},
15+
${misc:Depends},
16+
python3-i3ipc,
17+
python3-pyside2.qtwidgets,
18+
python3-pyside2.qtcore,
19+
python3-pyside2.qtgui
20+
Description: Input devices configurator for Sway
21+
Input devices configurator for SwayWM, written in Python and Qt5/PySide2,
22+
inspired by nwg-shell-config. It uses standard libinput options
23+
to configure keyboard, touchpad and pointer devices.

debian/copyright

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Source: <url://example.com>
3+
Upstream-Name: sway-input-config
4+
Upstream-Contact: <preferred name and address to reach the upstream project>
5+
6+
Files:
7+
*
8+
Copyright:
9+
<years> <put author's name and email here>
10+
<years> <likewise for another author>
11+
License: GPL-3.0+
12+
13+
Files:
14+
debian/*
15+
Copyright:
16+
2022 Aleksey Samoilov <[email protected]>
17+
License: GPL-3.0+
18+
19+
License: GPL-3.0+
20+
This program is free software: you can redistribute it and/or modify
21+
it under the terms of the GNU General Public License as published by
22+
the Free Software Foundation, either version 3 of the License, or
23+
(at your option) any later version.
24+
.
25+
This package is distributed in the hope that it will be useful,
26+
but WITHOUT ANY WARRANTY; without even the implied warranty of
27+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+
GNU General Public License for more details.
29+
.
30+
You should have received a copy of the GNU General Public License
31+
along with this program. If not, see <https://www.gnu.org/licenses/>.
32+
Comment:
33+
On Debian systems, the complete text of the GNU General
34+
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
35+
36+
# Please also look if there are files or directories which have a
37+
# different copyright/license attached and list them here.
38+
# Please avoid picking licenses with terms that are more restrictive than the
39+
# packaged work, as it may make Debian's contributions unacceptable upstream.
40+
#
41+
# If you need, there are some extra license texts available in two places:
42+
# /usr/share/debhelper/dh_make/licenses/
43+
# /usr/share/common-licenses/

debian/files

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sway-input-config_1.1.1-1~kinetic_source.buildinfo x11 optional

debian/rules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/make -f
2+
3+
%:
4+
dh $@ --with python3 --buildsystem=pybuild

debian/source/format

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

sway_input_config/data/layouts.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"English (US)": "us",
3+
"Dari": "af",
4+
"Arabic": "ara",
5+
"Albanian": "al",
6+
"Armenian": "am",
7+
"German (Austria)": "at",
8+
"English (Australian)": "au",
9+
"Azerbaijani": "az",
10+
"Belarusian": "by",
11+
"Belgian": "be",
12+
"Bangla": "bd",
13+
"Indian": "in",
14+
"Bosnian": "ba",
15+
"Portuguese (Brazil)": "br",
16+
"Bulgarian": "bg",
17+
"Berber (Algeria, Latin)": "dz",
18+
"Arabic (Morocco)": "ma",
19+
"English (Cameroon)": "cm",
20+
"Burmese": "mm",
21+
"French (Canada)": "ca",
22+
"French (Democratic Republic of the Congo)": "cd",
23+
"Chinese": "cn",
24+
"Croatian": "hr",
25+
"Czech": "cz",
26+
"Danish": "dk",
27+
"Dutch": "nl",
28+
"Dzongkha": "bt",
29+
"Estonian": "ee",
30+
"Persian": "ir",
31+
"Iraqi": "iq",
32+
"Faroese": "fo",
33+
"Finnish": "fi",
34+
"French": "fr",
35+
"English (Ghana)": "gh",
36+
"N'Ko (AZERTY)": "gn",
37+
"Georgian": "ge",
38+
"German": "de",
39+
"Greek": "gr",
40+
"Hungarian": "hu",
41+
"Icelandic": "is",
42+
"Hebrew": "il",
43+
"Italian": "it",
44+
"Japanese": "jp",
45+
"Kyrgyz": "kg",
46+
"Khmer (Cambodia)": "kh",
47+
"Kazakh": "kz",
48+
"Lao": "la",
49+
"Spanish (Latin American)": "latam",
50+
"Lithuanian": "lt",
51+
"Latvian": "lv",
52+
"Maori": "mao",
53+
"Montenegrin": "me",
54+
"Macedonian": "mk",
55+
"Maltese": "mt",
56+
"Mongolian": "mn",
57+
"Norwegian": "no",
58+
"Polish": "pl",
59+
"Portuguese": "pt",
60+
"Romanian": "ro",
61+
"Russian": "ru",
62+
"Serbian": "rs",
63+
"Slovenian": "si",
64+
"Slovak": "sk",
65+
"Spanish": "es",
66+
"Swedish": "se",
67+
"German (Switzerland)": "ch",
68+
"Arabic (Syria)": "sy",
69+
"Tajik": "tj",
70+
"Sinhala (phonetic)": "lk",
71+
"Thai": "th",
72+
"Turkish": "tr",
73+
"Taiwanese": "tw",
74+
"Ukrainian": "ua",
75+
"English (UK)": "gb",
76+
"Uzbek": "uz",
77+
"Vietnamese": "vn",
78+
"Korean": "kr",
79+
"Irish": "ie",
80+
"Urdu (Pakistan)": "pk",
81+
"Dhivehi": "mv",
82+
"English (South Africa)": "za",
83+
"Esperanto": "epo",
84+
"Nepali": "np",
85+
"English (Nigeria)": "ng",
86+
"Amharic": "et",
87+
"Wolof": "sn",
88+
"Braille": "brai",
89+
"Turkmen": "tm",
90+
"Bambara": "ml",
91+
"Swahili (Tanzania)": "tz",
92+
"French (Togo)": "tg",
93+
"Swahili (Kenya)": "ke",
94+
"Tswana": "bw",
95+
"Filipino": "ph",
96+
"Moldavian": "md",
97+
"Indonesian (Latin)": "id",
98+
"Indonesian (Javanese)": "jv",
99+
"Malay (Jawi, Arabic Keyboard)": "my"
100+
}

sway_input_config/main.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,7 @@
2525
dir_name = os.path.dirname(__file__)
2626
shortcut_list = os.path.join(dir_name, "data/shortcuts.json")
2727
kbd_model_list = os.path.join(dir_name, "data/kbd_model.json")
28-
29-
layout_list = ["af", "al", "am", "ara", "at", "au", "az", "ba", "bd", "be", "bg",
30-
"br", "brai", "bt", "bw", "by", "ca", "cd", "ch", "cm", "cn", "cz",
31-
"de", "dk", "dz", "ee", "epo", "es", "et", "fi", "fo", "fr", "gb",
32-
"ge", "gh", "gn", "gr", "hr", "hu", "id", "ie", "il", "in", "iq", "ir",
33-
"is", "it", "jp", "jv", "ke", "kg", "kh", "kr", "kz", "la", "latam",
34-
"lk", "lt", "lv", "ma", "mao", "md", "me", "mk", "ml", "mm", "mn", "mt",
35-
"mv", "my", "ng", "nl", "no", "np", "ph", "pk", "pl", "pt", "ro", "rs",
36-
"ru", "se", "si", "sk", "sn", "sy", "tg", "th", "tj", "tm", "tr", "tw",
37-
"tz", "ua", "us", "uz", "vn", "za"]
28+
layouts_list = os.path.join(dir_name, "data/layouts.json")
3829

3930

4031
class MainWindow(QMainWindow):
@@ -139,12 +130,17 @@ def __init__(self):
139130

140131
self.layoutList = QComboBox()
141132
self.layoutList.setStyleSheet("QComboBox { combobox-popup: 0; }")
142-
for item in layout_list:
143-
self.layoutList.addItem(item)
133+
layout = load_json(layouts_list)
134+
for key, value in layout.items():
135+
self.layoutList.addItem(key)
144136

145137
self.layoutName = QLineEdit()
146138
self.layoutLabel = QLabel("Layout:")
147-
self.layoutName.setText(settings["keyboard-layout"])
139+
layout = load_json(layouts_list)
140+
layout_list = []
141+
for key, value in layout.items():
142+
layout_list.append('{}'.format(','.join(settings["keyboard-layout"])))
143+
self.layoutName.setText(layout_list[0])
148144

149145
self.addBtn = QPushButton("Add")
150146
self.addBtn.setToolTip("Add selected layout to the list")
@@ -154,7 +150,9 @@ def __init__(self):
154150
self.labelVariant = QLabel("Variant:")
155151
self.variantName.setToolTip("Variant of the keyboard like 'dvorak' or 'colemak'.")
156152
self.variantName.setMaxLength(30)
157-
self.variantName.setText(settings["keyboard-variant"])
153+
variant_list = []
154+
variant_list.append('{}'.format(','.join(settings["keyboard-variant"])))
155+
self.variantName.setText(variant_list[0])
158156
self.variantName.textChanged.connect(self.on_variant_changed)
159157

160158
self.shortcutName = QComboBox()
@@ -271,9 +269,12 @@ def set_model(self):
271269
settings["keyboard-model"] = model_data[self.kbdModel.currentText()]
272270

273271
def add_layout(self):
272+
layout_data = load_json(layouts_list)
274273
layout = self.layoutList.currentText()
275-
self.layoutName.insert(",")
276-
self.layoutName.insert(layout)
274+
for key, value in layout_data.items():
275+
if key in layout:
276+
self.layoutName.insert(",")
277+
self.layoutName.insert(value)
277278
settings["keyboard-layout"] = self.layoutName.text()
278279

279280
def on_variant_changed(self):
@@ -683,9 +684,9 @@ def save_to_config():
683684

684685
lines = ['input "type:keyboard" {']
685686
if settings["keyboard-layout"]:
686-
lines.append(' xkb_layout {}'.format(settings["keyboard-layout"]))
687+
lines.append(' xkb_layout {}'.format(','.join(settings["keyboard-layout"])))
687688
if settings["keyboard-variant"]:
688-
lines.append(' xkb_variant {}'.format(settings["keyboard-variant"]))
689+
lines.append(' xkb_variant {}'.format(','.join(settings["keyboard-variant"])))
689690
if settings["keyboard-shortcut"]:
690691
lines.append(' xkb_options {}'.format(settings["keyboard-shortcut"]))
691692
lines.append(' xkb_model {}'.format(settings["keyboard-model"]))

0 commit comments

Comments
 (0)