I tried to unlock partitions from the launcher, but they keeps reappearing after every reboot. Is there any good way to permanently remove partitions from the launcher?
This is happening only on Ubuntu 16.04
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityI tried to unlock partitions from the launcher, but they keeps reappearing after every reboot. Is there any good way to permanently remove partitions from the launcher?
This is happening only on Ubuntu 16.04
Although the solution below is not a fix to what seems to be a minor bug, you can use it as a workaround to automatically blacklist devices on startup (log in).
...is a small script that remembers your blacklisted items on log in. It runs with two arguments: get
and set
. The first is to read the current blacklisted items, the second will (re-) set the list to the last read version.
/path/to/remember_blacklist.sh get
This will make a snapshot of the currently blacklisted devices.Now the next time you log in or restart, the blacklisted devices are automatically removed. Of course you can add the command to a shortcut.
Copy the script below into an empty file, save it as remember_blacklist.sh
#!/bin/bash
arg=$1
blacklist=~/.currblacklist
key="com.canonical.Unity.Devices blacklist"
if [ "$arg" == "get" ]
then
printf "$(gsettings get $key)" > $blacklist
elif [ "$arg" == "set" ]
then
if [ "$(cat $blacklist)" == "@as" ]
then
gsettings set $key []
else
gsettings set $key "$(cat $blacklist)"
fi
fi
make it executable (!)
Add the following to Startup Applications Dash > Startup Applications > Add. Add the command
/bin/bash -c "sleep 10 && /path/to/remember_blacklist.sh set"
/path/to/remember_blacklist.sh get
If you remove a device from the launcher, it is blacklisted. You can read the current list of blacklisted devices with the command:
gsettings get com.canonical.Unity.Devices blacklist
This will output something like
['0A444ED409660B91-intern_1', '2899FAA548C61099-intern_2']
What the script does is:
get
: it reads the current blacklist and saves the output in a hidden file: ~/.currblacklist
when run with the argument set
: it reads the content of the file ~/.currblacklist
and sets the blaclist with the command:
gsettings set com.canonical.Unity.Devices blacklist <content_of_the_file>
@as
(12th line in your script). Thanks :-)
Apr 24, 2016 at 12:15
@as
. This cannot be used to set an empty list however, then we need to use []
.
Apr 24, 2016 at 12:17