diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 37f2ad7..3108062 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -288,7 +288,7 @@ void on_sensitive_change_reversed(GtkWidget *self, GtkWidget *toggle) void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets) { int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); - + videoconfig.autoChooseDrivers=state; gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaLabel, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDCombo, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDLabel, !state); @@ -303,21 +303,34 @@ char *yon_configuration_get_save_command(char *command){ if (videoconfig.autoChooseDrivers==0){ if (strcmp(videoconfig.failsafenVidia, dntus)!=0) str = yon_char_get_augumented(str, yon_char_get_augumented(" FAILSAFENVIDIA=", videoconfig.failsafenVidia)); + else + str = yon_char_get_augumented(str," FAILSAFENVIDIA=\"\""); if (strcmp(videoconfig.failsafeATI, dntus)!=0) str = yon_char_get_augumented(str, yon_char_get_augumented(" FAILSAFEATI=", videoconfig.failsafeATI)); + else + str = yon_char_get_augumented(str," FAILSAFEATI=\"\""); + str=yon_char_get_augumented(str," VGADRV_AUTO=NO"); + } else { + str = yon_char_unite(str, " FAILSAFENVIDIA=\"\" FAILSAFEATI=\"\" VGADRV_AUTO=YES", NULL); + } if (strcmp(videoconfig.optirun, dntus)!=0&&strcmp(videoconfig.optirun, "")!=0) str = yon_char_get_augumented(str, yon_char_unite(" OPTIRUN=","\"",videoconfig.optirun,"\"",NULL)); + else + str = yon_char_get_augumented(str, yon_char_unite(" OPTIRUN=\"\"",NULL)); if (strcmp(videoconfig.primusrun, dntus)!=0&&strcmp(videoconfig.primusrun, "")!=0) str = yon_char_get_augumented(str, yon_char_unite(" PRIMUSRUN=","\"", videoconfig.primusrun,"\"",NULL)); + else + str = yon_char_get_augumented(str, yon_char_unite(" PRIMUSRUN=\"\"",NULL)); dictionary *dict=NULL; + for (int i=0;istringparameters){ - str=yon_char_unite(str," XORG_MONITOR[",dict->key,"]=\"",yon_dictionary_get_data(dict,monitorconfig*)->stringparameters,"\"", NULL); - - } + } } if (strcmp(str,command)!=0) @@ -348,8 +361,8 @@ char *yon_configuration_get_remove_command(char *command){ str = yon_char_get_augumented(str, " OPTIRUN"); str = yon_char_get_augumented(str, " PRIMUSRUN"); dictionary *dict=NULL; - for_dictionaries(dict,videoconfig.monitors){ - str = yon_char_get_augumented(str, yon_char_get_augumented(" ",XORG_MONITOR(dict->key))); + for(int i=0;iconfig){ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(window->templateMonitorscreenOverlay)),window->templateMonitorscreenOverlay); - yon_dictionary_rip(windowd); + videoconfig.monitor_visuals = yon_dictionary_rip(windowd); gtk_widget_destroy(window->templateMonitorscreenOverlay); - yon_dictionary_rip(window->config); + videoconfig.monitors = yon_dictionary_rip(window->config); free(window); } } @@ -898,7 +913,7 @@ void on_config_fill_interface(widgets_dict *widgets) str = videoconfig.failsafenVidia; gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), DONT_USE_LABEL); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), FBDEV_LABEL); - if (str) + if (str&&videoconfig.autoChooseDrivers==0) { gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeNvidiaCombo), 1); } @@ -909,12 +924,15 @@ void on_config_fill_interface(widgets_dict *widgets) str = videoconfig.failsafeATI; gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), DONT_USE_LABEL); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), FBDEV_LABEL); - if (str) + if (str&&videoconfig.autoChooseDrivers==0) { gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeAMDCombo), 1); } else gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeAMDCombo), 0); + if (videoconfig.autoChooseDrivers==1){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainDriverAutomaticallyChooseCheck),1); + } dictionary *dict = NULL; } @@ -943,6 +961,7 @@ dictionary *yon_proprieary_get(){ } } + /**void yon_gtk_list_store_fill_with_proprietaries(GtkListStore *list) * [EN] */ @@ -989,15 +1008,24 @@ void yon_setup_config(char *configcommand) videoconfig.configsize=0; videoconfig.loaded_config = yon_ubl_load_global_config(command, &videoconfig.configsize); char *param = NULL; + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"VGADRV_AUTO"); + if (param){ + yon_char_divide_search(param,"=",-1); + if (strcmp(param,"")!=0) + videoconfig.autoChooseDrivers=1; + + } param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"FAILSAFENVIDIA"); if (param){ yon_char_divide_search(param,"=",-1); + if (strcmp(param,"")!=0) videoconfig.failsafenVidia=yon_char_new(param); } param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"FAILSAFEATI"); if (param){ yon_char_divide_search(param,"=",-1); + if (strcmp(param,"")!=0) videoconfig.failsafeATI=yon_char_new(param); } @@ -1005,18 +1033,22 @@ void yon_setup_config(char *configcommand) if (param){ yon_char_divide_search(param,"=",-1); videoconfig.optirun=yon_char_remove_brackets(yon_char_new(param)); + if (strcmp(videoconfig.optirun,"")==0) videoconfig.optirun=NULL; } param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"PRIMUSRUN"); if (param){ yon_char_divide_search(param,"=",-1); videoconfig.primusrun=yon_char_remove_brackets(yon_char_new(param)); + if (strcmp(videoconfig.primusrun,"")==0) videoconfig.primusrun=NULL; } for (int i=0;i",DESCRIPTION_LABEL,": ",_(desc), + char *final_text = yon_char_unite("",DESCRIPTION_LABEL,": ",_(desc), "\n",VENDOR_LABEL,": ",vendor, "\n",MODEL_LABEL,": ",product, "\n",USED_KERNEL_DRIVER_LABEL,": ",driver_use, @@ -1448,6 +1480,7 @@ int main(int argc, char *argv[]) widgets_dict widgets; yon_setup_widgets(&widgets); yon_gtk_list_store_fill_with_proprietaries(videoconfig.list); + yon_gtk_list_store_fill_with_proprietaries(videoconfig.modulelist); gtk_widget_show(widgets.MainWindow); // yon_fill_ui(&widgets); videoconfig.status_render.text_to_render=LOCAL_LOAD_SUCCESS; diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index dcae947..5bd5184 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -41,11 +41,11 @@ #define load_drivers_command "/usr/bin/ubconfig --default --source " -#define load_drivers_global_command "/usr/bin/ubconfig --default --source global get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " +#define load_drivers_global_command "/usr/bin/ubconfig --default --source global get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN VGADRV_AUTO " #define save_drivers_global_command "/usr/bin/ubconfig --target global set video " -#define load_drivers_local_command "/usr/bin/ubconfig --default --source system get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " +#define load_drivers_local_command "/usr/bin/ubconfig --default --source system get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN VGADRV_AUTO " #define save_drivers_local_command "pkexec /usr/bin/ubconfig --target system set video " @@ -63,6 +63,8 @@ #define get_proprietary_drivers_command "LC_ALL=C pacman -Ss ubm-nvidia-.* |grep -oE \"[a-zA-Z-]{1,}-nvidia-[a-zA-Z0-9-]{1,}|installed\"|sed ':a;N;$!ba;s/\\ninstalled/ installed/g'" +#define get_proprietary_drivers_command "LC_ALL=C pacman -Ss ubm-nvidia-.* |grep -oE \"[a-zA-Z-]{1,}nvidia-[a-zA-Z0-9-]{1,}|installed\"|sed ':a;N;$!ba;s/\\ninstalled/ installed/g'" + #define get_adapter_info "lshw -c display -quiet |grep -oE \"vendor:[0-9a-zA-Z ]{1,}|description:[0-9a-zA-Z ]{1,}|product:[]0-9a-zA-Z [-]{1,}\"|sed 's/: /=/g';lspci | grep -E ' VGA | Display ' | cut -d\" \" -f 1 | xargs -i lspci -v -s {} |grep -oE \"Kernel[:a-zA-Z0-9: ]{1,}\"|sed 's/: /=/g'|sed 's/ /_/g'" #define XORG_MONITOR(port) yon_char_get_augumented(" XORG_MONITOR[",yon_char_get_augumented(port,"] ")) @@ -103,6 +105,7 @@ typedef struct proprietary_config proprietary; dictionary *supported_resolutions; GtkListStore *list; + GtkListStore *modulelist; char *failsafenVidia; char *failsafeATI; int descreteOnly; diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 151d208..5784a10 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -266,7 +266,8 @@ dictionary *yon_dictionary_find(dictionary **dict, char *key) dictionary *yon_dictionary_rip(dictionary *dict) { - if (!dict->next) + if (!dict->next&&!dict->prev) return NULL; + else if (!dict->next) { dictionary *prev = dict->prev; if (prev) diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 9981421..e379c61 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -174,7 +174,7 @@ 1.2 Copyright © 2023 - UBSoft Software LLC Settings for video output - https://ublinux.ru/ + https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-video Project Home Page Это приложение распространяется без каких-либо гарантий. Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. @@ -1532,7 +1532,7 @@ False 5 5 - 12 + 5 5 @@ -1545,7 +1545,6 @@ True False 5 - 5 True @@ -1586,7 +1585,7 @@ False 5 5 - 12 + 5 5