mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 18:32:10 +02:00
Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e5017aa3a | |||
| dc89336fc1 | |||
| 952152edf0 | |||
| 6862747c48 | |||
| f91be6442d | |||
| bdce8ea3a1 | |||
| 44c8fa0470 | |||
| 9f9a5ba39a | |||
| 7c37d719e5 | |||
| cc78d6b16c | |||
| e7b7645f08 | |||
| 6a17ef6a54 | |||
| 5b687727c0 | |||
| 9b038dc848 | |||
| 597dd32caf | |||
| 8d08a65611 | |||
| 263c54a81e | |||
| cba5560068 | |||
| 0703b2b88f | |||
| 86e5572a7e | |||
| 3b3c1a9f63 | |||
| 14b9e88a82 | |||
| bee7c62000 | |||
| 8fa4d7ae6e | |||
| 640d0666fc | |||
| 165b0b0a69 | |||
| dc216362d5 | |||
| 57ffe3bad2 | |||
| cdee6e2997 | |||
| fb03c95d68 | |||
| 5b76a0b45a | |||
| fa5a74c746 | |||
| 4c6e14bcc2 | |||
| deacecdc11 | |||
| 83dcdaa726 | |||
| 2c29465f69 | |||
| f3e48a00a0 | |||
| 9559db556d | |||
| b89eeaa954 | |||
| 7c15d0ce88 | |||
| 036d407708 | |||
| 52715a0ec5 | |||
| 4a6209e0e3 | |||
| 93bdaf10c4 | |||
| 4a75123eb1 | |||
| 7f2ab7310a | |||
| 3c9d9b3c67 | |||
| 7a1b214ffe | |||
| 4fe1bb0b7e | |||
| 2f26045d30 | |||
| 40e67a1d93 | |||
| d7018c2fd3 | |||
| 9e1ba0d104 | |||
| 9f23ce93bd | |||
| f89cbf6bc8 | |||
| e12c6e6fd7 | |||
| 7ba1e3d3d9 | |||
| 672bf0ef54 | |||
| 96ec2b662c | |||
| c3de293450 | |||
| f11b07ba8a | |||
| 4e84153e9d | |||
| 121cbde661 | |||
| 0d71ae7f97 | |||
| 2a49f1d0eb | |||
| 6b7403281b | |||
| 63a0faa1d9 | |||
| 408a2d731a | |||
| 46abc4f5f7 | |||
| 7393bcdf05 | |||
| d282050130 | |||
| c0de618177 | |||
| d1609ea96b | |||
| d869164d6b | |||
| 3b361c663d | |||
| 5bc9a5dc4e | |||
| c0781dd5f8 | |||
| c795c20723 | |||
| 0776dac95b | |||
| 3433043604 | |||
| bd0b108c04 | |||
| 2a9f9d5a34 | |||
| 4f3649e96e | |||
| e4f0efd58c | |||
| 25577a6e58 | |||
| 801bd7c879 | |||
| 89ce598800 | |||
| 9268d8449e | |||
| 179341c30c | |||
| 1947aa2b0e | |||
| 64c53e2cdc | |||
| 7eaefe163a | |||
| beabaa90f1 | |||
| 2f42d64dc9 | |||
| 7d452cc460 | |||
| 5b064f2e7b | |||
| e786cd5d33 | |||
| 6c7efea2fd |
+10
-10
@@ -44,7 +44,7 @@ jobs:
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: run fastfetch
|
||||
run: time ./fastfetch -c presets/ci.jsonc
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: run fastfetch --format json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: run fastfetch
|
||||
run: time ./fastfetch -c presets/ci.jsonc
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: run fastfetch --format json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
@@ -146,7 +146,7 @@ jobs:
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
@@ -185,7 +185,7 @@ jobs:
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
@@ -220,7 +220,7 @@ jobs:
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
@@ -259,7 +259,7 @@ jobs:
|
||||
- name: run
|
||||
run: |
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
@@ -300,7 +300,7 @@ jobs:
|
||||
- name: run
|
||||
run: |
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
@@ -348,7 +348,7 @@ jobs:
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: run fastfetch
|
||||
run: time ./fastfetch -c presets/ci.jsonc
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: run fastfetch --format json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
@@ -477,7 +477,7 @@ jobs:
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: run fastfetch
|
||||
run: time ./fastfetch -c presets/ci.jsonc
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: run fastfetch --format json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
@@ -547,7 +547,7 @@ jobs:
|
||||
run: curl -LO https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/raw/master/ags_lib/lib/amd_ags_x86.dll
|
||||
|
||||
- name: run fastfetch
|
||||
run: time ./fastfetch -c presets/ci.jsonc
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: run fastfetch --format json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
+104
@@ -1,3 +1,107 @@
|
||||
# 2.20.0
|
||||
|
||||
This release fixes regression of `2.19.0` on M1 MacBook Air. It also introduces a new option `--key-type icon` to display predefined icons in keys (requires newest nerd font). See `fastfetch -h key-type` for detail.
|
||||
|
||||
Changes:
|
||||
* JSON option `display.keyWidth` has been renamed to `display.key.width`
|
||||
* Previously: `{ "display": { "keyWidth": 3 } }`
|
||||
* Now: `{ "display": { "key": { "width": 3 } } }`
|
||||
* Windows Terminal font detection **in WSL** has been removed due to [issue #1113](https://github.com/fastfetch/fastfetch/issues/1113)
|
||||
|
||||
Features:
|
||||
* Add option `display.key.type: <enum>` to print icons in keys
|
||||
* Supported value `string`, `icon` and `both`. Default to `string` (don't display icons)
|
||||
* Example: `{ "display": { "key": { "type": "icon" } } }`
|
||||
* Add option `display.key.paddingLeft: <num>` to print left padding (whitespaces) in keys
|
||||
* Example: `{ "display": { "key": { "paddingLeft": 2 } } }`
|
||||
* Add option `modules.keyIcon` to set icon for specified module
|
||||
* Example: `{ "modules": { "type": "command", "keyIcon": "🔑" } }`
|
||||
* Report system mono font name for Terminator if used (TerminalFont, Linux)
|
||||
* Don't require logo height to be set when using `--logo-position right`
|
||||
* Report Snapdragon SOC marketing name for newer Android phones (CPU, Android)
|
||||
* Detect MTK SOC part name (CPU, Android)
|
||||
|
||||
Bugfixes:
|
||||
* Don't wake up suspended GPUs when using `--ds-force-drm` (Display, Linux)
|
||||
* Fix printing editor type in JSON result (Editor)
|
||||
* Fix `--logo-padding-*` not working correctly (#1121, Logo)
|
||||
* Fix possible segfault when detecting GPU frequency (#1121, macOS, GPU)
|
||||
|
||||
# 2.19.1
|
||||
|
||||
Bugfixes
|
||||
* Fix frequency value printing when using custom format (#1111, CPU / GPU)
|
||||
* Fix display detection for XiaoMi Android phone (Display, Android)
|
||||
|
||||
Features:
|
||||
* Display if HDR mode is enabled for screens (Display)
|
||||
* Supported in Windows and Linux (KDE) correctly
|
||||
|
||||
# 2.19.0
|
||||
|
||||
Changes:
|
||||
* JSON option `modules.cpu.freqNdigits` has been renamed and moved to `display.freq.ndigits`
|
||||
* Previously: `{ "modules": { "type": "cpu", "freqNdigits": 2 } }`
|
||||
* Now: `{ "display": { "freq": { "ndigits": 2 } } }`
|
||||
* This option now affects GPU frequency too
|
||||
* By default, frequencies are displayed in *GHz*. Set `display.freq.ndigits` to `-1` to display them in *MHz*
|
||||
* JSON option `display.binaryPrefix` has been moved to `display.size.binaryPrefix`
|
||||
* Previously: `{ "display": { "binaryPrefix": "IEC" } }`
|
||||
* Now: `{ "display": { "size": { "binaryPrefix": "IEC" } } }`
|
||||
|
||||
Features:
|
||||
* Print physical diagonal length if supported (Display)
|
||||
* Detect display type in X11 mode (Display)
|
||||
* Assume displays connected via DisplayPort are external monitors (Display, Linux)
|
||||
* Support GPU frequency detection for Intel XE driver (GPU, Linux)
|
||||
* Detect init system on Android (InitSystem, Android)
|
||||
* Use background to display color blocks (Colors)
|
||||
* To fix weird vertical black lines in some terminals and match the behavior of neofetch (#1094)
|
||||
* Can be reverted to old behavior with `--colors-symbol block`
|
||||
* Support Zed terminal version detection (Terminal)
|
||||
* Improve wezterm font detection (TerminalFont)
|
||||
* Add option `--separator-length`
|
||||
* Support GPU frequency detection for Apple Silicon (GPU, macOS)
|
||||
* Detect maximum refresh rate (#1101, Monitor)
|
||||
* Detect if HDR mode is supported and enabled (Windows, Display / Monitor)
|
||||
* Support physical monitor info detection for FreeBSD and SunOS (Monitor)
|
||||
* Support defining constant strings in JSON config file, which can be used to dedupe formattion strings
|
||||
```jsonc
|
||||
{
|
||||
"display": {
|
||||
"constants": [
|
||||
"Hello", // {$1}
|
||||
"world" // {$2}
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "{$1} {$2}!" // print "Hello world!"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "{$2} {$1}" // print "world Hello"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Bugfixes:
|
||||
* Fix some presets
|
||||
* Better detection for XTerm terminal fonts (#1095, TerminalFont, Linux)
|
||||
* Remove debug output (#1097, Windows)
|
||||
* Fix command line option `--gpu-hide-type` doesn't work (#1098, GPU)
|
||||
* Fix wrong date on Raspbian 10 (#1108, DateTime, Linux)
|
||||
* Use `brightness` instead of `actuall_brightness` when detecting current brightness level (Brightness, Linux)
|
||||
* Ref: https://bugzilla.kernel.org/show_bug.cgi?id=203905
|
||||
* Fix buffer overflow with long font family names when detecting kitty term font (TerminalFont)
|
||||
* Fix some typos
|
||||
|
||||
Logos:
|
||||
* Update void_small
|
||||
* Add ALT Linux
|
||||
|
||||
# 2.18.1
|
||||
|
||||
Fix a regression introduced in v2.18.0
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.18.1
|
||||
VERSION 2.20.0
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@@ -591,7 +591,7 @@ elseif(BSD)
|
||||
src/detection/gamepad/gamepad_bsd.c
|
||||
src/detection/media/media_linux.c
|
||||
src/detection/memory/memory_bsd.c
|
||||
src/detection/monitor/monitor_nosupport.c
|
||||
src/detection/monitor/monitor_linux.c
|
||||
src/detection/netio/netio_bsd.c
|
||||
src/detection/opengl/opengl_linux.c
|
||||
src/detection/os/os_linux.c
|
||||
@@ -796,7 +796,7 @@ elseif(SunOS)
|
||||
src/detection/gamepad/gamepad_nosupport.c
|
||||
src/detection/media/media_linux.c
|
||||
src/detection/memory/memory_sunos.c
|
||||
src/detection/monitor/monitor_nosupport.c
|
||||
src/detection/monitor/monitor_linux.c
|
||||
src/detection/netio/netio_sunos.c
|
||||
src/detection/opengl/opengl_linux.c
|
||||
src/detection/os/os_sunos.c
|
||||
|
||||
@@ -126,6 +126,12 @@ Fastfetch uses JSON (with comments) for configuration. I suggest you use an IDE
|
||||
|
||||
Alternatively, you can refer to the presets in [`presets` directory](https://github.com/fastfetch-cli/fastfetch/tree/dev/presets).
|
||||
|
||||
The **correct** way to edit the configuration:
|
||||
|
||||
This is an example that [changes size prefix from MiB / GiB to MB / GB](https://github.com/fastfetch-cli/fastfetch/discussions/1014). Editor used: [helix](https://github.com/helix-editor/helix)
|
||||
|
||||
[](https://asciinema.org/a/1uF6sTPGKrHKI1MVaFcikINSQ)
|
||||
|
||||
### Q: I WANT THE DOCUMENTATION!
|
||||
|
||||
[Here is the documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Json-Schema). It is generated from [JSON schema](https://github.com/fastfetch-cli/fastfetch/blob/dev/doc/json_schema.json) but you won't like it.
|
||||
@@ -169,6 +175,10 @@ The p10k doc clearly states that you should NOT print anything to stdout after `
|
||||
|
||||
You can always use `fastfetch --pipe false` to force fastfetch running in colorful mode.
|
||||
|
||||
### Q: Why do fastfetch and neofetch show different memory usage result?
|
||||
|
||||
See [#1096](https://github.com/fastfetch-cli/fastfetch/issues/1096).
|
||||
|
||||
### Q: I want feature A / B / C. Will fastfetch support it?
|
||||
|
||||
Fastfetch is a system information tool. We only accept hardware or system level software feature requests. For most personal uses, I recommend using `Command` module to detect it yourself, which can be used to grab output from a custom shell script:
|
||||
|
||||
@@ -83,12 +83,12 @@ __fastfetch_complete_logo_type()
|
||||
|
||||
__fastfetch_complete_binary_prefix()
|
||||
{
|
||||
local __ff_binary_prefixes=(
|
||||
local __ff_size_binary_prefixes=(
|
||||
"iec"
|
||||
"si"
|
||||
"jedec"
|
||||
)
|
||||
COMPREPLY=($(compgen -W "${__ff_binary_prefixes[*]}" -- "$CURRENT_WORD"))
|
||||
COMPREPLY=($(compgen -W "${__ff_size_binary_prefixes[*]}" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_gl()
|
||||
|
||||
Vendored
+24
@@ -1,3 +1,27 @@
|
||||
fastfetch (2.19.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.19.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 23 Jul 2024 10:25:14 +0800
|
||||
|
||||
fastfetch (2.19.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.19.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 22 Jul 2024 14:17:55 +0800
|
||||
|
||||
fastfetch (2.18.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.18.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Thu, 11 Jul 2024 14:32:15 +0800
|
||||
|
||||
fastfetch (2.18.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.18.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Wed, 10 Jul 2024 16:46:32 +0800
|
||||
|
||||
fastfetch (2.17.2) jammy; urgency=medium
|
||||
|
||||
* Update to 2.17.2
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
fastfetch_2.17.2_source.buildinfo universe/utils optional
|
||||
fastfetch_2.19.1_source.buildinfo universe/utils optional
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ config files, see the CONFIGURATION section
|
||||
|
||||
.B \-\-gen\-config \fI[file]
|
||||
Generate a config file with options specified on the command line.
|
||||
If \fIfile\fR is specified, the configuration will written to the
|
||||
If \fIfile\fR is specified, the configuration will be written to the
|
||||
file, otherwise it will be written to stdout.
|
||||
.TP
|
||||
|
||||
|
||||
+232
-89
@@ -22,6 +22,10 @@
|
||||
"minimum": 0,
|
||||
"default": 0
|
||||
},
|
||||
"keyIcon": {
|
||||
"description": "Set the icon to be displayed by `display.keyType: \"icon\"`",
|
||||
"type": "string"
|
||||
},
|
||||
"format": {
|
||||
"description": "Output format of the module. See `-h <module>-format` for detail. I.e: fastfetch -h disk-format",
|
||||
"type": "string"
|
||||
@@ -418,35 +422,59 @@
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"keyWidth": {
|
||||
"description": "Align the width of keys to number of characters, 0 to disable",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0
|
||||
},
|
||||
"binaryPrefix": {
|
||||
"type": "string",
|
||||
"description": "Set the binary prefix to used when printing bytes",
|
||||
"oneOf": [
|
||||
{
|
||||
"const": "iec",
|
||||
"description": "1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ... (standard)"
|
||||
"key": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how module keys should be displayed",
|
||||
"properties": {
|
||||
"width": {
|
||||
"description": "Align the width of keys to number of characters, 0 to disable",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0
|
||||
},
|
||||
{
|
||||
"const": "si",
|
||||
"description": "1000 Bytes = 1 KB, 1000 KB = 1 MB, ..."
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Set whether to show icon before string keys",
|
||||
"enum": [
|
||||
"none",
|
||||
"string",
|
||||
"icon",
|
||||
"both"
|
||||
],
|
||||
"default": "string"
|
||||
},
|
||||
{
|
||||
"const": "jedec",
|
||||
"description": "1024 Bytes = 1 kB, 1024 K = 1 MB, ..."
|
||||
"paddingLeft": {
|
||||
"type": "integer",
|
||||
"description": "Set the left padding of keys",
|
||||
"minimum": 0,
|
||||
"default": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how a size value should be displayed",
|
||||
"properties": {
|
||||
"binaryPrefix": {
|
||||
"type": "string",
|
||||
"description": "Set the binary prefix to used when formatting sizes",
|
||||
"oneOf": [
|
||||
{
|
||||
"const": "iec",
|
||||
"description": "1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ... (standard)"
|
||||
},
|
||||
{
|
||||
"const": "si",
|
||||
"description": "1000 Bytes = 1 KB, 1000 KB = 1 MB, ..."
|
||||
},
|
||||
{
|
||||
"const": "jedec",
|
||||
"description": "1024 Bytes = 1 kB, 1024 K = 1 MB, ..."
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxPrefix": {
|
||||
"type": "string",
|
||||
"description": "Set the largest binary prefix to use when formatting sizes",
|
||||
@@ -574,10 +602,31 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"freq": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how frequency values should be displayed",
|
||||
"properties": {
|
||||
"ndigits": {
|
||||
"type": "integer",
|
||||
"description": "Set the number of digits to keep after the decimal point when formatting frequency values\nA positive value will show the frequency in GHz of decimal\n-1 will show the frequency in MHz",
|
||||
"minimum": -1,
|
||||
"maximum": 9,
|
||||
"default": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"noBuffer": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to disable the stdout application buffer",
|
||||
"default": false
|
||||
},
|
||||
"constants": {
|
||||
"type": "array",
|
||||
"description": "List of strings to be used in custom format of modules",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -940,12 +989,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -977,12 +1029,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1011,12 +1066,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1047,12 +1105,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1073,12 +1134,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1096,13 +1160,6 @@
|
||||
"temp": {
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"freqNdigits": {
|
||||
"description": "Set the number of digits to keep after the decimal point when printing CPU frequency",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 9,
|
||||
"default": 2
|
||||
},
|
||||
"showPeCoreCount": {
|
||||
"description": "Detect and display CPU frequency of different core types (eg. Pcore and Ecore) if supported",
|
||||
"type": "boolean",
|
||||
@@ -1114,12 +1171,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1148,12 +1208,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1173,13 +1236,14 @@
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"block",
|
||||
"background",
|
||||
"circle",
|
||||
"diamond",
|
||||
"triangle",
|
||||
"square",
|
||||
"star"
|
||||
],
|
||||
"default": "block"
|
||||
"default": "background"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"description": "Set the number of white spaces to print before the symbol",
|
||||
@@ -1213,6 +1277,9 @@
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
},
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1239,12 +1306,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1266,12 +1336,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"description": "Text to print",
|
||||
"type": "string"
|
||||
@@ -1318,12 +1391,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1381,12 +1457,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1416,12 +1495,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1447,12 +1529,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1482,12 +1567,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1511,12 +1599,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1566,12 +1657,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1636,12 +1730,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1665,12 +1762,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1706,12 +1806,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1746,12 +1849,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1782,12 +1888,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1843,12 +1952,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1876,12 +1988,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1919,12 +2034,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -1940,12 +2058,19 @@
|
||||
"const": "separator"
|
||||
},
|
||||
"string": {
|
||||
"description": "Set the string to be printed",
|
||||
"description": "Set the string to be printed by the separator line",
|
||||
"type": "string",
|
||||
"default": "-"
|
||||
},
|
||||
"outputColor": {
|
||||
"description": "Set the color of the separator line",
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"length": {
|
||||
"description": "Set the length of the separator line, or 0 to auto-detect",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1977,12 +2102,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -2006,12 +2134,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -2056,12 +2187,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -2092,12 +2226,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -2133,12 +2270,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
@@ -2164,12 +2304,15 @@
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
"keyIcon": {
|
||||
"$ref": "#/$defs/keyIcon"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
|
||||
+9
-12
@@ -4,12 +4,12 @@
|
||||
{
|
||||
"type": "title",
|
||||
"key": "User",
|
||||
"format": "{1}"
|
||||
"format": "{user-name}"
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"key": "Hostname",
|
||||
"format": "{2}"
|
||||
"format": "{host-name}"
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"format": "{3} {9} {12}"
|
||||
"format": "{pretty-name} {version-id} {arch}"
|
||||
},
|
||||
"kernel",
|
||||
"uptime",
|
||||
@@ -34,32 +34,29 @@
|
||||
"type": "de",
|
||||
"key": "Desktop Environment"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"format": "{7}"
|
||||
},
|
||||
"shell",
|
||||
{
|
||||
"type": "terminal",
|
||||
"format": "{5} {6} {#37}█{#97}█ {#36}█{#96}█ {#35}█{#95}█ {#34}█{#94}█ {#33}█{#93}█ {#32}█{#92}█ {#31}█{#91}█ {#30}█{#90}█"
|
||||
"format": "{pretty-name} {version} {#37}█{#97}█ {#36}█{#96}█ {#35}█{#95}█ {#34}█{#94}█ {#33}█{#93}█ {#32}█{#92}█ {#31}█{#91}█ {#30}█{#90}█"
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"format": "{1}"
|
||||
"format": "{all}"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "Temperature",
|
||||
"temp": true,
|
||||
"format": "{8}"
|
||||
"format": "{temperature}"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "CPU",
|
||||
"format": "{4} x {1}"
|
||||
"format": "{cores-logical} x {name}"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"format": "{2}"
|
||||
"format": "{name}"
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "builtin",
|
||||
"source": "arch"
|
||||
},
|
||||
"modules": [
|
||||
"title",
|
||||
"separator",
|
||||
{
|
||||
"type": "os",
|
||||
"format": "Arch Linux ({12})"
|
||||
},
|
||||
"host",
|
||||
"kernel",
|
||||
"uptime",
|
||||
{
|
||||
"type": "packages",
|
||||
"format": "{} (pacman)"
|
||||
},
|
||||
"shell",
|
||||
"display",
|
||||
"de",
|
||||
"wm",
|
||||
"wmtheme",
|
||||
"theme",
|
||||
"icons",
|
||||
"font",
|
||||
"cursor",
|
||||
"terminal",
|
||||
"terminalfont",
|
||||
"cpu",
|
||||
"gpu",
|
||||
"memory",
|
||||
"disk",
|
||||
"battery",
|
||||
"poweradapter",
|
||||
"locale",
|
||||
"break",
|
||||
"colors"
|
||||
]
|
||||
}
|
||||
@@ -9,12 +9,15 @@
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"separator": " -> "
|
||||
"separator": " -> ",
|
||||
"constants": [
|
||||
"──────────────────────────────"
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "┌────────────────────────────────────────────────────────────┐",
|
||||
"format": "┌{$1}{$1}┐",
|
||||
"outputColor": "90"
|
||||
},
|
||||
{
|
||||
@@ -23,7 +26,7 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "└────────────────────────────────────────────────────────────┘",
|
||||
"format": "└{$1}{$1}┘",
|
||||
"outputColor": "90"
|
||||
},
|
||||
{
|
||||
@@ -32,12 +35,12 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "┌────────────────────────────────────────────────────────────┐",
|
||||
"format": "┌{$1}{$1}┐",
|
||||
"outputColor": "90"
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": " OS",
|
||||
"key": "{icon} OS",
|
||||
"keyColor": "yellow"
|
||||
},
|
||||
{
|
||||
@@ -142,7 +145,7 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "└────────────────────────────────────────────────────────────┘",
|
||||
"format": "└{$1}{$1}┘",
|
||||
"outputColor": "90"
|
||||
},
|
||||
"break",
|
||||
|
||||
+25
-18
@@ -6,96 +6,103 @@
|
||||
"display": {
|
||||
"separator": "-> ",
|
||||
"color": {
|
||||
"separator": "1"
|
||||
"separator": "1" // Bold
|
||||
},
|
||||
"constants": [
|
||||
"───────────────────────────"
|
||||
],
|
||||
"key": {
|
||||
"type": "both",
|
||||
"paddingLeft": 4
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "title",
|
||||
"format": " {6}{7}{8}"
|
||||
"format": " {user-name-colored}{at-symbol-colored}{host-name-colored}"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "┌───────────────────────────── {#1}System Information{#} ─────────────────────────────┐"
|
||||
"format": "┌{$1} {#1}System Information{#} {$1}┐"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"key": " OS ",
|
||||
"key": "OS ",
|
||||
"keyColor": "red",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": " Machine ",
|
||||
"key": "Machine ",
|
||||
"keyColor": "green",
|
||||
"type": "host"
|
||||
},
|
||||
{
|
||||
"key": " Kernel ",
|
||||
"key": "Kernel ",
|
||||
"keyColor": "magenta",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": " Uptime ",
|
||||
"key": "Uptime ",
|
||||
"keyColor": "red",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": " Resolution ",
|
||||
"key": "Resolution ",
|
||||
"keyColor": "yellow",
|
||||
"type": "display",
|
||||
"compactType": "original-with-refresh-rate"
|
||||
},
|
||||
{
|
||||
"key": " WM ",
|
||||
"key": "WM ",
|
||||
"keyColor": "blue",
|
||||
"type": "wm"
|
||||
},
|
||||
{
|
||||
"key": " DE ",
|
||||
"key": "DE ",
|
||||
"keyColor": "green",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": " Shell ",
|
||||
"key": "Shell ",
|
||||
"keyColor": "cyan",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": " Terminal ",
|
||||
"key": "Terminal ",
|
||||
"keyColor": "red",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": " CPU ",
|
||||
"key": "CPU ",
|
||||
"keyColor": "yellow",
|
||||
"type": "cpu"
|
||||
},
|
||||
{
|
||||
"key": " GPU ",
|
||||
"key": "GPU ",
|
||||
"keyColor": "blue",
|
||||
"type": "gpu"
|
||||
},
|
||||
{
|
||||
"key": " Memory ",
|
||||
"key": "Memory ",
|
||||
"keyColor": "magenta",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": " Local IP ",
|
||||
"key": "Local IP ",
|
||||
"keyColor": "red",
|
||||
"type": "localip",
|
||||
"compact": true
|
||||
},
|
||||
{
|
||||
"key": " Public IP ",
|
||||
"key": "Public IP ",
|
||||
"keyColor": "cyan",
|
||||
"type": "publicip"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "└──────────────────────────────────────────────────────────────────────────────┘"
|
||||
"format": "└{$1}────────────────────{$1}┘"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
|
||||
+17
-19
@@ -8,8 +8,7 @@
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"separator": "",
|
||||
"keyWidth": 15
|
||||
"separator": " "
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
@@ -17,65 +16,64 @@
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
// draw borders first to make colors of left and right border consistant
|
||||
"key": "│ │\u001b[11D{#31} user",
|
||||
"key": "│ {#31} user {#keys}│",
|
||||
"type": "title",
|
||||
"format": "{1}"
|
||||
"format": "{user-name}"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#32} hname",
|
||||
"key": "│ {#32} hname {#keys}│",
|
||||
"type": "title",
|
||||
"format": "{2}"
|
||||
"format": "{host-name}"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#33} uptime",
|
||||
"key": "│ {#33} uptime {#keys}│",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#34} distro",
|
||||
"key": "│ {#34}{icon} distro {#keys}│",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#35} kernel",
|
||||
"key": "│ {#35} kernel {#keys}│",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#36} desktop",
|
||||
"key": "│ {#36} desktop {#keys}│",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#31} term",
|
||||
"key": "│ {#31} term {#keys}│",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#32} shell",
|
||||
"key": "│ {#32} shell {#keys}│",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#33} cpu",
|
||||
"key": "│ {#33} cpu {#keys}│",
|
||||
"type": "cpu",
|
||||
"showPeCoreCount": true
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#34} disk",
|
||||
"key": "│ {#34} disk {#keys}│",
|
||||
"type": "disk",
|
||||
"folders": "/"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#35} memory",
|
||||
"key": "│ {#35} memory {#keys}│",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#36} network",
|
||||
"key": "│ {#36} network {#keys}│",
|
||||
"type": "localip",
|
||||
"format": "{1} ({4})"
|
||||
"format": "{ipv4} ({ifname})"
|
||||
},
|
||||
{
|
||||
"key": "├───────────┤",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"key": "│ │\u001b[11D{#39} colors",
|
||||
"key": "│ {#39} colors {#keys}│",
|
||||
"type": "colors",
|
||||
"symbol": "circle"
|
||||
},
|
||||
|
||||
@@ -6,20 +6,22 @@
|
||||
},
|
||||
"display": {
|
||||
"separator": "",
|
||||
"keyWidth": 12
|
||||
"key": {
|
||||
"width": 15
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
// draw borders first to make colors of left and right border consistant
|
||||
"key": " user",
|
||||
"type": "title",
|
||||
"format": "{1}",
|
||||
"format": "{user-name}",
|
||||
"keyColor": "31"
|
||||
},
|
||||
{
|
||||
"key": " hname",
|
||||
"type": "title",
|
||||
"format": "{2}",
|
||||
"format": "{host-name}",
|
||||
"keyColor": "32"
|
||||
|
||||
},
|
||||
@@ -29,7 +31,7 @@
|
||||
"keyColor": "33"
|
||||
},
|
||||
{
|
||||
"key": " distro",
|
||||
"key": "{icon} distro",
|
||||
"type": "os",
|
||||
"keyColor": "34"
|
||||
},
|
||||
@@ -73,7 +75,7 @@
|
||||
{
|
||||
"key": " network",
|
||||
"type": "localip",
|
||||
"format": "{1} ({4})",
|
||||
"format": "{ipv4} ({ifname})",
|
||||
"keyColor": "36"
|
||||
},
|
||||
{
|
||||
|
||||
+17
-19
@@ -8,8 +8,7 @@
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"separator": "",
|
||||
"keyWidth": 15
|
||||
"separator": " "
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
@@ -17,65 +16,64 @@
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
// draw borders first to make colors of left and right border consistant
|
||||
"key": "• •\u001b[11D{#31} user",
|
||||
"key": "• {#31} user {#keys}•",
|
||||
"type": "title",
|
||||
"format": "{1}"
|
||||
"format": "{user-name}"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#32} hname",
|
||||
"key": "• {#32} hname {#keys}•",
|
||||
"type": "title",
|
||||
"format": "{2}"
|
||||
"format": "{host-name}"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#33} uptime",
|
||||
"key": "• {#33} uptime {#keys}•",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#34} distro",
|
||||
"key": "• {#34}{icon} distro {#keys}•",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#35} kernel",
|
||||
"key": "• {#35} kernel {#keys}•",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#36} desktop",
|
||||
"key": "• {#36} desktop {#keys}•",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#31} term",
|
||||
"key": "• {#31} term {#keys}•",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#32} shell",
|
||||
"key": "• {#32} shell {#keys}•",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#33} cpu",
|
||||
"key": "• {#33} cpu {#keys}•",
|
||||
"type": "cpu",
|
||||
"showPeCoreCount": true
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#34} disk",
|
||||
"key": "• {#34} disk {#keys}•",
|
||||
"type": "disk",
|
||||
"folders": "/"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#35} memory",
|
||||
"key": "• {#35} memory {#keys}•",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#36} network",
|
||||
"key": "• {#36} network {#keys}•",
|
||||
"type": "localip",
|
||||
"format": "{1} ({4})"
|
||||
"format": "{ipv4} ({ifname})"
|
||||
},
|
||||
{
|
||||
"key": "•••••••••••••",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"key": "• •\u001b[11D{#39} colors",
|
||||
"key": "• {#39} colors {#keys}•",
|
||||
"type": "colors",
|
||||
"symbol": "circle"
|
||||
},
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
{
|
||||
"key": "║ {#31} user {#keys}║",
|
||||
"type": "title",
|
||||
"format": "{1}"
|
||||
"format": "{user-name}"
|
||||
},
|
||||
{
|
||||
"key": "║ {#32} hname {#keys}║",
|
||||
"type": "title",
|
||||
"format": "{2}"
|
||||
"format": "{host-name}"
|
||||
},
|
||||
{
|
||||
"key": "║ {#33} uptime {#keys}║",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": "║ {#34} distro {#keys}║",
|
||||
"key": "║ {#34}{icon} distro {#keys}║",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
@@ -66,7 +66,7 @@
|
||||
{
|
||||
"key": "║ {#36} network {#keys}║",
|
||||
"type": "localip",
|
||||
"format": "{1} ({4})"
|
||||
"format": "{ipv4} ({ifname})"
|
||||
},
|
||||
{
|
||||
"key": "╠═══════════╣",
|
||||
|
||||
+21
-17
@@ -11,72 +11,76 @@
|
||||
"separator": "> ",
|
||||
"color": {
|
||||
"separator": "red"
|
||||
}
|
||||
},
|
||||
"constants": [
|
||||
"───────────────────────────────────────────────────────────────────────────",
|
||||
"│\u001b[75C│\u001b[75D"
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"format": "{#1}{#keys}╭───────────────────────────────────────────────────────────────────────────╮\u001b[76D {6}{7}{8} 🖥 ",
|
||||
"format": "{#1}{#keys}╭{$1}╮\u001b[76D {user-name-colored}{at-symbol-colored}{host-name-colored} 🖥 ",
|
||||
"type": "title"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#31} kernel ",
|
||||
"key": "{$2}{#31} kernel ",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#32} uptime ",
|
||||
"key": "{$2}{#32} uptime ",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#33} distro ",
|
||||
"key": "{$2}{#33}{icon} distro ",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#34} desktop ",
|
||||
"key": "{$2}{#34} desktop ",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#35} term ",
|
||||
"key": "{$2}{#35} term ",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#36} shell ",
|
||||
"key": "{$2}{#36} shell ",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#35} cpu ",
|
||||
"key": "{$2}{#35} cpu ",
|
||||
"type": "cpu",
|
||||
"showPeCoreCount": true,
|
||||
"temp": true
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#34} gpu ",
|
||||
"key": "{$2}{#34} gpu ",
|
||||
"type": "gpu"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#33} disk ",
|
||||
"key": "{$2}{#33} disk ",
|
||||
"type": "disk",
|
||||
"folders": "/"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#32} memory ",
|
||||
"key": "{$2}{#32} memory ",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#31} network ",
|
||||
"key": "{$2}{#31} network ",
|
||||
"type": "localip",
|
||||
"format": "{1} ({4})"
|
||||
"format": "{ipv4} ({ifname})"
|
||||
},
|
||||
{
|
||||
"format": "{#1}{#keys}├───────────────────────────────────────────────────────────────────────────┤",
|
||||
"format": "{#1}{#keys}├{$1}┤",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"key": "│\u001b[75C│\u001b[75D{#39} colors ",
|
||||
"key": "{$2}{#39} colors ",
|
||||
"type": "colors",
|
||||
"symbol": "circle"
|
||||
},
|
||||
{
|
||||
"format": "{#1}{#keys}╰───────────────────────────────────────────────────────────────────────────╯",
|
||||
"format": "{#1}{#keys}╰{$1}╯",
|
||||
"type": "custom"
|
||||
}
|
||||
]
|
||||
|
||||
+21
-17
@@ -11,72 +11,76 @@
|
||||
"separator": "> ",
|
||||
"color": {
|
||||
"separator": "red"
|
||||
}
|
||||
},
|
||||
"constants": [
|
||||
"═══════════════════════════════════════════════════════════════════════════",
|
||||
"║\u001b[75C║\u001b[75D"
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"format": "{#1}{#keys}╔═══════════════════════════════════════════════════════════════════════════╗\u001b[76D {6}{7}{8} 💻 ",
|
||||
"format": "{#1}{#keys}╔{$1}╗\u001b[76D {user-name-colored}{at-symbol-colored}{host-name-colored} 💻 ",
|
||||
"type": "title"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#31} kernel ",
|
||||
"key": "{$2}{#31} kernel ",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#32} uptime ",
|
||||
"key": "{$2}{#32} uptime ",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#33} distro ",
|
||||
"key": "{$2}{#33}{icon} distro ",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#34} desktop ",
|
||||
"key": "{$2}{#34} desktop ",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#35} term ",
|
||||
"key": "{$2}{#35} term ",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#36} shell ",
|
||||
"key": "{$2}{#36} shell ",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#35} cpu ",
|
||||
"key": "{$2}{#35} cpu ",
|
||||
"type": "cpu",
|
||||
"showPeCoreCount": true,
|
||||
"temp": true
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#34} gpu ",
|
||||
"key": "{$2}{#34} gpu ",
|
||||
"type": "gpu"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#33} disk ",
|
||||
"key": "{$2}{#33} disk ",
|
||||
"type": "disk",
|
||||
"folders": "/"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#32} memory ",
|
||||
"key": "{$2}{#32} memory ",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#31} network ",
|
||||
"key": "{$2}{#31} network ",
|
||||
"type": "localip",
|
||||
"format": "{1} ({4})"
|
||||
"format": "{ipv4} ({ifname})"
|
||||
},
|
||||
{
|
||||
"format": "{#1}{#keys}╠═══════════════════════════════════════════════════════════════════════════╣",
|
||||
"format": "{#1}{#keys}╠{$1}╣",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"key": "║\u001b[75C║\u001b[75D{#39} colors ",
|
||||
"key": "{$2}{#39} colors ",
|
||||
"type": "colors",
|
||||
"symbol": "circle"
|
||||
},
|
||||
{
|
||||
"format": "{#1}{#keys}╚═══════════════════════════════════════════════════════════════════════════╝",
|
||||
"format": "{#1}{#keys}╚{$1}╝",
|
||||
"type": "custom"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"logo": {
|
||||
"source": " _____ _____ _____ _____ _____ _____ _____ _____ _____\n| __| _ | __|_ _| __| __|_ _| | | |\n| __| |__ | | | | __| __| | | | --| |\n|__| |__|__|_____| |_| |__| |_____| |_| |_____|__|__|",
|
||||
"type": "data",
|
||||
"separate": true,
|
||||
"position": "top",
|
||||
"padding": {
|
||||
"right": 2
|
||||
}
|
||||
|
||||
+44
-126
@@ -10,153 +10,71 @@
|
||||
// "height": 12
|
||||
// },
|
||||
"display": {
|
||||
"separator": " "
|
||||
"separator": " ",
|
||||
"constants": [
|
||||
"─────────────────" // {$1}, used in Custom module
|
||||
],
|
||||
"key": {
|
||||
"type": "icon",
|
||||
"paddingLeft": 2
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "custom", // HardwareStart
|
||||
// {#1} is equivalent to `\u001b[1m`. {#} is equivalent to `\u001b[m`
|
||||
"format": "┌─────────── {#1}Hardware Information{#} ───────────┐"
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "swap",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "display",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "brightness",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "battery",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "poweradapter",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "bluetooth",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "sound",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "gamepad",
|
||||
"key": " "
|
||||
"format": "┌{$1} {#1}Hardware Information{#} {$1}┐"
|
||||
},
|
||||
"host",
|
||||
"cpu",
|
||||
"gpu",
|
||||
"disk",
|
||||
"memory",
|
||||
"swap",
|
||||
"display",
|
||||
"brightness",
|
||||
"battery",
|
||||
"poweradapter",
|
||||
"bluetooth",
|
||||
"sound",
|
||||
"gamepad",
|
||||
{
|
||||
"type": "custom", // SoftwareStart
|
||||
"format": "├─────────── {#1}Software Information{#} ───────────┤"
|
||||
"format": "├{$1} {#1}Software Information{#} {$1}┤"
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"key": " ",
|
||||
"format": "{1}@{2}"
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": " " // Just get your distro's logo off nerdfonts.com
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
"key": " ",
|
||||
"format": "{1} {2}"
|
||||
},
|
||||
{
|
||||
"type": "lm",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "de",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "wm",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "terminal",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "terminalfont",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "theme",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "icons",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "wallpaper",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "uptime",
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "media",
|
||||
"key": " "
|
||||
"keyIcon": "",
|
||||
"key": "Title", // Title module has no key by default, so that icon is not displayed
|
||||
"format": "{user-name}@{host-name}"
|
||||
},
|
||||
"os",
|
||||
"kernel",
|
||||
"lm",
|
||||
"de",
|
||||
"wm",
|
||||
"shell",
|
||||
"terminal",
|
||||
"terminalfont",
|
||||
"theme",
|
||||
"icons",
|
||||
"wallpaper",
|
||||
"packages",
|
||||
"uptime",
|
||||
"media",
|
||||
{
|
||||
"type": "localip",
|
||||
"key": " ",
|
||||
"compact": true
|
||||
},
|
||||
{
|
||||
"type": "publicip",
|
||||
"key": " "
|
||||
},
|
||||
"publicip",
|
||||
{
|
||||
"type": "wifi",
|
||||
"key": " ",
|
||||
"format": "{4}" // ssid
|
||||
},
|
||||
{
|
||||
"type": "locale",
|
||||
"key": " "
|
||||
"format": "{ssid}"
|
||||
},
|
||||
"locale",
|
||||
{
|
||||
"type": "custom", // InformationEnd
|
||||
"format": "└────────────────────────────────────────────┘"
|
||||
"format": "└{$1}──────────────────────{$1}┘"
|
||||
},
|
||||
{
|
||||
"type": "colors",
|
||||
|
||||
+25
-20
@@ -4,7 +4,9 @@
|
||||
"logo": null,
|
||||
"display": {
|
||||
"pipe": true,
|
||||
"keyWidth": 16,
|
||||
"key": {
|
||||
"width": 16
|
||||
},
|
||||
"separator": "│ ",
|
||||
"percent": {
|
||||
"type": 6
|
||||
@@ -15,7 +17,10 @@
|
||||
"charElapsed": "█",
|
||||
"charTotal": "░",
|
||||
"width": 40
|
||||
}
|
||||
},
|
||||
"constants": [
|
||||
"\u001b[42C"
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
@@ -41,11 +46,11 @@
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": "│ OS │\u001b[42C"
|
||||
"key": "│ OS │{$1}"
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
"key": "│ KERNEL │\u001b[42C"
|
||||
"key": "│ KERNEL │{$1}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
@@ -53,34 +58,34 @@
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"key": "│ HOSTNAME │\u001b[42C",
|
||||
"key": "│ HOSTNAME │{$1}",
|
||||
"format": "{host-name}"
|
||||
},
|
||||
{
|
||||
"type": "localip",
|
||||
"key": "│ CLIENT IP │\u001b[42C",
|
||||
"key": "│ CLIENT IP │{$1}",
|
||||
"format": "{ipv4}"
|
||||
},
|
||||
{
|
||||
"type": "localip",
|
||||
"key": "│ MAC ADDR │\u001b[42C",
|
||||
"key": "│ MAC ADDR │{$1}",
|
||||
"format": "{mac} ({ifname})",
|
||||
"showIPv4": false,
|
||||
"showMac": true
|
||||
},
|
||||
{
|
||||
"type": "dns",
|
||||
"key": "│ DNS │\u001b[42C",
|
||||
"key": "│ DNS │{$1}",
|
||||
"showType": "ipv4"
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"key": "│ USER │\u001b[42C",
|
||||
"key": "│ USER │{$1}",
|
||||
"format": "{user-name}"
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"key": "│ MACHINE │\u001b[42C",
|
||||
"key": "│ MACHINE │{$1}",
|
||||
"format": "{name}"
|
||||
},
|
||||
{
|
||||
@@ -89,25 +94,25 @@
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "│ PROCESSOR │\u001b[42C",
|
||||
"key": "│ PROCESSOR │{$1}",
|
||||
"format": "{name}"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "│ CORES │\u001b[42C",
|
||||
"key": "│ CORES │{$1}",
|
||||
"format": "{cores-physical} PHYSICAL CORES / {cores-logical} THREADS",
|
||||
"showPeCoreCount": false
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "│ CPU FREQ │\u001b[42C",
|
||||
"key": "│ CPU FREQ │{$1}",
|
||||
"format": "{freq-max}{/freq-max}{freq-base}{/} GHz"
|
||||
},
|
||||
{
|
||||
"type": "loadavg",
|
||||
"compact": false,
|
||||
// {duration} is not fixed length, hack it
|
||||
"key": "│ LOAD \u001b[s{duration}m\u001b[u\u001b[6C│\u001b[42C"
|
||||
"key": "│ LOAD \u001b[s{duration}m\u001b[u\u001b[6C│{$1}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
@@ -115,12 +120,12 @@
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": "│ MEMORY │\u001b[42C",
|
||||
"key": "│ MEMORY │{$1}",
|
||||
"format": "{used} / {total} [{percentage}]"
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": "│ USAGE │\u001b[42C",
|
||||
"key": "│ USAGE │{$1}",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
@@ -129,13 +134,13 @@
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"key": "│ VOLUME │\u001b[42C",
|
||||
"key": "│ VOLUME │{$1}",
|
||||
"format": "{size-used} / {size-total} [{size-percentage}]",
|
||||
"folders": "/"
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"key": "│ DISK USAGE │\u001b[42C",
|
||||
"key": "│ DISK USAGE │{$1}",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
@@ -144,13 +149,13 @@
|
||||
},
|
||||
{
|
||||
"type": "users",
|
||||
"key": "│ LAST LOGIN │\u001b[42C",
|
||||
"key": "│ LAST LOGIN │{$1}",
|
||||
"format": "{login-time}{?client-ip} ({client-ip})",
|
||||
"myselfOnly": true
|
||||
},
|
||||
{
|
||||
"type": "uptime",
|
||||
"key": "│ UPTIME │\u001b[42C"
|
||||
"key": "│ UPTIME │{$1}"
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
|
||||
@@ -3,39 +3,44 @@
|
||||
"logo": {
|
||||
"type": "small"
|
||||
},
|
||||
"display": {
|
||||
"constants": [
|
||||
"██ "
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"key": "██ Distro",
|
||||
"key": "{$1}Distro",
|
||||
"keyColor": "38;5;210",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": "██ Kernel",
|
||||
"key": "{$1}Kernel",
|
||||
"keyColor": "38;5;84",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": "██ Shell",
|
||||
"key": "{$1}Shell",
|
||||
"keyColor": "38;5;147",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": "██ Packages",
|
||||
"key": "{$1}Packages",
|
||||
"keyColor": "38;5;200",
|
||||
"type": "packages"
|
||||
},
|
||||
{
|
||||
"key": "██ WM",
|
||||
"key": "{$1}WM",
|
||||
"keyColor": "38;5;44",
|
||||
"type": "wm"
|
||||
},
|
||||
{
|
||||
"key": "██ CPU",
|
||||
"key": "{$1}CPU",
|
||||
"keyColor": "38;5;75",
|
||||
"type": "cpu"
|
||||
},
|
||||
{
|
||||
"key": "██ Memory",
|
||||
"key": "{$1}Memory",
|
||||
"keyColor": "38;5;123",
|
||||
"type": "memory"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Designed for Arch Linux
|
||||
// Modified from: https://github.com/fastfetch-cli/fastfetch/pull/1025#issuecomment-2177566138
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
@@ -12,7 +13,10 @@
|
||||
"color": {
|
||||
"separator": "blue"
|
||||
},
|
||||
"separator": " | "
|
||||
"separator": " | ",
|
||||
"constants": [
|
||||
">-----------<+>---------------------------------------------<"
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
@@ -22,7 +26,7 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": ">-----------<+>------------------------------------------<",
|
||||
"format": "{$1}",
|
||||
"outputColor": "separator"
|
||||
},
|
||||
{
|
||||
@@ -57,7 +61,7 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": ">-----------<+>------------------------------------------<",
|
||||
"format": "{$1}",
|
||||
"outputColor": "separator"
|
||||
},
|
||||
{
|
||||
@@ -97,7 +101,7 @@
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": ">-----------<+>------------------------------------------<",
|
||||
"format": "{$1}",
|
||||
"outputColor": "separator"
|
||||
},
|
||||
"break",
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": "debian_small",
|
||||
"logo": {
|
||||
"type": "small"
|
||||
},
|
||||
"display": {
|
||||
"binaryPrefix": "si"
|
||||
"size": {
|
||||
"binaryPrefix": "si"
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
"vulkan",
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"source": "arch_small",
|
||||
"type": "small",
|
||||
"padding": {
|
||||
"right": 1
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"binaryPrefix": "si",
|
||||
"size": {
|
||||
"binaryPrefix": "si"
|
||||
},
|
||||
"color": "blue",
|
||||
"separator": " "
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": null,
|
||||
"display": {
|
||||
"color": "reset_magenta"
|
||||
"color": "magenta"
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
// "logo": {
|
||||
// "type": "iterm",
|
||||
// "source": "/Users/carter/Desktop/apple1.png",
|
||||
// "width": 28,
|
||||
// "height": 12
|
||||
// },
|
||||
"display": {
|
||||
"separator": " "
|
||||
},
|
||||
@@ -125,23 +119,22 @@
|
||||
"key": "╰─",
|
||||
"keyColor": "yellow"
|
||||
},
|
||||
|
||||
"break",
|
||||
|
||||
{
|
||||
"type": "title",
|
||||
"key": "╭─",
|
||||
"format": "{1}@{2}",
|
||||
"format": "{user-name}@{host-name}",
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": "├─", // Just get your distro's logo off nerdfonts.com
|
||||
"key": "├─{icon}", // Just get your distro's logo off nerdfonts.com
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
"key": "├─",
|
||||
"format": "{1} {2}",
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
@@ -173,7 +166,7 @@
|
||||
{
|
||||
"type": "wifi",
|
||||
"key": "├─",
|
||||
"format": "{4}", // ssid
|
||||
"format": "{ssid}",
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": "├", // Just get your distro's logo off nerdfonts.com
|
||||
"keyColor": "yellow",
|
||||
"format": "{6}{?6} {?}{10}{?10} {?}{8}{?8} {?}{11}"
|
||||
"key": "├{icon}", // Just get your distro's logo off nerdfonts.com
|
||||
"keyColor": "yellow"
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
@@ -106,13 +105,13 @@
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "uptime",
|
||||
"key": "├",
|
||||
"type": "display",
|
||||
"key": "├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "display",
|
||||
"key": "└",
|
||||
"type": "uptime",
|
||||
"key": "└",
|
||||
"keyColor": "green"
|
||||
},
|
||||
|
||||
|
||||
+13
-24
@@ -11,6 +11,9 @@
|
||||
"size": {
|
||||
"ndigits": 0,
|
||||
"maxPrefix": "MB"
|
||||
},
|
||||
"key": {
|
||||
"type": "icon"
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
@@ -22,31 +25,17 @@
|
||||
"host": "blue"
|
||||
}
|
||||
},
|
||||
"os",
|
||||
"kernel",
|
||||
"memory",
|
||||
"packages",
|
||||
"uptime",
|
||||
{
|
||||
"type": "os",
|
||||
"key": "",
|
||||
"format": "{2} {8}"
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "uptime",
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"key": "",
|
||||
"format": "{#31}███{#32}███{#33}███{#34}███{#35}███{#36}███"
|
||||
"type": "colors",
|
||||
"key": "Colors", // For printing icon
|
||||
"block": {
|
||||
"range": [1, 6]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
"type": "small"
|
||||
},
|
||||
"display": {
|
||||
"keyWidth": 11,
|
||||
"key": {
|
||||
"width": 11
|
||||
},
|
||||
"bar": {
|
||||
"charElapsed": "=",
|
||||
"charTotal": "-",
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"modules": [
|
||||
{
|
||||
"type": "host",
|
||||
"format": "{?2}{2}{?}{?5} ({5}){?}"
|
||||
},
|
||||
"chassis",
|
||||
{
|
||||
"type": "board",
|
||||
"format": "{?1}{1}{?}{?2} ({2}){?}"
|
||||
},
|
||||
"cpu",
|
||||
{
|
||||
"type": "memory",
|
||||
"format": "{?2}{2}{?}"
|
||||
},
|
||||
"physicaldisk",
|
||||
"gpu",
|
||||
"display",
|
||||
"monitor",
|
||||
{
|
||||
"type": "wifi",
|
||||
"format": "{?1}{1}{?}{?6} - {6}{?}"
|
||||
},
|
||||
{
|
||||
"type": "sound",
|
||||
"format": "{?2}{2}{?}"
|
||||
},
|
||||
"camera",
|
||||
{
|
||||
"type": "battery",
|
||||
"format": "{?1}{1}{?}{?2} {2}{?}{?3} ({3}){?}"
|
||||
},
|
||||
"poweradapter"
|
||||
]
|
||||
}
|
||||
@@ -11,7 +11,10 @@
|
||||
"separator",
|
||||
"os",
|
||||
"host",
|
||||
"kernel",
|
||||
{
|
||||
"type": "kernel",
|
||||
"format": "{release}"
|
||||
},
|
||||
"uptime",
|
||||
"packages",
|
||||
"shell",
|
||||
@@ -28,7 +31,7 @@
|
||||
"terminal",
|
||||
{
|
||||
"type": "terminalfont",
|
||||
"format": "{/2}{-}{/}{2}{?3} {3}{?}"
|
||||
"format": "{/name}{-}{/}{name}{?size} {size}{?}"
|
||||
},
|
||||
"cpu",
|
||||
{
|
||||
@@ -37,7 +40,7 @@
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"format": "{/1}{-}{/}{/2}{-}{/}{} / {}"
|
||||
"format": "{} / {}"
|
||||
},
|
||||
"break",
|
||||
"colors"
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"modules": [
|
||||
"os",
|
||||
"kernel",
|
||||
"shell",
|
||||
"de",
|
||||
"wm",
|
||||
"wmtheme",
|
||||
"theme",
|
||||
"icons",
|
||||
"font",
|
||||
"cursor",
|
||||
"terminal",
|
||||
"terminalfont"
|
||||
]
|
||||
}
|
||||
@@ -244,6 +244,27 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
|
||||
continue;
|
||||
}
|
||||
|
||||
//test for constant, if so evaluate it
|
||||
if (firstChar == '$')
|
||||
{
|
||||
char* pend = NULL;
|
||||
int32_t indexSigned = (int32_t) strtol(placeholderValue.chars + 1, &pend, 10);
|
||||
uint32_t index = (uint32_t) indexSigned;
|
||||
bool backward = indexSigned < 0;
|
||||
|
||||
if (indexSigned == 0 || *pend != '\0' || instance.config.display.constants.length < index)
|
||||
{
|
||||
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
|
||||
continue;
|
||||
}
|
||||
|
||||
FFstrbuf* item = FF_LIST_GET(FFstrbuf, instance.config.display.constants, backward
|
||||
? instance.config.display.constants.length - index
|
||||
: index - 1);
|
||||
ffStrbufAppend(buffer, item);
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t truncLength = INT32_MAX;
|
||||
char* pColon = memchr(placeholderValue.chars, ':', placeholderValue.length);
|
||||
if (pColon != NULL)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
typedef enum FFformatargtype
|
||||
{
|
||||
FF_FORMAT_ARG_TYPE_NULL = 0,
|
||||
|
||||
@@ -229,7 +229,6 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
||||
hConout = CreateFileW(L"CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, NULL);
|
||||
hOutput = hConout;
|
||||
}
|
||||
WriteFile(hOutput, "TEST\n", 5, &bytes, NULL);
|
||||
WriteFile(hOutput, request, (DWORD) strlen(request), &bytes, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ bool ffJsonConfigParseModuleArgs(const char* key, yyjson_val* val, FFModuleArgs*
|
||||
moduleArgs->keyWidth = (uint32_t) yyjson_get_uint(val);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(key, "keyIcon"))
|
||||
{
|
||||
ffStrbufSetS(&moduleArgs->keyIcon, yyjson_get_str(val));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -50,6 +55,8 @@ void ffJsonConfigGenerateModuleArgsConfig(yyjson_mut_doc* doc, yyjson_mut_val* m
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "keyColor", &moduleArgs->keyColor);
|
||||
if (moduleArgs->keyWidth != defaultModuleArgs->keyWidth)
|
||||
yyjson_mut_obj_add_uint(doc, module, "keyWidth", moduleArgs->keyWidth);
|
||||
if (!ffStrbufEqual(&defaultModuleArgs->keyIcon, &moduleArgs->keyIcon))
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "keyIcon", &moduleArgs->keyIcon);
|
||||
}
|
||||
|
||||
const char* ffJsonConfigParseEnum(yyjson_val* val, int* result, FFKeyValuePair pairs[])
|
||||
|
||||
+20
-28
@@ -50,20 +50,29 @@ bool ffOptionParseModuleArgs(const char* argumentKey, const char* subKey, const
|
||||
ffOptionParseColor(value, &result->outputColor);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(subKey, "key-color"))
|
||||
else if(ffStrStartsWithIgnCase(subKey, "key-"))
|
||||
{
|
||||
if(value == NULL)
|
||||
const char* subKey2 = subKey + strlen("key-");
|
||||
if(ffStrEqualsIgnCase(subKey2, "color"))
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s <str>\n", argumentKey);
|
||||
exit(477);
|
||||
if(value == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s <str>\n", argumentKey);
|
||||
exit(477);
|
||||
}
|
||||
ffOptionParseColor(value, &result->keyColor);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(subKey2, "width"))
|
||||
{
|
||||
result->keyWidth = ffOptionParseUInt32(argumentKey, value);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(subKey2, "icon"))
|
||||
{
|
||||
ffOptionParseString(argumentKey, value, &result->keyIcon);
|
||||
return true;
|
||||
}
|
||||
ffOptionParseColor(value, &result->keyColor);
|
||||
return true;
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(subKey, "key-width"))
|
||||
{
|
||||
result->keyWidth = ffOptionParseUInt32(argumentKey, value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -205,20 +214,3 @@ void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
|
||||
#undef FF_APPEND_COLOR_PROP_COND
|
||||
}
|
||||
}
|
||||
|
||||
void ffOptionInitModuleArg(FFModuleArgs* args)
|
||||
{
|
||||
ffStrbufInit(&args->key);
|
||||
ffStrbufInit(&args->keyColor);
|
||||
ffStrbufInit(&args->outputFormat);
|
||||
ffStrbufInit(&args->outputColor);
|
||||
args->keyWidth = 0;
|
||||
}
|
||||
|
||||
void ffOptionDestroyModuleArg(FFModuleArgs* args)
|
||||
{
|
||||
ffStrbufDestroy(&args->key);
|
||||
ffStrbufDestroy(&args->keyColor);
|
||||
ffStrbufDestroy(&args->outputFormat);
|
||||
ffStrbufDestroy(&args->outputColor);
|
||||
}
|
||||
|
||||
+28
-2
@@ -45,10 +45,19 @@ static inline void ffOptionInitModuleBaseInfo(
|
||||
baseInfo->generateJsonConfig = (__typeof__(baseInfo->generateJsonConfig)) generateJsonConfig;
|
||||
}
|
||||
|
||||
typedef enum FFModuleKeyType
|
||||
{
|
||||
FF_MODULE_KEY_TYPE_NONE = 0,
|
||||
FF_MODULE_KEY_TYPE_STRING = 1 << 0,
|
||||
FF_MODULE_KEY_TYPE_ICON = 1 << 1,
|
||||
FF_MODULE_KEY_TYPE_BOTH = FF_MODULE_KEY_TYPE_STRING | FF_MODULE_KEY_TYPE_ICON,
|
||||
} FFModuleKeyType;
|
||||
|
||||
typedef struct FFModuleArgs
|
||||
{
|
||||
FFstrbuf key;
|
||||
FFstrbuf keyColor;
|
||||
FFstrbuf keyIcon;
|
||||
FFstrbuf outputFormat;
|
||||
FFstrbuf outputColor;
|
||||
uint32_t keyWidth;
|
||||
@@ -73,5 +82,22 @@ static inline void ffOptionParseColor(const char* value, FFstrbuf* buffer)
|
||||
ffStrbufClear(buffer);
|
||||
ffOptionParseColorNoClear(value, buffer);
|
||||
}
|
||||
void ffOptionInitModuleArg(FFModuleArgs* args);
|
||||
void ffOptionDestroyModuleArg(FFModuleArgs* args);
|
||||
|
||||
static inline void ffOptionInitModuleArg(FFModuleArgs* args, const char* icon)
|
||||
{
|
||||
ffStrbufInit(&args->key);
|
||||
ffStrbufInit(&args->keyColor);
|
||||
ffStrbufInitStatic(&args->keyIcon, icon);
|
||||
ffStrbufInit(&args->outputFormat);
|
||||
ffStrbufInit(&args->outputColor);
|
||||
args->keyWidth = 0;
|
||||
}
|
||||
|
||||
static inline void ffOptionDestroyModuleArg(FFModuleArgs* args)
|
||||
{
|
||||
ffStrbufDestroy(&args->key);
|
||||
ffStrbufDestroy(&args->keyColor);
|
||||
ffStrbufDestroy(&args->keyIcon);
|
||||
ffStrbufDestroy(&args->outputFormat);
|
||||
ffStrbufDestroy(&args->outputColor);
|
||||
}
|
||||
|
||||
+18
-4
@@ -79,15 +79,15 @@ static void parseSize(FFstrbuf* result, uint64_t bytes, uint32_t base, const cha
|
||||
|
||||
void ffParseSize(uint64_t bytes, FFstrbuf* result)
|
||||
{
|
||||
switch (instance.config.display.binaryPrefixType)
|
||||
switch (instance.config.display.sizeBinaryPrefix)
|
||||
{
|
||||
case FF_BINARY_PREFIX_TYPE_IEC:
|
||||
case FF_SIZE_BINARY_PREFIX_TYPE_IEC:
|
||||
parseSize(result, bytes, 1024, (const char*[]) {"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", NULL});
|
||||
break;
|
||||
case FF_BINARY_PREFIX_TYPE_SI:
|
||||
case FF_SIZE_BINARY_PREFIX_TYPE_SI:
|
||||
parseSize(result, bytes, 1000, (const char*[]) {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB", NULL});
|
||||
break;
|
||||
case FF_BINARY_PREFIX_TYPE_JEDEC:
|
||||
case FF_SIZE_BINARY_PREFIX_TYPE_JEDEC:
|
||||
parseSize(result, bytes, 1024, (const char*[]) {"B", "KB", "MB", "GB", "TB", NULL});
|
||||
break;
|
||||
default:
|
||||
@@ -96,6 +96,20 @@ void ffParseSize(uint64_t bytes, FFstrbuf* result)
|
||||
}
|
||||
}
|
||||
|
||||
bool ffParseFrequency(uint32_t mhz, FFstrbuf* result)
|
||||
{
|
||||
if (mhz == 0)
|
||||
return false;
|
||||
|
||||
int8_t ndigits = instance.config.display.freqNdigits;
|
||||
|
||||
if (ndigits >= 0)
|
||||
ffStrbufAppendF(result, "%.*f GHz", ndigits, mhz / 1000.);
|
||||
else
|
||||
ffStrbufAppendF(result, "%u MHz", (unsigned) mhz);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, const FFstrbuf* gtk4)
|
||||
{
|
||||
if(gtk2->length > 0 && gtk3->length > 0 && gtk4->length > 0)
|
||||
|
||||
@@ -26,3 +26,4 @@ void ffVersionToPretty(const FFVersion* version, FFstrbuf* pretty);
|
||||
int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
|
||||
|
||||
void ffParseSize(uint64_t bytes, FFstrbuf* result);
|
||||
bool ffParseFrequency(uint32_t mhz, FFstrbuf* result);
|
||||
|
||||
+29
-13
@@ -11,8 +11,10 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
||||
return;
|
||||
|
||||
//This is used as a magic value for hiding keys
|
||||
if (!(moduleArgs && ffStrbufEqualS(&moduleArgs->key, " ")))
|
||||
if (!(moduleArgs && ffStrbufEqualS(&moduleArgs->key, " ")) && instance.config.display.keyType != FF_MODULE_KEY_TYPE_NONE)
|
||||
{
|
||||
ffPrintCharTimes(' ', instance.config.display.keyPaddingLeft);
|
||||
|
||||
if(!instance.config.display.pipe)
|
||||
{
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
@@ -25,21 +27,35 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
||||
ffPrintColor(&instance.config.display.colorKeys);
|
||||
}
|
||||
|
||||
//NULL check is required for modules with custom keys, e.g. disk with the folder path
|
||||
if((printType & FF_PRINT_TYPE_NO_CUSTOM_KEY) || !moduleArgs || moduleArgs->key.length == 0)
|
||||
bool hasIcon = false;
|
||||
if (instance.config.display.keyType & FF_MODULE_KEY_TYPE_ICON && moduleArgs && moduleArgs->keyIcon.length > 0)
|
||||
{
|
||||
fputs(moduleName, stdout);
|
||||
|
||||
if(moduleIndex > 0)
|
||||
printf(" %hhu", moduleIndex);
|
||||
ffStrbufWriteTo(&moduleArgs->keyIcon, stdout);
|
||||
hasIcon = true;
|
||||
}
|
||||
else
|
||||
|
||||
if (instance.config.display.keyType & FF_MODULE_KEY_TYPE_STRING)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 1, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex, "index"},
|
||||
}));
|
||||
ffStrbufWriteTo(&key, stdout);
|
||||
if(hasIcon)
|
||||
putchar(' ');
|
||||
|
||||
//NULL check is required for modules with custom keys, e.g. disk with the folder path
|
||||
if((printType & FF_PRINT_TYPE_NO_CUSTOM_KEY) || !moduleArgs || moduleArgs->key.length == 0)
|
||||
{
|
||||
fputs(moduleName, stdout);
|
||||
|
||||
if(moduleIndex > 0)
|
||||
printf(" %hhu", moduleIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 2, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex, "index"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &moduleArgs->keyIcon, "icon"},
|
||||
}));
|
||||
ffStrbufWriteTo(&key, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
if(!instance.config.display.pipe)
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#ifdef _WIN32
|
||||
#include "util/windows/getline.h"
|
||||
#endif
|
||||
|
||||
static bool parsePropLinePointer(const char** line, const char* start, FFstrbuf* buffer)
|
||||
bool ffParsePropLinePointer(const char** line, const char* start, FFstrbuf* buffer)
|
||||
{
|
||||
if(**line == '\0')
|
||||
return false;
|
||||
@@ -32,7 +33,7 @@ static bool parsePropLinePointer(const char** line, const char* start, FFstrbuf*
|
||||
}
|
||||
|
||||
//Line doesn't match start, skip it
|
||||
if(**line != *start || **line == '\0')
|
||||
if(tolower(**line) != tolower(*start) || **line == '\0')
|
||||
return false;
|
||||
|
||||
//Line and start match, continue testing
|
||||
@@ -69,14 +70,9 @@ static bool parsePropLinePointer(const char** line, const char* start, FFstrbuf*
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer)
|
||||
{
|
||||
return parsePropLinePointer(&line, start, buffer);
|
||||
}
|
||||
|
||||
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer)
|
||||
{
|
||||
while(!parsePropLinePointer(&lines, start, buffer))
|
||||
while(!ffParsePropLinePointer(&lines, start, buffer))
|
||||
{
|
||||
while(*lines != '\0' && *lines != '\n')
|
||||
++lines;
|
||||
|
||||
@@ -8,12 +8,18 @@ typedef struct FFpropquery
|
||||
FFstrbuf* buffer;
|
||||
} FFpropquery;
|
||||
|
||||
bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer);
|
||||
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer);
|
||||
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries);
|
||||
bool ffParsePropFileHomeValues(const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
||||
bool ffParsePropFileListValues(const FFlist* list, const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
||||
|
||||
bool ffParsePropLinePointer(const char** line, const char* start, FFstrbuf* buffer);
|
||||
|
||||
static inline bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer)
|
||||
{
|
||||
return ffParsePropLinePointer(&line, start, buffer);
|
||||
}
|
||||
|
||||
static inline bool ffParsePropFile(const char* filename, const char* start, FFstrbuf* buffer)
|
||||
{
|
||||
return ffParsePropFileValues(filename, 1, (FFpropquery[]){{start, buffer}});
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ static inline uint64_t ffTimeGetTick() //In msec
|
||||
#else
|
||||
struct timespec timeNow;
|
||||
clock_gettime(CLOCK_MONOTONIC, &timeNow);
|
||||
return (uint64_t)((timeNow.tv_sec * 1000) + (timeNow.tv_nsec / 1000000));
|
||||
return (uint64_t)(((uint64_t) timeNow.tv_sec * 1000u) + ((uint64_t) timeNow.tv_nsec / 1000000u));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ static inline uint64_t ffTimeGetNow()
|
||||
#else
|
||||
struct timespec timeNow;
|
||||
clock_gettime(CLOCK_REALTIME, &timeNow);
|
||||
return (uint64_t)((timeNow.tv_sec * 1000) + (timeNow.tv_nsec / 1000000));
|
||||
return (uint64_t)(((uint64_t) timeNow.tv_sec * 1000u) + ((uint64_t) timeNow.tv_nsec / 1000000u));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+63
-24
@@ -505,6 +505,27 @@
|
||||
"type": "num"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "key-padding-left",
|
||||
"desc": "Set the left padding of keys to <num> characters",
|
||||
"arg": {
|
||||
"type": "num"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "key-type",
|
||||
"desc": "Set whether to show icon before string keys",
|
||||
"arg": {
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"none": "Disable keys",
|
||||
"string": "Show string",
|
||||
"icon": "Show icon (requires newest nerd font)",
|
||||
"both": "Show both icon and string"
|
||||
},
|
||||
"default": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "bright-color",
|
||||
"desc": "Set if the keys, title and ASCII logo should be printed in bright color",
|
||||
@@ -549,19 +570,6 @@
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "binary-prefix",
|
||||
"desc": "Set the binary prefix to used",
|
||||
"arg": {
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"IEC": "1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ...",
|
||||
"SI": "1000 Bytes = 1 KB, 1000 KB = 1 MB, ...",
|
||||
"JEDEC": "1024 Bytes = 1 kB, 1024 kB = 1 MB, ..."
|
||||
},
|
||||
"default": "IEC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "percent-type",
|
||||
"desc": "Set the percentage output type",
|
||||
@@ -669,6 +677,19 @@
|
||||
"type": "num"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "size-binary-prefix",
|
||||
"desc": "Set the binary prefix to used when formatting sizes",
|
||||
"arg": {
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"IEC": "1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ...",
|
||||
"SI": "1000 Bytes = 1 KB, 1000 KB = 1 MB, ...",
|
||||
"JEDEC": "1024 Bytes = 1 kB, 1024 kB = 1 MB, ..."
|
||||
},
|
||||
"default": "IEC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "size-max-prefix",
|
||||
"desc": "Set the largest binary prefix to use when formatting sizes",
|
||||
@@ -688,6 +709,14 @@
|
||||
"default": "YB"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "freq-ndigits",
|
||||
"desc": "Set the number of digits to keep after the decimal point when printing CPU / GPU frequency in GHz",
|
||||
"arg": {
|
||||
"type": "num",
|
||||
"default": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-unit",
|
||||
"desc": "Set the unit of the temperature",
|
||||
@@ -947,7 +976,7 @@
|
||||
},
|
||||
{
|
||||
"long": "separator-string",
|
||||
"desc": "Set the string printed by the separator module",
|
||||
"desc": "Set the string to be printed by the separator line",
|
||||
"arg": {
|
||||
"type": "str",
|
||||
"default": "-"
|
||||
@@ -955,12 +984,21 @@
|
||||
},
|
||||
{
|
||||
"long": "separator-output-color",
|
||||
"desc": "Set the color of the separator module",
|
||||
"desc": "Set the color of the separator line",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "separator-length",
|
||||
"desc": "Set the length of the separator line",
|
||||
"remark": "Set to 0 to automatically calculate it with the title length",
|
||||
"arg": {
|
||||
"type": "num",
|
||||
"default": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "disk-folders",
|
||||
"desc": "A colon (semicolon on Windows) separated list of folder paths to be detected",
|
||||
@@ -1168,14 +1206,6 @@
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "cpu-freq-ndigits",
|
||||
"desc": "Set the number of digits to keep after the decimal point when printing CPU frequency",
|
||||
"arg": {
|
||||
"type": "num",
|
||||
"default": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "cpu-show-pe-core-count",
|
||||
"desc": "Detect and display CPU frequency of different core types (eg. Pcore and Ecore) if supported",
|
||||
@@ -1538,13 +1568,14 @@
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"block": "\u2588\u2588\u2588",
|
||||
"background": "(whitespaces with background)",
|
||||
"circle": "\u25cf",
|
||||
"diamond": "\u25c6",
|
||||
"triangle": "\u25b2",
|
||||
"square": "\u25a0",
|
||||
"star": "\u2605"
|
||||
},
|
||||
"default": "block"
|
||||
"default": "background"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1627,6 +1658,14 @@
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-key-icon",
|
||||
"desc": "Set the icon to be displayed by \"--key-type icon\"",
|
||||
"arg": {
|
||||
"type": "string"
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-output-color",
|
||||
"desc": "Override the global \"--color-output\" option for each specific module",
|
||||
|
||||
@@ -29,7 +29,7 @@ static const char* detectWithBacklight(FFlist* result)
|
||||
continue;
|
||||
|
||||
ffStrbufAppendS(&backlightDir, entry->d_name);
|
||||
ffStrbufAppendS(&backlightDir, "/actual_brightness");
|
||||
ffStrbufAppendS(&backlightDir, "/brightness");
|
||||
if(ffReadFileBuffer(backlightDir.chars, &buffer))
|
||||
{
|
||||
double actualBrightness = ffStrbufToDouble(&buffer);
|
||||
|
||||
@@ -19,10 +19,9 @@ typedef struct FFCPUResult
|
||||
uint16_t coresLogical;
|
||||
uint16_t coresOnline;
|
||||
|
||||
double frequencyBase; // GHz
|
||||
double frequencyMax; // GHz
|
||||
double frequencyMin; // GHz
|
||||
double frequencyBiosLimit; // GHz
|
||||
uint32_t frequencyBase; // GHz
|
||||
uint32_t frequencyMax; // GHz
|
||||
uint32_t frequencyBiosLimit; // GHz
|
||||
|
||||
FFCPUCore coreTypes[16]; // number of P cores, E cores, etc.
|
||||
|
||||
|
||||
@@ -43,38 +43,37 @@ static const char* detectFrequency(FFCPUResult* cpu)
|
||||
if (!IOObjectConformsTo(entryDevice, "AppleARMIODevice"))
|
||||
return "\"pmgr\" should conform to \"AppleARMIODevice\"";
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFMutableDictionaryRef properties = NULL;
|
||||
if (IORegistryEntryCreateCFProperties(entryDevice, &properties, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess)
|
||||
return "IORegistryEntryCreateCFProperties() failed";
|
||||
|
||||
uint32_t pMin, eMin, aMax, pCoreLength;
|
||||
if (ffCfDictGetData(properties, CFSTR("voltage-states5-sram"), 0, 4, (uint8_t*) &pMin, &pCoreLength) != NULL) // pCore
|
||||
FF_CFTYPE_AUTO_RELEASE CFDataRef freqProperty = (CFDataRef) IORegistryEntryCreateCFProperty(entryDevice, CFSTR("voltage-states5-sram"), kCFAllocatorDefault, kNilOptions);
|
||||
if (!freqProperty || CFGetTypeID(freqProperty) != CFDataGetTypeID())
|
||||
return "\"voltage-states5-sram\" in \"pmgr\" is not found";
|
||||
if (ffCfDictGetData(properties, CFSTR("voltage-states1-sram"), 0, 4, (uint8_t*) &eMin, NULL) != NULL) // eCore
|
||||
return "\"voltage-states1-sram\" in \"pmgr\" is not found";
|
||||
|
||||
cpu->frequencyMin = (pMin < eMin ? pMin : eMin) / (1000.0 * 1000 * 1000);
|
||||
// voltage-states5-sram stores supported <frequency / voltage> pairs of pcores from the lowest to the highest
|
||||
// voltage-states1-sram stores ecores'
|
||||
CFIndex propLength = CFDataGetLength(freqProperty);
|
||||
if (propLength == 0 || propLength % (CFIndex) sizeof(uint32_t) * 2 != 0)
|
||||
return "Invalid \"voltage-states5-sram\" length";
|
||||
|
||||
if (pCoreLength >= 8)
|
||||
{
|
||||
ffCfDictGetData(properties, CFSTR("voltage-states5-sram"), pCoreLength - 8, 4, (uint8_t*) &aMax, NULL);
|
||||
cpu->frequencyMax = aMax / (1000.0 * 1000 * 1000);
|
||||
}
|
||||
uint32_t* pStart = (uint32_t*) CFDataGetBytePtr(freqProperty);
|
||||
uint32_t pMax = *pStart;
|
||||
for (CFIndex i = 2; i < propLength / (CFIndex) sizeof(uint32_t) && pStart[i] > 0; i += 2 /* skip voltage */)
|
||||
pMax = pMax > pStart[i] ? pMax : pStart[i];
|
||||
|
||||
if (pMax > 0)
|
||||
cpu->frequencyMax = pMax / 1000 / 1000;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static const char* detectFrequency(FFCPUResult* cpu)
|
||||
{
|
||||
cpu->frequencyBase = ffSysctlGetInt64("hw.cpufrequency", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyMin = ffSysctlGetInt64("hw.cpufrequency_min", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyMax = ffSysctlGetInt64("hw.cpufrequency_max", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
if(cpu->frequencyBase != cpu->frequencyBase)
|
||||
cpu->frequencyBase = (uint32_t) (ffSysctlGetInt64("hw.cpufrequency", 0) / 1000 / 1000);
|
||||
cpu->frequencyMax = (uint32_t) (ffSysctlGetInt64("hw.cpufrequency_max", 0) / 1000 / 1000);
|
||||
if(cpu->frequencyBase == 0)
|
||||
{
|
||||
unsigned current = 0;
|
||||
size_t size = sizeof(current);
|
||||
if (sysctl((int[]){ CTL_HW, HW_CPU_FREQ }, 2, ¤t, &size, NULL, 0) == 0)
|
||||
cpu->frequencyBase = (double) current / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyBase = (uint32_t) (current / 1000 / 1000);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -44,16 +44,13 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
ffStrbufClear(&buffer);
|
||||
char key[32];
|
||||
snprintf(key, sizeof(key), "dev.cpu.%u.freq_levels", i);
|
||||
if (ffSysctlGetString(key, &buffer) == NULL && buffer.length > 0)
|
||||
if (ffSysctlGetString(key, &buffer) == NULL)
|
||||
{
|
||||
if (buffer.length == 0) continue;
|
||||
|
||||
// MHz/Watts pairs like: 2501/32000 2187/27125 2000/24000
|
||||
uint32_t fmax = (uint32_t) strtoul(buffer.chars, NULL, 10);
|
||||
uint32_t fmin = fmax;
|
||||
uint32_t i = ffStrbufLastIndexC(&buffer, ' ');
|
||||
if (i < buffer.length)
|
||||
fmin = (uint32_t) strtoul(buffer.chars + i + 1, NULL, 10);
|
||||
if (!(cpu->frequencyMin <= fmin)) cpu->frequencyMin = fmin; // Counting for NaN
|
||||
if (!(cpu->frequencyMax >= fmax)) cpu->frequencyMax = fmax;
|
||||
if (cpu->frequencyMax < fmax) cpu->frequencyMax = fmax;
|
||||
|
||||
if (options->showPeCoreCount)
|
||||
{
|
||||
@@ -65,12 +62,11 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coreTypes[ifreq].count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
cpu->frequencyMin /= 1000;
|
||||
cpu->frequencyMax /= 1000;
|
||||
|
||||
int clockRate = ffSysctlGetInt("hw.clockrate", 0);
|
||||
cpu->frequencyBase = clockRate <= 0 ? 0.0/0.0 : clockRate / 1000.0;
|
||||
cpu->frequencyBase = (uint32_t) ffSysctlGetInt("hw.clockrate", 0);
|
||||
cpu->temperature = FF_CPU_TEMP_UNSET;
|
||||
|
||||
if (options->temp)
|
||||
|
||||
@@ -13,18 +13,62 @@
|
||||
#ifdef __ANDROID__
|
||||
#include "common/settings.h"
|
||||
|
||||
static void detectQualcomm(FFCPUResult* cpu)
|
||||
{
|
||||
if (ffStrbufEqualS(&cpu->name, "SM8635"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 8s Gen 3 [SM8635]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM8650-AC"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 8 Gen 3 for Galaxy [SM8650-AC]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM8650"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 8 Gen 3 [SM8650]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM8550-AC"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 8 Gen 2 for Galaxy [SM8550-AC]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM8550"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 8 Gen 2 [SM8550]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM8475"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 8+ Gen 1 [SM8475]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM8450"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 8 Gen 1 [SM8450]");
|
||||
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM7675"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 7+ Gen 3 [SM7675]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM7550"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 7 Gen 3 [SM7550]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM7475"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 7+ Gen 2 [SM7550]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM7435"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 7s Gen 2 [SM7435]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM7450"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 7 Gen 1 [SM7450]");
|
||||
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM6375-AC"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 6s Gen 3 [SM6375-AC]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM6450"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 6 Gen 1 [SM6450]");
|
||||
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM4450"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 4 Gen 2 [SM4450]");
|
||||
else if (ffStrbufEqualS(&cpu->name, "SM4375"))
|
||||
ffStrbufSetStatic(&cpu->name, "Qualcomm Snapdragon 4 Gen 1 [SM4375]");
|
||||
}
|
||||
|
||||
static void detectAndroid(FFCPUResult* cpu)
|
||||
{
|
||||
if (cpu->name.length == 0)
|
||||
{
|
||||
ffSettingsGetAndroidProperty("ro.soc.model", &cpu->name);
|
||||
ffStrbufClear(&cpu->vendor); // We usually detect the vendor of CPU core as ARM, but instead we want the vendor of SOC
|
||||
if (ffSettingsGetAndroidProperty("ro.soc.model", &cpu->name))
|
||||
ffStrbufClear(&cpu->vendor); // We usually detect the vendor of CPU core as ARM, but instead we want the vendor of SOC
|
||||
else if(ffSettingsGetAndroidProperty("ro.mediatek.platform", &cpu->name))
|
||||
ffStrbufSetStatic(&cpu->vendor, "MTK");
|
||||
}
|
||||
if (cpu->vendor.length == 0)
|
||||
{
|
||||
if (!ffSettingsGetAndroidProperty("ro.soc.manufacturer", &cpu->vendor))
|
||||
ffSettingsGetAndroidProperty("ro.product.product.manufacturer", &cpu->vendor);
|
||||
}
|
||||
|
||||
if (ffStrbufEqualS(&cpu->vendor, "QTI") && ffStrbufStartsWithS(&cpu->name, "SM"))
|
||||
detectQualcomm(cpu);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -94,7 +138,7 @@ static uint32_t getFrequency(FFstrbuf* basePath, const char* cpuinfoFileName, co
|
||||
bool ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return (uint32_t) ffStrbufToUInt(buffer, 0);
|
||||
return (uint32_t) (ffStrbufToUInt(buffer, 0) / 1000);
|
||||
|
||||
if (scalingFileName)
|
||||
{
|
||||
@@ -102,7 +146,7 @@ static uint32_t getFrequency(FFstrbuf* basePath, const char* cpuinfoFileName, co
|
||||
ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return (uint32_t) ffStrbufToUInt(buffer, 0);
|
||||
return (uint32_t) (ffStrbufToUInt(buffer, 0) / 1000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -143,36 +187,15 @@ static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options)
|
||||
ffStrbufAppendS(&path, entry->d_name);
|
||||
uint32_t fbase = getFrequency(&path, "/base_frequency", NULL, &buffer);
|
||||
if (fbase > 0)
|
||||
{
|
||||
if (cpu->frequencyBase == cpu->frequencyBase)
|
||||
cpu->frequencyBase = cpu->frequencyBase > fbase ? cpu->frequencyBase : fbase;
|
||||
else
|
||||
cpu->frequencyBase = fbase;
|
||||
}
|
||||
cpu->frequencyBase = cpu->frequencyBase > fbase ? cpu->frequencyBase : fbase;
|
||||
|
||||
uint32_t fbioslimit = getFrequency(&path, "/bios_limit", NULL, &buffer);
|
||||
if (fbioslimit > 0)
|
||||
{
|
||||
if (cpu->frequencyBiosLimit == cpu->frequencyBiosLimit)
|
||||
cpu->frequencyBiosLimit = cpu->frequencyBiosLimit > fbioslimit ? cpu->frequencyBiosLimit : fbioslimit;
|
||||
else
|
||||
cpu->frequencyBiosLimit = fbioslimit;
|
||||
}
|
||||
cpu->frequencyBiosLimit = cpu->frequencyBiosLimit > fbioslimit ? cpu->frequencyBiosLimit : fbioslimit;
|
||||
|
||||
uint32_t fmax = getFrequency(&path, "/cpuinfo_max_freq", "/scaling_max_freq", &buffer);
|
||||
if (fmax > 0)
|
||||
{
|
||||
if (cpu->frequencyMax == cpu->frequencyMax)
|
||||
cpu->frequencyMax = cpu->frequencyMax > fmax ? cpu->frequencyMax : fmax;
|
||||
else
|
||||
cpu->frequencyMax = fmax;
|
||||
}
|
||||
uint32_t fmin = getFrequency(&path, "/cpuinfo_min_freq", "/scaling_min_freq", &buffer);
|
||||
if (fmin > 0)
|
||||
{
|
||||
if (cpu->frequencyMin == cpu->frequencyMin)
|
||||
cpu->frequencyMin = cpu->frequencyMin < fmin ? cpu->frequencyMin : fmin;
|
||||
else
|
||||
cpu->frequencyMin = fmin;
|
||||
}
|
||||
cpu->frequencyMax = cpu->frequencyMax > fmax ? cpu->frequencyMax : fmax;
|
||||
|
||||
if (options->showPeCoreCount)
|
||||
{
|
||||
@@ -187,10 +210,6 @@ static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options)
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
}
|
||||
cpu->frequencyBase /= 1e6;
|
||||
cpu->frequencyMax /= 1e6;
|
||||
cpu->frequencyMin /= 1e6;
|
||||
cpu->frequencyBiosLimit /= 1e6;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -272,8 +291,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, cpu->coresLogical);
|
||||
|
||||
if (!detectFrequency(cpu, options) || cpu->frequencyBase != cpu->frequencyBase)
|
||||
cpu->frequencyBase = ffStrbufToDouble(&cpuMHz) / 1000;
|
||||
if (!detectFrequency(cpu, options) || cpu->frequencyBase == 0)
|
||||
cpu->frequencyBase = (uint32_t) ffStrbufToUInt(&cpuMHz, 0);
|
||||
|
||||
if(cpuUarch.length > 0)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFCPUOptions* options, FFCPURe
|
||||
}
|
||||
{
|
||||
kstat_named_t* kn = kstat_data_lookup(ks, "clock_MHz");
|
||||
cpu->frequencyBase = kn->value.ui32 / 1000.;
|
||||
cpu->frequencyBase = kn->value.ui32;
|
||||
}
|
||||
|
||||
ks = kstat_lookup(kc, "unix", -1, "system_misc");
|
||||
|
||||
@@ -65,8 +65,8 @@ inline static const char* detectSpeedByCpuid(FFCPUResult* cpu)
|
||||
return "Unsupported instruction";
|
||||
|
||||
// cpuid returns 0 MHz when hyper-v is enabled
|
||||
if (base) cpu->frequencyBase = base / 1000.0;
|
||||
if (max) cpu->frequencyMax = max / 1000.0;
|
||||
if (base) cpu->frequencyBase = base;
|
||||
if (max) cpu->frequencyMax = max;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ static const char* detectMaxSpeedBySmbios(FFCPUResult* cpu)
|
||||
return "No active CPU is found in SMBIOS data";
|
||||
}
|
||||
|
||||
double speed = data->MaxSpeed / 1000.0;
|
||||
uint32_t speed = data->MaxSpeed;
|
||||
// Sometimes SMBIOS reports invalid value. We assume that max speed is small than 2x of base
|
||||
if (speed < cpu->frequencyBase || speed > cpu->frequencyBase * 2)
|
||||
return "Possible invalid CPU max speed in SMBIOS data. See #800";
|
||||
@@ -159,7 +159,7 @@ static const char* detectByRegistry(FFCPUResult* cpu)
|
||||
|
||||
uint32_t mhz;
|
||||
if(ffRegReadUint(hKey, L"~MHz", &mhz, NULL))
|
||||
cpu->frequencyBase = mhz / 1000.0;
|
||||
cpu->frequencyBase = mhz;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -180,8 +180,8 @@ static const char* detectCoreTypes(FFCPUResult* cpu)
|
||||
++cpu->coreTypes[ifreq].count;
|
||||
}
|
||||
|
||||
if (cpu->frequencyBase != cpu->frequencyBase)
|
||||
cpu->frequencyBase = pinfo->MaxMhz / 1000.0;
|
||||
if (cpu->frequencyBase == 0)
|
||||
cpu->frequencyBase = pinfo->MaxMhz;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
detectSpeedByCpuid(cpu);
|
||||
if (options->showPeCoreCount) detectCoreTypes(cpu);
|
||||
|
||||
if (cpu->frequencyMax != cpu->frequencyMax)
|
||||
if (cpu->frequencyMax == 0)
|
||||
detectMaxSpeedBySmbios(cpu);
|
||||
|
||||
if(options->temp)
|
||||
|
||||
@@ -71,6 +71,10 @@ static bool isPhysicalDevice(const struct mntent* device)
|
||||
ffStrStartsWith(device->mnt_fsname + 5, "fd") //Ignore fd devices
|
||||
) return false;
|
||||
|
||||
// https://source.android.com/docs/core/ota/apex?hl=zh-cn
|
||||
if(ffStrStartsWith(device->mnt_dir, "/apex/"))
|
||||
return false;
|
||||
|
||||
#endif // __ANDROID__
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "displayserver.h"
|
||||
|
||||
bool ffdsAppendDisplay(
|
||||
FFDisplayResult* ffdsAppendDisplay(
|
||||
FFDisplayServerResult* result,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
@@ -11,10 +11,12 @@ bool ffdsAppendDisplay(
|
||||
FFstrbuf* name,
|
||||
FFDisplayType type,
|
||||
bool primary,
|
||||
uint64_t id)
|
||||
uint64_t id,
|
||||
uint32_t physicalWidth,
|
||||
uint32_t physicalHeight)
|
||||
{
|
||||
if(width == 0 || height == 0)
|
||||
return false;
|
||||
return NULL;
|
||||
|
||||
FFDisplayResult* display = ffListAdd(&result->displays);
|
||||
display->width = width;
|
||||
@@ -25,10 +27,16 @@ bool ffdsAppendDisplay(
|
||||
display->rotation = rotation;
|
||||
ffStrbufInitMove(&display->name, name);
|
||||
display->type = type;
|
||||
display->primary = primary;
|
||||
display->id = id;
|
||||
display->physicalWidth = physicalWidth;
|
||||
display->physicalHeight = physicalHeight;
|
||||
display->primary = primary;
|
||||
|
||||
return true;
|
||||
display->bitDepth = 0;
|
||||
display->hdrEnabled = false;
|
||||
display->wcgEnabled = false;
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds);
|
||||
|
||||
@@ -58,8 +58,13 @@ typedef struct FFDisplayResult
|
||||
FFstrbuf name;
|
||||
FFDisplayType type;
|
||||
uint32_t rotation;
|
||||
bool primary;
|
||||
uint64_t id; // platform dependent
|
||||
uint32_t physicalWidth;
|
||||
uint32_t physicalHeight;
|
||||
bool primary;
|
||||
uint8_t bitDepth;
|
||||
bool hdrEnabled;
|
||||
bool wcgEnabled;
|
||||
} FFDisplayResult;
|
||||
|
||||
typedef struct FFDisplayServerResult
|
||||
@@ -74,7 +79,7 @@ typedef struct FFDisplayServerResult
|
||||
|
||||
const FFDisplayServerResult* ffConnectDisplayServer();
|
||||
|
||||
bool ffdsAppendDisplay(
|
||||
FFDisplayResult* ffdsAppendDisplay(
|
||||
FFDisplayServerResult* result,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
@@ -85,4 +90,6 @@ bool ffdsAppendDisplay(
|
||||
FFstrbuf* name,
|
||||
FFDisplayType type,
|
||||
bool primary,
|
||||
uint64_t id);
|
||||
uint64_t id,
|
||||
uint32_t physicalWidth,
|
||||
uint32_t physicalHeight);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "displayserver.h"
|
||||
#include "common/settings.h"
|
||||
|
||||
#include "common/processing.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
static void detectWithDumpsys(FFDisplayServerResult* ds)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
||||
@@ -63,6 +64,8 @@ static void detectWithDumpsys(FFDisplayServerResult* ds)
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
@@ -79,20 +82,24 @@ static bool detectWithGetprop(FFDisplayServerResult* ds)
|
||||
if (ffSettingsGetAndroidProperty("persist.sys.miui_resolution", &buffer) &&
|
||||
ffStrbufContainC(&buffer, ','))
|
||||
{
|
||||
// 1440,3200,560 => width,height,ppi
|
||||
// 1440,3200,560 => width,height,densityDpi
|
||||
uint32_t width = (uint32_t) ffStrbufToUInt(&buffer, 0);
|
||||
ffStrbufSubstrAfterFirstC(&buffer, ',');
|
||||
uint32_t height = (uint32_t) ffStrbufToUInt(&buffer, 0);
|
||||
ffStrbufSubstrAfterFirstC(&buffer, ',');
|
||||
double scaleFactor = (double) ffStrbufToUInt(&buffer, 0) / 160.;
|
||||
return ffdsAppendDisplay(ds,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(uint32_t) (width / scaleFactor + .5),
|
||||
(uint32_t) (height / scaleFactor + .5),
|
||||
0,
|
||||
0,
|
||||
FF_DISPLAY_TYPE_BUILTIN,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "displayserver.h"
|
||||
#include "util/apple/cf_helpers.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -57,7 +58,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
if(CoreDisplay_IODisplayCreateInfoDictionary)
|
||||
{
|
||||
io_service_t servicePort = CGDisplayIOServicePort(screen);
|
||||
CFDictionaryRef FF_CFTYPE_AUTO_RELEASE displayInfo = CoreDisplay_IODisplayCreateInfoDictionary(servicePort, kIODisplayOnlyPreferredName);
|
||||
CFDictionaryRef FF_CFTYPE_AUTO_RELEASE displayInfo = CoreDisplay_IODisplayCreateInfoDictionary(servicePort, kIODisplayOnlyPreferredName);
|
||||
if(displayInfo)
|
||||
{
|
||||
CFDictionaryRef productNames;
|
||||
@@ -67,7 +68,9 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
}
|
||||
#endif
|
||||
|
||||
ffdsAppendDisplay(ds,
|
||||
CGSize size = CGDisplayScreenSize(screen);
|
||||
|
||||
FFDisplayResult* display = ffdsAppendDisplay(ds,
|
||||
(uint32_t)CGDisplayModeGetPixelWidth(mode),
|
||||
(uint32_t)CGDisplayModeGetPixelHeight(mode),
|
||||
refreshRate,
|
||||
@@ -77,8 +80,28 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
&name,
|
||||
CGDisplayIsBuiltin(screen) ? FF_DISPLAY_TYPE_BUILTIN : FF_DISPLAY_TYPE_EXTERNAL,
|
||||
CGDisplayIsMain(screen),
|
||||
(uint64_t)screen
|
||||
(uint64_t)screen,
|
||||
(uint32_t) (size.width + 0.5),
|
||||
(uint32_t) (size.height + 0.5)
|
||||
);
|
||||
if (display)
|
||||
{
|
||||
// Shitty code
|
||||
uint8_t bitDepth = 0;
|
||||
FF_CFTYPE_AUTO_RELEASE CFStringRef desc = CFCopyDescription(mode);
|
||||
CFRange start = CFStringFind(desc, CFSTR("BitsPerSample = "), 0);
|
||||
if (start.location != kCFNotFound)
|
||||
{
|
||||
for (CFIndex idx = start.location + start.length; idx < CFStringGetLength(desc); ++idx)
|
||||
{
|
||||
UniChar ch = CFStringGetCharacterAtIndex(desc, idx);
|
||||
if (!ffCharIsDigit((char) ch))
|
||||
break;
|
||||
bitDepth = (uint8_t) (bitDepth * 10 + (ch - '0'));
|
||||
}
|
||||
}
|
||||
display->bitDepth = bitDepth;
|
||||
}
|
||||
CGDisplayModeRelease(mode);
|
||||
}
|
||||
CGDisplayRelease(screen);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "displayserver.h"
|
||||
#include "detection/os/os.h"
|
||||
#include "util/windows/unicode.h"
|
||||
#include "util/windows/registry.h"
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/edidHelper.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
#include <WinUser.h>
|
||||
@@ -73,6 +76,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
if (!monitorInfo) continue;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
uint32_t physicalWidth = 0, physicalHeight = 0;
|
||||
|
||||
DISPLAYCONFIG_TARGET_DEVICE_NAME targetName = {
|
||||
.header = {
|
||||
@@ -84,13 +88,39 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
};
|
||||
if(DisplayConfigGetDeviceInfo(&targetName.header) == ERROR_SUCCESS)
|
||||
{
|
||||
if (targetName.flags.friendlyNameFromEdid)
|
||||
ffStrbufSetWS(&name, targetName.monitorFriendlyDeviceName);
|
||||
wchar_t regPath[256] = L"SYSTEM\\CurrentControlSet\\Enum";
|
||||
wchar_t* pRegPath = regPath + strlen("SYSTEM\\CurrentControlSet\\Enum");
|
||||
wchar_t* pDevPath = targetName.monitorDevicePath + strlen("\\\\?");
|
||||
while (*pDevPath && *pDevPath != L'{')
|
||||
{
|
||||
if (*pDevPath == L'#')
|
||||
*pRegPath = L'\\';
|
||||
else
|
||||
*pRegPath = *pDevPath;
|
||||
++pRegPath;
|
||||
++pDevPath;
|
||||
assert(pRegPath < regPath + sizeof(regPath) / sizeof(wchar_t) + strlen("Device Parameters"));
|
||||
}
|
||||
wcscpy(pRegPath, L"Device Parameters");
|
||||
|
||||
uint8_t edidData[1024];
|
||||
DWORD edidLength = sizeof(edidData);
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, regPath, L"EDID", RRF_RT_REG_BINARY, NULL, edidData, &edidLength) == ERROR_SUCCESS &&
|
||||
edidLength > 0 && edidLength % 128 == 0)
|
||||
{
|
||||
ffEdidGetName(edidData, &name);
|
||||
ffEdidGetPhysicalSize(edidData, &physicalWidth, &physicalHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufSetWS(&name, targetName.monitorDevicePath);
|
||||
ffStrbufSubstrAfterFirstC(&name, '#');
|
||||
ffStrbufSubstrBeforeFirstC(&name, '#');
|
||||
if (targetName.flags.friendlyNameFromEdid)
|
||||
ffStrbufSetWS(&name, targetName.monitorFriendlyDeviceName);
|
||||
else
|
||||
{
|
||||
ffStrbufSetWS(&name, targetName.monitorDevicePath);
|
||||
ffStrbufSubstrAfterFirstC(&name, '#');
|
||||
ffStrbufSubstrBeforeFirstC(&name, '#');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,26 +132,21 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
uint32_t temp = width;
|
||||
width = height;
|
||||
height = temp;
|
||||
temp = physicalWidth;
|
||||
physicalWidth = physicalHeight;
|
||||
physicalHeight = temp;
|
||||
}
|
||||
|
||||
uint32_t rotation;
|
||||
switch (path->targetInfo.rotation)
|
||||
{
|
||||
case DISPLAYCONFIG_ROTATION_ROTATE90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case DISPLAYCONFIG_ROTATION_ROTATE180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case DISPLAYCONFIG_ROTATION_ROTATE270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
case DISPLAYCONFIG_ROTATION_ROTATE90: rotation = 90; break;
|
||||
case DISPLAYCONFIG_ROTATION_ROTATE180: rotation = 180; break;
|
||||
case DISPLAYCONFIG_ROTATION_ROTATE270: rotation = 270; break;
|
||||
default: rotation = 0; break;
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(ds,
|
||||
FFDisplayResult* display = ffdsAppendDisplay(ds,
|
||||
width,
|
||||
height,
|
||||
path->targetInfo.refreshRate.Numerator / (double) path->targetInfo.refreshRate.Denominator,
|
||||
@@ -135,8 +160,28 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
path->targetInfo.outputTechnology == DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED
|
||||
? FF_DISPLAY_TYPE_BUILTIN : FF_DISPLAY_TYPE_EXTERNAL,
|
||||
!!(monitorInfo->info.dwFlags & MONITORINFOF_PRIMARY),
|
||||
(uint64_t)(uintptr_t) monitorInfo->handle
|
||||
(uint64_t)(uintptr_t) monitorInfo->handle,
|
||||
physicalWidth,
|
||||
physicalHeight
|
||||
);
|
||||
|
||||
if (display)
|
||||
{
|
||||
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = {
|
||||
.header = {
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO,
|
||||
.size = sizeof(advColorInfo),
|
||||
.adapterId = path->targetInfo.adapterId,
|
||||
.id = path->targetInfo.id,
|
||||
}
|
||||
};
|
||||
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
|
||||
{
|
||||
display->hdrEnabled = !!advColorInfo.advancedColorEnabled;
|
||||
display->wcgEnabled = !!advColorInfo.wideColorEnforced;
|
||||
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
|
||||
if (ffSettingsGetFreeBSDKenv("screen.height", &buf))
|
||||
{
|
||||
uint32_t height = (uint32_t) ffStrbufToUInt(&buf, 0);
|
||||
ffdsAppendDisplay(ds, width, height, 0, 0, 0, 0, NULL, FF_DISPLAY_TYPE_UNKNOWN, false, 0);
|
||||
ffdsAppendDisplay(ds, width, height, 0, 0, 0, 0, NULL, FF_DISPLAY_TYPE_UNKNOWN, false, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ bool ffdsMatchDrmConnector(const char* connName, FFstrbuf* edidName)
|
||||
// However I can't find a better method to get the edid data
|
||||
const char* drmDirPath = "/sys/class/drm/";
|
||||
|
||||
DIR* dirp = opendir(drmDirPath);
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(drmDirPath);
|
||||
if(dirp == NULL)
|
||||
return false;
|
||||
|
||||
@@ -90,13 +90,25 @@ bool ffdsMatchDrmConnector(const char* connName, FFstrbuf* edidName)
|
||||
{
|
||||
ffStrbufClear(edidName);
|
||||
ffEdidGetName(edidData, edidName);
|
||||
closedir(dirp);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
ffStrbufClear(edidName);
|
||||
closedir(dirp);
|
||||
return false;
|
||||
}
|
||||
|
||||
FFDisplayType ffdsGetDisplayType(const char* name)
|
||||
{
|
||||
if(ffStrStartsWith(name, "eDP-") || ffStrStartsWith(name, "LVDS-"))
|
||||
return FF_DISPLAY_TYPE_BUILTIN;
|
||||
else if(ffStrStartsWith(name, "HDMI-") ||
|
||||
ffStrStartsWith(name, "DP-") ||
|
||||
ffStrStartsWith(name, "DisplayPort-") ||
|
||||
ffStrStartsWith(name, "DVI-") ||
|
||||
ffStrStartsWith(name, "VGA-"))
|
||||
return FF_DISPLAY_TYPE_EXTERNAL;
|
||||
|
||||
return FF_DISPLAY_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,6 @@ void ffdsConnectDrm(FFDisplayServerResult* result);
|
||||
|
||||
void ffdsDetectWMDE(FFDisplayServerResult* result);
|
||||
|
||||
FFDisplayType ffdsGetDisplayType(const char* drmConnectorName);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ static const char* drmParseSysfs(FFDisplayServerResult* result)
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned width = 0, height = 0;
|
||||
unsigned width = 0, height = 0, physicalWidth = 0, physicalHeight = 0;
|
||||
double refreshRate = 0;
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
|
||||
@@ -49,6 +49,7 @@ static const char* drmParseSysfs(FFDisplayServerResult* result)
|
||||
{
|
||||
ffEdidGetName(edidData, &name);
|
||||
ffEdidGetPreferredResolutionAndRefreshRate(edidData, &width, &height, &refreshRate);
|
||||
ffEdidGetPhysicalSize(edidData, &physicalWidth, &physicalHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,7 +79,9 @@ static const char* drmParseSysfs(FFDisplayServerResult* result)
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0
|
||||
0,
|
||||
physicalWidth,
|
||||
physicalHeight
|
||||
);
|
||||
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||
@@ -217,6 +220,8 @@ static const char* drmConnectLibdrm(FFDisplayServerResult* result)
|
||||
if (nDevices < 0)
|
||||
return "drmGetDevices() failed";
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
|
||||
for (int iDev = 0; iDev < nDevices; ++iDev)
|
||||
{
|
||||
drmDevice* dev = devices[iDev];
|
||||
@@ -225,6 +230,13 @@ static const char* drmConnectLibdrm(FFDisplayServerResult* result)
|
||||
continue;
|
||||
|
||||
const char* path = dev->nodes[DRM_NODE_PRIMARY];
|
||||
|
||||
ffStrbufSetF(&name, "/sys/class/drm/%s/device/power/runtime_status", strrchr(path, '/') + 1);
|
||||
|
||||
char buffer[8] = "";
|
||||
if (ffReadFileData(name.chars, strlen("suspend"), buffer) > 0 && ffStrStartsWith(buffer, "suspend"))
|
||||
continue;
|
||||
|
||||
FF_AUTO_CLOSE_FD int fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
continue;
|
||||
@@ -289,7 +301,8 @@ static const char* drmConnectLibdrm(FFDisplayServerResult* result)
|
||||
}
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
|
||||
ffStrbufClear(&name);
|
||||
|
||||
for (int iProp = 0; iProp < conn->count_props; ++iProp)
|
||||
{
|
||||
@@ -339,12 +352,14 @@ static const char* drmConnectLibdrm(FFDisplayServerResult* result)
|
||||
0,
|
||||
0,
|
||||
&name,
|
||||
conn->connector_type == DRM_MODE_CONNECTOR_eDP
|
||||
conn->connector_type == DRM_MODE_CONNECTOR_eDP || conn->connector_type == DRM_MODE_CONNECTOR_LVDS
|
||||
? FF_DISPLAY_TYPE_BUILTIN
|
||||
: conn->connector_type == DRM_MODE_CONNECTOR_HDMIA || conn->connector_type == DRM_MODE_CONNECTOR_HDMIB
|
||||
: conn->connector_type == DRM_MODE_CONNECTOR_HDMIA || conn->connector_type == DRM_MODE_CONNECTOR_HDMIB || conn->connector_type == DRM_MODE_CONNECTOR_DisplayPort
|
||||
? FF_DISPLAY_TYPE_EXTERNAL : FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
conn->connector_id
|
||||
conn->connector_id,
|
||||
conn->mmWidth,
|
||||
conn->mmHeight
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,14 +25,16 @@ static void waylandOutputGeometryListener(void *data,
|
||||
FF_MAYBE_UNUSED struct wl_output *output,
|
||||
FF_MAYBE_UNUSED int32_t x,
|
||||
FF_MAYBE_UNUSED int32_t y,
|
||||
FF_MAYBE_UNUSED int32_t physical_width,
|
||||
FF_MAYBE_UNUSED int32_t physical_height,
|
||||
int32_t physical_width,
|
||||
int32_t physical_height,
|
||||
FF_MAYBE_UNUSED int32_t subpixel,
|
||||
FF_MAYBE_UNUSED const char *make,
|
||||
FF_MAYBE_UNUSED const char *model,
|
||||
int32_t transform)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->physicalWidth = physical_width;
|
||||
display->physicalHeight = physical_height;
|
||||
display->transform = (enum wl_output_transform) transform;
|
||||
}
|
||||
|
||||
@@ -108,38 +110,7 @@ void ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* regist
|
||||
if(display.width <= 0 || display.height <= 0)
|
||||
return;
|
||||
|
||||
uint32_t rotation;
|
||||
switch(display.transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rotation)
|
||||
{
|
||||
case 90:
|
||||
case 270: {
|
||||
int32_t temp = display.width;
|
||||
display.width = display.height;
|
||||
display.height = temp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
uint32_t rotation = ffWaylandHandleRotation(&display);
|
||||
|
||||
ffdsAppendDisplay(wldata->result,
|
||||
(uint32_t) display.width,
|
||||
@@ -156,7 +127,9 @@ void ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* regist
|
||||
: &display.name,
|
||||
display.type,
|
||||
false,
|
||||
display.id
|
||||
display.id,
|
||||
(uint32_t) display.physicalWidth,
|
||||
(uint32_t) display.physicalHeight
|
||||
);
|
||||
|
||||
ffStrbufDestroy(&display.description);
|
||||
|
||||
@@ -92,28 +92,39 @@ static void waylandKdeGeometryListener(void *data,
|
||||
FF_MAYBE_UNUSED struct kde_output_device_v2 *kde_output_device_v2,
|
||||
FF_MAYBE_UNUSED int32_t x,
|
||||
FF_MAYBE_UNUSED int32_t y,
|
||||
FF_MAYBE_UNUSED int32_t physical_width,
|
||||
FF_MAYBE_UNUSED int32_t physical_height,
|
||||
int32_t physical_width,
|
||||
int32_t physical_height,
|
||||
FF_MAYBE_UNUSED int32_t subpixel,
|
||||
FF_MAYBE_UNUSED const char *make,
|
||||
FF_MAYBE_UNUSED const char *model,
|
||||
int32_t transform)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->physicalWidth = physical_width;
|
||||
display->physicalHeight = physical_height;
|
||||
display->transform = (enum wl_output_transform) transform;
|
||||
}
|
||||
|
||||
void waylandOutputNameListener(void* data, FF_MAYBE_UNUSED struct kde_output_device_v2* output, const char *name)
|
||||
static void waylandKdeNameListener(void* data, FF_MAYBE_UNUSED struct kde_output_device_v2* kde_output_device_v2, const char *name)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
if(ffStrStartsWith(name, "eDP-"))
|
||||
display->type = FF_DISPLAY_TYPE_BUILTIN;
|
||||
else if(ffStrStartsWith(name, "HDMI-"))
|
||||
display->type = FF_DISPLAY_TYPE_EXTERNAL;
|
||||
display->type = ffdsGetDisplayType(name);
|
||||
strncpy((char*) &display->id, name, sizeof(display->id));
|
||||
ffStrbufAppendS(&display->name, name);
|
||||
}
|
||||
|
||||
static void waylandKdeHdrListener(void *data, FF_MAYBE_UNUSED struct kde_output_device_v2 *kde_output_device_v2, uint32_t hdr_enabled)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->hdrEnabled = !!hdr_enabled;
|
||||
}
|
||||
|
||||
static void waylandKdeWcgListener(void *data, FF_MAYBE_UNUSED struct kde_output_device_v2 *kde_output_device_v2, uint32_t wcg_enabled)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->wcgEnabled = !!wcg_enabled;
|
||||
}
|
||||
|
||||
static struct kde_output_device_v2_listener outputListener = {
|
||||
.geometry = waylandKdeGeometryListener,
|
||||
.current_mode = waylandKdeCurrentModeListener,
|
||||
@@ -129,10 +140,10 @@ static struct kde_output_device_v2_listener outputListener = {
|
||||
.overscan = (void*) stubListener,
|
||||
.vrr_policy = (void*) stubListener,
|
||||
.rgb_range = (void*) stubListener,
|
||||
.name = waylandOutputNameListener,
|
||||
.high_dynamic_range = (void*) stubListener,
|
||||
.name = waylandKdeNameListener,
|
||||
.high_dynamic_range = waylandKdeHdrListener,
|
||||
.sdr_brightness = (void*) stubListener,
|
||||
.wide_color_gamut = (void*) stubListener,
|
||||
.wide_color_gamut = waylandKdeWcgListener,
|
||||
.auto_rotate_policy = (void*) stubListener,
|
||||
.icc_profile_path = (void*) stubListener,
|
||||
.brightness_metadata = (void*) stubListener,
|
||||
@@ -170,40 +181,9 @@ void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry,
|
||||
if(display.width <= 0 || display.height <= 0 || !display.internal)
|
||||
return;
|
||||
|
||||
uint32_t rotation;
|
||||
switch(display.transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
uint32_t rotation = ffWaylandHandleRotation(&display);
|
||||
|
||||
switch(rotation)
|
||||
{
|
||||
case 90:
|
||||
case 270: {
|
||||
int32_t temp = display.width;
|
||||
display.width = display.height;
|
||||
display.height = temp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(wldata->result,
|
||||
FFDisplayResult* item = ffdsAppendDisplay(wldata->result,
|
||||
(uint32_t) display.width,
|
||||
(uint32_t) display.height,
|
||||
display.refreshRate / 1000.0,
|
||||
@@ -215,8 +195,15 @@ void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry,
|
||||
: &display.name,
|
||||
display.type,
|
||||
false,
|
||||
display.id
|
||||
display.id,
|
||||
(uint32_t) display.physicalWidth,
|
||||
(uint32_t) display.physicalHeight
|
||||
);
|
||||
if (item)
|
||||
{
|
||||
item->hdrEnabled = display.hdrEnabled;
|
||||
item->wcgEnabled = display.wcgEnabled;
|
||||
}
|
||||
|
||||
ffStrbufDestroy(&display.description);
|
||||
ffStrbufDestroy(&display.name);
|
||||
|
||||
@@ -201,10 +201,7 @@ void ffWaylandOutputNameListener(void* data, FF_MAYBE_UNUSED void* output, const
|
||||
WaylandDisplay* display = data;
|
||||
if (display->id) return;
|
||||
|
||||
if(ffStrStartsWith(name, "eDP-"))
|
||||
display->type = FF_DISPLAY_TYPE_BUILTIN;
|
||||
else if(ffStrStartsWith(name, "HDMI-"))
|
||||
display->type = FF_DISPLAY_TYPE_EXTERNAL;
|
||||
display->type = ffdsGetDisplayType(name);
|
||||
if (!display->edidName.length)
|
||||
ffdsMatchDrmConnector(name, &display->edidName);
|
||||
display->id = ffWaylandGenerateIdFromName(name);
|
||||
@@ -220,6 +217,47 @@ void ffWaylandOutputDescriptionListener(void* data, FF_MAYBE_UNUSED void* output
|
||||
if (!ffStrEquals(description, "Unknown Display") && !ffStrContains(description, "(null)"))
|
||||
ffStrbufAppendS(&display->description, description);
|
||||
}
|
||||
|
||||
uint32_t ffWaylandHandleRotation(WaylandDisplay* display)
|
||||
{
|
||||
uint32_t rotation;
|
||||
switch(display->transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rotation)
|
||||
{
|
||||
case 90:
|
||||
case 270: {
|
||||
int32_t temp = display->width;
|
||||
display->width = display->height;
|
||||
display->height = temp;
|
||||
|
||||
temp = display->physicalWidth;
|
||||
display->physicalWidth = display->physicalHeight;
|
||||
display->physicalHeight = temp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return rotation;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ffdsConnectWayland(FFDisplayServerResult* result)
|
||||
|
||||
@@ -36,6 +36,8 @@ typedef struct WaylandDisplay
|
||||
WaylandData* parent;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t physicalWidth;
|
||||
int32_t physicalHeight;
|
||||
int32_t refreshRate;
|
||||
double scale;
|
||||
enum wl_output_transform transform;
|
||||
@@ -44,6 +46,8 @@ typedef struct WaylandDisplay
|
||||
FFstrbuf description;
|
||||
FFstrbuf edidName;
|
||||
uint64_t id;
|
||||
bool hdrEnabled;
|
||||
bool wcgEnabled;
|
||||
void* internal;
|
||||
} WaylandDisplay;
|
||||
|
||||
@@ -65,6 +69,8 @@ inline static uint64_t ffWaylandGenerateIdFromName(const char* name)
|
||||
|
||||
void ffWaylandOutputNameListener(void* data, FF_MAYBE_UNUSED void* output, const char *name);
|
||||
void ffWaylandOutputDescriptionListener(void* data, FF_MAYBE_UNUSED void* output, const char* description);
|
||||
// Modifies content of display. Don't call this function when calling ffdsAppendDisplay
|
||||
uint32_t ffWaylandHandleRotation(WaylandDisplay* display);
|
||||
|
||||
void ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
|
||||
void ffWaylandHandleZwlrOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
|
||||
|
||||
@@ -71,10 +71,17 @@ static void waylandZwlrCurrentModeListener(void* data, FF_MAYBE_UNUSED struct zw
|
||||
wldata->refreshRate = current->refreshRate;
|
||||
}
|
||||
|
||||
static void waylandZwlrPhysicalSizeListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_head_v1 *zwlr_output_head_v1, int32_t width, int32_t height)
|
||||
{
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
wldata->physicalWidth = width;
|
||||
wldata->physicalHeight = height;
|
||||
}
|
||||
|
||||
static const struct zwlr_output_head_v1_listener headListener = {
|
||||
.name = (void*) ffWaylandOutputNameListener,
|
||||
.description = (void*) ffWaylandOutputDescriptionListener,
|
||||
.physical_size = (void*) stubListener,
|
||||
.physical_size = waylandZwlrPhysicalSizeListener,
|
||||
.mode = waylandZwlrModeListener,
|
||||
.enabled = (void*) stubListener,
|
||||
.current_mode = waylandZwlrCurrentModeListener,
|
||||
@@ -113,38 +120,7 @@ static void waylandHandleZwlrHead(void *data, FF_MAYBE_UNUSED struct zwlr_output
|
||||
if(display.width <= 0 || display.height <= 0)
|
||||
return;
|
||||
|
||||
uint32_t rotation;
|
||||
switch(display.transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rotation)
|
||||
{
|
||||
case 90:
|
||||
case 270: {
|
||||
int32_t temp = display.width;
|
||||
display.width = display.height;
|
||||
display.height = temp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
uint32_t rotation = ffWaylandHandleRotation(&display);
|
||||
|
||||
ffdsAppendDisplay(wldata->result,
|
||||
(uint32_t) display.width,
|
||||
@@ -160,7 +136,9 @@ static void waylandHandleZwlrHead(void *data, FF_MAYBE_UNUSED struct zwlr_output
|
||||
: &display.name,
|
||||
display.type,
|
||||
false,
|
||||
display.id
|
||||
display.id,
|
||||
(uint32_t) display.physicalWidth,
|
||||
(uint32_t) display.physicalHeight
|
||||
);
|
||||
|
||||
ffStrbufDestroy(&display.description);
|
||||
|
||||
@@ -41,32 +41,25 @@ static bool xcbInitPropertyData(void* libraryHandle, XcbPropertyData* propertyDa
|
||||
static void* xcbGetProperty(XcbPropertyData* data, xcb_connection_t* connection, xcb_window_t window, const char* request)
|
||||
{
|
||||
xcb_intern_atom_cookie_t requestAtomCookie = data->ffxcb_intern_atom(connection, true, (uint16_t) strlen(request), request);
|
||||
xcb_intern_atom_reply_t* requestAtomReply = data->ffxcb_intern_atom_reply(connection, requestAtomCookie, NULL);
|
||||
FF_AUTO_FREE xcb_intern_atom_reply_t* requestAtomReply = data->ffxcb_intern_atom_reply(connection, requestAtomCookie, NULL);
|
||||
if(requestAtomReply == NULL)
|
||||
return NULL;
|
||||
|
||||
xcb_get_property_cookie_t propertyCookie = data->ffxcb_get_property(connection, false, window, requestAtomReply->atom, XCB_ATOM_ANY, 0, 64);
|
||||
|
||||
free(requestAtomReply);
|
||||
|
||||
xcb_get_property_reply_t* propertyReply = data->ffxcb_get_property_reply(connection, propertyCookie, NULL);
|
||||
FF_AUTO_FREE xcb_get_property_reply_t* propertyReply = data->ffxcb_get_property_reply(connection, propertyCookie, NULL);
|
||||
if(propertyReply == NULL)
|
||||
return NULL;
|
||||
|
||||
int length = data->ffxcb_get_property_value_length(propertyReply);
|
||||
if(length <= 0)
|
||||
{
|
||||
free(propertyReply);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Why are xcb property strings not null terminated???
|
||||
void* replyValue = malloc((size_t)length + 1);
|
||||
memcpy(replyValue, data->ffxcb_get_property_value(propertyReply), (size_t) length);
|
||||
((char*) replyValue)[length] = '\0';
|
||||
|
||||
free(propertyReply);
|
||||
|
||||
return replyValue;
|
||||
}
|
||||
|
||||
@@ -75,28 +68,18 @@ static void xcbDetectWMfromEWMH(XcbPropertyData* data, xcb_connection_t* connect
|
||||
if(result->wmProcessName.length > 0 || ffStrbufCompS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND) == 0)
|
||||
return;
|
||||
|
||||
xcb_window_t* wmWindow = (xcb_window_t*) xcbGetProperty(data, connection, rootWindow, "_NET_SUPPORTING_WM_CHECK");
|
||||
FF_AUTO_FREE xcb_window_t* wmWindow = (xcb_window_t*) xcbGetProperty(data, connection, rootWindow, "_NET_SUPPORTING_WM_CHECK");
|
||||
if(wmWindow == NULL)
|
||||
return;
|
||||
|
||||
char* wmName = (char*) xcbGetProperty(data, connection, *wmWindow, "_NET_WM_NAME");
|
||||
FF_AUTO_FREE char* wmName = (char*) xcbGetProperty(data, connection, *wmWindow, "_NET_WM_NAME");
|
||||
if(wmName == NULL)
|
||||
wmName = (char*) xcbGetProperty(data, connection, *wmWindow, "WM_NAME");
|
||||
|
||||
free(wmWindow);
|
||||
|
||||
if(wmName == NULL)
|
||||
if(wmName == NULL || *wmName == '\0')
|
||||
return;
|
||||
|
||||
if(*wmName == '\0')
|
||||
{
|
||||
free(wmName);
|
||||
return;
|
||||
}
|
||||
|
||||
ffStrbufSetS(&result->wmProcessName, wmName);
|
||||
|
||||
free(wmName);
|
||||
}
|
||||
|
||||
void ffdsConnectXcb(FFDisplayServerResult* result)
|
||||
@@ -122,17 +105,20 @@ void ffdsConnectXcb(FFDisplayServerResult* result)
|
||||
|
||||
while(iterator.rem > 0)
|
||||
{
|
||||
xcb_screen_t* screen = iterator.data;
|
||||
ffdsAppendDisplay(result,
|
||||
(uint32_t) iterator.data->width_in_pixels,
|
||||
(uint32_t) iterator.data->height_in_pixels,
|
||||
(uint32_t) screen->width_in_pixels,
|
||||
(uint32_t) screen->height_in_pixels,
|
||||
0,
|
||||
(uint32_t) iterator.data->width_in_pixels,
|
||||
(uint32_t) iterator.data->height_in_pixels,
|
||||
(uint32_t) screen->width_in_pixels,
|
||||
(uint32_t) screen->height_in_pixels,
|
||||
0,
|
||||
NULL,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0
|
||||
0,
|
||||
(uint32_t) screen->width_in_millimeters,
|
||||
(uint32_t) screen->height_in_millimeters
|
||||
);
|
||||
ffxcb_screen_next(&iterator);
|
||||
}
|
||||
@@ -191,7 +177,7 @@ typedef struct XcbRandrData
|
||||
xcb_randr_get_screen_resources_current_reply_t* screenResources;
|
||||
} XcbRandrData;
|
||||
|
||||
static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* modeInfo, FFstrbuf* name, uint32_t rotation, bool primary)
|
||||
static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* modeInfo, FFstrbuf* name, uint32_t rotation, bool primary, xcb_randr_get_output_info_reply_t* output, FFDisplayType displayType)
|
||||
{
|
||||
double refreshRate = (double) modeInfo->dot_clock / (double) (modeInfo->htotal * modeInfo->vtotal);
|
||||
|
||||
@@ -204,13 +190,15 @@ static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* mo
|
||||
(uint32_t) modeInfo->height,
|
||||
rotation,
|
||||
name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
displayType,
|
||||
primary,
|
||||
0
|
||||
0,
|
||||
(uint32_t) output->mm_width,
|
||||
(uint32_t) output->mm_height
|
||||
);
|
||||
}
|
||||
|
||||
static bool xcbRandrHandleMode(XcbRandrData* data, xcb_randr_mode_t mode, FFstrbuf* name, uint32_t rotation, bool primary)
|
||||
static bool xcbRandrHandleMode(XcbRandrData* data, xcb_randr_mode_t mode, FFstrbuf* name, uint32_t rotation, bool primary, xcb_randr_get_output_info_reply_t* output, FFDisplayType displayType)
|
||||
{
|
||||
//We do the check here, because we want the best fallback display if this call failed
|
||||
if(data->screenResources == NULL)
|
||||
@@ -221,7 +209,7 @@ static bool xcbRandrHandleMode(XcbRandrData* data, xcb_randr_mode_t mode, FFstrb
|
||||
while(modesIterator.rem > 0)
|
||||
{
|
||||
if(modesIterator.data->id == mode)
|
||||
return xcbRandrHandleModeInfo(data, modesIterator.data, name, rotation, primary);
|
||||
return xcbRandrHandleModeInfo(data, modesIterator.data, name, rotation, primary, output, displayType);
|
||||
|
||||
data->ffxcb_randr_mode_info_next(&modesIterator);
|
||||
}
|
||||
@@ -229,10 +217,10 @@ static bool xcbRandrHandleMode(XcbRandrData* data, xcb_randr_mode_t mode, FFstrb
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc, FFstrbuf* name, bool primary)
|
||||
static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc, FFstrbuf* name, bool primary, xcb_randr_get_output_info_reply_t* output, FFDisplayType displayType)
|
||||
{
|
||||
xcb_randr_get_crtc_info_cookie_t crtcInfoCookie = data->ffxcb_randr_get_crtc_info(data->connection, crtc, XCB_CURRENT_TIME);
|
||||
xcb_randr_get_crtc_info_reply_t* crtcInfoReply = data->ffxcb_randr_get_crtc_info_reply(data->connection, crtcInfoCookie, NULL);
|
||||
FF_AUTO_FREE xcb_randr_get_crtc_info_reply_t* crtcInfoReply = data->ffxcb_randr_get_crtc_info_reply(data->connection, crtcInfoCookie, NULL);
|
||||
if(crtcInfoReply == NULL)
|
||||
return false;
|
||||
|
||||
@@ -252,8 +240,8 @@ static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc, FFstrb
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
bool res = xcbRandrHandleMode(data, crtcInfoReply->mode, name, rotation, primary);
|
||||
res = res ? true : ffdsAppendDisplay(
|
||||
bool res = xcbRandrHandleMode(data, crtcInfoReply->mode, name, rotation, primary, output, displayType);
|
||||
res = res ? true : !!ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) crtcInfoReply->width,
|
||||
(uint32_t) crtcInfoReply->height,
|
||||
@@ -262,16 +250,17 @@ static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc, FFstrb
|
||||
(uint32_t) crtcInfoReply->height,
|
||||
rotation,
|
||||
name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
displayType,
|
||||
primary,
|
||||
0
|
||||
0,
|
||||
(uint32_t) output->mm_width,
|
||||
(uint32_t) output->mm_height
|
||||
);
|
||||
|
||||
free(crtcInfoReply);
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool xcbRandrHandleOutput(XcbRandrData* data, xcb_randr_output_t output, FFstrbuf* name, bool primary)
|
||||
static bool xcbRandrHandleOutput(XcbRandrData* data, xcb_randr_output_t output, FFstrbuf* name, bool primary, FFDisplayType displayType)
|
||||
{
|
||||
xcb_randr_get_output_info_cookie_t outputInfoCookie = data->ffxcb_randr_get_output_info(data->connection, output, XCB_CURRENT_TIME);
|
||||
FF_AUTO_FREE xcb_randr_get_output_info_reply_t* outputInfoReply = data->ffxcb_randr_get_output_info_reply(data->connection, outputInfoCookie, NULL);
|
||||
@@ -294,7 +283,7 @@ static bool xcbRandrHandleOutput(XcbRandrData* data, xcb_randr_output_t output,
|
||||
}
|
||||
}
|
||||
|
||||
bool res = xcbRandrHandleCrtc(data, outputInfoReply->crtc, name, primary);
|
||||
bool res = xcbRandrHandleCrtc(data, outputInfoReply->crtc, name, primary, outputInfoReply, displayType);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -317,17 +306,18 @@ static bool xcbRandrHandleMonitor(XcbRandrData* data, xcb_randr_monitor_info_t*
|
||||
(uint32_t) data->propData.ffxcb_get_atom_name_name_length(nameReply),
|
||||
data->propData.ffxcb_get_atom_name_name(nameReply)
|
||||
);
|
||||
const FFDisplayType displayType = ffdsGetDisplayType(name.chars);
|
||||
|
||||
bool foundOutput = false;
|
||||
|
||||
while(outputIterator.rem > 0)
|
||||
{
|
||||
if(xcbRandrHandleOutput(data, *outputIterator.data, &name, monitor->primary))
|
||||
if(xcbRandrHandleOutput(data, *outputIterator.data, &name, monitor->primary, displayType))
|
||||
foundOutput = true;
|
||||
data->ffxcb_randr_output_next(&outputIterator);
|
||||
};
|
||||
|
||||
return foundOutput ? true : ffdsAppendDisplay(
|
||||
return foundOutput ? true : !!ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) monitor->width,
|
||||
(uint32_t) monitor->height,
|
||||
@@ -336,16 +326,18 @@ static bool xcbRandrHandleMonitor(XcbRandrData* data, xcb_randr_monitor_info_t*
|
||||
(uint32_t) monitor->height,
|
||||
0,
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
displayType,
|
||||
!!monitor->primary,
|
||||
0
|
||||
0,
|
||||
(uint32_t) monitor->width_in_millimeters,
|
||||
(uint32_t) monitor->height_in_millimeters
|
||||
);
|
||||
}
|
||||
|
||||
static bool xcbRandrHandleMonitors(XcbRandrData* data, xcb_screen_t* screen)
|
||||
{
|
||||
xcb_randr_get_monitors_cookie_t monitorsCookie = data->ffxcb_randr_get_monitors(data->connection, screen->root, true);
|
||||
xcb_randr_get_monitors_reply_t* monitorsReply = data->ffxcb_randr_get_monitors_reply(data->connection, monitorsCookie, NULL);
|
||||
FF_AUTO_FREE xcb_randr_get_monitors_reply_t* monitorsReply = data->ffxcb_randr_get_monitors_reply(data->connection, monitorsCookie, NULL);
|
||||
if(monitorsReply == NULL)
|
||||
return false;
|
||||
|
||||
@@ -360,8 +352,6 @@ static bool xcbRandrHandleMonitors(XcbRandrData* data, xcb_screen_t* screen)
|
||||
data->ffxcb_randr_monitor_info_next(&monitorInfoIterator);
|
||||
}
|
||||
|
||||
free(monitorsReply);
|
||||
|
||||
return foundMonitor;
|
||||
}
|
||||
|
||||
@@ -392,7 +382,9 @@ static void xcbRandrHandleScreen(XcbRandrData* data, xcb_screen_t* screen)
|
||||
NULL,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0
|
||||
0,
|
||||
(uint32_t) screen->width_in_millimeters,
|
||||
(uint32_t) screen->height_in_millimeters
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,9 @@ void ffdsConnectXlib(FFDisplayServerResult* result)
|
||||
NULL,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0
|
||||
0,
|
||||
(uint32_t) WidthMMOfScreen(screen),
|
||||
(uint32_t) HeightMMOfScreen(screen)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,7 +119,6 @@ typedef struct XrandrData
|
||||
FF_LIBRARY_SYMBOL(XInternAtom)
|
||||
FF_LIBRARY_SYMBOL(XGetAtomName);
|
||||
FF_LIBRARY_SYMBOL(XFree);
|
||||
FF_LIBRARY_SYMBOL(XRRConfigCurrentRate)
|
||||
FF_LIBRARY_SYMBOL(XRRGetMonitors)
|
||||
FF_LIBRARY_SYMBOL(XRRGetScreenResourcesCurrent)
|
||||
FF_LIBRARY_SYMBOL(XRRGetOutputInfo)
|
||||
@@ -149,7 +150,7 @@ static double xrandrHandleMode(XrandrData* data, RRMode mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc, FFstrbuf* name, bool primary)
|
||||
static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc, FFstrbuf* name, bool primary, XRROutputInfo* output, FFDisplayType displayType)
|
||||
{
|
||||
//We do the check here, because we want the best fallback display if this call failed
|
||||
if(data->screenResources == NULL)
|
||||
@@ -185,16 +186,18 @@ static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc, FFstrbuf* name, bool
|
||||
(uint32_t) crtcInfo->height,
|
||||
rotation,
|
||||
name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
displayType,
|
||||
primary,
|
||||
0
|
||||
0,
|
||||
(uint32_t) output->mm_width,
|
||||
(uint32_t) output->mm_height
|
||||
);
|
||||
|
||||
data->ffXRRFreeCrtcInfo(crtcInfo);
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool xrandrHandleOutput(XrandrData* data, RROutput output, FFstrbuf* name, bool primary)
|
||||
static bool xrandrHandleOutput(XrandrData* data, RROutput output, FFstrbuf* name, bool primary, FFDisplayType displayType)
|
||||
{
|
||||
XRROutputInfo* outputInfo = data->ffXRRGetOutputInfo(data->display, data->screenResources, output);
|
||||
if(outputInfo == NULL)
|
||||
@@ -218,7 +221,7 @@ static bool xrandrHandleOutput(XrandrData* data, RROutput output, FFstrbuf* name
|
||||
if (edidData)
|
||||
data->ffXFree(edidData);
|
||||
}
|
||||
bool res = xrandrHandleCrtc(data, outputInfo->crtc, name, primary);
|
||||
bool res = xrandrHandleCrtc(data, outputInfo->crtc, name, primary, outputInfo, displayType);
|
||||
|
||||
data->ffXRRFreeOutputInfo(outputInfo);
|
||||
|
||||
@@ -231,13 +234,14 @@ static bool xrandrHandleMonitor(XrandrData* data, XRRMonitorInfo* monitorInfo)
|
||||
char* xname = data->ffXGetAtomName(data->display, monitorInfo->name);
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateS(xname);
|
||||
data->ffXFree(xname);
|
||||
FFDisplayType displayType = ffdsGetDisplayType(name.chars);
|
||||
for(int i = 0; i < monitorInfo->noutput; i++)
|
||||
{
|
||||
if(xrandrHandleOutput(data, monitorInfo->outputs[i], &name, monitorInfo->primary))
|
||||
if(xrandrHandleOutput(data, monitorInfo->outputs[i], &name, monitorInfo->primary, displayType))
|
||||
foundOutput = true;
|
||||
}
|
||||
|
||||
return foundOutput ? true : ffdsAppendDisplay(
|
||||
return foundOutput ? true : !!ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) monitorInfo->width,
|
||||
(uint32_t) monitorInfo->height,
|
||||
@@ -246,9 +250,11 @@ static bool xrandrHandleMonitor(XrandrData* data, XRRMonitorInfo* monitorInfo)
|
||||
(uint32_t) monitorInfo->height,
|
||||
0,
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
displayType,
|
||||
!!monitorInfo->primary,
|
||||
0
|
||||
0,
|
||||
(uint32_t) monitorInfo->mwidth,
|
||||
(uint32_t) monitorInfo->mheight
|
||||
);
|
||||
}
|
||||
|
||||
@@ -296,7 +302,9 @@ static void xrandrHandleScreen(XrandrData* data, Screen* screen)
|
||||
NULL,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0
|
||||
0,
|
||||
(uint32_t) WidthMMOfScreen(screen),
|
||||
(uint32_t) HeightMMOfScreen(screen)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -312,7 +320,6 @@ void ffdsConnectXrandr(FFDisplayServerResult* result)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XInternAtom,);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XGetAtomName,);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XFree,);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRConfigCurrentRate,);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetMonitors,);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetScreenResourcesCurrent,);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(xrandr, data, XRRGetOutputInfo,);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#define FF_GPU_TEMP_UNSET (0/0.0)
|
||||
#define FF_GPU_CORE_COUNT_UNSET -1
|
||||
#define FF_GPU_VMEM_SIZE_UNSET ((uint64_t)-1)
|
||||
#define FF_GPU_FREQUENCY_UNSET (0/0.0)
|
||||
#define FF_GPU_FREQUENCY_UNSET 0
|
||||
|
||||
extern const char* FF_GPU_VENDOR_NAME_APPLE;
|
||||
extern const char* FF_GPU_VENDOR_NAME_AMD;
|
||||
@@ -32,7 +32,7 @@ typedef struct FFGPUResult
|
||||
FFstrbuf platformApi;
|
||||
double temperature;
|
||||
int32_t coreCount;
|
||||
double frequency; // Maximum time clock frequency in GHz
|
||||
uint32_t frequency; // Maximum time clock frequency in MHz
|
||||
FFGPUMemory dedicated;
|
||||
FFGPUMemory shared;
|
||||
uint64_t deviceId; // Used internally, may be uninitialized
|
||||
|
||||
@@ -60,7 +60,7 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
|
||||
}
|
||||
|
||||
if (result.frequency)
|
||||
*result.frequency = device->coreClock / 1000.; // Maximum frequency
|
||||
*result.frequency = (uint32_t) device->coreClock; // Maximum frequency
|
||||
|
||||
if (result.type)
|
||||
*result.type = device->isAPU ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
|
||||
|
||||
@@ -36,6 +36,43 @@ static double detectGpuTemp(const FFstrbuf* gpuName)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __aarch64__
|
||||
#include "util/apple/cf_helpers.h"
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
|
||||
static const char* detectFrequency(FFGPUResult* gpu)
|
||||
{
|
||||
// https://github.com/giampaolo/psutil/pull/2222/files
|
||||
|
||||
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t entryDevice = IOServiceGetMatchingService(MACH_PORT_NULL, IOServiceNameMatching("pmgr"));
|
||||
if (!entryDevice)
|
||||
return "IOServiceGetMatchingServices() failed";
|
||||
|
||||
if (!IOObjectConformsTo(entryDevice, "AppleARMIODevice"))
|
||||
return "\"pmgr\" should conform to \"AppleARMIODevice\"";
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFDataRef freqProperty = (CFDataRef) IORegistryEntryCreateCFProperty(entryDevice, CFSTR("voltage-states9-sram"), kCFAllocatorDefault, kNilOptions);
|
||||
if (!freqProperty || CFGetTypeID(freqProperty) != CFDataGetTypeID())
|
||||
return "\"voltage-states9-sram\" in \"pmgr\" is not found";
|
||||
|
||||
// voltage-states5-sram stores supported <frequency / voltage> pairs of gpu from the lowest to the highest
|
||||
CFIndex propLength = CFDataGetLength(freqProperty);
|
||||
if (propLength == 0 || propLength % (CFIndex) sizeof(uint32_t) * 2 != 0)
|
||||
return "Invalid \"voltage-states9-sram\" length";
|
||||
|
||||
uint32_t* pStart = (uint32_t*) CFDataGetBytePtr(freqProperty);
|
||||
uint32_t pMax = *pStart;
|
||||
for (CFIndex i = 2; i < propLength / (CFIndex) sizeof(uint32_t) && pStart[i] > 0; i += 2 /* skip voltage */)
|
||||
pMax = pMax > pStart[i] ? pMax : pStart[i];
|
||||
|
||||
if (pMax > 0)
|
||||
gpu->frequency = pMax / 1000 / 1000;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
FF_IOOBJECT_AUTO_RELEASE io_iterator_t iterator = IO_OBJECT_NULL;
|
||||
@@ -94,6 +131,11 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
gpu->type = FF_GPU_TYPE_INTEGRATED;
|
||||
else if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA || vendorStr == FF_GPU_VENDOR_NAME_AMD)
|
||||
gpu->type = FF_GPU_TYPE_DISCRETE;
|
||||
|
||||
#ifdef __aarch64__
|
||||
if (vendorStr == FF_GPU_VENDOR_NAME_APPLE)
|
||||
detectFrequency(gpu);
|
||||
#endif
|
||||
}
|
||||
|
||||
gpu->temperature = options->temp ? detectGpuTemp(&gpu->name) : FF_GPU_TEMP_UNSET;
|
||||
|
||||
@@ -41,7 +41,7 @@ typedef struct FFGpuDriverResult
|
||||
FFGPUMemory* memory;
|
||||
uint32_t* coreCount;
|
||||
FFGPUType* type;
|
||||
double* frequency;
|
||||
uint32_t* frequency;
|
||||
} FFGpuDriverResult;
|
||||
|
||||
const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResult result, const char* soName);
|
||||
|
||||
@@ -191,7 +191,7 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe
|
||||
maxValue = props.max;
|
||||
}
|
||||
}
|
||||
*result.frequency = maxValue / 1000;
|
||||
*result.frequency = (uint32_t) (maxValue + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,19 +133,26 @@ static void pciDetectIntelSpecific(FFGPUResult* gpu, FFstrbuf* pciDir, FFstrbuf*
|
||||
ffStrbufSubstrAfter(&gpu->name, (uint32_t) strlen("Intel "));
|
||||
gpu->type = ffStrbufStartsWithIgnCaseS(&gpu->name, "Arc ") ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
|
||||
|
||||
ffStrbufAppendS(pciDir, "/drm/");
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDir->chars);
|
||||
if (!dirp) return;
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dirp)) != NULL)
|
||||
if (ffStrbufEqualS(&gpu->driver, "xe"))
|
||||
{
|
||||
if (ffStrStartsWith(entry->d_name, "card")) break;
|
||||
ffStrbufAppendS(pciDir, "/tile0/gt0/freq0/max_freq");
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufAppendS(pciDir, "/drm/");
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDir->chars);
|
||||
if (!dirp) return;
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dirp)) != NULL)
|
||||
{
|
||||
if (ffStrStartsWith(entry->d_name, "card")) break;
|
||||
}
|
||||
if (!entry) return;
|
||||
ffStrbufAppendS(pciDir, entry->d_name);
|
||||
ffStrbufAppendS(pciDir, "/gt_max_freq_mhz");
|
||||
}
|
||||
if (!entry) return;
|
||||
ffStrbufAppendS(pciDir, entry->d_name);
|
||||
ffStrbufAppendS(pciDir, "/gt_max_freq_mhz");
|
||||
if (ffReadFileBuffer(pciDir->chars, buffer))
|
||||
gpu->frequency = ffStrbufToDouble(buffer) / 1000.0;
|
||||
gpu->frequency = (uint32_t) ffStrbufToUInt(buffer, 0);
|
||||
}
|
||||
|
||||
static bool loadPciIds(FFstrbuf* pciids)
|
||||
@@ -339,7 +346,7 @@ FF_MAYBE_UNUSED static const char* detectAsahi(FFlist* gpus, FFstrbuf* buffer, F
|
||||
}) >= 0)
|
||||
{
|
||||
gpu->coreCount = (int) paramsGlobal.num_cores_total_active;
|
||||
gpu->frequency = paramsGlobal.max_frequency_khz / 1e6;
|
||||
gpu->frequency = paramsGlobal.max_frequency_khz / 1000;
|
||||
gpu->deviceId = paramsGlobal.chip_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,11 +122,7 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
|
||||
nvmlData.ffnvmlDeviceGetNumGpuCores(device, result.coreCount);
|
||||
|
||||
if (result.frequency)
|
||||
{
|
||||
uint32_t clockMHz;
|
||||
if (nvmlData.ffnvmlDeviceGetMaxClockInfo(device, NVML_CLOCK_GRAPHICS, &clockMHz) == NVML_SUCCESS)
|
||||
*result.frequency = clockMHz / 1000.;
|
||||
}
|
||||
nvmlData.ffnvmlDeviceGetMaxClockInfo(device, NVML_CLOCK_GRAPHICS, result.frequency);
|
||||
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ static const char* getProductNameWithHwModel(const FFstrbuf* hwModel)
|
||||
if(ffStrEquals(version, "18,1") ||
|
||||
ffStrEquals(version, "18,2")) return "MacBook Pro (16-inch, 2021)";
|
||||
if(ffStrEquals(version, "17,1")) return "MacBook Pro (13-inch, M1, 2020)";
|
||||
if(ffStrEquals(version, "16,4")) return "MacBook Pro (16-inch, 2019)";
|
||||
if(ffStrEquals(version, "16,3")) return "MacBook Pro (13-inch, 2020, Two Thunderbolt 3 ports)";
|
||||
if(ffStrEquals(version, "16,2")) return "MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)";
|
||||
if(ffStrEquals(version, "16,1")) return "MacBook Pro (16-inch, 2019)";
|
||||
if(ffStrEquals(version, "16,4") ||
|
||||
ffStrEquals(version, "16,1")) return "MacBook Pro (16-inch, 2019)";
|
||||
if(ffStrEquals(version, "15,4")) return "MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports)";
|
||||
if(ffStrEquals(version, "15,3")) return "MacBook Pro (15-inch, 2019)";
|
||||
if(ffStrEquals(version, "15,2")) return "MacBook Pro (13-inch, 2018/2019, Four Thunderbolt 3 ports)";
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
#include "initsystem.h"
|
||||
#include "common/processing.h"
|
||||
#include <unistd.h>
|
||||
|
||||
const char* ffDetectInitSystem(FFInitSystemResult* result)
|
||||
{
|
||||
const char* error = ffProcessGetBasicInfoLinux((int) result->pid, &result->name, NULL, NULL);
|
||||
if (error) return error;
|
||||
if (error)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
if (access("/system/bin/init", F_OK) == 0)
|
||||
{
|
||||
ffStrbufSetStatic(&result->exe, "/system/bin/init");
|
||||
ffStrbufSetStatic(&result->name, "init");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
const char* _;
|
||||
// In linux /proc/1/exe is not readable
|
||||
|
||||
@@ -35,13 +35,12 @@ static const char* getSshdVersion(FFstrbuf* version)
|
||||
{
|
||||
const char* error = ffProcessAppendStdErr(version, (char* const[]) {
|
||||
"sshd",
|
||||
"-qv",
|
||||
"-V",
|
||||
NULL
|
||||
});
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
// unknown option -- v
|
||||
// OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023...
|
||||
ffStrbufSubstrBeforeFirstC(version, ',');
|
||||
ffStrbufSubstrAfterFirstC(version, '_');
|
||||
|
||||
@@ -5,6 +5,7 @@ typedef struct FFMonitorResult
|
||||
FFstrbuf name;
|
||||
uint32_t width; // native / maximum resolution, in pixels
|
||||
uint32_t height; // native / maximum resolution, in pixels
|
||||
double refreshRate;// maximum refresh rate in native resolution, in Hz
|
||||
uint32_t physicalWidth; // in mm
|
||||
uint32_t physicalHeight; // in mm
|
||||
bool hdrCompatible;
|
||||
|
||||
@@ -19,7 +19,7 @@ static bool detectHdrSupportWithNSScreen(FFDisplayResult* display)
|
||||
NSScreen* mainScreen = NSScreen.mainScreen;
|
||||
if (display->primary)
|
||||
{
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
return mainScreen.maximumPotentialExtendedDynamicRangeColorComponentValue > 1;
|
||||
#else
|
||||
return mainScreen.maximumExtendedDynamicRangeColorComponentValue > 1;
|
||||
@@ -100,10 +100,22 @@ const char* ffDetectMonitor(FFlist* results)
|
||||
monitor->physicalHeight = (uint32_t) (size.height + 0.5);
|
||||
monitor->hdrCompatible = CFDictionaryContainsKey(displayInfo, CFSTR("ReferencePeakHDRLuminance")) ||
|
||||
detectHdrSupportWithNSScreen(display);
|
||||
monitor->serial = CGDisplaySerialNumber((CGDirectDisplayID) display->id);
|
||||
|
||||
int64_t serial, year, week;
|
||||
if (ffCfDictGetInt64(displayInfo, CFSTR("DisplaySerialNumber"), &serial) == NULL)
|
||||
monitor->serial = (uint32_t) (uint64_t) serial;
|
||||
FF_CFTYPE_AUTO_RELEASE CFArrayRef modes = CGDisplayCopyAllDisplayModes((CGDirectDisplayID) display->id, NULL);
|
||||
double maxRefreshRate = 0;
|
||||
for (uint32_t j = 0; j < CFArrayGetCount(modes); ++j)
|
||||
{
|
||||
CGDisplayModeRef mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, j);
|
||||
if (CGDisplayModeGetWidth(mode) == (uint32_t) width && CGDisplayModeGetHeight(mode) == (uint32_t) height)
|
||||
{
|
||||
double refreshRate = CGDisplayModeGetRefreshRate(mode);
|
||||
if (refreshRate > maxRefreshRate) maxRefreshRate = refreshRate;
|
||||
}
|
||||
}
|
||||
monitor->refreshRate = maxRefreshRate;
|
||||
|
||||
int64_t year, week;
|
||||
if (ffCfDictGetInt64(displayInfo, CFSTR("DisplayYearManufacture"), &year) == NULL)
|
||||
monitor->manufactureYear = (uint16_t) year;
|
||||
if (ffCfDictGetInt64(displayInfo, CFSTR("DisplayWeekManufacture"), &week) == NULL)
|
||||
|
||||
@@ -1,13 +1,178 @@
|
||||
#include "monitor.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "common/library.h"
|
||||
#include "util/edidHelper.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef FF_HAVE_XRANDR
|
||||
|
||||
const char* ffDetectMonitor(FFlist* results)
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
typedef struct XrandrData
|
||||
{
|
||||
FF_LIBRARY_SYMBOL(XInternAtom)
|
||||
FF_LIBRARY_SYMBOL(XGetAtomName);
|
||||
FF_LIBRARY_SYMBOL(XFree);
|
||||
FF_LIBRARY_SYMBOL(XRRGetMonitors)
|
||||
FF_LIBRARY_SYMBOL(XRRGetOutputInfo)
|
||||
FF_LIBRARY_SYMBOL(XRRGetOutputProperty)
|
||||
FF_LIBRARY_SYMBOL(XRRFreeOutputInfo)
|
||||
FF_LIBRARY_SYMBOL(XRRFreeMonitors)
|
||||
|
||||
//Init once
|
||||
Display* display;
|
||||
|
||||
//Init per screen
|
||||
XRRScreenResources* screenResources;
|
||||
} XrandrData;
|
||||
|
||||
static const char* xrandrHandleMonitors(XrandrData* data, Screen* screen, FFlist* results)
|
||||
{
|
||||
int numberOfMonitors;
|
||||
XRRMonitorInfo* monitorInfos = data->ffXRRGetMonitors(data->display, RootWindowOfScreen(screen), True, &numberOfMonitors);
|
||||
if(monitorInfos == NULL)
|
||||
return "XRRGetMonitors() failed";
|
||||
|
||||
for(int i = 0; i < numberOfMonitors; i++)
|
||||
{
|
||||
XRRMonitorInfo* monitorInfo = &monitorInfos[i];
|
||||
for(int i = 0; i < monitorInfo->noutput; i++)
|
||||
{
|
||||
RROutput output = monitorInfo->outputs[i];
|
||||
XRROutputInfo* outputInfo = data->ffXRRGetOutputInfo(data->display, data->screenResources, output);
|
||||
if(outputInfo == NULL)
|
||||
continue;
|
||||
|
||||
FFMonitorResult* display = (FFMonitorResult*) ffListAdd(results);
|
||||
ffStrbufInit(&display->name);
|
||||
display->width = 0;
|
||||
display->height = 0;
|
||||
display->manufactureYear = 0;
|
||||
display->manufactureWeek = 0;
|
||||
display->serial = 0;
|
||||
display->hdrCompatible = false;
|
||||
display->refreshRate = 0;
|
||||
|
||||
bool edidOk = false;
|
||||
Atom atomEdid = data->ffXInternAtom(data->display, "EDID", true);
|
||||
if (atomEdid != None)
|
||||
{
|
||||
int actual_format = 0;
|
||||
unsigned long nitems = 0, bytes_after = 0;
|
||||
Atom actual_type = None;
|
||||
uint8_t* edidData = NULL;
|
||||
if (data->ffXRRGetOutputProperty(data->display, output, atomEdid, 0, 100, false, false, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &edidData) == Success)
|
||||
{
|
||||
if (nitems > 0 && nitems % 128 == 0)
|
||||
{
|
||||
ffEdidGetName(edidData, &display->name);
|
||||
ffEdidGetPhysicalResolution(edidData, &display->width, &display->height);
|
||||
ffEdidGetPhysicalSize(edidData, &display->physicalWidth, &display->physicalHeight);
|
||||
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
display->hdrCompatible = ffEdidGetHdrCompatible(edidData, (uint32_t) nitems);
|
||||
edidOk = true;
|
||||
}
|
||||
}
|
||||
if (edidData)
|
||||
data->ffXFree(edidData);
|
||||
}
|
||||
|
||||
if (!edidOk)
|
||||
{
|
||||
ffStrbufSetS(&display->name, data->ffXGetAtomName(data->display, monitorInfo->name));
|
||||
display->physicalWidth = (uint32_t) monitorInfo->mwidth;
|
||||
display->physicalHeight = (uint32_t) monitorInfo->mheight;
|
||||
display->width = (uint32_t) monitorInfo->width;
|
||||
display->height = (uint32_t) monitorInfo->height;
|
||||
}
|
||||
|
||||
for(int i = 0; i < data->screenResources->nmode; i++)
|
||||
{
|
||||
bool found = false;
|
||||
for (int j = 0; j < outputInfo->nmode; ++j)
|
||||
{
|
||||
if (data->screenResources->modes[i].id == outputInfo->modes[j])
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found)
|
||||
{
|
||||
XRRModeInfo* modeInfo = &data->screenResources->modes[i];
|
||||
double refreshRate = (double) modeInfo->dotClock / (double) (modeInfo->hTotal * modeInfo->vTotal);
|
||||
if (edidOk)
|
||||
{
|
||||
if (display->width != modeInfo->width || display->height != modeInfo->height)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (display->width < modeInfo->width || display->height < modeInfo->height)
|
||||
{
|
||||
display->width = (uint32_t) modeInfo->width;
|
||||
display->height = (uint32_t) modeInfo->height;
|
||||
display->refreshRate = refreshRate;
|
||||
continue;
|
||||
}
|
||||
else if (display->width != modeInfo->width || display->height != modeInfo->height)
|
||||
continue;
|
||||
}
|
||||
if (display->refreshRate < refreshRate)
|
||||
display->refreshRate = refreshRate;
|
||||
}
|
||||
}
|
||||
data->ffXRRFreeOutputInfo(outputInfo);
|
||||
}
|
||||
}
|
||||
|
||||
data->ffXRRFreeMonitors(monitorInfos);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* detectByXrandr(FFlist* results)
|
||||
{
|
||||
FF_LIBRARY_LOAD(xrandr, &instance.config.library.libXrandr, "dlopen libXrandr" FF_LIBRARY_EXTENSION " failed", "libXrandr" FF_LIBRARY_EXTENSION, 3)
|
||||
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xrandr, XOpenDisplay)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xrandr, XCloseDisplay)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xrandr, XRRGetScreenResourcesCurrent);
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xrandr, XRRFreeScreenResources);
|
||||
|
||||
XrandrData data;
|
||||
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XInternAtom);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XGetAtomName);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XFree);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XRRGetMonitors);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XRRGetOutputInfo);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XRRGetOutputProperty);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XRRFreeOutputInfo);
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(xrandr, data, XRRFreeMonitors);
|
||||
|
||||
data.display = ffXOpenDisplay(NULL);
|
||||
if(data.display == NULL)
|
||||
return "XOpenDisplay() failed";
|
||||
|
||||
for(int i = 0; i < ScreenCount(data.display); i++)
|
||||
{
|
||||
Screen* screen = ScreenOfDisplay(data.display, i);
|
||||
data.screenResources = ffXRRGetScreenResourcesCurrent(data.display, RootWindowOfScreen(screen));
|
||||
xrandrHandleMonitors(&data, screen, results);
|
||||
ffXRRFreeScreenResources(data.screenResources);
|
||||
}
|
||||
|
||||
ffXCloseDisplay(data.display);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif // FF_HAVE_XRANDR
|
||||
|
||||
#ifdef __linux__
|
||||
FF_MAYBE_UNUSED static const char* detectByDrm(FFlist* results)
|
||||
{
|
||||
const char* drmDirPath = "/sys/class/drm/";
|
||||
|
||||
@@ -61,6 +226,7 @@ const char* ffDetectMonitor(FFlist* results)
|
||||
ffEdidGetPhysicalSize(edidData, &display->physicalWidth, &display->physicalHeight);
|
||||
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
display->hdrCompatible = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength);
|
||||
display->refreshRate = 0;
|
||||
}
|
||||
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||
@@ -69,3 +235,20 @@ const char* ffDetectMonitor(FFlist* results)
|
||||
closedir(dirp);
|
||||
return NULL;
|
||||
}
|
||||
#endif // __linux__
|
||||
|
||||
const char* ffDetectMonitor(FFlist* results)
|
||||
{
|
||||
const char* error = "Fastfetch was compiled without xrandr support";
|
||||
|
||||
#ifdef FF_HAVE_XRANDR
|
||||
error = detectByXrandr(results);
|
||||
if (!error) return NULL;
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
error = detectByDrm(results);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1,54 +1,116 @@
|
||||
#include "monitor.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "util/edidHelper.h"
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/windows/registry.h"
|
||||
#include "util/windows/unicode.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <setupapi.h>
|
||||
#include <devguid.h>
|
||||
|
||||
static inline void wrapSetupDiDestroyDeviceInfoList(HDEVINFO* hdev)
|
||||
{
|
||||
if(*hdev)
|
||||
SetupDiDestroyDeviceInfoList(*hdev);
|
||||
}
|
||||
|
||||
const char* ffDetectMonitor(FFlist* results)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/win32/power/enumerating-battery-devices
|
||||
HDEVINFO hdev __attribute__((__cleanup__(wrapSetupDiDestroyDeviceInfoList))) =
|
||||
SetupDiGetClassDevsW(&GUID_DEVCLASS_MONITOR, 0, 0, DIGCF_PRESENT);
|
||||
if(hdev == INVALID_HANDLE_VALUE)
|
||||
return "SetupDiGetClassDevsW(&GUID_DEVCLASS_MONITOR) failed";
|
||||
DISPLAYCONFIG_PATH_INFO paths[128];
|
||||
uint32_t pathCount = sizeof(paths) / sizeof(paths[0]);
|
||||
DISPLAYCONFIG_MODE_INFO modes[256];
|
||||
uint32_t modeCount = sizeof(modes) / sizeof(modes[0]);
|
||||
|
||||
SP_DEVINFO_DATA did = { .cbSize = sizeof(did) };
|
||||
for (DWORD idev = 0; SetupDiEnumDeviceInfo(hdev, idev, &did); ++idev)
|
||||
if (QueryDisplayConfig(
|
||||
QDC_ONLY_ACTIVE_PATHS,
|
||||
&pathCount,
|
||||
paths,
|
||||
&modeCount,
|
||||
modes,
|
||||
NULL) != ERROR_SUCCESS)
|
||||
return "QueryDisplayConfig() failed";
|
||||
|
||||
if (pathCount == 0)
|
||||
return "QueryDisplayConfig() returns 0 paths";
|
||||
|
||||
for (uint32_t i = 0; i < pathCount; ++i)
|
||||
{
|
||||
FF_HKEY_AUTO_DESTROY hKey = SetupDiOpenDevRegKey(hdev, &did, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_QUERY_VALUE);
|
||||
if (!hKey) continue;
|
||||
DISPLAYCONFIG_PATH_INFO* path = &paths[i];
|
||||
|
||||
FF_AUTO_FREE uint8_t* edidData = NULL;
|
||||
uint32_t edidLength = 0;
|
||||
if (!ffRegReadData(hKey, L"EDID", &edidData, &edidLength, NULL)) continue;
|
||||
if (edidLength == 0 || edidLength % 128 != 0)
|
||||
DISPLAYCONFIG_TARGET_DEVICE_NAME targetName = {
|
||||
.header = {
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME,
|
||||
.size = sizeof(targetName),
|
||||
.adapterId = path->targetInfo.adapterId,
|
||||
.id = path->targetInfo.id,
|
||||
},
|
||||
};
|
||||
if (DisplayConfigGetDeviceInfo(&targetName.header) != ERROR_SUCCESS)
|
||||
continue;
|
||||
|
||||
uint32_t width, height;
|
||||
ffEdidGetPhysicalResolution(edidData, &width, &height);
|
||||
if (width == 0 || height == 0) continue;
|
||||
wchar_t regPath[256] = L"SYSTEM\\CurrentControlSet\\Enum";
|
||||
wchar_t* pRegPath = regPath + strlen("SYSTEM\\CurrentControlSet\\Enum");
|
||||
wchar_t* pDevPath = targetName.monitorDevicePath + strlen("\\\\?");
|
||||
while (*pDevPath && *pDevPath != L'{')
|
||||
{
|
||||
if (*pDevPath == L'#')
|
||||
*pRegPath = L'\\';
|
||||
else
|
||||
*pRegPath = *pDevPath;
|
||||
++pRegPath;
|
||||
++pDevPath;
|
||||
assert(pRegPath < regPath + sizeof(regPath) / sizeof(wchar_t) + strlen("Device Parameters"));
|
||||
}
|
||||
wcscpy(pRegPath, L"Device Parameters");
|
||||
|
||||
FFMonitorResult* display = (FFMonitorResult*) ffListAdd(results);
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
display->hdrCompatible = ffEdidGetHdrCompatible(edidData, edidLength); // Doesn't work. edidLength is always 128
|
||||
ffStrbufInit(&display->name);
|
||||
ffEdidGetName(edidData, &display->name);
|
||||
ffEdidGetPhysicalSize(edidData, &display->physicalWidth, &display->physicalHeight);
|
||||
uint8_t edidData[1024];
|
||||
DWORD edidLength = sizeof(edidData);
|
||||
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, regPath, L"EDID", RRF_RT_REG_BINARY, NULL, edidData, &edidLength) == ERROR_SUCCESS &&
|
||||
edidLength > 0 && edidLength % 128 == 0)
|
||||
{
|
||||
uint32_t width, height;
|
||||
ffEdidGetPhysicalResolution(edidData, &width, &height);
|
||||
if (width == 0 || height == 0) continue;
|
||||
|
||||
FFMonitorResult* display = (FFMonitorResult*) ffListAdd(results);
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
ffStrbufInit(&display->name);
|
||||
ffEdidGetName(edidData, &display->name);
|
||||
ffEdidGetPhysicalSize(edidData, &display->physicalWidth, &display->physicalHeight);
|
||||
display->refreshRate = 0;
|
||||
display->hdrCompatible = false;
|
||||
|
||||
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = {
|
||||
.header = {
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO,
|
||||
.size = sizeof(advColorInfo),
|
||||
.adapterId = path->targetInfo.adapterId,
|
||||
.id = path->targetInfo.id,
|
||||
}
|
||||
};
|
||||
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
|
||||
display->hdrCompatible = !!advColorInfo.advancedColorSupported;
|
||||
else
|
||||
display->hdrCompatible = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength);
|
||||
|
||||
DISPLAYCONFIG_TARGET_PREFERRED_MODE preferredMode = {
|
||||
.header = {
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE,
|
||||
.size = sizeof(preferredMode),
|
||||
.adapterId = path->targetInfo.adapterId,
|
||||
.id = path->targetInfo.id,
|
||||
}
|
||||
};
|
||||
if (DisplayConfigGetDeviceInfo(&preferredMode.header) == ERROR_SUCCESS)
|
||||
{
|
||||
if (preferredMode.width == width && preferredMode.height == height)
|
||||
{
|
||||
DISPLAYCONFIG_RATIONAL freq = preferredMode.targetMode.targetVideoSignalInfo.vSyncFreq;
|
||||
display->refreshRate = freq.Numerator / (double) freq.Denominator;
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAYCONFIG_VIDEO_SIGNAL_INFO current = modes[path->targetInfo.modeInfoIdx].targetMode.targetVideoSignalInfo;
|
||||
if (current.activeSize.cx == width && current.activeSize.cy == height)
|
||||
{
|
||||
double refreshRate = current.vSyncFreq.Numerator / (double) current.vSyncFreq.Denominator;
|
||||
if (refreshRate > display->refreshRate) display->refreshRate = refreshRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ static const char* openCLHandleData(OpenCLData* data, FFOpenCLResult* result)
|
||||
{
|
||||
cl_uint value;
|
||||
if (data->ffclGetDeviceInfo(deviceID, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof(value), &value, NULL) == CL_SUCCESS)
|
||||
gpu->frequency = value / 1000.;
|
||||
gpu->frequency = value;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ static inline void wrapIoDestroyPlugInInterface(IOCFPlugInInterface*** pluginInf
|
||||
if (*pluginInf)
|
||||
IODestroyPlugInInterface(*pluginInf);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const char* detectSsdTemp(io_service_t entryPhysical, double* temp)
|
||||
{
|
||||
@@ -82,10 +82,12 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
device->temperature = FF_PHYSICALDISK_TEMP_UNSET;
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef removable = IORegistryEntryCreateCFProperty(entryPartition, CFSTR(kIOMediaRemovableKey), kCFAllocatorDefault, kNilOptions);
|
||||
device->type |= CFBooleanGetValue(removable) ? FF_PHYSICALDISK_TYPE_REMOVABLE : FF_PHYSICALDISK_TYPE_FIXED;
|
||||
if (removable)
|
||||
device->type |= CFBooleanGetValue(removable) ? FF_PHYSICALDISK_TYPE_REMOVABLE : FF_PHYSICALDISK_TYPE_FIXED;
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef writable = IORegistryEntryCreateCFProperty(entryPartition, CFSTR(kIOMediaWritableKey), kCFAllocatorDefault, kNilOptions);
|
||||
device->type |= CFBooleanGetValue(writable) ? FF_PHYSICALDISK_TYPE_READWRITE : FF_PHYSICALDISK_TYPE_READONLY;
|
||||
if (writable)
|
||||
device->type |= CFBooleanGetValue(writable) ? FF_PHYSICALDISK_TYPE_READWRITE : FF_PHYSICALDISK_TYPE_READONLY;
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFStringRef bsdName = IORegistryEntryCreateCFProperty(entryPartition, CFSTR(kIOBSDNameKey), kCFAllocatorDefault, kNilOptions);
|
||||
if (bsdName)
|
||||
@@ -125,7 +127,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
if (options->temp)
|
||||
{
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef nvmeSMARTCapable = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyNVMeSMARTCapableKey), kCFAllocatorDefault, kNilOptions);
|
||||
|
||||
@@ -72,200 +72,13 @@ FF_MAYBE_UNUSED static void detectTTY(FFTerminalFontResult* terminalFont)
|
||||
ffStrbufAppendS(&terminalFont->error, "Couldn't find Font in "FASTFETCH_TARGET_DIR_ETC"/vconsole.conf");
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__)
|
||||
|
||||
#include "common/library.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static const char* detectWTProfile(yyjson_val* profile, FFstrbuf* name, double* size)
|
||||
{
|
||||
yyjson_val* font = yyjson_obj_get(profile, "font");
|
||||
if (!font)
|
||||
return "yyjson_obj_get(profile, \"font\"); failed";
|
||||
|
||||
if (!yyjson_is_obj(font))
|
||||
return "yyjson_is_obj(font) returns false";
|
||||
|
||||
if (name->length == 0)
|
||||
{
|
||||
yyjson_val* pface = yyjson_obj_get(font, "face");
|
||||
if(yyjson_is_str(pface))
|
||||
ffStrbufAppendS(name, unsafe_yyjson_get_str(pface));
|
||||
}
|
||||
|
||||
if (*size < 0)
|
||||
{
|
||||
yyjson_val* psize = yyjson_obj_get(font, "size");
|
||||
if (yyjson_is_num(psize))
|
||||
*size = yyjson_get_num(psize);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void wrapYyjsonFree(yyjson_doc** doc)
|
||||
{
|
||||
assert(doc);
|
||||
if (*doc)
|
||||
yyjson_doc_free(*doc);
|
||||
}
|
||||
|
||||
static const char* detectFromWTImpl(FFstrbuf* content, FFstrbuf* name, double* size)
|
||||
{
|
||||
yyjson_doc* __attribute__((__cleanup__(wrapYyjsonFree))) doc = yyjson_read_opts(content->chars, content->length, YYJSON_READ_ALLOW_COMMENTS | YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_INF_AND_NAN, NULL, NULL);
|
||||
if (!doc)
|
||||
return "Failed to parse WT JSON config file";
|
||||
|
||||
yyjson_val* const root = yyjson_doc_get_root(doc);
|
||||
assert(root);
|
||||
|
||||
yyjson_val* profiles = yyjson_obj_get(root, "profiles");
|
||||
if (!profiles)
|
||||
return "yyjson_obj_get(root, \"profiles\") failed";
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY wtProfileId = ffStrbufCreateS(getenv("WT_PROFILE_ID"));
|
||||
ffStrbufTrim(&wtProfileId, '\'');
|
||||
if (wtProfileId.length > 0)
|
||||
{
|
||||
yyjson_val* list = yyjson_obj_get(profiles, "list");
|
||||
if (yyjson_is_arr(list))
|
||||
{
|
||||
yyjson_val* profile;
|
||||
size_t idx, max;
|
||||
yyjson_arr_foreach(list, idx, max, profile)
|
||||
{
|
||||
yyjson_val* guid = yyjson_obj_get(profile, "guid");
|
||||
|
||||
if(ffStrbufEqualS(&wtProfileId, yyjson_get_str(guid)))
|
||||
{
|
||||
detectWTProfile(profile, name, size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
yyjson_val* defaults = yyjson_obj_get(profiles, "defaults");
|
||||
if (defaults)
|
||||
detectWTProfile(defaults, name, size);
|
||||
|
||||
if(name->length == 0)
|
||||
ffStrbufSetS(name, "Cascadia Mono");
|
||||
if(*size < 0)
|
||||
*size = 12;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
static void detectFromWindowsTerminal(const FFstrbuf* terminalExe, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/terminal/install#settings-json-file
|
||||
FF_STRBUF_AUTO_DESTROY json = ffStrbufCreate();
|
||||
const char* error = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(terminalExe && terminalExe->length > 0 && !ffStrbufEqualS(terminalExe, "Windows Terminal"))
|
||||
{
|
||||
char jsonPath[MAX_PATH + 1];
|
||||
strncpy(jsonPath, terminalExe->chars, ffStrbufLastIndexC(terminalExe, '\\') + 1);
|
||||
char* pathEnd = jsonPath + strlen(jsonPath);
|
||||
strncpy(pathEnd, ".portable", sizeof(jsonPath) - (size_t) (pathEnd - jsonPath) - 1);
|
||||
|
||||
if(ffPathExists(jsonPath, FF_PATHTYPE_ANY))
|
||||
{
|
||||
strncpy(pathEnd, "settings\\settings.json", sizeof(jsonPath) - (size_t) (pathEnd - jsonPath) - 1);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal portable settings JSON file";
|
||||
}
|
||||
else if(SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, jsonPath)))
|
||||
{
|
||||
size_t remaining = sizeof(jsonPath) - strlen(jsonPath) - 1;
|
||||
if(ffStrbufContainIgnCaseS(terminalExe, "_8wekyb3d8bbwe\\"))
|
||||
{
|
||||
// Microsoft Store version
|
||||
if(ffStrbufContainIgnCaseS(terminalExe, ".WindowsTerminalPreview_"))
|
||||
{
|
||||
// Preview version
|
||||
strncat(jsonPath, "\\Packages\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\\LocalState\\settings.json", remaining);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal Preview settings JSON file";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Stable version
|
||||
strncat(jsonPath, "\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json", remaining);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal settings JSON file";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strncat(jsonPath, "\\Microsoft\\Windows Terminal\\settings.json", remaining);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal settings JSON file";
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
FF_UNUSED(terminalExe);
|
||||
#endif
|
||||
|
||||
if(!error && json.length == 0)
|
||||
{
|
||||
error = ffProcessAppendStdOut(&json, (char* const[]) {
|
||||
"cmd.exe",
|
||||
"/c",
|
||||
//print the file content directly, so we don't need to handle the difference of Windows and POSIX path
|
||||
"if exist %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json "
|
||||
"( type %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json ) "
|
||||
"else if exist %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\\LocalState\\settings.json "
|
||||
"( type %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\\LocalState\\settings.json ) "
|
||||
"else if exist \"%LOCALAPPDATA%\\Microsoft\\Windows Terminal\\settings.json\" "
|
||||
"( type %LOCALAPPDATA%\\Microsoft\\Windows Terminal\\settings.json ) "
|
||||
"else ( call )",
|
||||
NULL
|
||||
});
|
||||
}
|
||||
|
||||
if(error)
|
||||
{
|
||||
ffStrbufAppendS(&terminalFont->error, error);
|
||||
return;
|
||||
}
|
||||
ffStrbufTrimRight(&json, '\n');
|
||||
if(json.length == 0)
|
||||
{
|
||||
ffStrbufAppendS(&terminalFont->error, "Cannot find file \"settings.json\"");
|
||||
return;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
double size = -1;
|
||||
error = detectFromWTImpl(&json, &name, &size);
|
||||
|
||||
if(error)
|
||||
ffStrbufAppendS(&terminalFont->error, error);
|
||||
else
|
||||
{
|
||||
char sizeStr[16];
|
||||
snprintf(sizeStr, sizeof(sizeStr), "%g", size);
|
||||
ffFontInitValues(&terminalFont->font, name.chars, sizeStr);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //defined(_WIN32) || defined(__linux__)
|
||||
|
||||
static bool queryKittyTerm(const char* query, FFstrbuf* res)
|
||||
{
|
||||
// https://github.com/fastfetch-cli/fastfetch/discussions/1030#discussioncomment-9845233
|
||||
char buffer[64] = "";
|
||||
char buffer[256] = "";
|
||||
if (ffGetTerminalResponse(
|
||||
query, // kitty-query-font_family;kitty-query-font_size
|
||||
"\eP1+r%*[^=]=%64[^\e]\e\\", buffer) == NULL && *buffer)
|
||||
"\eP1+r%*[^=]=%255[^\e]\e\\", buffer) == NULL)
|
||||
{
|
||||
// decode hex string
|
||||
for (const char* p = buffer; p[0] && p[1]; p += 2)
|
||||
@@ -322,40 +135,19 @@ FF_MAYBE_UNUSED static bool detectKitty(const FFstrbuf* exe, FFTerminalFontResul
|
||||
return true;
|
||||
}
|
||||
|
||||
static void detectTerminator(FFTerminalFontResult* result)
|
||||
static bool detectWezterm(const FFstrbuf* exe, FFTerminalFontResult* result)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY useSystemFont = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY cli = ffStrbufCreateCopy(exe);
|
||||
ffStrbufSubstrBeforeLastC(&cli, '-');
|
||||
|
||||
FFpropquery fontQuery[] = {
|
||||
{"use_system_font =", &useSystemFont},
|
||||
{"font =", &fontName},
|
||||
};
|
||||
#ifdef _WIN32
|
||||
ffStrbufAppendS(&cli, ".exe");
|
||||
#endif
|
||||
|
||||
if(!ffParsePropFileConfigValues("terminator/config", 2, fontQuery))
|
||||
{
|
||||
ffStrbufAppendS(&result->error, "Couldn't read Terminator config file");
|
||||
return;
|
||||
}
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(&useSystemFont, "True"))
|
||||
{
|
||||
ffFontInitCopy(&result->font, "System");
|
||||
return;
|
||||
}
|
||||
|
||||
if(fontName.length == 0)
|
||||
ffFontInitValues(&result->font, "mono", "8");
|
||||
else
|
||||
ffFontInitPango(&result->font, fontName.chars);
|
||||
}
|
||||
|
||||
static bool detectWezterm(FFTerminalFontResult* result)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
|
||||
|
||||
ffStrbufSetS(&result->error, ffProcessAppendStdOut(&fontName, (char* const[]){
|
||||
"wezterm",
|
||||
cli.chars,
|
||||
"ls-fonts",
|
||||
"--text",
|
||||
"a",
|
||||
@@ -435,10 +227,8 @@ static bool detectTerminalFontCommon(const FFTerminalResult* terminal, FFTermina
|
||||
{
|
||||
if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "alacritty"))
|
||||
detectAlacritty(terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "terminator"))
|
||||
detectTerminator(terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "wezterm-gui"))
|
||||
detectWezterm(terminalFont);
|
||||
detectWezterm(&terminal->exe, terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "tabby"))
|
||||
detectTabby(terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "contour"))
|
||||
@@ -453,13 +243,6 @@ static bool detectTerminalFontCommon(const FFTerminalResult* terminal, FFTermina
|
||||
detectTTY(terminalFont);
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__)
|
||||
//Used by both Linux (WSL) and Windows
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "Windows Terminal") ||
|
||||
ffStrbufIgnCaseEqualS(&terminal->processName, "WindowsTerminal.exe"))
|
||||
detectFromWindowsTerminal(&terminal->exe, terminalFont);
|
||||
#endif
|
||||
|
||||
else
|
||||
return false;
|
||||
|
||||
|
||||
@@ -379,6 +379,30 @@ static void detectWarp(FFTerminalFontResult* terminalFont)
|
||||
}
|
||||
}
|
||||
|
||||
static void detectTerminator(FFTerminalFontResult* result)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY useSystemFont = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
|
||||
|
||||
if(!ffParsePropFileConfigValues("terminator/config", 2, (FFpropquery[]) {
|
||||
{"use_system_font =", &useSystemFont},
|
||||
{"font =", &fontName},
|
||||
}) || ffStrbufIgnCaseEqualS(&useSystemFont, "True"))
|
||||
{
|
||||
FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
|
||||
if(ffStrSet(fontName))
|
||||
ffFontInitPango(&result->font, fontName);
|
||||
else
|
||||
ffStrbufAppendS(&result->error, "Couldn't get system monospace font name from GSettings / DConf");
|
||||
return;
|
||||
}
|
||||
|
||||
if(fontName.length == 0)
|
||||
ffFontInitValues(&result->font, "Mono", "10");
|
||||
else
|
||||
ffFontInitPango(&result->font, fontName.chars);
|
||||
}
|
||||
|
||||
static void detectWestonTerminal(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
|
||||
@@ -426,4 +450,6 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
|
||||
detectWarp(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "weston-terminal"))
|
||||
detectWestonTerminal(terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "terminator"))
|
||||
detectTerminator(terminalFont);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,184 @@
|
||||
#include "common/properties.h"
|
||||
#include "common/library.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/processing.h"
|
||||
#include "common/properties.h"
|
||||
#include "detection/terminalshell/terminalshell.h"
|
||||
#include "terminalfont.h"
|
||||
#include "util/windows/unicode.h"
|
||||
#include "terminalfont.h"
|
||||
|
||||
#include <shlobj.h>
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static const char* detectWTProfile(yyjson_val* profile, FFstrbuf* name, double* size)
|
||||
{
|
||||
yyjson_val* font = yyjson_obj_get(profile, "font");
|
||||
if (!font)
|
||||
return "yyjson_obj_get(profile, \"font\"); failed";
|
||||
|
||||
if (!yyjson_is_obj(font))
|
||||
return "yyjson_is_obj(font) returns false";
|
||||
|
||||
if (name->length == 0)
|
||||
{
|
||||
yyjson_val* pface = yyjson_obj_get(font, "face");
|
||||
if(yyjson_is_str(pface))
|
||||
ffStrbufAppendS(name, unsafe_yyjson_get_str(pface));
|
||||
}
|
||||
|
||||
if (*size < 0)
|
||||
{
|
||||
yyjson_val* psize = yyjson_obj_get(font, "size");
|
||||
if (yyjson_is_num(psize))
|
||||
*size = yyjson_get_num(psize);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void wrapYyjsonFree(yyjson_doc** doc)
|
||||
{
|
||||
assert(doc);
|
||||
if (*doc)
|
||||
yyjson_doc_free(*doc);
|
||||
}
|
||||
|
||||
static const char* detectFromWTImpl(FFstrbuf* content, FFstrbuf* name, double* size)
|
||||
{
|
||||
yyjson_doc* __attribute__((__cleanup__(wrapYyjsonFree))) doc = yyjson_read_opts(content->chars, content->length, YYJSON_READ_ALLOW_COMMENTS | YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_INF_AND_NAN, NULL, NULL);
|
||||
if (!doc)
|
||||
return "Failed to parse WT JSON config file";
|
||||
|
||||
yyjson_val* const root = yyjson_doc_get_root(doc);
|
||||
assert(root);
|
||||
|
||||
yyjson_val* profiles = yyjson_obj_get(root, "profiles");
|
||||
if (!profiles)
|
||||
return "yyjson_obj_get(root, \"profiles\") failed";
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY wtProfileId = ffStrbufCreateS(getenv("WT_PROFILE_ID"));
|
||||
ffStrbufTrim(&wtProfileId, '\'');
|
||||
if (wtProfileId.length > 0)
|
||||
{
|
||||
yyjson_val* list = yyjson_obj_get(profiles, "list");
|
||||
if (yyjson_is_arr(list))
|
||||
{
|
||||
yyjson_val* profile;
|
||||
size_t idx, max;
|
||||
yyjson_arr_foreach(list, idx, max, profile)
|
||||
{
|
||||
yyjson_val* guid = yyjson_obj_get(profile, "guid");
|
||||
|
||||
if(ffStrbufEqualS(&wtProfileId, yyjson_get_str(guid)))
|
||||
{
|
||||
detectWTProfile(profile, name, size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
yyjson_val* defaults = yyjson_obj_get(profiles, "defaults");
|
||||
if (defaults)
|
||||
detectWTProfile(defaults, name, size);
|
||||
|
||||
if(name->length == 0)
|
||||
ffStrbufSetS(name, "Cascadia Mono");
|
||||
if(*size < 0)
|
||||
*size = 12;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void detectFromWindowsTerminal(const FFstrbuf* terminalExe, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/terminal/install#settings-json-file
|
||||
FF_STRBUF_AUTO_DESTROY json = ffStrbufCreate();
|
||||
const char* error = NULL;
|
||||
|
||||
if(terminalExe && terminalExe->length > 0 && !ffStrbufEqualS(terminalExe, "Windows Terminal"))
|
||||
{
|
||||
char jsonPath[MAX_PATH + 1];
|
||||
strncpy(jsonPath, terminalExe->chars, ffStrbufLastIndexC(terminalExe, '\\') + 1);
|
||||
char* pathEnd = jsonPath + strlen(jsonPath);
|
||||
strncpy(pathEnd, ".portable", sizeof(jsonPath) - (size_t) (pathEnd - jsonPath) - 1);
|
||||
|
||||
if(ffPathExists(jsonPath, FF_PATHTYPE_ANY))
|
||||
{
|
||||
strncpy(pathEnd, "settings\\settings.json", sizeof(jsonPath) - (size_t) (pathEnd - jsonPath) - 1);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal portable settings JSON file";
|
||||
}
|
||||
else if(SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, jsonPath)))
|
||||
{
|
||||
size_t remaining = sizeof(jsonPath) - strlen(jsonPath) - 1;
|
||||
if(ffStrbufContainIgnCaseS(terminalExe, "_8wekyb3d8bbwe\\"))
|
||||
{
|
||||
// Microsoft Store version
|
||||
if(ffStrbufContainIgnCaseS(terminalExe, ".WindowsTerminalPreview_"))
|
||||
{
|
||||
// Preview version
|
||||
strncat(jsonPath, "\\Packages\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\\LocalState\\settings.json", remaining);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal Preview settings JSON file";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Stable version
|
||||
strncat(jsonPath, "\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json", remaining);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal settings JSON file";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strncat(jsonPath, "\\Microsoft\\Windows Terminal\\settings.json", remaining);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
error = "Error reading Windows Terminal settings JSON file";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!error && json.length == 0)
|
||||
{
|
||||
error = ffProcessAppendStdOut(&json, (char* const[]) {
|
||||
"cmd.exe",
|
||||
"/c",
|
||||
//print the file content directly, so we don't need to handle the difference of Windows and POSIX path
|
||||
"if exist %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json "
|
||||
"( type %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json ) "
|
||||
"else if exist %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\\LocalState\\settings.json "
|
||||
"( type %LOCALAPPDATA%\\Packages\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\\LocalState\\settings.json ) "
|
||||
"else if exist \"%LOCALAPPDATA%\\Microsoft\\Windows Terminal\\settings.json\" "
|
||||
"( type %LOCALAPPDATA%\\Microsoft\\Windows Terminal\\settings.json ) "
|
||||
"else ( call )",
|
||||
NULL
|
||||
});
|
||||
}
|
||||
|
||||
if(error)
|
||||
{
|
||||
ffStrbufAppendS(&terminalFont->error, error);
|
||||
return;
|
||||
}
|
||||
ffStrbufTrimRight(&json, '\n');
|
||||
if(json.length == 0)
|
||||
{
|
||||
ffStrbufAppendS(&terminalFont->error, "Cannot find file \"settings.json\"");
|
||||
return;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
double size = -1;
|
||||
error = detectFromWTImpl(&json, &name, &size);
|
||||
|
||||
if(error)
|
||||
ffStrbufAppendS(&terminalFont->error, error);
|
||||
else
|
||||
{
|
||||
char sizeStr[16];
|
||||
snprintf(sizeStr, sizeof(sizeStr), "%g", size);
|
||||
ffFontInitValues(&terminalFont->font, name.chars, sizeStr);
|
||||
}
|
||||
}
|
||||
|
||||
static void detectMintty(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
@@ -87,7 +261,10 @@ static void detectConEmu(FFTerminalFontResult* terminalFont)
|
||||
|
||||
void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
if(ffStrbufIgnCaseEqualS(&terminal->processName, "mintty"))
|
||||
if(ffStrbufIgnCaseEqualS(&terminal->processName, "Windows Terminal") ||
|
||||
ffStrbufIgnCaseEqualS(&terminal->processName, "WindowsTerminal.exe"))
|
||||
detectFromWindowsTerminal(&terminal->exe, terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "mintty"))
|
||||
detectMintty(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "conhost.exe"))
|
||||
detectConhost(terminalFont);
|
||||
|
||||
@@ -352,11 +352,15 @@ FF_MAYBE_UNUSED static bool getTerminalVersionCockpit(FFstrbuf* exe, FFstrbuf* v
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionXterm(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if(ffProcessAppendStdOut(version, (char* const[]){
|
||||
exe->chars,
|
||||
"-v",
|
||||
NULL
|
||||
})) return false;
|
||||
ffStrbufSetS(version, getenv("XTERM_VERSION"));
|
||||
if (!version->length)
|
||||
{
|
||||
if(ffProcessAppendStdOut(version, (char* const[]){
|
||||
exe->chars,
|
||||
"-v",
|
||||
NULL
|
||||
})) return false;
|
||||
}
|
||||
|
||||
//xterm(273)
|
||||
ffStrbufTrimRight(version, ')');
|
||||
@@ -477,14 +481,37 @@ static bool getTerminalVersionZellij(FFstrbuf* exe, FFstrbuf* version)
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
static bool getTerminalVersionZed(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY cli = ffStrbufCreateCopy(exe);
|
||||
ffStrbufSubstrBeforeLastC(&cli, '/');
|
||||
ffStrbufAppendS(&cli, "/cli"
|
||||
#ifdef _WIN32
|
||||
".exe"
|
||||
#endif
|
||||
);
|
||||
|
||||
if(ffProcessAppendStdOut(version, (char* const[]) {
|
||||
cli.chars,
|
||||
"--version",
|
||||
NULL
|
||||
}) != NULL)
|
||||
return false;
|
||||
|
||||
// Zed 0.142.6 – /Applications/Zed.app
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
ffStrbufSubstrBeforeFirstC(version, ' ');
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
static bool getTerminalVersionKitty(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
char versionHex[64] = "";
|
||||
char versionHex[64];
|
||||
// https://github.com/fastfetch-cli/fastfetch/discussions/1030#discussioncomment-9845233
|
||||
if (ffGetTerminalResponse(
|
||||
"\eP+q6b697474792d71756572792d76657273696f6e\e\\", // kitty-query-version
|
||||
"\eP1+r%*[^=]=%64[^\e]\e\\\\", versionHex) == NULL && *versionHex)
|
||||
"\eP1+r%*[^=]=%63[^\e]\e\\\\", versionHex) == NULL)
|
||||
{
|
||||
// decode hex string
|
||||
for (const char* p = versionHex; p[0] && p[1]; p += 2)
|
||||
@@ -646,6 +673,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "zellij"))
|
||||
return getTerminalVersionZellij(exe, version);
|
||||
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "zed"))
|
||||
return getTerminalVersionZed(exe, version);
|
||||
|
||||
const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION");
|
||||
if(termProgramVersion)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
##############
|
||||
######################
|
||||
##########################
|
||||
##+$2###$1#######################
|
||||
#####$2#$1*$2###%+$1######################
|
||||
########$2%$1*#$2%#####$1###################
|
||||
##########$2##$1*#*$2#######%+$1##############
|
||||
#############$2%#############%$1############
|
||||
#############$2+################$1##########
|
||||
##############$2################*$1#########
|
||||
##############$2+################+$1########
|
||||
###############$2##########$1###$2+##%$1########
|
||||
###############$2+########$1######$2###$1#######
|
||||
#############$2*####$1############$2%#+$1#######
|
||||
############$2+###$3####$1##########$2%#*$1#######
|
||||
##########$2###*$3######$2+#+$1#####$2+##*$1######
|
||||
#########$2##%$3#####$2:%#####$1###$2###*$1#####
|
||||
########$2%#+$3######$2#############$1####
|
||||
#####$2##%:$3######$2:############$1##
|
||||
##$2+##*$3########$2############$1
|
||||
$2###$3#########$2##########$1
|
||||
$3########$2######
|
||||
@@ -0,0 +1,7 @@
|
||||
_______
|
||||
_ \______ -
|
||||
| \ ___ \ |
|
||||
| | / \ | |
|
||||
| | \___/ | |
|
||||
| \______ \_|
|
||||
-_______\
|
||||
@@ -1,7 +1,7 @@
|
||||
_______
|
||||
_ \______ -
|
||||
| \ ___ \ |
|
||||
| | / \ | |
|
||||
| | \___/ | |
|
||||
| \______ \_|
|
||||
-_______\
|
||||
____
|
||||
'pfPfp.%
|
||||
// _._ \\
|
||||
UU |===| UU
|
||||
\\ ^~^ //
|
||||
`0PpppP'
|
||||
`````
|
||||
|
||||
@@ -112,6 +112,18 @@ static const FFlogo A[] = {
|
||||
.colorKeys = FF_COLOR_FG_CYAN,
|
||||
.colorTitle = FF_COLOR_FG_CYAN,
|
||||
},
|
||||
// ALTLinux
|
||||
{
|
||||
.names = {"ALTLinux", "Sisyphus"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ALTLINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
FF_COLOR_FG_BLACK,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_YELLOW,
|
||||
.colorTitle = FF_COLOR_FG_YELLOW,
|
||||
},
|
||||
// Amazon
|
||||
{
|
||||
.names = {"Amazon"},
|
||||
@@ -4480,6 +4492,17 @@ static const FFlogo V[] = {
|
||||
.colorKeys = FF_COLOR_FG_WHITE,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// Void2Small
|
||||
{
|
||||
.names = {"void2_small", "void-linux2-small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_VOID2_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_WHITE,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// LAST
|
||||
{},
|
||||
};
|
||||
|
||||
+30
-19
@@ -38,8 +38,8 @@ static bool printImageIterm(bool printError)
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
{
|
||||
ffStrbufAppendF(&buf, "\e[2J\e[3J\e[%u;%uH",
|
||||
(unsigned) options->paddingTop,
|
||||
(unsigned) options->paddingLeft
|
||||
(unsigned) options->paddingTop + 1,
|
||||
(unsigned) options->paddingLeft + 1
|
||||
);
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_TOP)
|
||||
@@ -49,9 +49,13 @@ static bool printImageIterm(bool printError)
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
{
|
||||
if (printError)
|
||||
fputs("Logo (iterm): Must set logo width and height\n", stderr);
|
||||
return false;
|
||||
if (!options->width)
|
||||
{
|
||||
if (printError)
|
||||
fputs("Logo (iterm): Must set logo width when using position right\n", stderr);
|
||||
return false;
|
||||
}
|
||||
ffStrbufAppendF(&buf, "\e[2J\e[3J\e[%u;9999999H\e[%uD", (unsigned) options->paddingTop + 1, (unsigned) options->paddingRight + options->width);
|
||||
}
|
||||
if (options->width)
|
||||
ffStrbufAppendF(&buf, "\e]1337;File=inline=1;width=%u:%s\a", (unsigned) options->width, base64.chars);
|
||||
@@ -59,7 +63,7 @@ static bool printImageIterm(bool printError)
|
||||
ffStrbufAppendF(&buf, "\e]1337;File=inline=1:%s\a", base64.chars);
|
||||
ffWriteFDBuffer(FFUnixFD2NativeFD(STDOUT_FILENO), &buf);
|
||||
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
if (options->position == FF_LOGO_POSITION_LEFT || options->position == FF_LOGO_POSITION_RIGHT)
|
||||
{
|
||||
uint16_t X = 0, Y = 0;
|
||||
const char* error = ffGetTerminalResponse("\e[6n", "\e[%hu;%huR", &Y, &X);
|
||||
@@ -68,7 +72,8 @@ static bool printImageIterm(bool printError)
|
||||
fprintf(stderr, "\nLogo (iterm): fail to query cursor position: %s\n", error);
|
||||
return true; // We already printed image logo, don't print ascii logo then
|
||||
}
|
||||
instance.state.logoWidth = X + options->paddingRight;
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
instance.state.logoWidth = X + options->paddingRight - 1;
|
||||
instance.state.logoHeight = Y;
|
||||
fputs("\e[H", stdout);
|
||||
}
|
||||
@@ -83,7 +88,7 @@ static bool printImageIterm(bool printError)
|
||||
ffStrbufAppendNC(&buf, options->paddingTop, '\n');
|
||||
if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
ffStrbufAppendF(&buf, "\e[9999999C\e[%uD", (unsigned) options->paddingRight + options->width);
|
||||
else
|
||||
else if (options->paddingLeft)
|
||||
ffStrbufAppendF(&buf, "\e[%uC", (unsigned) options->paddingLeft);
|
||||
ffStrbufAppendF(&buf, "\e]1337;File=inline=1;width=%u;height=%u;preserveAspectRatio=%u:%s\a\n",
|
||||
(unsigned) options->width,
|
||||
@@ -133,8 +138,8 @@ static bool printImageKittyDirect(bool printError)
|
||||
{
|
||||
// We must clear the entre screen to make sure that terminal buffer won't scroll up
|
||||
printf("\e[2J\e[3J\e[%u;%uH",
|
||||
(unsigned) options->paddingTop,
|
||||
(unsigned) options->paddingLeft
|
||||
(unsigned) options->paddingTop + 1,
|
||||
(unsigned) options->paddingLeft + 1
|
||||
);
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_TOP)
|
||||
@@ -144,9 +149,13 @@ static bool printImageKittyDirect(bool printError)
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
{
|
||||
if (printError)
|
||||
fputs("Logo (iterm): Must set logo width and height\n", stderr);
|
||||
return false;
|
||||
if (!options->width)
|
||||
{
|
||||
if (printError)
|
||||
fputs("Logo (iterm): Must set logo width when using position right\n", stderr);
|
||||
return false;
|
||||
}
|
||||
printf("\e[2J\e[3J\e[%u;9999999H\e[%uD", (unsigned) options->paddingTop + 1, (unsigned) options->paddingRight + options->width);
|
||||
}
|
||||
|
||||
if (options->width)
|
||||
@@ -154,16 +163,18 @@ static bool printImageKittyDirect(bool printError)
|
||||
else
|
||||
printf("\e_Ga=T,f=100,t=f;%s\e\\", base64.chars);
|
||||
fflush(stdout);
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
if (options->position == FF_LOGO_POSITION_LEFT || options->position == FF_LOGO_POSITION_RIGHT)
|
||||
{
|
||||
uint16_t X = 0, Y = 0;
|
||||
const char* error = ffGetTerminalResponse("\e[6n", "\e[%hu;%huR", &Y, &X);
|
||||
if (error)
|
||||
{
|
||||
fprintf(stderr, "\nLogo (kitty-direct): fail to query cursor position: %s\n", error);
|
||||
if (printError)
|
||||
fprintf(stderr, "\nLogo (kitty-direct): fail to query cursor position: %s\n", error);
|
||||
return true; // We already printed image logo, don't print ascii logo then
|
||||
}
|
||||
instance.state.logoWidth = X + options->paddingRight;
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
instance.state.logoWidth = X + options->paddingRight - 1;
|
||||
instance.state.logoHeight = Y;
|
||||
fputs("\e[H", stdout);
|
||||
}
|
||||
@@ -178,7 +189,7 @@ static bool printImageKittyDirect(bool printError)
|
||||
ffPrintCharTimes('\n', options->paddingTop);
|
||||
if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
printf("\e[9999999C\e[%uD", (unsigned) options->paddingRight + options->width);
|
||||
else
|
||||
else if (options->paddingLeft)
|
||||
printf("\e[%uC", (unsigned) options->paddingLeft);
|
||||
|
||||
printf("\e_Ga=T,f=100,t=f,c=%u,r=%u;%s\e\\\n",
|
||||
@@ -338,7 +349,7 @@ static void printImagePixels(FFLogoRequestData* requestData, const FFstrbuf* res
|
||||
ffPrintCharTimes('\n', options->paddingTop);
|
||||
if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
printf("\e[9999999C\e[%uD", (unsigned) options->paddingRight + requestData->logoCharacterWidth);
|
||||
else
|
||||
else if (options->paddingLeft)
|
||||
printf("\e[%uC", (unsigned) options->paddingLeft);
|
||||
fflush(stdout);
|
||||
ffWriteFDBuffer(FFUnixFD2NativeFD(STDOUT_FILENO), result);
|
||||
@@ -722,7 +733,7 @@ static bool printCachedPixel(FFLogoRequestData* requestData)
|
||||
ffPrintCharTimes('\n', options->paddingTop);
|
||||
if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
printf("\e[9999999C\e[%uD", (unsigned) options->paddingRight + requestData->logoCharacterWidth);
|
||||
else
|
||||
else if (options->paddingLeft)
|
||||
printf("\e[%uC", (unsigned) options->paddingLeft);
|
||||
fflush(stdout);
|
||||
|
||||
|
||||
+69
-20
@@ -16,41 +16,91 @@ typedef enum FFLogoSize
|
||||
FF_LOGO_SIZE_SMALL,
|
||||
} FFLogoSize;
|
||||
|
||||
static void ffLogoPrintCharsRaw(const char* data, size_t length)
|
||||
static bool ffLogoPrintCharsRaw(const char* data, size_t length, bool printError)
|
||||
{
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
||||
|
||||
if (!options->width || !options->height)
|
||||
{
|
||||
ffStrbufAppendF(&buf, "\e[2J\e[3J\e[%u;%uH",
|
||||
(unsigned) options->paddingTop,
|
||||
(unsigned) options->paddingLeft
|
||||
);
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
{
|
||||
ffStrbufAppendF(&buf, "\e[2J\e[3J\e[%u;%uH",
|
||||
(unsigned) options->paddingTop + 1,
|
||||
(unsigned) options->paddingLeft + 1
|
||||
);
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_TOP)
|
||||
{
|
||||
ffStrbufAppendNC(&buf, options->paddingTop, '\n');
|
||||
ffStrbufAppendNC(&buf, options->paddingLeft, ' ');
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
{
|
||||
if (!options->width)
|
||||
{
|
||||
if (printError)
|
||||
fputs("Logo (iterm): Must set logo width when using position right\n", stderr);
|
||||
return false;
|
||||
}
|
||||
ffStrbufAppendF(&buf, "\e[2J\e[3J\e[%u;9999999H\e[%uD", (unsigned) options->paddingTop + 1, (unsigned) options->paddingRight + options->width);
|
||||
}
|
||||
ffStrbufAppendNS(&buf, (uint32_t) length, data);
|
||||
ffWriteFDBuffer(FFUnixFD2NativeFD(STDOUT_FILENO), &buf);
|
||||
|
||||
uint16_t X = 0, Y = 0;
|
||||
const char* error = ffGetTerminalResponse("\e[6n", "\e[%hu;%huR", &Y, &X);
|
||||
if (error)
|
||||
if (options->position == FF_LOGO_POSITION_LEFT || options->position == FF_LOGO_POSITION_RIGHT)
|
||||
{
|
||||
fprintf(stderr, "\nLogo (image-raw): fail to query cursor position: %s\n", error);
|
||||
return;
|
||||
uint16_t X = 0, Y = 0;
|
||||
const char* error = ffGetTerminalResponse("\e[6n", "\e[%hu;%huR", &Y, &X);
|
||||
if (error)
|
||||
{
|
||||
if (printError)
|
||||
fprintf(stderr, "\nLogo (image-raw): fail to query cursor position: %s\n", error);
|
||||
return true;
|
||||
}
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
instance.state.logoWidth = X + instance.config.logo.paddingRight - 1;
|
||||
instance.state.logoHeight = Y;
|
||||
fputs("\e[H", stdout);
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_TOP)
|
||||
{
|
||||
instance.state.logoWidth = instance.state.logoHeight = 0;
|
||||
ffPrintCharTimes('\n', options->paddingRight);
|
||||
}
|
||||
instance.state.logoWidth = X + instance.config.logo.paddingRight;
|
||||
instance.state.logoHeight = Y;
|
||||
fputs("\e[H", stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufAppendNC(&buf, options->paddingTop, '\n');
|
||||
ffStrbufAppendNC(&buf, options->paddingLeft, ' ');
|
||||
|
||||
if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
ffStrbufAppendF(&buf, "\e[9999999C\e[%uD", (unsigned) options->paddingRight + options->width);
|
||||
else if (options->paddingLeft)
|
||||
ffStrbufAppendF(&buf, "\e[%uC", (unsigned) options->paddingLeft);
|
||||
|
||||
ffStrbufAppendNS(&buf, (uint32_t) length, data);
|
||||
instance.state.logoHeight = options->paddingTop + options->height;
|
||||
instance.state.logoWidth = options->paddingLeft + options->width + options->paddingRight;
|
||||
ffStrbufAppendF(&buf, "\n\e[%uA", instance.state.logoHeight);
|
||||
ffStrbufAppendC(&buf, '\n');
|
||||
|
||||
if (options->position == FF_LOGO_POSITION_LEFT)
|
||||
{
|
||||
instance.state.logoWidth = options->width + options->paddingLeft + options->paddingRight;
|
||||
instance.state.logoHeight = options->paddingTop + options->height;
|
||||
ffStrbufAppendF(&buf, "\e[%uA", (unsigned) instance.state.logoHeight);
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_TOP)
|
||||
{
|
||||
instance.state.logoWidth = instance.state.logoHeight = 0;
|
||||
ffStrbufAppendNC(&buf, options->paddingRight, '\n');
|
||||
}
|
||||
else if (options->position == FF_LOGO_POSITION_RIGHT)
|
||||
{
|
||||
instance.state.logoWidth = instance.state.logoHeight = 0;
|
||||
ffStrbufAppendF(&buf, "\e[%uA", (unsigned) options->height);
|
||||
}
|
||||
ffWriteFDBuffer(FFUnixFD2NativeFD(STDOUT_FILENO), &buf);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// If result is NULL, calculate logo width
|
||||
@@ -441,10 +491,9 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
|
||||
|
||||
logoApplyColors(logoGetBuiltinDetected(FF_LOGO_SIZE_NORMAL), doColorReplacement);
|
||||
if(raw)
|
||||
ffLogoPrintCharsRaw(content.chars, content.length);
|
||||
else
|
||||
ffLogoPrintChars(content.chars, doColorReplacement);
|
||||
return ffLogoPrintCharsRaw(content.chars, content.length, instance.config.display.showErrors);
|
||||
|
||||
ffLogoPrintChars(content.chars, doColorReplacement);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
ffPrintBatteryHelpFormat,
|
||||
ffGenerateBatteryJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
|
||||
@@ -43,8 +43,9 @@ void ffPrintBios(FFBiosOptions* options)
|
||||
else
|
||||
{
|
||||
ffStrbufClear(&key);
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 1, ((FFformatarg[]){
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.type, "type"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"},
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -167,7 +168,7 @@ void ffInitBiosOptions(FFBiosOptions* options)
|
||||
ffPrintBiosHelpFormat,
|
||||
ffGenerateBiosJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBiosOptions(FFBiosOptions* options)
|
||||
|
||||
@@ -200,7 +200,7 @@ void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
ffPrintBluetoothHelpFormat,
|
||||
ffGenerateBluetoothJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->showDisconnected = false;
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void ffInitBoardOptions(FFBoardOptions* options)
|
||||
ffPrintBoardHelpFormat,
|
||||
ffGenerateBoardJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBoardOptions(FFBoardOptions* options)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user