I've switched to XMonad as my window manager. Sometimes when I put my laptop to hibernate, it's hanging and won't shut down. I have to force it off by pressing the powerbutton for 5 seconds.
After I boot again, I can't connect to the internet. I have to logout, go to gnome, and after logging in, I rightclick the network applet icon and select the enable networking options. After that, my internet is working again.
Is there a way to do this via the command line or another option?
You can use
nmcli
(part of NM) orcnetworkmanager
to control NetworkManager from the commandline.
BTW: you can configure Monad to use a panel or such (but maybe that's not what you want).
You can customise xmonad with status bar and tray apps for utilities like network-manager which need tray icons.
This guide, for example, details how to set up xmobar and trayer, among other things.
I find after improper shutdowns that the /etc/NetworkManager/nm-system-settings.conf often has Managed=False set. When you go into GNOME and hit that checkbox, all you're doing is toggling that to True. You can do it with a text editor too.
It sounds like you've killed the network-manager daemon. You can restart it by doing
sudo service network-manager start
. However if you're not using network-manager you can always remove it all together (and probably eliminate this issue).