mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-16 07:56:12 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58b3e82346 | ||
|
|
ba67c074db | ||
|
|
c8b3f9f4a4 | ||
|
|
c05f34eb7d | ||
|
|
39b901e6fd |
@@ -0,0 +1,23 @@
|
|||||||
|
#/43;45;45;15
|
||||||
|
${C3}.${C1}-------------------------:
|
||||||
|
.${C2}+=${C1}========================.
|
||||||
|
:${C2}++${C1}===${C2}++===${C1}===============- :${C2}++${C1}-
|
||||||
|
:${C2}*++${C1}====${C2}+++++==${C1}===========- .==:
|
||||||
|
-${C2}*+++${C1}=====${C2}+***++=${C1}=========:
|
||||||
|
=${C2}*++++=${C1}=======------------:
|
||||||
|
=${C2}*+++++=${C1}====- ${C3}...${C1}
|
||||||
|
.${C2}+*+++++${C1}=-===: .${C2}=+++=${C1}:
|
||||||
|
:${C2}++++${C1}=====-==: -***${C2}**${C1}+
|
||||||
|
:${C2}++=${C1}=======-=. .=+**+${C3}.${C1}
|
||||||
|
.${C2}+${C1}==========-. ${C3}.${C1}
|
||||||
|
:${C2}+++++++${C1}====- ${C3}.${C1}--==-${C3}.${C1}
|
||||||
|
:${C2}++${C1}==========. ${C3}:${C2}+++++++${C1}${C3}:
|
||||||
|
${C1}.-===========. =*****+*+
|
||||||
|
${C1}.-===========: .+*****+:
|
||||||
|
${C1}-=======${C2}++++${C1}:::::::::::::::::::::::::-: ${C3}.${C1}---:
|
||||||
|
:======${C2}++++${C1}====${C2}+++******************=.
|
||||||
|
${C1}:=====${C2}+++${C1}==========${C2}++++++++++++++*-
|
||||||
|
${C1}.====${C2}++${C1}==============${C2}++++++++++*-
|
||||||
|
${C1}.===${C2}+${C1}==================${C2}+++++++:
|
||||||
|
${C1}.-=======================${C2}+++:
|
||||||
|
${C3}..........................
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#/34;15;46;252
|
||||||
|
${C2} ...-:::::-...
|
||||||
|
${C2} .-MMMMMMMMMMMMMMM-.
|
||||||
|
.-MMMM${C1}`..-:::::::-..`${C2}MMMM-.
|
||||||
|
.:MMMM${C1}.:MMMMMMMMMMMMMMM:.${C2}MMMM:.
|
||||||
|
-MMM${C1}-M---MMMMMMMMMMMMMMMMMMM.${C2}MMM-
|
||||||
|
`:MMM${C1}:MM` :MMMM:....::-...-MMMM:${C2}MMM:`
|
||||||
|
:MMM${C1}:MMM` :MM:` `` `` `:MMM:${C2}MMM:
|
||||||
|
.MMM${C1}.MMMM` :MM. -MM. .MM- `MMMM.${C2}MMM.
|
||||||
|
:MMM${C1}:MMMM` :MM. -MM- .MM: `MMMM-${C2}MMM:
|
||||||
|
:MMM${C1}:MMMM` :MM. -MM- .MM: `MMMM:${C2}MMM:
|
||||||
|
:MMM${C1}:MMMM` :MM. -MM- .MM: `MMMM-${C2}MMM:
|
||||||
|
.MMM${C1}.MMMM` :MM:--:MM:--:MM: `MMMM.${C2}MMM.
|
||||||
|
:MMM${C1}:MMM- `-MMMMMMMMMMMM-` -MMM-${C2}MMM:
|
||||||
|
:MMM${C1}:MMM:` `:MMM:${C2}MMM:
|
||||||
|
.MMM${C1}.MMMM:--------------:MMMM.${C2}MMM.
|
||||||
|
'-MMMM${C1}.-MMMMMMMMMMMMMMM-.${C2}MMMM-'
|
||||||
|
'.-MMMM${C1}``--:::::--``${C2}MMMM-.'
|
||||||
|
${C2} '-MMMMMMMMMMMMM-'
|
||||||
|
${C2} ``-:::::-``
|
||||||
@@ -11,9 +11,14 @@ if [ ! -z "$MEM_TOTAL" ] && [ ! -z "$MEM_USED" ]; then echo -e "${C3}Memory: ${C
|
|||||||
for i in $(seq ${MOUNTED_PARTITIONS}); do
|
for i in $(seq ${MOUNTED_PARTITIONS}); do
|
||||||
device="PARTITION${i}_DEVICE"
|
device="PARTITION${i}_DEVICE"
|
||||||
mountpoint="PARTITION${i}_MOUNTPOINT"
|
mountpoint="PARTITION${i}_MOUNTPOINT"
|
||||||
|
label="PARTITION${i}_LABEL"
|
||||||
total="PARTITION${i}_TOTAL_SIZE"
|
total="PARTITION${i}_TOTAL_SIZE"
|
||||||
used="PARTITION${i}_USED_SIZE"
|
used="PARTITION${i}_USED_SIZE"
|
||||||
echo -e "${C3}${!mountpoint}: ${C4}${!used}/${!total}"
|
if [ -z "${!label}" ]; then
|
||||||
|
echo -e "${C3}Partition ${!mountpoint}: ${C4}${!used}/${!total}"
|
||||||
|
else
|
||||||
|
echo -e "${C3}Partition ${!label}: ${C4}${!used}/${!total}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
if [ ! -z "$DISPLAY_PROTOCOL" ]; then
|
if [ ! -z "$DISPLAY_PROTOCOL" ]; then
|
||||||
echo -e "${C3}Display Protocol: ${C4}${DISPLAY_PROTOCOL}"
|
echo -e "${C3}Display Protocol: ${C4}${DISPLAY_PROTOCOL}"
|
||||||
@@ -22,4 +27,4 @@ if [ ! -z "$DISPLAY_PROTOCOL" ]; then
|
|||||||
echo -e "${C3}Screen $i: ${C4}${!monitor}"
|
echo -e "${C3}Screen $i: ${C4}${!monitor}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$DE_WM" ]; then echo -e "${C3}DE/WM: ${C4}${DE_WM}"; fi
|
if [ ! -z "$DE_WM" ]; then echo -e "${C3}DE/WM: ${C4}${DE_WM}"; fi
|
||||||
|
|||||||
@@ -152,27 +152,38 @@ func readConfig() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final := ""
|
final := ""
|
||||||
for lineIndex, line := range asciiSplit {
|
y := len(asciiSplit)
|
||||||
lineVisibleLength := len(strings.Split(asciiNoColor, "\n")[lineIndex])
|
if len(asciiSplit) < len(strings.Split(string(out), "\n")) {
|
||||||
lastAsciiColor := ""
|
y = len(strings.Split(string(out), "\n"))
|
||||||
if lineIndex != 0 {
|
}
|
||||||
r := regexp.MustCompile("\033[38;5;[0-9]+m")
|
for lineIndex := 0; lineIndex < y; lineIndex++ {
|
||||||
matches := r.FindAllString(asciiSplit[lineIndex-1], -1)
|
line := ""
|
||||||
if len(matches) != 0 {
|
for i := 0; i < maxWidth+5; i++ {
|
||||||
lastAsciiColor = r.FindAllString(asciiSplit[lineIndex-1], -1)[len(matches)-1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for i := lineVisibleLength; i < maxWidth+5; i++ {
|
|
||||||
line = line + " "
|
line = line + " "
|
||||||
}
|
}
|
||||||
asciiSplit[lineIndex] = lastAsciiColor + line
|
lastAsciiColor := ""
|
||||||
|
if lineIndex < len(asciiSplit) {
|
||||||
|
line = asciiSplit[lineIndex]
|
||||||
|
lineVisibleLength := len(strings.Split(asciiNoColor, "\n")[lineIndex])
|
||||||
|
if lineIndex != 0 {
|
||||||
|
r := regexp.MustCompile("\033[38;5;[0-9]+m")
|
||||||
|
matches := r.FindAllString(asciiSplit[lineIndex-1], -1)
|
||||||
|
if len(matches) != 0 {
|
||||||
|
lastAsciiColor = r.FindAllString(asciiSplit[lineIndex-1], -1)[len(matches)-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i := lineVisibleLength; i < maxWidth+5; i++ {
|
||||||
|
line = line + " "
|
||||||
|
}
|
||||||
|
asciiSplit[lineIndex] = lastAsciiColor + line
|
||||||
|
}
|
||||||
str := string(out)
|
str := string(out)
|
||||||
if lineIndex < len(strings.Split(str, "\n")) {
|
if lineIndex < len(strings.Split(str, "\n")) {
|
||||||
line = line + colorMap["C0"] + strings.Split(str, "\n")[lineIndex]
|
line = line + colorMap["C0"] + strings.Split(str, "\n")[lineIndex]
|
||||||
}
|
}
|
||||||
final += lastAsciiColor + line + "\n"
|
final += lastAsciiColor + line + "\n"
|
||||||
}
|
}
|
||||||
fmt.Println(final)
|
fmt.Println(final + "\033[0m")
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetupFetchEnv() []string {
|
func SetupFetchEnv() []string {
|
||||||
@@ -193,6 +204,9 @@ func SetupFetchEnv() []string {
|
|||||||
for i, part := range partitions {
|
for i, part := range partitions {
|
||||||
env["PARTITION"+strconv.Itoa(i+1)+"_DEVICE"] = part.Device
|
env["PARTITION"+strconv.Itoa(i+1)+"_DEVICE"] = part.Device
|
||||||
env["PARTITION"+strconv.Itoa(i+1)+"_MOUNTPOINT"] = part.MountPoint
|
env["PARTITION"+strconv.Itoa(i+1)+"_MOUNTPOINT"] = part.MountPoint
|
||||||
|
if part.Label != "" {
|
||||||
|
env["PARTITION"+strconv.Itoa(i+1)+"_LABEL"] = part.Label
|
||||||
|
}
|
||||||
env["PARTITION"+strconv.Itoa(i+1)+"_TOTAL_SIZE"] = FormatBytes(part.TotalSize)
|
env["PARTITION"+strconv.Itoa(i+1)+"_TOTAL_SIZE"] = FormatBytes(part.TotalSize)
|
||||||
env["PARTITION"+strconv.Itoa(i+1)+"_USED_SIZE"] = FormatBytes(part.UsedSize)
|
env["PARTITION"+strconv.Itoa(i+1)+"_USED_SIZE"] = FormatBytes(part.UsedSize)
|
||||||
env["PARTITION"+strconv.Itoa(i+1)+"_FREE_SIZE"] = FormatBytes(part.FreeSize)
|
env["PARTITION"+strconv.Itoa(i+1)+"_FREE_SIZE"] = FormatBytes(part.FreeSize)
|
||||||
|
|||||||
@@ -267,7 +267,6 @@ func GetDEWM() string {
|
|||||||
}
|
}
|
||||||
return strings.TrimSpace(string(out))
|
return strings.TrimSpace(string(out))
|
||||||
}
|
}
|
||||||
|
|
||||||
if processExists("plasmashell") {
|
if processExists("plasmashell") {
|
||||||
return "KDE Plasma " + runCommand("plasmashell --version | awk '{print $2}'")
|
return "KDE Plasma " + runCommand("plasmashell --version | awk '{print $2}'")
|
||||||
} else if processExists("gnome-session") {
|
} else if processExists("gnome-session") {
|
||||||
@@ -323,23 +322,39 @@ func getMonitorResolution() []string {
|
|||||||
type partition struct {
|
type partition struct {
|
||||||
Device string
|
Device string
|
||||||
MountPoint string
|
MountPoint string
|
||||||
|
Label string
|
||||||
TotalSize uint64
|
TotalSize uint64
|
||||||
UsedSize uint64
|
UsedSize uint64
|
||||||
FreeSize uint64
|
FreeSize uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMountedPartitions() []partition {
|
func getMountedPartitions() []partition {
|
||||||
entries, err := os.ReadDir("/dev/disk/by-partuuid")
|
partuuids, err := os.ReadDir("/dev/disk/by-partuuid")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partlabels, err := os.ReadDir("/dev/disk/by-partlabel")
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
labels := make(map[string]string)
|
||||||
|
for _, entry := range partlabels {
|
||||||
|
link, err := filepath.EvalSymlinks(filepath.Join("/dev/disk/by-partlabel/", entry.Name()))
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
labels[link] = entry.Name()
|
||||||
|
}
|
||||||
|
|
||||||
bytes, err := os.ReadFile("/proc/mounts")
|
bytes, err := os.ReadFile("/proc/mounts")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
mountsRaw := strings.Split(string(bytes), "\n")
|
mountsRaw := strings.Split(string(bytes), "\n")
|
||||||
mounts := make(map[string]string)
|
mounts := make(map[string]string)
|
||||||
|
|
||||||
for i := 0; i < len(mountsRaw); i++ {
|
for i := 0; i < len(mountsRaw); i++ {
|
||||||
split := strings.Split(mountsRaw[i], " ")
|
split := strings.Split(mountsRaw[i], " ")
|
||||||
if len(split) <= 2 {
|
if len(split) <= 2 {
|
||||||
@@ -349,7 +364,7 @@ func getMountedPartitions() []partition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var partitions []partition
|
var partitions []partition
|
||||||
for _, entry := range entries {
|
for _, entry := range partuuids {
|
||||||
link, err := filepath.EvalSymlinks(filepath.Join("/dev/disk/by-partuuid/", entry.Name()))
|
link, err := filepath.EvalSymlinks(filepath.Join("/dev/disk/by-partuuid/", entry.Name()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
@@ -360,10 +375,14 @@ func getMountedPartitions() []partition {
|
|||||||
p := partition{
|
p := partition{
|
||||||
link,
|
link,
|
||||||
mounts[link],
|
mounts[link],
|
||||||
|
"",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
}
|
}
|
||||||
|
if value, ok := labels[link]; ok {
|
||||||
|
p.Label = value
|
||||||
|
}
|
||||||
buf := new(syscall.Statfs_t)
|
buf := new(syscall.Statfs_t)
|
||||||
err = syscall.Statfs(p.MountPoint, buf)
|
err = syscall.Statfs(p.MountPoint, buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user