This repository was archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
118 lines (100 loc) · 3.23 KB
/
init.lua
File metadata and controls
118 lines (100 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
--[[
Example user config: https://ari-web.xyz/dotfile/gentoo/dotfiles/config/yafetch/init.lua
--]]
local red = "\27[31m"
local grn = "\27[32m"
local yel = "\27[33m"
local blu = "\27[34m"
local wht = "\27[37m"
local bld = "\27[1m"
local res = "\27[0m"
yafetch.sep = " ~ "
yafetch.sep_color = bld
--[[
if set to false, yafetch.shell() will return
the full path of the current shell
--]]
yafetch.shell_base = true
local shell = yafetch.shell()
local shell_icon = " "
local kernel = yafetch.kernel()
local kernel_icon = " "
local pkgs = yafetch.pkgs()
local pkgs_icon = " "
local distro = yafetch.distro()
-- https://www.nerdfonts.com/cheat-sheet (search for 'linux')
local distro_icons = {
["Alpine Linux"] = "\u{f313}",
["Arch Linux"] = "\u{f303}",
["CentOS"] = "\u{f304}",
["Container_Linux"] = "\u{f305}",
["Debian"] = "\u{f306}",
["Devuan"] = "\u{f307}",
["Elementary"] = "\u{f309}",
["Fedora"] = "\u{f30a}",
["FreeBSD"] = "\u{f30c}",
["Gentoo"] = "\u{f30d}",
["Linux Mint"] = "\u{f30f}",
["Mageia"] = "\u{f310}",
["Mandriva"] = "\u{f311}",
["Manjaro"] = "\u{f312}",
["NixOS"] = "\u{f313}",
["OpenSUSE"] = "\u{f314}",
["Raspbian"] = "\u{f315}",
["Redhat"] = "\u{f316}",
["Sabayon"] = "\u{f317}",
["Slackware"] = "\u{f318}",
["Ubuntu"] = "\u{f31b}",
["Linux"] = "\u{f31a}",
}
function running_as_root()
local fd = io.open"/root"
if fd == nil then return false else io.close(fd) return true end
end
if running_as_root() then
--[
-- Dear future me,
-- I am very sorry for the bad formatting,
-- I cannot make it any prettier :(
-- I hope you're not too mad about it...
--]
ascii1 = grn .. " \\^V// " .. red .. bld
ascii2 = res .. " |. .| " .. res
ascii3 = res .. " - \\ - / _ " .. res
ascii4 = res .. " \\_| |_/ " .. res
ascii5 = res .. " \\ \\ " .. res
ascii6 = res .. " " .. red .. "__" .. res .. "/_/" .. red .. "__ " .. res
ascii7 = red .. " |_______| " .. res
ascii8 = red .. " \\ / " .. res .. "I am (g)root, don't break me" .. res
ascii9 = red .. " \\___/ " .. res
root_mode = true
root_extras = {
ascii6,
ascii7,
ascii8,
ascii9
}
else
ascii1 = wht .. " ,d88b.d88b, " .. res
ascii2 = red .. " 88888888888 " .. res
ascii3 = grn .. " `Y8888888Y´ " .. res
ascii4 = yel .. " `Y888Y´ " .. res
ascii5 = blu .. " `Y´ " .. res
root_mode = false
root_extras = {}
end
yafetch.header_sep = string.format("%s@%s", blu, res)
yafetch.header_sep_color = wht
yafetch.header_format = ascii1 -- could be ascii1, an icon, etc.
function yafetch.init()
yafetch.header()
yafetch.format(ascii2 .. res .. red, (distro_icons[distro] or distro_icons["Linux"]) .. " ", wht, distro)
yafetch.format(ascii3 .. res .. grn, shell_icon, wht, shell)
yafetch.format(ascii4 .. res .. yel, kernel_icon, wht, kernel)
yafetch.format(ascii5 .. res .. blu, pkgs_icon, wht, pkgs)
if root_mode then
for extra_art in pairs(root_extras) do
print(root_extras[extra_art])
end
end
end