Skip to content

Nocxium/nChain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is nChain

nChain is a theme changer for Linux, with a focus on being very flexible and without any special dependancies (Outside of the basic Linux tools). It works by creating and removing symlinks to your files each time you change a theme.

nChain can be used with many lauchers, such as Rofi, dmenu and Wofi. Or you could just run it directly from the terminal.

nChain should work on most, if not all linux environments. Im using NixOS with hyprland myself, although I’ve used it with Arch and Debian as well.

You can find some of my themes here as a reference https://github.com/Nocxium/nChain-example

examples/Cat-ppuccin.png examples/Trippy-Mountain.png examples/Leaf-seasons.png examples/MoonScape.png examples/Rainy-Forest.png examples/Snowy-Umbrella.png examples/Snowy-Umbrella-Dark.png examples/Winter-green.png

Key features

  • Create and change themes easily
  • No special dependancies. Can run on most, if not all Linux distos/WM/DE
  • Ability to customize what commands to run after a specific theme change
  • Ability to put themes into categories when ran from a launcher like rofi.
  • Add a fallback theme with “nChain -t yourtheme default”. Also helpful to avoid having multiple copies of files you want to use in multiple themes, but not all.
  • Works with multiple different launchers like Rofi, dmenu, wofi etc. Can also be run entirely from the terminal.
  • Easily extendible with other scripts

Important notes

Even though I’ve programmed nChain to not remove/overwrite any files unless they are links, and to not remove folders that aren’t empty, I still HIGHLY suggest that you backup your data before trying out these scripts. When you try it out for the first time, just add a single folder with a file inside of your theme to see that it works as you expect it to.

Use nChain at your own risk.

Do NOT modify or move the linkgen.sh file unless you know what you are doing.

Additionally, don’t include any spaces in your theme names.

Installation

Clone the repo to your home/.config folder.

git clone https://github.com/Nocxium/nChain.git $HOME/.config/nChain

Run chmod +x on all the .sh files, as well as the nChain file.

cd $HOME/.config/nChain
chmod +x nChain
chmod +x scripts/*

Move the nChain file to usr/bin (Unless you are on NixOS)

sudo mv nChain /usr/bin/

If you aren’t a nix user you can ignore/remove the nChain.nix file.

For nix users, you can either follow the above steps (but add the nChain file to your path in another location), or just use the nChain.nix file with your config instead of using the regular nChain (bash) file.

You can now run nChain by typing it in the terminal. To list all commands, run

nChain -h

How to use it

File structure

If you have ever used stow to manage your dotfiles, you will feel right at home. The structure is very similar. If not, watch the example below. It is quite staightforward once you wrap your head around it.

All themes go under the theme folder, and optional scripts under the script folder.

You shouldnt touch the links folder. nChain uses that to store paths to linked files

Structure example

You start by creating a folder with your themes name inside the “themes” folder. The structure inside ~/.config/nChain should look something like this:

.
├── links
├── scripts
│   ├── linkGen.sh
│   └── settings.sh
└── themes
    ├── theme1
    ├── theme2
    └── theme3

IMPORTANT! Theme names can’t include a space.

Once you are inside your theme folder, you should see it as the base of your home folder.

If you for example want to change the dunst, kitty and waybar config for each theme, the tree structure in ~/.config/nChain/ could look like this:

├── links
├── scripts
│   ├── linkGen.sh
│   └── settings.sh
└── themes
    ├── theme1
    │   └── .config
    │       ├── dunst
    │       │   └── dunstrc
    │       ├── kitty
    │       │   └── theme.conf
    │       └── waybar
    │           ├── config.jsonc
    │           └── style.css
    ├── theme2
    │   └── .config
    │       ├── dunst
    │       │   └── dunstrc
    │       ├── kitty
    │       │   └── theme.conf
    │       └── waybar
    │           ├── config.jsonc
    │           └── style.css
    └── theme3
        └── .config
            ├── dunst
            │   └── dunstrc
            ├── kitty
            │   └── theme.conf
            └── waybar
                ├── config.jsonc
                └── style.css

As you can see, inside each of your theme folder, you are treating it as your home folder, and navigating to the rofi config folder with .config/rofi

If you for example change to theme1 now, its config files will now be symlinked to your homefolders .config folder. If you change it to theme2, nChain will unlink theme1 files, and now link your theme2 files.

IMPORTANT! You only want to include the config files that you will be editing in your themes folder.

For example, if a program has config file A and B, but A is always the same in all your themes, don’t include that file in your theme… you don’t need to have that file as a symlink.

If you want more examples, I suggest that you take a look at my nChain-example repo https://github.com/Nocxium/nChain-example, which contains the themes in the pictures above. Note that there are still some adjustments I haven’t had time to do yet. But you will see how it is structured, and maybe even get ideas on how to extend it with other scripts like I have done.

Configuration

Do NOT modify or move the linkgen.sh file, unless you know what you are doing. Use settings.sh instead. If you open settings.sh in the script folder, you will see the following:

launcher="rofi -dmenu -i -p 'Select theme:'"

folders_to_skip=(
  # "folder_one"
  # "folder_two"
)

pre_commands=(
  # These commands are running before the theme change'"
)

post_commands=(
  # Optional commands to run after the theme change. Put each command inside "". Here are some examples:
  # "killall .dunst-wrapped"
  # "kill -SIGUSR1 $(pidof kitty)"
  # "$HOME/.config/nChain/scripts/notify-send.sh &"
)

# Define optional categories and subcategories
declare -A categories
categories=(
  # ["Nature"]="Leaf-seasons Rainy-Forest Winter-green Trippy-Mountain"
  # ["Minimalistic"]="Cat-ppuccin"
)

The file should be pretty self-explanitory, but to give some additional information:

launcher can be changed here if you prefer something else like dmenu or wofi.

folders_to_skip should contain any optional folders in “themes” folder that you dont want included in your launcher. Wildcards are accepted.

If you have a theme that you want to run different post_commands with, you can just create a file called “your_theme_name.sh”, and that sh file will be used as your post_commands instead. Don’t forget to chmod +x that file.

nChain also allows you to put different themes in different categories for your launcher. Put the name of the category inside the brackets, and then the name of the themes after the equal sign.

About

A lightweight theme switcher for Linux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published