Compare commits

...

21 Commits

Author SHA1 Message Date
Ben Reaves
cbb60668e3 - Proof of concept cheatsheet feature 2020-06-06 03:29:47 -05:00
Ben Reaves
0275669be1 - Fixed pasting & various shortcut issues under Windows 10 2020-06-01 19:22:19 -05:00
Ben Reaves
3899fcf596 - Fixed potential problem in the xkb setup 2020-05-31 20:14:26 -05:00
Ben Reaves
20c93600e1 - Added Windows 10 Emoji Panel Ctrl-Cmd-Spacebar 2020-05-31 16:37:01 -05:00
Ben Reaves
c0bfec035f - Fixes RCtrl key on Left Cmd position for Windows using VMs & VS Code remaps. Recloses #191 2020-05-30 19:46:11 -05:00
Ben Reaves
eb576a6217 - Fixed shortcuts by re-ordering code (windows) 2020-05-30 00:10:03 -05:00
Ben Reaves
b34dc4e928 - Sublime text remaps in VS Code now optional (linux). Closes #191 2020-05-29 16:06:40 -05:00
Ben Reaves
2ffe639024 - Resolves multi-language support under xkeysnail. Closes #192. 2020-05-29 15:33:53 -05:00
Ben Reaves
4c5cb36503 - Added cmd-t/w - open/close tabs to win terminals 2020-05-27 02:38:14 -05:00
Ben Reaves
6b4c697dd0 - Added support for Windows 10 Hosts w/ Kinto & running Linux VMs 2020-05-27 00:02:41 -05:00
Ben Reaves
7fe9230b5f - Added proper Ctrl/Alt + Backspace behavior for Linux remap. Closes #187 2020-05-23 16:02:32 -05:00
Ben Reaves
e3d42651b7 - Adding basic hotkey functions for apps 2020-05-18 14:21:31 -05:00
Ben Reaves
ca54bf89d6 - Part of #182 merge, brings back Ctrl-a/e functionality for GUI apps. 2020-05-18 14:03:43 -05:00
Ben Reaves
772413a9c3 Merge pull request #182 from Mahoney-forks/fix-ctl-a-beginning-of-line
Make toggle-application-view shortcut more mac like
2020-05-18 13:44:20 -05:00
Robert Elliot
bbd7b3fc93 Make toggle-application-view shortcut more mac like
Toggle-application-view defaults to `<Super-a>` (virtual)/`<Ctrl-a>` (physical)
This clashed with using `<Ctrl-a>` for move cursor to beginning of line (OS/X).
`LaunchB` seems the closes OS/X analogue - FN-F4.
2020-05-18 11:40:57 +01:00
Ben Reaves
98120062eb - Added linux mint and mate support 2020-05-16 02:52:25 -05:00
Ben Reaves
637a8fecaa Merge pull request #178 from rbreaves/dev
- Improved xfce4 support, added xfce4-terminal. Fixed xkeysnail issue.
2020-05-16 01:03:40 -05:00
Ben Reaves
ad53b7034d - Improved support for xfce4 with Ubuntu, xubuntu, voyager. Fixed In-app switching bug. 2020-05-15 20:49:48 -05:00
Ben Reaves
896c6fd6a1 - Added xfce4-terminal 2020-05-15 20:19:15 -05:00
Ben Reaves
dbaf02f884 Merge pull request #177 from rbreaves/dev
- Setup fixes for xkeynail install
2020-05-15 13:45:15 -05:00
Ben Reaves
79857af79c - Setup fixes for xkeynail install 2020-05-15 13:43:21 -05:00
7 changed files with 321 additions and 87 deletions

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@
.DS_Store
__pycache__/
xkeysnail/
keybindings_*
mutter_*

138
references/overlay.py Normal file
View File

