Skip to content

Commit

Permalink
mouse & keystate datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
gerritdevriese committed Nov 3, 2022
1 parent b3a6b81 commit 7426285
Show file tree
Hide file tree
Showing 5 changed files with 805 additions and 699 deletions.
Binary file modified KZones.kwinscript
Binary file not shown.
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,27 @@ cd kzones && ./build
```

## Setup

### Behavior

#### Remember and restore window geometries
When enabled, the script will remember the window geometry when snapping it to a zone and restore it when the window is unsnapped.

#### Always show layout name
When enabled, the layout name will always be shown in the OSD

#### Modifier key
TODO

#### Non-primary mouse button
TODO

#### Zone target
The Target can be set to **Indicator** or **Zone**. **Indicator** is the default and will snap the window to the zone if cursor is inside the zone indicator. Choose **Zone** if you want to always snap the window to the zone it's dropped in. (you can cancel the snap with the "Toggle OSD" shortcut)

### Layouts
You can define layouts by putting them in the **Layouts** tab in the script settings, here are some examples to get you started:

#### Examples
<details open>
<summary>Single layout</summary>
Expand Down Expand Up @@ -179,27 +198,16 @@ If for some reason you want to move the zone indicator, you can do so by adding

This example will move the indicator 100 pixels to the right and 50 pixels up.

### Other settings

#### Determine zone

###### Target
The Target can be set to **Indicator** or **Zone**. **Indicator** is the default and will snap the window to the zone if the chosen method is inside the zone indicator. Choose **Zone** if you want to always snap the window to the zone it's dropped in. (you can cancel the snap with the "Toggle OSD" shortcut)

###### Method
By default the script will use the **Titlebar** method to determine which zone a window should snap to. This means that the window will snap when the target contains the titlebar of the window. You can change this behaviour by setting the method to **Cursor** or **Window**.

###### Size
Change the size of the chosen method, for example when using the **Titlebar** method you can decrease the size of the "handle" to make it easier to snap windows to the correct zone. You can temporarily enable debug mode to see the exact size of the "handle".

#### Filtering
### Filters
You can block certain windows from snapping by adding their class name to the exclude list. Or you can only allow certain windows to snap by adding their class name to the include list. You can find the class name of a window by running `xprop` in a terminal and clicking on the window. The class name will be in the `WM_CLASS` property.

### Advanced

#### Polling rate
The polling rate is the amount of time between each zone check when dragging a window. The default is 100ms, a faster polling rate is more accurate but will use more CPU. You can change this to your liking.

#### Inverted mode
When enabled, moving windows will not trigger the osd. Instead you'll have to use the "Toggle OSD" shortcut to show the osd.
#### Debug mode
TODO

## Shortcuts
List of all available shortcuts:
Expand Down
88 changes: 43 additions & 45 deletions contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,43 @@
</entry>

<entry name="layoutsJson" type="String">
<default>[
{
&quot;name&quot;: &quot;Layout 1&quot;,
&quot;padding&quot;: 0,
&quot;zones&quot;: [
{
&quot;name&quot;: &quot;1&quot;,
&quot;x&quot;: 0,
&quot;y&quot;: 0,
&quot;height&quot;: 100,
&quot;width&quot;: 25
},
{
&quot;name&quot;: &quot;2&quot;,
&quot;x&quot;: 25,
&quot;y&quot;: 0,
&quot;height&quot;: 100,
&quot;width&quot;: 50
},
{
&quot;name&quot;: &quot;3&quot;,
&quot;x&quot;: 75,
&quot;y&quot;: 0,
&quot;height&quot;: 100,
&quot;width&quot;: 25
}
]
}
]</default>
<default>
[
{
&quot;name&quot;: &quot;Layout 1&quot;,
&quot;padding&quot;: 0,
&quot;zones&quot;: [
{
&quot;name&quot;: &quot;1&quot;,
&quot;x&quot;: 0,
&quot;y&quot;: 0,
&quot;height&quot;: 100,
&quot;width&quot;: 25
},
{
&quot;name&quot;: &quot;2&quot;,
&quot;x&quot;: 25,
&quot;y&quot;: 0,
&quot;height&quot;: 100,
&quot;width&quot;: 50
},
{
&quot;name&quot;: &quot;3&quot;,
&quot;x&quot;: 75,
&quot;y&quot;: 0,
&quot;height&quot;: 100,
&quot;width&quot;: 25
}
]
}
]
</default>
</entry>

<entry name="pollingRate" type="Int">
<default>100</default>
</entry>

<entry name="targetMethod" type="Int">
<default>2</default>
</entry>

<entry name="handleUnitPercent" type="Bool">
<default>true</default>
</entry>

<entry name="handleUnitPixels" type="Bool">
<default>false</default>
</entry>

<entry name="handleSize" type="Int">
<default>100</default>
</entry>

<entry name="enableDebugMode" type="Bool">
<default>false</default>
</entry>
Expand Down Expand Up @@ -98,5 +84,17 @@
<default>false</default>
</entry>

<entry name="modifierKey" type="Int">
<default>5</default>
</entry>

<entry name="npmbToggle" type="Bool">
<default>true</default>
</entry>

<entry name="npmbCycle" type="Bool">
<default>false</default>
</entry>

</group>
</kcfg>
Loading

0 comments on commit 7426285

Please sign in to comment.