Skip to content

Commit f5e42f9

Browse files
authored
Merge pull request #482 from TheJumpCloud/BAN-1163
BAN-1163: enable disable wayland
2 parents 259d374 + 0bfd76c commit f5e42f9

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#### Name
2+
3+
Linux - remote-assist - Disable wayland windowing system | v1.0 JCCG
4+
5+
#### commandType
6+
7+
linux
8+
9+
#### Command
10+
11+
```
12+
#!/bin/bash
13+
################################################################################
14+
# This script will disable wayland windowing system
15+
################################################################################
16+
17+
if [[ "${UID}" != 0 ]]; then
18+
(>&2 echo "Error: $0 must be run as root")
19+
exit 1
20+
fi
21+
22+
disable_wayland() {
23+
case ${linuxType} in
24+
ubuntu|\"rocky\"|\"centos\")
25+
`sed -i 's/^#.*WaylandEnable=.*/WaylandEnable=false/' /etc/gdm3/custom.conf`
26+
;;
27+
debian)
28+
`sed -i 's/^#.*WaylandEnable=.*/WaylandEnable=false/' /etc/gdm3/daemon.conf`
29+
;;
30+
esac
31+
}
32+
33+
# Get the current windowing system
34+
windowingSystem=$(echo $XDG_SESSION_TYPE)
35+
if [ "$windowingSystem" == "" ]; then
36+
windowingSystem=`loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}'`
37+
fi
38+
39+
windowingSystem="wayland"
40+
41+
# Get the linux type
42+
linuxType=`awk -F= '$1=="ID" { print $2 ;}' /etc/os-release`
43+
linuxType="$(echo -e "${linuxType}" | sed -e 's/^[[:space:]]*//')"
44+
45+
if [[ "$linuxType" == "linuxmint" ]]; then
46+
echo "Linuxmint does not support wayland. Nothing to be done for linuxmint."
47+
exit 0
48+
fi
49+
50+
if [[ "$windowingSystem" == "wayland" ]]; then
51+
disable_wayland "$linuxType"
52+
elif [[ "$windowingSystem" == "x11" ]]; then
53+
echo "Windowing System is already set to x11"
54+
exit 1
55+
fi
56+
57+
echo "Now 'restart' the machine or run 'sudo systemctl restart gdm'."
58+
59+
exit 0
60+
```
61+
62+
#### Description
63+
64+
This script enables the Wayland windowing system on the Linux machine.
65+
66+
#### _Import This Command_
67+
68+
To import this command into your JumpCloud tenant run the below command using the [JumpCloud PowerShell Module](https://github.com/TheJumpCloud/support/wiki/Installing-the-JumpCloud-PowerShell-Module)
69+
70+
```
71+
Import-JCCommand -URL "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Linux%20Commands/Linux%20-%20remote-assist%20-%20Disable%20wayland%20windowing%20system.md"
72+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#### Name
2+
3+
Linux - remote-assist - Enable wayland windowing system | v1.0 JCCG
4+
5+
#### commandType
6+
7+
linux
8+
9+
#### Command
10+
11+
```
12+
#!/bin/bash
13+
################################################################################
14+
# This script will enable wayland windowing system
15+
################################################################################
16+
17+
if [[ "${UID}" != 0 ]]; then
18+
(>&2 echo "Error: $0 must be run as root")
19+
exit 1
20+
fi
21+
22+
enable_wayland() {
23+
case ${linuxType} in
24+
ubuntu|\"rocky\"|\"centos\")
25+
`sed -i 's/WaylandEnable=.*/#WaylandEnable=false/' /etc/gdm3/custom.conf`
26+
;;
27+
debian)
28+
`sed -i 's/WaylandEnable=.*/#WaylandEnable=false/' /etc/gdm3/daemon.conf`
29+
;;
30+
esac
31+
}
32+
33+
# Get the current windowing system
34+
windowingSystem=$(echo $XDG_SESSION_TYPE)
35+
if [[ "$windowingSystem" == "" ]]; then
36+
windowingSystem=`loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}'`
37+
fi
38+
39+
# Get the linux type
40+
linuxType=`awk -F= '$1=="ID" { print $2 ;}' /etc/os-release`
41+
linuxType="$(echo -e "${linuxType}" | sed -e 's/^[[:space:]]*//')"
42+
43+
if [[ "$linuxType" == "linuxmint" ]]; then
44+
echo "Linuxmint does not support wayland. Nothing to be done for linuxmint."
45+
exit 0
46+
fi
47+
48+
if [[ "$windowingSystem" == "wayland" ]]; then
49+
echo "Windowing System is already set to wayland"
50+
exit 1
51+
elif [[ "$windowingSystem" == "x11" ]]; then
52+
enable_wayland "$linuxType"
53+
fi
54+
55+
echo "Next step is to either 'reboot' the machine or run 'sudo systemctl restart gdm'."
56+
57+
exit 0
58+
```
59+
60+
#### Description
61+
62+
This script enables the Wayland windowing system on the Linux machine.
63+
64+
#### _Import This Command_
65+
66+
To import this command into your JumpCloud tenant run the below command using the [JumpCloud PowerShell Module](https://github.com/TheJumpCloud/support/wiki/Installing-the-JumpCloud-PowerShell-Module)
67+
68+
```
69+
Import-JCCommand -URL "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Linux%20Commands/Linux%20-%20remote-assist%20-%20Enable%20wayland%20windowing%20system.md"
70+
```

PowerShell/JumpCloud Commands Gallery/commands.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@
8383
"link": "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Linux%20Commands/Linux%20-%20Snap%20-%20Remove%20Slack.md",
8484
"description": "Remove Slack app with the Snap app manager. To learn more about Snap, visit [SnapCraft's website](https://snapcraft.io/)"
8585
},
86+
{
87+
"name": "Linux - remote-assist - Disable wayland windowing system | v1.0 JCCG",
88+
"type": "linux",
89+
"command": "#!/bin/bash\n################################################################################\n# This script will disable wayland windowing system\n################################################################################\n\nif [[ \"${UID}\" != 0 ]]; then\n (>&2 echo \"Error: $0 must be run as root\")\n exit 1\nfi\n\ndisable_wayland() {\n case ${linuxType} in\n ubuntu|\\\"rocky\\\"|\\\"centos\\\")\n `sed -i 's/^#.*WaylandEnable=.*/WaylandEnable=false/' /etc/gdm3/custom.conf`\n ;;\n debian)\n `sed -i 's/^#.*WaylandEnable=.*/WaylandEnable=false/' /etc/gdm3/daemon.conf`\n ;;\n esac\n}\n\n# Get the current windowing system\nwindowingSystem=$(echo $XDG_SESSION_TYPE)\nif [ \"$windowingSystem\" == \"\" ]; then\n windowingSystem=`loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}'`\nfi\n\nwindowingSystem=\"wayland\"\n\n# Get the linux type\nlinuxType=`awk -F= '$1==\"ID\" { print $2 ;}' /etc/os-release`\nlinuxType=\"$(echo -e \"${linuxType}\" | sed -e 's/^[[:space:]]*//')\"\n\nif [[ \"$linuxType\" == \"linuxmint\" ]]; then\n echo \"Linuxmint does not support wayland. Nothing to be done for linuxmint.\"\n exit 0\nfi\n\nif [[ \"$windowingSystem\" == \"wayland\" ]]; then\n disable_wayland \"$linuxType\"\nelif [[ \"$windowingSystem\" == \"x11\" ]]; then\n echo \"Windowing System is already set to x11\"\n exit 1\nfi\n\necho \"Now 'restart' the machine or run 'sudo systemctl restart gdm'.\"\n\nexit 0",
90+
"link": "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Linux%20Commands/Linux%20-%20remote-assist%20-%20Disable%20wayland%20windowing%20system.md",
91+
"description": "This script enables the Wayland windowing system on the Linux machine."
92+
},
93+
{
94+
"name": "Linux - remote-assist - Enable wayland windowing system | v1.0 JCCG",
95+
"type": "linux",
96+
"command": "#!/bin/bash\n################################################################################\n# This script will enable wayland windowing system\n################################################################################\n\nif [[ \"${UID}\" != 0 ]]; then\n (>&2 echo \"Error: $0 must be run as root\")\n exit 1\nfi\n\nenable_wayland() {\n case ${linuxType} in\n ubuntu|\\\"rocky\\\"|\\\"centos\\\")\n `sed -i 's/WaylandEnable=.*/#WaylandEnable=false/' /etc/gdm3/custom.conf`\n ;;\n debian)\n `sed -i 's/WaylandEnable=.*/#WaylandEnable=false/' /etc/gdm3/daemon.conf`\n ;;\n esac\n}\n\n# Get the current windowing system\nwindowingSystem=$(echo $XDG_SESSION_TYPE)\nif [[ \"$windowingSystem\" == \"\" ]]; then\n windowingSystem=`loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}'`\nfi\n\n# Get the linux type\nlinuxType=`awk -F= '$1==\"ID\" { print $2 ;}' /etc/os-release`\nlinuxType=\"$(echo -e \"${linuxType}\" | sed -e 's/^[[:space:]]*//')\"\n\nif [[ \"$linuxType\" == \"linuxmint\" ]]; then\n echo \"Linuxmint does not support wayland. Nothing to be done for linuxmint.\"\n exit 0\nfi\n\nif [[ \"$windowingSystem\" == \"wayland\" ]]; then\n echo \"Windowing System is already set to wayland\"\n exit 1\nelif [[ \"$windowingSystem\" == \"x11\" ]]; then\n enable_wayland \"$linuxType\"\nfi\n\necho \"Next step is to either 'reboot' the machine or run 'sudo systemctl restart gdm'.\"\n\nexit 0",
97+
"link": "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Linux%20Commands/Linux%20-%20remote-assist%20-%20Enable%20wayland%20windowing%20system.md",
98+
"description": "This script enables the Wayland windowing system on the Linux machine."
99+
},
86100
{
87101
"name": "Mac - Disable Local User | v1.0 JCCG",
88102
"type": "mac",

0 commit comments

Comments
 (0)