diff options
-rw-r--r-- | src/AglShellGrpcClient.cpp | 13 | ||||
-rw-r--r-- | src/AglShellGrpcClient.h | 1 | ||||
-rw-r--r-- | src/agl_shell.proto | 8 | ||||
-rw-r--r-- | src/main.cpp | 12 |
4 files changed, 33 insertions, 1 deletions
diff --git a/src/AglShellGrpcClient.cpp b/src/AglShellGrpcClient.cpp index db27190..89b1883 100644 --- a/src/AglShellGrpcClient.cpp +++ b/src/AglShellGrpcClient.cpp @@ -76,6 +76,19 @@ GrpcClient::SetAppFloat(const std::string& app_id, int32_t x_pos, int32_t y_pos) return status.ok(); } +bool +GrpcClient::SetAppNormal(const std::string& app_id) +{ + agl_shell_ipc::NormalRequest request; + + request.set_app_id(app_id); + + grpc::ClientContext context; + ::agl_shell_ipc::NormalResponse reply; + + grpc::Status status = m_stub->SetAppNormal(&context, request, &reply); + return status.ok(); +} grpc::Status GrpcClient::Wait(void) diff --git a/src/AglShellGrpcClient.h b/src/AglShellGrpcClient.h index 82ae6eb..61e5c63 100644 --- a/src/AglShellGrpcClient.h +++ b/src/AglShellGrpcClient.h @@ -93,6 +93,7 @@ public: bool ActivateApp(const std::string& app_id, const std::string& output_name); bool DeactivateApp(const std::string& app_id); bool SetAppFloat(const std::string& app_id, int32_t x_pos, int32_t y_pos); + bool SetAppNormal(const std::string& app_id); std::vector<std::string> GetOutputs(); void GetAppState(); void AppStatusState(Callback callback); diff --git a/src/agl_shell.proto b/src/agl_shell.proto index 8e81750..f8a57d2 100644 --- a/src/agl_shell.proto +++ b/src/agl_shell.proto @@ -10,6 +10,7 @@ service AglShellManagerService { rpc SetAppFloat(FloatRequest) returns (FloatResponse) {} rpc AppStatusState(AppStateRequest) returns (stream AppStateResponse) {} rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {} + rpc SetAppNormal(NormalRequest) returns (NormalResponse) {} } message ActivateRequest { @@ -62,3 +63,10 @@ message OutputResponse { message ListOutputResponse { repeated OutputResponse outputs = 1; }; + +message NormalRequest { + string app_id = 1; +}; + +message NormalResponse { +}; diff --git a/src/main.cpp b/src/main.cpp index 593de6b..56f75cd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,6 +46,7 @@ enum action_state { DEACTIVATE, SET_FLOAT, SET_SPLIT, + SET_NORMAL, GETOUTPUTS, }; @@ -57,6 +58,7 @@ static struct action { { DEACTIVATE, "DEACTIVATE" }, { GETOUTPUTS, "GETOUTPUTS" }, { SET_FLOAT, "FLOAT" }, + { SET_NORMAL, "NORMAL" }, }; static int @@ -83,7 +85,7 @@ help(char **argv) { fprintf(stderr, "Usage: %s [-a action] [-p app_id] [-o output_name] [-l]\n", argv[0]); - fprintf(stderr, "\t-a -- action activate|deactivate|float|max|getoutputs\n"); + fprintf(stderr, "\t-a -- action activate|deactivate|float|normal|getoutputs\n"); fprintf(stderr, "\t-p -- app_id application_id\n"); fprintf(stderr, "\t-o -- output_name one of the outputs from getoutputs action\n"); fprintf(stderr, "\t-l -- continuously listen for window state events\n"); @@ -182,6 +184,14 @@ int main(int argc, char *argv[]) fprintf(stderr, "Floating application '%s'\n", app_id); client->SetAppFloat(std::string(app_id), 40, 300); break; + case SET_NORMAL: + if (!app_id) { + fprintf(stderr, "Normal/maximized require an app_id\n"); + help(argv); + } + fprintf(stderr, "Maximizing application '%s'\n", app_id); + client->SetAppNormal(std::string(app_id)); + break; case GETOUTPUTS: read_outputs(client); break; |