Skip to content

neuromorph/custom-osd

 
 

Repository files navigation

Custom OSD (GNOME 4X Extension)

A GNOME Shell extension allowing the user to customize the On Screen Display (OSD) pop ups on Gnome. You can set the Geometry (position, orientation, size, shape), Style (font, colors, shadow, transparency, background effects etc.) and Beyond: Set the delay of the OSD pop-ups and optionally display % value for OSDs with levels like Volume/Brightness etc. You can choose to display the OSD on Primary/ External or both the monitors and select what components to show. In summary, fully transform the OSD pop-ups to match your theme and liking!
The new update allows to create and save multiple Settings profiles and choose one to apply. The profiles can be imported / exported to files. Profiles Presets (exported to file), available here, can help as starter pack. Also, if you would like to share your settings profiles, do raise a PR or issue.

Installation

Recommended

It's recommended to install the extension from extensions website, or from the Extension Manager app.

How to manually install the extension (if needed)?

git clone https://github.com/neuromorph/custom-osd.git \
	~/.local/share/gnome-shell/extensions/custom-osd@neuromorph

OR download the release zip file (may not be latest) and unzip at location: ~/.local/share/gnome-shell/extensions/

You may need to restart the gnome shell environnment (for manual install):

  • logout and login again (Do this if using Wayland) or
  • alt+f2 then type r and enter

Settings

Use the Profiles page in Extension Preferences to create and manage settings profiles.

Use the settings page of the Preferences for customizations:

  • Special Effects
  • Position on Screen
  • Vertical/Horizontal Orientation
  • Size
  • Hide-Delay time
  • Foreground and Background colors
  • Box Shadow On/Off and Color/Thickness
  • Box Border On/Off and Color
  • Level Color/Thickness
  • Transparency for foreground, background, border, level
  • Shape Shift: Pill/Rectangle/Other (interpolation)
  • Numeric % for levels
  • Monitor to show OSD on
  • Set Font of OSD text
  • Clock OSD to show current date/time
  • Select what to show: Icon, Text, Level Bar, Numeric %

Notes and Tips

OSD What?
OSDs are On-Screen-Display pop ups that show up for volume, brightness etc. This extension allows you to customize these pop ups, whether built-in or those created by extensions like Caffeine, Lock Keys etc.

Position

  • In Profiles tab, create new profiles with default settings.
  • Select a profile as Active and edit its settings in Settings tab.
  • Type/edit the values and hit enter key to update OR
  • Simply click the - + buttons or PgUp / PgDn keyboard keys.
  • Press [Save] or [Save As] button to save the setting.
  • Hover over the values/buttons for more info (tooltips).
  • Position is (0,0) at screen-center. Range is -50 to +50 as shown above.
  • Transparency setting applies to background transparency.
  • Custom-color panel of Color button has foreground transparency slider
  • Box Shadow is ON by default in Gnome. It is a shade of gray by default and will be visible if the OSD is relatively opaque and it appears on some lighter background. If your prefer more transparent and/or flat OSD then turn the shadow off.
  • Icon is the only mandatory element for any OSD and thus, some of the OSDs may not have one or more of the other components (like label, level, numeric value). This is decided by the app that sends the OSD request (eg. Volume/Brightness app or Lock Keys). Out of the available components, this extension allows to choose what to show and hide.
  • Vertical orientation may sometimes show a glitch in text rendering, please change the size of OSD by a bit to fix this.
  • Font settting also provides an option to change font size (without changing other OSD components). Note that, a large font size will also push the OSD size. Also, if you icrease/decrease size of OSD through settings, it will try to proportionally increase/decrease the font size as well.
  • Background effects are experimental. You can combine them with shadow, border or transparency etc. However, shadow can be less effective around rectangular shape with background effects. Other settings of Shape will work fine. Dynamic Blur will be rectangular. Gnome Shell Blur does not support rounded corners :/
  • Further styling effects maybe possible by editing the extension's stylesheet.
  • You can also trigger your own custom OSDs from command line (see below).

Trigger Custom OSDs from Command Line

