How to make a Black “Dark mode”

nano is a text editing program that is called up by the terminal so that you can edit a file that is stored somewhere in your system files. Another text editor is vim, and there are several others. Which of them one uses is entirely by choice; nano is usually installed already, so it’s a default choice.

Terminal is not a text editor itself. It allows you to enter and execute changes, such as installing or removing software, or changing configurations, including the contents of any file…which you first have to open using a text editor like nano.

In the case of the gtk.css file, it doesn’t exist by default (because it wasn’t needed by any GTK-based application yet), which is why you see “No such file or directory” as output above. So first you have to manually create it before you can edit it in the terminal. By the way css stands for Cascading Style Sheets; it is simply a way for the user to make GTK applications look and behave as desired instead of preset defaults.

So, in the terminal, to open any file with nano so that you can edit the contents, the command would take this format:

sudo nano NameOfDirectory/NameOfFile&Extension
[EDIT: Disregard sudo; it’s not required in this command. Should be nano NameOfDirectory/NameOfFile&Extension instead. See comments below.]

sudo - i.e. “super user do” - elevates your user privileges to admin level (required for making system changes)

nano - use the program nano to edit the file that follows

“NameOfDirectory” - the name of the directory (folder) where the file is located

“NameOfFile&Extension” - the name of the file you want to edit, e.g. “gtk.css” or “abc.txt” or whatever

By the way, here’s a simple guide to basic terminal commands:

So, in short, here’s what you are trying to accomplish with the custom background creation:

  1. Create (if it doesn’t exist already) the gtk-3.0 FOLDER inside the .config FOLDER in the file system home folder. (TIP: a “.” before a folder or file name makes it hidden; you can’t see it in the files navigator unless you select “Show Hidden” from the menu. This is to prevent accidents.)

  2. Open the gtk-3.0 FOLDER and create a FILE named gtk.css.

  3. Inside gtk.css, paste the script as indicated in the tutorial. Change the path to your saved background to correspond to the name and location of your background (mine is file:///home/purism/Pictures/mybackground.png), and also set your desired transparency level. Save and close the file.

(Steps 1, 2, and 3 can be done either in the terminal as described above, or simply in the file navigator, using the menus, right-click, etc.)

  1. Restart phosh (the user interface of the Librem 5). You can do this with a terminal command (sudo systemctl restart phosh) or by restarting the phone.

Hope that helps. :wink:


Save and close the file did not work for me.
How to save and close?
I am sorry, it is difficult to get back on the horse🤨

Are you doing it in the terminal or in the file navigator?

In nano, as instructed.
Your last return was very instructive.
I picked up a lot and already saw the mistake I made with the picture… the rest was lost not included in the initial frame.
Thank you very much, appreciate it.

1 Like

No problem…
So using nano in the terminal, once you copy and paste the script in, look at the bottom of the screen for options. One is Cntrl X, which means close. Once you type that, you will get the option to save changes or discard. You should be able to save it and close it, then exit the terminal.

And actually…I think sudo is not required for this operation. Sorry.

1 Like

In that case, if the file has already been created, it would be best to check output of

ls -l ~/.config/gtk-3.0/gtk.css

in order to make sure that it didn’t pick up any unusual ownership or permissions.


1 tiny issue left to explain please,
I found the the folder gtk-3 inside the .config folder.
So far so good!
How do I create a file inside a folder being in the app “files” on the Librem 5 phone not a desktop.
I checked the shortcut section.
Thank you.

This should do, within the terminal:
cd ~/.config/gtk-3.0/
touch gtk.css
ls -la

EDIT: @dav69, you’ll need instructions from this important post: Terminal to clipboard, although Ctrl+c and Ctrl+v will work on Librem 5 keyboard very well.

One way is to rename your background picture to mybackground.jpg and put/paste it in here: /home/purism/Pictures/ or just “Change the path to point to your chosen image”.

This the result,

1 Like

Each raw is separate command/step:

  1. cd ~/.config/gtk-3.0/

  2. ls -la −− you’ll see that this folder is empty

  3. touch gtk.css

  4. ls -la −− you’ll see that above, third one, command created needed gtk.css file

Above linked text (code) to be put into gtk.css file you’ll select as a whole and touch Ctrl and letter c to copy it. Than switch to with nano opened gtk.css file and touch v to paste. Touch/press again Ctrl to disable this button and use keyboard as usual to save and close this gtk.css file.

This got me when I was new, but in nano after pressing Ctrl x press y and then press enter to finish saving.

1 Like

For the GUI way, you can enter the .config directory, then enter the gtk-3.0 folder, then from the “File” menu at the top of the files navigator, select “Create New Document,” then “Empty Document,” which you should name gtk.css.

Next, after you have copied the full text of the script, go back and open the empty gtk.css file, paste the text, then save and close.

As @Quarnero said, just name your saved background the same as it’s called in the script, and place it in the Pictures directory. But if your background is saved as a .jpg, just change the script to read .jpg instead of .png.

For select-all, copy, paste, and other functions using the on-screen keyboard, first:
Click the “globe” symbol on the keyboard.
Choose “Terminal” for the keyboard type/layout.
Then click on the “>_” key.
Next click on “Menu” and then “Select All.”
Then click on “Menu” and then “Copy” or “Paste,” as required.

1 Like

the “File” menu at the top of the files navigator, select “Create New Document,” then “Empty Document,” which you should name gtk.css .

I cannot find the “File” menu!
Can you show me a pic?

Oops… Sorry for the confusion. I use a different Files manager, called nemo, not the default one, which is called nautilus.

Nemo looks like this:

In nautilus, which I also have installed, I see that there is an option to create a folder, but I don’t see an option to create a document.

Which serves to illustrate why I loathe Gnome’s super-dumbed-down and somewhat opaque menu options. :wink:

If you want to add nemo Files manager, you can run this in the terminal:
‘sudo apt update’
And then if any packages are available to install, follow with:
sudo apt upgrade
Then: sudo apt install nemo

Or search for it in the software store app.
You can have both File managers installed at the same time. Use whichever can easily do what you want.

1 Like

I have installed nautilus! Thank you.
I thought I lost it altogether, not seeing what you were explaining.
So now I have a folder gtk-3.0 with a file named gtk.css.
I cannot copy paste the code because my mail is not on the phone.
I have to write it out in the terminal.
Does it need to be written stepwise as shown in the examples?

I just tried to enter the text straight into gtk.css, it is possible.

1 Like

Aside: You can solve that by enabling the SSH server on your phone and SSHing in from the computer that does have your email (or anything else). Then you can cut and paste from email (or anything else) into a terminal session on your phone.

1 Like

My phone is still not connected, I am still learning how to install the tunnel. Only after that I will turn my phone into my daily driver.
Thank you for your input.

To be clear … I only meant: SSH access from the local network, assuming that another computer on your local network is the one that receives email etc.

The first 3 lines are greyed out.
Are they part of the text to be inserted in the gtk.css
Thank you so much.

Thank you :pray: