Repository navigation
Expand file tree
/
Copy pathclass_gui.py
More file actions
executable file
·1736 lines (1457 loc) · 70.8 KB
/
Copy pathclass_gui.py
File metadata and controls
executable file
·1736 lines (1457 loc) · 70.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""
Cryptorial's Lazy Arch Setup Script (CLASS) - Graphical GTK4 Wizard
Developed by Cryptorial
"""
import sys
import os
import json
import subprocess
import threading
import argparse
import gi
gi.require_version("Gtk", "4.0")
from gi.repository import Gtk, GLib, Pango, Gdk
# -------------------------------------------------------------
# Desktop Environment & GPU Hardware Auto-Detection
# -------------------------------------------------------------
def get_desktop_environment():
xdg_current = os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
session_desktop = os.environ.get("XDG_SESSION_DESKTOP", "").lower()
combined = f"{xdg_current} {session_desktop}"
if "kde" in combined or "plasma" in combined:
return "kde"
elif "gnome" in combined:
return "gnome"
elif "cinnamon" in combined:
return "cinnamon"
return "other"
def detect_gpus():
detected_gpus = []
gpu_pkgs = set()
try:
lspci_out = subprocess.check_output("lspci -k", shell=True, text=True, stderr=subprocess.DEVNULL)
except Exception:
lspci_out = ""
vga_lines = [
line for line in lspci_out.splitlines()
if any(kw in line for kw in ["VGA compatible controller", "3D controller", "Display controller"])
]
combined_text = "\n".join(vga_lines).lower()
has_amd = any(kw in combined_text for kw in ["amd", "advanced micro devices", "ati"])
has_nvidia = "nvidia" in combined_text
has_intel = "intel" in combined_text
# Fallback to sysfs vendor IDs if lspci is empty or unavailable
if not (has_amd or has_nvidia or has_intel):
for vpath in ["/sys/class/drm/card0/device/vendor", "/sys/class/drm/card1/device/vendor"]:
if os.path.exists(vpath):
try:
with open(vpath) as f:
vid = f.read().strip()
if vid == "0x1002": has_amd = True
elif vid == "0x10de": has_nvidia = True
elif vid == "0x8086": has_intel = True
except Exception:
pass
if has_amd:
detected_gpus.append("AMD Radeon (Mesa / RADV)")
gpu_pkgs.update(["vulkan-radeon", "lib32-vulkan-radeon", "mesa", "lib32-mesa"])
if has_nvidia:
detected_gpus.append("NVIDIA (Proprietary Drivers)")
res = subprocess.run(["pacman", "-Qq", "nvidia-utils"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if res.returncode == 0:
gpu_pkgs.update(["lib32-nvidia-utils", "nvidia-settings"])
else:
gpu_pkgs.update(["nvidia", "nvidia-utils", "lib32-nvidia-utils", "nvidia-settings"])
if has_intel:
detected_gpus.append("Intel Graphics (Mesa / Vulkan / Arc)")
gpu_pkgs.update(["mesa", "lib32-mesa", "vulkan-intel", "lib32-vulkan-intel", "intel-media-driver"])
if not detected_gpus:
detected_gpus.append("Generic / Virtual GPU (Mesa)")
gpu_pkgs.update(["mesa", "lib32-mesa"])
return " + ".join(detected_gpus), sorted(gpu_pkgs)
# -------------------------------------------------------------
# Configuration Data (Faithfully retrieved from Arch / AUR)
# -------------------------------------------------------------
EMULATOR_PKGS_SET = {
"pcsx2-git", "rpcs3-git", "dolphin-emu", "ppsspp",
"retroarch", "mame", "duckstation-gpl", "eden-git"
}
# Categories ordered with Emulators as the last category
BASE_CATEGORIES = [
(
"Gaming & Compatibility",
[
("steam", "Steam", "Valve's digital software delivery platform & store"),
("gamescope", "Gamescope", "SteamOS session compositing micro-compositor window manager"),
("protonplus", "ProtonPlus", "Modern compatibility tools manager for Proton, Wine, and GE"),
("protonup-qt", "ProtonUp-Qt", "Install and manage GE-Proton, Luxtorpeda & custom tools"),
("winetricks", "Winetricks", "Script to install runtime libraries and workarounds in Wine"),
("protontricks", "Protontricks", "Wrapper to run Winetricks commands for Steam Play/Proton games"),
("hydra-launcher-bin", "Hydra Launcher", "Open-source gaming platform to manage your game library"),
("xodus-nexus-bin", "Xodus Nexus", "Xbox-inspired launcher for Microsoft Store PC games on Linux"),
("portproton", "PortProton", "Software for playing Windows games and emulators with Proton"),
("r2modman-bin", "r2modman", "Thunderstore mod manager for Unity and Steam games"),
("prismlauncher", "Prism Launcher", "Minecraft launcher with multi-instance & modpack support"),
]
),
(
"Performance, Overlays & Hardware",
[
("gamemode", "GameMode", "Feral Interactive daemon to optimize system performance on demand"),
("goverlay", "Goverlay", "GUI to configure Vulkan/OpenGL overlays (auto-installs preview tools)"),
("mangohud", "MangoHud", "Vulkan & OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load"),
("mangojuice", "MangoJuice", "Companion launcher helper for configuring MangoHud"),
("vkbasalt", "vkBasalt", "Vulkan post-processing layer (CAS, FXAA, SMAA, deband)"),
("corectrl", "CoreCtrl", "Hardware performance control application for CPU and GPU"),
("lact", "LACT", "Linux AMDGPU controller and overclocking GUI"),
("openrgb", "OpenRGB", "Open-source RGB lighting control without vendor software"),
]
),
(
"Communication & Social",
[
("discord", "Discord", "All-in-one voice, video, and text communication platform"),
("zapzap", "ZapZap", "WhatsApp desktop application written in PyQt6"),
("rootapp-bin", "Root App", "Discord alternative for gaming communities and groups"),
]
),
(
"Media, Audio & Recording",
[
("vice-clipper", "Vice Clipper", "Medal.tv-style game clip recorder for Linux: instant replay and session recording"),
("vlc", "VLC Media Player", "Free and open-source cross-platform multimedia player"),
("stremio", "Stremio", "One-stop video streaming hub for movies, series, and channels"),
("spotify", "Spotify", "Desktop digital music streaming service client"),
("parabolic", "Parabolic", "Web video and audio media downloader"),
("losslesscut-bin", "LosslessCut", "Cross-platform GUI tool for lossless video/audio trimming"),
("songrec", "Songrec", "Open-source, unofficial Shazam audio identifier client"),
]
),
(
"Productivity, Utilities & System",
[
("baobab", "Baobab", "Graphical disk usage analyzer and directory tree browser"),
("flatseal", "Flatseal", "Permissions manager for Flatpak applications"),
("ventoy-bin", "Ventoy USB", "Bootable multi-ISO USB creator solution"),
("kdeconnect", "KDE Connect", "Seamless wireless phone and desktop integration"),
("localsend-bin", "LocalSend", "Cross-platform local network file sharing (AirDrop alternative)"),
("iriunwebcam-bin", "Iriun Webcam", "Use your phone's camera as a wireless webcam on PC"),
("qbittorrent", "qBittorrent", "Fast, lightweight BitTorrent client in Qt and C++"),
("btop", "btop", "Modern terminal resource monitor and process viewer"),
("fastfetch", "fastfetch", "Feature-rich and performance-oriented system information tool"),
("bazaar", "Bazaar", "Modern application store for Flatpaks and Flathub"),
]
),
(
"Emulators & Retro Gaming",
[
("pcsx2-git", "PCSX2", "PlayStation 2 emulator"),
("rpcs3-git", "RPCS3", "PlayStation 3 emulator"),
("dolphin-emu", "Dolphin", "GameCube and Wii emulator"),
("ppsspp", "PPSSPP", "PlayStation Portable (PSP) emulator written in C++"),
("retroarch", "RetroArch", "Reference frontend for libretro multi-system emulation"),
("mame", "MAME", "Multiple Arcade Machine Emulator using SDL with OpenGL support"),
("duckstation-gpl", "DuckStation", "Fast PlayStation 1 (PSX) emulator focusing on playability and speed"),
("eden-git", "Eden", "Nintendo Switch emulator fork"),
]
),
]
def get_categorized_apps():
categories = []
de = get_desktop_environment()
for cat_name, items in BASE_CATEGORIES:
new_items = list(items)
if cat_name == "Productivity, Utilities & System" and de in ("kde", "gnome"):
new_items.insert(0, ("waywallen", "Waywallen", "Wallpaper manager for Wayland (with display daemon & DE plugin)"))
categories.append((cat_name, new_items))
return categories
# Strict browser selection list
BROWSERS = [
("brave-origin-bin", "Brave Origin (Recommended)", "The minimalist browser from the makers of Brave"),
("firefox", "Firefox", "Fast, private and safe open-source browser by Mozilla"),
("chromium", "Chromium", "Open-source web browser project developed by Google"),
("vivaldi", "Vivaldi", "Advanced, feature-rich browser built for power users"),
("other", "Other (Search Repositories / AUR)", "Search and install any browser package"),
]
# Curated browser extensions list
BROWSER_EXTENSIONS = [
(
"return-youtube-dislike",
"Return YouTube Dislike",
"Restores the dislike count display on YouTube videos",
"gebbhagfogifgggkldgodflihgfeippi",
"{762f9885-5a13-4abd-9c77-433dcd38b8fd}",
"https://addons.mozilla.org/firefox/downloads/latest/return-youtube-dislikes/latest.xpi",
True
),
(
"sponsorblock",
"SponsorBlock",
"Skip sponsor segments, intros, outros, and subscription reminders on YouTube",
"mnjggcdmjocbbbhaepdhchncahnbgone",
"sponsorBlocker@ajay.app",
"https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi",
True
),
(
"adblock-for-youtube",
"Adblock for YouTube",
"Removes pre-roll video ads, banners, and popups on YouTube",
"cmedhionkhpnakcndndgjdbohmhepckk",
"jid1-q4sG8pYhq8KGHs@jetpack",
"https://addons.mozilla.org/firefox/downloads/latest/adblock-for-youtube/latest.xpi",
True
),
(
"darkreader",
"Dark Reader",
"Inverts brightness and applies high-contrast dark themes to every website",
"eimadpbcbfnmbkopoojfekhnkhdbieeh",
"addon@darkreader.org",
"https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi",
True
),
(
"consent-o-matic",
"Consent-O-Matic",
"Automatically fills out and rejects GDPR / ePrivacy cookie popups in the background",
"mljpablpbeekflopdjnioimmkigebmhi",
"gdpr@cavi.au.dk",
"https://addons.mozilla.org/firefox/downloads/latest/consent-o-matic/latest.xpi",
True
),
(
"adnauseam",
"AdNauseam",
"Blocks ads while clicking them in the background to obfuscate your browsing profile",
"",
"adnauseam@rednoise.org",
"https://addons.mozilla.org/firefox/downloads/latest/adnauseam/latest.xpi",
True
),
(
"microsoft-to-microslop",
"Microsoft to Microslop",
"Replaces every visual occurrence of 'Microsoft' on web pages with 'Microslop'",
"hlkljlkdinjnbfmclionhbefbnefcgll",
"microsoft-to-microslop@example.com",
"https://addons.mozilla.org/firefox/downloads/latest/microsoft-to-microslop/latest.xpi",
True
),
(
"hola-vpn",
"Hola VPN",
"Website unblocker and proxy extension",
"gkojfkhlekighikafcpjkiklfbnlmeio",
"",
"",
True
),
]
# Flatpak applications section
FLATPAK_APPS = [
(
"com.dec05eba.gpu_screen_recorder",
"GPU Screen Recorder (GSR)",
"A shadowplay-like screen recorder for Linux with instant replay and minimal performance overhead",
True # Selected by default, can be ticked off
),
]
# Custom Setup & Management Scripts section (Optional / Opt-in)
SCRIPTS = [
(
"slssteam",
"SLSsteam Manager (slssteam)",
"CLI manager and auto-updater for SLSsteam. Unlocks DLCs and manages achievements for Steam and Flatpak Steam.",
False # Opt-in by default
),
(
"vencord",
"Vencord Discord Mod (vencord)",
"Automated installer and restarter utility for the Vencord client enhancement suite on Discord.",
False # Opt-in by default
),
(
"fix-ntfs",
"NTFS Disk Repair & Auto-Mounter (fix-ntfs)",
"Repairs dirty/unmountable NTFS drives, resets journal flags via ntfsfix, and permanently configures udisks2 for forced mounting.",
False # Opt-in by default
),
]
# -----------------------------
# UI Helpers (Safe Markup Escaping - Prevents Empty Labels)
# -----------------------------
def make_check_button(title, desc="", group=None):
btn = Gtk.CheckButton()
lbl = Gtk.Label()
safe_title = GLib.markup_escape_text(title)
if desc:
safe_desc = GLib.markup_escape_text(desc)
lbl.set_markup(f"<b>{safe_title}</b>\n<span size='small' alpha='65%'>{safe_desc}</span>")
else:
lbl.set_markup(f"<b>{safe_title}</b>")
lbl.set_xalign(0)
lbl.set_wrap(True)
btn.set_child(lbl)
if group is not None:
btn.set_group(group)
return btn
def load_custom_css():
css = Gtk.CssProvider()
css_data = """
progressbar.large-progress > trough {
min-height: 24px;
border-radius: 8px;
}
progressbar.large-progress > trough > progress {
min-height: 24px;
border-radius: 8px;
}
textview.log-viewer text {
background-color: #181825;
color: #cdd6f4;
font-family: monospace;
font-size: 10pt;
}
"""
try:
css.load_from_string(css_data)
except AttributeError:
css.load_from_data(css_data.encode("utf-8"))
display = Gdk.Display.get_default()
if display:
Gtk.StyleContext.add_provider_for_display(
display, css, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
# -----------------------------
# Main Application Window
# -----------------------------
class CLASSWizardWindow(Gtk.ApplicationWindow):
def __init__(self, app, output_file, status_file=None):
super().__init__(application=app)
self.output_file = output_file
self.status_file = status_file
self.set_title("Cryptorial's Lazy Arch Setup Script (CLASS)")
# Spacious, open, comfortable window size
self.set_default_size(940, 720)
# Hardware Auto-Detection
self.gpu_display_name, self.detected_gpu_pkgs = detect_gpus()
# State storage
self.install_gpu_drivers = False
self.selected_browser = "brave-origin-bin"
self.selected_extensions = {ext_id for ext_id, _, _, _, _, _, default_active in BROWSER_EXTENSIONS if default_active}
self.selected_apps = set()
self.selected_flatpaks = {pkg for pkg, _, _, default_active in FLATPAK_APPS if default_active}
self.selected_scripts = {s_id for s_id, _, _, default_active in SCRIPTS if default_active}
self.queued_aur = set()
# Step tracking:
# 0: Drivers (1/6), 1: Browser (2/6), 2: Extensions (3/6), 3: Apps (4/6), 4: Flatpaks (5/6), 5: Scripts (6/6), 6: Summary
self.current_step = 0
self.total_steps = 7
self.is_installing = False
# Connect window close (titlebar X) to cleanly halt the setup
self.connect("close-request", self.on_window_close_request)
self.build_ui()
def build_ui(self):
root_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
self.set_child(root_box)
# Header Title Area
header_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=4)
header_box.set_margin_top(18)
header_box.set_margin_bottom(14)
header_box.set_margin_start(32)
header_box.set_margin_end(32)
# Top row: Titles on left, Halt Cross Button on dead right
top_row = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
top_row.set_hexpand(True)
titles_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=4)
titles_box.set_hexpand(True)
titles_box.set_halign(Gtk.Align.START)
self.title_label = Gtk.Label()
self.title_label.set_halign(Gtk.Align.START)
self.title_label.set_markup("<span size='x-large' weight='bold'>Cryptorial's Lazy Arch Setup Script</span>")
titles_box.append(self.title_label)
self.subtitle_label = Gtk.Label()
self.subtitle_label.set_halign(Gtk.Align.START)
self.subtitle_label.set_markup(f"<span size='small' alpha='65%'>Auto-detected GPU: <b>{self.gpu_display_name}</b> | Driver packages ready</span>")
titles_box.append(self.subtitle_label)
top_row.append(titles_box)
# Cross button in top right that halts the whole thing
self.btn_halt = Gtk.Button(label="X")
self.btn_halt.set_tooltip_text("Halt Setup and Exit")
self.btn_halt.set_halign(Gtk.Align.END)
self.btn_halt.set_valign(Gtk.Align.START)
self.btn_halt.set_size_request(38, 38)
self.btn_halt.add_css_class("destructive-action")
self.btn_halt.connect("clicked", self.on_halt_clicked)
top_row.append(self.btn_halt)
header_box.append(top_row)
# Progress bar for wizard steps
self.wizard_prog_bar = Gtk.ProgressBar()
self.wizard_prog_bar.set_fraction(1.0 / self.total_steps)
self.wizard_prog_bar.set_margin_top(10)
header_box.append(self.wizard_prog_bar)
root_box.append(header_box)
# Separator
sep1 = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
root_box.append(sep1)
# Content Area - Gtk.Stack for smooth page transitions
self.stack = Gtk.Stack()
self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
self.stack.set_vexpand(True)
self.stack.set_hexpand(True)
self.stack.set_margin_start(32)
self.stack.set_margin_end(32)
self.stack.set_margin_top(16)
self.stack.set_margin_bottom(12)
root_box.append(self.stack)
# Build each page:
# GPU Drivers -> Browser -> Browser Extensions -> Applications -> Flatpaks -> Scripts -> Summary -> Installation Progress
self.build_drivers_page()
self.build_browser_page()
self.build_extensions_page()
self.build_apps_page()
self.build_flatpaks_page()
self.build_scripts_page()
self.build_summary_page()
self.build_progress_page()
# Separator
sep2 = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
root_box.append(sep2)
# Bottom Navigation Bar
# Layout rule: Previous dead left, Skip dead center, Next dead right
nav_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
nav_box.set_margin_top(16)
nav_box.set_margin_bottom(18)
nav_box.set_margin_start(32)
nav_box.set_margin_end(32)
# Left box: Previous (Dead Left)
self.left_nav_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.left_nav_box.set_hexpand(True)
self.left_nav_box.set_halign(Gtk.Align.START)
self.btn_prev = Gtk.Button(label="Previous")
self.btn_prev.set_size_request(135, 42)
self.btn_prev.connect("clicked", self.on_prev_clicked)
self.left_nav_box.append(self.btn_prev)
nav_box.append(self.left_nav_box)
# Center box: Skip (Dead Center)
self.center_nav_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.center_nav_box.set_hexpand(True)
self.center_nav_box.set_halign(Gtk.Align.CENTER)
self.btn_skip = Gtk.Button(label="Skip Step")
self.btn_skip.set_size_request(125, 42)
self.btn_skip.connect("clicked", self.on_skip_clicked)
self.center_nav_box.append(self.btn_skip)
nav_box.append(self.center_nav_box)
# Right box: Next (Dead Right)
self.right_nav_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.right_nav_box.set_hexpand(True)
self.right_nav_box.set_halign(Gtk.Align.END)
self.btn_next = Gtk.Button(label="Next")
self.btn_next.set_size_request(145, 42)
self.btn_next.add_css_class("suggested-action")
self.btn_next.connect("clicked", self.on_next_clicked)
self.right_nav_box.append(self.btn_next)
nav_box.append(self.right_nav_box)
root_box.append(nav_box)
# Initial display
self.update_step_view()
# -------------------------------------------------------------
# Step 1: Graphics & GPU Drivers
# -------------------------------------------------------------
def build_drivers_page(self):
page = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=14)
page.set_margin_top(8)
info = Gtk.Label()
info.set_halign(Gtk.Align.START)
info.set_markup("<b>Graphics & GPU Driver Configuration (Optional):</b>\n<span size='small' alpha='65%'>GPU drivers are opt-in. Check the box below if you want to install hardware-accelerated drivers and 32-bit Vulkan libraries for your detected graphics hardware.</span>")
page.append(info)
scrolled = Gtk.ScrolledWindow()
scrolled.set_vexpand(True)
content_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
content_box.set_margin_top(8)
content_box.set_margin_bottom(8)
content_box.set_margin_start(8)
content_box.set_margin_end(8)
pkgs_text = ", ".join(self.detected_gpu_pkgs) if self.detected_gpu_pkgs else "None"
desc = f"Detected: {self.gpu_display_name}\nPackages: {pkgs_text}\nInstalls 32-bit & 64-bit Mesa/Vulkan runtimes and hardware acceleration."
self.chk_gpu_drivers = make_check_button(
f"Install GPU Drivers ({self.gpu_display_name})",
desc
)
self.chk_gpu_drivers.set_active(False) # Opt-in by default
self.chk_gpu_drivers.connect("toggled", self.on_gpu_drivers_toggled)
content_box.append(self.chk_gpu_drivers)
scrolled.set_child(content_box)
page.append(scrolled)
self.stack.add_named(page, "page_drivers")
def on_gpu_drivers_toggled(self, btn):
self.install_gpu_drivers = btn.get_active()
# -------------------------------------------------------------
# Page 2: Browser Selection
# -------------------------------------------------------------
def build_browser_page(self):
page = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
page.set_margin_top(8)
info = Gtk.Label()
info.set_halign(Gtk.Align.START)
info.set_markup("<b>Choose a primary web browser to install:</b>\n<span size='small' alpha='65%'>Select one from the options below, or search the repositories.</span>")
page.append(info)
scrolled = Gtk.ScrolledWindow()
scrolled.set_vexpand(True)
radio_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
radio_box.set_margin_top(8)
radio_box.set_margin_bottom(8)
self.browser_radios = {}
first_b = None
for bid, title, desc in BROWSERS:
r = make_check_button(title, desc, group=first_b)
if first_b is None:
first_b = r
r.set_active(True)
self.browser_radios[bid] = r
radio_box.append(r)
# "Other" search section embedded
self.other_search_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8)
self.other_search_box.set_margin_top(8)
self.other_search_box.set_margin_start(28)
self.other_search_box.set_visible(False)
search_entry_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
self.browser_search_entry = Gtk.Entry()
self.browser_search_entry.set_placeholder_text("Enter browser package name (e.g. librewolf, floorp)...")
self.browser_search_entry.set_hexpand(True)
self.browser_search_entry.connect("activate", self.on_search_browser)
btn_search_b = Gtk.Button(label="Search Repos")
btn_search_b.connect("clicked", self.on_search_browser)
search_entry_box.append(self.browser_search_entry)
search_entry_box.append(btn_search_b)
self.other_search_box.append(search_entry_box)
self.browser_results_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.other_search_box.append(self.browser_results_box)
radio_box.append(self.other_search_box)
# Connect "Other" radio button toggle
self.browser_radios["other"].connect("toggled", self.on_browser_other_toggled)
scrolled.set_child(radio_box)
page.append(scrolled)
self.stack.add_named(page, "page_browser")
def on_browser_other_toggled(self, btn):
self.other_search_box.set_visible(btn.get_active())
def on_search_browser(self, widget):
query = self.browser_search_entry.get_text().strip()
if not query:
return
while child := self.browser_results_box.get_first_child():
self.browser_results_box.remove(child)
lbl = Gtk.Label(label="Searching repositories...")
self.browser_results_box.append(lbl)
def search_thread():
try:
cmd = f"yay -Slq | grep -i '{query}' | head -n 25 | sort -u"
res = subprocess.check_output(cmd, shell=True, text=True).splitlines()
except Exception:
res = []
def update_ui():
while child := self.browser_results_box.get_first_child():
self.browser_results_box.remove(child)
if not res:
self.browser_results_box.append(Gtk.Label(label=f"No packages found for '{query}'."))
return
res_label = Gtk.Label()
res_label.set_markup("<b>Search Results (Click to select):</b>")
res_label.set_halign(Gtk.Align.START)
self.browser_results_box.append(res_label)
first_r = None
self.custom_browser_radios = []
for pkg in res:
rb = make_check_button(pkg, group=first_r)
if first_r is None:
first_r = rb
rb.set_active(True)
self.custom_browser_radios.append((pkg, rb))
self.browser_results_box.append(rb)
GLib.idle_add(update_ui)
threading.Thread(target=search_thread, daemon=True).start()
# -------------------------------------------------------------
# Step 3: Browser Extensions
# -------------------------------------------------------------
def build_extensions_page(self):
page = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
page.set_margin_top(8)
info = Gtk.Label()
info.set_halign(Gtk.Align.START)
info.set_markup("<b>Select curated browser extensions to provision:</b>\n<span size='small' alpha='65%'>Automatically pre-configured for your chosen browser (Brave, Chromium, Firefox, etc.). Extensions will be ready when you launch the browser.</span>")
page.append(info)
# Top bar with Master Select All / Unselect All
top_bar = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20)
top_bar.set_margin_top(6)
top_bar.set_margin_bottom(8)
self.extensions_master_select_all = make_check_button("Select / Unselect All Extensions")
self.extensions_master_select_all.set_active(True)
self.extensions_master_select_all.connect("toggled", self.on_master_extensions_toggled)
top_bar.append(self.extensions_master_select_all)
page.append(top_bar)
scrolled = Gtk.ScrolledWindow()
scrolled.set_vexpand(True)
grid = Gtk.Grid()
grid.set_column_spacing(24)
grid.set_row_spacing(12)
grid.set_margin_top(8)
grid.set_margin_bottom(12)
grid.set_margin_start(8)
grid.set_margin_end(8)
self.extensions_checkboxes = {}
self.ext_selection_updating = False
half = (len(BROWSER_EXTENSIONS) + 1) // 2
for idx, (ext_id, name, desc, _, _, _, default_active) in enumerate(BROWSER_EXTENSIONS):
c = make_check_button(name, desc)
c.set_active(default_active)
c.connect("toggled", lambda b, e=ext_id: self.on_extension_toggled(b, e))
self.extensions_checkboxes[ext_id] = c
col = 0 if idx < half else 1
row = idx if idx < half else idx - half
grid.attach(c, col, row, 1, 1)
scrolled.set_child(grid)
page.append(scrolled)
self.stack.add_named(page, "page_extensions")
def on_master_extensions_toggled(self, btn):
if getattr(self, "ext_selection_updating", False):
return
self.ext_selection_updating = True
active = btn.get_active()
for ext_id, chk in self.extensions_checkboxes.items():
chk.set_active(active)
if active:
self.selected_extensions.add(ext_id)
else:
self.selected_extensions.discard(ext_id)
self.ext_selection_updating = False
def on_extension_toggled(self, btn, ext_id):
if btn.get_active():
self.selected_extensions.add(ext_id)
else:
self.selected_extensions.discard(ext_id)
if not getattr(self, "ext_selection_updating", False):
self.ext_selection_updating = True
all_active = all(chk.get_active() for chk in self.extensions_checkboxes.values())
self.extensions_master_select_all.set_active(all_active)
self.ext_selection_updating = False
# -------------------------------------------------------------
# Page 4: Application Selection (with Extra AUR Search at bottom)
# -------------------------------------------------------------
def build_apps_page(self):
page = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
page.set_margin_top(8)
info = Gtk.Label()
info.set_halign(Gtk.Align.START)
info.set_markup("<b>Select applications, emulators, and tools to install:</b>\n<span size='small' alpha='65%'>Organized by category. You can tick an entire category or select individual items.</span>")
page.append(info)
# Top bar with Master Select All tick box + filter search entry
top_bar = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20)
top_bar.set_margin_top(6)
top_bar.set_margin_bottom(8)
self.apps_master_select_all = make_check_button("Select / Unselect All Applications")
self.apps_master_select_all.set_active(False)
self.apps_master_select_all.connect("toggled", self.on_master_select_all_toggled)
top_bar.append(self.apps_master_select_all)
# Generic, clean placeholder
self.filter_entry = Gtk.SearchEntry()
self.filter_entry.set_placeholder_text("Search applications (e.g. steam, vlc, discord, spotify)...")
self.filter_entry.set_hexpand(True)
self.filter_entry.connect("search-changed", self.on_filter_changed)
top_bar.append(self.filter_entry)
page.append(top_bar)
# Scrolled container for categorized sections and bottom AUR search
scrolled = Gtk.ScrolledWindow()
scrolled.set_vexpand(True)
categories_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=18)
categories_container.set_margin_top(6)
categories_container.set_margin_bottom(14)
categories_container.set_margin_start(4)
categories_container.set_margin_end(4)
self.category_groups = []
self.apps_checkboxes = {}
self.selection_updating = False
categories = get_categorized_apps()
for cat_name, items in categories:
cat_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8)
# Category Header with its own Select-Whole-Category Checkbox
cat_header_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
cat_check = make_check_button(cat_name)
cat_check.set_active(False)
cat_check.add_css_class("heading")
cat_header_box.append(cat_check)
cat_box.append(cat_header_box)
cat_sep = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
cat_box.append(cat_sep)
# 2-column grid for this category
grid = Gtk.Grid()
grid.set_column_spacing(24)
grid.set_row_spacing(10)
grid.set_margin_top(4)
grid.set_margin_bottom(8)
grid.set_margin_start(16)
cat_item_buttons = []
half = (len(items) + 1) // 2
for idx, (pkg, name, desc) in enumerate(items):
c = make_check_button(name, desc)
c.set_active(False)
c.connect("toggled", lambda b, cn=cat_name: self.on_app_item_toggled(b, cn))
self.apps_checkboxes[pkg] = (c, name, desc, cat_name)
cat_item_buttons.append((pkg, c))
col = 0 if idx < half else 1
row = idx if idx < half else idx - half
grid.attach(c, col, row, 1, 1)
# Connect category checkbox to toggle the whole category
cat_check.connect("toggled", lambda b, buttons=cat_item_buttons: self.on_category_toggled(b, buttons))
cat_box.append(grid)
categories_container.append(cat_box)
self.category_groups.append((cat_box, cat_name, cat_check, cat_item_buttons))
# -------------------------------------------------------------
# Extra Packages (AUR Search) - Bottom of Package Selection
# -------------------------------------------------------------
aur_sep = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
aur_sep.set_margin_top(16)
aur_sep.set_margin_bottom(10)
categories_container.append(aur_sep)
aur_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
aur_box.set_margin_start(4)
aur_box.set_margin_end(4)
aur_box.set_margin_bottom(16)
aur_title = Gtk.Label()
aur_title.set_halign(Gtk.Align.START)
aur_title.set_markup("<span size='medium' weight='bold'>Extra Packages (Search Repositories / AUR)</span>")
aur_box.append(aur_title)
aur_desc = Gtk.Label()
aur_desc.set_halign(Gtk.Align.START)
aur_desc.set_markup("<span size='small' alpha='65%'>Can't find a package above? Search the Arch User Repository or enter package names directly to add them to your installation queue.</span>")
aur_box.append(aur_desc)
# Search / Add row
search_row = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
search_row.set_margin_top(4)
self.aur_search_entry = Gtk.Entry()
self.aur_search_entry.set_placeholder_text("Search AUR packages (e.g. visual-studio-code-bin, obs-studio)...")
self.aur_search_entry.set_hexpand(True)
self.aur_search_entry.connect("activate", self.on_search_aur)
search_row.append(self.aur_search_entry)
btn_aur_search = Gtk.Button(label="Search AUR")
btn_aur_search.connect("clicked", self.on_search_aur)
search_row.append(btn_aur_search)
self.manual_pkg_entry = Gtk.Entry()
self.manual_pkg_entry.set_placeholder_text("Manual package name...")
self.manual_pkg_entry.set_size_request(210, -1)
self.manual_pkg_entry.connect("activate", self.on_manual_add)
search_row.append(self.manual_pkg_entry)
btn_manual_add = Gtk.Button(label="+ Add")
btn_manual_add.connect("clicked", self.on_manual_add)
search_row.append(btn_manual_add)
aur_box.append(search_row)
# Live AUR search results container (shown when search is made)
self.aur_results_frame = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8)
self.aur_results_frame.set_margin_top(6)
self.aur_results_frame.set_visible(False)
res_header_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
lbl_res = Gtk.Label()
lbl_res.set_markup("<b>AUR Search Results (Click checkbox to queue):</b>")
lbl_res.set_hexpand(True)
lbl_res.set_halign(Gtk.Align.START)
res_header_box.append(lbl_res)
btn_add_selected = Gtk.Button(label="+ Add Checked to Queue")
btn_add_selected.add_css_class("suggested-action")
btn_add_selected.connect("clicked", self.on_add_checked_aur)
res_header_box.append(btn_add_selected)
btn_close_res = Gtk.Button(label="Close")
btn_close_res.connect("clicked", lambda _: self.aur_results_frame.set_visible(False))
res_header_box.append(btn_close_res)
self.aur_results_frame.append(res_header_box)
# Scrolled flow/list for search results
self.aur_results_scroll = Gtk.ScrolledWindow()
self.aur_results_scroll.set_size_request(-1, 150)
self.aur_results_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.aur_results_box.set_margin_top(4)
self.aur_results_box.set_margin_bottom(4)
self.aur_results_scroll.set_child(self.aur_results_box)
self.aur_results_frame.append(self.aur_results_scroll)
aur_box.append(self.aur_results_frame)
# Queued packages display
self.queued_frame = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.queued_frame.set_margin_top(6)
queue_header_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
self.queued_count_label = Gtk.Label()
self.queued_count_label.set_markup("<b>Queued Extra Packages (0):</b>")
self.queued_count_label.set_hexpand(True)
self.queued_count_label.set_halign(Gtk.Align.START)
queue_header_box.append(self.queued_count_label)
btn_clear = Gtk.Button(label="Clear Queue")
btn_clear.connect("clicked", self.on_clear_queue)
queue_header_box.append(btn_clear)
self.queued_frame.append(queue_header_box)
self.queue_list_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=4)
self.queue_list_box.set_margin_top(4)
self.queued_frame.append(self.queue_list_box)
aur_box.append(self.queued_frame)
categories_container.append(aur_box)
scrolled.set_child(categories_container)
page.append(scrolled)
self.stack.add_named(page, "page_apps")
# Initial queue UI update
self.update_queue_ui()
def on_master_select_all_toggled(self, btn):
if self.selection_updating:
return
self.selection_updating = True
state = btn.get_active()
for cat_box, cat_name, cat_check, cat_item_buttons in self.category_groups:
if cat_box.get_visible():
cat_check.set_active(state)
for pkg, c in cat_item_buttons:
if c.get_visible():
c.set_active(state)
self.selection_updating = False
def on_category_toggled(self, cat_btn, cat_item_buttons):
if self.selection_updating:
return
self.selection_updating = True
state = cat_btn.get_active()
for pkg, c in cat_item_buttons:
if c.get_visible():
c.set_active(state)
# Update master checkbox status
visible_boxes = [c for c, _, _, _ in self.apps_checkboxes.values() if c.get_visible()]
all_checked = all(c.get_active() for c in visible_boxes) if visible_boxes else False
self.apps_master_select_all.set_active(all_checked)
self.selection_updating = False
def on_app_item_toggled(self, btn, cat_name):
if self.selection_updating:
return
self.selection_updating = True
for cat_box, name, cat_check, cat_item_buttons in self.category_groups:
if name == cat_name:
vis_items = [c for pkg, c in cat_item_buttons if c.get_visible()]
cat_all = all(c.get_active() for c in vis_items) if vis_items else False
cat_check.set_active(cat_all)
break
visible_boxes = [c for c, _, _, _ in self.apps_checkboxes.values() if c.get_visible()]
all_checked = all(c.get_active() for c in visible_boxes) if visible_boxes else False
self.apps_master_select_all.set_active(all_checked)
self.selection_updating = False
def on_filter_changed(self, entry):
term = entry.get_text().strip().lower()
for cat_box, cat_name, cat_check, cat_item_buttons in self.category_groups:
any_cat_match = False
for pkg, c in cat_item_buttons:
_, name, desc, _ = self.apps_checkboxes[pkg]
matches = (term in pkg.lower()) or (term in name.lower()) or (term in desc.lower()) or (term in cat_name.lower())
c.set_visible(matches if term else True)
if matches: