I want a shortcut to hide the top bar and dock, so I thought the best way to do that would be to figure out a terminal command which does the same.So, can someone tell me the command to do so or another way to make the shortcut work?
1 Answers
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 ubuntu-dock@ubuntu.com
for enabling back
gdbus call --session --dest org.gnome.Shell.Extensions --object-path /org/gnome/Shell/Extensions --method org.gnome.Shell.Extensions.EnableExtension ubuntu-dock@ubuntu.com
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 ubuntu-dock@ubuntu.com | 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 ubuntu-dock@ubuntu.com
else
gdbus call --session --dest org.gnome.Shell.Extensions --object-path /org/gnome/Shell/Extensions --method org.gnome.Shell.Extensions.EnableExtension ubuntu-dock@ubuntu.com
fi
Below GIF shows the result. However, when gnome-shell refreshes/re-login/reboot etc. will affect the persistence.
- 17,371
- 23,201
