Skip to content

Commit

Permalink
fix(frzr): handle more disk types and update to Godot v4.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Feb 4, 2024
1 parent f78b802 commit 2564d99
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions assets/themes/chimera_theme.tres
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ corner_radius_bottom_left = 5
[resource]
Button/styles/hover = SubResource("StyleBoxFlat_gs8jf")
Button/styles/normal = SubResource("StyleBoxFlat_p3csy")
Dialog/base_type = &"PanelContainer"
Dialog/styles/panel = SubResource("StyleBoxFlat_xapbx")
PanelContainer/styles/panel = SubResource("StyleBoxFlat_k1e5x")
ProgressBar/styles/background = SubResource("StyleBoxFlat_v38kh")
2 changes: 2 additions & 0 deletions core/systems/frzr/frzr.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func get_available_disks() -> Array[Disk]:
if not line.contains("disk"):
continue
var parts := line.split(" ", false, 3)
if parts.size() < 4:
continue
var disk := Disk.new()
disk.name = parts[0]
disk.path = "/dev/" + disk.name
Expand Down
36 changes: 36 additions & 0 deletions core/ui/menus/network_menu.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
extends Control


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print(RenderingServer.get_video_adapter_name())
print(RenderingServer.get_video_adapter_type())
print(await get_current_card_device())

func get_current_card_device() -> String:
var cmd := Command.new("glxinfo")
cmd.dry_run = false
if await cmd.execute() != OK:
return ""

for line in cmd.stdout.split("\n"):
if not "Device: " in line:
continue

# Match on the last part of the string to get the device ID
# E.g. Device: AMD Radeon Graphics (renoir, LLVM 16.0.6, DRM 3.54, 6.5.5-arch1-1) (0x1636)
var regex := RegEx.new()
regex.compile("\\(0[xX][0-9a-fA-F]+\\)$")
var result := regex.search(line)
if not result:
continue
var match_str := result.get_string()

return match_str.replace("0x", "").replace(")", "")

return ""


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
5 changes: 4 additions & 1 deletion core/ui/menus/network_menu.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[gd_scene format=3 uid="uid://bv456bg77othn"]
[gd_scene load_steps=2 format=3 uid="uid://bv456bg77othn"]

[ext_resource type="Script" path="res://core/ui/menus/network_menu.gd" id="1_krc2r"]

[node name="NetworkMenu" type="Control"]
layout_mode = 3
Expand All @@ -7,3 +9,4 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_krc2r")
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ config_version=5

config/name="ChimeraOS Installer"
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.1", "GL Compatibility")
config/features=PackedStringArray("4.2", "GL Compatibility")
boot_splash/show_image=false
config/icon="res://icon.svg"

Expand Down

0 comments on commit 2564d99

Please sign in to comment.