Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Show key casting window from Sikuli

AuthorDaveJarvis <email>
Date2020-07-15 00:15:14 GMT-0700
Commit61fd408d0974e982820264a077f630606b270601
Parentfb70940
Delta60 lines added, 31 lines removed, 29-line increase
scripts/keycast/src/main/com/whitemagicsoftware/keycast/KeyCast.java
import java.awt.geom.RoundRectangle2D;
-import static java.awt.GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT;
-import static java.awt.GraphicsDevice.WindowTranslucency.TRANSLUCENT;
-
/**
* This class is responsible for logging key presses and mouse clicks on the
* screen. While there is a plethora of software out here that does this,
* none meet all the following criteria: small size, easily positioned,
* show single key stroke or chord, shows left/right mouse clicks, shows
* release of modifier keys when quickly typing, and traps all keys typed
* from within Sikuli.
+ * <p>
+ * When using the XFCE Window Manager, enable compositing as follows:
+ * </p>
+ * <ol>
+ * <li>Open the Xfce Applications Menu.</li>
+ * <li>Click Settings, Settings Editor.</li>
+ * <li>Select xfwm4, near the bottom left.</li>
+ * <li>Check the value column for use_compositing.</li>
+ * </ol>
*/
@SuppressWarnings("unused")
private static class EventFrame extends JFrame {
public EventFrame() {
+ setDefaultLookAndFeelDecorated( true );
setUndecorated( true );
setAlwaysOnTop( true );
- setOpacity( 0.7f );
- //setBackground( new Color( 33, 33, 33, 22 ) );
+ setBackground( new Color( .2f, .2f, .2f, 0.5f ) );
+ //setOpacity( 0.55f );
+ setLocationRelativeTo( null );
setSize( FRAME_WIDTH, FRAME_HEIGHT );
-
setShape( new RoundRectangle2D.Double(
0, 0, getWidth(), getHeight(), ARC, ARC ) );
FrameDragListener frameDragListener = new FrameDragListener( this );
addMouseListener( frameDragListener );
addMouseMotionListener( frameDragListener );
- setLocationRelativeTo( null );
}
}
public static void main( final String[] args ) {
-
- // Determine what the GraphicsDevice can support.
- GraphicsEnvironment ge =
- GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice gd = ge.getDefaultScreenDevice();
- final boolean isTranslucencySupported =
- gd.isWindowTranslucencySupported(TRANSLUCENT);
-
- //If shaped windows aren't supported, exit.
- if (!gd.isWindowTranslucencySupported(PERPIXEL_TRANSPARENT)) {
- System.err.println("Shaped windows are not supported");
- System.exit(0);
- }
-
final var kc = new KeyCast();
kc.show();
scripts/keycast/.idea/workspace.xml
<component name="ChangeListManager">
<list default="true" id="780e9f19-7a15-496f-b7fb-29ddeefc2e7a" name="Default Changelist" comment="">
- <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+ <change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/com/whitemagicsoftware/keycast/KeyCast.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/com/whitemagicsoftware/keycast/KeyCast.java" afterDir="false" />
</list>
</state>
</system>
+ </component>
+ <component name="FileTemplateManagerImpl">
+ <option name="RECENT_TEMPLATES">
+ <list>
+ <option value="Class" />
+ </list>
+ </option>
</component>
<component name="Git.Settings">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
+ <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.project.gradle" />
<property name="show.unlinked.gradle.project.popup" value="true" />
</component>
- <component name="RunManager">
+ <component name="RunManager" selected="Gradle.keycast [jar]">
<configuration name="KeyCast" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.whitemagicsoftware.keycast.KeyCast" />
<option name="Make" enabled="true" />
</method>
+ </configuration>
+ <configuration name="keycast [jar]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
+ <ExternalSystemSettings>
+ <option name="executionName" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="externalSystemIdString" value="GRADLE" />
+ <option name="scriptParameters" />
+ <option name="taskDescriptions">
+ <list />
+ </option>
+ <option name="taskNames">
+ <list>
+ <option value="jar" />
+ </list>
+ </option>
+ <option name="vmOptions" />
+ </ExternalSystemSettings>
+ <GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
+ <method v="2" />
</configuration>
+ <list>
+ <item itemvalue="Application.KeyCast" />
+ <item itemvalue="Gradle.keycast [jar]" />
+ </list>
<recent_temporary>
<list>
+ <item itemvalue="Gradle.keycast [jar]" />
<item itemvalue="Application.KeyCast" />
</list>
</component>
<component name="WindowStateProjectService">
+ <state x="384" y="467" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1594796594477">
+ <screen x="0" y="28" width="2560" height="1529" />
+ </state>
+ <state x="384" y="467" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.28.2560.1529@0.28.2560.1529" timestamp="1594796594477" />
<state x="1092" y="513" width="376" height="578" key="#com.intellij.ide.util.MemberChooser" timestamp="1594787513239">
<screen x="0" y="28" width="2560" height="1529" />
</state>
<state x="1092" y="513" width="376" height="578" key="#com.intellij.ide.util.MemberChooser/0.28.2560.1529@0.28.2560.1529" timestamp="1594787513239" />
<state x="487" y="28" width="871" height="1526" key="#com.intellij.refactoring.rename.AutomaticRenamingDialog" timestamp="1594787393194">
<screen x="0" y="28" width="2560" height="1529" />
</state>
<state x="487" y="28" width="871" height="1526" key="#com.intellij.refactoring.rename.AutomaticRenamingDialog/0.28.2560.1529@0.28.2560.1529" timestamp="1594787393194" />
- <state width="1479" height="330" key="GridCell.Tab.0.bottom" timestamp="1594788657778">
+ <state width="1479" height="330" key="GridCell.Tab.0.bottom" timestamp="1594796940212">
<screen x="0" y="28" width="2560" height="1529" />
</state>
- <state width="1479" height="330" key="GridCell.Tab.0.bottom/0.28.2560.1529@0.28.2560.1529" timestamp="1594788657778" />
- <state width="1479" height="330" key="GridCell.Tab.0.center" timestamp="1594788657778">
+ <state width="1479" height="330" key="GridCell.Tab.0.bottom/0.28.2560.1529@0.28.2560.1529" timestamp="1594796940212" />
+ <state width="1479" height="330" key="GridCell.Tab.0.center" timestamp="1594796940212">
<screen x="0" y="28" width="2560" height="1529" />
</state>
- <state width="1479" height="330" key="GridCell.Tab.0.center/0.28.2560.1529@0.28.2560.1529" timestamp="1594788657778" />
- <state width="1479" height="330" key="GridCell.Tab.0.left" timestamp="1594788657778">
+ <state width="1479" height="330" key="GridCell.Tab.0.center/0.28.2560.1529@0.28.2560.1529" timestamp="1594796940212" />
+ <state width="1479" height="330" key="GridCell.Tab.0.left" timestamp="1594796940211">
<screen x="0" y="28" width="2560" height="1529" />
</state>
- <state width="1479" height="330" key="GridCell.Tab.0.left/0.28.2560.1529@0.28.2560.1529" timestamp="1594788657778" />
- <state width="1479" height="330" key="GridCell.Tab.0.right" timestamp="1594788657778">
+ <state width="1479" height="330" key="GridCell.Tab.0.left/0.28.2560.1529@0.28.2560.1529" timestamp="1594796940211" />
+ <state width="1479" height="330" key="GridCell.Tab.0.right" timestamp="1594796940212">
<screen x="0" y="28" width="2560" height="1529" />
</state>
- <state width="1479" height="330" key="GridCell.Tab.0.right/0.28.2560.1529@0.28.2560.1529" timestamp="1594788657778" />
+ <state width="1479" height="330" key="GridCell.Tab.0.right/0.28.2560.1529@0.28.2560.1529" timestamp="1594796940212" />
<state x="504" y="419" width="1026" height="842" key="SettingsEditor" timestamp="1594783076076">
<screen x="0" y="28" width="2560" height="1529" />