mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-18 22:26:12 +01:00
Debug stuff
This commit is contained in:
parent
f7068a1146
commit
3f87784248
13 changed files with 249 additions and 271 deletions
|
@ -1,3 +1,5 @@
|
|||
local inspect = require("inspect")
|
||||
|
||||
require("pinnacle").setup(function(Pinnacle)
|
||||
local Input = Pinnacle.input
|
||||
local Process = Pinnacle.process
|
||||
|
@ -12,104 +14,111 @@ require("pinnacle").setup(function(Pinnacle)
|
|||
|
||||
local terminal = "alacritty"
|
||||
|
||||
Input:mousebind({ mod_key }, "btn_left", "press", function()
|
||||
Window:begin_move("btn_left")
|
||||
end)
|
||||
|
||||
Input:mousebind({ mod_key }, "btn_right", "press", function()
|
||||
Window:begin_resize("btn_right")
|
||||
end)
|
||||
|
||||
------
|
||||
|
||||
Input:keybind({ mod_key, "alt" }, "q", function()
|
||||
Pinnacle:quit()
|
||||
end)
|
||||
|
||||
Input:keybind({ mod_key, "alt" }, "c", function()
|
||||
local focused = Window:get_focused()
|
||||
if focused then
|
||||
focused:close()
|
||||
end
|
||||
end)
|
||||
|
||||
Input:keybind({ mod_key }, key.Return, function()
|
||||
Process:spawn(terminal)
|
||||
end)
|
||||
|
||||
Input:keybind({ mod_key, "alt" }, key.space, function()
|
||||
local focused = Window:get_focused()
|
||||
if focused then
|
||||
focused:toggle_floating()
|
||||
end
|
||||
end)
|
||||
|
||||
Input:keybind({ mod_key }, "f", function()
|
||||
local focused = Window:get_focused()
|
||||
if focused then
|
||||
focused:toggle_fullscreen()
|
||||
end
|
||||
end)
|
||||
|
||||
Input:keybind({ mod_key }, "m", function()
|
||||
local focused = Window:get_focused()
|
||||
if focused then
|
||||
focused:toggle_maximized()
|
||||
end
|
||||
end)
|
||||
|
||||
local tag_names = { "1", "2", "3", "4", "5" }
|
||||
|
||||
Output:connect_for_all(function(op)
|
||||
local tags = Tag:add(op, tag_names)
|
||||
Output:connect_for_all(function(output)
|
||||
local tags = Tag:add(output, "1", "2", "3", "4", "5")
|
||||
tags[1]:set_active(true)
|
||||
end)
|
||||
|
||||
Process:spawn_once("foot")
|
||||
local output = Output:get_all()[1]
|
||||
|
||||
local layout_cycler = Tag:new_layout_cycler({
|
||||
"master_stack",
|
||||
"dwindle",
|
||||
"spiral",
|
||||
"corner_top_left",
|
||||
"corner_top_right",
|
||||
"corner_bottom_left",
|
||||
"corner_bottom_right",
|
||||
})
|
||||
Process:spawn("alacritty")
|
||||
|
||||
Input:keybind({ mod_key }, key.space, function()
|
||||
local focused_op = Output:get_focused()
|
||||
if focused_op then
|
||||
layout_cycler.next(focused_op)
|
||||
Input:keybind({}, "q", function()
|
||||
print("Keybind: q")
|
||||
end)
|
||||
Input:keybind({ "shift" }, "q", function()
|
||||
-- Should not happen, overridden by shift Q
|
||||
print("Keybind: shift q")
|
||||
end)
|
||||
Input:keybind({}, "Q", function()
|
||||
print("Keybind: Q")
|
||||
end)
|
||||
Input:keybind({ "shift" }, "Q", function()
|
||||
print("Keybind: shift Q")
|
||||
end)
|
||||
Input:keybind({}, "@", function()
|
||||
-- Should not happen, can't get @ without shift
|
||||
print("Keybind: @")
|
||||
end)
|
||||
Input:keybind({ "ctrl" }, "@", function()
|
||||
--- Should not happen, same as above
|
||||
print("Keybind: ctrl @")
|
||||
end)
|
||||
|
||||
Input:keybind({ "shift" }, "a", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_fullscreen(true)
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "s", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_fullscreen(false)
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "d", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_maximized(true)
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "f", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_maximized(false)
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "g", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_floating(true)
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "h", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_floating(false)
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "j", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:toggle_fullscreen()
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "k", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:toggle_maximized()
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "shift" }, "l", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:toggle_floating()
|
||||
end
|
||||
end)
|
||||
|
||||
Input:keybind({ mod_key, "shift" }, key.space, function()
|
||||
local focused_op = Output:get_focused()
|
||||
if focused_op then
|
||||
layout_cycler.prev(focused_op)
|
||||
Input:keybind({ "shift" }, "z", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_geometry({ x = 100, y = 200, width = 500, height = 200 })
|
||||
end
|
||||
end)
|
||||
Input:keybind({ "ctrl" }, "z", function()
|
||||
local win = Window:get_focused()
|
||||
if win then
|
||||
win:set_geometry({ width = 500, height = 200 })
|
||||
end
|
||||
end)
|
||||
|
||||
for _, tag_name in ipairs(tag_names) do
|
||||
-- nil-safety: tags are guaranteed to be on the outputs due to connect_for_all above
|
||||
Input:keybind({ mod_key }, tag_name, function()
|
||||
Tag:get(tag_name):switch_to()
|
||||
end)
|
||||
Input:keybind({ mod_key, "shift" }, tag_name, function()
|
||||
Tag:get(tag_name):toggle_active()
|
||||
end)
|
||||
Input:keybind({ mod_key, "alt" }, tag_name, function()
|
||||
local focused = Window:get_focused()
|
||||
if focused then
|
||||
focused:move_to_tag(Tag:get(tag_name) --[[@as TagHandle]])
|
||||
end
|
||||
end)
|
||||
Input:keybind({ mod_key, "shift", "alt" }, tag_name, function()
|
||||
local focused = Window:get_focused()
|
||||
if focused then
|
||||
focused:toggle_tag(Tag:get(tag_name) --[[@as TagHandle]])
|
||||
end
|
||||
end)
|
||||
end
|
||||
Input:keybind({ "ctrl" }, key.Return, function()
|
||||
Process:spawn("alacritty")
|
||||
end)
|
||||
Input:keybind({ "shift" }, "x", function()
|
||||
print(inspect(Output:get_focused():props()))
|
||||
print(inspect(Window:get_focused():props()))
|
||||
print(inspect(Tag:get("1"):props()))
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -9,12 +9,10 @@ function protobuf.build_protos()
|
|||
local proto_file_paths = {
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/tag/" .. version .. "/tag.proto",
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/input/" .. version .. "/input.proto",
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/input/libinput/" .. version .. "/libinput.proto",
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/" .. version .. "/pinnacle.proto",
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/output/" .. version .. "/output.proto",
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/process/" .. version .. "/process.proto",
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/window/" .. version .. "/window.proto",
|
||||
PINNACLE_PROTO_DIR .. "/pinnacle/window/rules/" .. version .. "/rules.proto",
|
||||
}
|
||||
|
||||
local cmd = "protoc --descriptor_set_out=/tmp/pinnacle.pb --proto_path=" .. PINNACLE_PROTO_DIR .. " "
|
||||
|
|
|
@ -36,6 +36,7 @@ end
|
|||
|
||||
-- This is an @enum and not an @alias because with an @alias the completion replaces tables with a string,
|
||||
-- which is annoying
|
||||
|
||||
---@enum (key) Modifier
|
||||
local modifier_values = {
|
||||
shift = 1,
|
||||
|
|
|
@ -281,10 +281,10 @@ function Window:add_window_rule(rule)
|
|||
|
||||
if rule.rule.tags then
|
||||
local ids = {}
|
||||
for _, tg in ipairs(rule.cond.tags) do
|
||||
for _, tg in ipairs(rule.rule.tags) do
|
||||
table.insert(ids, tg.id)
|
||||
end
|
||||
rule.cond.tags = ids
|
||||
rule.rule.tags = ids
|
||||
end
|
||||
|
||||
if rule.rule.fullscreen_or_maximized then
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
syntax = "proto2";
|
||||
|
||||
package pinnacle.input.libinput.v0alpha1;
|
||||
|
||||
message SetLibinputSettingRequest {
|
||||
// Pointer acceleration profile
|
||||
enum AccelProfile {
|
||||
ACCEL_PROFILE_UNSPECIFIED = 0;
|
||||
// No acceleration
|
||||
ACCEL_PROFILE_FLAT = 1;
|
||||
// Acceleration
|
||||
ACCEL_PROFILE_ADAPTIVE = 2;
|
||||
}
|
||||
|
||||
message CalibrationMatrix {
|
||||
// Exactly 6 floats
|
||||
repeated float matrix = 1;
|
||||
}
|
||||
|
||||
// The click method defines when to generate software-emulated
|
||||
// buttons, usually on a device that does not have a specific
|
||||
// physical button available.
|
||||
enum ClickMethod {
|
||||
CLICK_METHOD_UNSPECIFIED = 0;
|
||||
CLICK_METHOD_BUTTON_AREAS = 1;
|
||||
CLICK_METHOD_CLICK_FINGER = 2;
|
||||
}
|
||||
|
||||
// The scroll method of a device selects when to generate scroll axis
|
||||
// events instead of pointer motion events.
|
||||
enum ScrollMethod {
|
||||
SCROLL_METHOD_UNSPECIFIED = 0;
|
||||
SCROLL_METHOD_NO_SCROLL = 1;
|
||||
SCROLL_METHOD_TWO_FINGER = 2;
|
||||
SCROLL_METHOD_EDGE = 3;
|
||||
SCROLL_METHOD_ON_BUTTON_DOWN = 4;
|
||||
}
|
||||
|
||||
// Map 1/2/3 finger taps to buttons
|
||||
enum TapButtonMap {
|
||||
TAP_BUTTON_MAP_UNSPECIFIED = 0;
|
||||
// 1 tap = left mouse, 2 = right, 3 = middle
|
||||
TAP_BUTTON_MAP_LEFT_RIGHT_MIDDLE = 1;
|
||||
// 1 tap = left mouse, 2 = middle, 3 = right
|
||||
TAP_BUTTON_MAP_LEFT_MIDDLE_RIGHT = 2;
|
||||
}
|
||||
|
||||
oneof setting {
|
||||
AccelProfile accel_profile = 1;
|
||||
double accel_speed = 2;
|
||||
CalibrationMatrix calibration_matrix = 3;
|
||||
ClickMethod click_method = 4;
|
||||
// When `true`, the device will be disabled while typing
|
||||
// and for a short period after.
|
||||
bool disable_while_typing = 5;
|
||||
bool left_handed = 6;
|
||||
bool middle_emulation = 7;
|
||||
uint32 rotation_angle = 8;
|
||||
// When the scroll method is set to `SCROLL_METHOD_ON_BUTTON_DOWN`,
|
||||
// pointer motion will become scroll motion and
|
||||
// the specified button will also not have any press/release events
|
||||
// generated.
|
||||
uint32 scroll_button = 9;
|
||||
// Only applies when the scroll method is `SCROLL_METHOD_ON_BUTTON_DOWN`.
|
||||
// When `false`, the scroll button must be held down to button scroll.
|
||||
// When `true`, the scroll button toggles scrolling instead.
|
||||
bool scroll_button_lock = 10;
|
||||
ScrollMethod scroll_method = 11;
|
||||
// When `true`, the direction of scrolling will be reversed.
|
||||
// Useful for eg. trackpads.
|
||||
bool natural_scroll = 12;
|
||||
TapButtonMap tap_button_map = 13;
|
||||
// Enable or disable double-tap dragging
|
||||
bool tap_drag = 14;
|
||||
// Enable or disable a timeout that allows tap-drags to continue
|
||||
// when the finger is lifted and placed back during a tap-drag
|
||||
bool tap_drag_lock = 15;
|
||||
// Enable or disable tap-to-click
|
||||
bool tap = 16;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ syntax = "proto2";
|
|||
package pinnacle.input.v0alpha1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "pinnacle/input/libinput/v0alpha1/libinput.proto";
|
||||
|
||||
enum Modifier {
|
||||
MODIFIER_UNSPECIFIED = 0;
|
||||
|
@ -50,6 +49,84 @@ message SetRepeatRateRequest {
|
|||
optional int32 delay = 2;
|
||||
}
|
||||
|
||||
message SetLibinputSettingRequest {
|
||||
// Pointer acceleration profile
|
||||
enum AccelProfile {
|
||||
ACCEL_PROFILE_UNSPECIFIED = 0;
|
||||
// No acceleration
|
||||
ACCEL_PROFILE_FLAT = 1;
|
||||
// Acceleration
|
||||
ACCEL_PROFILE_ADAPTIVE = 2;
|
||||
}
|
||||
|
||||
message CalibrationMatrix {
|
||||
// Exactly 6 floats
|
||||
repeated float matrix = 1;
|
||||
}
|
||||
|
||||
// The click method defines when to generate software-emulated
|
||||
// buttons, usually on a device that does not have a specific
|
||||
// physical button available.
|
||||
enum ClickMethod {
|
||||
CLICK_METHOD_UNSPECIFIED = 0;
|
||||
CLICK_METHOD_BUTTON_AREAS = 1;
|
||||
CLICK_METHOD_CLICK_FINGER = 2;
|
||||
}
|
||||
|
||||
// The scroll method of a device selects when to generate scroll axis
|
||||
// events instead of pointer motion events.
|
||||
enum ScrollMethod {
|
||||
SCROLL_METHOD_UNSPECIFIED = 0;
|
||||
SCROLL_METHOD_NO_SCROLL = 1;
|
||||
SCROLL_METHOD_TWO_FINGER = 2;
|
||||
SCROLL_METHOD_EDGE = 3;
|
||||
SCROLL_METHOD_ON_BUTTON_DOWN = 4;
|
||||
}
|
||||
|
||||
// Map 1/2/3 finger taps to buttons
|
||||
enum TapButtonMap {
|
||||
TAP_BUTTON_MAP_UNSPECIFIED = 0;
|
||||
// 1 tap = left mouse, 2 = right, 3 = middle
|
||||
TAP_BUTTON_MAP_LEFT_RIGHT_MIDDLE = 1;
|
||||
// 1 tap = left mouse, 2 = middle, 3 = right
|
||||
TAP_BUTTON_MAP_LEFT_MIDDLE_RIGHT = 2;
|
||||
}
|
||||
|
||||
oneof setting {
|
||||
AccelProfile accel_profile = 1;
|
||||
double accel_speed = 2;
|
||||
CalibrationMatrix calibration_matrix = 3;
|
||||
ClickMethod click_method = 4;
|
||||
// When `true`, the device will be disabled while typing
|
||||
// and for a short period after.
|
||||
bool disable_while_typing = 5;
|
||||
bool left_handed = 6;
|
||||
bool middle_emulation = 7;
|
||||
uint32 rotation_angle = 8;
|
||||
// When the scroll method is set to `SCROLL_METHOD_ON_BUTTON_DOWN`,
|
||||
// pointer motion will become scroll motion and
|
||||
// the specified button will also not have any press/release events
|
||||
// generated.
|
||||
uint32 scroll_button = 9;
|
||||
// Only applies when the scroll method is `SCROLL_METHOD_ON_BUTTON_DOWN`.
|
||||
// When `false`, the scroll button must be held down to button scroll.
|
||||
// When `true`, the scroll button toggles scrolling instead.
|
||||
bool scroll_button_lock = 10;
|
||||
ScrollMethod scroll_method = 11;
|
||||
// When `true`, the direction of scrolling will be reversed.
|
||||
// Useful for eg. trackpads.
|
||||
bool natural_scroll = 12;
|
||||
TapButtonMap tap_button_map = 13;
|
||||
// Enable or disable double-tap dragging
|
||||
bool tap_drag = 14;
|
||||
// Enable or disable a timeout that allows tap-drags to continue
|
||||
// when the finger is lifted and placed back during a tap-drag
|
||||
bool tap_drag_lock = 15;
|
||||
// Enable or disable tap-to-click
|
||||
bool tap = 16;
|
||||
}
|
||||
}
|
||||
|
||||
service InputService {
|
||||
rpc SetKeybind(SetKeybindRequest) returns (stream SetKeybindResponse);
|
||||
rpc SetMousebind(SetMousebindRequest) returns (stream SetMousebindResponse);
|
||||
|
@ -57,5 +134,5 @@ service InputService {
|
|||
rpc SetXkbConfig(SetXkbConfigRequest) returns (google.protobuf.Empty);
|
||||
rpc SetRepeatRate(SetRepeatRateRequest) returns (google.protobuf.Empty);
|
||||
|
||||
rpc SetLibinputSetting(.pinnacle.input.libinput.v0alpha1.SetLibinputSettingRequest) returns (google.protobuf.Empty);
|
||||
rpc SetLibinputSetting(SetLibinputSettingRequest) returns (google.protobuf.Empty);
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
syntax = "proto2";
|
||||
|
||||
package pinnacle.window.rules.v0alpha1;
|
||||
|
||||
enum FullscreenOrMaximized {
|
||||
FULLSCREEN_OR_MAXIMIZED_UNSPECIFIED = 0;
|
||||
FULLSCREEN_OR_MAXIMIZED_NEITHER = 1;
|
||||
FULLSCREEN_OR_MAXIMIZED_FULLSCREEN = 2;
|
||||
FULLSCREEN_OR_MAXIMIZED_MAXIMIZED = 3;
|
||||
}
|
||||
|
||||
message AddWindowRuleRequest {
|
||||
optional WindowRuleCondition cond = 1;
|
||||
optional WindowRule rule = 2;
|
||||
}
|
||||
|
||||
message WindowRuleCondition {
|
||||
repeated WindowRuleCondition any = 1;
|
||||
repeated WindowRuleCondition all = 2;
|
||||
repeated string classes = 3;
|
||||
repeated string titles = 4;
|
||||
repeated uint32 tags = 5;
|
||||
}
|
||||
|
||||
message WindowRule {
|
||||
optional string output = 1;
|
||||
repeated uint32 tags = 2;
|
||||
// `true` for floating, `false` for tiled
|
||||
optional bool floating = 3;
|
||||
|
||||
optional FullscreenOrMaximized fullscreen_or_maximized = 4;
|
||||
|
||||
optional int32 x = 5;
|
||||
optional int32 y = 6;
|
||||
optional int32 width = 7;
|
||||
optional int32 height = 8;
|
||||
}
|
|
@ -4,7 +4,6 @@ package pinnacle.window.v0alpha1;
|
|||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "pinnacle/v0alpha1/pinnacle.proto";
|
||||
import "pinnacle/window/rules/v0alpha1/rules.proto";
|
||||
|
||||
message CloseRequest {
|
||||
optional uint32 window_id = 1;
|
||||
|
@ -76,10 +75,44 @@ message GetPropertiesResponse {
|
|||
optional string title = 3;
|
||||
optional bool focused = 4;
|
||||
optional bool floating = 5;
|
||||
optional .pinnacle.window.rules.v0alpha1.FullscreenOrMaximized fullscreen_or_maximized = 6;
|
||||
optional FullscreenOrMaximized fullscreen_or_maximized = 6;
|
||||
repeated uint32 tag_ids = 7;
|
||||
}
|
||||
|
||||
enum FullscreenOrMaximized {
|
||||
FULLSCREEN_OR_MAXIMIZED_UNSPECIFIED = 0;
|
||||
FULLSCREEN_OR_MAXIMIZED_NEITHER = 1;
|
||||
FULLSCREEN_OR_MAXIMIZED_FULLSCREEN = 2;
|
||||
FULLSCREEN_OR_MAXIMIZED_MAXIMIZED = 3;
|
||||
}
|
||||
|
||||
message AddWindowRuleRequest {
|
||||
optional WindowRuleCondition cond = 1;
|
||||
optional WindowRule rule = 2;
|
||||
}
|
||||
|
||||
message WindowRuleCondition {
|
||||
repeated WindowRuleCondition any = 1;
|
||||
repeated WindowRuleCondition all = 2;
|
||||
repeated string classes = 3;
|
||||
repeated string titles = 4;
|
||||
repeated uint32 tags = 5;
|
||||
}
|
||||
|
||||
message WindowRule {
|
||||
optional string output = 1;
|
||||
repeated uint32 tags = 2;
|
||||
// `true` for floating, `false` for tiled
|
||||
optional bool floating = 3;
|
||||
|
||||
optional FullscreenOrMaximized fullscreen_or_maximized = 4;
|
||||
|
||||
optional int32 x = 5;
|
||||
optional int32 y = 6;
|
||||
optional int32 width = 7;
|
||||
optional int32 height = 8;
|
||||
}
|
||||
|
||||
service WindowService {
|
||||
rpc Close(CloseRequest) returns (google.protobuf.Empty);
|
||||
rpc SetGeometry(SetGeometryRequest) returns (google.protobuf.Empty);
|
||||
|
@ -94,5 +127,5 @@ service WindowService {
|
|||
rpc Get(GetRequest) returns (GetResponse);
|
||||
rpc GetProperties(GetPropertiesRequest) returns (GetPropertiesResponse);
|
||||
|
||||
rpc AddWindowRule(.pinnacle.window.rules.v0alpha1.AddWindowRuleRequest) returns (google.protobuf.Empty);
|
||||
rpc AddWindowRule(AddWindowRuleRequest) returns (google.protobuf.Empty);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,10 @@ fn main() {
|
|||
const PROTOS: &[&str] = &[
|
||||
formatcp!("../api/protocol/pinnacle/{VERSION}/pinnacle.proto"),
|
||||
formatcp!("../api/protocol/pinnacle/input/{VERSION}/input.proto"),
|
||||
formatcp!("../api/protocol/pinnacle/input/libinput/{VERSION}/libinput.proto"),
|
||||
formatcp!("../api/protocol/pinnacle/output/{VERSION}/output.proto"),
|
||||
formatcp!("../api/protocol/pinnacle/process/{VERSION}/process.proto"),
|
||||
formatcp!("../api/protocol/pinnacle/tag/{VERSION}/tag.proto"),
|
||||
formatcp!("../api/protocol/pinnacle/window/{VERSION}/window.proto"),
|
||||
formatcp!("../api/protocol/pinnacle/window/rules/{VERSION}/rules.proto"),
|
||||
];
|
||||
|
||||
let descriptor_path = PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("pinnacle.bin");
|
||||
|
|
|
@ -8,12 +8,6 @@ pub mod pinnacle {
|
|||
pub mod v0alpha1 {
|
||||
tonic::include_proto!("pinnacle.input.v0alpha1");
|
||||
}
|
||||
|
||||
pub mod libinput {
|
||||
pub mod v0alpha1 {
|
||||
tonic::include_proto!("pinnacle.input.libinput.v0alpha1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod output {
|
||||
|
@ -32,12 +26,6 @@ pub mod pinnacle {
|
|||
pub mod v0alpha1 {
|
||||
tonic::include_proto!("pinnacle.window.v0alpha1");
|
||||
}
|
||||
|
||||
pub mod rules {
|
||||
pub mod v0alpha1 {
|
||||
tonic::include_proto!("pinnacle.window.rules.v0alpha1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod process {
|
||||
|
|
|
@ -1,26 +1,22 @@
|
|||
use std::{ffi::OsString, num::NonZeroU32, pin::Pin, process::Stdio};
|
||||
|
||||
use pinnacle_api_defs::pinnacle::{
|
||||
input::{
|
||||
libinput::v0alpha1::set_libinput_setting_request::{
|
||||
AccelProfile, ClickMethod, ScrollMethod, TapButtonMap,
|
||||
},
|
||||
v0alpha1::set_mousebind_request::MouseEdge,
|
||||
input::v0alpha1::{
|
||||
set_libinput_setting_request::{AccelProfile, ClickMethod, ScrollMethod, TapButtonMap},
|
||||
set_mousebind_request::MouseEdge,
|
||||
SetKeybindRequest, SetKeybindResponse, SetLibinputSettingRequest, SetMousebindRequest,
|
||||
SetMousebindResponse, SetRepeatRateRequest, SetXkbConfigRequest,
|
||||
},
|
||||
output::v0alpha1::{ConnectForAllRequest, ConnectForAllResponse, SetLocationRequest},
|
||||
process::v0alpha1::SetEnvRequest,
|
||||
process::v0alpha1::{SetEnvRequest, SpawnRequest, SpawnResponse},
|
||||
tag::v0alpha1::{
|
||||
AddRequest, AddResponse, RemoveRequest, SetActiveRequest, SetLayoutRequest, SwitchToRequest,
|
||||
},
|
||||
v0alpha1::Geometry,
|
||||
window::{
|
||||
rules::v0alpha1::{
|
||||
AddWindowRuleRequest, FullscreenOrMaximized, WindowRule, WindowRuleCondition,
|
||||
},
|
||||
v0alpha1::{
|
||||
CloseRequest, MoveGrabRequest, MoveToTagRequest, ResizeGrabRequest, SetFloatingRequest,
|
||||
SetFullscreenRequest, SetGeometryRequest, SetMaximizedRequest, SetTagRequest,
|
||||
},
|
||||
v0alpha1::{Geometry, QuitRequest},
|
||||
window::v0alpha1::{
|
||||
AddWindowRuleRequest, CloseRequest, FullscreenOrMaximized, MoveGrabRequest,
|
||||
MoveToTagRequest, ResizeGrabRequest, SetFloatingRequest, SetFullscreenRequest,
|
||||
SetGeometryRequest, SetMaximizedRequest, SetTagRequest, WindowRule, WindowRuleCondition,
|
||||
},
|
||||
};
|
||||
use smithay::{
|
||||
|
@ -45,18 +41,6 @@ use crate::{
|
|||
window::{window_state::WindowId, WindowElement},
|
||||
};
|
||||
|
||||
use pinnacle_api_defs::pinnacle::{
|
||||
input::{
|
||||
libinput::v0alpha1::SetLibinputSettingRequest,
|
||||
v0alpha1::{
|
||||
SetKeybindRequest, SetKeybindResponse, SetMousebindRequest, SetMousebindResponse,
|
||||
SetRepeatRateRequest, SetXkbConfigRequest,
|
||||
},
|
||||
},
|
||||
process::v0alpha1::{SpawnRequest, SpawnResponse},
|
||||
v0alpha1::QuitRequest,
|
||||
};
|
||||
|
||||
type ResponseStream<T> = Pin<Box<dyn Stream<Item = Result<T, Status>> + Send>>;
|
||||
pub type StateFnSender = calloop::channel::Sender<Box<dyn FnOnce(&mut State) + Send>>;
|
||||
|
||||
|
@ -275,7 +259,7 @@ impl pinnacle_api_defs::pinnacle::input::v0alpha1::input_service_server::InputSe
|
|||
|
||||
let discriminant = std::mem::discriminant(&setting);
|
||||
|
||||
use pinnacle_api_defs::pinnacle::input::libinput::v0alpha1::set_libinput_setting_request::Setting;
|
||||
use pinnacle_api_defs::pinnacle::input::v0alpha1::set_libinput_setting_request::Setting;
|
||||
let apply_setting: Box<dyn Fn(&mut libinput::Device) + Send> = match setting {
|
||||
Setting::AccelProfile(profile) => {
|
||||
let profile = AccelProfile::try_from(profile).unwrap_or(AccelProfile::Unspecified);
|
||||
|
|
|
@ -10,9 +10,9 @@ use crate::{
|
|||
state::WithState,
|
||||
window::WindowElement,
|
||||
};
|
||||
use pinnacle_api_defs::pinnacle::input::{
|
||||
libinput::v0alpha1::set_libinput_setting_request::Setting,
|
||||
v0alpha1::{set_mousebind_request, SetKeybindResponse, SetMousebindResponse},
|
||||
use pinnacle_api_defs::pinnacle::input::v0alpha1::{
|
||||
set_libinput_setting_request::Setting, set_mousebind_request, SetKeybindResponse,
|
||||
SetMousebindResponse,
|
||||
};
|
||||
use smithay::{
|
||||
backend::input::{
|
||||
|
|
28
src/state.rs
28
src/state.rs
|
@ -186,7 +186,6 @@ impl State {
|
|||
let mut seat = seat_state.new_wl_seat(&display_handle, backend.seat_name());
|
||||
seat.add_pointer();
|
||||
|
||||
// TODO: update from config
|
||||
seat.add_keyboard(XkbConfig::default(), 500, 25)?;
|
||||
|
||||
loop_handle.insert_idle(|data| {
|
||||
|
@ -231,6 +230,8 @@ impl State {
|
|||
|
||||
data.state.xwm = Some(wm);
|
||||
data.state.xdisplay = Some(display);
|
||||
|
||||
std::env::set_var("DISPLAY", format!(":{display}"));
|
||||
}
|
||||
XWaylandEvent::Exited => {
|
||||
data.state.xwm.take();
|
||||
|
@ -319,14 +320,7 @@ impl State {
|
|||
loop_signal_clone.stop();
|
||||
});
|
||||
|
||||
tokio::spawn(async move {
|
||||
grpc_server
|
||||
.serve_with_incoming_shutdown(uds_stream, ping_rx_future)
|
||||
.await
|
||||
.expect("failed to serve grpc");
|
||||
});
|
||||
|
||||
Ok(Self {
|
||||
let state = Self {
|
||||
backend,
|
||||
loop_signal,
|
||||
loop_handle,
|
||||
|
@ -378,7 +372,21 @@ impl State {
|
|||
|
||||
config_join_handle: None,
|
||||
grpc_kill_pinger: ping_tx,
|
||||
})
|
||||
};
|
||||
|
||||
state.schedule(
|
||||
|data| data.state.xdisplay.is_some(),
|
||||
move |_| {
|
||||
tokio::spawn(async move {
|
||||
grpc_server
|
||||
.serve_with_incoming_shutdown(uds_stream, ping_rx_future)
|
||||
.await
|
||||
.expect("failed to serve grpc");
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
/// Schedule `run` to run when `condition` returns true.
|
||||
|
|
Loading…
Reference in a new issue