@@ -0,0 +1,138 @@
import wx
# import wx.richtext as rt
# import images
# http://www.ccp4.ac.uk/dist/checkout/wxPython-src-3.0.2.0/wxPython/demo/RichTextCtrl.py
# https://stackoverflow.com/questions/40257359/how-to-dynamically-update-multiple-wxpython-static-text
def GetRoundBitmap( w, h, r ):
maskColor = wx.Colour(0,0,0)
shownColor = wx.Colour(5,5,5)
b = wx.EmptyBitmap(w,h)
dc = wx.MemoryDC(b)
dc.SetBrush(wx.Brush(maskColor))
dc.DrawRectangle(0,0,w,h)
dc.SetBrush(wx.Brush(shownColor))
dc.SetPen(wx.Pen(shownColor))
dc.DrawRoundedRectangle(0,0,w,h,r)
dc.SelectObject(wx.NullBitmap)
b.SetMaskColour(maskColor)
return b
def GetRoundShape( w, h, r ):
return wx.Region( GetRoundBitmap(w,h,r) )
class PanelOne(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.Bind(wx.EVT_KEY_UP, self.OnKeyDown)
wx.StaticText(self, label = "'^⌘G - Select All (Ctrl-Cmd-G) ^⌘G - Select All (Ctrl-Cmd-G)\n^⌘G - Select All (Ctrl-Cmd-G) ^⌘G - Select All (Ctrl-Cmd-G)")
self.SetTransparent( 220 )
def OnKeyDown(self, event):
self.Destroy()
class FancyFrame(wx.Frame):
def __init__(self):
sizer = wx.GridBagSizer()
style = ( wx.CLIP_CHILDREN | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR |
wx.NO_BORDER | wx.FRAME_SHAPED )
wx.Frame.__init__(self, None, title='Fancy', style = style)
# self.rtc = rt.RichTextCtrl(self, style=wx.VSCROLL|wx.TE_READONLY|wx.HSCROLL|wx.NO_BORDER);
# self.rtc.Disable()
boldstatic = wx.Font(pointSize = 24, family = wx.DEFAULT,
style = wx.BOLD, weight = wx.BOLD,
faceName = 'Consolas')
normalstatic = wx.Font(pointSize = 10, family = wx.DEFAULT,
style = wx.NORMAL, weight = wx.NORMAL,
faceName = 'Consolas')
# font = wx.Font(pointSize = 18, family = wx.DEFAULT,
# style = wx.NORMAL, weight = wx.NORMAL,
# faceName = 'Consolas')
self.SetFont(boldstatic)
self.SetBackgroundColour((211,211,211))
self.label = wx.StaticText(self, label = "^⌘G", pos = (100,50))
self.SetFont(normalstatic)
self.label2 = wx.StaticText(self, label = " - Select All (Ctrl-Cmd-G)", pos = (200,50))
# sizer.Add(self.label, (4, 0), (1, 5), wx.EXPAND)
# sizer.Add(self.label2, (5, 0), (1, 5), wx.EXPAND)
# wx.StaticText(self, label = "^⌘G - Select All (Ctrl-Cmd-G) || ^⌘G - Select All (Ctrl-Cmd-G)\n^⌘G - Select All (Ctrl-Cmd-G) ^⌘G - Select All (Ctrl-Cmd-G)")
# self.rtc.Bind(wx.EVT_SET_FOCUS,self.OnInput)
# self.rtc.Bind(wx.EVT_KILL_FOCUS,self.OnInput)
# self.rtc.Bind(wx.EVT_KEY_UP, self.OnKeyDown)
# self.rtc.BeginFontSize(14)
# self.rtc.BeginBold()
# self.rtc.WriteText("^⌘G")
# self.rtc.EndBold()
# self.rtc.BeginFontSize(10)
# self.rtc.WriteText(" - Select All (Ctrl-Cmd-G)\n")
# self.rtc.BeginFontSize(14)
# self.rtc.WriteText("Different font sizes on the same line is allowed, too.")
# self.rtc.EndFontSize()
# self.rtc.WriteText(" Next we'll show an indented paragraph.")
# self.rtc.BeginLeftIndent(60)
# self.rtc.Newline()
# self.rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.")
# self.rtc.EndLeftIndent()
# self.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD))
# font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
# wx.text.SetFont(font)
# self.panelOne = PanelOne(self)
# self.SetFocus()
w, h = wx.GetDisplaySize()
self.SetSize((w/2, h/2))
self.SetPosition( ((w-w/2)/2,(h-h/2)/2) )
self.SetTransparent( 220 )
self.Bind(wx.EVT_KEY_UP, self.OnKeyDown)
self.Bind(wx.EVT_MOTION, self.OnMouse)
self.Bind(wx.EVT_PAINT, self.OnPaint)
if wx.Platform == '__WXGTK__':
self.Bind(wx.EVT_WINDOW_CREATE, self.SetRoundShape)
else:
self.SetRoundShape()
self.SetSizer(sizer)
self.Show(True)
def OnInput(self, e):
self.Destroy()
# e.Skip()
def SetRoundShape(self, event=None):
w, h = self.GetSizeTuple()
self.SetShape(GetRoundShape( w,h, 10 ) )
def OnPaint(self, event):
dc = wx.PaintDC(self)
dc = wx.GCDC(dc)
w, h = self.GetSizeTuple()
r = 10
dc.SetPen( wx.Pen("#D3D3D3dth = 2"))
dc.SetBrush( wx.Brush("#D3D3D3"))
dc.DrawRoundedRectangle( 0,0,w,h,r )
def OnKeyDown(self, event):
# self.Close(force=True)
self.Destroy()
def OnMouse(self, event):
"""implement dragging"""
if not event.Dragging():
self._dragPos = None
return
self.CaptureMouse()
if not self._dragPos:
self._dragPos = event.GetPosition()
else:
pos = event.GetPosition()
displacement = self._dragPos - pos
self.SetPosition( self.GetPosition() - displacement )
app = wx.App()
f = FancyFrame()
app.MainLoop()

View File

@@ -68,6 +68,8 @@ if len(check_x11) == 0:
distro = cmdline("awk -F= '$1==\"NAME\" { print $2 ;}' /etc/os-release").replace('"','').strip().split(" ")[0]
dename = cmdline("./system-config/dename.sh").replace('"','').strip().split(" ")[0].lower()
run_pkg = ""
def requirements(pkgm):
print(bcolors.CYELLOW2 + "You need to install some packages, " +run_pkg+ ", for Kinto to fully remap browsers during input focus.\n" + bcolors.ENDC)
print("sudo " + pkgm + " " + run_pkg + "\n")
@@ -110,7 +112,7 @@ def setShortcuts():
addhotkeys = yn_choice("\nDo you want to apply system level shortcuts?")
if(addhotkeys):
distro = distro.lower()
if dename == "gnome":
if dename == "gnome" or dename == "mate":
cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > keybindings_`date +"%Y.%m.%d-%s"`.conf')
cmdline('dconf dump /org/gnome/mutter/keybindings/ > mutter_`date +"%Y.%m.%d-%s"`.conf')
if(kintotype == 1):
@@ -121,8 +123,10 @@ def setShortcuts():
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary>F14','<Primary><Shift>F14','<Alt><Shift>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
cmdline("gsettings set org.gnome.mutter overlay-key ''")
if distro == "ubuntu" and dename == "gnome":
cmdline("gsettings set org.gnome.shell.keybindings toggle-application-view \"['LaunchB']\"")
if dename != "mate":
cmdline("gsettings set org.gnome.mutter overlay-key ''")
if (distro == "ubuntu" and dename == "gnome") or (distro == "linux" and dename == "mate") or (distro == "ubuntu" and dename == "mate"):
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['<Super>Up','<Super>Left']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['<Super>Down','<Super>Right']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']")
@@ -156,7 +160,7 @@ def setShortcuts():
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui')
# elif distro == "budgie" and dename == "gnome":
# print("Apply budgie shortcuts here")
elif distro == "galliumos" and dename == "xfce":
elif (distro == "galliumos" and dename == "xfce") or (distro == "ubuntu" and dename == "xfce"):
print("Applying GalliumOS (xfce) shortcuts...")
cmdline('cp ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ./xfce4-keyboard-shortcuts_`date +"%Y.%m.%d-%s"`.xml')
# Reset Show desktop
@@ -319,7 +323,7 @@ def kintoImpOne():
runpkg = 0
run_pkg = ""
global run_pkg
if len(check_xbind) > 0 and len(check_xdotool) > 0 and len(check_ibus) > 0:
print("Xbindkeys, xdotool and IBus requirement is installed.")
@@ -335,6 +339,7 @@ def kintoImpOne():
runpkg = 1
if runpkg != 0:
print(runpkg)
requirements(pkgm)
if not os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "":

View File

@@ -16,7 +16,7 @@
"symbols":"",
"types":"",
"de":[],
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty","alacritty","mate-terminal","tilix" ]
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty","alacritty","mate-terminal","tilix","xfce4-terminal" ]
},
{
"name": "firefox",

View File

@@ -12,7 +12,9 @@ GroupAdd, terminals, Fluent Terminal ahk_class ApplicationFrameWindow
GroupAdd, posix, ahk_exe ubuntu.exe
GroupAdd, posix, ahk_exe ConEmu.exe
GroupAdd, posix, ahk_exe ConEmu64.exe
GroupAdd, posix, ahk_exe Hyper.exe
GroupAdd, posix, ahk_exe mintty.exe
GroupAdd, posix, Fluent Terminal ahk_class ApplicationFrameWindow
GroupAdd, ConEmu, ahk_exe ConEmu.exe
GroupAdd, ConEmu, ahk_exe ConEmu64.exe
@@ -25,6 +27,34 @@ GroupAdd, editors, ahk_exe Code.exe
GroupAdd, vscode, ahk_exe VSCodium.exe
GroupAdd, vscode, ahk_exe Code.exe
; Close Apps
^q::Send !{F4}
; Emoji Panel
#^Space::Send {LWin down};{LWin up}
; Full Screenshot
^+3::Send {PrintScreen}
; Region Screenshot
^+4::Send #+{S}
; wordwise support
$^Left::Send {Home}
$^+Left::Send +{Home}
$^Right::Send {End}
$^+Right::Send +{End}
^Up::Send ^{Home}
^+Up::Send ^+{Home}
^Down::Send ^{End}
^+Down::Send ^+{End}
^Backspace::Send +{Home}{Delete}
!Backspace::Send ^{Backspace}
!Left::Send ^{Left}
!+Left::Send ^+{Left}
!Right::Send ^{Right}
!+Right::Send ^+{Right}
; Cmd+Space Alternative
LWin & vk07::return
LWin::return
@@ -56,40 +86,15 @@ if(!GetKeyState("LWin", "P"))
}
return
; Close Apps
^q::Send !{F4}
; Full Screenshot
^+3::Send {PrintScreen}
; Region Screenshot
^+4::Send #+{S}
; wordwise support
$^Left::Send {Home}
$^+Left::Send +{Home}
$^Right::Send {End}
$^+Right::Send +{End}
^Up::Send ^{Home}
^+Up::Send ^+{Home}
^Down::Send ^{End}
^+Down::Send ^+{End}
^Backspace::Send +{Home}{Delete}
!Backspace::Send ^{Backspace}
!Left::Send ^{Left}
!+Left::Send ^+{Left}
!Right::Send ^{Right}
!+Right::Send ^+{Right}
; ; Sublime Text Remaps for VS Code ; ST2CODE
; #IfWinActive ahk_group vscode ; ST2CODE
; ; Remap Ctrl+Shift to behave like macOS Sublimetext ; ST2CODE
; ; Will extend cursor to multiple lines ; ST2CODE
; #+Up::send ^!{Up} ; ST2CODE
; #+Down::send ^!{Down} ; ST2CODE
; ; Remap Ctrl+Cmd+G to select all matches ; ST2CODE
; #^g::send ^+{L} ; ST2CODE
; #If ; ST2CODE
; Sublime Text Remaps for VS Code
#IfWinActive ahk_group vscode ; ST2CODE
; Remap Ctrl+Shift to behave like macOS Sublimetext
; Will extend cursor to multiple lines
#+Up::send ^!{Up} ; ST2CODE
#+Down::send ^!{Down} ; ST2CODE
; Remap Ctrl+Cmd+G to select all matches
#^g::send ^+{L} ; ST2CODE
#If ; ST2CODE
#IfWinActive ahk_exe sublime_text.exe
; Remap Ctrl+Shift to behave like macOS Sublimetext
@@ -101,22 +106,41 @@ $^+Right::Send +{End}
#^g::send !{F3}
#If
; Not sure why this fix is needed
#IfWinActive ahk_exe Firefox.exe
^v::send ^v
#If
#IfWinActive ahk_group terminals
; Copy
^c::Send {LCtrl down}{LShift down}c{LCtrl Up}{LShift Up}
#c::Send {LCtrl down}c{LCtrl Up}
#IfWinNotActive ahk_group ConEmu
; Paste
^v::Send {LCtrl down}{LShift down}v{LCtrl Up}{LShift Up}
#If
; Paste
$^v::
If not WinActive("ahk_group ConEmu") && not WinActive("ahk_exe cmd.exe"){
Send {LCtrl down}{LShift down}v{LCtrl Up}{LShift Up}
}
else{
Send ^v
}
return
#If
#IfWinActive ahk_group posix
; Open/Close Tab for those that support it
$^t::
If not WinActive("ahk_group ConEmu"){
Send {LCtrl down}{LShift down}t{LCtrl Up}{LShift Up}
}
else{
Send ^t
}
return
$^w::
If not WinActive("ahk_group ConEmu"){
Send {LCtrl down}{LShift down}w{LCtrl Up}{LShift Up}
}
else{
Send ^w
}
return
; End of Line
#e::Send {LCtrl down}e{LCtrl Up}
^e::return
@@ -141,11 +165,11 @@ $^+Right::Send +{End}
#z::Send {LCtrl down}z{LCtrl Up}
#If
#IfWinActive ahk_group ConEmu
; Paste
$^v::Send {Shift down}{Insert}{Shift Up}
#v::Send {LCtrl down}v{LCtrl Up}
#If
; #IfWinActive ahk_group ConEmu
; ; Paste
; $^v::Send {Shift down}{Insert}{Shift Up}
; #v::Send {LCtrl down}v{LCtrl Up}
; #If
#IfWinActive ahk_exe mintty.exe
; Copy

