diff --git a/CHANGELOG.md b/CHANGELOG.md index 558a90dcb..53f43d5ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/CMakeLists.txt b/CMakeLists.txt index be70a5e01..2f07deeb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/README.md b/README.md index a7bc7b580..a87eee346 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/completions/bash b/completions/bash index b4f1548f7..7c32c4cc3 100644 --- a/completions/bash +++ b/completions/bash @@ -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" diff --git a/presets/all b/presets/all index d89a50e90..85be11eef 100644 --- a/presets/all +++ b/presets/all @@ -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 diff --git a/presets/hardware b/presets/hardware index 3f3995d02..f93873197 100644 --- a/presets/hardware +++ b/presets/hardware @@ -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}){?}" diff --git a/presets/neofetch b/presets/neofetch index 192abcf1a..9d42df956 100644 --- a/presets/neofetch +++ b/presets/neofetch @@ -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" diff --git a/presets/paleofetch b/presets/paleofetch index fbaa17848..66913e3dc 100644 --- a/presets/paleofetch +++ b/presets/paleofetch @@ -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" diff --git a/presets/verbose b/presets/verbose index 5a9f2f0e5..57711c43d 100644 --- a/presets/verbose +++ b/presets/verbose @@ -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: {} diff --git a/src/common/init.c b/src/common/init.c index 368a42677..e4f106e94 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -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); diff --git a/src/data/config_user.txt b/src/data/config_user.txt index 0ea7b3973..0e987509e 100644 --- a/src/data/config_user.txt +++ b/src/data/config_user.txt @@ -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 diff --git a/src/data/help_format.txt b/src/data/help_format.txt index 87a4b1cc2..106a7acdc 100644 --- a/src/data/help_format.txt +++ b/src/data/help_format.txt @@ -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". diff --git a/src/data/modules.txt b/src/data/modules.txt index a684c1b84..586c2de1d 100644 --- a/src/data/modules.txt +++ b/src/data/modules.txt @@ -11,6 +11,7 @@ Date Datetime DE Disk +Display Font GPU Host @@ -27,7 +28,6 @@ Player PowerAdapter Processes PublicIP -Resolution Separator Shell Swap diff --git a/src/data/structure.txt b/src/data/structure.txt index e47d27847..851657c6d 100644 --- a/src/data/structure.txt +++ b/src/data/structure.txt @@ -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 diff --git a/src/detection/displayserver/displayserver.c b/src/detection/displayserver/displayserver.c index 4a42a21a1..e7ab5c49e 100644 --- a/src/detection/displayserver/displayserver.c +++ b/src/detection/displayserver/displayserver.c @@ -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; } diff --git a/src/detection/displayserver/displayserver.h b/src/detection/displayserver/displayserver.h index d31d5edee..d100520b5 100644 --- a/src/detection/displayserver/displayserver.h +++ b/src/detection/displayserver/displayserver.h @@ -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 diff --git a/src/detection/displayserver/displayserver_apple.c b/src/detection/displayserver/displayserver_apple.c index 4d0d802c2..782453de9 100644 --- a/src/detection/displayserver/displayserver_apple.c +++ b/src/detection/displayserver/displayserver_apple.c @@ -7,7 +7,7 @@ #include #include -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); } diff --git a/src/detection/displayserver/displayserver_nosupport.c b/src/detection/displayserver/displayserver_nosupport.c index 8427c7cb2..359ebc634 100644 --- a/src/detection/displayserver/displayserver_nosupport.c +++ b/src/detection/displayserver/displayserver_nosupport.c @@ -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); } diff --git a/src/detection/displayserver/displayserver_windows.c b/src/detection/displayserver/displayserver_windows.c index f39955b8b..439672571 100644 --- a/src/detection/displayserver/displayserver_windows.c +++ b/src/detection/displayserver/displayserver_windows.c @@ -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 diff --git a/src/detection/displayserver/linux/displayserver_linux.c b/src/detection/displayserver/linux/displayserver_linux.c index 526670c9d..97d7f3c25 100644 --- a/src/detection/displayserver/linux/displayserver_linux.c +++ b/src/detection/displayserver/linux/displayserver_linux.c @@ -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 diff --git a/src/detection/displayserver/linux/wayland.c b/src/detection/displayserver/linux/wayland.c index 37891149c..f95c82c6b 100644 --- a/src/detection/displayserver/linux/wayland.c +++ b/src/detection/displayserver/linux/wayland.c @@ -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); diff --git a/src/detection/displayserver/linux/xcb.c b/src/detection/displayserver/linux/xcb.c index 692be7808..44b168a65 100644 --- a/src/detection/displayserver/linux/xcb.c +++ b/src/detection/displayserver/linux/xcb.c @@ -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, diff --git a/src/detection/displayserver/linux/xlib.c b/src/detection/displayserver/linux/xlib.c index 108de5946..ef6d76b75 100644 --- a/src/detection/displayserver/linux/xlib.c +++ b/src/detection/displayserver/linux/xlib.c @@ -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), diff --git a/src/fastfetch.c b/src/fastfetch.c index d31fbf7e2..37d473ee7 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -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) diff --git a/src/fastfetch.h b/src/fastfetch.h index 2f3b20753..69121e4c9 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -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); diff --git a/src/flashfetch.c b/src/flashfetch.c index 86729ace6..0c24732e3 100644 --- a/src/flashfetch.c +++ b/src/flashfetch.c @@ -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); diff --git a/src/modules/resolution.c b/src/modules/display.c similarity index 58% rename from src/modules/resolution.c rename to src/modules/display.c index 396d435b1..beed373ba 100644 --- a/src/modules/resolution.c +++ b/src/modules/display.c @@ -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"); }