32 Commits

Author SHA1 Message Date
a5150b7c0b fixed typo 2020-08-24 17:53:37 -07:00
28da1cd78e updated css retrieval method 2020-08-24 17:29:00 -07:00
b1d7778750 Merge branch 'master' into dockerize
Merging  master into dockerize
2020-08-24 17:17:20 -07:00
1d651d5af7 Update README 2020-08-24 17:14:04 -07:00
cf15fc5097 updated readme for docker info 2020-08-24 16:53:32 -07:00
48223dfdfd updated screenshot 2020-08-24 16:50:28 -07:00
893761d4e8 added compose file 2020-08-24 16:47:37 -07:00
4369b2d721 updated screenshot 2020-08-24 16:34:09 -07:00
933c16ac7e updating dockerize branch 2020-08-24 16:29:25 -07:00
e11f8aa6e9 Update README.md 2020-08-24 16:27:16 -07:00
086707a355 Update README.md 2020-08-24 16:25:35 -07:00
1e9677dcb9 added scrot 2020-08-24 16:16:21 -07:00
eb404aca82 i hate merging 2020-08-24 16:15:39 -07:00
6e75da4ec2 added forest theme 2020-08-24 16:15:17 -07:00
db03581cfd Update README.md 2020-08-24 16:08:18 -07:00
59a8b23a4b Update README.md 2020-08-24 16:07:57 -07:00
56c0bf2af7 added photos 2020-08-24 16:07:29 -07:00
15adabdd86 fuck you 2020-08-24 15:59:12 -07:00
9b969eecf6 renamed main script 2020-08-24 15:57:37 -07:00
8492439cdc updated README 2020-08-24 15:54:37 -07:00
0da73d49ed added theme selection 2020-08-24 15:52:49 -07:00
a2fd07f2df Merge remote-tracking branch 'origin/themes' into master
merged master with themes branch
2020-08-24 15:18:08 -07:00
22d7b4ce73 fixed bug with duplicate keys 2020-08-24 15:13:14 -07:00
9a78049525 implemented font-size selection 2020-08-24 15:07:28 -07:00
2f28ed3063 added docker files 2020-08-24 14:58:33 -07:00
527a1a8712 added gen_css skeleton 2020-08-24 14:52:50 -07:00
a84f0f9e3e added font-size variable to config 2020-08-24 14:51:57 -07:00
d2b80fd1eb updated readme 2020-08-24 14:34:34 -07:00
c1f8bde5e9 removed example folder 2020-08-24 14:14:13 -07:00
e543ce7b9d Merge remote-tracking branch 'origin/initscript' into master
merge initscript to master
2020-08-24 14:11:24 -07:00
2b90acc3ac updated README 2020-08-24 14:11:05 -07:00
40ba3abed4 functional install.py completed 2020-08-24 14:10:37 -07:00
17 changed files with 221 additions and 247 deletions

View File

@ -2,22 +2,86 @@
A terminal-style home page replicating the tree command.
<p align="center">
<img src="/StartTree.png", title="StartTree"/>
<img src="/images/StartTree.png", title="StartTree"/>
</p>
## TODO
- [x] Add screenshot to README.md
- [x] add install script
- [ ] Should allow selection of search engine
- [ ] Should allow for multiple columns
- [ ] User makes a 'config.yaml' file that is parsed and translated into the HTML
<div align="center">
<h1>
<a href="https://gideonwolfe.com/">
<img style="vertical-align:middle" src="/images/forest.png", width="400", />
</a>
<span style="">
<img style="vertical-align:middle" src="/images/void.png", width="400", />
</a>
</span>
</h1>
</div>
```yaml
Tree_1:
General:
Google: "https://www.google.com/"
Youtube: "https://www.youtube.com/"
Reddit:
Homepage: "https://www.reddit.com/"
Unixporn: "https://www.reddit.com/r/unixporn/"
# Usage
## Installation
To install StartTree for the first time, run the following commands:
(Note: If the `~/.config/StartTree` directory already exists, `init.py` will not execute to prevent accidentally overwriting a custom config. )
```
git clone https://github.com/Paul-Houser/StartTree.git
cd StartTree
./init.py
./generate.py
```
This will create the directory `~/.config/StartTree` containing the default `config.yaml`, as well as generate the html/css, which you can view by pointing your browser at `$HOME/.cache/StartTree/index.html`.
## Config
The config should be placed in `~/.config/StartTree/config.yaml`
## Updating the HTML
To re-generate the html/css after editing the config, navigate to the `StartTree` directory and execute `./generate.py`.
# Example Config
```yaml
font_size: 22 # specify font size
theme: void # specify the name of a theme in the themes/ directory, or use 'pywal'
tree_1: # each column should be named 'tree_X' where X is unique for each tree.
general: # Header name
github: "https://www.github.com/" # Link-text: url
gmail: "https://mail.google.com/"
reddit:
# the following is an example of naming a link something with a space,
# or containing characters that cannot be in a yaml variable name.
frontpage:
- "https://www.reddit.com/"
- "front page" #
unixporn: "https://www.reddit.com/r/unixporn/"
tree_2:
other:
archwiki:
- "https://archlinux.org/"
- "arch wiki"
hulu: "https://www.hulu.com/"
netflix: "https://www.netflix.com/"
youtube: "https://www.youtube.com/"
```
# Themes
A variety of themes can be found in the `themes` directory.
If one wishes to dynamically theme from `pywal`, they may select `pywal` as their chosen theme in `config.yaml`.
# Docker
In order to circumvent some restrictions on browsers for what is allowed as a "Home" and "New Tab" page, you can host StartTree as a lightweight `NGINX` server through `docker-compose`.
To set this up, one must have `docker` and `docker-compose` installed and configured. Then, go into the directory where you cloned `StartTree`, and run
```bash
cd docker
vim docker-compose.yaml # edit specifics to your liking
docker-compose -f docker-compose.yaml up -d
```
This will make the `NGINX` server persist across reboots. You can point your browser's new tab and home page to `localhost:p<port#>` and you should your startpage!
### NOTE:
Currently, docker is unaware if a file changes on the fly (like generating a new colorscheme or adding new shortcuts), so you have to restart the container with
`docker-compose -f docker-compose.yaml restart <servicename>`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 KiB

View File

@ -1,70 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="./styles/style.css">
<title>Home</title>
</head>
<body>
<div class="container">
<div class="prompt">~<span> λ</span> tree</div>
<div class="row">
<div class="column">
<div class="tree">
<h1>.</h1>
<ul>
<li>
<h1>general</h1>
<ul>
<li><a href="https://cloud.paulhouser.xyz">nextcloud</a></li>
<li><a href="https://github.com/Paul-Houser">github</a></li>
<li><a href="https://gitlab.cs.wwu.edu">wwu-gitlab</a></li>
<li><a href="https://mail.google.com">gmail</a></li>
</ul>
</li>
<li>
<h1>reddit</h1>
<ul>
<li><a href="https://reddit.com">front page</a></li>
<li><a href="https://reddit.com/u/P_swizzles">profile</a></li>
<li><a href="https://reddit.com/r/unixporn">unixporn</a></li>
<li><a href="https://reddit.com/r/archlinux">archlinux</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="column">
<div class="tree">
<h1>.</h1>
<ul>
<li>
<h1>school</h1>
<ul>
<li><a href="https://wwu.instructure.com/">canvas</a></li>
<li><a href="https://dw.wwu.edu/Dashboard/dashboard">degreeworks</a></li>
<li><a href="https://outlook.office.com">outlook</a></li>
<li><a href="https://admin.wwu.edu/pls/wwis/twbkwbis.P_GenMenu?name=bmenu.P_MainMnu">web4u</a></li>
</ul>
</li>
<li>
<h1>other</h1>
<ul>
<li><a href="https://archlinux.org">arch wiki</a></li>
<li><a href="https://hulu.com">hulu</a></li>
<li><a href="https://www.netflix.com">netflix</a></li>
<li><a href="https://youtube.com">youtube</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="prompt">~<span> λ</span> ddg</div>
<form action="https://duckduckgo.com/" method="GET">
<h1>search: </h1>
<input type="text" name="q" autofocus="autofocus">
</form>
</div>
</body>
</html>

Binary file not shown.

View File

