Skip to content

Commit

Permalink
Merge pull request #352 from JacobZang/master
Browse files Browse the repository at this point in the history
archives: VIM: add lightdm hotplug
  • Loading branch information
numbqq authored Nov 6, 2024
2 parents fb34e2a + 2e80ae6 commit 5ed03ec
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if systemctl is-enabled resize2fs.service | grep "^enabled$" > /dev/null; then
exit
fi

if ! systemctl is-active --quiet gdm ; then
if ! (systemctl is-active --quiet gdm || systemctl is-active --quiet lightdm); then
## For server
## Get hdmi resolution
for x in $(cat /proc/cmdline); do
Expand All @@ -31,14 +31,20 @@ if ! systemctl is-active --quiet gdm ; then
echo 0 > /sys/class/graphics/fb0/blank
else
## For desktop
## Restart the GDM service when hdmitx plugin
## Restart the display manager (gdm3 or lightdm) when hdmitx plugin

process_name="gdm-wayland-session"
search_string="/usr/libexec/gdm-wayland-session"
gdm_process_name="gdm-wayland-session"
lightdm_process_name="lightdm"
gdm_search_string="/usr/libexec/gdm-wayland-session"
lightdm_search_string="/usr/sbin/lightdm"

output=$(ps aux | grep "$process_name")
if ! echo "$output" | grep -q "$search_string"; then
gdm_output=$(ps aux | grep "$gdm_process_name" | grep -v "grep")
lightdm_output=$(ps aux | grep "$lightdm_process_name" | grep -v "grep")

if [ "$gdm_output" ]; then
systemctl restart gdm3
elif [ "$lightdm_output" ]; then
systemctl restart lightdm
fi
fi

Expand Down

0 comments on commit 5ed03ec

Please sign in to comment.