View File

@@ -3,7 +3,10 @@
import re
from xkeysnail.transform import *
terminals = ["gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty","alacritty","mate-terminal","tilix"]
# Use the following for testing terminal keymaps
# terminals = [ "", ... ]
# xbindkeys -mk
terminals = ["gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty","alacritty","mate-terminal","tilix","xfce4-terminal"]
terminals = [term.casefold() for term in terminals]
termStr = "|".join(str(x) for x in terminals)
@@ -26,6 +29,9 @@ define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
# Key.RIGHT_CTRL: Key.RIGHT_META, # WinMac
# # KintoWin
# Key.LEFT_CTRL: Key.RIGHT_CTRL, # KintoWin
# # Mac Only
# Key.LEFT_META: Key.RIGHT_CTRL, # Mac
# Key.LEFT_CTRL: Key.LEFT_META, # Mac
@@ -39,7 +45,7 @@ define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
# Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook
# # Left Ctrl Stays Left Ctrl
# Key.LEFT_META: Key.LEFT_ALT, # Chromebook
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # Chromebook
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # Chromebook - Multi-language (Remove)
# Key.RIGHT_CTRL: Key.RIGHT_ALT, # Chromebook
# # Right Meta does not exist on chromebooks
@@ -47,10 +53,14 @@ define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
# Key.LEFT_ALT: Key.RIGHT_CTRL, # WinMac
# Key.LEFT_META: Key.LEFT_ALT, # WinMac
# Key.LEFT_CTRL: Key.LEFT_CTRL, # WinMac
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac - Multi-language (Remove)
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
# Key.RIGHT_CTRL: Key.LEFT_CTRL, # WinMac
# # KintoWin
# Key.LEFT_CTRL: Key.RIGHT_CTRL, # KintoWin
# Key.LEFT_META: Key.LEFT_CTRL, # KintoWin
# # Mac Only
# Key.LEFT_META: Key.RIGHT_CTRL, # Mac
# # Left Ctrl Stays Left Ctrl
@@ -67,25 +77,30 @@ define_keymap(re.compile("org.gnome.nautilus", re.IGNORECASE),{
})
define_keymap(None,{
# Basic App hotkey functions
K("RC-Q"): K("Alt-F4"),
K("RC-H"): K("Alt-F9"),
# Cmd Tab - App Switching Default
K("RC-Tab"): K("RC-F13"), # Default
K("RC-Shift-Tab"): K("RC-Shift-F13"), # Default
K("RC-Grave"): K("M-F6"), # Default
K("RC-Shift-Grave"): K("M-Shift-F6"), # Default
# K("RC-Tab"): K("RC-backslash"), # Chromebook
# K("RC-Shift-Tab"): K("RC-Shift-backslash"), # Chromebook
# K("RC-Grave"): K("RC-Shift-backslash"), # Chromebook
K("RC-Tab"): K("RC-F13"), # Default not-xfce4
K("RC-Shift-Tab"): K("RC-Shift-F13"), # Default not-xfce4
K("RC-Grave"): K("M-F6"), # Default not-xfce4
K("RC-Shift-Grave"): K("M-Shift-F6"), # Default not-xfce4
# K("RC-Tab"): K("RC-backslash"), # xfce4
# K("RC-Shift-Tab"): K("RC-Shift-backslash"), # xfce4
# K("RC-Grave"): K("RC-Shift-backslash"), # xfce4
# In-App Tab switching
# K("M-Tab"): K("C-Tab"), # Chromebook - In-App Tab switching
# K("M-Shift-Tab"): K("C-Shift-Tab"), # Chromebook - In-App Tab switching
# K("M-Grave") : K("C-Shift-Tab"), # Chromebook - In-App Tab switching
K("Super-Tab"): K("LC-Tab"), # Default
K("Super-Shift-Tab"): K("LC-Shift-Tab"), # Default
K("Super-Tab"): K("LC-Tab"), # Default not-chromebook
K("Super-Shift-Tab"): K("LC-Shift-Tab"), # Default not-chromebook
# Wordwise
K("RC-Left"): K("Home"), # Beginning of Line
K("Super-a"): K("Home"), # Beginning of Line
K("RC-Shift-Left"): K("Shift-Home"), # Select all to Beginning of Line
K("RC-Right"): K("End"), # End of Line
K("Super-e"): K("End"), # End of Line
K("RC-Shift-Right"): K("Shift-End"), # Select all to End of Line
# K("RC-Left"): K("C-LEFT_BRACE"), # Firefox-nw - Back
# K("RC-Right"): K("C-RIGHT_BRACE"), # Firefox-nw - Forward
@@ -95,7 +110,11 @@ define_keymap(None,{
K("RC-Shift-Up"): K("C-Shift-Home"), # Select all to Beginning of File
K("RC-Down"): K("C-End"), # End of File
K("RC-Shift-Down"): K("C-Shift-End"), # Select all to End of File
K("M-Backspace"): K("Delete"), # Delete
# K("M-Backspace"): K("Delete"), # Chromebook - Delete
K("Super-Backspace"): K("C-Backspace"), # Default not-chromebook - Delete Left Word of Cursor
K("Super-Delete"): K("C-Delete"), # Default not-chromebook - Delete Right Word of Cursor
K("Alt-Backspace"): K("C-Backspace"), # Default not-chromebook - Delete Left Word of Cursor
K("Alt-Delete"): K("C-Delete"), # Default not-chromebook - Delete Right Word of Cursor
# K(""): pass_through_key, # cancel
# K(""): K(""), #
})
@@ -148,10 +167,10 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{
K("C-g"): K("f3"), # find_next
K("Shift-f3"): pass_through_key, # cancel find_prev
K("C-Shift-g"): K("Shift-f3"), # find_prev
K("Super-C-g"): K("C-f2"), # Default - Sublime - find_all_under
# K("Super-C-g"): K("C-f2"), # Default - Sublime - find_all_under
# K("C-M-g"): K("C-f2"), # Chromebook - Sublime - find_all_under
K("Super-Shift-up"): K("M-Shift-up"), # multi-cursor up
K("Super-Shift-down"): K("M-Shift-down"), # multi-cursor down
# K("Super-Shift-up"): K("M-Shift-up"), # multi-cursor up - Sublime
# K("Super-Shift-down"): K("M-Shift-down"), # multi-cursor down - Sublime
# K(""): pass_through_key, # cancel
# K(""): K(""), #
}, "Code")
@@ -249,7 +268,6 @@ define_keymap(re.compile(termStr, re.IGNORECASE),{
K("RC-MINUS"): K("C-Shift-MINUS"),
K("RC-EQUAL"): K("C-Shift-EQUAL"),
K("RC-BACKSPACE"): K("C-Shift-BACKSPACE"),
K("RC-Q"): K("C-Shift-Q"),
K("RC-W"): K("C-Shift-W"),
K("RC-E"): K("C-Shift-E"),
K("RC-R"): K("C-Shift-R"),

View File

@@ -5,10 +5,10 @@
typeset -l distro
distro=$(awk -F= '$1=="NAME" { print $2 ;}' /etc/os-release)
typeset -l dename
dename=$(./system-config/dename.sh | cut -d " " -f1)
function uninstall {
typeset -l dename
dename=$(./system-config/dename.sh | cut -d " " -f1)
while true; do
read -rep $'\nPress R to restore your original shortcuts.\nPress F to reset to factory shortcuts. (f/r)\n' yn
@@ -140,14 +140,34 @@ if [ $# -eq 0 ]; then
echo " 1) Windows & Mac (HID driver)"
echo " 2) Mac Only & VMs on Macbooks"
echo " 3) Chromebook"
# echo " 4) Uninstall"
echo " 4) Windows w/ Kinto - aka Linux VM"
# echo " 5) Uninstall"
read n
set "$n"
fi
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
# multi-language
rightalt=false
# VS code remap
vssublime=false
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
while true; do
read -rep $'\nDo you want multi-language support (the right Alt key will not remap)? (y/N)\n' yn
case $yn in
[Yy]* ) rightalt=true; break;;
* ) break;;
esac
done
while true; do
read -rep $'\nWould you like to give VS Code Sublime Text keymaps? (y/N)\n' yn
case $yn in
[Yy]* ) vssublime=true; break;;
* ) break;;
esac
done
branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$branch" == "dev" ] || [ "$branch" == "alpha" ];then
while true; do
@@ -173,12 +193,12 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
sudo ./system-config/unipkg.sh python3-pip
fi
if ! [ -x "$(command -v python3-config)" ]; then
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ]; then
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
pydev="python3-dev"
elif [ "$distro" == "fedora" ]; then
pydev="python3-devel"
fi
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ]; then
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
echo "Will need to install $pydev..."
sudo ./system-config/unipkg.sh "$pydev"
fi
@@ -188,6 +208,9 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
sudo ./system-config/unipkg.sh "xorg-xhost gcc"
fi
fi
if [ "$distro" == '"linux mint"' ]; then
pip3 install setuptools
fi
# echo "Transferring files..."
mkdir -p ~/.config/kinto
@@ -224,21 +247,38 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
sed -i "s/{username}/`whoami`/g" ~/.config/kinto/prexk.sh
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh
elif ! [[ $1 == "4" || $1 == "uninstall" ]]; then
echo "Expected argument was not provided"
if $vssublime ; then
perl -pi -e "s/(# )(.*)(- Sublime)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
fi
if [[ $1 == "1" || $1 == "winmac" ]]; then
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all
perl -pi -e "s/(# )(.*)(# WinMac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
elif [[ $1 == "2" || $1 == "mac" ]]; then
perl -pi -e "s/(# )(.*)(# Mac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
elif [[ $1 == "3" || $1 == "chromebook" ]]; then
perl -pi -e "s/(# )(.*)(# Chromebook)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
elif [[ $1 == "4" || $1 == "kintowin" ]]; then
perl -pi -e "s/(# )(.*)(# KintoWin)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
fi
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
if $rightalt ; then
perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
mv ./xkeysnail-config/kinto.py.new ~/.config/kinto/kinto.py
# if [ "$distro" == "fedora" ];then
sudo rm /etc/systemd/system/xkeysnail.service
@@ -253,18 +293,18 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/xkeysnail.service && echo "Created soft symlink..." || echo "Failed to create soft symlink..."
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/graphical.target.wants/xkeysnail.service && echo "Created soft symlink for graphical target..." || echo "Failed to create soft symlink for graphical target..."
xhost +SI:localuser:root
git clone --depth 5 https://github.com/rbreaves/xkeysnail.git
git checkout 51c369084e0045a8410d227bab52411bf84fb65b
git clone --depth 10 https://github.com/rbreaves/xkeysnail.git || git pull --depth 10
cd xkeysnail
git checkout 51c369084e0045a8410d227bab52411bf84fb65b
giturl=$(git ls-remote --get-url)
if [ "$geturl" != "https://github.com/rbreaves/xkeysnail.git" ];then
if [ "$giturl" != "https://github.com/rbreaves/xkeysnail.git" ];then
echo -e "\nreplacing xkeysnail with fork...\n"
cd ..
rm -rf ./xkeysnail
git clone --depth 5 https://github.com/rbreaves/xkeysnail.git
git checkout 51c369084e0045a8410d227bab52411bf84fb65b
git clone --depth 10 https://github.com/rbreaves/xkeysnail.git
cd xkeysnail
git checkout 51c369084e0045a8410d227bab52411bf84fb65b
fi
git pull origin master
sudo pip3 install --upgrade .
cd ..
sudo systemctl daemon-reload
@@ -309,7 +349,14 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
echo "You can run 'sudo systemctl status xkeysnail' for more info"
echo "You can also run 'sudo journalctl -u xkeysnail'"
fi
elif [[ $1 == "4" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
echo ""
if $vssublime ; then
echo -e "\e[1m\e[32mEnabled\e[0m VS Code Sublime Text remap."
fi
if $rightalt ; then
echo -e "\e[1m\e[32mEnabled\e[0m mutli-language support."
fi
elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
echo "Uninstalling Kinto - xkeysnail (udev)"
uninstall
# Undo Apple keyboard cmd & alt swap