Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
System Monitoring Center
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Kayıtlar (commit)
Kenar çubuğunu aç
Hakan Dündar
System Monitoring Center
Commits
316a5ecc
Kaydet (Commit)
316a5ecc
authored
Haz 20, 2022
tarafından
Hakan Dündar
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix: Screen resolution for modified screen scale factors
üst
eca22200
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
Gpu.py
src/Gpu.py
+18
-4
No files found.
src/Gpu.py
Dosyayı görüntüle @
316a5ecc
...
...
@@ -626,9 +626,22 @@ class Gpu:
# ----------------------- Get screen resolution and refresh rate -----------------------
def
gpu_resolution_refresh_rate_func
(
self
):
# Get current
resolution
# Get current
screen.
current_screen
=
Gdk
.
Screen
.
get_default
()
current_resolution
=
str
(
current_screen
.
get_width
())
+
"x"
+
str
(
current_screen
.
get_height
())
# Get current screen resolution.
try
:
xrandr_output
=
(
subprocess
.
check_output
([
"xrandr"
],
shell
=
False
))
.
decode
()
.
strip
()
xrandr_output_lines
=
xrandr_output
.
split
(
"
\n
"
)
if
"Screen 1:"
not
in
xrandr_output
:
for
line
in
xrandr_output_lines
:
if
"Screen 0:"
in
line
:
current_resolution
=
''
.
join
(
line
.
split
(
"current"
)[
1
]
.
split
(
","
)[
0
]
.
strip
()
.
split
(
" "
))
except
Exception
:
xrandr_output
=
"-"
current_resolution
=
"-"
if
current_resolution
==
"-"
:
current_resolution
=
str
(
current_screen
.
get_width
())
+
"x"
+
str
(
current_screen
.
get_height
())
# Get current refresh rate
try
:
...
...
@@ -642,8 +655,9 @@ class Gpu:
# If refresh rate is not get or it is smaller than 30 (incorrect values such as 1, 2.14 are get on some systems such as RB-Pi devices), get it by using xrandr (if there is only one monitor connected).
if
current_refresh_rate
==
"Unknown"
or
current_refresh_rate
<
30
:
try
:
xrandr_output
=
(
subprocess
.
check_output
([
"xrandr"
],
shell
=
False
))
.
decode
()
.
strip
()
xrandr_output_lines
=
xrandr_output
.
split
(
"
\n
"
)
if
xrandr_output
==
"-"
:
xrandr_output
=
(
subprocess
.
check_output
([
"xrandr"
],
shell
=
False
))
.
decode
()
.
strip
()
xrandr_output_lines
=
xrandr_output
.
split
(
"
\n
"
)
number_of_monitors
=
xrandr_output
.
count
(
" connected"
)
if
number_of_monitors
==
1
:
for
line
in
xrandr_output_lines
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment