add using the wiki and centered status bar pages

This commit is contained in:
speedie 2023-02-18 15:18:01 +01:00
parent bd53b16666
commit 6981d1dc93
5 changed files with 59 additions and 9 deletions

View file

@ -294,6 +294,7 @@ input.pagename {
width: 20em;
}
/* buttons (non-colors) */
input[type="button"],
input[type="submit"] {
border:none;
@ -306,21 +307,23 @@ input[type="submit"] {
margin-right: 1em;
}
/* buttons (such as for the edit page) */
input[type="submit"] {
/*background-color: rgb(22, 101, 201);*/
background-color: #222222;
color: white;
background-color: #ffffff;
color: black;
}
input[type="button"] {
background-color: rgb(220, 220, 220);
background-color: #222222;
color: white;
}
input[type="submit"]:hover {
/*background-color: rgb(69, 135, 226);*/
background-color: #222222;
background-color: #ffffff;
color: black;
}
input[type="button"]:hover {
background-color: rgb(200, 200, 200);
background-color: #222222;
color: white;
}
img {

View file

@ -0,0 +1,22 @@
Centered status bar
===================
Thanks to [[Configuring the bar]] and the `es` modules, we can position the status text in the center similar to the [splitstatus](https://dwm.suckless.org/patches/splitstatus) patch.
To do this, start off by copying `bar.h` to `bar.rl.h`. This is optional, but I highly recommend it. Now, you'll want to add a module like this.
`{ -1, 0, bar_align_center, width_status_es, draw_status_es, click_status_es, 0, "extra status" },`
We're using `bar_align_center` because we want it in the center, that's the point here. We're using `es` modules because we want to have status text in both the center and the usual right. In the default configuration, you'll (probably) want to remove the title module, or move it to the other bar to get the aesthetic you want. Now that you have the modules configured, compile this using `make clean install`.
To use the `es` modules, you simply add `;` somewhere in the status text. Any text after will be considered extrastatus text. For example `speedwm -s "Hello;World"` will draw Hello as regular status text and World as extra status text in the center of the bar.
### Usage in the status bar
The above is all cool and all, but if we want to use it with the built in status bar, we need to integrate it into the modules. There are many different ways this could be done, but we're going to do it the easiest here. In this example, we're going to put the time in the center and the rest will be in the normal status bar.
Copy `status.h` to `status.rl.h` and `vim status.rl.h`. Now we can remove the `module_time` module, because a duplicate is unnecessary. Let's add a module to the array like this.
`{ ";", "module_time --print", 1, 1 },`
Of course, the `;` here switches to the centered status. Now we can run `make clean install` and restart `speedwm_status`. You should see your expected changes and the time should be in the center now.

24
pages/Using the wiki.md Normal file
View file

@ -0,0 +1,24 @@
Using the wiki
==============
Lost? If you don't know where to go, you can click the icon on the top bar. The `All` button allows you to get a view of all articles that have been posted on the wiki.
There is also a search bar at the top of every page which allows you to search for any article that has been posted.
## Basic wiki features
The wiki, based on a fork of w2wiki allows you to create new articles, edit existing articles, read existing articles (that's pretty much given), [host it yourself](https://codeberg.org/speedie/speedwm-wiki), and delete articles.
Now, please note that I am giving you this power, and with great power comes great responsibility. I want everyone to be able to help with the project. However, if it gets abused by people then I will have to remove this functionality and go back to using purely Git.
So please don't ruin it for everyone. If the wiki has to be shut down due to your vandalism, we hate you forever. That said, we do make Git backups fairly often (I will not say how often to prevent vandalism), so if an article is deleted it should be possible to restore it with minor changes lost.
## The sidebar
The sidebar is a markdown page like any other and can also be edited as any other. It is supposed to be used as a list of links, but of course there is no limit to what you can do with it.
To edit it, click `All` and edit `_sidebar`. From there, you can follow regular markdown syntax.
## Testing locally
Please, please, please test locally if you're new to markdown. That way, you avoid (for example) deleting pages by accident. You can easily test an identical (minus some pages perhaps) copy of the wiki locally by installing `php` with your distro's package manager and cloning [the repo](https://codeberg.org/speedie/speedwm-wiki) somewhere. If you don't know what you're doing, just cd into it, run `php -S localhost:1337` to start PHP, open any web browser and go to `localhost:1337`. Of course, the `1337` here can be swapped out for almost any value, it's just what I happen to go with.

2
run.sh
View file

@ -13,8 +13,6 @@ POST_DIR="$1"
cd "$POST_DIR" || die "Does not exist."
pwd
[ -e "/tmp/markdown-log" ] && mv /tmp/markdown-log /tmp/markdown-log-2
find ./*md > /tmp/markdown-log

3
test.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
printf "Testing locally..\nOpen 'localhost:1337' in your web browser.\n"
php -S localhost:1337