diff --git a/CasterQuickReference.pdf b/CasterQuickReference.pdf index a10c5f166..a957b0d3f 100644 Binary files a/CasterQuickReference.pdf and b/CasterQuickReference.pdf differ diff --git a/castervoice/apps/dragon.py b/castervoice/apps/dragon.py index 0e1d8f0bf..9baa0a2b6 100644 --- a/castervoice/apps/dragon.py +++ b/castervoice/apps/dragon.py @@ -36,12 +36,9 @@ class DragonRule(MergeRule): 'normal mode': R(Playback([(["normal", "mode", "on"], 0.0)]), rdescript="Dragon: Normal Mode"), - 'com on': + 'command mode': R(Playback([(["command", "mode", "on"], 0.0)]), - rdescript="Dragon: Command Mode (On)"), - 'com off': - R(Playback([(["command", "mode", "off"], 0.0)]), - rdescript="Dragon: Command Mode (Off)"), + rdescript="Dragon: Command Mode"), 'scratch': R(Playback([(["scratch", "that"], 0.0)]), rdescript="Dragon: 'Scratch That'"), "reboot dragon": diff --git a/castervoice/bin/VirtualDesktopAccessor.dll b/castervoice/bin/VirtualDesktopAccessor.dll new file mode 100644 index 000000000..4a588c7e4 Binary files /dev/null and b/castervoice/bin/VirtualDesktopAccessor.dll differ diff --git a/castervoice/doc/caster_quick_reference.tex b/castervoice/doc/CasterQuickReference.tex similarity index 91% rename from castervoice/doc/caster_quick_reference.tex rename to castervoice/doc/CasterQuickReference.tex index eb56a98e1..faa8e70a8 100644 --- a/castervoice/doc/caster_quick_reference.tex +++ b/castervoice/doc/CasterQuickReference.tex @@ -73,7 +73,7 @@ \put(10,205){ % Position on the page to put the title \begin{minipage}[t]{210mm} % The size and alignment of the title -\section*{Caster Quick Reference - v0.5.8} % Title +\section*{Caster Quick Reference} % Title \end{minipage} } @@ -372,7 +372,17 @@ \section*{Caster Quick Reference - v0.5.8} % Title \command{move window}{move with arrow keys} \command{window left}{snap window to left} \command{window right}{snap window to right} +\command{show work}{show active workspaces} +\command{new work}{create a new workspace} +\command{close work}{close the current workspace} +\command{close all work}{close all workspaces} +\command{previous work \footnotemark[1]}{go to the previous workspace} +\command{next work \footnotemark[1]}{go to the next workspace} +\command{go work }{go to workspace number n} +\command{send work }{send the current window to workspace n} +\command{move work }{move the current window to workspace n} +\footnotetext[1]{Takes an optional number parameter for repetition} %---------------------------------------------------------------------------------------- \sectiontitle{Repetition} @@ -388,36 +398,44 @@ \section*{Caster Quick Reference - v0.5.8} % Title \sectiontitle{Aliasing} \command{alias }{alias highlighted text} -\command{chain alias}{alias as CCR} +\command{chain alias }{alias as CCR} %---------------------------------------------------------------------------------------- -\sectiontitle{Miscellaneous} +\sectiontitle{Bring me} + +\command{program/website/folder/file to bring me as }{create a new bring me binding} +\command{bring me }{open bring me binding} +\command{remove from bring me}{} +\command{restore bring me defaults}{} -\command{pita }{fuzzy string matching} %---------------------------------------------------------------------------------------- -\sectiontitle{Special number words} \footnotemark[1] +\end{minipage} +} + +\put(200, 200){ +\begin{minipage}[t]{85mm} -\command{zero}{0} -\command{ane}{1} -\command{twain}{2} -\command{traio}{3} -\command{fairn}{4} -\command{faif}{5} -\command{six}{6} -\command{seven}{7} -\command{eigen}{8} -\command{nine}{9} +\sectiontitle{Dragon} -\footnotetext[1]{Commands which specify a number use these if the settings file is configured for it, all double-digits and larger are normal.} +\command{number/spell/dictation/normal/command mode}{switch dragon modes} +\command{reboot dragon}{} + +\sectiontitle{Update and Caster Management} + +\command{update caster}{Updates Caster} +\command{update dragonfly}{Updates Dragonfly} +\command{reboot caster}{Restarts Caster} \end{minipage} } +\end{picture} % End the container for the entire page -\put(200, 200){ -\begin{minipage}[t]{85mm} +\begin{picture}(297,210) % Create a container for the page content +\put(10,200){ % Divide the page +\begin{minipage}[t]{85mm} % Create a box to house text \sectiontitle{Example command chains} \examplecommand{shackle clear}{Select and delete the current line} @@ -430,15 +448,12 @@ \section*{Caster Quick Reference - v0.5.8} % Title \examplecommand{curly quotes arch ross deckle quotes brov}{\{"a":"b"\}} \examplecommand{backslash format command curly}{\textbackslash command\{\}} \examplecommand{(python) tell sink print to console spark three}{new line, print()} - \sectiontitle{Update and Caster Management} \command{update caster}{Updates Caster} \command{update dragonfly}{Updates Dragonfly} \command{reboot caster}{Restarts Caster} - \end{minipage} - } \end{picture} % End the container for the entire page diff --git a/castervoice/lib/ccr/core/nav.py b/castervoice/lib/ccr/core/nav.py index 7fa598aa9..6b9f0a96b 100644 --- a/castervoice/lib/ccr/core/nav.py +++ b/castervoice/lib/ccr/core/nav.py @@ -6,7 +6,7 @@ from dragonfly import Repeat, Function, Dictation, Choice, MappingRule from castervoice.lib import context, navigation, alphanumeric, textformat, text_utils -from castervoice.lib import control +from castervoice.lib import control, utilities from castervoice.lib.actions import Key, Mouse from castervoice.lib.dfplus.additions import IntegerRefST from castervoice.lib.dfplus.merge.ccrmerger import CCRMerger @@ -122,6 +122,31 @@ class NavigationNon(MappingRule): R(Key("c-w/20"), rdescript="Close Tab")*Repeat(extra="n"), "elite translation ": R(Function(alphanumeric.elite_text), rdescript="1337 Text"), + + # Workspace management + "show work [spaces]": + R(Key("w-tab"), rdescript="show workspaces"), + "(create | new) work [space]": + R(Key("wc-d"), rdescript="create workspace"), + "close work [space]": + R(Key("wc-f4"), rdescript="So close workspace"), + "close all work [spaces]": + R(Function(utilities.close_all_workspaces), + rdescript="close all work spaces"), + "next work [space] []": + R(Key("wc-right"), rdescript="next workspace")*Repeat(extra="n"), + "(previous | prior) work [space] []": + R(Key("wc-left"), rdescript="prior workspace")*Repeat(extra="n"), + + "go work [space] ": + R(Function(lambda n: utilities.go_to_desktop_number(n)), + rdescript="go to workspace n"), + "send work [space] ": + R(Function(lambda n: utilities.move_current_window_to_desktop(n)), + rdescript="send current window to workspace n"), + "move work [space] ": + R(Function(lambda n: utilities.move_current_window_to_desktop(n, True)), + rdescript="move current window to workspace n"), } extras = [ diff --git a/castervoice/lib/utilities.py b/castervoice/lib/utilities.py index 3db7f2607..0dc811da8 100644 --- a/castervoice/lib/utilities.py +++ b/castervoice/lib/utilities.py @@ -18,6 +18,7 @@ HKEY_CURRENT_USER, OpenKey, QueryValueEx) from dragonfly.windows.window import Window +from dragonfly import Key try: # Style C -- may be imported into Caster, or externally BASE_PATH = os.path.realpath(__file__).rsplit(os.path.sep + "castervoice", 1)[0] @@ -30,6 +31,33 @@ # checked to see when a new file name had appeared FILENAME_PATTERN = re.compile(r"[/\\]([\w_ ]+\.[\w]+)") +from ctypes import cdll +from win32gui import GetForegroundWindow + +def load_vda(): + # https://github.com/reckoner/pyVirtualDesktopAccessor + # provides a 32-bit python implementation (this one). + # there is a 64-bit implementation at + # https://github.com/Ciantic/VirtualDesktopAccessor + vda = cdll.LoadLibrary(BASE_PATH + "/castervoice/bin/VirtualDesktopAccessor.dll") + return vda + +def move_current_window_to_desktop(n=0, follow=False): + vda = load_vda() + wndh = GetForegroundWindow() + vda.MoveWindowToDesktopNumber(wndh, n-1) + if follow: + vda.GoToDesktopNumber(n-1) + +def go_to_desktop_number(n): + vda = load_vda() + return vda.GoToDesktopNumber(n-1) + +def close_all_workspaces(): + vda = load_vda() + total = vda.GetDesktopCount() + go_to_desktop_number(total) + Key("wc-f4/10:" + str(total-1)).execute() def window_exists(classname, windowname): try: