Skip to content

Commit

Permalink
Merge branch 'windowmgmt' into develop
Browse files Browse the repository at this point in the history
#  Fixed Conflicts:
#	CasterQuickReference.pdf
#	castervoice/doc/CasterQuickReference.tex
  • Loading branch information
LexiconCode committed Mar 4, 2019
2 parents 5591499 + 3c74684 commit efbaff9
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 27 deletions.
Binary file modified CasterQuickReference.pdf
Binary file not shown.
7 changes: 2 additions & 5 deletions castervoice/apps/dragon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
Binary file added castervoice/bin/VirtualDesktopAccessor.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}

Expand Down Expand Up @@ -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 <n>}{go to workspace number n}
\command{send work <n>}{send the current window to workspace n}
\command{move work <n>}{move the current window to workspace n}

\footnotetext[1]{Takes an optional number parameter for repetition}
%----------------------------------------------------------------------------------------

\sectiontitle{Repetition}
Expand All @@ -388,36 +398,44 @@ \section*{Caster Quick Reference - v0.5.8} % Title
\sectiontitle{Aliasing}

\command{alias <dict>}{alias highlighted text}
\command{chain alias}{alias as CCR}
\command{chain alias <dict>}{alias as CCR}

%----------------------------------------------------------------------------------------

\sectiontitle{Miscellaneous}
\sectiontitle{Bring me}

\command{program/website/folder/file to bring me as <key>}{create a new bring me binding}
\command{bring me <key>}{open bring me binding}
\command{remove <key> from bring me}{}
\command{restore bring me defaults}{}

\command{pita <text>}{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}
Expand All @@ -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(<third clipboard position>)}

\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
Expand Down
27 changes: 26 additions & 1 deletion castervoice/lib/ccr/core/nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -122,6 +122,31 @@ class NavigationNon(MappingRule):
R(Key("c-w/20"), rdescript="Close Tab")*Repeat(extra="n"),
"elite translation <text>":
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] [<n>]":
R(Key("wc-right"), rdescript="next workspace")*Repeat(extra="n"),
"(previous | prior) work [space] [<n>]":
R(Key("wc-left"), rdescript="prior workspace")*Repeat(extra="n"),

"go work [space] <n>":
R(Function(lambda n: utilities.go_to_desktop_number(n)),
rdescript="go to workspace n"),
"send work [space] <n>":
R(Function(lambda n: utilities.move_current_window_to_desktop(n)),
rdescript="send current window to workspace n"),
"move work [space] <n>":
R(Function(lambda n: utilities.move_current_window_to_desktop(n, True)),
rdescript="move current window to workspace n"),
}

extras = [
Expand Down
28 changes: 28 additions & 0 deletions castervoice/lib/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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:
Expand Down

0 comments on commit efbaff9

Please sign in to comment.