@ -1,133 +0,0 @@
@import url('/home/paul/.cache/wal/colors.css');
@font-face {
font-family: "Roboto Mono";
src: url("./Hack.ttf");
}
:root {
--font: "Roboto Mono";
/* --background: var(--background) !important; */
/* --foreground: #fffffe; */
/* --pink: #e53170; */
/* --red: #f25f4c; */
/* --orange: #ff8906; */
/* --branch: 1px solid #a7a9be; */
--branch: 1px solid var(--color12);
}
html {
font-size: 22px;
}
body {
background: var(--background);
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.prompt {
font-family: var(--font);
color: var(--color5);
}
.prompt~.prompt {
padding: 1.5rem 0 0.3125rem;
}
span {
color: var(--color10);
}
h1 {
display: inline;
font-family: var(--font);
font-size: 1rem;
font-weight: normal;
color: var(--color9);
}
.tree > ul {
margin: 0;
padding-left: 1rem;
padding-right: 1rem;
}
ul {
list-style: none;
padding-left: 2.5rem;
}
li {
position: relative;
}
li::before, li::after {
content: "";
position: absolute;
left: -0.75rem;
}
li::before {
border-top: var(--branch);
top: 0.75rem;
width: 0.5rem;
}
li::after {
border-left: var(--branch);
height: 100%;
top: 0.25rem;
}
li:last-child::after {
height: 0.5rem;
}
a {
font-family: var(--font);
font-size: 1rem;
color: var(--color6);
text-decoration: none;
outline: none;
}
a:hover {
color: var(--color12);
background: var(--background);
}
form h1 {
padding-left: 0.125rem;
}
input {
font-family: var(--font);
font-size: 1rem;
color: var(--color6);
background-color: var(--background);
border-width: 1px;
border-color: var(--color12);
border-style: solid;
padding-top: 4px;
padding-bottom: 4px;
}
.column {
flex: 50%;
padding: 5px;
}
.row {
display: flex;
}
.row:after {
content: "";
display: table;
clear: both;
}

View File

@ -1,22 +1,15 @@
Tree_1:
font_size: 22
theme: void
tree_1:
general:
nextcloud: "https://cloud.paulhouser.xyz/"
github: "https://www.github.com/Paul-Houser/"
wwu-gitlab: "https://gitlab.cs.wwu.edu/"
github: "https://www.github.com/"
gmail: "https://mail.google.com/"
reddit:
frontpage:
- "https://www.reddit.com/"
- "front page"
profile: "https://www.reddit.com/u/P_swizzles/"
unixporn: "https://www.reddit.com/r/unixporn/"
archlinux: "https://www.reddit.com/r/archlinux/"
Tree_2:
school:
canvas: "https://wwu.instructure.com/"
degreeworks: "https://dw.wwu.edu/Dashboard/dashboard"
outlook: "https://outlook.office.com"
web4u: "https://admin.wwu.edu/pls/wwis/twbkwbis.P_GenMenu?name=bmenu.P_MainMnu"
tree_2:
other:
archwiki:
- "https://archlinux.org/"

BIN
docker/data/Hack.ttf Normal file

Binary file not shown.

View File

@ -0,0 +1,15 @@
version: '3'
services:
StartTree:
image: nginx
volumes:
- $HOME/.cache/StartTree/styles/colors.css:/usr/share/nginx/html/styles/colors.css # This needs to be changed depending on theme
- $HOME/.cache/StartTree/index.html:/usr/share/nginx/html/index.html
- $HOME/.cache/StartTree/styles/style.css:/usr/share/nginx/html/styles/style.css
- $HOME/.cache/StartTree/styles/Hack.ttf:/usr/share/nginx/html/styles/Hack.ttf
ports:
- "9876:80"
environment:
- NGINX_PORT=80
restart: unless-stopped

View File

@ -35,7 +35,12 @@ def print_keys(dictionary):
def gen_list_indices(html_file, file_dict):
for key in file_dict:
print()
value = file_dict[key]
print(key + "->" + str(value))
if not isinstance(value, list):
html_file.write("<li><a href=\"" + value + "\">" + key + "</a></li>")
else:
html_file.write("<li><a href=\"" + value[0] + "\">" + value[1] + "</a></li>")
def gen_col_headers(html_file, file_dict):
for key in file_dict:
@ -51,17 +56,18 @@ def gen_col_headers(html_file, file_dict):
def gen_columns(html_file, file_dict):
for key in file_dict:
html_file.write("<div class=\"column\">\n")
html_file.write(" <div class=\"tree\">\n")
html_file.write(" <h1>.</h1>\n")
html_file.write(" <ul>\n")
if key.split("_")[0] == "tree":
html_file.write("<div class=\"column\">\n")
html_file.write(" <div class=\"tree\">\n")
html_file.write(" <h1>.</h1>\n")
html_file.write(" <ul>\n")
# generate the column headers
gen_col_headers(html_file, file_dict[key])
# generate the column headers
gen_col_headers(html_file, file_dict[key])
html_file.write(" </ul>\n")
html_file.write(" </div>\n")
html_file.write("</div>\n")
html_file.write(" </ul>\n")
html_file.write(" </div>\n")
html_file.write("</div>\n")
def gen_html(file_dict):
@ -93,8 +99,38 @@ def gen_html(file_dict):
print("Done!")
def gen_style(file_dict):
skeleton_style = open('./skeletons/style.css', 'r')
cache_style = open(cache_dir + '/styles/style.css', 'w')
# find style attributes in file_dict
font_size = 20
theme = "void"
for key in file_dict:
if key == "font_size":
font_size = file_dict[key]
if key == "theme":
theme = file_dict[key]
if theme == "pywal":
theme = home + '/.cache/wal/colors.css'
else:
theme = '../themes/' + theme + '.css'
copyfile(theme, home + '/.cache/StartTree/styles/colors.css')
cache_style.write("@import url('./colors.css');\n")
lines = skeleton_style.readlines()
for line in lines:
if line == "/* font-size */\n":
cache_style.write("font-size: " + str(font_size) + "px;\n")
else:
cache_style.write(line)
def main():
file_dict = parse_yaml()
gen_style(file_dict)
gen_html(file_dict)
if __name__ == '__main__':

BIN
images/StartTree.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 KiB

BIN
images/forest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
images/void.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

@ -21,11 +21,6 @@ config_path = home + '/.config/StartTree/config.yaml'
# get cache path
cache_dir = home + '/.cache/StartTree'
def prettifyHTML(html):
soup = BeautifulSoup(html, 'html.parser')
prettyHTML = soup.prettify()
return prettyHTML
def setup():
# check if .config path exists
if not os.path.isdir(home + '/.config'):
@ -57,6 +52,9 @@ def setup():
print("Creating '" + cache_dir + "'...")
os.mkdir(cache_dir)
print("symlinking themes")
os.symlink(os.getcwd() + '/themes', home + '/.cache/StartTree/themes')
print("Creating '" + cache_dir + "/styles'")
os.mkdir(cache_dir + '/styles')

View File

@ -1,4 +1,3 @@
@import url('/home/paul/.cache/wal/colors.css');
@font-face {
font-family: "Roboto Mono";
src: url("./Hack.ttf");
@ -16,7 +15,7 @@
}
html {
font-size: 22px;
/* font-size */
}
body {

24
themes/black-ice.css Normal file
View File

@ -0,0 +1,24 @@
:root {
/* Special */
--background: #000000;
--foreground: #9a9c9f;
--cursor: #9a9c9f;
/* Colors */
--color0: #000000;
--color1: #04294d;
--color2: #2d2d2d;
--color3: #094c57;
--color4: #176485;
--color5: #585a5a;
--color6: #62909b;
--color7: #9a9c9f;
--color8: #36393f;
--color9: #04294d;
--color10: #2d2d2d;
--color11: #094c57;
--color12: #176485;
--color13: #585a5a;
--color14: #62909b;
--color15: #9a9c9f;
}

24
themes/forest.css Normal file
View File

@ -0,0 +1,24 @@
:root {
/* Special */
--background: #020303;
--foreground: #9da0a0;
--cursor: #9da0a0;
/* Colors */
--color0: #020303;
--color1: #2b3d30;
--color2: #424a55;
--color3: #405642;
--color4: #5b6a55;
--color5: #7f8d76;
--color6: #82908c;
--color7: #9da0a0;
--color8: #3b4242;
--color9: #2b3d30;
--color10: #424a55;
--color11: #405642;
--color12: #5b6a55;
--color13: #7f8d76;
--color14: #82908c;
--color15: #9da0a0;
}

24
themes/void.css Normal file
View File

@ -0,0 +1,24 @@
:root {
/* Special */
--background: #06070A;
--foreground: #79c4c6;
--cursor: #79c4c6;
/* Colors */
--color0: #06070A;
--color1: #175564;
--color2: #066C71;
--color3: #414255;
--color4: #0E7587;
--color5: #64468F;
--color6: #8D419F;
--color7: #79c4c6;
--color8: #54898a;
--color9: #175564;
--color10: #066C71;
--color11: #414255;
--color12: #0E7587;
--color13: #64468F;
--color14: #8D419F;
--color15: #79c4c6;
}