90 Commits

Author SHA1 Message Date
vinceliuice
775e4f7487 Update install.sh 2024-08-19 14:26:40 +08:00
vinceliuice
8357e49262 Fixed issues 2024-08-19 14:18:26 +08:00
Vince
a69383892e Merge pull request #227 from quatquatt/update-wiki-link
Update link to point to the new nixos wiki
2024-08-03 01:36:57 +08:00
quatquatt
896ca7f9c9 update link from the former, unofficial nixos wiki page to the new https://wiki.nixos.org 2024-08-02 13:09:36 -04:00
vinceliuice
c47af2ef5d Update install.sh 2024-07-31 13:57:24 +08:00
Vince
0628270f03 Merge pull request #222 from MasterEvarior/master
Added instructions on how to use the flake.nix
2024-06-02 01:15:40 +08:00
MasterEvarior
d9316d1acc Added instructions on how to use the flake.nix 2024-06-01 18:48:52 +02:00
Vince
ce56cfb5c6 Fixed #220 2024-05-16 13:29:13 +08:00
vinceliuice
b732fe3fad update 2024-04-12 09:29:31 +08:00
vinceliuice
a9dab5cce1 Revert "Merge pull request #218 from damian101/master"
This reverts commit 30be255898, reversing
changes made to 8ddd471937.
2024-04-12 09:25:31 +08:00
Vince
30be255898 Merge pull request #218 from damian101/master
Smaller images, losslessly optimized
2024-04-12 01:42:01 +08:00
Vince
8ddd471937 Merge pull request #217 from leon-erd/master
Nix: fix extension of splashImage
2024-04-12 01:41:04 +08:00
Vince
704cef3017 Merge pull request #216 from OneRandom1509/master
fix: fixed grub.cfg directory issues in install.sh for fedora
2024-04-12 01:40:25 +08:00
Damian Höster
515ce57ffb Smaller images, losslessly optimized
1. `oxipng -o max -Z --fast` on all PNGs
2. `ect -30035`on preview and banner
3. `ect -80085 -progressive` on all other PNGs and all JPEGs
2024-03-30 14:07:36 +01:00
Leon
a634923206 Nix: fix extension of splashImage 2024-03-26 10:21:10 +01:00
OneRandom1509
8c9aade1fa chore: removed duplicate mkconfig command for fedora 2024-03-12 19:06:49 +05:30
OneRandom1509
0d7ea30481 chore: changed mkconfig directory to boot/grub2/grub.cfg 2024-03-12 14:59:50 +05:30
OneRandom1509
179e2c21a1 fix: removed UEFI grub fonts file for fedora 2024-03-12 13:16:39 +05:30
OneRandom1509
3fa5e0f312 fix: removed UEFI grub config file for fedora 2024-03-12 13:10:19 +05:30
Vince
eda1b86dd8 Merge pull request #208 from trytomakeyouprivate/master
added opensuse microOS and Fedora Atomic Desktop commands
2024-02-17 20:48:43 +08:00
Vince
d296515893 Merge pull request #209 from daniel-j-guenther/patch-1
Update README.md
2024-02-17 20:47:58 +08:00
Vince
82c47cfa55 Merge pull request #212 from h4m6urg1r/master
flake.nix simplified splashImage changing
2024-02-17 20:46:01 +08:00
Hamburgir
d5c82f7213 flake.nix simplified splashImage changing
Fixed problem that occured when setting custom spalsh image for NixOS
2024-02-16 18:42:36 +05:30
Daniel Guenther
42aa89641b Update README.md
See in issues. Enjoy 2024
2024-01-04 22:21:53 +01:00
trytomakeyouprivate
9f0d2837ed added opensuse microOS and Fedora Atomic Desktop commands
Applying those works on Fedora Atomic! It should work the same on OpenSuse microOS as on regular OpenSuse too.
2023-12-19 15:37:12 +00:00
vinceliuice
000171da27 Fixed #205 2023-09-17 19:15:42 +08:00
Vince
9843327eb6 Merge pull request #204 from varris1/flake-fix
flake.nix: Change deprecated string type to str
2023-08-16 21:39:13 +08:00
Varris
c8f6113801 flake.nix: Change deprecated string type to str 2023-08-15 20:54:51 +02:00
vinceliuice
de378454b5 Fixed #203 2023-08-16 00:29:57 +08:00
Vince
7da365a621 Merge pull request #202 from hotime/patch-3
chore: reset group ID and remove inkscape:label for deepin, kubuntu, xubuntu in svg files
2023-08-06 00:39:42 +08:00
hotime
f07021174e chore: reset group ID and remove inkscape:label for deepin, kubuntu, xubuntu in svg files
logos-color.svg
[deepin]
id="g2" -> id="deepin"
remove inkscape:label="deepin"
id="path2-3" -> id="path67"
remove inkscape:label="path67"
[kubuntu]
id="g1" -> id="kubuntu"
remove inkscape:label="kubuntu"

logos-white.svg
[deepin]
id="g1" -> id="deepin"
remove inkscape:label="deepin"
id="path2-3" -> id="path60"
remove inkscape:label="path60"

