1
0
forked from extern/nix-config

Major clean up overall

This commit:

- Moves the rest of the packages from packages.sh to PKGBUILD
- Updates the README to include upstream packages instead of relying on
  our own local versions of them
- Removes the rest of the legacy install scripts
- Adds some missing config options and other useful commands to the
  README and help files
- Removes the local copy of launch-cmd in favor of upstream instead
- Moves a variety of smaller help files to other.md
- Adds fish information to other.md
- Moves automation information to install-guide.sh
- Removes the local copy of Arch Silence in favor of upstream instead
- Updates theme_helper.cr before eventually removing it in favor of Mica
This commit is contained in:
Donovan Glover 2018-01-28 23:48:42 -05:00
parent 65e0ed690a
commit a42e4ad4d0
No known key found for this signature in database
GPG Key ID: 8FC5F7D90A5D8F4D
22 changed files with 413 additions and 327 deletions

View File

@ -2,7 +2,7 @@ pkgname=new-start
pkgver=0.1.0
pkgrel=1
pkgdesc="A modern Arch workflow built with an emphasis on functionality."
arch=('i686' 'x86_64')
arch=('any')
license=('GPL')
depends=(
# Core system
@ -73,11 +73,41 @@ depends=(
'borg' # Backup directories
'exa' # Drop-in replacement for ls and tree
'fd-rs' # Faster alternative to find
'diff-so-fancy' # A better looking git diff
'diff-so-fancy' # A better-looking git diff
'youtube-dl' # View online videos in mpv
# Fonts
'ttf-hack' # Terminal font
'ttf-fira-mono' # Polybar font
'noto-fonts' # Everything else
# Other languages
'elixir'
'ruby'
'go'
'php'
'jdk-9-openjdk'
'python'
'lua'
'nodejs'
# Other extras
'pygmentize' # Command line syntax highlighting (used for 'dog')
'ctags' # ctags (used with vim)
'shards' # Crystal package manager
'npm' # Node package manager
'ispell' # Spell checker (an alternative to the built-in vim one)
'alsa-utils' # (?) Required for sound support
# (La)TeX
'texlive-core' # TeX core
'texlive-science' # TeX + the formal sciences (mathematics, etc.)
'texlive-pictures' # Graphics support
'texlive-publishers' # Publisher formats
'texlive-latexextra' # LaTeX extras
'texlive-humanities' # TeX isn't just for mathematics
'texlive-fontsextra' # More fonts
'texlive-formatsextra' # More formats
'texlive-bibtexextra' # More features for BibTeX
'minted' # Add syntax highlighting support to LaTeX
)

View File

@ -24,6 +24,11 @@ New Start is built on top of [Arch GNU/Linux](https://www.archlinux.org/) and co
- Install the system from scratch and have the exact same configuration as before.
- It is trivial to make your own live usb of the system.
## Philosophy
1. Use configuration files for everything. Make it easy to replicate your entire setup on multiple machines, without having to manually click through things or add obscurely large "config" files.
2. Changing themes should make the computer feel completely different, but not affect the functionality itself.
## Before You Begin
1. [Linux is not an operating system](https://www.gnu.org/gnu/linux-and-gnu.html). All the so-called "Linux" distributions are actually distributions of [GNU/Linux](https://www.gnu.org/gnu/gnu-users-never-heard-of-gnu.html).
@ -44,7 +49,7 @@ Install the packages from your local user account:
```shell
git clone https://github.com/GloverDonovan/new-start
cd new-start
makepkg
makepkg -si
sudo pacman -U *.xz
```
@ -53,17 +58,46 @@ If you don't have one already, install an AUR helper:
```shell
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg
makepkg -si
sudo pacman -U *.xz
```
Next, use your AUR helper to install the AUR packages:
```shell
yay -S shotgun polybar ttf-noto htop-vim-git inox-bin waterfox-bin
yay -S shotgun polybar ttf-noto htop-vim-git inox-bin \
waterfox-bin arch-silence-grub-theme launch-cmd
```
Then choose which dotfiles you want to use:
Enable the Arch Silence GRUB theme:
```shell
grub-mkconfig -o /boot/grub/grub.cfg
```
Install crystal ctags:
```shell
git clone https://github.com/SuperPaintman/crystal-ctags
cd crystal-ctags
sudo make install
```
Install all the vim plugins:
```shell
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +PlugInstall +qall
```
Add the `undo` directory for regular vim:
```shell
mkdir ~/.vim/undo
```
Then choose which dotfiles you want to install:
```shell
mv dotfiles ~
@ -103,6 +137,25 @@ Some of the software I use include (in no particular order):
For a complete list of the packages included, see the [`PKGBUILD`](PKGBUILD).
If you want to use an alternative DNS server (such as [OpenNIC](https://www.opennic.org/)), put the following in your `etc/resolv.conf`:
```
nameserver # IP of nameserver 1
nameserver # IP of nameserver 2 (fallback #1)
nameserver # IP of nameserver 3 (fallback #2)
options timeout:1
```
Other things I use:
- Display Server: [xorg](https://wiki.archlinux.org/index.php/Xorg)
- Sound System: [alsa](https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture)
- Boot Loader: [grub](https://wiki.archlinux.org/index.php/GRUB)
- GRUB Theme: [arch-silence](https://github.com/fghibellini/arch-silence)
- Vim Keybindings: [VimFx](https://github.com/akhodakivskiy/VimFx), [Vimium](https://github.com/philc/vimium)
- Secure Connection: [HTTPS Everywhere](https://github.com/EFForg/https-everywhere)
- (vim) Plugin manager: [vim-plug](https://github.com/junegunn/vim-plug)
### Help Files
Help files are a way for me to keep track of all the useful commands I learn about certain software. They're compiled in easy-to-read files so I don't have to search the same thing over and over.

View File

@ -2,7 +2,7 @@
*
* New Start: A modern Arch workflow built with an emphasis on functionality.
* Copyright (C) 2017 Donovan Glover
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or

View File

@ -239,3 +239,8 @@ Note that if you ever get 404s with `pacman` or `yay`, you need to update your l
- Run a command as root: `pls <command>`
- Run the previous command as root: `pls !!`
## Startup Commands
- Turn the screensaver off and disable DPMS: `xset s off -dpms`
- Sync the system time with one on the internet: `sudo synctime`
- Launch Polybar `~/.config/polybar/launch.sh`

View File

@ -1,27 +0,0 @@
# The GNU/Linux System
This file holds information about GNU/Linux in general.
## Root file structure
```
/ # Root directory
/bin # Binaries for global commands (ls, cat, etc.)
/boot # Boot loader files (grub, the linux kernel, etc.)
/dev # "Device files" (/dev/null, /dev/random, etc.)
/etc # System-wide configuration files
/home # Saved files and personal settings of each user
/lib # Libraries used by the binaries in /bin
/lib64 # 64-bit libraries
/mnt # Temporarily mounted filesystems reside here
/opt # Applications that don't rely on other dependencies
/proc # Provides process and kernel information as files
/root # Home directory for the root user
/run # Information about the running system since last boot
/sbin # System binaries (fsck, init, route, etc.)
/srv # Site-specific data served by the system
/sys # Contains information about the system
/tmp # Temporary files used for processes
/usr # Applications that rely on other dependencies
/var # Variable files that are supposed to change over time
```

283
help/other.md Normal file
View File

@ -0,0 +1,283 @@
This file holds other GNU/Linux information that aren't (?) detailed enough to be their own file.
## Ranger
### Movement Keys
- Scroll down: `j`
- Scroll up: `k`
- Go back one directory: `h`
- Go forward one directory *or* open the selected file: `l`
- Move to the top of the file list: `gg`
- Move to the bottom of the file list: `G`
- Go to the Nth file: `<N>gg`
- Go to the home directory: `gh`
- Go to the root directory: `gr`
- Quit ranger: `q`
### Useful Things
- Search for files in the current directory: `/`
- Quickly find and automatically open files that match the pattern: `f`
- Manually choose software to open the selected file with: `r`
- Edit the selected file in your editor of choice: `E`
- Switch back to the terminal and cd to the current directory: `S`
- Toggle hidden files: `zh`
### Other Commands
- Enter command mode: `:`
- Change how files are sorted: `o`
- Sort by size: `s`
- Sort by file type: `t`
- Sort by last modified: `m`
- Sort by date created: `c`
- Sort by time accessed: `a`
- Sort alphabetically (default): `b`
- Reverse the results: `r`
- Randomize the results: `z`
- Rename the selected file: `:r <newname>`
- Edit an existing filename: `A`
### Other notes
- You should never use ranger to manipulate files. Ranger does one thing and does it well: explore files.
- You should not use tabs in ranger. What you would do with tabs can be accomplished easier with the terminal.
- Although bookmarks are a feature in ranger, your file management should be simple enough that bookmarks aren't required.
## GNU/Linux Root File Structure
```
/ # Root directory
/bin # Binaries for global commands (ls, cat, etc.)
/boot # Boot loader files (grub, the linux kernel, etc.)
/dev # "Device files" (/dev/null, /dev/random, etc.)
/etc # System-wide configuration files
/home # Saved files and personal settings of each user
/lib # Libraries used by the binaries in /bin
/lib64 # 64-bit libraries
/mnt # Temporarily mounted filesystems reside here
/opt # Applications that don't rely on other dependencies
/proc # Provides process and kernel information as files
/root # Home directory for the root user
/run # Information about the running system since last boot
/sbin # System binaries (fsck, init, route, etc.)
/srv # Site-specific data served by the system
/sys # Contains information about the system
/tmp # Temporary files used for processes
/usr # Applications that rely on other dependencies
/var # Variable files that are supposed to change over time
```
## Waterfox
### Command Mode
- Take a screenshot of the entire page `screenshot --fullpage`
- Take a screenshot of the visible window only `screenshot`
- Restart the browser `restart`
### Preferences
Waterfox has 2 preference files: `prefs.js` and `user.js`.
`prefs.js` are the settings defined by the browser and `user.js` is an optional file that you can create. `user.js` takes precedence over `prefs.js` and will replace the settings in `prefs.js` when Waterfox is started.
### Theme
Waterfox allows you to customize the appearance of the browser by creating your own `userChrome.css`. It is located inside of the `chrome` folder, which needs to be created by the user.
## tty
### Moving Around
- Move to the previous terminal: `Alt+Left`
- Move to the next terminal: `Alt+Right`
- Switch to the Nth terminal: `Ctrl+Alt+F<N>`
- Scroll up: `Shift+PgUp`
- Scroll down: `Shift+PgDn`
### Manipulating Text
- Copy text: `Ctrl+Shift+C`
- Paste text: `Ctrl+Shift+V`
- Go to the beginning of the line: `Ctrl+A`
- Go to the end of the line: `Ctrl+E`
- Remove everything after the cursor: `Ctrl+K`
- Clear the terminal: `Ctrl+L`
### Piping
- Take the output from `a` and use it as the input for `b`: `a | b`
- Take the output from `a` and write it to the file `b`: `a > b`
- Take the output from `a` and append it to the file `b`: `a >> b`
### Wildcard
- Use `*` anywhere as a wildcard to find all matches
- Use `**` to wildcard subdirectories (e.g. `~/.config/**/*.cr`)
### Control Keys
- Cancel the running command: `Ctrl+C`
- Suspend the current process (resume with `fg`): `Ctrl+Z`
## fish - the friendly interactive shell
### Passing things around
- Read input from a file: `command < file.txt`
- Write output to a file: `command > file.txt`
- Append output to a file: `command >> file.txt`
- Write an error to a file: `command ^ file.txt`
- Append an error to a file: `command ^^ file.txt`
### Misc.
- Pipe the output of a program into another one: `git status | lolcat`
- Learn more about a program: `man fish` **OR** `fish -h`
- Match any single character except `/` (includes an empty string): `?`
- Create a new variable: `set my_var "some_string"`
- By convention, exported variables are in `$UPPERCASE` and unexported variables are in `$lowercase`
- Create a new exported variable: `set -x MY_VAR "some_string"`
- Unset a variable: `set -e my_var`
### Jobs
- Start a background job: `ncmpcpp &`
- Bring a background job to the foreground: `fg`
- Move the current program to the background: `<C-z>`
Note that your fish config file is located at: `~/.config/fish/config.fish`
### Functions
```fish
function func
# Do something
end
```
Note that you should put your functions in `~/.config/fish/functions/function_name.fish`.
### Aliases
```fish
function ls
command exa $argv
end
```
```fish
alias ls="exa"
```
### Autosuggestions
- Complete autosuggestions with the right arrow **OR** `<C-f>`.
- Complete only the next word with alt right **OR** `<A-f>`.
- `-c` + The program you want to autocomplete for
- `-s` + A shorthand parameter (e.g. `-s o` for `-o`)
- `-l` + A longhand parameter (e.g. `-l output` for `--output`)
- `-a` + Parameter arguments (e.g. `-a "true false"` if an `--option` can take both `true` and `false` as values)
See complete --help for more options. Examples in `/usr/share/fish/completions`.
You can make completions in the terminal, a configuration file, anywhere!
### Tab Completions
Use tab for tab completion (as obvious as this may seem, it's really useful!)
Any completions you make should be in `~/.config/fish/completions/program_name.fish`
### Command substitution
- Pass the results of one command as the argument of another command: `echo (ls -al)`
### Expansions
- Brace expansion: `echo file.{png,jpg}`, `mv *.{cr,rs} src/`
- Variable expansion:
- `echo $var # => echo 1 2 3`
- `echo "$var" # => echo "1 2 3"`
- `set a 1; set b a; echo $$b # => 5`
- Index range expansion: `echo (seq 10)[1..5] # => echo 1 2 3 4 5`
- Reverse output: `echo (seq 10)[-1..1]`
- Home directory expansion: `~`
- Process expansion: `%self`
Note that in fish, variables start at 1, similar to lua et al.
```fish
set my_arr "a" "b" "c"
```
- `$argv` is the array of arguments given to the shell or function
You can change the colors fish uses with `$fish_color_*` and `$fish_pager_color_*`
To work with multiple lines in fish, either use `Enter` with a block statement (`if`, `for`, `begin`, etc.), use `<A-CR>`, or add `\` to the end of your lines.
- Only run with a login shell: `status --is-login`
- Only run with an interactive shell: `status --is-interactive`
- Get the status of the last executed command (success, failure, etc.): `echo $status`
- Use multiple commands on the same line `;`
- And operator: `; and`
- Or operator: `; or`
### Conditionals
```fish
if condition
# Do something
else
# Do something else
end
```
### Switch
```fish
switch(name)
case Sally
# Do something
case John
# Do something else
case '*'
# Catch-all
end
```
List all the functions available to fish: `functions`
### Loops
```fish
while true
# Do something
end
```
```fish
for file in *.txt
# Do something with all .txt files
end
```
```fish
for i in (seq 5)
# Do something 5 times
end
```
Set colors in fish:
```fish
set_color purple
echo "some text"
set_color normal
echo "more text"
```

View File

@ -1,45 +0,0 @@
## Ranger
### Movement Keys
- Scroll down: `j`
- Scroll up: `k`
- Go back one directory: `h`
- Go forward one directory *or* open the selected file: `l`
- Move to the top of the file list: `gg`
- Move to the bottom of the file list: `G`
- Go to the Nth file: `<N>gg`
- Go to the home directory: `gh`
- Go to the root directory: `gr`
- Quit ranger: `q`
### Useful Things
- Search for files in the current directory: `/`
- Quickly find and automatically open files that match the pattern: `f`
- Manually choose software to open the selected file with: `r`
- Edit the selected file in your editor of choice: `E`
- Switch back to the terminal and cd to the current directory: `S`
- Toggle hidden files: `zh`
### Other Commands
- Enter command mode: `:`
- Change how files are sorted: `o`
- Sort by size: `s`
- Sort by file type: `t`
- Sort by last modified: `m`
- Sort by date created: `c`
- Sort by time accessed: `a`
- Sort alphabetically (default): `b`
- Reverse the results: `r`
- Randomize the results: `z`
- Rename the selected file: `:r <newname>`
- Edit an existing filename: `A`
### Other notes
- You should never use ranger to manipulate files. Ranger does one thing and does it well: explore files.
- You should not use tabs in ranger. What you would do with tabs can be accomplished easier with the terminal.
- Although bookmarks are a feature in ranger, your file management should be simple enough that bookmarks aren't required.

View File

@ -1,32 +0,0 @@
## Moving Around
- Move to the previous terminal: `Alt+Left`
- Move to the next terminal: `Alt+Right`
- Switch to the Nth terminal: `Ctrl+Alt+F<N>`
- Scroll up: `Shift+PgUp`
- Scroll down: `Shift+PgDn`
## Manipulating Text
- Copy text: `Ctrl+Shift+C`
- Paste text: `Ctrl+Shift+V`
- Go to the beginning of the line: `Ctrl+A`
- Go to the end of the line: `Ctrl+E`
- Remove everything after the cursor: `Ctrl+K`
- Clear the terminal: `Ctrl+L`
## Piping
- Take the output from `a` and use it as the input for `b`: `a | b`
- Take the output from `a` and write it to the file `b`: `a > b`
- Take the output from `a` and append it to the file `b`: `a >> b`
## Wildcard
- Use `*` anywhere as a wildcard to find all matches
## Control Keys
- Cancel the running command: `Ctrl+C`
- Suspend the current process (resume with `fg`): `Ctrl+Z`

View File

@ -1,17 +0,0 @@
# Waterfox
## Command Mode
- Take a screenshot of the entire page `screenshot --fullpage`
- Take a screenshot of the visible window only `screenshot`
- Restart the browser `restart`
## Preferences
Waterfox has 2 preference files: `prefs.js` and `user.js`.
`prefs.js` are the settings defined by the browser and `user.js` is an optional file that you can create. `user.js` takes precedence over `prefs.js` and will replace the settings in `prefs.js` when Waterfox is started.
## Theme
Waterfox allows you to customize the appearance of the browser by creating your own `userChrome.css`. It is located inside of the `chrome` folder, which needs to be created by the user.

View File

@ -1,4 +1,16 @@
# This is my personal install guide. It's what I use to install Arch.
#
# Note that if you automate this the default password for your new
# account is the same as your username.
#
# Upon reboot:
# 1. Change the root password with `passwd`
# 2. Change the local account password with `passwd <username>`
#
# You may also want to turn on error handling so that any errors
# automatically terminate the script (useful for automation)
#
# set -e
$USERNAME = "hello"
$HOSTNAME = "world"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

View File

@ -1,82 +0,0 @@
##################################################################################
#
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017 Donovan Glover
#
# Arch Silence: A GRUB2 theme for Arch Linux users.
# Copyright (C) 2015 Filippo Ghibellini
# https://github.com/fghibellini/arch-silence
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
##################################################################################
# General settings
title-text: ""
desktop-color: "#333"
terminal-font: "Dejavu Sans Regular 12"
terminal-left: "0"
terminal-top: "0"
terminal-width: "100%"
terminal-height: "100%"
terminal-border: "0"
# Progress bar
+ progress_bar {
id = "__timeout__"
left = 0
top = 0
height = 15
width = 100%
show_text = false
# just two vertical pixels of color #1793d1
bar_style = "progress_bar/progress_bar_*.png"
highlight_style = "progress_bar/progress_bar_hl_*.png"
}
# Arch logo
+ image {
top = 50%-200
left = 50%-75
file = "arch_logo.png"
}
# Boot menu
+ boot_menu {
left = 50%-150
width = 500
top = 50%+100
height = 300
item_font = "DejaVu Sans Bold 14"
item_color = "#999"
selected_item_font = "DejaVu Sans Bold 14"
selected_item_color= "#fff"
item_height = 26
item_padding = 0
item_icon_space = 0
item_spacing = 1
scrollbar = false
}
# Help bar at the bottom
+ image {
top = 100%-56
left = 50%-175
file = "help_bar.png"
}

View File

@ -1,28 +0,0 @@
# Note that the default password for your new account is the same as your username. Upon reboot, the X server should automatically start at login. Then:
#
# 1. Change the root password with `passwd`
# 2. Change the local account password with `passwd <username>`
# Turn error handling on so that any errors terminate the script
set -e
USAGE="Usage: ./install.sh <hostname> $1 <localuser> $2"
# ============= We're done configuring, now install our stuff =============
# Install all the vim plugins
# TODO: Download vim-plug before this so :PlugInstall works
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Make the undo dir so we can undo with the regular vim
mkdir ~/.vim/undo
# TODO: Ensure that this works during the install process
vim +PlugInstall +qall
# This is a placeholder of the structure needed to install crystal-ctags
git clone https://github.com/SuperPaintman/crystal-ctags
cd crystal-ctags
sudo make install # TODO: Is sudo required here?

View File

@ -1,31 +0,0 @@
alias i="pacman --noconfirm -S"
i elixir # Install elixir, our functional language of choice
i ruby # Install ruby, another programming language of choice
i go # Install go, another dependency to build other packages
i php # Install php, used when we need to test php stuff
i php-cgi # Install php-cgi, used to make php work with local servers
i lua # Install lua, in case we ever want to use it
i jdk-9-openjdk # Install java, if for some reason we need to use it
i nodejs # Install node.js, used as a javascript runtime environment
i pygmentize # Install pygmentize, used as a variant of cat with syntax highlighting
i ctags # Install ctags, used with vim to create tags for formal languages
i shards # Install shards, a package manager for crystal
i npm # Install npm, a package manager for node.js
i ispell # Install ispell, used to spell check files
i alsa-utils # Install alsa-utils, required to make the sound system work
i texlive-core # Install texlive-core, the basic functionality required for TeX and LaTeX
i texlive-science # Install texlive-science, allowing us to easily use mathematics with TeX
i texlive-pictures # Install texlive-pictures, used to make graphics with TeX
i texlive-publishers # Install texlive-publishers, a collection of publisher formats
i texlive-latexextra # Install texlive-latexextra, giving us more LaTeX support
i texlive-humanities # Install texliive-humanities, an easier way to write text
i texlive-fontsextra # Install texlive-fontsextra, used for font variety
i texlive-formatsextra # Install texlive-formatsextra, additional support for TeX formats
i texlive-bibtexextra # Install texlive-bibtexextra, more features for BibTeX
i minted # Install minted, used for syntax highlighting in LaTeX

View File

@ -1,58 +0,0 @@
/********************************************************************************\
*
* New Start: A modern Arch workflow built with an emphasis on functionality.
* Copyright (C) 2017 Donovan Glover
*
* Launch: A command line launcher for users with a terminal-centric workflow.
* Copyright (C) 2017 Maxwell Anselm
* https://github.com/silverhammermba/launch
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
\********************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char** argv) {
if(argc <= 1) return 1;
pid_t child;
if(child = fork()) {
if(child == -1) {
perror("fork");
return 1;
}
printf("%ld\n", (long) child);
return 0;
}
if(!freopen("/dev/null", "w", stdout)) {
fprintf(stdout, "Failed to silence stdout.\n");
}
if(!freopen("/dev/null", "w", stderr)) {
fprintf(stderr, "Failed to silence stderr.\n");
}
execvp(argv[1], argv + 1);
if(freopen("/dev/tty", "w", stderr)) {
perror(argv[0]);
}
return 1;
}

View File

@ -25,6 +25,7 @@ require "./../trucolor"
# https://github.com/chriskempson/base16-shell
# https://github.com/chriskempson/base16-xresources
# https://github.com/nicodebo/base16-zathura
# https://github.com/samme/base16-styles
module Theme
extend self
@ -236,6 +237,24 @@ module Theme
File.write(file, config)
end
# Sets the colors used inside the web browser.
#
# This method changes the css variables used by the browser,
# allowing custom styles to take advantage of this and serve
# a variety of different color schemes effortlessly.
#
# This makes it trivial to have a browser that is completely
# immersed in your color scheme. You can even theme the websites
# that you use often enough so that it matches any color scheme
# you switch to!
def set_web(theme : Hash(YAML::Type, YAML::Type))
css : String = ""
theme.each do |key, value|
css += add_css key, value
end
puts css
end
# Sets the background color in termite.
#
# NOTE: This is particularly useful to avoid color flashing.
@ -355,6 +374,10 @@ module Theme
return "set #{type.ljust(30)} \"##{color.to_s}\"\n"
end
private def add_css(key : Yaml::Type, value : YAML::Type)
return "$#{key}: ##{value}"
end
# Prints an error that the file does not exists.
def _DNE(file : String)
_e("The file " + File.expand_path(file) + " does not exist!")