1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
.Dd September 15, 2026
.Dt HOMESCREEN 1
.Os
.Sh NAME
.Nm homescreen
.Nd an Android launcher, built without Gradle
.Sh SYNOPSIS
.Nm homescreen-install
.Op Fl wireless
.Op Fl set-default
.Op Fl unset-default Ar package
.Op Fl serial Ar serial
.Op Fl print-apk Ar path
.Sh DESCRIPTION
.Nm
is an Android home screen.
It is built from a Nix derivation that drives the Android SDK tools directly,
without Gradle, and installed with
.Nm homescreen-install ,
which signs the APK with a key kept outside the repository.
.Pp
The screen is a four-column grid of every launchable application, each drawn as
its icon above its name, with a search field along the bottom.
Applications that have been pinned are shown first, in a section of their own
above a rule; the rest follow, ordered by use.
.Ss Ordering
Sorting by last-used time alone is correct and unusable: every launch reorders
the grid, so no position is worth learning and the thing reached for moves
because it was reached for.
.Pp
Instead the last-used time is quantised: used in the last day, in the last week,
in the last month, longer ago, never.
Applications are ordered by that bucket and then alphabetically within it, so
the ones in regular use collect at the top, but using one again does not move
it.
The layout changes only when something crosses a boundary, which is roughly
daily rather than hourly.
.Pp
Pinned applications are listed alphabetically and are excluded from the grid
below, so nothing appears twice.
They are sorted by name rather than by when they were pinned, so that pinning
something new never moves what is already there.
.Ss Searching
Typing in the field at the bottom narrows the grid to applications whose name
contains what was typed, ignoring case.
The pinned section is hidden while searching: the point of searching is to
reach something that is not pinned.
.Pp
The field takes focus only when tapped.
It is the only focusable view on the screen, and would otherwise take focus when
the window opens and bring the keyboard with it, covering half the grid before
anything has been typed.
.Ss Pinning
A long press pins an application, or unpins one already pinned, and says which
in a brief message.
There is no confirmation and no menu: pinning is cheap and immediately visible,
and undoing it is the same gesture again.
.Pp
Because a long press is spent on pinning, there is no way to reach an
application's system settings page from here.
.Pp
It answers both
.Li CATEGORY_HOME
and
.Li CATEGORY_LAUNCHER ,
so it can be used as the home screen or opened from the app drawer of the
launcher that currently is one.
Installing does not change the home screen; only
.Fl set-default
does.
.Ss Installing
.Bl -tag -width Ds
.It Fl serial Ar serial
Install to this
.Xr adb 1
device.
Without it, a device attached over USB is preferred, and mDNS discovery is used
only if there is none.
.It Fl wireless
Skip USB and discover the device over mDNS.
.It Fl set-default
Also make
.Nm
the default home screen, equivalent to picking it from the Home app dialog.
Read
.Sx CAVEATS
first.
.It Fl unset-default Ar package
Give the home screen back to
.Ar package
and exit, without building or signing anything.
The stock launcher on a Pixel is
.Li com.google.android.apps.nexuslauncher .
.It Fl print-apk Ar path
Sign the APK to
.Ar path
and exit without installing.
.El
.Sh FILES
.Bl -tag -width Ds
.It Pa ~/.config/homescreen/keystore.jks
The signing key, created on first run.
.It Pa /data/data/de.profpatsch.homescreen/databases/homescreen.db
On the phone, and private to the application.
Holds which applications have been pinned and nothing else: which applications
exist is answered by
.Li LauncherApps
and which have been used recently by
.Li UsageStatsManager ,
so neither is ours to store.
.Pp
Schema changes are numbered migrations applied once each and recorded in
.Li schema_version ,
as in the Go programs in this repository.
A migration that has been applied is never edited; another one is added.
.El
.Sh SEE ALSO
.Xr adb 1
.Sh AUTHORS
.An Profpatsch
.Sh CAVEATS
.Ss Usage access has to be granted, and is not granted by installing
Ordering the grid by use needs
.Li PACKAGE_USAGE_STATS ,
which is not an ordinary permission: it is an app op, switched on per
application under
.Pa Settings > Apps > Special app access > Usage access .
.Nm homescreen-install
switches it on over
.Xr adb 1
instead, and reads the value back rather than trusting it \(en
.Li appops set
reports success and silently does nothing if the permission is not declared in
the manifest.
.Pp
Without it the query returns nothing rather than failing, so the grid falls back
to plain alphabetical order.
That is worse but not broken, which is the intended behaviour: a missing
permission must never leave the phone without a working home screen.
.Ss Getting back to another launcher
Making
.Nm
the default home screen is safe in the sense that every application remains
reachable, through the grid or through search.
Changing back is still worth knowing before it is needed, and does not require
the phone to be usable, because it goes over
.Xr adb 1 :
.Bd -literal -offset indent
homescreen-install -unset-default com.google.android.apps.nexuslauncher
.Ed
.Pp
Through the phone alone it is
.Pa Settings > Apps > Default apps > Home app ,
and Settings is in the grid like anything else.
.Ss Keep another launcher installed
A home screen that crashes on startup leaves the phone with no usable home
button.
The only other package answering
.Li CATEGORY_HOME
on a stock Pixel is Settings, which is a narrow way back.
Do not uninstall the stock launcher.
.Ss The signing key cannot be lost
Android refuses to update an application whose signature has changed.
Losing
.Pa keystore.jks
means uninstalling
.Nm
and losing whatever it stores.
It belongs in a backup.
.Ss Wireless debugging is reachable from the whole tailnet
.Li adbd
listens on the IPv6 wildcard, not only on Wi-Fi, so with wireless debugging
enabled the port is reachable from every network the phone is on \(en including
a VPN.
It also advertises itself over mDNS with the device's model and serial.
.Pp
Connections are authenticated: the credential is
.Pa ~/.android/adbkey ,
the same key that authorises USB.
The consequence is that this file becomes remotely usable rather than merely
locally usable, so anyone holding a copy can obtain a shell from anywhere on
the same network, with no prompt on the device.
This is why
.Nm homescreen-install
prefers USB, which requires physical access.
Turn wireless debugging off when not installing.
.Pp
The port is randomised whenever wireless debugging is toggled, so it must be
discovered rather than remembered.
.Ss No AndroidX
The build resolves no Maven dependencies: it compiles against
.Pa android.jar
and the Kotlin standard library, and nothing else.
Everything a launcher needs exists in the platform at
.Li minSdk 33 ,
but adding an AndroidX library is not a matter of naming it \(en most ship as
.Pa .aar ,
which would have to be unpacked, its resources compiled, its manifest merged
and its transitive dependencies resolved by hand.
.Pp
Two consequences are visible in the code.
SQLite is used through
.Li android.database.sqlite ,
present since API 1, rather than through Room, which is a code generator over
those same classes.
And the two sections are two
.Li GridView Ns s
stacked in a
.Li ScrollView ,
because
.Li GridView
has no notion of a section header \(en
.Li addHeaderView
belongs to
.Li ListView
\(en and the usual answer,
.Li RecyclerView
with a full-span header, is exactly such a library.