mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-06 19:08:27 +02:00
Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3389c512e2 | ||
![]() |
f3ab1e043b | ||
![]() |
78e537ac71 | ||
![]() |
997d2dd39f | ||
![]() |
39c40bc315 | ||
![]() |
16f8b237d5 | ||
![]() |
7013d81686 | ||
![]() |
87ca8e7566 | ||
![]() |
0e4160622f | ||
![]() |
564360e9fa | ||
![]() |
91e692c76b | ||
![]() |
6c46696bd4 | ||
![]() |
40c8d20513 | ||
![]() |
6b6e448e76 | ||
![]() |
f73a2c8420 | ||
![]() |
153c5e7b91 | ||
![]() |
548e248515 | ||
![]() |
4a51232b9d | ||
![]() |
4da8f97bf7 | ||
![]() |
bfd363107d | ||
![]() |
6a2948e8a5 | ||
![]() |
16d5531035 | ||
![]() |
5870f6b987 | ||
![]() |
fd2234fae4 |
123
README.md
123
README.md
@@ -1,11 +1,11 @@
|
|||||||
# Kinto
|
# Kinto
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://github.com/rbreaves/kinto/releases/latest)
|
[](https://github.com/rbreaves/kinto/releases/latest)
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
\- Type in Linux like it's a Mac. \-
|
\- Type in Linux like it's a Mac. \-
|
||||||
|
|
||||||
Seamless copy and paste with all apps and terminals. Also the only linux remapper that is aware of your cursor/caret status - meaning it avoids shortcut conflicts within an app versus wordwise shortcuts when a text field is in use.
|
Seamless copy and paste with all apps and terminals. Also the only linux remapper that is aware of your cursor/caret status - meaning it avoids shortcut conflicts within an app versus wordwise shortcuts when a text field is in use.
|
||||||
@@ -14,9 +14,9 @@ Seamless copy and paste with all apps and terminals. Also the only linux remappe
|
|||||||
|
|
||||||
Kinto works for standard Windows, Apple and Chromebook keyboards. The following however describes the dynamic rebinding based on a standard Windows keyboard. (Alt location is Cmd for Apple keyboards)
|
Kinto works for standard Windows, Apple and Chromebook keyboards. The following however describes the dynamic rebinding based on a standard Windows keyboard. (Alt location is Cmd for Apple keyboards)
|
||||||
|
|
||||||
- Normal apps - Alt will be Ctrl, Win/Super will be Alt, Ctrl will be Win/Super
|
- Normal apps - Alt → Ctrl, Win/Super → Alt, Ctrl → Win/Super
|
||||||
|
|
||||||
- Terminal apps - Alt will be Ctrl+Shift, Win/Super will be Alt, Ctrl will be Ctrl
|
- Terminal apps - Alt → Ctrl+Shift, Win/Super → Alt, Ctrl → Ctrl
|
||||||
|
|
||||||
- Cursor/word-wise shortcut keys have been added to align with macOS keyboard shortcuts.
|
- Cursor/word-wise shortcut keys have been added to align with macOS keyboard shortcuts.
|
||||||
|
|
||||||
@@ -28,13 +28,11 @@ Kinto works for standard Windows, Apple and Chromebook keyboards. The following
|
|||||||
- IBus*
|
- IBus*
|
||||||
- Fedora/RHEL/Manjaro/Arch/Debian/Ubuntu based distro 16.04+
|
- Fedora/RHEL/Manjaro/Arch/Debian/Ubuntu based distro 16.04+
|
||||||
|
|
||||||
If you need kintox11 recompiled for your distro please let me know and I will add a binary for your distro if my binary fails.
|
Binary is included and will be installed, but you can also compile kintox11.c on your system. You will need to compile and install json-c first as its libraries will be required to compile and run the program.
|
||||||
|
|
||||||
You can also attempt to compile kintox11.c on your system as well, but you will need to compile and install json-c first as its libraries will be required to compile and run the program.
|
|
||||||
|
|
||||||
*IBus is needed to support wordwise during browser app usage as the keymap will need to change slightly depending if the cursor/caret is on screen waiting for input. Setup.py will set it but you can manually set it as well or check your current Input Method.
|
*IBus is needed to support wordwise during browser app usage as the keymap will need to change slightly depending if the cursor/caret is on screen waiting for input. Setup.py will set it but you can manually set it as well or check your current Input Method.
|
||||||
|
|
||||||
To confirm navigate to your "Language Support" and set "Keyboard input method system:" to IBus for full word-wise support with web browsers.
|
On most distros you can confirm navigate to your "Language Support" and set "Keyboard input method system:" to IBus for full word-wise support with web browsers.
|
||||||
|
|
||||||
Wayland support is planned, but not ready yet.
|
Wayland support is planned, but not ready yet.
|
||||||
|
|
||||||
@@ -63,6 +61,71 @@ To Uninstall Kinto
|
|||||||
./uninstall.sh
|
./uninstall.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Other Notes Related to Install
|
||||||
|
|
||||||
|
**Manjaro with Gnome there are issues.**
|
||||||
|
|
||||||
|
Please see this ticket for more information.
|
||||||
|
|
||||||
|
https://github.com/rbreaves/kinto/issues/59
|
||||||
|
|
||||||
|
https://wiki.archlinux.org/index.php/IBus
|
||||||
|
|
||||||
|
**For other Arch based distros.**
|
||||||
|
|
||||||
|
Append the following and logoff and back on, but only after running setup.py to install all packages and the kinto service. Please report if there are any difficulties.
|
||||||
|
nano ~/.bashrc
|
||||||
|
```
|
||||||
|
export GTK_IM_MODULE=xim
|
||||||
|
export XMODIFIERS=@im=ibus
|
||||||
|
export QT_IM_MODULE=xim
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to Upgrade Kinto
|
||||||
|
|
||||||
|
Simply bring down the latest in either the master branch or dev, but dev is sometimes in flux as new features are being developed. Then you can re-run the setup.py installer, it will stop the service and re-install Kinto.
|
||||||
|
|
||||||
|
Note: If you have made any custom changes to ~/.xkb or ~/.config/kinto then you will need to backup or rename those directories before running an update.
|
||||||
|
|
||||||
|
```
|
||||||
|
git pull origin master
|
||||||
|
./setup.py
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to Control Kinto
|
||||||
|
|
||||||
|
Under systemd this is how you control Kinto.
|
||||||
|
|
||||||
|
Status
|
||||||
|
```
|
||||||
|
systemctl --user status keyswap
|
||||||
|
```
|
||||||
|
|
||||||
|
Stop (your keymap will return to normal)
|
||||||
|
```
|
||||||
|
systemctl --user stop keyswap
|
||||||
|
```
|
||||||
|
|
||||||
|
Start
|
||||||
|
```
|
||||||
|
systemctl --user start keyswap
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart
|
||||||
|
```
|
||||||
|
systemctl --user restart keyswap
|
||||||
|
```
|
||||||
|
|
||||||
|
Enable
|
||||||
|
```
|
||||||
|
systemctl --user enable keyswap
|
||||||
|
```
|
||||||
|
|
||||||
|
Disable
|
||||||
|
```
|
||||||
|
systemctl --user disable keyswap
|
||||||
|
```
|
||||||
|
|
||||||
## How to Add Setxkbmap Option inside Kinto
|
## How to Add Setxkbmap Option inside Kinto
|
||||||
|
|
||||||
To summarize you'll need to pull the partial out of the symbols file the option resides in and then add that to the mac_gui file and lastly reference it in the keymap file(s) you want it in.
|
To summarize you'll need to pull the partial out of the symbols file the option resides in and then add that to the mac_gui file and lastly reference it in the keymap file(s) you want it in.
|
||||||
@@ -354,40 +417,6 @@ You can also add additional Desktop Environment related tweaks to user_config.js
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to Control Kinto
|
|
||||||
|
|
||||||
Under systemd this is how you control Kinto.
|
|
||||||
|
|
||||||
Status
|
|
||||||
```
|
|
||||||
systemctl --user status keyswap
|
|
||||||
```
|
|
||||||
|
|
||||||
Stop (your keymap will return to normal)
|
|
||||||
```
|
|
||||||
systemctl --user stop keyswap
|
|
||||||
```
|
|
||||||
|
|
||||||
Start
|
|
||||||
```
|
|
||||||
systemctl --user start keyswap
|
|
||||||
```
|
|
||||||
|
|
||||||
Restart
|
|
||||||
```
|
|
||||||
systemctl --user restart keyswap
|
|
||||||
```
|
|
||||||
|
|
||||||
Enable
|
|
||||||
```
|
|
||||||
systemctl --user enable keyswap
|
|
||||||
```
|
|
||||||
|
|
||||||
Disable
|
|
||||||
```
|
|
||||||
systemctl --user disable keyswap
|
|
||||||
```
|
|
||||||
|
|
||||||
## Learning macOS style hotkeys on Linux
|
## Learning macOS style hotkeys on Linux
|
||||||
|
|
||||||
You can use websites like https://www.shortcutfoo.com in Google Chrome while using the terminal style keymap, but Firefox is not compatible due to detecting "cmd" as keycode 224. Chrome detects Win/Super/Cmd as keycode 91 on all OS's.
|
You can use websites like https://www.shortcutfoo.com in Google Chrome while using the terminal style keymap, but Firefox is not compatible due to detecting "cmd" as keycode 224. Chrome detects Win/Super/Cmd as keycode 91 on all OS's.
|
||||||
@@ -452,6 +481,16 @@ cd ~/.config/kinto
|
|||||||
./kintox11
|
./kintox11
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Debug
|
||||||
|
|
||||||
|
If all else fails you can now run Kinto in debug mode as of 1.0.6-2. The output will become more verbose and I'd recommend running this directly after stopping the service.
|
||||||
|
|
||||||
|
```
|
||||||
|
systemctl --user stop keyswap
|
||||||
|
cd ~/.config/kinto
|
||||||
|
./kintox11 --debug
|
||||||
|
```
|
||||||
|
|
||||||
## Language Support
|
## Language Support
|
||||||
I'd appreciate any help from people with non-US based keyboards, to help ensure that these keymaps and keyswap methods work in all or most languages.
|
I'd appreciate any help from people with non-US based keyboards, to help ensure that these keymaps and keyswap methods work in all or most languages.
|
||||||
|
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
"type":"windows",
|
"type":"windows",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Standard Windows 104 Keyboards",
|
"description":"Standard Windows 104 Keyboards",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
"term":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"xkb_symbols_gui":"+altwin(ctrl_alt_win)+mac_gui(mac_levelssym)",
|
"xkb_symbols_gui":"+altwin(ctrl_alt_win)+mac_gui(mac_levelssym)",
|
||||||
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term(mac_win)+mac_term(mac_global)",
|
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term(mac_win)+mac_term(mac_global)",
|
||||||
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
"type":"mac",
|
"type":"mac",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Standard Mac Keyboards with Apple driver",
|
"description":"Standard Mac Keyboards with Apple driver",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
"term":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"xkb_symbols_gui":"+altwin(ctrl_alt_win)+mac_gui(mac_levelssym)",
|
"xkb_symbols_gui":"+altwin(ctrl_alt_win)+mac_gui(mac_levelssym)",
|
||||||
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term(mac_win)+mac_term(mac_global)",
|
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term(mac_win)+mac_term(mac_global)",
|
||||||
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
"type":"mac",
|
"type":"mac",
|
||||||
"active": true,
|
"active": true,
|
||||||
"description":"Standard Mac Keyboards",
|
"description":"Standard Mac Keyboards",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
"term":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"xkb_symbols_gui":"+ctrl(swap_lwin_lctl)+ctrl(swap_rwin_rctl)+mac_gui(mac_levelssym)",
|
"xkb_symbols_gui":"+ctrl(swap_lwin_lctl)+ctrl(swap_rwin_rctl)+mac_gui(mac_levelssym)",
|
||||||
"xkb_symbols_term":"+altwin(alt_super_win)+mac_term(mac_apple)+mac_term(mac_global)",
|
"xkb_symbols_term":"+altwin(alt_super_win)+mac_term(mac_apple)+mac_term(mac_global)",
|
||||||
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
||||||
@@ -49,8 +49,8 @@
|
|||||||
"type":"chromebook",
|
"type":"chromebook",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Standard Chromebook Keyboards",
|
"description":"Standard Chromebook Keyboards",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
"term":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
|
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
|
||||||
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
|
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
|
||||||
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
||||||
@@ -62,9 +62,9 @@
|
|||||||
"type":"chromebook",
|
"type":"chromebook",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Chromebook with Windows 104 Keyboard",
|
"description":"Chromebook with Windows 104 Keyboard",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY; setxkbmap -device $usbid -option altwin:ctrl_alt_win",
|
"gui":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY 2>&1 | grep -v XF86FullScreen; setxkbmap -device $usbid -option altwin:ctrl_alt_win",
|
||||||
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
"term":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"fallbackgui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"fallbackgui":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
|
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
|
||||||
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
|
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
|
||||||
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
||||||
@@ -76,8 +76,8 @@
|
|||||||
"type":"chromebook",
|
"type":"chromebook",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Chromebook with Mac Keyboard",
|
"description":"Chromebook with Mac Keyboard",
|
||||||
"gui":"setxkbmap -option;setxkbmap -option ctrl:swap_lwin_lctl; xkbcomp -w0 -i $internalid -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"setxkbmap -option ctrl:swap_lwin_lctl; xkbcomp -w0 -i $internalid -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
"term":"xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY 2>&1 | grep -v XF86FullScreen",
|
||||||
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
|
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
|
||||||
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
|
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
|
||||||
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
"xkb_types_gui":"+mac_gui(addmac_levels)",
|
||||||
|
@@ -8,6 +8,7 @@ mkdir -p ~/.config/systemd/user
|
|||||||
mkdir -p ~/.config/autostart
|
mkdir -p ~/.config/autostart
|
||||||
cp ./system-config/keyswap.service ~/.config/systemd/user/keyswap.service
|
cp ./system-config/keyswap.service ~/.config/systemd/user/keyswap.service
|
||||||
cp ./system-config/kinto.desktop ~/.config/autostart/kinto.desktop
|
cp ./system-config/kinto.desktop ~/.config/autostart/kinto.desktop
|
||||||
|
cp ./system-config/keyswap.timer ~/.config/systemd/user/keyswap.timer
|
||||||
cp ./kintox11/binary/kintox11 ~/.config/kinto/kintox11
|
cp ./kintox11/binary/kintox11 ~/.config/kinto/kintox11
|
||||||
cp ./system-config/xactive.sh ~/.config/kinto/xactive.sh
|
cp ./system-config/xactive.sh ~/.config/kinto/xactive.sh
|
||||||
cp ./system-config/caret_status.sh ~/.config/kinto/caret_status.sh
|
cp ./system-config/caret_status.sh ~/.config/kinto/caret_status.sh
|
||||||
@@ -15,10 +16,11 @@ cp ./system-config/cleanup.sh ~/.config/kinto/cleanup.sh
|
|||||||
cp ./system-config/.firefox-nw ~/.config/kinto/.firefox-nw
|
cp ./system-config/.firefox-nw ~/.config/kinto/.firefox-nw
|
||||||
sed -i "s/{username}/`whoami`/g" ~/.config/systemd/user/keyswap.service
|
sed -i "s/{username}/`whoami`/g" ~/.config/systemd/user/keyswap.service
|
||||||
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/systemd/user/keyswap.service
|
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/systemd/user/keyswap.service
|
||||||
if [ "${#DISPLAY}" -gt 2 ]
|
# if [ "${#DISPLAY}" -gt 2 ]
|
||||||
then
|
# then
|
||||||
sed -i "s/#Environment/Environment/g" ~/.config/systemd/user/keyswap.service
|
sed -i "s/#Environment/Environment/g" ~/.config/systemd/user/keyswap.service
|
||||||
fi
|
# fi
|
||||||
systemctl --user daemon-reload
|
systemctl --user daemon-reload
|
||||||
systemctl --user enable keyswap
|
sed -i "s/ExecStart=/ExecStart=${swapcmd}/g" ~/.config/systemd/user/keyswap.service
|
||||||
systemctl --user start keyswap
|
systemctl --user enable keyswap.timer
|
||||||
|
systemctl --user start keyswap.timer
|
||||||
|
Binary file not shown.
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -175,15 +176,26 @@ int handle_error(Display* display, XErrorEvent* error){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window get_focus_window(Display* d){
|
Window get_focus_window(Display* d, int etype, char const *eventName, char const *current_app, bool debug){
|
||||||
Window w;
|
Window w;
|
||||||
int revert_to;
|
int revert_to;
|
||||||
XGetInputFocus(d, &w, &revert_to); // see man
|
|
||||||
|
if(debug == true){
|
||||||
|
printf("\n get focus window\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(etype == 17 || etype == 18)) {
|
||||||
|
XGetInputFocus(d, &w, &revert_to); // see man
|
||||||
|
if(debug == true){
|
||||||
|
printf(" -%s: event: %d, window_id: %ld\n",current_app,etype,w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(xerror){
|
if(xerror){
|
||||||
printf("Error getting focused window\n");
|
printf("*Error getting focused window, e.type: %d, current_app: %s\n",etype,current_app);
|
||||||
exit(1);
|
exit(1);
|
||||||
}else if(w == None){
|
}else if(w == None){
|
||||||
printf("no focus window\n");
|
printf("*no focus window, e.type: %d, current_app: %s\n",etype,current_app);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +206,7 @@ Window get_focus_window(Display* d){
|
|||||||
// a top window have the following specifications.
|
// a top window have the following specifications.
|
||||||
// * the start window is contained the descendent windows.
|
// * the start window is contained the descendent windows.
|
||||||
// * the parent window is the root window.
|
// * the parent window is the root window.
|
||||||
Window get_top_window(Display* d, Window start){
|
Window get_top_window(Display* d, Window start, int etype, char const *eventName, char const *current_app, bool debug){
|
||||||
Window w = start;
|
Window w = start;
|
||||||
Window parent = start;
|
Window parent = start;
|
||||||
Window root = None;
|
Window root = None;
|
||||||
@@ -202,32 +214,52 @@ Window get_top_window(Display* d, Window start){
|
|||||||
unsigned int nchildren;
|
unsigned int nchildren;
|
||||||
Status s;
|
Status s;
|
||||||
|
|
||||||
while (parent != root && parent != 0) {
|
if(debug == true){
|
||||||
|
printf("\n get top window\n");
|
||||||
|
}
|
||||||
|
// Checking for Destroy and Unmap Notify events here too
|
||||||
|
// Sometimes they still get passed through and if so need
|
||||||
|
// to be ignored or XQueryTree will cause a segmentation fault
|
||||||
|
while (parent != root && parent != 0 && !(etype == 17 || etype == 18)) {
|
||||||
w = parent;
|
w = parent;
|
||||||
|
|
||||||
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
|
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
|
||||||
|
|
||||||
|
if(debug == true){
|
||||||
|
printf(" -%s: event: %d, window_id: %ld\n",current_app,etype,w);
|
||||||
|
}
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
XFree(children);
|
XFree(children);
|
||||||
|
|
||||||
if(xerror){
|
if(xerror){
|
||||||
printf("fail to get top window: %ld\n",w);
|
printf("*fail to get top window: %ld, e.type: %d, current_app: %s\n",w,etype,current_app);
|
||||||
exit(1);
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf(" get parent (window: %d)\n", (int)w);
|
// printf(" get parent (window: %d)\n", (int)w);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("success (window: %d)\n", (int)w);
|
// printf("success (window: %d)\n", (int)w);
|
||||||
|
// printf("hello\n");
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search a named window (that has a WM_STATE prop)
|
// search a named window (that has a WM_STATE prop)
|
||||||
// on the descendent windows of the argment Window.
|
// on the descendent windows of the argment Window.
|
||||||
Window get_named_window(Display* d, Window start){
|
Window get_named_window(Display* d, Window start, int etype, char const *eventName, char const *current_app, bool debug){
|
||||||
Window w;
|
Window w;
|
||||||
|
|
||||||
|
if(debug == true){
|
||||||
|
printf("\n get named window\n");
|
||||||
|
}
|
||||||
// printf("getting named window ... ");
|
// printf("getting named window ... ");
|
||||||
w = XmuClientWindow(d, start); // see man
|
w = XmuClientWindow(d, start); // see man
|
||||||
|
|
||||||
|
if(debug == true){
|
||||||
|
printf(" -%s: event: %d, window_id: %ld\n\n",current_app,etype,w);
|
||||||
|
}
|
||||||
// if(w == start)
|
// if(w == start)
|
||||||
// printf("fail\n");
|
// printf("fail\n");
|
||||||
// printf("success (window: %d)\n", (int) w);
|
// printf("success (window: %d)\n", (int) w);
|
||||||
@@ -258,7 +290,53 @@ const char * str_window_class(Display* d, Window w, char *prior_app ){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void){
|
int main(int argc, char *argv[]){
|
||||||
|
|
||||||
|
bool debug;
|
||||||
|
|
||||||
|
if(argc < 2){
|
||||||
|
debug = false;
|
||||||
|
}
|
||||||
|
if(argc > 1 && (strcmp(argv[1], "-d") == 0 || strcmp(argv[1], "--debug") == 0 )){
|
||||||
|
debug = true;
|
||||||
|
printf("Running in debug mode\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *eventNames[34];
|
||||||
|
eventNames[0] = "None";
|
||||||
|
eventNames[1] = "KeyPress";
|
||||||
|
eventNames[2] = "KeyRelease";
|
||||||
|
eventNames[3] = "ButtonPress";
|
||||||
|
eventNames[4] = "ButtonRelease";
|
||||||
|
eventNames[5] = "MotionNotify";
|
||||||
|
eventNames[6] = "EnterNotify";
|
||||||
|
eventNames[7] = "LeaveNotify";
|
||||||
|
eventNames[8] = "FocusIn";
|
||||||
|
eventNames[9] = "FocusOut";
|
||||||
|
eventNames[10] = "KeymapNotify";
|
||||||
|
eventNames[11] = "Expose";
|
||||||
|
eventNames[12] = "GraphicsExpose";
|
||||||
|
eventNames[13] = "NoExpose";
|
||||||
|
eventNames[14] = "VisibilityNotify";
|
||||||
|
eventNames[15] = "CreateNotify";
|
||||||
|
eventNames[16] = "DestroyNotify";
|
||||||
|
eventNames[17] = "UnmapNotify";
|
||||||
|
eventNames[18] = "MapNotify";
|
||||||
|
eventNames[19] = "MapRequest";
|
||||||
|
eventNames[20] = "ReparentNotify";
|
||||||
|
eventNames[21] = "ConfigureNotify";
|
||||||
|
eventNames[22] = "ConfigureRequest";
|
||||||
|
eventNames[23] = "ResizeRequest";
|
||||||
|
eventNames[25] = "CirculateNotify";
|
||||||
|
eventNames[26] = "CirculateRequest";
|
||||||
|
eventNames[27] = "PropertyNotify";
|
||||||
|
eventNames[28] = "SelectionClear";
|
||||||
|
eventNames[29] = "SelectionRequest";
|
||||||
|
eventNames[30] = "SelectionNotify";
|
||||||
|
eventNames[31] = "ColormapNotify";
|
||||||
|
eventNames[32] = "ClientMessage";
|
||||||
|
eventNames[33] = "MappingNotify";
|
||||||
|
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buffer[10240];
|
char buffer[10240];
|
||||||
@@ -430,13 +508,13 @@ int main(void){
|
|||||||
printf("Starting keyswap...\n");
|
printf("Starting keyswap...\n");
|
||||||
|
|
||||||
// get active window
|
// get active window
|
||||||
w = get_focus_window(d);
|
w = get_focus_window(d, 0, eventNames[0], current_app, debug);
|
||||||
w = get_top_window(d, w);
|
w = get_top_window(d, w, 0, eventNames[0], current_app, debug);
|
||||||
w = get_named_window(d, w);
|
w = get_named_window(d, w, 0, eventNames[0], current_app, debug);
|
||||||
|
|
||||||
// XFetchName(d, w, &name);
|
// XFetchName(d, w, &name);
|
||||||
// printf("window:%#x name:%s\n", w, name);
|
// printf("window:%#x name:%s\n", w, name);
|
||||||
printf("First window name: %s \n",str_window_class(d, w,prior_app));
|
printf("First window name: %s \n\n",str_window_class(d, w,prior_app));
|
||||||
|
|
||||||
int breakouter;
|
int breakouter;
|
||||||
int last_event=0;
|
int last_event=0;
|
||||||
@@ -483,7 +561,9 @@ int main(void){
|
|||||||
|
|
||||||
if(strcicmp(prior_category, current_category) != 0){
|
if(strcicmp(prior_category, current_category) != 0){
|
||||||
printf("%s: %s\n",current_category,current_app);
|
printf("%s: %s\n",current_category,current_app);
|
||||||
// printf("run: %s\n",run_array[category_idx]);
|
if(debug == true){
|
||||||
|
printf("run: %s\n",run_array[category_idx]);
|
||||||
|
}
|
||||||
system(run_array[category_idx]);
|
system(run_array[category_idx]);
|
||||||
strcpy(run_normal,run_array[category_idx]);
|
strcpy(run_normal,run_array[category_idx]);
|
||||||
ran_onInput = 0;
|
ran_onInput = 0;
|
||||||
@@ -494,11 +574,15 @@ int main(void){
|
|||||||
if(config_de_array[category_idx][r] != -1){
|
if(config_de_array[category_idx][r] != -1){
|
||||||
int de_id_idx = in_int(de_id_array, de_len, config_de_array[category_idx][r]);
|
int de_id_idx = in_int(de_id_array, de_len, config_de_array[category_idx][r]);
|
||||||
if(strcicmp(current_category, "term") == 0){
|
if(strcicmp(current_category, "term") == 0){
|
||||||
// printf("Running de term command: %s\n",de_runterm_array[de_id_idx]);
|
if(debug == true){
|
||||||
|
printf("Running de term command: %s\n",de_runterm_array[de_id_idx]);
|
||||||
|
}
|
||||||
system(de_runterm_array[de_id_idx]);
|
system(de_runterm_array[de_id_idx]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// printf("Running de gui command: %s\n",de_rungui_array[de_id_idx]);
|
if(debug == true){
|
||||||
|
printf("Running de gui command: %s\n",de_rungui_array[de_id_idx]);
|
||||||
|
}
|
||||||
system(de_rungui_array[de_id_idx]);
|
system(de_rungui_array[de_id_idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,12 +603,16 @@ int main(void){
|
|||||||
if(strlen(run_onInput) > 0){
|
if(strlen(run_onInput) > 0){
|
||||||
while(XNextEventTimeout(d, &e, .5, event_ts, last_event, &event_ts, &last_event)){
|
while(XNextEventTimeout(d, &e, .5, event_ts, last_event, &event_ts, &last_event)){
|
||||||
if(check_caret() && ran_onInput == 0){
|
if(check_caret() && ran_onInput == 0){
|
||||||
// printf("run_onInput: %s\n",run_onInput);
|
if(debug == true){
|
||||||
|
printf("run_onInput: %s\n",run_onInput);
|
||||||
|
}
|
||||||
system(run_onInput);
|
system(run_onInput);
|
||||||
ran_onInput = 1;
|
ran_onInput = 1;
|
||||||
}
|
}
|
||||||
else if(!check_caret() && ran_onInput == 1){
|
else if(!check_caret() && ran_onInput == 1){
|
||||||
// printf("run_offInput: %s\n",run_offInput);
|
if(debug == true){
|
||||||
|
printf("run_offInput: %s\n",run_offInput);
|
||||||
|
}
|
||||||
system(run_offInput);
|
system(run_offInput);
|
||||||
ran_onInput = 0;
|
ran_onInput = 0;
|
||||||
}
|
}
|
||||||
@@ -535,8 +623,10 @@ int main(void){
|
|||||||
XNextEvent(d, &e);
|
XNextEvent(d, &e);
|
||||||
// Make sure window dragging or resizing is not occuring
|
// Make sure window dragging or resizing is not occuring
|
||||||
if(!(e.type == 22 && (e.type == last_event) && timeInMilliseconds()-event_ts < 300)){
|
if(!(e.type == 22 && (e.type == last_event) && timeInMilliseconds()-event_ts < 300)){
|
||||||
// printf("%d == %d\n",e.type, last_event);
|
if(debug == true){
|
||||||
// printf("Timestamp: %lld\n",timeInMilliseconds()-event_ts);
|
printf(" event: %s %d\n",eventNames[e.type-1],e.type);
|
||||||
|
printf(" duration: %lldms\n",timeInMilliseconds()-event_ts);
|
||||||
|
}
|
||||||
event_ts = timeInMilliseconds();
|
event_ts = timeInMilliseconds();
|
||||||
last_event = e.type;
|
last_event = e.type;
|
||||||
break;
|
break;
|
||||||
@@ -546,8 +636,16 @@ int main(void){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w = get_focus_window(d);
|
// Reference http://www.rahul.net/kenton/xproto/xevents_errors.html
|
||||||
w = get_top_window(d, w);
|
// event type 17 - DestroyNotify
|
||||||
w = get_named_window(d, w);
|
// event type 18 - UnmapNotify
|
||||||
|
// Dismiss the following events by initiating another XNextEvent
|
||||||
|
while(e.type == 17 || e.type == 18){
|
||||||
|
XNextEvent(d, &e);
|
||||||
|
}
|
||||||
|
|
||||||
|
w = get_focus_window(d, e.type, eventNames[e.type-1], current_app, debug);
|
||||||
|
w = get_top_window(d, w, e.type, eventNames[e.type-1], current_app, debug);
|
||||||
|
w = get_named_window(d, w, e.type, eventNames[e.type-1], current_app, debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
6
setup.py
6
setup.py
@@ -86,11 +86,9 @@ if len(check_ibus) == 0:
|
|||||||
if runpkg != 0:
|
if runpkg != 0:
|
||||||
requirements(pkgm)
|
requirements(pkgm)
|
||||||
|
|
||||||
if os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "":
|
if not os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "":
|
||||||
install_ibus()
|
install_ibus()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open("defaults.json")
|
f = open("defaults.json")
|
||||||
except IOError:
|
except IOError:
|
||||||
@@ -215,7 +213,7 @@ if(onetime):
|
|||||||
print(bcolors.CYELLOW + "Please enter your init tweak(s) (eg 1 or 1 2 3 - leave blank to skip): " + bcolors.ENDC)
|
print(bcolors.CYELLOW + "Please enter your init tweak(s) (eg 1 or 1 2 3 - leave blank to skip): " + bcolors.ENDC)
|
||||||
defaultinit = [int(i) for i in input().split()]
|
defaultinit = [int(i) for i in input().split()]
|
||||||
if len(defaultinit) != 0:
|
if len(defaultinit) != 0:
|
||||||
user_config['init'] = defaultinit
|
user_config['init'] = [intents[defaultinit[0]-1]['id']]
|
||||||
|
|
||||||
print("\nDynamic shortcut tweaks\n")
|
print("\nDynamic shortcut tweaks\n")
|
||||||
|
|
||||||
|
11
system-config/keyswap.timer
Normal file
11
system-config/keyswap.timer
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# keyswap.timer
|
||||||
|
[Unit]
|
||||||
|
Description=Runs the keyswap.service 5 seconds after boot up
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
#OnBootSec=5s
|
||||||
|
OnActiveSec=5s
|
||||||
|
Unit=keyswap.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
@@ -2,7 +2,7 @@
|
|||||||
Name=Kinto
|
Name=Kinto
|
||||||
GenericName=Kinto
|
GenericName=Kinto
|
||||||
Comment=Make Linux Type Like it's a Mac
|
Comment=Make Linux Type Like it's a Mac
|
||||||
Exec=/usr/bin/systemctl --user start keyswap
|
Exec=/bin/sleep 5 /usr/bin/systemctl --user start keyswap
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
X-GNOME-Autostart-enabled=true
|
X-GNOME-Autostart-enabled=true
|
Reference in New Issue
Block a user