ionutbortis / gnome-bedtime-mode

Home of the "Bedtime Mode" :zzz: GNOME Shell Extension.
GNU General Public License v3.0
70 stars 12 forks source link
gnome gnome-shell gnome-shell-extension

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:

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! :sun_with_face:

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 version '47'!

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

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

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

rm gnome-bedtime-mode_20.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:

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;'

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. :thumbsup:

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! :partying_face: :tada: :pray:

Translators hall of fame :trophy:

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.