Add Keybinding to Dnf Upgrade and Shutdown to Gnome Shell
Oct 27, 2016 · 1 minute readCategory: linux
In Fedora I prefer to apply updates just before shutting down so that next time I boot up the updates will be in place.
For me this seems like the best way to do it.
To make that easier I also then create a keybinding so that I can hit [Start]+[q]
to trigger the upgrade/shutdown process in a terminal
Being a lazy developer I prefer to have things automated and so here is a bash command to set this up:
cat <<'EOF' | bash
echo "setting up keybinding";
keybindingsPath="/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings"
custom0path="$keybindingsPath/custom0"
dconf write $custom0path/binding "'<Super>q'"
dconf write $custom0path/command "'gnome-terminal --command=\"sudo bash -c \'dnf -y upgrade; shutdown now\'\"'"
dconf write $custom0path/name "'upgrade and shutdown'"
c0="'/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/'"
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "[$c0]"
echo "
Done
try hitting [Start] + [q]
"
EOF
just copy/paste into an open terminal window to set this up