diff options
-rw-r--r-- | src/AglShellGrpcClient.cpp | 14 | ||||
-rw-r--r-- | src/AglShellGrpcClient.h | 1 | ||||
-rw-r--r-- | src/agl_shell.proto | 8 | ||||
-rw-r--r-- | src/main.cpp | 22 |
4 files changed, 39 insertions, 6 deletions
diff --git a/src/AglShellGrpcClient.cpp b/src/AglShellGrpcClient.cpp index 89b1883..e196e1f 100644 --- a/src/AglShellGrpcClient.cpp +++ b/src/AglShellGrpcClient.cpp @@ -90,6 +90,20 @@ GrpcClient::SetAppNormal(const std::string& app_id) return status.ok(); } +bool +GrpcClient::SetAppFullscreen(const std::string& app_id) +{ + agl_shell_ipc::FullscreenRequest request; + + request.set_app_id(app_id); + + grpc::ClientContext context; + ::agl_shell_ipc::FullscreenResponse reply; + + grpc::Status status = m_stub->SetAppFullscreen(&context, request, &reply); + return status.ok(); +} + grpc::Status GrpcClient::Wait(void) { diff --git a/src/AglShellGrpcClient.h b/src/AglShellGrpcClient.h index 61e5c63..d59ba9a 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 SetAppFullscreen(const std::string& app_id); bool SetAppNormal(const std::string& app_id); std::vector<std::string> GetOutputs(); void GetAppState(); diff --git a/src/agl_shell.proto b/src/agl_shell.proto index f8a57d2..200d43e 100644 --- a/src/agl_shell.proto +++ b/src/agl_shell.proto @@ -8,6 +8,7 @@ service AglShellManagerService { rpc DeactivateApp(DeactivateRequest) returns (DeactivateResponse) {} rpc SetAppSplit(SplitRequest) returns (SplitResponse) {} rpc SetAppFloat(FloatRequest) returns (FloatResponse) {} + rpc SetAppFullscreen(FullscreenRequest) returns (FullscreenResponse) {} rpc AppStatusState(AppStateRequest) returns (stream AppStateResponse) {} rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {} rpc SetAppNormal(NormalRequest) returns (NormalResponse) {} @@ -70,3 +71,10 @@ message NormalRequest { message NormalResponse { }; + +message FullscreenRequest { + string app_id = 1; +}; + +message FullscreenResponse { +}; diff --git a/src/main.cpp b/src/main.cpp index 56f75cd..15c88b6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,17 +48,19 @@ enum action_state { SET_SPLIT, SET_NORMAL, GETOUTPUTS, + SET_FULLSCREEN, }; static struct action { enum action_state action; const char *name; } actions[] = { - { ACTIVATE, "ACTIVATE" }, - { DEACTIVATE, "DEACTIVATE" }, - { GETOUTPUTS, "GETOUTPUTS" }, - { SET_FLOAT, "FLOAT" }, - { SET_NORMAL, "NORMAL" }, + { ACTIVATE, "ACTIVATE" }, + { DEACTIVATE, "DEACTIVATE" }, + { GETOUTPUTS, "GETOUTPUTS" }, + { SET_FLOAT, "FLOAT" }, + { SET_NORMAL, "NORMAL" }, + { SET_FULLSCREEN, "FULLSCREEN" }, }; static int @@ -85,7 +87,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|normal|getoutputs\n"); + fprintf(stderr, "\t-a -- action activate|deactivate|float|normal|getoutputs|fullscreen\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"); @@ -184,6 +186,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_FULLSCREEN: + if (!app_id) { + fprintf(stderr, "Fullscreen require an app_id\n"); + help(argv); + } + fprintf(stderr, "Fullscreened application '%s'\n", app_id); + client->SetAppFullscreen(std::string(app_id)); + break; case SET_NORMAL: if (!app_id) { fprintf(stderr, "Normal/maximized require an app_id\n"); |