Skip to content

ionutbortis/gnome-bedtime-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gnome Bedtime Mode

Hey Gnome, it's bedtime!

Converts to grayscale the entire Gnome workspace by using a smooth transition. Best to use during evening/night.

This behavior is similar to Android's bedtime mode which converts the phone screen to grayscale. It should somewhat make your device less appealing and limit the usage of it before bedtime. On my side, at least, it still requires a fair amount of self control in order to make that happen.

The extension has a nice Preferences (Settings) UI where you can customize it to your liking:

  • Set an automatic schedule for turning on/off the Bedtime Mode
  • Add an On Demand button to Top Bar or a Quick Settings toggle to manually enable/disable the mode
  • Control the On Demand button visibility, appearance and position in Top Bar
  • Choose another color preset and intensity, if you prefer a different color scheme
  • Change color intensity on the fly by scrolling over the On Demand button in Top Bar

Multi language support is also available. Please check the Translators hall of fame section for the supported languages list and Guide for translators section if you want to contribute with a translation for your native language.

Peace! 🌞

Installation

From the official GNOME Shell Extensions website:

Get it on GNOME Extensions

Or

You can download the latest release package and manually install it to your extensions folder. The latest package only supports Gnome versions 45 and 46!

For older Gnome versions please use the official GNOME Shell Extensions website mentioned above.

wget https://github.com/ionutbortis/gnome-bedtime-mode/releases/download/v19.0/gnome-bedtime-mode_19.0.zip
# (Or manually download via browser and run the next commands from the download folder)

gnome-extensions install --force gnome-bedtime-mode_19.0.zip

rm gnome-bedtime-mode_19.0.zip

Next, you need to log out and log in again into your user account

You can now enable/disable the extension by running the Extensions app (search and install it from your distro repos or get it from here), or by browsing to https://extensions.gnome.org/local.

Alternatively, you can do this from command line:

gnome-extensions enable gnomebedtime@ionutbortis.gmail.com
gnome-extensions disable gnomebedtime@ionutbortis.gmail.com

To open the extension's Preferences (Settings) UI, use the Extensions app or run this command:

gnome-extensions prefs gnomebedtime@ionutbortis.gmail.com

Keyboard shortcut

If you want to use a keyboard shortcut in order to toggle the Bedtime Mode then you can do this:

  • Go to "Settings -> Keyboard -> Keyboard Shortcuts"
  • Click on "View and Customize Shortcuts"
  • Go to "Custom Shortcuts" and click "Add Shortcut" or the "+" button
  • Fill the inputs with the following
    • Name: Toggle Bedtime Mode
    • Command:
bash -c 'schema_id=org.gnome.shell.extensions.bedtime-mode; schema_dir=~/.local/share/gnome-shell/extensions/gnomebedtime@ionutbortis.gmail.com/schemas/; if [[ $(gsettings --schemadir $schema_dir get $schema_id bedtime-mode-active) == true ]]; then turn_on=false; else turn_on=true; fi; gsettings --schemadir $schema_dir set $schema_id bedtime-mode-active $turn_on;'
  • Press "Set Shortcut" and use your preferred one
  • Done!

How can you contribute?

Help is always needed so if you found this extension helpful, the best way to contribute is to help with the creation of new translations (see next section).

If you encounter some bugs, please submit them as issues here on github. Also, feature requests or improvement ideas are welcomed.

Guide for translators

If you like the extension and want to help in creating a translation for your native language, please carry on reading. 👍

Fork this github repository and clone your fork onto your local machine. Also, checkout the next-release branch:

git clone git@github.com:[your_github_username]/gnome-bedtime-mode.git
cd gnome-bedtime-mode/ && git checkout next-release

Run the languages.sh script with the --new-locale=xx argument in order to create a new translation file (you need to replace xx with your language code):

./scripts/languages.sh --new-locale=xx

Enter your email address when prompted and a new translation file should be successfully generated into the gnome-bedtime-mode/po folder. It will have the name of the new locale and the .po extension.

Then, you just need to use a tool for opening the .po file and translate the texts. Popular choices are Gtranslator and POEdit.

When the new .po file is fully translated run the install script and the extension should be packaged with the new translations and installed to your Gnome shell:

./scripts/install.sh

After running the install script you need to re-login and manually enable the extension via an app or command line:

gnome-extensions enable gnomebedtime@ionutbortis.gmail.com

Open the extension preferences and check if all the texts are properly translated. If the new translations look fine push the changes and create a pull request to the next-release branch on the original repository.

That's it! You are now an official contributor to this extension, YaaY! 🥳 🎉 🙏

Translators hall of fame 🏆

Credits

Credits for inspiration go to:

I wrote this extension because I use the Android's Bedtime Mode on a daily basis and I wanted something similar for my laptop. Having Ubuntu as my main OS, I liked the idea of extending the desktop shell to your liking. It was also a good way to improve on my JavaScript coding skills.

Many thanks to the creator of the Night Theme Switcher extension. I used his code for reference since the Gnome Extensions Coding documentation was not that great when I first started.