Skip to content

Commit

Permalink
minor improvements to kalamine watch
Browse files Browse the repository at this point in the history
  • Loading branch information
fabi1cazenave committed Feb 24, 2024
1 parent f509d85 commit e6cafdd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ jobs:
python -m kalamine.cli build layouts/*.toml
python -m kalamine.cli new test.toml
pytest
- name: Run black
run: black kalamine
run: black kalamine --check

- name: Run isort
run: isort kalamine
run: isort kalamine --check

- name: Run ruff
run: ruff kalamine

- name: Run mypy
run: mypy kalamine
8 changes: 5 additions & 3 deletions kalamine/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,19 @@ def send(

# XXX always reloads the layout on the root page, never in sub pages
nonlocal kb_layout
if self.path == "/json":
if self.path == "/favicon.ico":
pass
elif self.path == "/json":
send(json.dumps(kb_layout.json), content="application/json")
elif self.path == "/keylayout":
# send(kb_layout.keylayout, content='application/xml')
send(kb_layout.keylayout)
elif self.path == "/klc":
send(kb_layout.klc, charset="utf-16-le")
send(kb_layout.klc, charset="utf-16-le", content="text")
elif self.path == "/xkb_keymap":
send(kb_layout.xkb_keymap)
elif self.path == "/xkb_symbols":
send(kb_layout.xkb_symbols)
send(kb_layout.xkb_symbols.replace("//#", "//"))
elif self.path == "/":
kb_layout = KeyboardLayout(load_layout(file_path)) # refresh
send(main_page(kb_layout), content="text/html")
Expand Down
2 changes: 1 addition & 1 deletion kalamine/tpl/base.xkb_symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//# This XKB symbols file should be copied to:
//# /usr/share/X11/xkb/symbols/custom
//# or
//# $XKB_CONFIG_ROOT/xkb/symbols/custom
//# $XKB_CONFIG_ROOT/symbols/custom
//#
//# File : ${fileName}.xkb_symbols
// Project page : ${url}
Expand Down
2 changes: 1 addition & 1 deletion kalamine/tpl/full.xkb_symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//# This XKB symbols file should be copied to:
//# /usr/share/X11/xkb/symbols/custom
//# or
//# $XKB_CONFIG_ROOT/xkb}/symbols/custom
//# $XKB_CONFIG_ROOT/symbols/custom
//#
//# File : ${fileName}.xkb_symbols
// Project page : ${url}
Expand Down
2 changes: 1 addition & 1 deletion kalamine/tpl/full_1dk.xkb_symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//# This XKB symbols file should be copied to:
//# /usr/share/X11/xkb/symbols/custom
//# or
//# $XKB_CONFIG_ROOT/xkb/symbols/custom
//# $XKB_CONFIG_ROOT/symbols/custom
//#
//# File : ${fileName}.xkb_symbols
// Project page : ${url}
Expand Down

0 comments on commit e6cafdd

Please sign in to comment.