Is there a way to hide ubuntu dock and top bar using terminal?
Solution 1:
This command can be used to hide the topbar
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval string:'Main.panel.actor.hide();'
to show it back
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval string:'Main.panel.actor.show();'
You can tweak the commands with a script to toggle show and hide.
For Ubuntu dock hiding - the below workaround is a bit overkill because we are disabling the whole extension.
gdbus call --session --dest org.gnome.Shell.Extensions --object-path /org/gnome/Shell/Extensions --method org.gnome.Shell.Extensions.DisableExtension [email protected]
for enabling back
gdbus call --session --dest org.gnome.Shell.Extensions --object-path /org/gnome/Shell/Extensions --method org.gnome.Shell.Extensions.EnableExtension [email protected]
You can tweak the commands with a script to toggle Enabling and Disabling
All together you can have a single keyboard shortcut that can toggle "Hiding the Topbar and disabling the Extension" "Showing the Topbar and Enabling the Extension"
you can create a script with below content..
#!/bin/bash
status1=`gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval string:'Main.panel.actor.visible;'`
status2=`gdbus call --session --dest org.gnome.Shell.Extensions --object-path /org/gnome/Shell/Extensions --method org.gnome.Shell.Extensions.GetExtensionInfo [email protected] | grep "'state': <2.0>" >/dev/null && echo "OFF" || echo "ON"`
if [ "$status1" == "(true, 'false')" ]; then
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.panel.actor.show();'
else
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.panel.actor.hide();'
fi
if [ "$status2" == "ON" ]; then
gdbus call --session --dest org.gnome.Shell.Extensions --object-path /org/gnome/Shell/Extensions --method org.gnome.Shell.Extensions.DisableExtension [email protected]
else
gdbus call --session --dest org.gnome.Shell.Extensions --object-path /org/gnome/Shell/Extensions --method org.gnome.Shell.Extensions.EnableExtension [email protected]
fi
Below GIF shows the result. However when gnome-shell refreshes/re-login/reboot etc will affect the persistence.