mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Resolution: rename to display
This commit is contained in:
@@ -4,6 +4,7 @@ Notable Changes:
|
||||
* fastfetch no longer creates a sample config file silently. Use `--gen-config` to generate one.
|
||||
* fastfetch now search for user config file in the order of `fastfetch --list-config-paths`
|
||||
* Unknown disks are hidden by default.
|
||||
* `Resolution` module is renamed to `Display`. (#393)
|
||||
|
||||
Features:
|
||||
* `--logo-padding-top` option (@CarterLi, #372)
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/modules/poweradapter.c
|
||||
src/modules/processes.c
|
||||
src/modules/publicip.c
|
||||
src/modules/resolution.c
|
||||
src/modules/display.c
|
||||
src/modules/separator.c
|
||||
src/modules/shell.c
|
||||
src/modules/media.c
|
||||
|
||||
@@ -36,8 +36,8 @@ The following libraries are used if present at runtime:
|
||||
* [`libxcb-randr`](https://xcb.freedesktop.org/),
|
||||
[`libXrandr`](https://gitlab.freedesktop.org/xorg/lib/libxrandr),
|
||||
[`libxcb`](https://xcb.freedesktop.org/),
|
||||
[`libX11`](https://gitlab.freedesktop.org/xorg/lib/libx11): At least one of them sould be present in X11 sessions for better resolution detection and faster WM detection. The `*randr` ones provide multi monitor support The `libxcb*` ones usually have better performance.
|
||||
* [`libwayland-client`](https://wayland.freedesktop.org/): Better resolution performance and output in wayland sessions. Supports different refresh rates per monitor.
|
||||
[`libX11`](https://gitlab.freedesktop.org/xorg/lib/libx11): At least one of them sould be present in X11 sessions for better display detection and faster WM detection. The `*randr` ones provide multi monitor support The `libxcb*` ones usually have better performance.
|
||||
* [`libwayland-client`](https://wayland.freedesktop.org/): Better display performance and output in wayland sessions. Supports different refresh rates per monitor.
|
||||
* [`libGIO`](https://developer.gnome.org/gio/unstable/): Needed for values that are only stored GSettings.
|
||||
* [`libDConf`](https://developer.gnome.org/dconf/unstable/): Needed for values that are only stored in DConf + Fallback for GSettings.
|
||||
* [`libmagickcore` (ImageMagick)](https://www.imagemagick.org/): Images in terminal using sixel or kitty graphics protocol.
|
||||
@@ -85,7 +85,7 @@ All categories not listed here should work without needing a specific implementa
|
||||
|
||||
##### Available Modules
|
||||
```
|
||||
Battery, Bios, Board, Break, Brightness, Colors, Command, CPU, CPUUsage, Cursor, Custom, Date, DateTime, DE, Disk, Font, GPU, Host, Icons, Kernel, Locale, LocalIP, Media, Memory, OpenCL, OpenGL, Packages, Player, Power Adapter, Processes, PublicIP, Resolution, Separator OS, Shell, Swap, Terminal, Terminal Font, Theme, Time, Title, Uptime, Vulkan, Wifi, WM, WMTheme
|
||||
Battery, Bios, Board, Break, Brightness, Colors, Command, CPU, CPUUsage, Cursor, Custom, Date, DateTime, DE, Disk, Display, Font, GPU, Host, Icons, Kernel, Locale, LocalIP, Media, Memory, OpenCL, OpenGL, Packages, Player, Power Adapter, Processes, PublicIP, Separator OS, Shell, Swap, Terminal, Terminal Font, Theme, Time, Title, Uptime, Vulkan, Wifi, WM, WMTheme
|
||||
```
|
||||
|
||||
##### Builtin logos
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@ __fastfetch_complete_help()
|
||||
"processes-format"
|
||||
"packages-format"
|
||||
"shell-format"
|
||||
"resolution-format"
|
||||
"display-format"
|
||||
"de-format"
|
||||
"wm-format"
|
||||
"wm-theme-format"
|
||||
@@ -253,9 +253,9 @@ __fastfetch_completion()
|
||||
"--shell-key"
|
||||
"--shell-format"
|
||||
"--shell-error"
|
||||
"--resolution-key"
|
||||
"--resolution-format"
|
||||
"--resolution-error"
|
||||
"--display-key"
|
||||
"--display-format"
|
||||
"--display-error"
|
||||
"--de-key"
|
||||
"--de-format"
|
||||
"--de-error"
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
--structure Title:Separator:OS:Host:Bios:Board:Chassis:Kernel:Uptime:Processes:Packages:Shell:Resolution:Brightness:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:CPUUsage:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Player:Media:PublicIP:LocalIP:Wifi:DateTime:Locale:Vulkan:OpenGL:OpenCL:Users:Weather:Break:Colors
|
||||
--structure Title:Separator:OS:Host:Bios:Board:Chassis:Kernel:Uptime:Processes:Packages:Shell:Display:Brightness:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:CPUUsage:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Player:Media:PublicIP:LocalIP:Wifi:DateTime:Locale:Vulkan:OpenGL:OpenCL:Users:Weather:Break:Colors
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
--structure Host:Resolution:CPU:GPU:Memory:Disk:Battery
|
||||
--structure Host:Display:CPU:GPU:Memory:Disk:Battery
|
||||
--memory-format "{?2}{2}{?}"
|
||||
--disk-format "{?2}{2}{?}"
|
||||
--battery-format "{?1}{1} {?}{?2}{2} {?}{?3}({3}){?}"
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
--structure "Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Terminal:TerminalFont:CPU:GPU:Memory:Break:Colors"
|
||||
--structure "Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Terminal:TerminalFont:CPU:GPU:Memory:Break:Colors"
|
||||
--host-format "{/2}{-}{/}{2}{?3} {3}{?}"
|
||||
--os-format "{3} {12}"
|
||||
--resolution-format "{}x{}"
|
||||
--display-format "{}x{}"
|
||||
--de-format "{2} {3}"
|
||||
--theme-format "{?1}{1}{?3} {3}{?} [Plasma], {?}{7}"
|
||||
--terminal-font-format "{/2}{-}{/}{2}{?3} {3}{?}"
|
||||
--memory-format "{/1}{-}{/}{/2}{-}{/}{} / {}"
|
||||
--gpu-key "GPU"
|
||||
--resolution-key "Resolution"
|
||||
--display-key "Display"
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
--structure Title:Separator:OS:Host:Kernel:Uptime:Battery:Break:Packages:Shell:Resolution:Terminal:Break:CPU:GPU:Memory:Break:Colors
|
||||
--structure Title:Separator:OS:Host:Kernel:Uptime:Battery:Break:Packages:Shell:Display:Terminal:Break:CPU:GPU:Memory:Break:Colors
|
||||
--host-format "{/2}{-}{/}{2}{?3} {3}{?}"
|
||||
--battery-format "{/4}{-}{/}{4}%{?5} [{5}]{?}"
|
||||
--resolution-key "Resolution"
|
||||
--display-key "Display"
|
||||
--gpu-key "GPU"
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
--processes-format Count: {}
|
||||
--packages-format All: {}; pacman: {}; pacman branch: {}; dpkg: {}; rpm: {}; emerge: {}; eopkg: {}; xbps: {}; apk: {}; flatpak: {}; snap: {}; brew: {}; brew-cask: {}; port: {}; scoop: {}; choco: {}
|
||||
--shell-format Process name: {}; Process path: {}; Process exe: {}; Process version: {}; User path: {}; User exe: {}; User version: {}
|
||||
--resolution-format Width: {}; Height: {}; Refresh rate: {}
|
||||
--display-format Width: {}; Height: {}; Refresh rate: {}
|
||||
--de-format Process name: {}; Pretty name: {}; Version: {}
|
||||
--wm-format Process name: {}; Pretty name: {}; Protocol: {}
|
||||
--wm-theme-format Name: {}
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ static void defaultConfig(FFinstance* instance)
|
||||
initModuleArg(&instance->config.processes);
|
||||
initModuleArg(&instance->config.packages);
|
||||
initModuleArg(&instance->config.shell);
|
||||
initModuleArg(&instance->config.resolution);
|
||||
initModuleArg(&instance->config.display);
|
||||
initModuleArg(&instance->config.de);
|
||||
initModuleArg(&instance->config.wm);
|
||||
initModuleArg(&instance->config.wmTheme);
|
||||
@@ -345,7 +345,7 @@ static void destroyConfig(FFinstance* instance)
|
||||
destroyModuleArg(&instance->config.processes);
|
||||
destroyModuleArg(&instance->config.packages);
|
||||
destroyModuleArg(&instance->config.shell);
|
||||
destroyModuleArg(&instance->config.resolution);
|
||||
destroyModuleArg(&instance->config.display);
|
||||
destroyModuleArg(&instance->config.de);
|
||||
destroyModuleArg(&instance->config.wm);
|
||||
destroyModuleArg(&instance->config.wmTheme);
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
#--processes-key Processes
|
||||
#--packages-key Packages
|
||||
#--shell-key Shell
|
||||
#--resolution-key Resolution {1}
|
||||
#--display-key Display {1}
|
||||
#--brightness-key Brightness ({1})
|
||||
#--de-key DE
|
||||
#--wm-key WM
|
||||
@@ -309,7 +309,7 @@
|
||||
#--processes-format
|
||||
#--packages-format
|
||||
#--shell-format
|
||||
#--resolution-format
|
||||
#--display-format
|
||||
#--brightness-format
|
||||
#--de-format
|
||||
#--wm-format
|
||||
@@ -353,7 +353,7 @@
|
||||
#--processes-error
|
||||
#--packages-error
|
||||
#--shell-error
|
||||
#--resolution-error
|
||||
#--display-error
|
||||
#--brightness-error
|
||||
#--de-error
|
||||
#--wm-error
|
||||
|
||||
@@ -33,4 +33,4 @@ You can therefore use --host-format " " to disable host output.
|
||||
Note that --host-format "" would evaluate as not set, and therefore use the built-in host format
|
||||
|
||||
Format string is also the way to go to set a fixed value - just use one without placeholders.
|
||||
For example when running in headless mode, you could use "--resolution-format "Preferred".
|
||||
For example when running in headless mode, you could use "--display-format Preferred".
|
||||
|
||||
@@ -11,6 +11,7 @@ Date
|
||||
Datetime
|
||||
DE
|
||||
Disk
|
||||
Display
|
||||
Font
|
||||
GPU
|
||||
Host
|
||||
@@ -27,7 +28,6 @@ Player
|
||||
PowerAdapter
|
||||
Processes
|
||||
PublicIP
|
||||
Resolution
|
||||
Separator
|
||||
Shell
|
||||
Swap
|
||||
|
||||
@@ -1 +1 @@
|
||||
Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors
|
||||
Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:PowerAdapter:Locale:Break:Colors
|
||||
|
||||
@@ -19,15 +19,15 @@ uint32_t ffdsParseRefreshRate(int32_t refreshRate)
|
||||
return (uint32_t) refreshRate;
|
||||
}
|
||||
|
||||
bool ffdsAppendResolution(FFDisplayServerResult* result, uint32_t width, uint32_t height, uint32_t refreshRate)
|
||||
bool ffdsAppendDisplay(FFDisplayServerResult* result, uint32_t width, uint32_t height, uint32_t refreshRate)
|
||||
{
|
||||
if(width == 0 || height == 0)
|
||||
return false;
|
||||
|
||||
FFResolutionResult* resolution = ffListAdd(&result->resolutions);
|
||||
resolution->width = width;
|
||||
resolution->height = height;
|
||||
resolution->refreshRate = refreshRate;
|
||||
FFDisplayResult* display = ffListAdd(&result->displays);
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
display->refreshRate = refreshRate;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
typedef struct FFResolutionResult
|
||||
typedef struct FFDisplayResult
|
||||
{
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t refreshRate;
|
||||
} FFResolutionResult;
|
||||
} FFDisplayResult;
|
||||
|
||||
typedef struct FFDisplayServerResult
|
||||
{
|
||||
@@ -20,13 +20,13 @@ typedef struct FFDisplayServerResult
|
||||
FFstrbuf deProcessName;
|
||||
FFstrbuf dePrettyName;
|
||||
FFstrbuf deVersion;
|
||||
FFlist resolutions; //List of FFResolutionResult
|
||||
FFlist displays; //List of FFDisplayResult
|
||||
} FFDisplayServerResult;
|
||||
|
||||
const FFDisplayServerResult* ffConnectDisplayServer(const FFinstance* instance);
|
||||
|
||||
//Used internal
|
||||
uint32_t ffdsParseRefreshRate(int32_t refreshRate);
|
||||
bool ffdsAppendResolution(FFDisplayServerResult* result, uint32_t width, uint32_t height, uint32_t refreshRate);
|
||||
bool ffdsAppendDisplay(FFDisplayServerResult* result, uint32_t width, uint32_t height, uint32_t refreshRate);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <assert.h>
|
||||
#include <CoreGraphics/CGDirectDisplay.h>
|
||||
|
||||
static void detectResolution(FFDisplayServerResult* ds)
|
||||
static void detectDisplays(FFDisplayServerResult* ds)
|
||||
{
|
||||
CGDirectDisplayID screens[128];
|
||||
uint32_t screenCount;
|
||||
@@ -20,7 +20,7 @@ static void detectResolution(FFDisplayServerResult* ds)
|
||||
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(screen);
|
||||
if(mode)
|
||||
{
|
||||
ffdsAppendResolution(ds,
|
||||
ffdsAppendDisplay(ds,
|
||||
(uint32_t)CGDisplayModeGetWidth(mode),
|
||||
(uint32_t)CGDisplayModeGetHeight(mode),
|
||||
(uint32_t)CGDisplayModeGetRefreshRate(mode)
|
||||
@@ -84,6 +84,6 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
|
||||
ffStrbufAppendS(&ds->deProcessName, "aqua");
|
||||
ffStrbufAppendS(&ds->dePrettyName, "Aqua");
|
||||
|
||||
ffListInitA(&ds->resolutions, sizeof(FFResolutionResult), 4);
|
||||
detectResolution(ds);
|
||||
ffListInitA(&ds->displays, sizeof(FFDisplayResult), 4);
|
||||
detectDisplays(ds);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
|
||||
ffStrbufInitA(&ds->deProcessName, 0);
|
||||
ffStrbufInitA(&ds->dePrettyName, 0);
|
||||
ffStrbufInitA(&ds->deVersion, 0);
|
||||
ffListInitA(&ds->resolutions, sizeof(FFResolutionResult), 0);
|
||||
ffListInitA(&ds->displays, sizeof(FFDisplayResult), 0);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
|
||||
ffStrbufInit(&ds->deProcessName);
|
||||
ffStrbufInit(&ds->dePrettyName);
|
||||
ffStrbufInit(&ds->deVersion);
|
||||
ffListInit(&ds->resolutions, sizeof(FFResolutionResult));
|
||||
ffListInit(&ds->displays, sizeof(FFDisplayResult));
|
||||
|
||||
DISPLAY_DEVICEW displayDevice = { .cb = sizeof(DISPLAY_DEVICEW) };
|
||||
for(DWORD devNum = 0; EnumDisplayDevicesW(NULL, devNum, &displayDevice, 0) != 0; ++devNum)
|
||||
@@ -34,7 +34,7 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
|
||||
if(EnumDisplaySettingsW(displayDevice.DeviceName, ENUM_CURRENT_SETTINGS, &devMode) == 0)
|
||||
continue;
|
||||
|
||||
ffdsAppendResolution(ds, devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmDisplayFrequency);
|
||||
ffdsAppendDisplay(ds, devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmDisplayFrequency);
|
||||
}
|
||||
|
||||
//https://github.com/hykilpikonna/hyfetch/blob/master/neofetch#L2067
|
||||
|
||||
@@ -32,14 +32,14 @@ static void parseDRM(FFDisplayServerResult* result)
|
||||
continue;
|
||||
}
|
||||
|
||||
FFResolutionResult* resolution = ffListAdd(&result->resolutions);
|
||||
resolution->width = 0;
|
||||
resolution->height = 0;
|
||||
resolution->refreshRate = 0;
|
||||
FFDisplayResult* display = ffListAdd(&result->displays);
|
||||
display->width = 0;
|
||||
display->height = 0;
|
||||
display->refreshRate = 0;
|
||||
|
||||
int scanned = fscanf(modeFile, "%ux%u", &resolution->width, &resolution->height);
|
||||
if(scanned < 2 || resolution->width == 0 || resolution->height == 0)
|
||||
--result->resolutions.length;
|
||||
int scanned = fscanf(modeFile, "%ux%u", &display->width, &display->height);
|
||||
if(scanned < 2 || display->width == 0 || display->height == 0)
|
||||
--result->displays.length;
|
||||
|
||||
fclose(modeFile);
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||
@@ -57,31 +57,31 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
|
||||
ffStrbufInit(&ds->deProcessName);
|
||||
ffStrbufInit(&ds->dePrettyName);
|
||||
ffStrbufInit(&ds->deVersion);
|
||||
ffListInitA(&ds->resolutions, sizeof(FFResolutionResult), 4);
|
||||
ffListInitA(&ds->displays, sizeof(FFDisplayResult), 4);
|
||||
|
||||
//We try wayland as our prefered display server, as it supports the most features.
|
||||
//This method can't detect the name of our WM / DE
|
||||
ffdsConnectWayland(instance, ds);
|
||||
|
||||
//Try the x11 libs, from most feature rich to least.
|
||||
//We use the resolution list to detect if a connection is needed.
|
||||
//They respect wmProtocolName, and only detect resolution if it is set.
|
||||
//We use the display list to detect if a connection is needed.
|
||||
//They respect wmProtocolName, and only detect display if it is set.
|
||||
|
||||
if(ds->resolutions.length == 0)
|
||||
if(ds->displays.length == 0)
|
||||
ffdsConnectXcbRandr(instance, ds);
|
||||
|
||||
if(ds->resolutions.length == 0)
|
||||
if(ds->displays.length == 0)
|
||||
ffdsConnectXrandr(instance, ds);
|
||||
|
||||
if(ds->resolutions.length == 0)
|
||||
if(ds->displays.length == 0)
|
||||
ffdsConnectXcb(instance, ds);
|
||||
|
||||
if(ds->resolutions.length == 0)
|
||||
if(ds->displays.length == 0)
|
||||
ffdsConnectXlib(instance, ds);
|
||||
|
||||
//This resolution detection method is display server independent.
|
||||
//This display detection method is display server independent.
|
||||
//Use it if all connections failed
|
||||
if(ds->resolutions.length == 0)
|
||||
if(ds->displays.length == 0)
|
||||
parseDRM(ds);
|
||||
|
||||
//This fills in missing information about WM / DE by using env vars and iterating processes
|
||||
|
||||
@@ -59,7 +59,7 @@ static void waylandOutputModeListener(void* data, struct wl_output* output, uint
|
||||
static FFThreadMutex mutex = FF_THREAD_MUTEX_INITIALIZER;
|
||||
ffThreadMutexLock(&mutex);
|
||||
|
||||
FFResolutionResult* result = ffListAdd(wldata->results);
|
||||
FFDisplayResult* result = ffListAdd(wldata->results);
|
||||
|
||||
ffThreadMutexUnlock(&mutex);
|
||||
|
||||
@@ -136,7 +136,7 @@ bool detectWayland(const FFinstance* instance, FFDisplayServerResult* result)
|
||||
return false;
|
||||
}
|
||||
|
||||
data.results = &result->resolutions;
|
||||
data.results = &result->displays;
|
||||
|
||||
struct wl_registry_listener registry_listener = {
|
||||
.global = waylandGlobalAddListener,
|
||||
@@ -151,7 +151,7 @@ bool detectWayland(const FFinstance* instance, FFDisplayServerResult* result)
|
||||
ffwl_display_disconnect(display);
|
||||
dlclose(wayland);
|
||||
|
||||
//We successfully connected to wayland and detected the resolution.
|
||||
//We successfully connected to wayland and detected the display.
|
||||
//So we can set set the session type to wayland.
|
||||
//This is used as an indicator that we are running wayland by the x11 backends.
|
||||
ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_WAYLAND);
|
||||
|
||||
@@ -115,7 +115,7 @@ void ffdsConnectXcb(const FFinstance* instance, FFDisplayServerResult* result)
|
||||
|
||||
while(iterator.rem > 0)
|
||||
{
|
||||
ffdsAppendResolution(
|
||||
ffdsAppendDisplay(
|
||||
result,
|
||||
(uint32_t) iterator.data->width_in_pixels,
|
||||
(uint32_t) iterator.data->height_in_pixels,
|
||||
@@ -180,7 +180,7 @@ static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* mo
|
||||
modeInfo->dot_clock / (uint32_t) (modeInfo->htotal * modeInfo->vtotal)
|
||||
));
|
||||
|
||||
return ffdsAppendResolution(
|
||||
return ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) modeInfo->width,
|
||||
(uint32_t) modeInfo->height,
|
||||
@@ -190,7 +190,7 @@ static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* mo
|
||||
|
||||
static bool xcbRandrHandleMode(XcbRandrData* data, xcb_randr_mode_t mode)
|
||||
{
|
||||
//We do the check here, because we want the best fallback resolution if this call failed
|
||||
//We do the check here, because we want the best fallback display if this call failed
|
||||
if(data->screenResources == NULL)
|
||||
return false;
|
||||
|
||||
@@ -215,7 +215,7 @@ static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc)
|
||||
return false;
|
||||
|
||||
bool res = xcbRandrHandleMode(data, crtcInfoReply->mode);
|
||||
res = res ? true : ffdsAppendResolution(
|
||||
res = res ? true : ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) crtcInfoReply->width,
|
||||
(uint32_t) crtcInfoReply->height,
|
||||
@@ -258,7 +258,7 @@ static bool xcbRandrHandleMonitor(XcbRandrData* data, xcb_randr_monitor_info_t*
|
||||
data->ffxcb_randr_output_next(&outputIterator);
|
||||
};
|
||||
|
||||
return foundOutput ? true : ffdsAppendResolution(
|
||||
return foundOutput ? true : ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) monitor->width,
|
||||
(uint32_t) monitor->height,
|
||||
@@ -316,7 +316,7 @@ static void xcbRandrHandleScreen(XcbRandrData* data, xcb_screen_t* screen)
|
||||
return;
|
||||
|
||||
//If detetction failed, fallback to screen = monitor, like in the libxcb.so implementation
|
||||
ffdsAppendResolution(
|
||||
ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) screen->width_in_pixels,
|
||||
(uint32_t) screen->height_in_pixels,
|
||||
|
||||
@@ -79,7 +79,7 @@ void ffdsConnectXlib(const FFinstance* instance, FFDisplayServerResult* result)
|
||||
for(int i = 0; i < ScreenCount(display); i++)
|
||||
{
|
||||
Screen* screen = ScreenOfDisplay(display, i);
|
||||
ffdsAppendResolution(
|
||||
ffdsAppendDisplay(
|
||||
result,
|
||||
(uint32_t) screen->width,
|
||||
(uint32_t) screen->height,
|
||||
@@ -138,7 +138,7 @@ static bool xrandrHandleModeInfo(XrandrData* data, XRRModeInfo* modeInfo)
|
||||
modeInfo->dotClock / (modeInfo->hTotal * modeInfo->vTotal)
|
||||
));
|
||||
|
||||
return ffdsAppendResolution(
|
||||
return ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) modeInfo->width,
|
||||
(uint32_t) modeInfo->height,
|
||||
@@ -158,7 +158,7 @@ static bool xrandrHandleMode(XrandrData* data, RRMode mode)
|
||||
|
||||
static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc)
|
||||
{
|
||||
//We do the check here, because we want the best fallback resolution if this call failed
|
||||
//We do the check here, because we want the best fallback display if this call failed
|
||||
if(data->screenResources == NULL)
|
||||
return false;
|
||||
|
||||
@@ -167,7 +167,7 @@ static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc)
|
||||
return false;
|
||||
|
||||
bool res = xrandrHandleMode(data, crtcInfo->mode);
|
||||
res = res ? true : ffdsAppendResolution(
|
||||
res = res ? true : ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) crtcInfo->width,
|
||||
(uint32_t) crtcInfo->height,
|
||||
@@ -201,7 +201,7 @@ static bool xrandrHandleMonitor(XrandrData* data, XRRMonitorInfo* monitorInfo)
|
||||
foundOutput = true;
|
||||
}
|
||||
|
||||
return foundOutput ? true : ffdsAppendResolution(
|
||||
return foundOutput ? true : ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) monitorInfo->width,
|
||||
(uint32_t) monitorInfo->height,
|
||||
@@ -253,7 +253,7 @@ static void xrandrHandleScreen(XrandrData* data, Screen* screen)
|
||||
return;
|
||||
|
||||
//Fallback to screen
|
||||
ffdsAppendResolution(
|
||||
ffdsAppendDisplay(
|
||||
data->result,
|
||||
(uint32_t) WidthOfScreen(screen),
|
||||
(uint32_t) HeightOfScreen(screen),
|
||||
|
||||
+5
-5
@@ -174,9 +174,9 @@ static inline void printCommandHelp(const char* command)
|
||||
"User shell version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "resolution-format") == 0)
|
||||
else if(strcasecmp(command, "display-format") == 0)
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("resolution", "{}x{} @ {}Hz", 4,
|
||||
constructAndPrintCommandHelpFormat("display", "{}x{} @ {}Hz", 4,
|
||||
"Screen width",
|
||||
"Screen height",
|
||||
"Screen refresh rate",
|
||||
@@ -1147,7 +1147,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
else if(optionParseModuleArgs(key, value, "processes", &instance->config.processes)) {}
|
||||
else if(optionParseModuleArgs(key, value, "packages", &instance->config.packages)) {}
|
||||
else if(optionParseModuleArgs(key, value, "shell", &instance->config.shell)) {}
|
||||
else if(optionParseModuleArgs(key, value, "resolution", &instance->config.resolution)) {}
|
||||
else if(optionParseModuleArgs(key, value, "display", &instance->config.display)) {}
|
||||
else if(optionParseModuleArgs(key, value, "brightness", &instance->config.brightness)) {}
|
||||
else if(optionParseModuleArgs(key, value, "de", &instance->config.de)) {}
|
||||
else if(optionParseModuleArgs(key, value, "wifi", &instance->config.wifi)) {}
|
||||
@@ -1407,8 +1407,8 @@ static void parseStructureCommand(FFinstance* instance, FFdata* data, const char
|
||||
ffPrintPackages(instance);
|
||||
else if(strcasecmp(line, "shell") == 0)
|
||||
ffPrintShell(instance);
|
||||
else if(strcasecmp(line, "resolution") == 0)
|
||||
ffPrintResolution(instance);
|
||||
else if(strcasecmp(line, "display") == 0)
|
||||
ffPrintDisplay(instance);
|
||||
else if(strcasecmp(line, "desktopenvironment") == 0 || strcasecmp(line, "de") == 0)
|
||||
ffPrintDesktopEnvironment(instance);
|
||||
else if(strcasecmp(line, "windowmanager") == 0 || strcasecmp(line, "wm") == 0)
|
||||
|
||||
+2
-2
@@ -107,7 +107,7 @@ typedef struct FFconfig
|
||||
FFModuleArgs processes;
|
||||
FFModuleArgs packages;
|
||||
FFModuleArgs shell;
|
||||
FFModuleArgs resolution;
|
||||
FFModuleArgs display;
|
||||
FFModuleArgs de;
|
||||
FFModuleArgs wifi;
|
||||
FFModuleArgs wm;
|
||||
@@ -275,7 +275,7 @@ void ffPrintUptime(FFinstance* instance);
|
||||
void ffPrintProcesses(FFinstance* instance);
|
||||
void ffPrintPackages(FFinstance* instance);
|
||||
void ffPrintShell(FFinstance* instance);
|
||||
void ffPrintResolution(FFinstance* instance);
|
||||
void ffPrintDisplay(FFinstance* instance);
|
||||
void ffPrintBrightness(FFinstance* instance);
|
||||
void ffPrintDesktopEnvironment(FFinstance* instance);
|
||||
void ffPrintWM(FFinstance* instance);
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ int main(int argc, char** argv)
|
||||
//ffPrintProcesses(&instance);
|
||||
ffPrintPackages(&instance);
|
||||
ffPrintShell(&instance);
|
||||
ffPrintResolution(&instance);
|
||||
ffPrintDisplay(&instance);
|
||||
// ffPrintBrightness(&instance);
|
||||
ffPrintDesktopEnvironment(&instance);
|
||||
ffPrintWM(&instance);
|
||||
|
||||
@@ -2,26 +2,26 @@
|
||||
#include "common/printing.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
|
||||
#define FF_RESOLUTION_MODULE_NAME "Resolution"
|
||||
#define FF_RESOLUTION_MODULE_NAME "Display"
|
||||
#define FF_RESOLUTION_NUM_FORMAT_ARGS 3
|
||||
|
||||
void ffPrintResolution(FFinstance* instance)
|
||||
void ffPrintDisplay(FFinstance* instance)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
ffPrintError(instance, FF_RESOLUTION_MODULE_NAME, 0, &instance->config.resolution, "Resolution detection is not supported on Android");
|
||||
ffPrintError(instance, FF_RESOLUTION_MODULE_NAME, 0, &instance->config.display, "Display detection is not supported on Android");
|
||||
return;
|
||||
#endif
|
||||
|
||||
const FFDisplayServerResult* dsResult = ffConnectDisplayServer(instance);
|
||||
|
||||
for(uint32_t i = 0; i < dsResult->resolutions.length; i++)
|
||||
for(uint32_t i = 0; i < dsResult->displays.length; i++)
|
||||
{
|
||||
FFResolutionResult* result = ffListGet(&dsResult->resolutions, i);
|
||||
uint8_t moduleIndex = dsResult->resolutions.length == 1 ? 0 : (uint8_t) (i + 1);
|
||||
FFDisplayResult* result = ffListGet(&dsResult->displays, i);
|
||||
uint8_t moduleIndex = dsResult->displays.length == 1 ? 0 : (uint8_t) (i + 1);
|
||||
|
||||
if(instance->config.resolution.outputFormat.length == 0)
|
||||
if(instance->config.display.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, FF_RESOLUTION_MODULE_NAME, moduleIndex, &instance->config.resolution.key);
|
||||
ffPrintLogoAndKey(instance, FF_RESOLUTION_MODULE_NAME, moduleIndex, &instance->config.display.key);
|
||||
printf("%ix%i", result->width, result->height);
|
||||
|
||||
if(result->refreshRate > 0)
|
||||
@@ -31,7 +31,7 @@ void ffPrintResolution(FFinstance* instance)
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(instance, FF_RESOLUTION_MODULE_NAME, moduleIndex, &instance->config.resolution, FF_RESOLUTION_NUM_FORMAT_ARGS, (FFformatarg[]) {
|
||||
ffPrintFormat(instance, FF_RESOLUTION_MODULE_NAME, moduleIndex, &instance->config.display, FF_RESOLUTION_NUM_FORMAT_ARGS, (FFformatarg[]) {
|
||||
{FF_FORMAT_ARG_TYPE_INT, &result->width},
|
||||
{FF_FORMAT_ARG_TYPE_INT, &result->height},
|
||||
{FF_FORMAT_ARG_TYPE_INT, &result->refreshRate}
|
||||
@@ -39,6 +39,6 @@ void ffPrintResolution(FFinstance* instance)
|
||||
}
|
||||
}
|
||||
|
||||
if(dsResult->resolutions.length == 0)
|
||||
ffPrintError(instance, FF_RESOLUTION_MODULE_NAME, 0, &instance->config.resolution, "Couldn't detect resolution");
|
||||
if(dsResult->displays.length == 0)
|
||||
ffPrintError(instance, FF_RESOLUTION_MODULE_NAME, 0, &instance->config.display, "Couldn't detect display");
|
||||
}
|
||||
Reference in New Issue
Block a user