A barebones tool to get screen width and height using GTK 3 and print those on the command line
Find a file
2025-04-26 11:05:44 +02:00
man use correct manpage directory 2025-04-26 11:05:44 +02:00
.gitignore add .gitignore to ignore locally test-compiled result 2025-02-02 13:04:52 +01:00
compile_strict use C99, since the code actually supports this standard 2025-02-25 21:18:57 +01:00
invo.c make the code strict C18 and add strict compilation script 2025-02-08 19:36:07 +01:00
LICENSE.txt first commit 2025-02-02 12:16:22 +01:00
README.md use C99, since the code actually supports this standard 2025-02-25 21:18:57 +01:00

“Make each program do one thing well.” Unix Philosophy

This program can get and print the monitor width and height, apply optional multipliers, and then print the result to the standard output.

This can be used as base for size-aware resizing of windows.

Compilation

Arch users might like the AUR package.

Compile using gcc and pkg-config:

# Normal compilation
gcc -std=c99 $(pkg-config --cflags gtk+-3.0) -o invo invo.c $(pkg-config --libs gtk+-3.0)

# Optionally compile with a given version string
gcc -std=c99 -Dversion_string=my_cool_version $(pkg-config --cflags gtk+-3.0) -o invo invo.c $(pkg-config --libs gtk+-3.0)

Then copy invo wherever you like.

There is also a provided POSIX compliant shell script that compiles invo.c and tests the result. The script strictly compiles C99 code and warns about anything that isnt strictly C99 code.

# Strict C99 compilation to `invo`
./compile_strict

# Strict C99 compilation to `foobar`
./compile_strict foobar

This script validates if gcc and pkg-config are available on your machine, and if so, it compiles invo.c.

Usage

The simplest call is just providing either --width or --height (or both) to print the respective information.

% invo --width
3840

% invo --width --height
3840
2160

You can also use a multiplier to change the printed value.

% invo --height 0.5
1080

A full list of options can be shown with the --help parameter.

There is also a Manapage available. The Arch package installs it automatically, otherwise just run man ./invo.1. In case of differences, this readme file has to be seen as the more recent version.