logos-whitesur.svg
[deepin]
id="g2" -> id="deepin"
remove inkscape:label="deepin"
id="path2-3" -> id="path330"
remove inkscape:label="path330"
[xubuntu]
id="g1" -> id="xubuntu"
remove inkscape:label="xubuntu"
2023-08-05 21:24:08 +08:00
Vince
f3fc65d3a2 Merge pull request #201 from hotime/patch-2
update icons: deepin, brunch-settings; fine tune icon parameters.
2023-08-03 22:21:14 +08:00
hotime
960ac1a172 update icons: deepin, brunch-settings; fine tune icon parameters.
1, update deepin icons to make the icon closer to the deepin logo, while also making the style suitable for this theme.
2, update brunch-settings icon for colors-white.svg, whitch has a different style effect from other icons of the colors-white style.
3, remove redundant element "g536" in group xubuntu for logos-whitesur.svg.
4, fine tune icon parameters like X,Y,width,height datas in SVG files, whitch has uncorrect datas. For example, all icon group in svg files are supposed to be 32.000x32.000, but a few icons are 32.001x32.001, and more...
2023-08-03 20:19:25 +08:00
Vince
02ec0a888b Merge pull request #200 from hotime/patch-1
fix: the old background reappears for a few seconds
2023-08-01 21:54:20 +08:00
hotime
cd5fee4582 fix: the old background reappears for a few seconds
Add replacing or appending "GRUB_BACKGROUND" surpport for file "/etc/default/grub" to fix "the old background reappears for a few seconds" bug.
2023-08-01 18:55:38 +08:00
vinceliuice
9c673d5a34 Update install.sh 2023-07-24 21:47:50 +08:00
Vince
20c00af363 Merge pull request #198 from anandusateeshNSUT/master
Fixed directory issues for fedora in the install.sh itself
2023-07-22 02:32:45 +08:00
anandusateesh
5a9e5b58a0 Fixed directory issues 2023-07-21 23:07:59 +05:30
vinceliuice
8d2f2e17b8 Update install.sh 2023-07-22 00:31:33 +08:00
vinceliuice
c991e3a3a7 Update install.sh 2023-07-21 23:15:11 +08:00
vinceliuice
bf840ebdb7 Update install.sh 2023-07-21 23:09:52 +08:00
vinceliuice
1358b497d9 Merge branch 'master' of github.com:vinceliuice/grub2-themes 2023-07-21 22:56:08 +08:00
vinceliuice
8383f6b4f8 Update install.sh 2023-07-21 22:51:22 +08:00
Vince
4c7bba04ac Merge pull request #196 from Maik93/master
improve grub.bak existance check
2023-07-11 00:25:51 +08:00
Michael Mugnai
4deac71ab4 improve grub.bak existance check 2023-07-09 22:09:07 +02:00
vinceliuice
8cd0ea9b4a Update install.sh 2023-04-15 23:05:00 +08:00
vinceliuice
c1f9aeaf83 Merge branch 'master' of github.com:vinceliuice/grub2-themes 2023-04-15 22:47:38 +08:00
vinceliuice
d0a481efa1 Update install.sh 2023-04-15 22:46:16 +08:00
vinceliuice
7c0d8eb784 Fixed #191 2023-01-18 12:21:58 +08:00
vinceliuice
8a5ebe97fa Merge branch 'master' of github.com:vinceliuice/grub2-themes 2023-01-05 14:33:13 +08:00
vinceliuice
bde73b88ed Fixed #172 2023-01-05 14:32:40 +08:00
Vince
bfedd16365 Merge pull request #187 from AnotherGroupChat/master
Update Nix install for theme.txt control + fix module reference
2023-01-05 14:14:21 +08:00
dylan madisetti
7e8a1ea758 Allow for more granular control of theme.txt and update depricated way of reffering to modules 2022-11-18 12:35:17 -05:00
Vince
c106dfb9b5 update 2022-11-12 08:42:45 +08:00
Vince
7033bb66e5 Update README.md 2022-10-30 23:49:02 +08:00
Vince
b0dca256c3 Update README.md 2022-10-30 23:48:26 +08:00
Vince
ece050a022 Update README.md 2022-10-30 23:47:50 +08:00
Vince
530859b0b3 Update README.md 2022-10-30 23:41:38 +08:00
Vince
375b7d0f0a Update README.md 2022-10-30 23:39:27 +08:00
Vince
48338ec6a3 Update install.sh 2022-10-30 23:36:05 +08:00
Vince
e77cbfa662 Fixed #181 2022-10-30 23:20:45 +08:00
Vince
967a302d8f update 2022-10-23 19:44:08 +08:00
Vince
7ab56dc587 Merge pull request #180 from hyttmi/master
Remove override of THEME_DIR
2022-10-23 19:37:13 +08:00
Mika Hyttinen
8303aa2825 Remove override of THEME_DIR 2022-10-23 08:46:09 +03:00
Vince
b10a5fd4c8 update 2022-10-15 23:57:32 +08:00
Vince
8627f86ce5 Merge pull request #178 from dotlogix/Feature/UbuntuDDE
Fix alignments of icons and add ubuntuDDE
2022-10-15 23:46:51 +08:00
Alexander Schill
fd78958d50 Fix alignments of icons and add ubuntuDDE 2022-10-15 16:31:52 +02:00
Vince
c6e2967f06 Merge pull request #175 from Rdkang/master
Added theme variant name to the preview image
2022-08-31 02:02:35 +08:00
Rdkang
6b58676c4d Added theme variant name to the preview image 2022-08-30 11:54:20 +01:00
Vince
fa74d1b6af Merge pull request #162 from thomassdk/FixNixOSSupport
Make splashImage option a `nullOr` type
2022-03-28 00:26:11 +08:00
thomassdk
29dd80dd70 Make splashImage option a nullOr type 2022-03-27 15:52:59 +00:00
Vince
20a8f12488 Merge pull request #161 from PatrickJosh/fix-fedora-34-and-later
Update install.sh to fix installation on Fedora 34 and later.
2022-03-26 21:20:58 +08:00
Joshua Noeske
b5b4780418 Update install.sh to fix installation on Fedora 34 and later. 2022-03-26 10:50:37 +01:00
vinceliuice
3f5624833d update 2022-03-19 10:55:49 +08:00
vinceliuice
f4f3354233 Update install.sh 2022-03-19 10:32:20 +08:00
Vince
a4bff7bf91 Merge pull request #158 from AnotherGroupChat/nixos
Add NixOS support
2022-03-19 10:07:53 +08:00
Dylan Madisetti
86caf618c3 Merge branch 'vinceliuice:master' into nixos 2022-03-18 12:53:01 -04:00
madisetti
4f3b99cdf3 Added footer and enable option 2022-02-21 11:59:04 -05:00
Vince
53f899da9c Merge pull request #155 from AnotherGroupChat/master
Added generate hook
2022-02-21 13:06:36 +08:00
madisetti
2fd6eb9b66 Needs to exit 0 2022-02-20 23:00:36 -05:00
madisetti
824064faa9 Move clear to remove busybox dependency 2022-02-20 22:46:11 -05:00
madisetti
70ff68055b Added flake for grub on NixOS 2022-02-20 22:41:50 -05:00
madisetti
e5b869f186 Added generate hook 2022-02-20 22:26:29 -05:00
Vince
9e440c4bbc Update install.sh 2022-01-22 18:29:10 +08:00
Vince
468bee78f5 Merge pull request #151 from The-Plottwist/master
Pull request for 149'th issue
2022-01-16 12:51:38 +08:00
The-Plottwist
9d244c9d07 Fixed issue #149
In the old functionality, the current config file was being replaced with a backup file (if it had presented).
However, we now back-up the config file and replace the active theme line instead.
2022-01-15 22:36:57 +03:00
The-Plottwist
d27e1caf5f Little fixes
Almost always ```read``` command should be used with ```-r``` option.
Added some clarity about globals.
2022-01-15 21:15:50 +03:00
The-Plottwist
2824010b86 Improved Readability
Added section headers and made some rearrangements to improve readability.
Removed discouraged '$?' usage.
Added install_program function.
2022-01-15 21:11:14 +03:00
Vince
f1e03b4949 update 2021-12-07 11:29:49 +08:00
Vince
41de75c50e Update README.md 2021-12-05 14:18:39 +08:00
99 changed files with 5885 additions and 5623 deletions

