Skip to content
Snippets Groups Projects
Commit 102294d4 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Add i3bar click event.

parent f13e8423
No related branches found
No related tags found
No related merge requests found
......@@ -124,7 +124,9 @@ enum MouseButton
enum Modifiers
{
Shift=1,
Ctrl=2
Control=2,
Super=4,
Alt=8
}
record ClickEvent(
......@@ -491,10 +493,24 @@ class StatusBarI3: RootStatusBar
if(jsonButton == 2) button = MouseButton.Middle; else
if(jsonButton == 3) button = MouseButton.Left; else
break;
Modifiers mod = 0;
foreach(var i in json["modifiers"].AsArray())
{
var s = i.AsValue().GetValue<string>();
if(s=="Shift") mod |= Modifiers.Shift;
if(s=="Control") mod |= Modifiers.Control;
if(s=="Mod4") mod |= Modifiers.Super;
if(s=="Mod1") mod |= Modifiers.Alt;
}
Console.Error.WriteLine(mod);
Console.Error.Flush();
var ev = new ClickEvent(
Relative: new Coordinates(json["relative_x"].AsValue().GetValue<int>(), json["relative_y"].AsValue().GetValue<int>()),
Absolute: new Coordinates(json["x"].AsValue().GetValue<int>(), json["y"].AsValue().GetValue<int>()),
Output: new Coordinates(json["output_x"].AsValue().GetValue<int>(), json["output_x"].AsValue().GetValue<int>()),
Size: new Coordinates(json["height"].AsValue().GetValue<int>(), json["width"].AsValue().GetValue<int>()),
Button: button
Button: button,
Modifiers: mod
);
string name = json["name"].AsValue().GetValue<string>();
int outputId = int.Parse(name.Split(".")[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment