diff --git a/config.nims b/config.nims index 0750d26..5279780 100644 --- a/config.nims +++ b/config.nims @@ -15,6 +15,7 @@ proc compile(release: bool) = args.add(&"--verbosity:0") args.add(&"-d:danger") args.add(&"--opt:speed") + args.add(&"-d:strip") args.add(&"--outdir:{thisDir()}/bin") args.add(&"{thisDir()}/src/catnap.nim") diff --git a/config/config.toml b/config/config.toml index 923a1f4..897b2f8 100644 --- a/config/config.toml +++ b/config/config.toml @@ -14,15 +14,16 @@ uptime = {icon = " ", name = "uptime", color = "(BE)"} distro = {icon = " ", name = "distro", color = "(GN)"} kernel = {icon = " ", name = "kernel", color = "(MA)"} desktop = {icon = " ", name = "desktop", color = "(CN)"} -# terminal = {icon = " ", name = "term", color = "(RD)"} -# shell = {icon = " ", name = "shell", color = "(MA)"} +terminal = {icon = " ", name = "term", color = "(RD)"} +shell = {icon = " ", name = "shell", color = "(MA)"} # packages = {icon = " ", name = "packages", color = "(RD)"} # WARNING: Resource Intensive +# weather = {icon = " ", name = "weather", color = "(BE)"} # Requires curl and an emoji font. | WARNING: Resource Intensive +# The following stats do not work on MacOS and the BSDs. # gpu = {icon = "󱔐 ", name = "gpu", color = "(MA)"} # WARNING: Resource Intensive # cpu = {icon = " ", name = "cpu", color = "(RD)"} # disk_0 = {icon = " ", name = "disk", color = "(GN)"} -memory = {icon = " ", name = "memory", color = "(YW)"} +# memory = {icon = " ", name = "memory", color = "(YW)"} # battery = {icon = " ", name = "battery", color = "(GN)"} -# weather = {icon = " ", name = "weather", color = "(BE)"} # Requires curl and an emoji font. | WARNING: Resource Intensive sep_color = "SEPARATOR" colors = {icon = " ", name = "colors", color = "!DT!", symbol = ""} diff --git a/config/distros.toml b/config/distros.toml index 04a8038..1604c75 100644 --- a/config/distros.toml +++ b/config/distros.toml @@ -238,9 +238,22 @@ art = [ "@@@@#=: ", ] +[dragonfly] +alias = "dragonflybsd" +margin = [2, 3, 2,] +art = [ + " ,{RD}_{WE}, ", + "('-_{RD}|{WE}_-') ", + " >--{RD}|{WE}--< ", + "(_-'{RD}|{WE}'-_) ", + " {RD}| ", + " {RD}| ", + " {RD}| ", +] + ### E ### [elementary] -alias = "elementaryos" +alias = "elementaryos" margin = [2, 2, 3,] art = [ "{WE} _______ ", @@ -293,6 +306,17 @@ art = [ ] +[freebsd] +margin = [2, 4, 2,] +art = [ + "{RD}/\\,-'''''-,/\\ ", + "{RD}\\_) (_/ ", + "{RD}| | ", + "{RD}| | ", + " {RD}; ; ", + " {RD}'-_____-' ", +] + ### G ### [garuda] margin = [3, 2, 3,] @@ -416,6 +440,18 @@ art = [ ### M ### +[macos] +margin = [2, 4, 2,] +art = [ + "{GN} .:' ", + "{GN} _ :'_ ", + "{YW} .'\\`_\\`-'_\\`. ", + "{RD}:________.-' ", + "{RD}:________: ", + "{MA} :_______\\`-; ", + "{BE} \\`._.-._.' ", +] + [mageria] margin = [2, 4, 3,] art = [ @@ -466,6 +502,18 @@ art = [ ### N ### +[netbsd] +margin = [2, 2, 2,] +art = [ + "{WE}\\\\{YW}\\`-______,----__ ", + "{WE} \\\\ {YW}__,---\\`_", + "{WE} \\\\ {YW}\\`.____ ", + "{WE} \\\\{YW}-______,----\\`-", + "{WE} \\\\ ", + "{WE} \\\\ ", + "{WE} \\\\ ", +] + [nobara] margin = [2, 2, 2,] art = [ @@ -500,6 +548,18 @@ art = [ ] ### O ### +[openbsd] +margin = [2, 2, 3,] +art = [ + "{YW} _____ ", + "{YW} \\- -/ ", + "{YW} \\_/ \\ ", + "{YW} | {WE}O O{YW} |", + "{YW} |_ < ) 3 )", + "{YW} / \\ / ", + " {YW} /-_____-\\ ", +] + [opensuse] margin = [0, 0, 2,] art = [ diff --git a/src/catnaplib/global/definitions.nim b/src/catnaplib/global/definitions.nim index c34e14e..72c7123 100644 --- a/src/catnaplib/global/definitions.nim +++ b/src/catnaplib/global/definitions.nim @@ -112,6 +112,10 @@ const "sourcemage": "sorcery", "vanilla": "apx", "venom": "scratchpkg", + "freebsd": "pkg", + "dragonfly": "pkg", + "netbsd": "pkgsrc", + "openbsd": "pkgsrc", }.toOrderedTable PKGCOUNTCOMMANDS* = static: { "apx": "apx list -i | wc -l", @@ -130,6 +134,8 @@ const "zypper": "rpm -qa --last | wc --l", "pacman": "pacman -Q | wc -l", "apk": "apk list --installed | wc -l", + "pkg": "pkg info", + "pkgsrc": "pkg_info", }.toOrderedTable # Files / Dirs diff --git a/src/catnaplib/platform/probe.nim b/src/catnaplib/platform/probe.nim index 962115f..eb8748e 100644 --- a/src/catnaplib/platform/probe.nim +++ b/src/catnaplib/platform/probe.nim @@ -19,7 +19,7 @@ proc getDistro*(): string = result = readCache(cacheFile) if result != "": return - when defined(linux): + when defined(linux) or defined(bsd): # Returns the name of the running linux distro result = "/etc/os-release".loadConfig.getSectionValue("", "PRETTY_NAME") & " " & uname().machine elif defined(macos): @@ -75,7 +75,7 @@ proc getUser*(): string = proc getKernel*(): string = # Returns the active kernel version - result = "/proc/version".open.readLine.split(" ")[2] + result = uname().release proc getParentPid(pid: int): int = let statusFilePath = "/proc/" & $pid & "/status" @@ -212,6 +212,9 @@ proc getCpu*(): string = result = readCache(cacheFile) if result != "": return + + when defined(macos): + return execCmd("sysctl -n machdep.cpu.brand_string") let rawLines = readFile("/proc/cpuinfo").split("\n")