2
1
Fork 0

guide: the grammar police strike again

This commit is contained in:
outfoxxed 2024-03-14 03:21:31 -07:00
parent f181b8cbd2
commit df0ccc2a97
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -517,11 +517,10 @@ ShellRoot {
## Multiple files ## Multiple files
In an example as small as this it isn't a problem, but as your project In an example as small as this, it isn't a problem, but as the shell
gets bigger you may become annoyed having everything all grows it might be prefferable to separate it into multiple files.
in one file. Luckily its easy to break a component out to a new file.
Lets move the entire bar into a new file to make space for other widgets: To start with, let's move the entire bar into a new file.
```qml {filename="shell.qml"} ```qml {filename="shell.qml"}
import Quickshell import Quickshell
@ -585,12 +584,11 @@ We can bring in other folders as well using
[import statements](/docs/configuration/qml-overview/#explicit-imports). [import statements](/docs/configuration/qml-overview/#explicit-imports).
Now what about breaking out the clock? This is a bit more complex because Now what about breaking out the clock? This is a bit more complex because
the clock component in the bar and the process and timer that make up the actual the clock component in the bar, as well as the process and timer that
clock both need to be dealt with. make up the actual clock, need to be dealt with.
To start with let's move the clock to a new file. For now it's just a To start with, we can move the clock widget to a new file. For now it's just a
single `Text` object but the same concepts apply regardless of complexity single `Text` object but the same concepts apply regardless of complexity.
(and you probably want a more complicated clock than this.)
```qml {filename="ClockWidget.qml"} ```qml {filename="ClockWidget.qml"}
import QtQuick import QtQuick
@ -725,7 +723,7 @@ Scope {
Now you might be thinking, why do we need the `Time` type in Now you might be thinking, why do we need the `Time` type in
our bar file, and the answer is we don't. We can make `Time` our bar file, and the answer is we don't. We can make `Time`
a [singleton](/docs/configuration/qml-overview/#singletons). a [Singleton](/docs/configuration/qml-overview/#singletons).
A singleton object has only one instance, and is accessible from A singleton object has only one instance, and is accessible from
any scope. any scope.