user-1: I noticed that at key moments, such as when I am using social media in a passive way, or when I am between tasks in daily life, I tend to enter a kind of 'habitual' mode of being. On social media I click aimlessly around, almost compulsively. In my house, I just walk around without much planning or purpose. 
What could cause such mindless behaviour? 
I am also wondering whether merely paying close attention to lapses in attentiveness and to distracted moments can ultimately lead to the elimination of such habitual behaviours. 

user16632: You're off to a good start, in that you are aware of periods when mindfulness is absent. When does this awareness occur? Much later, just after, or during? Try to catch it sooner. Be like a detective, and trace mindlessness back to it's source. See if you can remember what conditioned it. The sooner you catch it, the easier the trace will be.
Everything is conditioned. If we can observe mindlessness non-judgmentaly (or anything else) as they arise, the conditions that give rise will become known. Know what gives rise to it's coming, and what gives rise to it's disappearance. Know what it is like during mindfulness, and what it is like without. Observe keenly, as though you were expected to report on it later. Develop a keen interest in what's actually happening, and experience it fully for yourself. 
It is not enough to simply hold the object with your attention, one must "rub" into the object, so to speak, to understand it moment to moment. Observe how it changes and disappears. The conditions that give rise to mindlessness will become obvious. Often, it is the hindrances - clinging, aversion, sloth, restlessness, and doubt. The hindrances are simply the mind out of balance. Rebalance yourself in the middle way and mindfulness will become more effortless.
For example, becoming mindless while browsing the internet is probably both sloth, aversion, and craving - to lazy to do something else, desiring a good story to make you laugh, aversion towards being bored, etc.

user-1: In short, the five hindrances disrupt mindfulness. 
https://en.m.wikipedia.org/wiki/Five_hindrances
Also related to the five hindrances are the general defilements (kilesas), which also hinders mindfulness. 

I am also wondering whether merely paying close attention to lapses in attentiveness and to distracted moments can ultimately lead to the elimination of such habitual behaviours.

It’s a good start. However, one needs to purposely commit to the entire eightfold noble path in order to completely eliminate those behaviors. 

user471: In the following talk, it is described that the five hindrances, namely, sensual desire, ill will, sloth and torpor, restlessness and remorse, and doubt, do not just affect a person in meditation. It also affects a person at other times. The five hindrances obsess the mind and enslave the mind. They also appear habitually.
The speaker says that people who commit acts of crime like raping their own daughter, are strongly deluded and enslaved by the hindrances.
Only after attaining and mastering the first jhana, do the five hindrances reduce to a very low level that is not significant enough to be considered hindrances any more. After attaining the fourth jhana, the five hindrances are nearly completely eliminated.
The speaker says that a person who has overcome the five hindrances is capable of yoniso manasikara (focused attention or careful attention). With this, a person could attain stream entry simply by listening to the true Dhamma (teachings) attentively and reflecting on it. This is based on SN 55.5.
So, why do moments of mindlessness occur? It's due to the presence of the five hindrances.
In the YouTube video entitled "Characteristics of a Sotapanna" at timestamp 25:52, Ven. Dhammavuddho Mahathera stated (with some paraphrasing):

The third condition, this word - yoniso manasikara, which I
  translate as focused attention. It is also known as careful attention.
  This word means that when you listen to the Dhamma, you are focused on
  listening to the Dhamma. In other words, at that time, you don't have
  the five hindrances. If that is so, then you can understand the Dhamma
  and attain stream entry.
So who are the people who do not have the five hindrances? In the
  suttas, it is stated by the Buddha that as long as a person has not
  attained piti and sukha which are secluded from unwholesome
  states, which are secluded from sensual pleasures, the five hindrances
  will obsess him and obsess him habitually.
So, there are two types of persons who do not have the five
  hindrances. The first is the one who has attained the first jhana
  (i.e. he who has attained piti and sukha). When a person has attained
  the first jhana, he has eliminated the five hindrances and the Buddha
  says that the five hindrances no longer obsess that person habitually.
  ...
So there are two conditions if a person has the hindrances. Firstly,
  it obsesses your mind, it enslaves your mind. Secondly, it is
  habitual, it is very often there. That's why when
  somebody rapes his daughter or rapes his granddaughter, 
  it's because he cannot control these hindrances. His
  hindrances overwhelms his mind, obsesses the mind. After a person
  attains the first jhana, the Buddha says that the five hindrances are
  eliminated.
