Skip to content

estin/cos-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cos-cli

A CLI tool for managing windows and workspaces on the COSMIC Desktop Environment (Wayland).

Note: This is a third-party, unofficial tool. It is not affiliated with System76 or the official COSMIC project.

Features

  • List Information: View active applications, workspaces, and outputs.
  • Window Management: Move applications between workspaces by their App ID.
  • Activate Application: Bring a specific application to the foreground.
  • Smart Wait: Option to wait for an application to launch before moving it.

Installation

Ensure you have the Rust toolchain installed.

cargo build --release

or from github directly

cargo install --git https://github.com/estin/cos-cli

Usage

cos-cli [COMMAND]

Commands

info

List all available apps, workspaces, outputs and seats, including the state of each app window.

cos-cli info

Example output:

Apps:	[0] firefox (title: Gemini - Mozilla Firefox, state: [activated])	[1] org.wezfurlong.wezterm (title: cos-cli, state: [maximized]) Workspaces:	[0] Group	Workspace: 1	Workspace: 2	Workspace: 3 Outputs:	[0] Output: eDP-1 Seats:	[0] Seat: seat0 

With --json option it will output all info in JSON format.

cos-cli info --json

Example output:

{"apps":[{"index":0,"app_id":"firefox","title":"Gemini - Mozilla Firefox","state":["activated"]},{"index":1,"app_id":"org.wezfurlong.wezterm","title":"cos-cli","state":["maximized"]}],"workspaces":[{"index":0,"workspaces":[{"name":"1"},{"name":"2"},{"name":"3"}]}],"outputs":[{"index":0,"name":"eDP-1"}],"seats":[{"index":0,"name":"seat0"}]}

Using jq to find app index by pattern and activate app

cos-cli activate -i $(cos-cli info --json | jq '.apps[] | select(.app_id | test("wezterm")) | .index')

move

Move an application to a specific workspace.

cos-cli move --app-id <ID> --workspace <NAME>

Arguments:

  • -a, --app-id <ID> The Application ID (partial match, case-insensitive)
  • -i, --index <INDEX> The Application index from 'info' command
  • -w, --workspace <NAME> The name of the target workspace
  • -g, --workspace-group <INDEX> The workspace group index from 'info' command (optional)
  • -o, --output-index <INDEX> The output index from 'info' command (optional)
  • --wait <SECONDS> Wait for the app to appear (optional, only for --app-id)

activate

Activate an application.

cos-cli activate --index <INDEX>

Arguments:

  • -i, --index <INDEX> The Application index from 'info' command
  • -s, --seat <INDEX> The Seat index from 'info' command (optional)

state

Set the state of an application's window (e.g., maximize, minimize, fullscreen, sticky).

cos-cli state (--app-id <ID> | --index <INDEX>) [--wait <SECONDS>] [--maximize|--unmaximize] [--minimize|--unminimize] [--fullscreen|--unfullscreen] [--sticky|--unsticky]

Arguments:

  • -a, --app-id <ID> The Application ID (partial match, case-insensitive)
  • -i, --index <INDEX> The Application index from 'info' command
  • --wait <SECONDS> Wait for the app to appear (optional, only for --app-id)
  • --maximize Maximize the application window
  • --unmaximize Unmaximize the application window
  • --minimize Minimize the application window
  • --unminimize Unminimize the application window
  • --fullscreen Set the application window to fullscreen
  • --unfullscreen Unset the application window from fullscreen
  • --sticky Make the application window sticky (visible on all workspaces)
  • --unsticky Unset the application window from being sticky

Examples:

cos-cli state -i 0 --maximize cos-cli state --app-id firefox --sticky --fullscreen --wait 5 cos-cli state -i 1 --unminimize

About

A CLI utility for COSMIC Wayland toplevel and workspace management

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors