@@ -1248,22 +1248,24 @@ create_name_desktop () {
1248
1248
1249
1249
# Конвертация секунд в дни, часы, минуты
1250
1250
seconds_to_time () {
1251
- [[ ! $DESKTOP_WITH_TIME == enabled ]] && return 0
1251
+ [[ $DESKTOP_WITH_TIME == " disabled " ]] && return 0
1252
1252
[[ -z $1 ]] && return 0
1253
1253
local seconds days hours minutes
1254
1254
seconds=$1
1255
1255
1256
- days=$(( seconds / (60 * 60 * 24 )) )
1257
- seconds=$(( seconds % (60 * 60 * 24 )) )
1256
+ if [[ $DESKTOP_WITH_TIME == " posnumber2" ]] ; then
1257
+ days=$(( seconds / (60 * 60 * 24 )) )
1258
+ seconds=$(( seconds % (60 * 60 * 24 )) )
1259
+ fi
1258
1260
1259
1261
hours=$(( seconds / (60 * 60 )) )
1260
1262
seconds=$(( seconds % (60 * 60 )) )
1261
1263
1262
1264
minutes=$(( seconds / 60 ))
1263
1265
seconds=$(( seconds % 60 ))
1264
1266
1265
- if [[ $days =~ ^0$ ]] ; then
1266
- days=
1267
+ if [[ $days == " 0 " ]] ; then
1268
+ days=" "
1267
1269
elif [[ $days =~ ^1$ ]] ; then
1268
1270
days=" $days ${translations[day]} , "
1269
1271
elif [[ $days =~ ^([2-9]1| [1-9][0-9]+1)$ ]] && [[ $LANGUAGE == ru ]] ; then
@@ -1274,26 +1276,29 @@ seconds_to_time () {
1274
1276
days=" $days ${translations[days]} , "
1275
1277
fi
1276
1278
1277
- if [[ $hours =~ ^0$ ]] ; then
1278
- hours=
1279
+ if [[ $hours == " 0 " ]] ; then
1280
+ hours=" "
1279
1281
elif [[ $hours =~ ^1$ ]] ; then
1280
1282
hours=" $hours ${translations[hour]} ${translations[and]} "
1281
- elif [[ $hours =~ ^( [2-4]| 2 [2-4]) $ ]] && [[ $LANGUAGE == ru ]] ; then
1283
+ elif [[ $hours =~ [2-4]$ && ! $hours =~ ^1 [2-4]$ ]] && [[ $LANGUAGE == ru ]] ; then
1282
1284
hours=" $hours часа ${translations[and]} "
1283
- elif [[ $hours =~ ^21 $ ]] && [[ $LANGUAGE == ru ]] ; then
1285
+ elif [[ $hours =~ 1$ && ! $hours =~ 11 $ ]] && [[ $LANGUAGE == ru ]] ; then
1284
1286
hours=" $hours ${translations[hour]} ${translations[and]} "
1285
1287
else
1286
1288
hours=" $hours ${translations[hours]} ${translations[and]} "
1287
1289
fi
1288
1290
1289
- if [[ $minutes =~ ^0$ ]] ; then
1290
- hours=${hours// " ${translations[and]} " / }
1291
- minutes=
1292
- if [[ -z $days ]] || [[ -z $hours ]] ; then
1293
- days=${days// " ," / }
1294
- fi
1295
- if [[ -z $days ]] && [[ -z $hours ]] ; then
1291
+ if [[ $minutes == " 0" ]] ; then
1292
+ minutes=" "
1293
+ if [[ $DESKTOP_WITH_TIME == " posnumber1" && -z $hours ]] \
1294
+ || [[ $DESKTOP_WITH_TIME == " posnumber2" && -z $days && -z $hours ]]; then
1296
1295
minutes=" ${translations[less than a minute]} "
1296
+ else
1297
+ hours=${hours// " ${translations[and]} " / }
1298
+ if [[ $DESKTOP_WITH_TIME == " posnumber2" ]] \
1299
+ && [[ -z $days || -z $hours ]] ; then
1300
+ days=${days// " ," / }
1301
+ fi
1297
1302
fi
1298
1303
elif [[ $minutes =~ ^1$ ]] ; then
1299
1304
minutes=" $minutes ${translations[minute]} "
@@ -1305,7 +1310,11 @@ seconds_to_time () {
1305
1310
minutes=" $minutes ${translations[minutes]} "
1306
1311
fi
1307
1312
1308
- echo -e " <b>\n${translations[Time spent]} : $days$hours$minutes </b>"
1313
+ if [[ $DESKTOP_WITH_TIME == " posnumber1" ]] ; then
1314
+ echo -e " <b>\n${translations[Time spent]} : $hours$minutes </b>"
1315
+ elif [[ $DESKTOP_WITH_TIME == " posnumber2" ]] ; then
1316
+ echo -e " <b>\n${translations[Time spent]} : $days$hours$minutes </b>"
1317
+ fi
1309
1318
}
1310
1319
1311
1320
combobox_fix () {
@@ -6015,10 +6024,10 @@ gui_userconf () {
6015
6024
GPU_VAR=" disabled"
6016
6025
fi
6017
6026
6018
- if [[ -n " $DESKTOP_WITH_TIME " ]] \
6019
- && [[ " $DESKTOP_WITH_TIME " != " disabled " ]]
6020
- then
6021
- DESKTOP_WITH_TIME=" enabled "
6027
+ if [[ $DESKTOP_WITH_TIME == " posnumber1 " ]] ; then
6028
+ DESKTOP_WITH_TIME= ${translations[Show in hours and minutes]}
6029
+ elif [[ $DESKTOP_WITH_TIME == " posnumber2 " ]] ; then
6030
+ DESKTOP_WITH_TIME=${translations[Show in days, hours, minutes]}
6022
6031
else
6023
6032
DESKTOP_WITH_TIME=" disabled"
6024
6033
fi
@@ -6042,9 +6051,9 @@ gui_userconf () {
6042
6051
YAD_DPI_VAR=" disabled"
6043
6052
fi
6044
6053
6045
- if [[ $GUI_THEME == default ]] ; then GUI_THEME=${translations[default]}
6046
- elif [[ $GUI_THEME == compact ]] ; then GUI_THEME=${translations[compact]}
6047
- elif [[ $GUI_THEME == classic ]] ; then GUI_THEME=${translations[classic]}
6054
+ if [[ $GUI_THEME == " default" ]] ; then GUI_THEME=${translations[default]}
6055
+ elif [[ $GUI_THEME == " compact" ]] ; then GUI_THEME=${translations[compact]}
6056
+ elif [[ $GUI_THEME == " classic" ]] ; then GUI_THEME=${translations[classic]}
6048
6057
fi
6049
6058
6050
6059
if command -v gsettings & > /dev/null ; then
@@ -6064,7 +6073,7 @@ gui_userconf () {
6064
6073
--field=" ${translations[Choice wine audio driver]} !${translations[Fixes sound popling if choice alsa]} :CB" " $( combobox_fix --disabled " $SOUND_DRIVER_VAR " " alsa!oss!pulse" ) " \
6065
6074
--field=" ${translations[Select PortProton theme]} !${translations[Allows you to select a theme for PortProton]} :CB" " $( combobox_fix " $GUI_THEME " " ${translations[default]} !${translations[compact]} !${translations[classic]} " ) " \
6066
6075
--field=" ${translations[Select gtk theme]} !${translations[Allows you to select a theme for GTK.]} :CB" " $( combobox_fix " $GTK_THEME " " ${YAD_GTK_THEME} Adwaita:${translations[light]} !Adwaita:${translations[dark]} !${translations[default]} " ) " \
6067
- --field=" ${translations[Time display]} !${translations[Displays time spent in an application or game]} :CB" " $( combobox_fix --disabled " $DESKTOP_WITH_TIME " " enabled " ) " \
6076
+ --field=" ${translations[Time display]} !${translations[Displays time spent in an application or game]} :CB" " $( combobox_fix --disabled " $DESKTOP_WITH_TIME " " ${translations[Show in hours and minutes]} ! ${translations[Show in days, hours, minutes]} " ) " \
6068
6077
--field=" ${translations[Sort shortcuts by time]} !${translations[This setting sorts the shortcuts in the main menu depending on the time spent in the application or game]} :CB" " $( combobox_fix --disabled " $SORT_WITH_TIME " " enabled" ) " \
6069
6078
1> " ${PW_TMPFS_PATH} /tmp_yad_userconf_set_cb" 2> /dev/null &
6070
6079
@@ -6116,6 +6125,9 @@ gui_userconf () {
6116
6125
elif [[ $GTK_THEME =~ ${translations[light]} ]] ; then GTK_THEME=${GTK_THEME// ${translations[light]} / light}
6117
6126
elif [[ $GTK_THEME =~ ${translations[dark]} ]] ; then GTK_THEME=${GTK_THEME// ${translations[dark]} / dark}
6118
6127
fi
6128
+ if [[ $DESKTOP_WITH_TIME == " ${translations[Show in hours and minutes]} " ]] ; then DESKTOP_WITH_TIME=" posnumber1"
6129
+ elif [[ $DESKTOP_WITH_TIME == " ${translations[Show in days, hours, minutes]} " ]] ; then DESKTOP_WITH_TIME=" posnumber2"
6130
+ fi
6119
6131
6120
6132
edit_user_conf_from_gui PW_GPU_USE PW_WINE_DPI_VALUE PW_SOUND_DRIVER_USE GUI_THEME GTK_THEME DESKTOP_WITH_TIME SORT_WITH_TIME
6121
6133
restart_pp
0 commit comments