Jump to content

How to Show OSD Overlay in Fullscreen Linux Apps and Games

Linux Hint

Recommended Posts

Playing fullscreen games or using apps in distraction free fullscreen mode can cut you off from relevant system information visible in a panel or taskbar. To overcome this, you can use an OSD (on-screen display) overlay on fullscreen apps and games. This article will cover a guide on a handy OSD creation command line utility, simply called “osd_cat”. Terms like OSD and HUD (heads-up display) will be used interchangeably in the article.

Installing Osd_cat in Linux

To install osd_cat in Ubuntu, run the command below:

$ sudo apt install xosd-bin

You can install osd_cat in other Linux distributions by searching for it in the package manager application.

Osd_cat comes with many command line options, it is not possible to cover all use cases here. You can access osd_cat man page by running the command below:

$ man osd_cat

Osd_cat man page is also available online. A few examples are explained below, giving you some idea about usage of osd_cat and its various command line options.

Date and Time

To show a continuously updating date and time HUD, run the command below:

$ while true; do date; sleep 1; done | osd_cat --align center
--pos middle --lines 1 --delay 1

The command runs a never ending “while” loop in a terminal and updates output of the “date” command every second. The pipe symbol “ | “ is used to feed output of “date” command into the osd_cat command. The “-lines” switch is used to define the number of lines to display in OSD and the “-delay” switch is used to define the duration of osd_cat command (1 second here). The “–align” and “–pos” switches are used to display the OSD at the horizontal and vertical center of the screen respectively.


To change the font size, use “–font” switch and change its value, as shown in the command below:

$ while true; do date; sleep 1; done | osd_cat --align center --pos middle
--lines 1 --delay 1 --font -*-*-*-*-*-*-28-*-*-*-*-*-*-*

To run an executable binary along with the osd_cat command, use another pipe symbol:

$ while true; do date; sleep 1; done | osd_cat --align center --pos middle
 --lines 1 --delay 1 | ./executable_binary

Note that closing the executable binary will not end the “while” loop. You will have to manually end the loop by pressing the <CTRL + C> key in the terminal window where the command was first launched.

If you can see blinking text in OSD, try increasing the value of “–delay” to 2 or more.

CPU and Memory Usage

To display a HUD showing CPU usage every second, use the command below:

$ while true; do top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}'; sleep 1; done
 | osd_cat --align center --pos middle --lines 1 --delay 2 --font -*-*-*-*-*-*-28-*

To display a HUD that shows RAM used by the system every second, use the command below:

$ while true; do free | grep Mem | awk '{print $3/$2 * 100.0}'; sleep 1; done | osd_cat
--align center --pos middle --lines 1 --delay 2 --font -*-*-*-*-*-*-28-*-*-*-*-*-*-*

Crosshair in Games

You can display a small crosshair exactly at the center of the screen using osd_cat. By displaying a single letter exactly at the center of the screen, you can use it as a reticle in FPS Games. Most FPS games display a crosshair at the center of the screen. Whenever a player uses mouselook (moves camera through mouse), the crosshair remains at the center of the screen while the camera or scene moves around. An osd_cat HUD can be used to display a fixed, static reticle at the center of the display. Run the command below to show letter “o” as crosshair:

$ echo "o" | osd_cat --align center --pos middle

Note that the crosshair can be slightly off depending upon the game you are playing and the original crosshair style and size. However, it can be easily fixed using “offset” and “indent” switches explained in the “osd_cat” man page. These options can be also used to align crosshair in third person or over the shoulder games, where crosshair may not be exactly at the center.

DualShock Controller Battery Level

You can show the battery level of your DualShock controller as an overlay on any game using osd_cat. Pretty useful if you don’t want to constantly check remaining capacity while playing games. Run the command below to show remaining battery percentage in an osd_cat HUD:

$ while true; do upower -i $(upower -e | grep sony_controller_battery) | grep percentage
 | awk '{print $2}'; sleep 1; done | osd_cat --align center --pos middle --lines 1
 --delay 2 --font -*-*-*-*-*-*-28-*-*-*-*-*-*-*


Osd_cat can be customized heavily and you can use it with any command that generates output in the terminal to create a HUD. For instance, you can continuously show an FPS counter in 3D games or you can show useful information in a minimal desktop environment that uses a lightweight window manager like openbox or a tiled window manager like XMonad.

View the full article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...