-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal.sh
executable file
·48 lines (43 loc) · 972 Bytes
/
terminal.sh
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
#!/bin/bash
ARGS=""
if [ $# -gt 0 ]; then
ARGS="$@ "
fi
# Detect the OS
os_name=$(awk -F= '/^ID=/{print $2}' /etc/os-release)
session=$(echo $XDG_SESSION_DESKTOP)
# Function to choose terminal emulator based on session
choose_terminal_by_session() {
case "$session" in
gnome|ubunt|pop)
terminal="gnome-terminal"
;;
kde|plasma)
terminal="konsole"
;;
xfce)
terminal="xfce4-terminal"
;;
mate)
terminal="mate-terminal"
;;
COSMIC)
terminal="cosmic-term"
;;
*)
terminal="xterm"
;;
esac
}
# Choose the terminal emulator based on the OS
case "$os_name" in
debian|ubuntu|pop|fedora|arch)
choose_terminal_by_session
./install.sh $terminal
echo "$terminal ${ARGS}--"
;;
*)
echo "Unsupported OS"
exit 1
;;
esac