View File

@@ -4,26 +4,86 @@
Usage: `sudo ./install.sh [OPTIONS...]`
| Options: | Description: |
|:-----------------------|:-------------|
| -b, --boot | Install grub theme into `/boot/grub/themes` |
| -t, --theme | theme variant(s) [tela/vimix/stylish/slaze/whitesur] (default is tela)"
| -i, --icon | icon variant(s) [color/white/whitesur] (default is color)"
| -s, --screen | screen resolution variant(s) [1080p/2k/4k/ultrawide/ultrawide2k] (default is 1080p)"
| -r, --remove [THEME] | Uninstall selected theme |
| -h, --help | Show this help |
```
-t, --theme theme variant(s) [tela|vimix|stylish|whitesur] (default is tela)
-i, --icon icon variant(s) [color|white|whitesur] (default is color)
-s, --screen screen display variant(s) [1080p|2k|4k|ultrawide|ultrawide2k] (default is 1080p)
-r, --remove Remove theme [tela|vimix|stylish|whitesur] (must add theme name option, default is tela)
-b, --boot install theme into '/boot/grub' or '/boot/grub2'
-g, --generate do not install but generate theme into chosen directory (must add your directory)
-h, --help Show this help
```
_If no options are used, a user interface `dialog` will show up instead_
### Examples:
- Install Tela theme on 2k display device:
- `sudo ./install.sh -t tela -s 2k`
```sh
sudo ./install.sh -t tela -s 2k
```
- Install Tela theme into /boot/grub/themes:
- `sudo ./install.sh -b -t tela`
```sh
sudo ./install.sh -b -t tela
```
- Uninstall Tela theme:
- `sudo ./install.sh -r -t tela`
```sh
sudo ./install.sh -r -t tela
```
## Installation with NixOS:
To use this theme with NixOS you will have to enable [flakes](https://wiki.nixos.org/wiki/flakes). Before you do this, please inform yourself if you really want to, because flakes are still an unstable feature.
First you will have to add grub2 to your `flake.nix` file as a new input.
```nix
# flake.nix
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Add grub2 themes to your inputs ...
grub2-themes = {
url = "github:vinceliuice/grub2-themes";
};
};
outputs = inputs@{ nixpkgs, grub2-themes, ... }: {
nixosConfigurations = {
my_host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
# ... and then to your modules
modules = [
./configuration.nix
grub2-themes.nixosModules.default
];
};
};
};
}
```
After that, you can configure the theme as shown below. In this example it is inside the `configuration.nix` file but it can be any file you choose.
```nix
# configuration.nix
{ inputs, config, pkgs, lib, ... }:
{
boot.loader.grub = { ... };
boot.loader.grub2-theme = {
enable = true;
theme = "stylish";
footer = true;
};
}
```
## Issues / tweaks:
@@ -38,7 +98,11 @@ _If no options are used, a user interface `dialog` will show up instead_
- Make sure you have `imagemagick` installed, or at least something that provides `convert`
- Find the resolution of your display, and make sure your background matches the resolution
- (1920x1080 -> --1080p, 2560x1080 -> --ultrawide, 2560x1440 -> --2k, 3440x1440 -> --ultrawide2k, 3840x2160 -> --4k)
- 1920x1080 >> 1080p
- 2560x1080 >> ultrawide
- 2560x1440 >> 2k
- 3440x1440 >> ultrawide2k
- 3840x2160 >> 4k
- Place your custom background inside the root of the project, and name it `background.jpg`
- Run the installer like normal, but with -s `[YOUR_RESOLUTION]` and -t `[THEME]` and -i `[ICON]`
- Make sure to replace `[YOUR_RESOLUTION]` with your resolution and `[THEME]` with the theme
@@ -55,7 +119,6 @@ _If no options are used, a user interface `dialog` will show up instead_
## Documents
[Grub2 theme reference](http://wiki.rosalab.ru/en/index.php/Grub2_theme_/_reference)
[Grub2 theme tutorial](http://wiki.rosalab.ru/en/index.php/Grub2_theme_tutorial)
[Grub2 theme reference](https://wiki.rosalab.ru/en/index.php/Grub2_theme_/_reference)
[Grub2 theme tutorial](https://wiki.rosalab.ru/en/index.php/Grub2_theme_tutorial)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 964 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

After

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 969 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 987 B

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 987 B

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 987 B

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 987 B

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 171 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 132 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 206 KiB

View File

@@ -42,7 +42,11 @@ neon
artix
kernel
zorin
nixos
gpart
ubuntuDDE
archcraft
brunch
recovery
restart
@@ -60,3 +64,4 @@ type
tz
unset
submenu
brunch-settings

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 200 KiB

157
flake.nix Normal file
View File

@@ -0,0 +1,157 @@
{
description = "Flake to manage grub2 themes from vinceliuice";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
in
with nixpkgs.lib;
rec {
nixosModules.default = { config, ... }:
let
cfg = config.boot.loader.grub2-theme;
splashImage = if cfg.splashImage == null then "" else cfg.splashImage;
hasBootMenuConfig = cfg.bootMenuConfig != null;
hasTerminalConfig = cfg.terminalConfig != null;
resolutions = {
"1080p" = "1920x1080";
"ultrawide" = "2560x1080";
"2k" = "2560x1440";
"4k" = "3840x2160";
"ultrawide2k" = "3440x1440";
};
grub2-theme = pkgs.stdenv.mkDerivation {
name = "grub2-theme";
src = "${self}";
installPhase = ''
mkdir -p $out/grub/themes;
bash ./install.sh \
--generate $out/grub/themes \
--screen ${cfg.screen} \
--theme ${cfg.theme} \
--icon ${cfg.icon};
if [ -n "${splashImage}" ]; then
rm $out/grub/themes/${cfg.theme}/background.jpg;
${pkgs.imagemagick}/bin/convert ${splashImage} $out/grub/themes/${cfg.theme}/background.jpg;
fi;
if [ ${pkgs.lib.trivial.boolToString cfg.footer} == "false" ]; then
sed -i ':again;$!N;$!b again; s/\+ image {[^}]*}//g' $out/grub/themes/${cfg.theme}/theme.txt;
fi;
if [ ${pkgs.lib.trivial.boolToString hasBootMenuConfig} == "true" ]; then
sed -i ':again;$!N;$!b again; s/\+ boot_menu {[^}]*}//g' $out/grub/themes/${cfg.theme}/theme.txt;
cat << EOF >> $out/grub/themes/${cfg.theme}/theme.txt
+ boot_menu {
${if cfg.bootMenuConfig == null then "" else cfg.bootMenuConfig}
}
EOF
fi;
if [ ${pkgs.lib.trivial.boolToString hasTerminalConfig} == "true" ]; then
sed -i 's/^terminal-.*$//g' $out/grub/themes/${cfg.theme}/theme.txt
cat << EOF >> $out/grub/themes/${cfg.theme}/theme.txt
${if cfg.terminalConfig == null then "" else cfg.terminalConfig}
EOF
fi;
'';
};
resolution = resolutions."${cfg.screen}";
in
rec {
options = {
boot.loader.grub2-theme = {
enable = mkOption {
default = true;
example = true;
type = types.bool;
description = ''
Enable grub2 theming
'';
};
theme = mkOption {
default = "tela";
example = "tela";
type = types.enum [ "tela" "vimix" "stylish" "whitesur" ];
description = ''
The theme to use for grub2.
'';
};
icon = mkOption {
default = "white";
example = "white";
type = types.enum [ "color" "white" "whitesur" ];
description = ''
The icon to use for grub2.
'';
};
screen = mkOption {
default = "1080p";
example = "1080p";
type = types.enum [ "1080p" "2k" "4k" "ultrawide" "ultrawide2k" ];
description = ''
The screen resolution to use for grub2.
'';
};
splashImage = mkOption {
default = null;
example = "/my/path/background.jpg";
type = types.nullOr types.path;
description = ''
The path of the image to use for background (must be jpg or png).
'';
};
bootMenuConfig = mkOption {
default = null;
example = "left = 30%";
type = types.nullOr types.str;
description = ''
Grub theme definition for boot_menu.
Refer to config/theme-*.txt for reference.
'';
};
terminalConfig = mkOption {
default = null;
example = "terminal-font: \"Terminus Regular 18\"";
type = types.nullOr types.str;
description = ''
Replaces grub theme definition for terminial-*.
Refer to config/theme-*.txt for reference.
'';
};
footer = mkOption {
default = true;
example = true;
type = types.bool;
description = ''
Whether to include the image footer.
'';
};
};
};
config = mkIf cfg.enable (mkMerge [{
environment.systemPackages = [
grub2-theme
];
boot.loader.grub =
{
theme = "${grub2-theme}/grub/themes/${cfg.theme}";
splashImage =
"${grub2-theme}/grub/themes/${cfg.theme}/background.jpg";
gfxmodeEfi = "${resolution},auto";
gfxmodeBios = "${resolution},auto";
extraConfig = ''
insmod gfxterm
insmod png
set icondir=($root)/theme/icons
'';
};
}]);
};
};
}

View File

@@ -1,10 +1,8 @@
#! /usr/bin/env bash
# Grub2 Themes
set -o errexit
# Exit Immediately if a command fails
set -o errexit
[ GLOBAL::CONF ]
{
readonly ROOT_UID=0
readonly Project_Name="GRUB2::THEMES"
readonly MAX_DELAY=20 # max delay for user to enter root password
@@ -12,13 +10,15 @@ tui_root_login=
THEME_DIR="/usr/share/grub/themes"
REO_DIR="$(cd $(dirname $0) && pwd)"
}
THEME_VARIANTS=('tela' 'vimix' 'stylish' 'whitesur')
ICON_VARIANTS=('color' 'white' 'whitesur')
SCREEN_VARIANTS=('1080p' '2k' '4k' 'ultrawide' 'ultrawide2k')
#COLORS
#################################
# :::::: C O L O R S :::::: #
#################################
CDEF=" \033[0m" # default color
CCIN=" \033[0;36m" # info color
CGSC=" \033[0;32m" # success color
@@ -30,6 +30,10 @@ b_CGSC=" \033[1;32m" # bold success color
b_CRER=" \033[1;31m" # bold error color
b_CWAR=" \033[1;33m" # bold warning color
#######################################
# :::::: F U N C T I O N S :::::: #
#######################################
# echo like ... with flag type and display message colors
prompt () {
case ${1} in
@@ -49,18 +53,72 @@ prompt () {
# Check command availability
function has_command() {
command -v $1 > /dev/null
command -v $1 &> /dev/null #with "&>", all output will be redirected.
}
usage() {
printf "%s\n" "Usage: ${0##*/} [OPTIONS...]"
printf "\n%s\n" "OPTIONS:"
printf " %-25s%s\n" "-b, --boot" "install grub theme into /boot/grub/themes"
printf " %-25s%s\n" "-t, --theme" "theme variant(s) [tela|vimix|stylish|whitesur] (default is tela)"
printf " %-25s%s\n" "-i, --icon" "icon variant(s) [color|white|whitesur] (default is color)"
printf " %-25s%s\n" "-s, --screen" "screen display variant(s) [1080p|2k|4k|ultrawide|ultrawide2k] (default is 1080p)"
printf " %-25s%s\n" "-r, --remove" "Remove theme (must add theme name option)"
printf " %-25s%s\n" "-h, --help" "Show this help"
cat << EOF
Usage: $0 [OPTION]...
OPTIONS:
-t, --theme theme variant(s) [tela|vimix|stylish|whitesur] (default is tela)
-i, --icon icon variant(s) [color|white|whitesur] (default is color)
-s, --screen screen display variant(s) [1080p|2k|4k|ultrawide|ultrawide2k] (default is 1080p)
-r, --remove Remove theme [tela|vimix|stylish|whitesur] (must add theme name option, default is tela)
-b, --boot install theme into '/boot/grub' or '/boot/grub2'
-g, --generate do not install but generate theme into chosen directory (must add your directory)
-h, --help Show this help
EOF
}
generate() {
if [[ "${install_boot}" == 'true' ]]; then
if [[ -d "/boot/grub" ]]; then
THEME_DIR='/boot/grub/themes'
fi
if [[ -d "/boot/grub2" ]]; then
THEME_DIR='/boot/grub2/themes'
fi
fi
# Make a themes directory if it doesn't exist
prompt -i "\n Checking for the existence of themes directory..."
[[ -d "${THEME_DIR}/${theme}" ]] && rm -rf "${THEME_DIR}/${theme}"
mkdir -p "${THEME_DIR}/${theme}"
# Copy theme
prompt -i "\n Installing ${theme} ${icon} ${screen} theme..."
# Don't preserve ownership because the owner will be root, and that causes the script to crash if it is ran from terminal by sudo
cp -a --no-preserve=ownership "${REO_DIR}/common/"{*.png,*.pf2} "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/config/theme-${screen}.txt" "${THEME_DIR}/${theme}/theme.txt"
cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${screen}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg"
# Use custom background.jpg as grub background image
if [[ -f "${REO_DIR}/background.jpg" ]]; then
prompt -w "\n Using custom background.jpg as grub background image..."
cp -a --no-preserve=ownership "${REO_DIR}/background.jpg" "${THEME_DIR}/${theme}/background.jpg"
convert -auto-orient "${THEME_DIR}/${theme}/background.jpg" "${THEME_DIR}/${theme}/background.jpg"
fi
if [[ ${screen} == 'ultrawide' ]]; then
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-${icon}/icons-1080p" "${THEME_DIR}/${theme}/icons"
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-select/select-1080p/"*.png "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/assets/info-1080p.png" "${THEME_DIR}/${theme}/info.png"
elif [[ ${screen} == 'ultrawide2k' ]]; then
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-${icon}/icons-2k" "${THEME_DIR}/${theme}/icons"
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-select/select-2k/"*.png "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/assets/info-2k.png" "${THEME_DIR}/${theme}/info.png"
else
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-${icon}/icons-${screen}" "${THEME_DIR}/${theme}/icons"
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-select/select-${screen}/"*.png "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/assets/info-${screen}.png" "${THEME_DIR}/${theme}/info.png"
fi
}
install() {
@@ -70,48 +128,24 @@ install() {
# Check for root access and proceed if it is present
if [[ "$UID" -eq "$ROOT_UID" ]]; then
clear
# Create themes directory if it didn't exist
prompt -s "\n Checking for the existence of themes directory..."
[[ -d "${THEME_DIR}/${theme}" ]] && rm -rf "${THEME_DIR}/${theme}"
mkdir -p "${THEME_DIR}/${theme}"
# Copy theme
prompt -s "\n Installing ${theme} ${icon} ${screen} theme..."
# Don't preserve ownership because the owner will be root, and that causes the script to crash if it is ran from terminal by sudo
cp -a --no-preserve=ownership "${REO_DIR}/common/"{*.png,*.pf2} "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/config/theme-${screen}.txt" "${THEME_DIR}/${theme}/theme.txt"
cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${screen}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg"
# Use custom background.jpg as grub background image
if [[ -f "${REO_DIR}/background.jpg" ]]; then
prompt -w "\n Using custom background.jpg as grub background image..."
cp -a --no-preserve=ownership "${REO_DIR}/background.jpg" "${THEME_DIR}/${theme}/background.jpg"
convert -auto-orient "${THEME_DIR}/${theme}/background.jpg" "${THEME_DIR}/${theme}/background.jpg"
fi
if [[ ${screen} == 'ultrawide' ]]; then
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-${icon}/icons-1080p" "${THEME_DIR}/${theme}/icons"
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-select/select-1080p/"*.png "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/assets/info-1080p.png" "${THEME_DIR}/${theme}/info.png"
elif [[ ${screen} == 'ultrawide2k' ]]; then
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-${icon}/icons-2k" "${THEME_DIR}/${theme}/icons"
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-select/select-2k/"*.png "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/assets/info-2k.png" "${THEME_DIR}/${theme}/info.png"
else
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-${icon}/icons-${screen}" "${THEME_DIR}/${theme}/icons"
cp -a --no-preserve=ownership "${REO_DIR}/assets/assets-select/select-${screen}/"*.png "${THEME_DIR}/${theme}"
cp -a --no-preserve=ownership "${REO_DIR}/assets/info-${screen}.png" "${THEME_DIR}/${theme}/info.png"
fi
# Generate the theme in "/usr/share/grub/themes"
generate "${theme}" "${icon}" "${screen}"
# Set theme
prompt -s "\n Setting ${theme} as default..."
prompt -i "\n Setting ${theme} as default..."
# Backup grub config
cp -an /etc/default/grub /etc/default/grub.bak
if [[ -f /etc/default/grub.bak ]]; then
prompt -w "\n File '/etc/default/grub.bak' already exists!"
# read choice
# if [[ "$choice" = 'y' ]]; then
# cp -a /etc/default/grub /etc/default/grub.bak
# else
# prompt -s "Skipping to save a backup configuration in '/etc/default/grub.bak'"
# fi
else
cp -an /etc/default/grub /etc/default/grub.bak
fi
# Fedora workaround to fix the missing unicode.pf2 file (tested on fedora 34): https://bugzilla.redhat.com/show_bug.cgi?id=1739762
# This occurs when we add a theme on grub2 with Fedora.
@@ -143,6 +177,14 @@ install() {
echo "GRUB_THEME=\"${THEME_DIR}/${theme}/theme.txt\"" >> /etc/default/grub
fi
if grep "GRUB_BACKGROUND=" /etc/default/grub 2>&1 >/dev/null; then
#Replace GRUB_BACKGROUND
sed -i "s|.*GRUB_BACKGROUND=.*|GRUB_BACKGROUND=\"${THEME_DIR}/${theme}/background.jpg\"|" /etc/default/grub
else
#Append GRUB_BACKGROUND
echo "GRUB_BACKGROUND=\"${THEME_DIR}/${theme}/background.jpg\"" >> /etc/default/grub
fi
# Make sure the right resolution for grub is set
if [[ ${screen} == '1080p' ]]; then
gfxmode="GRUB_GFXMODE=1920x1080,auto"
@@ -175,58 +217,59 @@ install() {
fi
# For Kali linux
if [[ -f "/etc/default/grub.d/kali-themes.cfg" ]]; then
if [[ -f "/etc/default/grub.d/kali-themes.cfg" && ! -f "/etc/default/grub.d/kali-themes.cfg.bak" ]]; then
cp -an /etc/default/grub.d/kali-themes.cfg /etc/default/grub.d/kali-themes.cfg.bak
sed -i "s|.*GRUB_GFXMODE=.*|${gfxmode}|" /etc/default/grub.d/kali-themes.cfg
sed -i "s|.*GRUB_THEME=.*|GRUB_THEME=\"${THEME_DIR}/${theme}/theme.txt\"|" /etc/default/grub.d/kali-themes.cfg
fi
# Update grub config
prompt -s "\n Updating grub config...\n"
prompt -i "\n Updating grub config... \n"
updating_grub
prompt -w "\n * At the next restart of your computer you will see your new Grub theme: '$theme' \n"
prompt -w "\n * At the next restart of your computer you will see your new Grub theme: '$theme' "
else
#Check if password is cached (if cache timestamp not expired yet)
sudo -n true 2> /dev/null && echo
if [[ $? == 0 ]]; then
#No need to ask for password
sudo "$0" -t ${theme} -i ${icon} -s ${screen}
#Check if password is cached (if cache timestamp has not expired yet)
elif sudo -n true 2> /dev/null && echo; then
if [[ "${install_boot}" == 'true' ]]; then
sudo "$0" -t ${theme} -i ${icon} -s ${screen} -b
else
#Ask for password
if [[ -n ${tui_root_login} ]] ; then
if [[ -n "${theme}" && -n "${screen}" ]]; then
sudo "$0" -t ${theme} -i ${icon} -s ${screen}
fi
else
#Ask for password
if [[ -n ${tui_root_login} ]] ; then
if [[ -n "${theme}" && -n "${screen}" ]]; then
if [[ "${install_boot}" == 'true' ]]; then
sudo -S $0 -t ${theme} -i ${icon} -s ${screen} -b <<< ${tui_root_login}
else
sudo -S $0 -t ${theme} -i ${icon} -s ${screen} <<< ${tui_root_login}
fi
else
prompt -e "\n [ Error! ] -> Run me as root! "
read -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s
sudo -S echo <<< $REPLY 2> /dev/null && echo
if [[ $? == 0 ]]; then
#Correct password, use with sudo's stdin
sudo -S "$0" -t ${theme} -i ${icon} -s ${screen} <<< ${REPLY}
fi
else
prompt -e "\n [ Error! ] -> Run me as root! "
read -r -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s
if sudo -S echo <<< $REPLY 2> /dev/null && echo; then
#Correct password, use with sudo's stdin
if [[ "${install_boot}" == 'true' ]]; then
sudo -S "$0" -t ${theme} -i ${icon} -s ${screen} -b <<< ${REPLY}
else
#block for 3 seconds before allowing another attempt
sleep 3
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
sudo -S "$0" -t ${theme} -i ${icon} -s ${screen} <<< ${REPLY}
fi
else
#block for 3 seconds before allowing another attempt
sleep 3
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
fi
fi
fi
fi
}
run_dialog() {
if [[ -x /usr/bin/dialog ]]; then
if [[ "$UID" -ne "$ROOT_UID" ]]; then
#Check if password is cached (if cache timestamp not expired yet)
sudo -n true 2> /dev/null && echo
if [[ $? == 0 ]]; then
if sudo -n true 2> /dev/null && echo; then
#No need to ask for password
sudo $0
else
@@ -237,15 +280,12 @@ run_dialog() {
--passwordbox "require root permission" 8 50 \
--output-fd 1 )
sudo -S echo <<< $tui_root_login 2> /dev/null && echo
if [[ $? == 0 ]]; then
if sudo -S echo <<< $tui_root_login 2> /dev/null && echo; then
#Correct password, use with sudo's stdin
sudo -S "$0" <<< $tui_root_login
else
#block for 3 seconds before allowing another attempt
sleep 3
clear
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
fi
@@ -293,11 +333,13 @@ run_dialog() {
5) screen="ultrawide2k" ;;
*) operation_canceled ;;
esac
# clear
echo -e '\0033\0143'
fi
}
operation_canceled() {
clear
prompt -i "\n Operation canceled by user, Bye!"
exit 1
}
@@ -307,15 +349,18 @@ updating_grub() {
update-grub
elif has_command grub-mkconfig; then
grub-mkconfig -o /boot/grub/grub.cfg
elif has_command zypper; then
# Check for OpenSuse (regular or microOS)
elif has_command zypper || has_command transactional-update; then
grub2-mkconfig -o /boot/grub2/grub.cfg
elif has_command dnf; then
# Check for Fedora (regular or Atomic)
elif has_command dnf || has_command rpm-ostree; then
# Check for UEFI
if [[ -f /boot/efi/EFI/fedora/grub.cfg ]]; then
prompt -i "Find config file on /boot/efi/EFI/fedora/grub.cfg ...\n"
prompt -s "Find config file on /boot/efi/EFI/fedora/grub.cfg ...\n"
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
fi
if [[ -f /boot/grub2/grub.cfg ]]; then
prompt -i "Find config file on /boot/grub2/grub.cfg ...\n"
# Check for BIOS
elif [[ -f /boot/grub2/grub.cfg ]]; then
prompt -s "Find config file on /boot/grub2/grub.cfg ...\n"
grub2-mkconfig -o /boot/grub2/grub.cfg
fi
fi
@@ -324,20 +369,24 @@ updating_grub() {
prompt -s "\n * All done!"
}
function install_program () {
if has_command zypper; then
zypper in "$@"
elif has_command apt-get; then
apt-get install "$@"
elif has_command dnf; then
dnf install -y "$@"
elif has_command yum; then
yum install "$@"
elif has_command pacman; then
pacman -S --noconfirm "$@"
fi
}
install_dialog() {
if [ ! "$(which dialog 2> /dev/null)" ]; then
prompt -w "\n 'dialog' need to be installed for this shell"
if has_command zypper; then
sudo zypper in dialog
elif has_command apt-get; then
sudo apt-get install dialog
elif has_command dnf; then
sudo dnf install -y dialog
elif has_command yum; then
sudo yum install dialog
elif has_command pacman; then
sudo pacman -S --noconfirm dialog
fi
install_program "dialog"
fi
}
@@ -346,53 +395,73 @@ remove() {
# Check for root access and proceed if it is present
if [ "$UID" -eq "$ROOT_UID" ]; then
echo -e "\n Checking for the existence of themes directory..."
prompt -i "Checking for the existence of themes directory..."
if [[ -d "${THEME_DIR}/${theme}" ]]; then
prompt -i "\n Find installed theme: '${THEME_DIR}/${theme}'..."
rm -rf "${THEME_DIR}/${theme}"
prompt -w "\n Removed: '${THEME_DIR}/${theme}'..."
elif [[ -d "/boot/grub/themes/${theme}" ]]; then
prompt -i "\n Find installed theme: '/boot/grub/themes/${theme}'..."
rm -rf "/boot/grub/themes/${theme}"
prompt -w "\n Removed: '/boot/grub/themes/${theme}'..."
elif [[ -d "/boot/grub2/themes/${theme}" ]]; then
prompt -i "\n Find installed theme: '/boot/grub2/themes/${theme}'..."
rm -rf "/boot/grub2/themes/${theme}"
prompt -w "\n Removed: '/boot/grub2/themes/${theme}'..."
else
prompt -e "\n ${theme} grub theme not exist!"
prompt -e "\n Specified ${theme} theme does not exist!"
exit 0
fi
# Backup grub config
if [[ -f "/etc/default/grub.bak" ]]; then
rm -rf /etc/default/grub && mv /etc/default/grub.bak /etc/default/grub
local grub_config_location=""
if [[ -f "/etc/default/grub" ]]; then
grub_config_location="/etc/default/grub"
elif [[ -f "/etc/default/grub.d/kali-themes.cfg" ]]; then
grub_config_location="/etc/default/grub.d/kali-themes.cfg"
else
prompt -e "\n grub.bak not exist!"
exit 0
prompt -e "\n Cannot find grub config file in default locations!"
prompt -w "\n Please inform the developers by opening an issue on github."
prompt -i "\n Exiting..."
exit 1
fi
# For Kali linux
if [[ -f "/etc/default/grub.d/kali-themes.cfg.bak" ]]; then
rm -rf /etc/default/grub.d/kali-themes.cfg && mv /etc/default/grub.d/kali-themes.cfg.bak /etc/default/grub.d/kali-themes.cfg
local current_theme="" # Declaration and assignment should be done seperately ==> https://github.com/koalaman/shellcheck/wiki/SC2155
current_theme="$(grep 'GRUB_THEME=' $grub_config_location | grep -v \#)"
if [[ -n "$current_theme" ]]; then
# Backup with --in-place option to grub.bak within the same directory; then remove the current theme.
sed --in-place='.bak' "s|$current_theme|#GRUB_THEME=|" "$grub_config_location"
if [[ -f "$grub_config_location".back ]]; then
rm -rf "$grub_config_location".back
fi
# Update grub config
prompt -i "\n Resetting grub theme...\n"
updating_grub
else
prompt -e "\n No active theme found."
prompt -i "\n Exiting..."
exit 1
fi
# Update grub config
prompt -s "\n Resetting grub theme...\n"
updating_grub
else
#Check if password is cached (if cache timestamp not expired yet)
sudo -n true 2> /dev/null && echo
if [[ $? == 0 ]]; then
if sudo -n true 2> /dev/null && echo; then
#No need to ask for password
sudo "$0" "${PROG_ARGS[@]}"
sudo "$0" -t ${theme} "${PROG_ARGS[@]}"
else
#Ask for password
prompt -e "\n [ Error! ] -> Run me as root! "
read -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s
read -r -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s #when using "read" command, "-r" option must be supplied ==> https://github.com/koalaman/shellcheck/wiki/SC2162
sudo -S echo <<< $REPLY 2> /dev/null && echo
if [[ $? == 0 ]]; then
if sudo -S echo <<< $REPLY 2> /dev/null && echo; then
#Correct password, use with sudo's stdin
sudo -S "$0" "${PROG_ARGS[@]}" <<< $REPLY
sudo -S "$0" -t ${theme} "${PROG_ARGS[@]}" <<< $REPLY
else
#block for 3 seconds before allowing another attempt
sleep 3
clear
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
fi
@@ -404,19 +473,16 @@ dialog_installer() {
if [[ ! -x /usr/bin/dialog ]]; then
if [[ $UID -ne $ROOT_UID ]]; then
#Check if password is cached (if cache timestamp not expired yet)
sudo -n true 2> /dev/null && echo
if [[ $? == 0 ]]; then
if sudo -n true 2> /dev/null && echo; then
#No need to ask for password
exec sudo $0
else
#Ask for password
prompt -e "\n [ Error! ] -> Run me as root! "
read -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s
read -r -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s
sudo -S echo <<< $REPLY 2> /dev/null && echo
if [[ $? == 0 ]]; then
if sudo -S echo <<< $REPLY 2> /dev/null && echo; then
#Correct password, use with sudo's stdin
sudo $0 <<< $REPLY
else
@@ -431,18 +497,59 @@ dialog_installer() {
fi
run_dialog
install "${theme}" "${icon}" "${screen}"
exit 1
}
#######################################################
# :::::: A R G U M E N T H A N D L I N G :::::: #
#######################################################
install=install
while [[ $# -gt 0 ]]; do
PROG_ARGS+=("${1}")
dialog='false'
case "${1}" in
-b|--boot)
THEME_DIR="/boot/grub/themes"
shift 1
;;
-r|--remove)
remove='true'
shift
for theme in "${@}"; do
case "${theme}" in
tela)
themes+=("${THEME_VARIANTS[0]}")
shift
;;
vimix)
themes+=("${THEME_VARIANTS[1]}")
shift
;;
stylish)
themes+=("${THEME_VARIANTS[2]}")
shift
;;
whitesur)
themes+=("${THEME_VARIANTS[3]}")
shift
;;
-*)
break
;;
*)
prompt -e "ERROR: Unrecognized theme variant '$1'."
prompt -i "Try '$0 --help' for more information."
exit 1
;;
esac
done
;;
-g|--generate)
shift 1
THEME_DIR="${1}"
install=generate
shift 1
;;
-b|--boot)
install_boot='true'
shift 1
;;
-t|--theme)
@@ -465,7 +572,7 @@ while [[ $# -gt 0 ]]; do
themes+=("${THEME_VARIANTS[3]}")
shift
;;
-*|--*)
-*)
break
;;
*)
@@ -492,7 +599,7 @@ while [[ $# -gt 0 ]]; do
icons+=("${ICON_VARIANTS[2]}")
shift
;;
-*|--*)
-*)
break
;;
*)
@@ -527,11 +634,11 @@ while [[ $# -gt 0 ]]; do
screens+=("${SCREEN_VARIANTS[4]}")
shift
;;
-*|--*)
-*)
break
;;
*)
prompt -e "ERROR: Unrecognized icon variant '$1'."
prompt -e "ERROR: Unrecognized screen variant '$1'."
prompt -i "Try '$0 --help' for more information."
exit 1
;;
@@ -550,13 +657,17 @@ while [[ $# -gt 0 ]]; do
esac
done
#############################
# :::::: M A I N :::::: #
#############################
# Show terminal user interface for better use
if [[ "${dialog:-}" == 'false' ]]; then
if [[ "${remove:-}" != 'true' ]]; then
for theme in "${themes[@]-${THEME_VARIANTS[0]}}"; do
for icon in "${icons[@]-${ICON_VARIANTS[0]}}"; do
for screen in "${screens[@]-${SCREEN_VARIANTS[0]}}"; do
install "${theme}" "${icon}" "${screen}"
$install "${theme}" "${icon}" "${screen}"
done
done
done
@@ -569,4 +680,4 @@ if [[ "${dialog:-}" == 'false' ]]; then
dialog_installer
fi
exit 1
exit 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 KiB

After

Width:  |  Height:  |  Size: 858 KiB