This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prime-boot
executable file
·92 lines (85 loc) · 1.76 KB
/
prime-boot
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
#!/usr/bin/bash
if command -v zenity &> /dev/null; then
dialog_helper=zenity
elif command -v kdialog &> /dev/null; then
dialog_helper=kdialog
fi
case $dialog_helper in
zenity)
intel_boot=FALSE
offload_boot=FALSE
nvidia_boot=FALSE
;;
kdialog)
intel_boot=off
offload_boot=off
nvidia_boot=off
;;
esac
has_prime_select=false
($(exec prime-test))
case $? in
0)
has_prime_select=true
;;
esac
if $has_prime_select; then
current_boot=($(exec /usr/sbin/prime-select get-boot))
case ${current_boot[4]} in
"intel")
case $dialog_helper in
zenity)
intel_boot=TRUE
;;
kdialog)
intel_boot=on
;;
esac
;;
"offload")
case $dialog_helper in
zenity)
offload_boot=TRUE
;;
kdialog)
offload_boot=on
;;
esac
;;
"nvidia")
case $dialog_helper in
zenity)
nvidia_boot=TRUE
;;
kdialog)
nvidia_boot=on
;;
esac
;;
esac
case $dialog_helper in
zenity)
selected=$(zenity --list --radiolist --column="" --column="Title" --hide-header $offload_boot "offload" $nvidia_boot "nvidia" $intel_boot "intel" --hide-header --text="$(exec prime-i18n BootDriver)" --title="$(exec prime-i18n TitleSelect)")
;;
kdialog)
selected=$(kdialog --radiolist "$(exec prime-i18n BootDriver)" "offload" "offload" $offload_boot "nvidia" "nvidia" $nvidia_boot "intel" "intel" $intel_boot)
;;
esac
case $? in
0)
pkexec /usr/sbin/prime-select boot $selected
case $? in
0)
case $dialog_helper in
zenity)
zenity --info --title="$(exec prime-i18n TitleSuccess)" --text="$(prime-i18n BootDriverChanged) $selected."
;;
kdialog)
kdialog --title="$(exec prime-i18n TitleSuccess)" --msgbox "$(prime-i18n BootDriverChanged) $selected."
;;
esac
;;
esac
;;
esac
fi