A lot of people don't believe it because they don't really understand
  the hindrances. If I ask you what are the hindrances, a lot of people
  will say sensual desire, ill will, sloth and torpor, restlessness and
  worry, and doubt. But these are not the five hindrances. These are
  called the five hindrances only when they obsess your mind, when they
  enslave your mind and they recur habitually. Only then they are called
  the five hindrances.
When a person attains the first jhana, these five hindrances reduce to
  a low level. They are still there but they are not called hindrances
  any more. It's just as if you walk through a jungle, you may
  encounter seven foot high long grass obstructing you. It's a
  hindrance because when you try to go through it, you cannot see in
  front of you. Secondly, it cuts or injures your skin. So, it's a big
  hindrance. But if I cut down that long grass to 12 inches, it is no
  more a hindrance. But it is still observable.
So, when a person attains  the first jhana, 
  it's as if the seven foot high long grass has 
  been cut down to 12 inches. When he attains the second jhana, 
  the 12 inches becomes 8 inches. 
  When he attains the third jhana, it becomes 4
  inches. When he attains the fourth jhana, it becomes one millimeter.
  So there is a big difference between the first three jhanas and the
  fourth jhana.
That is why it is said that once a person attains the first jhana, the
  hindrances are (nearly) eliminated, 
  meaning generally (nearly) eliminated for good.


-1: <p>I noticed that at key moments, such as when I am using social media in a passive way, or when I am between tasks in daily life, I tend to enter a kind of 'habitual' mode of being. On social media I click aimlessly around, almost compulsively. In my house, I just walk around without much planning or purpose. </p>

<p><strong>What could cause such mindless behaviour?</strong> </p>

<p>I am also wondering whether <em>merely</em> paying close attention to lapses in attentiveness and to distracted moments can ultimately lead to the elimination of such habitual behaviours. </p>
 16632: <p>You're off to a good start, in that you are aware of periods when mindfulness is absent. When does this awareness occur? Much later, just after, or during? Try to catch it sooner. Be like a detective, and trace mindlessness back to it's source. See if you can remember what conditioned it. The sooner you catch it, the easier the trace will be.</p>

<p>Everything is conditioned. If we can observe mindlessness non-judgmentaly (or anything else) as they arise, the conditions that give rise will become known. Know what gives rise to it's coming, and what gives rise to it's disappearance. Know what it is like during mindfulness, and what it is like without. Observe keenly, as though you were expected to report on it later. Develop a keen interest in what's actually happening, and experience it fully for yourself. </p>

<p>It is not enough to simply hold the object with your attention, one must "rub" into the object, so to speak, to understand it moment to moment. Observe how it changes and disappears. The conditions that give rise to mindlessness will become obvious. Often, it is the hindrances - clinging, aversion, sloth, restlessness, and doubt. The hindrances are simply the mind out of balance. Rebalance yourself in the middle way and mindfulness will become more effortless.</p>

<p>For example, becoming mindless while browsing the internet is probably both sloth, aversion, and craving - to lazy to do something else, desiring a good story to make you laugh, aversion towards being bored, etc.</p>
 -1: <p>In short, the five hindrances disrupt mindfulness. </p>

<p><a href="https://en.m.wikipedia.org/wiki/Five_hindrances" rel="nofollow noreferrer">https://en.m.wikipedia.org/wiki/Five_hindrances</a></p>

<p>Also related to the five hindrances are the general defilements (kilesas), which also hinders mindfulness. </p>

<blockquote>
  <p>I am also wondering whether merely paying close attention to lapses in attentiveness and to distracted moments can ultimately lead to the elimination of such habitual behaviours.</p>
</blockquote>

<p>It’s a good start. However, one needs to purposely commit to the entire eightfold noble path in order to completely eliminate those behaviors. </p>
 471: <p>In the following talk, it is described that the <a href="https://www.accesstoinsight.org/lib/authors/nyanaponika/wheel026.html" rel="nofollow noreferrer">five hindrances</a>, namely, sensual desire, ill will, sloth and torpor, restlessness and remorse, and doubt, do not just affect a person in meditation. It also affects a person at other times. The five hindrances obsess the mind and enslave the mind. They also appear habitually.</p>

<p>The speaker says that people who commit acts of crime like raping their own daughter, are strongly deluded and enslaved by the hindrances.</p>

<p>Only after attaining and mastering the first <em>jhana</em>, do the five hindrances reduce to a very low level that is not significant enough to be considered hindrances any more. After attaining the fourth <em>jhana</em>, the five hindrances are nearly completely eliminated.</p>

