-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Enhance (main/fastfetch) Add DE & WM Detection #25266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Usinganame
wants to merge
1
commit into
termux:master
Choose a base branch
from
Usinganame:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+199
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 967d5329..2bd5e188 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -12,6 +12,7 @@ set(PROJECT_LICENSE "MIT license") | ||
################### | ||
# Target Platform # | ||
################### | ||
+ | ||
if(ANDROID) | ||
set(LINUX FALSE) | ||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") | ||
robertkirkman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@@ -58,14 +59,14 @@ include(CMakeDependentOption) | ||
|
||
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku" OFF) | ||
cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD" OFF) | ||
-cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF) | ||
-cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF) | ||
+cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR ANDROID" OFF) | ||
+cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR ANDROID" OFF) | ||
cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF) | ||
cmake_dependent_option(ENABLE_DRM_AMDGPU "Enable libdrm_amdgpu" ON "LINUX OR FreeBSD" OFF) | ||
cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF) | ||
cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF) | ||
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR Haiku" OFF) | ||
-cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF) | ||
+cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR ANDROID" OFF) | ||
robertkirkman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR OpenBSD OR NetBSD OR SunOS" OFF) | ||
cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX" OFF) | ||
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR WIN32 OR SunOS OR Haiku" OFF) | ||
@@ -592,8 +593,22 @@ elseif(ANDROID) | ||
src/detection/physicalmemory/physicalmemory_nosupport.c | ||
src/detection/diskio/diskio_linux.c | ||
src/detection/displayserver/displayserver_android.c | ||
+ src/detection/displayserver/linux/displayserver_linux.c | ||
+ src/detection/displayserver/linux/drm.c | ||
+ src/detection/displayserver/linux/xcb.c | ||
+ src/detection/displayserver/linux/wmde.c | ||
+ src/detection/displayserver/linux/xlib.c | ||
+ src/detection/displayserver/linux/wayland/wayland.c | ||
+ src/detection/displayserver/linux/wayland/global-output.c | ||
+ src/detection/displayserver/linux/wayland/zwlr-output.c | ||
+ src/detection/displayserver/linux/wayland/kde-output.c | ||
+ src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c | ||
+ src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c | ||
+ src/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.c | ||
+ src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c | ||
src/detection/font/font_nosupport.c | ||
src/detection/gpu/gpu_nosupport.c | ||
+ src/detection/gtk_qt/gtk.c | ||
src/detection/host/host_android.c | ||
src/detection/icons/icons_nosupport.c | ||
src/detection/initsystem/initsystem_linux.c | ||
@@ -613,6 +628,7 @@ elseif(ANDROID) | ||
src/detection/packages/packages_linux.c | ||
src/detection/poweradapter/poweradapter_nosupport.c | ||
src/detection/processes/processes_linux.c | ||
+ src/detection/gtk_qt/qt.c | ||
src/detection/sound/sound_nosupport.c | ||
src/detection/swap/swap_linux.c | ||
src/detection/terminalfont/terminalfont_android.c | ||
@@ -624,9 +640,9 @@ elseif(ANDROID) | ||
src/detection/users/users_linux.c | ||
src/detection/wallpaper/wallpaper_nosupport.c | ||
src/detection/wifi/wifi_android.c | ||
- src/detection/wm/wm_nosupport.c | ||
- src/detection/de/de_nosupport.c | ||
- src/detection/wmtheme/wmtheme_nosupport.c | ||
+ src/detection/wm/wm_linux.c | ||
+ src/detection/de/de_linux.c | ||
+ src/detection/wmtheme/wmtheme_linux.c | ||
src/detection/camera/camera_android.c | ||
src/detection/zpool/zpool_nosupport.c | ||
src/util/platform/FFPlatform_unix.c | ||
@@ -1979,4 +1995,4 @@ fastfetch is a neofetch-like tool for fetching system information and displaying | ||
It is written mostly in C to achieve much better performance.\ | ||
") | ||
|
||
-include(CPack) | ||
+include(CPack) | ||
\ No newline at end of file | ||
diff --git a/src/detection/displayserver/displayserver.h b/src/detection/displayserver/displayserver.h | ||
index 7949f61e..2b964af5 100644 | ||
--- a/src/detection/displayserver/displayserver.h | ||
+++ b/src/detection/displayserver/displayserver.h | ||
@@ -43,6 +43,7 @@ | ||
#define FF_WM_PROTOCOL_TTY "TTY" | ||
#define FF_WM_PROTOCOL_X11 "X11" | ||
#define FF_WM_PROTOCOL_WAYLAND "Wayland" | ||
+#define FF_WM_PROTOCOL_ANDROID "Android" | ||
|
||
typedef enum __attribute__((__packed__)) FFDisplayType { | ||
FF_DISPLAY_TYPE_UNKNOWN, | ||
diff --git a/src/detection/displayserver/displayserver_android.c b/src/detection/displayserver/displayserver_android.c | ||
index 0c7a3c1c..66ce97d6 100644 | ||
--- a/src/detection/displayserver/displayserver_android.c | ||
+++ b/src/detection/displayserver/displayserver_android.c | ||
@@ -31,7 +31,7 @@ static bool checkHdrStatus(FFDisplayResult* display) | ||
return false; | ||
} | ||
|
||
-static void detectWithDumpsys(FFDisplayServerResult* ds) | ||
+void detectWithDumpsys(FFDisplayServerResult* ds) | ||
{ | ||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate(); | ||
if (ffProcessAppendStdOut(&buf, (char* []) { | ||
@@ -106,7 +106,7 @@ static void detectWithDumpsys(FFDisplayServerResult* ds) | ||
} | ||
} | ||
|
||
-static bool detectWithGetprop(FFDisplayServerResult* ds) | ||
+bool detectWithGetprop(FFDisplayServerResult* ds) | ||
{ | ||
// Only for MiUI | ||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate(); | ||
@@ -145,11 +145,11 @@ static bool detectWithGetprop(FFDisplayServerResult* ds) | ||
return false; | ||
} | ||
|
||
-void ffConnectDisplayServerImpl(FFDisplayServerResult* ds) | ||
-{ | ||
- ffStrbufSetStatic(&ds->wmProcessName, "WindowManager"); | ||
- ffStrbufSetStatic(&ds->wmPrettyName, "Window Manager"); | ||
- | ||
- if (!detectWithGetprop(ds)) | ||
- detectWithDumpsys(ds); | ||
-} | ||
+// void ffConnectDisplayServerImpl(FFDisplayServerResult* ds) | ||
+// { | ||
+// ffStrbufSetStatic(&ds->wmProcessName, "WindowManager"); | ||
+// ffStrbufSetStatic(&ds->wmPrettyName, "Window Manager"); | ||
+// | ||
+// if (!detectWithGetprop(ds)) | ||
+// detectWithDumpsys(ds); | ||
+// } | ||
diff --git a/src/detection/displayserver/displayserver_android.h b/src/detection/displayserver/displayserver_android.h | ||
new file mode 100644 | ||
index 00000000..44ff8a99 | ||
--- /dev/null | ||
+++ b/src/detection/displayserver/displayserver_android.h | ||
@@ -0,0 +1,2 @@ | ||
+void detectWithDumpsys(FFDisplayServerResult* ds); | ||
+bool detectWithGetprop(FFDisplayServerResult* ds); | ||
diff --git a/src/detection/displayserver/linux/displayserver_linux.c b/src/detection/displayserver/linux/displayserver_linux.c | ||
index 63b2c831..40f8da7b 100644 | ||
--- a/src/detection/displayserver/linux/displayserver_linux.c | ||
+++ b/src/detection/displayserver/linux/displayserver_linux.c | ||
@@ -2,6 +2,10 @@ | ||
#include "common/io/io.h" | ||
#include "util/stringUtils.h" | ||
|
||
+#ifdef __ANDROID__ | ||
+ #include "detection/displayserver/displayserver_android.h" | ||
+#endif | ||
+ | ||
#ifdef __FreeBSD__ | ||
#include "common/settings.h" | ||
#endif | ||
@@ -41,6 +45,14 @@ static void getWMProtocolNameFromEnv(FFDisplayServerResult* result) | ||
ffStrbufSetStatic(&result->wmProtocolName, FF_WM_PROTOCOL_TTY); | ||
return; | ||
} | ||
+ | ||
+ #ifdef __ANDROID__ | ||
+ if(ffStrSet(env) && ffStrEqualsIgnCase(env, "xterm-256color")) | ||
+ { | ||
+ ffStrbufSetStatic(&result->wmProtocolName, FF_WM_PROTOCOL_ANDROID); | ||
+ return; | ||
+ } | ||
+ #endif | ||
} | ||
|
||
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds) | ||
@@ -89,11 +101,22 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds) | ||
if (ds->wmProtocolName.length == 0) | ||
getWMProtocolNameFromEnv(ds); | ||
|
||
- if(!ffStrbufEqualS(&ds->wmProtocolName, FF_WM_PROTOCOL_TTY)) | ||
+ if(!ffStrbufEqualS(&ds->wmProtocolName, FF_WM_PROTOCOL_TTY) && !ffStrbufEqualS(&ds->wmProtocolName, FF_WM_PROTOCOL_ANDROID)) | ||
{ | ||
//This fills in missing information about WM / DE by using env vars and iterating processes | ||
ffdsDetectWMDE(ds); | ||
} | ||
+ | ||
+ #ifdef __ANDROID__ | ||
+ if(ffStrbufEqualS(&ds->wmProtocolName, FF_WM_PROTOCOL_ANDROID)) | ||
+ { | ||
+ ffStrbufSetStatic(&ds->wmProcessName, "WindowManager"); | ||
+ ffStrbufSetStatic(&ds->wmPrettyName, "Window Manager"); | ||
+ | ||
+ if (!detectWithGetprop(ds)) | ||
+ detectWithDumpsys(ds); | ||
+ } | ||
+ #endif | ||
} | ||
|
||
FFDisplayType ffdsGetDisplayType(const char* name) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.