If you want to trigger new custom OSDs from command line, as part of a shell script for example, you can do so using following not so elegant command.
The main part to edit is the last string being passed to the command. The format is:
"$RANDOM, Name of Icon, Label, Level"

  • $RANDOM: Random number required to cause a change even if everything else is same. Keep as it is.
  • Name of Icon [OPTIONAL]: The icon to display in the OSD. It should be installed and available in path. e.g. preferences-system-time-symbolic
  • Label [OPTIONAL]: Text to display in OSD. Keep it short. e.g. Media Playing or Caps Lock ON etc.
  • Level [OPTIONAL]: The level of the level bar, if applicable. Range is 0 to 1.0. e.g. 0.5 for 50% volume.

If you want to skip an optional param, leave it blank, keep the commas. If icon is not provided, a default icon will be used.

Example command:

GSETTINGS_SCHEMA_DIR=$HOME/.local/share/gnome-shell/extensions/custom-osd@neuromorph/schemas gsettings set org.gnome.shell.extensions.custom-osd showosd "$RANDOM,preferences-system-time-symbolic,My OSD,0.75"

Translations

Gettext is a localization framework for writing multi-lingual applications that is also used by GNOME Shell extensions.
This extension provides a template file (.pot) that contains a list of all the translatable strings in this project. Translators can use this template to create a (.po) translation file (e.g. fr.po for French).

Translators can use tools like Gtranslator or POEdit or any other online tools to work with the .pot files and create a .po for your language.

The translation .po files go in the 'po' directory.
The compiled translation i.e. the .mo file can be created from the .po file with this command (e.g. fr.po to fr.mo)
$ msgfmt -o fr.mo /path/to/fr.po - Replace /path/to with file path.
The .mo file goes inside the 'locale' directory under corresponding subpath and filename as 'custom-osd.mo'. For 'fr', locale/fr/LC_MESSAGES/custom-osd.mo .
Please submit a pull request when ready. Thanks in advance!

Note: There is a lot of text here (check the .pot file) esp. due to the Help tab, field descriptions and tooltips. So, partial translations are welcome as well. Ideally, a bare minimum would be to translate the functional UI part i.e. 'Profiles' and 'Settings' tabs UI even without the tooltips. This should already allow people to use the extension in their language. You may later want to add the translations for tooltips and other tabs or someone else can pitch in.

Language Translated By Status
Indonesian (ID) Ilham Adi Setiawan (@IlhamSetiawan) Completed
Spanish (ES) summus imperator(@Nosis) Completed

What's New (recent first)

  • New Profiles tab to create/manage settings profiles. Multiple profiles can be saved, imported, exported etc. Then on, just select a profile as Active profile to apply to OSDs. Also, new background effect - Dynamic Blur.
  • New background effects! Also, show/hide components based on OSD type
  • Preferences moved to Adwaita ui, code updated to prepare for translations
  • New clock OSD to show current date/time and option to set OSD font in settings
  • Some refactor, button to reset settings to default, foreground trasparency option integrated in color, shape shift, fix defaults.
  • Select any combinations of OSD components to display. New test-OSD for instant feedback when changing settings. Refactor to preset OSDs with customization and minimize runtime adaptation.
  • Improved positioning logic to snap fit edges
  • Improved efficiency and compatibility
  • Added support for Numeric level %, Monitors to display OSD and Box Border
  • Added support for Color+BG Color, Shadow and Orientation
  • Settings updated to include Color and Transparency options
  • Cleanup and upload initial version to Gnome extensions store
  • Metadata updated for Gnome 44
  • Ported for GNOME 42 + some fixes

Screenshots

Screenshot New OSDs

Acknowledgements

  • This extension started from Better OSD and its Gnome 40 update. Better OSD became obsolete and forked versions also do not support new OSD modifications in GNOME shell after GNOME 41+. Custom-OSD began with porting the old extension to new GNOME mods so I could continue to use it locally. Eventually, I decided to put it out in case it is helpful to others as well. It soon found many users and many new feature requests as well, so I ended up rewriting the entire code for refinements/bug-fix/refactor and many new features. Nevertheless, Better OSD served as the inspiration and starter code and was an OSD lifesaver back in the days, many thanks to them!
  • Also thanks to users who appreciated the project, raised issues and requested new features here and on Gnome Extensions website. In particualr, RedBearAK thoroughly reviewed the extension revisions and suggested many ideas (most have been incorporated). Much appreciated!

About

Fully customize your OSD pop-ups! Move, orient, resize, set hide-delay and style to match your theme and liking.

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 99.4%
  • CSS 0.6%