<p>The speaker says that a person who has overcome the five hindrances is capable of <em>yoniso manasikara</em> (focused attention or careful attention). With this, a person could attain <a href="https://www.accesstoinsight.org/lib/study/into_the_stream.html" rel="nofollow noreferrer">stream entry</a> simply by listening to the true <em>Dhamma</em> (teachings) attentively and reflecting on it. This is based on <a href="https://suttacentral.net/sn55.5/en/sujato" rel="nofollow noreferrer">SN 55.5</a>.</p>

<p>So, why do moments of mindlessness occur? It's due to the presence of the five hindrances.</p>

<p>In the YouTube video entitled "<a href="https://youtu.be/VI3dT4aXkfM" rel="nofollow noreferrer">Characteristics of a <em>Sotapanna</em></a>" at timestamp <a href="https://youtu.be/VI3dT4aXkfM?t=1552" rel="nofollow noreferrer">25:52</a>, <a href="https://vbgnet.org/dhammavuddho-mahathera/" rel="nofollow noreferrer">Ven. Dhammavuddho Mahathera</a> stated (with some paraphrasing):</p>

<blockquote>
  <p>The third condition, this word - <em>yoniso manasikara</em>, which I
  translate as focused attention. It is also known as careful attention.
  This word means that when you listen to the <em>Dhamma</em>, you are focused on
  listening to the <em>Dhamma</em>. In other words, at that time, you don't have
  the five hindrances. If that is so, then you can understand the <em>Dhamma</em>
  and attain stream entry.</p>
  
  <p>So who are the people who do not have the five hindrances? In the
  suttas, it is stated by the Buddha that as long as a person has not
  attained <em>piti</em> and <em>sukha</em> which are secluded from unwholesome
  states, which are secluded from sensual pleasures, the five hindrances
  will obsess him and obsess him habitually.</p>
  
  <p>So, there are two types of persons who do not have the five
  hindrances. The first is the one who has attained the first <em>jhana</em>
  (i.e. he who has attained <em>piti</em> and <em>sukha</em>). When a person has attained
  the first <em>jhana</em>, he has eliminated the five hindrances and the Buddha
  says that the five hindrances no longer obsess that person habitually.
  ...</p>
  
  <p>So there are two conditions if a person has the hindrances. Firstly,
  it obsesses your mind, it enslaves your mind. Secondly, it is
  habitual, it is very often there. That's why when
  somebody rapes his daughter or rapes his granddaughter, 
  it's because he cannot control these hindrances. His
  hindrances overwhelms his mind, obsesses the mind. After a person
  attains the first <em>jhana</em>, the Buddha says that the five hindrances are
  eliminated.</p>
  
  <p>A lot of people don't believe it because they don't really understand
  the hindrances. If I ask you what are the hindrances, a lot of people
  will say sensual desire, ill will, sloth and torpor, restlessness and
  worry, and doubt. But these are not the five hindrances. These are
  called the five hindrances only when they obsess your mind, when they
  enslave your mind and they recur habitually. Only then they are called
  the five hindrances.</p>
  
  <p>When a person attains the first <em>jhana</em>, these five hindrances reduce to
  a low level. They are still there but they are not called hindrances
  any more. It's just as if you walk through a jungle, you may
  encounter seven foot high <a href="https://en.wikipedia.org/wiki/Imperata_cylindrica" rel="nofollow noreferrer">long grass</a> obstructing you. It's a
  hindrance because when you try to go through it, you cannot see in
  front of you. Secondly, it cuts or injures your skin. So, it's a big
  hindrance. But if I cut down that long grass to 12 inches, it is no
  more a hindrance. But it is still observable.</p>
  
  <p>So, when a person attains  the first <em>jhana</em>, 
  it's as if the seven foot high long grass has 
  been cut down to 12 inches. When he attains the second <em>jhana</em>, 
  the 12 inches becomes 8 inches. 
  When he attains the third <em>jhana</em>, it becomes 4
  inches. When he attains the fourth <em>jhana</em>, it becomes one millimeter.
  So there is a big difference between the first three <em>jhanas</em> and the
  fourth <em>jhana</em>.</p>
  
  <p>That is why it is said that once a person attains the first <em>jhana</em>, the
  hindrances are (nearly) eliminated, 
  meaning generally (nearly) eliminated for good.</p>
</blockquote>
