-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
511d74f
commit cb26653
Showing
3 changed files
with
40 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# Framework-System-Details | ||
|
||
Go to Activities, search for Framework System Details, launch the application. This will tell you the BIOS version your using, your CPU version (11th or 12th Gen), and of course your kernel version on Ubuntu 22.04. | ||
|
||
Running | ||
|
||
sudo python3 bios-checker.py | ||
|
||
will show the following window. | ||
|
||
![screenshot](screenshot.png) |
This file contains 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 |
---|---|---|
@@ -1,26 +1,43 @@ | ||
import subprocess | ||
import gi | ||
"""Show system details such as BIOS version, CPU version and kernel version.""" | ||
|
||
gi.require_version('Gtk', '3.0') | ||
from gi.repository import Gtk, Pango | ||
from subprocess import check_output | ||
from gi import require_version | ||
require_version('Gtk', '3.0') | ||
from gi.repository import Gtk # nopep8 # noqa: E402 # pylint: disable=C0413 | ||
|
||
# Set locale to US English so output matches the expected strings | ||
# Set locale to US English so output matches the expected strings. | ||
env = {"LC_ALL": "en_US.utf8"} | ||
|
||
# Function to run a command with pkexec | ||
def run_with_pkexec(cmd): | ||
return subprocess.check_output(['pkexec', 'sh', '-c', cmd], env=env) | ||
|
||
# Run the commands and store their output in variables | ||
def run_with_pkexec(cmd: str) -> bytes: | ||
"""Run a command with pkexec. | ||
:param cmd: The command to run. | ||
:return: The output of the command. | ||
""" | ||
return check_output(['pkexec', 'sh', '-c', cmd], env=env) | ||
|
||
|
||
# Run the commands and store their output in variables. | ||
bios_info = run_with_pkexec("dmidecode | grep -A3 'Vendor:'") | ||
cpu_info = subprocess.check_output("lshw -C cpu | grep -A3 'product:'", shell=True, env=env) | ||
kernel_version = subprocess.check_output("uname -r", shell=True, env=env) | ||
cpu_info = check_output("lshw -C cpu | grep -A3 'product:'", shell=True, | ||
env=env) | ||
kernel_version = check_output("uname -r", shell=True, env=env) | ||
|
||
# Create a GTK dialog window with larger text and a bigger size | ||
dialog = Gtk.MessageDialog(parent=None, flags=0, message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, text="Framework System Details") | ||
dialog.set_markup("<span size='xx-large' weight='bold'>BIOS Information:</span>\n{}\n<span size='xx-large' weight='bold'>CPU Information:</span>\n{}\n<span size='xx-large' weight='bold'>Kernel Version:</span> {}".format(bios_info.decode(), cpu_info.decode(), kernel_version.decode())) | ||
# Create a GTK dialog window with larger text and a bigger size. | ||
dialog = Gtk.MessageDialog(parent=None, flags=0, | ||
message_type=Gtk.MessageType.INFO, | ||
buttons=Gtk.ButtonsType.OK, | ||
text="Framework System Details") | ||
markup = f"""<span size='xx-large' weight='bold'>BIOS Information:</span> | ||
{bios_info.decode()} | ||
<span size='xx-large' weight='bold'>CPU Information:</span> | ||
{cpu_info.decode()} | ||
<span size='xx-large' weight='bold'>Kernel Version:</span> | ||
{kernel_version.decode()}""" | ||
print(markup) | ||
dialog.set_markup(markup) | ||
dialog.format_secondary_markup(None) | ||
dialog.set_size_request(600, 400) | ||
dialog.run() | ||
dialog.destroy() | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.