- Additional updates that give Firefox and Chrome separate keymap files due to shortcut differences

This commit is contained in:
Ben Reaves
2020-02-16 20:10:37 -06:00
parent fbe2451a3c
commit 778d1df1ba
8 changed files with 63 additions and 26 deletions

View File

@@ -14,7 +14,9 @@ cp ./kintox11/binary/kintox11 ~/.config/kinto/kintox11
cp ./system-config/xactive.sh ~/.config/kinto/xactive.sh
cp ./system-config/caret_status.sh ~/.config/kinto/caret_status.sh
cp ./system-config/cleanup.sh ~/.config/kinto/cleanup.sh
cp ./system-config/.browsers ~/.config/kinto/.browsers
cp ./system-config/.firefox ~/.config/kinto/.firefox
cp ./system-config/.chrome-ww ~/.config/kinto/.chrome-ww
cp ./system-config/.chrome-nw ~/.config/kinto/.chrome-nw
sed -i "s/{username}/`whoami`/g" ~/.config/systemd/user/keyswap.service
systemctl --user daemon-reload
systemctl --user enable keyswap

Binary file not shown.

View File

@@ -99,6 +99,7 @@ char *trimwhitespace(char *str)
int check_caret()
{
int caretint;
char * fpname;
fpname = malloc(sizeof(char)*20);
strcpy(fpname,"/tmp/kinto/caret");
@@ -113,10 +114,12 @@ int check_caret()
fread(buffer, size, 1, fp);
buffer[size] = '\0';
trimwhitespace(buffer);
if(strncmp(buffer,"1",1) == 0){
caretint = atoi(buffer);
if(caretint == 1){
// printf("caret: %s\n", buffer);
return 1;
}
// printf("found nothing\n");
return 0;
}
else{
@@ -528,13 +531,13 @@ int main(void){
XEvent e;
if(strlen(run_onInput) > 0){
while(XNextEventTimeout(d, &e, .5, event_ts, last_event, &event_ts, &last_event)){
if(check_caret(run_onInput) && ran_onInput == 0){
if(check_caret() && ran_onInput == 0){
// printf("run_onInput: %s\n",run_onInput);
system(run_onInput);
ran_onInput = 1;
}
else if(!check_caret(run_onInput) && ran_onInput == 1){
// printf("run_normal: %s\n",run_normal);
else if(!check_caret() && ran_onInput == 1){
// printf("run_offInput: %s\n",run_offInput);
system(run_offInput);
ran_onInput = 0;
}

View File

@@ -25,17 +25,20 @@ def requirements():
check_xbind = symbols_gui_line = cmdline("which xbindkeys").strip()
check_xte = symbols_gui_line = cmdline("which xte").strip()
check_xdotool = symbols_gui_line = cmdline("which xdotool").strip()
if len(check_xbind) > 0 and len(check_xte) > 0:
print("Xbindkeys and xte requirement is installed.")
elif len(check_xbind) == 0 and len(check_xbind) == 0:
run_pkg = "xbindkeys xautomation"
requirements()
elif len(check_xbind) == 0:
runpkg = 0
if len(check_xbind) > 0 and len(check_xte) > 0 and len(check_xdotool) > 0:
print("Xbindkeys, xdotool and xte requirement is installed.")
if len(check_xbind) == 0:
run_pkg = "xbindkeys"
requirements()
elif len(check_xte) == 0:
run_pkg = "xautomation"
if len(check_xte) == 0:
run_pkg += " xautomation"
if len(check_xdotool) == 0:
run_pkg += " xdotool"
if runpkg != 0:
requirements()
try:
@@ -119,6 +122,7 @@ if os.path.isdir(homedir + "/.xkb/keymap") == False:
time.sleep(0.5)
os.system('setxkbmap -option')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui.nw')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.term')
time.sleep(0.5)
@@ -130,6 +134,9 @@ cmdline('sed -i '' -e "' + symbols_gui_line + 's/\\"/' + keyboardconfigs[default
cmdline('sed -i '' -e "' + types_gui_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui')
cmdline('sed -i '' -e "' + symbols_term_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_term'] + '\\"/2" ~/.xkb/keymap/kbd.mac.term')
cmdline('sed -i '' -e "' + symbols_gui_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)","") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.nw')
cmdline('sed -i '' -e "' + types_gui_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.nw')
user_file = homedir + '/.config/kinto/user_config.json'
with open(user_file, 'r') as f:
@@ -175,12 +182,15 @@ if len(defaultde) != 0:
user_config['config'][0]['de'] = tweaks_selected
# term
user_config['config'][1]['de'] = tweaks_selected
# browsers
# firefox
user_config['config'][2]['de'] = tweaks_selected
# chrome
user_config['config'][3]['de'] = tweaks_selected
user_config['config'][0]['run'] = keyboardconfigs[defaultkb-1]['gui']
user_config['config'][1]['run'] = keyboardconfigs[defaultkb-1]['term']
user_config['config'][2]['run'] = keyboardconfigs[defaultkb-1]['gui']
user_config['config'][3]['run'] = keyboardconfigs[defaultkb-1]['gui'].replace("kbd.mac.gui","kbd.mac.gui.nw")
os.remove(user_file)
with open(user_file, 'w') as f:

7
system-config/.chrome-nw Normal file
View File

@@ -0,0 +1,7 @@
"xdotool key --delay 0 --clearmodifiers Alt+Left"
Control + Left + Release
#Home + release
"xdotool key --delay 0 --clearmodifiers Alt+Right"
Control + Right + Release
#End + release

5
system-config/.chrome-ww Normal file
View File

@@ -0,0 +1,5 @@
"xdotool key --delay 0 --clearmodifiers Home"
Control + Left + Release
"xdotool key --delay 0 --clearmodifiers End"
Control + Right + Release

View File

@@ -1,5 +1,5 @@
"xte 'keydown Control_L' 'key bracketleft' 'keyup Control_L'"
Home + release
"xte 'keydown Control_L' 'key bracketright' 'keyup Control_L'"
End + release
"xte 'keydown Control_R' 'key bracketright' 'keyup Control_R'"
End + release

View File

@@ -19,15 +19,25 @@
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm" ]
},
{
"name": "browsers",
"run": "",
"run_onInput": "killall xbindkeys > /dev/null 2>&1",
"run_offInput": "xbindkeys -f $HOME/.config/kinto/.browsers",
"symbols":"",
"types":"",
"de": [],
"appnames":[ "Chromium","Firefox" ]
}],
"name": "firefox",
"run": "",
"run_onInput": "killall xbindkeys > /dev/null 2>&1",
"run_offInput": "killall xbindkeys > /dev/null 2>&1;xbindkeys -f $HOME/.config/kinto/.firefox",
"symbols": "",
"types": "",
"de": [],
"appnames": [ "Firefox" ]
},
{
"name": "chrome",
"run": "",
"run_onInput": "killall xbindkeys > /dev/null 2>&1;xbindkeys -f $HOME/.config/kinto/.chrome-ww",
"run_offInput": "killall xbindkeys > /dev/null 2>&1;xbindkeys -f $HOME/.config/kinto/.chrome-nw",
"symbols": "",
"types": "",
"de": [],
"appnames": [ "Chromium" ]
}],
"init": [],
"detypes":["gnome2","gnome3","kde4","kde5","xfce","i3wm"],
"de":[{