Restructure the modules

I think this is better for separating modules explicitly. This is also
considered as there are similar objects between modules (e.g., NixOS
and home-manager modules and users).

Revert users module to old position
This commit is contained in:
Gabriel Arazas 2021-12-06 14:55:00 +08:00
parent 78d11aad6c
commit 3a022a374a
155 changed files with 62921 additions and 92 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "users/config"]
path = users/config
path = users/foo-dogsquared/config
url = https://github.com/foo-dogsquared/dotfiles.git

View File

@ -46,12 +46,12 @@ nixos-config
This usually configures like the hardware setup, timezone, and users.
Host configurations are also exported in the flakes in `outputs.nixosConfigurations`.
* link:./modules/[`./modules/`] contain my custom link:https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules[NixOS modules].
* link:./modules/[`./modules/`] contain my custom modules including for NixOS and home-manager.
For more information, see the link:./modules/README.adoc[related documentation].
It is also exported from the flake in `outputs.nixosModules`.
* link:./pkgs/[`./pkgs/`] contains my custom packages.
It is exported in the flakes at `outputs.packages` compiled through various systems.
It is exported in the flakes at `outputs.packages` compiled through various systems (but only `x86_64-linux` is mainly tested).
* link:./users/[`./users/`] contains my link:https://github.com/nix-community/home-manager[home-manager] configurations and modules.
It is exported in the flakes at `outputs.homeConfigurations`.
@ -67,6 +67,7 @@ In order of priority:
* [x] Create custom modules.
* [x] Create a themes system similar to link:https://github.com/hlissner/dotfiles[this NixOS config].
* [x] Manage secrets with agenix.
* [ ] Create link:https://github.com/numtide/devshell[devshells].
* [x] Automate backups with NixOS config.
* [x] Create custom packages and export it to flakes. (Maybe consider making it to upstream)
* [x] Create cluser-wide configs.

94
flake.lock generated
View File

@ -20,6 +20,37 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1627913399,
"narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -40,7 +71,67 @@
"type": "github"
}
},
"neovim-flake": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"dir": "contrib",
"lastModified": 1638653427,
"narHash": "sha256-4GjEJ3skxI7qrdh75bDfsmHo7QHkWWDo3waQ3Hotej4=",
"owner": "neovim",
"repo": "neovim",
"rev": "1e6eeca9d1360554ee18525603e83c3a1999a622",
"type": "github"
},
"original": {
"dir": "contrib",
"owner": "neovim",
"repo": "neovim",
"type": "github"
}
},
"neovim-nightly-overlay": {
"inputs": {
"flake-compat": "flake-compat",
"neovim-flake": "neovim-flake",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1638692002,
"narHash": "sha256-qA5erdDRylHAdbWcSaa5MLQi5T7lwlNOcglvNt2GMbY=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "ccbfeaac2c0b0cae2ab48a1dca49cba4f4ac9b8c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1638376152,
"narHash": "sha256-ucgLpVqhFnClH7YRUHBHnmiOd82RZdFR3XJt36ks5fE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6daa4a5c045d40e6eae60a3b6e427e8700f1c07f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1638432899,
"narHash": "sha256-iZ+rgyRx3JVyylXYxSyW01liDWEn+O8cKnin6cMzOFU=",
@ -60,7 +151,8 @@
"inputs": {
"agenix": "agenix",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nixpkgs": "nixpkgs_2"
}
}
},

View File

@ -2,7 +2,6 @@
description = "foo-dogsquared's NixOS config as a flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
@ -10,7 +9,7 @@
agenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, home-manager, ... }:
outputs = inputs@{ self, nixpkgs, ... }:
let
# All the target systems.
systems = [
@ -22,6 +21,7 @@
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
libExtended = nixpkgs.lib.extend (final: prev:
(import ./lib {
inherit inputs;
@ -66,27 +66,18 @@
# A list of NixOS configurations from the `./hosts` folder.
# It also has some sensible default configurations.
nixosConfigurations = libExtended.mapAttrs
(host: path: libExtended.mkHost path hostDefaultConfig)
(host: path: libExtended.flakeUtils.mkHost path hostDefaultConfig)
(libExtended.filesToAttr ./hosts);
# We're going to make our custom modules available for our flake. Whether
# or not this is a good thing is debatable, I just want to test it.
nixosModules = libExtended.mapAttrsRecursive (_: path: import path)
(libExtended.filesToAttr ./modules);
(libExtended.filesToAttr ./modules/nixos);
homeConfigurations = let
excludedModules = [
"config" # The common user-specific configurations.
"modules" # User-specific Nix modules.
];
in libExtended.mapAttrs (user: path:
home-manager.lib.homeManagerConfiguration {
system = "x86_64-linux";
configuration = import path;
homeDirectory = "/home/${user}";
username = user;
}) (libExtended.filterAttrs (n: v: !libExtended.elem n excludedModules)
(libExtended.filesToAttr ./users));
homeManagerConfigurations = libExtended.mapAttrs (user: path: libExtended.flakeUtils.mkUser path userDefaultConfig) (libExtended.filesToAttr ./users);
# In case anybody want my modules for whatever reason, here you go.
homeManagerModules = libExtended.mapAttrsRecursive (_: path: import path) (libExtended.filesToAttr ./modules/home-manager);
packages = forAllSystems
(system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; });

View File

@ -29,7 +29,7 @@
neovim.enable = true;
};
themes.a-happy-gnome.enable = true;
users.users = [ "foo-dogsquared" ];
users.users.foo-dogsquared.config = {};
};
# Use the systemd-boot EFI boot loader.

View File

@ -2,7 +2,7 @@
:toc:
These are the modules to be used for the system configuration.
For easier modularization, any user-specific configurations such as from link:https://github.com/nix-community/home-manager[home-manager] should be placed in link:../users/[`../users/` directory].
Multiple types of modules can be found here but the usual types of modules you'll be paying attention is the modules for link:https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules[NixOS modules] and home-manager, both in link:./nixos/[`./nixos/`] and link:./home-manager/[`./home-manager/`], respectively.
The modules are imported usually through `lib.filesToAttr`, allowing for easier structuring without modifying the index file of each module (i.e., `default.nix`).
(See the implementation for more details.)
@ -11,7 +11,7 @@ For example, take the following module folder structure...
[source, tree]
----
modules/
system/
├── themes/
│   ├── a-happy-gnome/
│   │   ├── default.nix
@ -31,7 +31,7 @@ modules/
└── users.nix
----
...should have the following attribute set.
...should have the following attribute set when run with `lib.filesToAttr ./nixos`.
[source, nix]
----
@ -51,12 +51,12 @@ modules/
----
The resulting attribute set can be easily be used for importing.
Here's an example of a NixOS system created with the modules which can used for shared configuration between hosts.
Here's an example of a NixOS system created with the NixOS modules which can used for shared configuration between hosts.
[source, nix]
----
lib.nixosSystem {
system = "x86_64-linux";
modules = lib.mapAttrsToList (name: path: import path) (lib.filesToAttr ./modules);
modules = lib.mapAttrsToList (name: path: import path) (lib.filesToAttr ./modules/nixos);
}
----

View File

@ -24,7 +24,7 @@ in
(lib.mkIf cfg.audio.enable {
home.packages = with pkgs; [
ardour
ardour # The big boi in Linux music production with FOSS.
musescore
# Trying to

View File

@ -22,6 +22,7 @@ in {
gtkUsePortal = true;
wlr.enable = true;
};
xdg.sounds.enable = true;
# Enable font-related options for more smoother and consistent experience.
fonts.enableDefaultFonts = true;

87
modules/nixos/users.nix Normal file
View File

@ -0,0 +1,87 @@
# This enables home-manager specific configs and an easier modularization for user-specific configurations.
# It will also map home-manager users to NixOS users, making it easy to
{ inputs, config, options, lib, ... }:
let
userOption = {
options = {
config = lib.mkOption {
type = lib.types.attrs;
default = { };
example = {
uid = 1234;
description = "John Doe";
extraGroups = [ "wheel" "adbusers" "audio" ];
};
description = ''Configuration to be merged in <literal>users.users.<name></literal>.'';
};
};
};
cfg = config.modules.users;
homeManagerUsers = lib.getUsers "home-manager" (lib.attrNames cfg.users);
homeManagerModules = lib.filesToAttr ../home-manager;
mkUser = user: modulePath:
let
defaultConfig = {
home.username = user;
home.homeDirectory = "/home/${user}";
xdg.enable = true;
};
in {
users.users.${user} = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
home-manager.users.${user} = defaultConfig // import modulePath;
};
nixosUsers = lib.mapAttrsToList mkUser homeManagerUsers;
hmUsersList = lib.attrNames homeManagerUsers;
nonexistentUsers = lib.filter (name: !lib.elem name hmUsersList) (lib.attrNames cfg.users);
in {
options.modules.users = {
users = lib.mkOption {
default = { };
type = with lib.types; attrsOf (submodule userOption);
description = ''
A set of users from the `./users` directory to be included in the NixOS config.
If you don't have the corresponding home-manager user, just configure it directly with <literal>users.users</literal>.
'';
example = {
foo-dogsquared.config = {
extraGroups = [ "wheel" "audio" ];
};
alice.config = {};
};
};
};
# FIXME: Recursion error when using `lib.getUsers cfg.users`.
# Time to study how Nix modules really work.
# The assertion is basically enough for this case.
imports = [
# home-manager to enable user-specific config.
inputs.home-manager.nixosModules.home-manager
# The global configuration for the home-manager module.
{
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.sharedModules = lib.modulesToList homeManagerModules;
}
] ++ nixosUsers;
config = {
assertions = [{
assertion = (builtins.length nonexistentUsers) < 1;
message = "${
lib.concatMapStringsSep ", " (u: "'${u}'") nonexistentUsers
} is not found in the `./users` directory.";
}];
};
}

View File

@ -1,60 +0,0 @@
# This enables home-manager specific configs and an easier modularization for user-specific configurations.
{ inputs, config, options, lib, ... }:
let
cfg = config.modules.users;
userModules = lib.getUsers cfg.users;
homeManagerModules = lib.filesToAttr ../users/modules;
users = lib.attrNames userModules;
nonexistentUsers = lib.filter (name: !lib.elem name users) cfg.users;
mkUser = user: modulePath:
let
defaultConfig = {
home.username = user;
home.homeDirectory = "/home/${user}";
xdg.enable = true;
};
in {
users.users.${user} = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
home-manager.users.${user} = import modulePath;
};
in {
options.modules.users = {
users = lib.mkOption {
default = [ ];
type = with lib.types; listOf str;
description =
"A list of users from the `./users` directory to be included in the NixOS config.";
};
};
# FIXME: Recursion error when using `lib.getUsers cfg.users`.
# Time to study how Nix modules really work.
# The assertion is basically enough for this case.
imports = [
# home-manager to enable user-specific config.
inputs.home-manager.nixosModules.home-manager
# The global configuration for the home-manager module.
{
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.sharedModules = lib.modulesToList homeManagerModules;
}
] ++ (lib.mapAttrsToList mkUser userModules);
config = {
assertions = [{
assertion = (builtins.length nonexistentUsers) < 1;
message = "${
lib.concatMapStringsSep ", " (u: "'${u}'") nonexistentUsers
} is not found in the `./users` directory.";
}];
};
}

8
shell.nix Normal file
View File

@ -0,0 +1,8 @@
{ lib, pkgs, ... }:
lib.mkShell {
packages = with pkgs; [
nixfmt
nixUnstable
];
}

View File

@ -3,7 +3,6 @@
This is where user-specific configurations comes in.
Ideally, the configurations are link:https://nix-community.github.io/home-manager/[home-manager config].
The configs should assume to be used as a configuration as `.config/nixpkgs/home.nix` (i.e., `home-manager.lib.homeManagerConfiguration`, `home-manager.users.${user}`, in your ordinary home-manager setup in a foreign distro).
Here's an example of a sample user config placed in `users/hello.nix`.
@ -25,7 +24,7 @@ This is to be imported to `homeManagerConfiguration` in the flake outputs and wh
== Modules
There are also user modules (in link:./modules[`./modules`]) that are imported to use with home-manager, allowing you to extend it as you wish.
There are also user modules (in link:../modules/home-manager/[`../modules/home-manager/`]) that are imported to use with home-manager, allowing you to extend it as you wish.
It works just like link:https://github.com/nix-community/home-manager/tree/master/modules[home-manager modules].
For easier identification, it should be stored with `modules` as the top-level attribute (e.g., `modules.alacritty`, `modules.i18n`).
@ -45,7 +44,7 @@ in
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ alacritty ];
xdg.configFile."alacritty" = {
source = ../config/alacritty
source = ../../config/alacritty
recursive = true;
};
};

@ -1 +0,0 @@
Subproject commit 9af98f21d21f5118c241a7c4809ae3d2a390846d

View File

@ -0,0 +1,5 @@
root = true
[*.snippets]
indent_size = 2
indent_style = space

View File

@ -0,0 +1,2 @@
**/.envrc
**/shell.nix

View File

@ -0,0 +1,21 @@
{
"alacritty": "$HOME/.config/alacritty/",
"bangs": "$HOME/.config/bangs/",
"bin": "$HOME/.local/bin/",
"bspwm": "$HOME/.config/bspwm/",
"dunst": "$HOME/.config/dunst/",
"emacs": "$HOME/.config/doom",
"lf": "$HOME/.config/lf",
"himalaya": "$HOME/.config/himalaya",
"newsboat": "$HOME/.config/newsboat",
"nvim": "$HOME/.config/nvim/",
"picom": "$HOME/.config/picom",
"polybar": "$HOME/.config/polybar",
"rofi": "$HOME/.config/rofi",
"slop": "$HOME/.config/slop",
"sxiv": "$HOME/.config/sxiv",
"sxhkd": "$HOME/.config/sxhkd",
"sway": "$HOME/.config/sway",
"waybar": "$HOME/.config/waybar",
"zsh": "$HOME/.config/zsh"
}

View File

@ -0,0 +1,12 @@
{
"bin": "$HOME/.local/bin",
"emacs": "$HOME/.config/doom",
"mpd": "$HOME/.config/mpd",
"nvim": "$HOME/.config/nvim",
"nyxt": "$HOME/.config/nyxt",
"newsboat": "$HOME/.config/newsboat",
"rofi": "$HOME/.config/rofi",
"starship": "$HOME/.config",
"slop": "$HOME/.config/slop",
"youtube-dl": "$HOME/.config/youtube-dl"
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Gabriel Arazas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,647 @@
= dotfiles
:toc:
My dotfiles for my Linux-based system setup.
The structure of this repo is designed to be managed with https://www.gnu.org/software/stow/[GNU Stow], a symlinks farm manager.
I don't know what I'm doing most of the time in creating this setup so if you're brave (or suicidal) enough to take a look at my stuff, go ahead.
CAUTION: As they always say: "Don't blindly apply these dotfiles unless you know what you're doing."
Review the code first, change the setting accordingly, and apply it on your own if you want.
== Screenshots
Want to see how my setup look first?
Alright.
.bspwm setup with no windows
image::docs/bspwm-empty.png[bspwm setup with no windows]
.Editors, lots of editors footnote:[For this who are curious for the editors, it's Neovim, Doom Emacs, and Visual Studio Code.]
image::docs/editors-ahoy.png[Editors, lots of editors]
.bspwm with some terminal applications
image::docs/terminals.png[The terminals]
.rofi, dunst, and lf
image::docs/rofi-dunst-and-lf.png[rofi, dunst, and lf]
.vim and zathura (and LaTeX) setup
image::docs/vim-and-zathura.png[vim and zathura (and LaTeX) setup]
.A dropdown terminal (because why not)
image::docs/dropdown-term.png[A dropdown terminal]
== Specifications
Here are the main specifications of my machine currently running this (as of 2020-09-11):
* **Operating system**: https://nixos.org/[NixOS]-based distros (e.g., NixOS, GuixSD)
* **Display server**: X Window System using https://www.x.org/wiki/[Xorg]
* **Window manager**: https://github.com/baskerville/bspwm[bspwm]
* **Terminal emulator**: https://github.com/jwilm/alacritty/[Alacritty]
* **Shell**: http://www.zsh.org/[Zsh]
* **Terminal emulator font**: https://github.com/be5invis/iosevka[Iosevka]
* **GTK theme**: https://github.com/horst3180/Arc-theme[Arc theme] (Arc Darker variant)
== Tour of my setup
Here's what the setup should look like (aside from the Stow packages which will be discussed later):
[source]
----
dotfiles
├── .vtsm/
├── docs/
├── LICENSE
├── makefile
├── README.adoc
└── vtsm
----
The big picture for my dotfiles setup have big goals and those are (according to priority):
* Easy to transfer and/or reproduce.
* Modularity, https://github.com/holman/dotfiles[@holman]-style.
* Looking cool (but not too cool or else my potato will weep).
=== How I maintain my dotfiles
The dotfiles are mostly intended to be used with GNU Stow.
If you're not familiar with it, you can read http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html[this sweet short article] to get you started.
However, with Python 3 (specifically 3.8) installed, you have another option.
Behold, the link:./vtsm["Very Tiny Stow Manager"] (VTSM for short)!
The best way to describe VTSM is basically GNU Stow with a generic shell runner.
VTSM takes inspiration from GNU Stow (obviously) and https://github.com/holman/dotfiles[how Zach Holman's dotfiles are set].
When managing your dotfiles, VTSM is going to be your friend/workmate.
All VTSM needs is a directory containing a package list stored in a JSON file with the name of the packages and their target path.
By default, it searches for a file named `locations.json` but you can specify what JSON file to use with the `-m`/`--manifest` option.
.An example of what a manifest could contain
[source, json]
----
{
"alacritty": "$HOME/.config/alacritty/",
"bin": "$HOME/bin/",
"bspwm": "$HOME/.config/bspwm/",
"dunst": "$HOME/.config/dunst/",
"emacs": "$HOME/.config/doom",
"lf": "$HOME/.config/lf",
"nvim": "$HOME/.config/nvim/",
"picom": "$HOME/.config/picom",
"polybar": "$HOME/.config/polybar",
"rofi": "$HOME/.config/rofi/",
"sxiv": "$HOME/.config/sxiv",
"sxhkd": "$HOME/.config/sxhkd/",
"wal": "$HOME/.config/wal",
"xorg": "$HOME",
"zsh": "$HOME"
}
----
With the tiny manager and the package list, we can then execute commands with all of the packages and its target path with one go.
Here are some examples of running commands with VTSM.
[source, shell]
----
# Take the setup as the filesystem structure.
# See the JSON files at .vtsm to see what packages to be installed and where to install them.
# Running the program without any arguments for a test run.
# There should be a bunch of `echo` commands being ran for all of the listed packages.
./vtsm
# Create the directories of the target path and install them with GNU Stow.
# Bada-bing, bada-boom, you have installed your setup or something.
./vtsm --manifest .vtsm/arch.json --commands "mkdir -p {location} && stow {package} --target {location}"
# Run commands only to Rofi and Emacs config files.
./vtsm --manifest .vtsm/arch.json --only "rofi" "emacs" --commands "stow --restow {package} --target {location}"
----
For the command string, it is a https://docs.python.org/3/library/string.html#string.Template[Python template] with `package` and `location` as the available objects.
=== Custom scripts
Next are more custom scripts!
They're located in link:bin/[`bin/`] and ideally should be linked in `$HOME/.local/bin`.
footnote:[This is a part of the package list but I think it's appropriate to create a dedicated subsection for this.]
Here's a list of the top most useful scripts (at least for me):
* link:./bin/rofi-screenshot-menu[A Rofi menu for all of my screenshoting and screencasting needs].
The script is also a fork of https://github.com/ceuk/rofi-screenshot[`ceuk's` rofi-screenshot].
Big thanks to them for the idea!
* link:./bin/ocr[An image selection-to-text script using OCR].
Capture a region, process it through an OCR engine, and the content are then copied into the clipboard.
Useful for capturing links in images or videos usually found in lecture videos.
* link:./bin/user-prompt[Quick command prompts].
The script is based from https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/prompt[Luke Smith's prompt script].
* link:./bin/toggle-process[Switching on/off programs].
Useful for situations where only one instance of the program is desirable.
* link:./bin/choose-emoji-menu[A universal emoji list] for easy copy-pasting and clear communication with those who speak Emojian.
== Configured programs
Here's a list of the programs with details on the config found in this repo.
Each of the listed directory is designed to be used/managed with https://www.gnu.org/software/stow/[GNU Stow] at the indicated target path.
Each of my configuration also tries to be visually consistent but it is only a secondary priority.
For a color scheme, my main preference is https://www.nordtheme.com/[Nord].
=== https://github.com/jwilm/alacritty/[Alacritty]
Similar to https://sw.kovidgoyal.net/kitty[Kitty] , it's a GPU-based terminal emulator.
It's documentation for the configuration can be viewed at the config file itself being filled with comments.
* Config located at link:alacritty/[`alacritty/`] directory.
* The usual target path for a user is at `$HOME/.config/alacritty/`.
* Minimum version (from `alacritty --version`):
** `alacritty 0.3.3`
* Contains a single `alacritty.yaml` as the config file.
Not much has changed except for the color scheme and the font being used.
=== https://github.com/baskerville/bspwm[bspwm]
A minimalist window manager.
Only provides a window manager and nothing else.
* Config located at link:bspwm/[`bspwm/`] directory.
* The usual target path for a user is at `$HOME/.config/bspwm/`.
* Minimum version (from `bspwm --version`):
** `0.9.7-10-g2ffd9c1`
* Simply contains `bspwmrc` which is an executable setting up bspwm-related settings and and starting up some applications.
However, the "true" version is stored as a https://github.com/dylanaraps/pywal/wiki/User-Template-Files[template file] for pywal (located at link:wal/templates/bspwmrc[`wal/templates/bspwmrc`]).
* This allows for a modular setup.
For using keybindings, it uses `sxhkd` (Simple X Hotkey Daemon).
For something similar to i3-bar, https://github.com/polybar/polybar[polybar] serves as the replacement.
To control the window manager, you should use `bspc`.
=== https://dunst-project.org/[Dunst]
It's a notification daemon used to display notifications sent by notifiers (programs that send messages/notifications).
* Config location is at link:dunst/[`dunst/`].
* The usual target path for a user is at `$HOME/.config/dunst/`.
* Minimum version (from `dunst --version`):
** `Dunst - A customizable and lightweight notification-daemon 1.4.1 (2019-07-03)`
* Simply contains a `dunstrc` configuring appearance of the notifications.
Though, the "true" version of the config is located at link:wal/templates/dunstrc[`wal/templates/dunstrc`].
Look out for the related manual entry (i.e., `man dunst`) and the https://wiki.archlinux.org/index.php/Dunst[Arch Wiki entry].
=== https://www.gnu.org/software/emacs/[GNU Emacs]
Another text editor, of course.
I finally bit the bullet with this one with the native support for https://orgmode.org/[Org Mode] as the biggest reason.
(Is this going to be start of something sinister?)
* This package is really a https://github.com/hlissner/doom-emacs[Doom Emacs]-based configuration more than the vanilla config so you need to install it first before touching the config with your grubby hands.
Just run the following command `git clone https://github.com/hlissner/doom-emacs ~/.emacs.d && ~/.emacs.d/bin/doom install` and it should take care of the rest.
* Config located at link:emacs/[`emacs/`].
* The ideal target path for a user is at `$HOME/.config/doom`.
* Minium version (from `emacs --version`):
** `GNU Emacs 26.3`
** For Doom Emacs, it's not particularly important since it's in rolling release but for future references, it is from the `develop` branch at commit https://github.com/hlissner/doom-emacs/commit/efa599f076c3a140c6b4006c352fdba3361abebd[`efa599f076c3a140c6b4006c352fdba3361abebd`] accessed at 2020-04-24.
* The Doom configs are just the default config and some snippets (in `snippets/`) so there's not much to go through here.
* Regarding theming Doom Emacs, I've found mainly two ways.
** First is simply using https://gitlab.com/jjzmajic/ewal[ewal] but the resulting colors are not pretty IMO and I haven't found a way to customize it aside from forking and modifying the package itself.
** Second is simply generating the Doom Emacs theme file myself;
I have a https://gitlab.com/foo-dogsquared/doom-theme-generator[small script] that is generates one from the Pywal color scheme.
** Or simply don't and use https://gitlab.com/protesilaos/modus-themes[modus-themes] instead for that light customization options.
=== https://github.com/gokcehan/lf[lf]
A http://ranger.github.io/[ranger]-inspired terminal file manager.
https://godoc.org/github.com/gokcehan/lf[Here's the documentation for it.]
* Config located at link:lf/[`lf/`] directory.
* The usual target path for a user is at `$HOME/.config/lf/`.
* Minimum version (from `lf --version`):
** `r14`
* All of the config files are basically default config files except with a few personal changes.
=== https://neovim.io/[Neovim]
A modern version of https://www.vim.org/[Vim], a modal text editor.
footnote:[Migrated after I've seen https://lukesmith.xyz/[Luke-senpai] used it in his recent videos.
Seriously though, I find nvim to be way better for configuration.]
* Config located at link:nvim/[`nvim/`] directory.
* The usual target path for a user is at `$HOME/.config/nvim`.
* Minimum version (from `nvim --version`):
** `NVIM v0.4.3`
* Uses https://github.com/junegunn/vim-plug[`vim-plug`] as the plugin manager.
* Contains my plugin list and editor configurations in `init.vim`.
* There are also some https://github.com/sirver/UltiSnips[UltiSnips] snippets stored in `own-snippets` folder (since `snippets` is a reserved folder name).
* One of the largest snippet file is the snippets for LaTeX files.
It is based on https://github.com/gillescastel/latex-snippets/[_Gilles Castel_'s UltiSnips LaTeX snippets].
=== https://github.com/yshui/picom[picom]
A window compositor forked from https://github.com/chjj/compton[compton] that adds off-screen buffers and additional effects and animations to the window.
Can be used for adding style to your setup.
This is formerly the Compton configuration.
* Config found at link:picom/[`picom/`] directory.
* The usual target path for a user is at `$HOME/.config/picom`.
* Minimum version (from `picom --version`):
** `v7.2`
* The config is copied from `/etc/xorg/picom.conf` and edited a few parameters.
For documentation, check out the manual entry (i.e., `man picom`) and the https://wiki.archlinux.org/index.php/Picom[related Arch Wiki entry].
The default configuration (located at `/etc/xdg/picom.conf` assuming at Arch Linux) can be helpful as well as it is filled with comments.
=== https://github.com/polybar/polybar[polybar]
A tool for creating status bars.
This is the replacement bar from my previous i3-based setup.
* Config located at link:polybar[`polybar/`].
* The usual target path for a user is at `$HOME/.config/polybar`.
* Minimum version (from `polybar --version`):
** `polybar 3.4.1`
** `Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard`
* There is only the standalone config (might decide to make it modular) and the launch script which is copied from the https://wiki.archlinux.org/index.php/Polybar[related Arch Wiki entry].
The theme is dynamically used with the Xresources file (by using `xrdb`).
For documentation, check out the https://wiki.archlinux.org/index.php/Polybar[already linked Arch Wiki entry] and the https://github.com/polybar/polybar/wiki[official documentation from GitHub].
=== https://github.com/davatorium/rofi[Rofi]
The application switcher and launcher.
Also serves as a replacement for https://tools.suckless.org/dmenu/[dmenu].
* Config located at link:rofi/[`rofi/`].
* The usual target path for a user is at `$HOME/.config/rofi/`.
* Minimum version (from `rofi -version`):
** `Version: 1.5.4`
* Main config is `config.rasi`.
* Contains the config and my custom Rofi themes.
To see the documentation, check out the manual entry for `rofi`.
For creating or editing Rofi themes, read the manual entry of `rofi-theme`.
Also, view the related https://wiki.archlinux.org/index.php/Rofi[Arch Wiki entry].
=== https://github.com/naelstrof/slop[slop]
A select operator for X-based systems with all the fanciful bell and whistles.
* Config located at link:slop[`slop`].
* The usual target path is at `$HOME/.config/slop`.
* Minimum version (from `slop --version`):
** v7.5
* It only contains customized selection shaders and whatnot that may be used for my custom scripts.
=== https://github.com/baskerville/sxhkd[sxhkd]
Stands for "Simple X Hotkey Daemon".
It is a hotkey daemon detecting certain X events primarily from the keyboard and mouse.
It is also very useful since it enables modular setup.
Can be used independent of the desktop environment (DE) or the window manager (WM).
* Config located at link:sxhkd/[`sxhkd/`] folder.
* The usual target path is at `$HOME/.config/sxhkd`.
* Minimum version (from `sxhkd --version`):
** `0.6.0-3-g7124055`
* Contains a config file (`sxhkdrc`) for the keybindings.
There are some keybindings specifically used for `bspwm`.
=== https://github.com/muennich/sxiv[sxiv]
A simple developer-oriented X image viewer with a lot of options for customization.
* Config located at link:sxiv/[`sxiv/`] directory.
* The usual target path is at `$HOME/.config/sxiv`.
* Minimum version (from `sxiv -v`):
** `sxiv 26`
* Contains custom keybindings (with `exec/key-handler`) and a configuration for the status bar (with `exec/image-info`).
sxiv has a manual (i.e., `man sxiv`) so that's convenient.
I also recommend https://www.youtube.com/watch?v=GYW9i_u5PYs[Luke Smith's video] introducing it.
That's where I also heard of it.
=== https://www.zsh.org/[Zsh]
A Unix shell and an alternative to the Bash.
Mostly chosen due to its wide options for customization compared to GNU Bash.
* Config found at link:zsh/[`zsh/`] directory.
* The usual target path for a user is at `$HOME/.config/zsh`.
You do have to set `ZDOTDIR=$XDG_CONFIG_HOME/zsh` at `/etc/zsh/zshenv` (requires root privilege) though.
* Minimum version (from `zsh --version`):
** `zsh 5.7.1 (x86_64-pc-linux-gnu)`
* Contains `.zprofile` and `.zshrc`.
The primary file to look for is the `.profile` to set environment variables independent of the shell setups.
* Previously relied on https://github.com/robbyrussell/oh-my-zsh/[oh-my-zsh].
Eventually, the config became independent and can work without it.
For the documentation, check out the manual entry for `zsh` to gain an overview of the shell.
The documentation itself is massive and comprehensive.
The main manual explains some things such as the startup/shutdown files and compatibility with other shells.
It also lays out the sections of the manual which you can check it out.
Since the manual has been split into multiple sections, it can be daunting to navigate.
The most referred sections by far are `zshmisc` where it gives details on the miscellanea of zsh such as the prompt and special variables you might want to know.
The other section is `zshbuiltins` where it explains built-in commands of zsh.
For coding with Zsh, look into the http://zsh.sourceforge.net/Doc/Release/index.html[Zsh Manual].
== Additional programs used
As much as possible, I use free and open source software (FOSS) for all of my needs.
Not all of the items listed are FOSS, though.
footnote:[You can also view the package lists at the project root for a detailed list.]
=== Browser extensions
* https://bitwarden.com/[Bitwarden] - An open source password manager.
Comes with a browser extension or a desktop version of the app.
* Internet Archive Web Extension (https://chrome.google.com/webstore/detail/wayback-machine/fpnmgdkabkmnadcjpehmlllkndpkmiak[Chrome] and https://addons.mozilla.org/en-US/firefox/addon/wayback-machine_new/[Firefox] version) - A browser extension for tracking down the saved versions of a page.
Very useful extension for tracking old resources that has been moved or deleted.
* https://github.com/gorhill/uBlock[uBlock Origin] - A security tool for blocking known trackers.
* https://www.one-tab.com/[OneTab extension] - An extension to enable grouping of tabs into one tab.
Convenient for preventing a lot of tabs opened at one time.
* https://www.eff.org/privacybadger[Privacy Badger] - A security tool for blocking trackers.
Unlike the other blockers like uBlock Origin, Privacy Badger learns with more usage.
=== Command line tools
I still use https://www.gnu.org/software/coreutils/[GNU coreutils] and common Unix tools (e.g., https://curl.haxx.se/[cURL]) but it could be good to find some alternatives.
If you want to look for some alternatives or just feeling adventurous yourself, I recommend starting with https://github.com/agarrharr/awesome-cli-apps[this awesome list] and https://github.com/alebcay/awesome-shell[this one, too].
* https://github.com/sharkdp/bat[bat] - Basically `cat(1)` with wings.
* https://github.com/jarun/Buku[Buku] - A developer-oriented (i.e., easy to integrate with your own programs) browser-independent bookmark manager for the command line.
* https://github.com/cookiecutter/cookiecutter[Cookiecutter] - A project template generator for your... projects. :)
* https://github.com/ogham/exa[exa] - A user-friendly replacement for `ls(1)`.
* https://github.com/sharkdp/fd[fd] - A user-friendly alternative to `find(1)` from https://www.gnu.org/software/findutils/[GNU `findutils`].
* https://feh.finalrewind.org/[feh] - A minimal image viewer.
* https://github.com/junegunn/fzf[fzf] - A fuzzy command line finder.
* https://github.com/sharkdp/hexyl[hexyl] - A hex viewer on the command line.
* https://github.com/gokcehan/lf[lf] - A terminal file manager mainly inspired by http://ranger.github.io/[Ranger].
* https://github.com/naelstrof/maim[maim] - A simple screenshot utility.
* https://github.com/dylanaraps/neofetch/[neofetch] - A program for getting information for your hardware and software setup.
footnote:[You can also take a look at https://github.com/dylanaraps/pfetch[pfetch] (created by the same author) which can be an excellent reference for getting system information between Unix-based systems.
Seriously though, it's insane;
the guy's a wizard.]
* https://neovim.io/[Neovim] - A modern fork of https://www.vim.org/[Vim].
* https://github.com/BurntSushi/ripgrep[ripgrep] - A fast alternative to https://www.gnu.org/software/grep/[GNU `grep`].
* https://weechat.org/[Weechat] - An IRC client on the command line.
* https://github.com/ytdl-org/youtube-dl[youtube-dl] - A utility for downloading YouTube videos (and also others).
=== Design
* https://blender.org/[Blender] - A top-notch 3D modelling program.
* https://draw.io/[draw.io] - A drawing board for your flowcharts and other charts, maybe.
* https://www.freecadweb.org/[FreeCAD] - A general purpose 3D computer-aided design program.
* https://inkscape.org/[Inkscape] - A vector illustration/editing program. Alternative to Adobe Illustrator.
* http://www.kicad-pcb.org/[KiCad] - An electronic design automation suite.
* https://krita.org/en/[Krita] - A painting/illustration program.
=== Desktop user experience
* https://github.com/tmux/tmux/[tmux] - A terminal multiplexer useful for managing multiple sessions.
* https://github.com/noctuid/tdrop[tdrop] - A modular dropdown creator.
* https://github.com/dylanaraps/pywal[pywal] - An automation tool for generating color schemes from images and applying them to your programs.
=== Device drivers and servers
* https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture[ALSA] - A Linux sound driver.
* https://wiki.archlinux.org/index.php/NetworkManager[GNOME NetworkManager]
* https://www.nvidia.com/Download/index.aspx?lang=en-us[NVIDIA Driver] - Since I have an NVIDIA-based GPU (NVIDIA GeForce GT 630), I have to use that.
=== Documents
* https://asciidoctor.org/[Asciidoctor] - A text formatting language suitable for creating books, documentations, and writings.
Highlights a heavier feature set compared to Markdown.
* https://github.com/gohugoio/hugo[Hugo] - A static site generator for creating websites and personal wikis.
* https://jupyter.org/[Jupyter] - Similar to R Markdown except with a stronger emphasis for https://en.wikipedia.org/wiki/Literate_programming[literate programming].
This is closely associated with the https://anaconda.com/[Anaconda distribution].
Useful for a variety of document formats to be converted into a website especially with the (bare) support for https://pandoc.org/[Pandoc] converter.
* https://www.libreoffice.org/[LibreOffice] - An office productivity suite and serves as a free alternative to Microsoft Office suite.
* http://luatex.org/[LuaTeX] - The TeX engine I primarily use for my LaTeX documents.
* https://orgmode.org/[Org-mode] - A lightweight text formatting language that offers a variety of export options, literate programming, and reproducible of stuff similar to Jupyter Notebooks.
* https://pandoc.org/[Pandoc] - A universal document converter that supports a wide variety of document formats.
Primarily used for converting Markdown documents into Asciidoctor text.
* https://rmarkdown.rstudio.com/[R Markdown] - A text formatting language that comes with executing programs with live output in the notebook.
* https://www.tug.org/texlive/[TeX Live] - A cross-platform LaTeX distribution for compiling LaTeX files.
=== Fonts
* https://github.com/belluzj/fantasque-sans[Fantasque Sans Mono] - A serif-style monospace font for fancy occasions.
* https://github.com/tonsky/FiraCode[Fira Code] - A programmer-oriented font that supports ligatures.
* https://fontawesome.com/[Font Awesome] - A set of icons for your user interface and stuff.
* https://github.com/be5invis/iosevka[Iosevka] - A monospace text that features ligatures and provides a wide variety of symbols.
It is currently my terminal font.
* https://www.jetbrains.com/lp/mono/[Jetbrains Mono] - A free and open source font featuring ligatures by Jetbrains.
* http://www.gust.org.pl/projects/e-foundry/lm-math[Latin Modern Math] - A serif font specifically for mathematical and scientific work.
It is based from Computer Modern Math (the default typeface for LaTeX documents).
It is also my go-to font for mathematical fonts.
* https://github.com/ryanoasis/nerd-fonts[Nerd Fonts] - A suite of font tools.
Also offers 40+ patched fonts of the popular fonts such as Iosevka, Fira Code, and many others.
* https://github.com/googlefonts/noto-fonts[Noto Fonts] - A font family provided by Google.
Features a wide support for a variety of languages and styles.
* https://www.ibm.com/plex/[Plex] - The font family of IBM.
Offers a wide variety of styles from the serif, sans, and monospace.
footnote:[There is a plan to extend the fonts to include mathematical symbols but as of 2020-03-27, it's not yet complete.]
* https://github.com/adobe-fonts/source-serif-pro[Source Serif Pro] - A free and open source serif font by Frank Grießhammer for Adobe.
Part of the Adobe's Source Pro open source font family.
It is also my go-to serif font for my documents (e.g., LaTeX documents).
* https://github.com/adobe-fonts/source-sans-pro[Source Sans Pro] - Another one of the Adobe's Source Pro open source font family.
I use it when paired with Source Serif Pro.
The go-to sans font for my go-to serif font.
* https://github.com/stipub/stixfonts[STIX] - A mathematical font based from the Times New Roman font.
This is my second math font of choice.
=== Graphical programs
* https://discordapp.com/[Discord] - A certain police PSA said Discord users are hackers and I want to be one so I joined.
* https://www.mozilla.org/en-US/firefox/new/[Firefox] - One of the major web browser second to Chrome.
* https://docs.xfce.org/xfce/thunar/start[Thunar] - A file manager and a part of the https://xfce.org/[XFCE] package.
footnote:[I'm mainly using https://github.com/gokcehan/lf[lf], don't fret.]
* https://www.thunderbird.net/[Thunderbird] - An email client.
footnote:[I'm sorry I'm not using a based command line tool like https://github.com/neomutt/neomutt[Neomutt] yet.
Please don't crucify me, I'm on my way to be cool, I swear.]
* https://www.qbittorrent.org/[Qbittorrent] - A torrent manager for sailing the web (or the seven seas).
=== Icon sets
* https://fontawesome.com/[Font Awesome] - An extensive collection of general icons with various styles.
* https://github.com/Templarian/MaterialDesign[Material Design] - A community-led icon set derived from Google's own Material icons.
* https://github.com/powerline/fonts[Powerline fonts] - A font specifically made for them powerline status bars.
* https://github.com/simple-icons/simple-icons/[Simple Icons] - A collection of popular brand icons.
=== Mathematical tools
* https://www.anaconda.com/[Anaconda] - A mathematical environment distribution.
* https://www.gnu.org/software/octave/[Octave] - A mathematical computational environment similar to Matlab.
* https://www.r-project.org/[R] - Similar to Octave.
=== Multimedia-related tools
* https://audacious-media-player.org/[Audacious] - An audio player with various listening options.
footnote:[Don't worry, I'm trying to be cool by considering https://rybczak.net/ncmpcpp/[`ncmpcpp`].]
* https://ffmpeg.org/[ffmpeg] - A multimedia codec including for MP4, FLV, and more.
Also can be used as a recorder.
* https://www.imagemagick.org/[ImageMagick] - A software suite for graphics.
* https://obsproject.com/[OBS Studio] - A facility for streaming and recording videos.
* https://www.shotcut.org/[Shotcut] - A video editor built with the https://www.mltframework.org/[MLT Framework].
* https://github.com/muennich/sxiv[sxiv] - Self-explaining-ly named "Simple X Image Viewer".
* https://www.videolan.org/vlc/[VLC Media Player] - A multimedia player.
=== Music production
You can find my crappy soundtracks primarily in my https://www.youtube.com/channel/UCuMiU9bzATu5oTp-vhOlL2Q[YouTube channel] (may consider a SoundCloud account or similar).
* https://kx.studio/Applications:Cadence[Cadence] - A set of audio tools.
* https://kx.studio/Applications:Carla[Carla] - An audio plug-in host supporting various audio plug-in formats such as VST2/3, SF2, and SFZ.
Part of the KX Studio project.
* https://lmms.io/[LMMS] - A digital audio workstation for beat production.
* https://musescore.org/[Musescore] - A music composition and notation software.
* https://supercollider.github.io/[SuperCollider] - A platform for audio synthesis and algorithmic composition.
=== Software development
* https://docker.com/[Docker] - An application for virtualizing your environments with containers.
* https://bitbucket.org/eradman/entr[entr] - A utility for running commands for certain filesystem events.
Useful for not fiddling with `inotify`.
* https://gcc.gnu.org/[GCC] - A set of compilers from GNU; I mainly use it for developing and compiling C and C++ languages.
* https://git-scm.com/[Git] - My one and only version control system.
* https://godotengine.org/[Godot Engine] - A game engine with its own interface.
* https://llvm.org/[LLVM] - A set of compilers similar to GCC; mainly used it for testing other C/C++ stuff.
* https://www.gnu.org/software/make/[Make] - A build automation system.
* https://www.vagrantup.com/[Vagrant] - A virtual machine manager with a focus for developer environments.
* https://code.visualstudio.com/[Visual Studio Code] - A text editor that comes with lightweight IDE features.
* Whatever runtimes/toolchains for programming languages I have (e.g., Oracle Java, Rust, Go, LLVM).
=== System administration
TIP: I recommend to start at this list especially if you're starting with a bare minimum of a Linux installation.
* https://hisham.hm/htop/[htop] - A process viewer and manager.
* https://github.com/lxde/lxsession[lxsession] - A session manager and an authentication agent for Polkit; very useful if you're usually using with a user-level account.
* https://www.freedesktop.org/wiki/Software/polkit/[Polkit] - A program for bridging unprivileged processes to privileged access.
* https://wiki.archlinux.org/index.php/Systemd-boot[systemd-boot] - The UEFI boot manager.
* https://www.freedesktop.org/wiki/Software/udisks/[udisks] - A manager for mounting filesystems.
* https://github.com/coldfix/udiskie[udiskie] - An automounter for removable media.
== Inspirations
* https://github.com/addy-dclxvi/almighty-dotfiles/
* https://github.com/LukeSmithxyz/voidrice
* https://github.com/adi1090x
* https://github.com/jethrokuan/dots/ for his Emacs and Org Mode writing setup.
He also has a dedicated series on his https://blog.jethro.dev/[blog site] if you want the juicy details.
* https://www.reddit.com/r/unixporn/ obviously.
* Specifically for https://www.reddit.com/r/unixporn/comments/8ezsq7/bspwm_terminal_tabs_in_polybar_dark_and_dull_exam/[the tabbed terminals idea] and the https://github.com/Nikzt/dotfiles[linked dotfiles repo]) (not yet implemented, still cleaning up my stuff)
* https://www.reddit.com/r/unixporn/comments/edmb8b/awesome_gnawesome/[Just] https://github.com/ilovecookieee/Glorious-Dotfiles[saving] https://github.com/PapyElGringo/material-awesome[these] for an **awesome** future, hehehe.
== Wallpapers
Here's a list of some of the best wallpapers I've used throughout my ricing journey.
I've also tried to get the creators to show appreciation for their work.
* https://www.deviantart.com/rmradev/art/Alien-Moon-743912901[`alien-moon.jpg`]
** Creator: https://www.deviantart.com/rmradev[rmRadev]
* https://dribbble.com/shots/3713646-Small-Memory[`forest-bright.jpg`]
** Creator: https://dribbble.com/MikaelGustafsson[Mikael Gustafsson]
* https://dropr.com/mbdsgns/254740/hotline_miami_iv/+?p=1388845[`hotline-miami-alt-cover.png`]
** Creator: https://dropr.com/mbdsgns[Mbdsgns]
* https://www.artstation.com/artwork/wn8ng[`long-walk-home.jpg`]
** Creator: https://www.artstation.com/beaulamb[Beau Lamb]
* https://www.reddit.com/r/wallpapers/comments/g6tgst/night_landscape_mountain_and_milky_way_galaxy[`mountain-with-galaxy.jpg`]
** I was not able to track down the photographer of this one.
* https://www.reddit.com/r/wallpapers/comments/cckpj0/i_made_this_simple_and_clean_drawing_over_the/[`nebula.jpg`]
** Creator: https://www.reddit.com/user/datGryphon/[datGryphon]
* https://www.artstation.com/artwork/XOQdR[`the-core.jpg`]
** Creator: https://www.artstation.com/beaulamb[Beau Lamb]
* https://www.reddit.com/r/wallpapers/comments/ebvk0q/rocket_launch_1920x1080/[`rocket-launch.jpg`]
* https://www.artstation.com/artwork/XBlZbY[`scarecrow-field.jpg`]
** Creator: https://www.artstation.com/joejazz[Josef Bartoň]
=== Sources
My personal recommendations for looking out for more cool-looking photos.
* https://images.nasa.gov/[Images from NASA].
They also have a small collection of them in their https://unsplash.com/@nasa[Unsplash account].
* https://imgur.com/gallery/4BKvq[Firewatch] (or any style similar to Firewatch) wallpapers are top-notch ricing material.
* https://mantissa.artstation.com/[Midge "Mantissa" Sinnaeve]
* https://www.artstation.com/beaulamb[Beau Lamb]
* http://louie.co.nz/[Louis Coyle] and https://dribbble.com/louiscoyle[his illustrations].
* https://www.deviantart.com/rmradev[rmRadev]
* https://www.reddit.com/r/wallpapers/[/r/wallpapers]
* https://unsplash.com/s/photos/galaxy-landscape[Any image that features a landscape with stars, lel.]
* https://www.pexels.com/[Pexels]
* https://www.pixabay.com/[Pixabay]
* https://unsplash.com/[Unsplash]

View File

@ -0,0 +1,547 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
#env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used.
#TERM: xterm-256color
window:
# Window dimensions (changes require restart)
#
# Specified in number of columns/lines, not pixels.
# If both are `0`, this setting is ignored.
dimensions:
columns: 0
lines: 0
# Allow terminal applications to change Alacritty's window title.
dynamic_title: true
# Window position (changes require restart)
#
# Specified in number of pixels.
# If the position is not set, the window manager will handle the placement.
#position:
# x: 0
# y: 0
# Window padding (changes require restart)
#
# Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides.
padding:
x: 0
y: 0
# Spread additional padding evenly around the terminal content.
dynamic_padding: false
# Window decorations
#
# Values for `decorations`:
# - full: Borders and title bar
# - none: Neither borders nor title bar
#
# Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons
# - buttonless: Title bar, transparent background, but no title bar buttons
decorations: full
# Startup Mode (changes require restart)
#
# Values for `startup_mode`:
# - Windowed
# - Maximized
# - Fullscreen
#
# Values for `startup_mode` (macOS only):
# - SimpleFullscreen
startup_mode: Windowed
# Window title
#title: Alacritty
# Window class (Linux only):
#class: Alacritty
scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
history: 10000
# Number of lines the viewport will move for every line scrolled when
# scroll back is enabled (history > 0).
multiplier: 3
# Font configuration (changes require restart)
font:
normal:
family: monospace
family: Source Code Pro
family: Fira Code
family: Iosevka
#normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux) monospace
# - (Windows) Consolas
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Regular
# Bold font face
#bold:
# Font family
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Bold
# Italic font face
#italic:
# Font family
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Italic
# Point size
size: 13.0
# Offset is the extra space around each character. `offset.y` can be thought of
# as modifying the line spacing, and `offset.x` as modifying the letter spacing.
offset:
x: 0
y: 0
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increasing `x` moves the glyph to the right,
# increasing `y` moves the glyph upwards.
glyph_offset:
x: 0
y: 0
# Thin stroke font rendering (macOS only)
#
# Thin strokes are suitable for retina displays, but for non-retina screens
# it is recommended to set `use_thin_strokes` to `false`
#
# macOS >= 10.14.x:
#
# If the font quality on non-retina display looks bad then set
# `use_thin_strokes` to `true` and enable font smoothing by running the
# following command:
# `defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO`
#
# This is a global setting and will require a log out or restart to take
# effect.
use_thin_strokes: true
# If `true`, bold text is drawn using the bright color variants.
draw_bold_text_with_bright_colors: true
# Visual Bell
#
# Any time the BEL code is received, Alacritty "rings" the visual bell. Once
# rung, the terminal background will be set to white and transition back to the
# default background color. You can control the rate of this transition by
# setting the `duration` property (represented in milliseconds). You can also
# configure the transition function by setting the `animation` property.
#
# Values for `animation`:
# - Ease
# - EaseOut
# - EaseOutSine
# - EaseOutQuad
# - EaseOutCubic
# - EaseOutQuart
# - EaseOutQuint
# - EaseOutExpo
# - EaseOutCirc
# - Linear
#
# Specifying a `duration` of `0` will disable the visual bell.
bell:
animation: EaseOutExpo
duration: 0
color: '0xffffff'
# Background opacity
#
# Window opacity as a floating point number from `0.0` to `1.0`.
# The value `0.0` is completely transparent and `1.0` is opaque.
background_opacity: 1
# Mouse bindings
#
# Available fields:
# - mouse
# - action
# - mods (optional)
#
# Values for `mouse`:
# - Middle
# - Left
# - Right
# - Numeric identifier such as `5`
#
# All available `mods` and `action` values are documented in the key binding
# section.
mouse_bindings:
- { mouse: Middle, action: PasteSelection }
mouse:
# Click settings
#
# The `double_click` and `triple_click` settings control the time
# alacritty should wait for accepting multiple clicks as one double
# or triple click.
double_click: { threshold: 300 }
triple_click: { threshold: 300 }
# If this is `true`, the cursor is temporarily hidden when typing.
hide_when_typing: false
hints:
# URL launcher
#
# This program is executed when clicking on a text which is recognized as a URL.
# The URL is always added to the command as the last parameter.
#
# When set to `None`, URL launching will be disabled completely.
#
# Default:
# - (macOS) open
# - (Linux) xdg-open
# - (Windows) explorer
#launcher:
# program: xdg-open
# args: []
# URL modifiers
#
# These are the modifiers that need to be held down for opening URLs when clicking
# on them. The available modifiers are documented in the key binding section.
modifiers: None
selection:
semantic_escape_chars: ",│`|:\"' ()[]{}<>"
# When set to `true`, selected text will be copied to the primary clipboard.
save_to_clipboard: false
cursor:
# Cursor style
#
# Values for `style`:
# - ▇ Block
# - _ Underline
# - | Beam
style: Block
# If this is `true`, the cursor will be rendered as a hollow box when the
# window is not focused.
unfocused_hollow: true
# Live config reload (changes require restart)
live_config_reload: true
# Shell
#
# You can set `shell.program` to the path of your favorite shell, e.g. `/bin/fish`.
# Entries in `shell.args` are passed unmodified as arguments to the shell.
#
# Default:
# - (macOS) /bin/bash --login
# - (Linux) user login shell
# - (Windows) powershell
#shell:
# program: /bin/bash
# args:
# - --login
# Startup directory
#
# Directory the shell is started in. If this is unset, or `None`, the working
# directory of the parent process will be used.
working_directory: None
# Windows 10 ConPTY backend (Windows only)
#
# This will enable better color support and may resolve other issues,
# however this API and its implementation is still young and so is
# disabled by default, as stability may not be as good as the winpty
# backend.
#
# Alacritty will fall back to the WinPTY automatically if the ConPTY
# backend cannot be initialized.
enable_experimental_conpty_backend: false
# Send ESC (\x1b) before characters when alt is pressed.
alt_send_esc: true
debug:
# Display the time it takes to redraw each frame.
render_timer: false
# Keep the log file after quitting Alacritty.
persistent_logging: false
# Log level
#
# Values for `log_level`:
# - None
# - Error
# - Warn
# - Info
# - Debug
# - Trace
log_level: Warn
# Print all received window events.
print_events: false
# Record all characters and escape sequences as test data.
ref_test: false
# Key bindings
#
# Key bindings are specified as a list of objects. Each binding will specify a
# key and modifiers required to trigger it, terminal modes where the binding is
# applicable, and what should be done when the key binding fires. It can either
# send a byte sequence to the running application (`chars`), execute a
# predefined action (`action`) or fork and execute a specified command plus
# arguments (`command`).
#
# Bindings are always filled by default, but will be replaced when a new binding
# with the same triggers is defined. To unset a default binding, it can be
# mapped to the `None` action.
#
# Example:
# `- { key: V, mods: Control|Shift, action: Paste }`
#
# Available fields:
# - key
# - mods (optional)
# - chars | action | command (exactly one required)
# - mode (optional)
#
# Values for `key`:
# - `A` -> `Z`
# - `F1` -> `F12`
# - `Key1` -> `Key0`
#
# A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/enum.VirtualKeyCode.html#variants
#
# Instead of using the name of the keys, the `key` field also supports using
# the scancode of the desired key. Scancodes have to be specified as a
# decimal number.
# This command will allow you to display the hex scancodes for certain keys:
# `showkey --scancodes`
#
# Values for `mods`:
# - Command
# - Control
# - Option
# - Super
# - Shift
# - Alt
#
# Multiple `mods` can be combined using `|` like this: `mods: Control|Shift`.
# Whitespace and capitalization is relevant and must match the example.
#
# Values for `chars`:
# The `chars` field writes the specified string to the terminal. This makes
# it possible to pass escape sequences.
# To find escape codes for bindings like `PageUp` ("\x1b[5~"), you can run
# the command `showkey -a` outside of tmux.
# Note that applications use terminfo to map escape sequences back to
# keys. It is therefore required to update the terminfo when
# changing an escape sequence.
#
# Values for `action`:
# - Paste
# - PasteSelection
# - Copy
# - IncreaseFontSize
# - DecreaseFontSize
# - ResetFontSize
# - ScrollPageUp
# - ScrollPageDown
# - ScrollLineUp
# - ScrollLineDown
# - ScrollToTop
# - ScrollToBottom
# - ClearHistory
# - Hide
# - Quit
# - ClearLogNotice
# - SpawnNewInstance
# - ToggleFullscreen
# - None
#
# Values for `action` (macOS only):
# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space
#
# Values for `command`:
# The `command` field must be a map containing a `program` string and
# an `args` array of command line parameter strings.
#
# Example:
# `command: { program: "alacritty", args: ["-e", "vttest"] }`
#
# Values for `mode`:
# - ~AppCursor
# - AppCursor
# - ~AppKeypad
# - AppKeypad
key_bindings:
# (Windows/Linux only)
#- { key: V, mods: Control|Shift, action: Paste }
#- { key: C, mods: Control|Shift, action: Copy }
#- { key: Insert, mods: Shift, action: PasteSelection }
#- { key: Key0, mods: Control, action: ResetFontSize }
#- { key: Equals, mods: Control, action: IncreaseFontSize }
#- { key: Add, mods: Control, action: IncreaseFontSize }
#- { key: Subtract, mods: Control, action: DecreaseFontSize }
#- { key: Minus, mods: Control, action: DecreaseFontSize }
#- { key: Return, mods: Alt, action: ToggleFullscreen }
# (macOS only)
#- { key: Key0, mods: Command, action: ResetFontSize }
#- { key: Equals, mods: Command, action: IncreaseFontSize }
#- { key: Add, mods: Command, action: IncreaseFontSize }
#- { key: Minus, mods: Command, action: DecreaseFontSize }
#- { key: K, mods: Command, action: ClearHistory }
#- { key: K, mods: Command, chars: "\x0c" }
#- { key: V, mods: Command, action: Paste }
#- { key: C, mods: Command, action: Copy }
#- { key: H, mods: Command, action: Hide }
#- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit }
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
- { key: Paste, action: Paste }
- { key: Copy, action: Copy }
- { key: L, mods: Control, action: ClearLogNotice }
- { key: L, mods: Control, chars: "\x0c" }
- { key: Home, mods: Alt, chars: "\x1b[1;3H" }
- { key: Home, chars: "\x1bOH", mode: AppCursor }
- { key: Home, chars: "\x1b[H", mode: ~AppCursor }
- { key: End, mods: Alt, chars: "\x1b[1;3F" }
- { key: End, chars: "\x1bOF", mode: AppCursor }
- { key: End, chars: "\x1b[F", mode: ~AppCursor }
- { key: PageUp, mods: Shift, action: ScrollPageUp, mode: ~Alt }
- { key: PageUp, mods: Shift, chars: "\x1b[5;2~", mode: Alt }
- { key: PageUp, mods: Control, chars: "\x1b[5;5~" }
- { key: PageUp, mods: Alt, chars: "\x1b[5;3~" }
- { key: PageUp, chars: "\x1b[5~" }
- { key: PageDown, mods: Shift, action: ScrollPageDown, mode: ~Alt }
- { key: PageDown, mods: Shift, chars: "\x1b[6;2~", mode: Alt }
- { key: PageDown, mods: Control, chars: "\x1b[6;5~" }
- { key: PageDown, mods: Alt, chars: "\x1b[6;3~" }
- { key: PageDown, chars: "\x1b[6~" }
- { key: Tab, mods: Shift, chars: "\x1b[Z" }
- { key: Back, chars: "\x7f" }
- { key: Back, mods: Alt, chars: "\x1b\x7f" }
- { key: Insert, chars: "\x1b[2~" }
- { key: Delete, chars: "\x1b[3~" }
- { key: Left, mods: Shift, chars: "\x1b[1;2D" }
- { key: Left, mods: Control, chars: "\x1b[1;5D" }
- { key: Left, mods: Alt, chars: "\x1b[1;3D" }
- { key: Left, chars: "\x1b[D", mode: ~AppCursor }
- { key: Left, chars: "\x1bOD", mode: AppCursor }
- { key: Right, mods: Shift, chars: "\x1b[1;2C" }
- { key: Right, mods: Control, chars: "\x1b[1;5C" }
- { key: Right, mods: Alt, chars: "\x1b[1;3C" }
- { key: Right, chars: "\x1b[C", mode: ~AppCursor }
- { key: Right, chars: "\x1bOC", mode: AppCursor }
- { key: Up, mods: Shift, chars: "\x1b[1;2A" }
- { key: Up, mods: Control, chars: "\x1b[1;5A" }
- { key: Up, mods: Alt, chars: "\x1b[1;3A" }
- { key: Up, chars: "\x1b[A", mode: ~AppCursor }
- { key: Up, chars: "\x1bOA", mode: AppCursor }
- { key: Down, mods: Shift, chars: "\x1b[1;2B" }
- { key: Down, mods: Control, chars: "\x1b[1;5B" }
- { key: Down, mods: Alt, chars: "\x1b[1;3B" }
- { key: Down, chars: "\x1b[B", mode: ~AppCursor }
- { key: Down, chars: "\x1bOB", mode: AppCursor }
- { key: F1, chars: "\x1bOP" }
- { key: F2, chars: "\x1bOQ" }
- { key: F3, chars: "\x1bOR" }
- { key: F4, chars: "\x1bOS" }
- { key: F5, chars: "\x1b[15~" }
- { key: F6, chars: "\x1b[17~" }
- { key: F7, chars: "\x1b[18~" }
- { key: F8, chars: "\x1b[19~" }
- { key: F9, chars: "\x1b[20~" }
- { key: F10, chars: "\x1b[21~" }
- { key: F11, chars: "\x1b[23~" }
- { key: F12, chars: "\x1b[24~" }
- { key: F1, mods: Shift, chars: "\x1b[1;2P" }
- { key: F2, mods: Shift, chars: "\x1b[1;2Q" }
- { key: F3, mods: Shift, chars: "\x1b[1;2R" }
- { key: F4, mods: Shift, chars: "\x1b[1;2S" }
- { key: F5, mods: Shift, chars: "\x1b[15;2~" }
- { key: F6, mods: Shift, chars: "\x1b[17;2~" }
- { key: F7, mods: Shift, chars: "\x1b[18;2~" }
- { key: F8, mods: Shift, chars: "\x1b[19;2~" }
- { key: F9, mods: Shift, chars: "\x1b[20;2~" }
- { key: F10, mods: Shift, chars: "\x1b[21;2~" }
- { key: F11, mods: Shift, chars: "\x1b[23;2~" }
- { key: F12, mods: Shift, chars: "\x1b[24;2~" }
- { key: F1, mods: Control, chars: "\x1b[1;5P" }
- { key: F2, mods: Control, chars: "\x1b[1;5Q" }
- { key: F3, mods: Control, chars: "\x1b[1;5R" }
- { key: F4, mods: Control, chars: "\x1b[1;5S" }
- { key: F5, mods: Control, chars: "\x1b[15;5~" }
- { key: F6, mods: Control, chars: "\x1b[17;5~" }
- { key: F7, mods: Control, chars: "\x1b[18;5~" }
- { key: F8, mods: Control, chars: "\x1b[19;5~" }
- { key: F9, mods: Control, chars: "\x1b[20;5~" }
- { key: F10, mods: Control, chars: "\x1b[21;5~" }
- { key: F11, mods: Control, chars: "\x1b[23;5~" }
- { key: F12, mods: Control, chars: "\x1b[24;5~" }
- { key: F1, mods: Alt, chars: "\x1b[1;6P" }
- { key: F2, mods: Alt, chars: "\x1b[1;6Q" }
- { key: F3, mods: Alt, chars: "\x1b[1;6R" }
- { key: F4, mods: Alt, chars: "\x1b[1;6S" }
- { key: F5, mods: Alt, chars: "\x1b[15;6~" }
- { key: F6, mods: Alt, chars: "\x1b[17;6~" }
- { key: F7, mods: Alt, chars: "\x1b[18;6~" }
- { key: F8, mods: Alt, chars: "\x1b[19;6~" }
- { key: F9, mods: Alt, chars: "\x1b[20;6~" }
- { key: F10, mods: Alt, chars: "\x1b[21;6~" }
- { key: F11, mods: Alt, chars: "\x1b[23;6~" }
- { key: F12, mods: Alt, chars: "\x1b[24;6~" }
- { key: F1, mods: Super, chars: "\x1b[1;3P" }
- { key: F2, mods: Super, chars: "\x1b[1;3Q" }
- { key: F3, mods: Super, chars: "\x1b[1;3R" }
- { key: F4, mods: Super, chars: "\x1b[1;3S" }
- { key: F5, mods: Super, chars: "\x1b[15;3~" }
- { key: F6, mods: Super, chars: "\x1b[17;3~" }
- { key: F7, mods: Super, chars: "\x1b[18;3~" }
- { key: F8, mods: Super, chars: "\x1b[19;3~" }
- { key: F9, mods: Super, chars: "\x1b[20;3~" }
- { key: F10, mods: Super, chars: "\x1b[21;3~" }
- { key: F11, mods: Super, chars: "\x1b[23;3~" }
- { key: F12, mods: Super, chars: "\x1b[24;3~" }
- { key: NumpadEnter, chars: "\n" }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
#!/usr/bin/env sh
# This is the askpass program that `sudo -a` uses.
# This script should be set with the `SUDO_ASKPASS` environment variable.
rofi -theme dmenu -dmenu -p "Password: " -password

View File

@ -0,0 +1,163 @@
#!/usr/bin/env nix-shell
#! nix-shell -i oil -p coreutils ripgrep handlr gnused xxd
# A ripoff from Duckduckgo bangs.
# Examples:
# ```
# bangs hello there ~g ~aw
# ```
# will open a search result page on Google and Arch Wiki
# TODO:
# - Make the config compatible to bangs database from Duckduckgo.
proc usage() {
cat <<HELP
bangs - a ripoff from Duckduckgo bangs, except
you can open multiple pages in one go.
Usage:
bangs [SEARCH_QUERY...] [BANGS...]
A bang is absolutely necessary to indicate what search pages
to open.
While there is a default config, you should create your own list
by setting a config file at '\${XDG_CONFIG_HOME}/bangs/config.json'.
The config is simply a JSON file with the bang as the key and an
object with 'url' and 'name'.
Examples:
- Google and Duckduckgo search
bangs hello world ~g ~ddg
- Change the bangs prefix
BANGS_PREFIX="--" bangs how to program in python --g --yt
HELP
}
# Simply prints the given string into percent-encoded equivalent.
#
# `urlencode "Hello world"` will give "Hello%20world"
#
# Stolen from https://gist.github.com/cdown/1163649 and https://gist.github.com/cdown/1163649#gistcomment-1256298.
# Just ported it in Oil script.
proc urlencode(msg) {
for (i in 0:len(msg)) {
var char = msg[i]
case $char {
[a-zA-Z0-9.~_-])
printf '%s' $char
;;
*)
printf '%s' $char | xxd -plain -cols 1 | while read :hex { printf '%%%s' $hex }
;;
}
}
}
# `printf` except it prints in the stderr stream.
proc warnf(format, @msg) {
>&2 printf "$format\\n" @msg
}
# The entry point of this program.
proc main {
# Config-related variables.
# For now, there is no system-related config.
# This is primarily a user script, after all. :)
const config_dir = "${XDG_CONFIG_HOME:-"$HOME/.config"}/bangs"
const config_file = "${config_dir}/config.json"
# Note you can configure these variables through the respective environment variables.
const bangs_prefix = "${BANGS_PREFIX:-~}"
const bangs_placeholder = "${BANGS_PLACEHOLDER:-{{{s}}}}"
# These are the default bangs available.
# Bangs are any keys that shouldn't have whitespace characters.
# We'll use this in case there is no user configuration.
#
# We also made the default config to be more flexible with the placeholder.
const default_config = {
'aw': {
'name': 'Arch Wiki',
'url': 'https://wiki.archlinux.org/index.php?title=Special%3ASearch&search=' + bangs_placeholder
},
'gh': {
'name': 'GitHub',
'url': 'https://github.com/search?utf8=%E2%9C%93&q=' + bangs_placeholder
},
'g': {
'name': 'Google',
'url': 'https://www.google.com/search?q=' + bangs_placeholder
},
'so': {
'name': 'Stack Overflow',
'url': 'http://stackoverflow.com/search?q=' + bangs_placeholder
},
'w': {
'name': 'Wikipedia',
'url': 'https://en.wikipedia.org/wiki/Special:Search?search=' + bangs_placeholder
}
}
# Setting up some variables.
const bangs_format = / %start $bangs_prefix !space+ %end /
const valid_bangs = %()
const search_query = %()
# Config file detection.
# Otherwise, we'll just use the default config.
if test -f $config_file {
json read :bangs < $config_file
} else {
var bangs = default_config
}
# Show the usage when no arguments was given like any sane program.
if (len(ARGV) == 0) {
usage
exit 0
}
# Filter out the bangs from the search query.
# The bangs are just words prefixed with a certain sequence of characters.
# We put both bangs and the search query in separate arrays for easier processing.
# E.g., in the search query `hello ~ddg world ~g`, `~ddg~ and `~g` are the bangs.
for i in @ARGV {
# If the argument is not a bang, append in the search query queue.
write -- $i | rg --quiet $bangs_format || {
append :search_query $i
continue
}
# Otherwise, put it in the bangs array.
# Keep in mind, we do throw out bangs that are not in the bangs database.
var bang = $(write -- $i | sed --regexp-extended --expression "s/^${bangs_prefix}//")
if (bang in bangs) {
append :valid_bangs $bang
warnf "%s will be used to search." $bang
} else {
warnf "%s is not found in the database." $bang
}
}
# Encode the query for a consistent formatting.
# Even though this script is in Oil where it has less problems with splitting strings, we still might want to encode the query for a good measure.
var query = join(search_query, " ")
var encoded_query = $(urlencode $query)
warnf "Search query is '%s'" $query
warnf "Encoded form is '%s'" $encoded_query
# Search the query with the given bangs.
for bang in @valid_bangs {
var metadata = bangs[bang]
var url = $(write -- ${metadata['url']} | sed --expression "s/${bangs_placeholder}/${encoded_query}/")
handlr open $url
}
}
main @ARGV

View File

@ -0,0 +1,31 @@
#!/usr/bin/env nix-shell
#! nix-shell --pure -i bash -p mktemp wget gnused gawk rofi xclip libnotify
# Simply create a universal emoji selection list.
# The emoji list should be the following file:
# https://unicode.org/Public/emoji/13.0/emoji-test.txt
# Dependencies:
# * mktemp - GNU coreutils 8.31
# * wget - GNU Wget 1.20.3
# * sed - GNU sed 4.8
# * awk - GNU Awk 5.0.1
# * rofi - Version: 1.5.4
# * xclip - version 0.13
emoji_file="${XDG_DATA_HOME:-$HOME/.local/share}/emoji-list.txt"
# Checks if the emoji file is non-existent or past its modification date of at least 30 days ago (2592000 seconds).
if [[ ! -f $emoji_file ]] || test $(expr $(date "+%s") - $(date --reference="$emoji_file" "+%s")) -gt 2592000; then
notify-send "Downloading the emoji data file."
wget --output-document "$emoji_file" https://unicode.org/Public/emoji/latest/emoji-test.txt
touch $emoji_file
fi
selection=$(awk 'match($0, /([0-9A-F ]+)\s+; fully-qualified\s+# (\S+) E[[:digit:]]+.[[:digit:]]+ (.+)$/, a){print a[2], a[3]}' "$emoji_file" \
| rofi -dmenu -i -matching fuzzy -p "Choose an emoji to copy." \
| awk '{print $1}')
if [ -n "$selection" ]; then
printf "%s" "$selection" | xclip -selection clipboard && notify-send "'$(xclip -o -selection clipboard)' has been copied to clipboard."
fi

View File

@ -0,0 +1,22 @@
#!/usr/bin/env sh
# This is based from the `mansplain` script by Luke Smith.
# Video reference is at https://www.youtube.com/watch?v=8E8sUNHdzG8.
# There's not much room for customizability so you'll have to edit the script itself if you want something different.
# Minimum requirements as of writing this script at 2019-12-18:
# * man - v2.9.0
# * xargs - v4.7.0
# * rofi - v1.5.4
# * awk - v5.0.1
# Optional dependencies:
# * zathura - v0.4.4
# * girara - v0.3.3
# * pdf-mupdf - v0.3.5
set -o pipefail
man -k . | rofi -dmenu -p 'Choose a manual' | awk '{print $1}' | xargs --no-run-if-empty "$TERMINAL" --command man

View File

@ -0,0 +1,51 @@
#!/usr/bin/env oil
# Create an interface for select Unicode characters with rofi and copy it into the clipboard.
# The characters are extracted from the Unicode Character Database (https://www.unicode.org/ucd/).
# It requires a tag name or an XPath similarly used for Python's `xml.etree.ElementTree.Element.findall`.
# See the following link for more information.
# (https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.findall)
# Dependencies:
# * Oil shell
# * curl
# * python (at least v3.7)
# * rofi
# * awk
# Set to use Oil features and strictness.
shopt --set strict:all
var QUERY = ARGV[0]
var UCD_VERSION = "13.0.0"
var UCD_XML_URL = "https://www.unicode.org/Public/$UCD_VERSION/ucdxml/ucd.nounihan.grouped.zip"
var CACHE = ${XDG_CACHE_DIR:-$HOME/.cache/unicode-character-database}
mkdir -p $CACHE
if test ! -f $CACHE/ucd.zip {
curl $UCD_XML_URL --output $CACHE/ucd.zip --silent
}
# The remaining thing is coded with Python because I want to use the UCD with no Unihan data and the grouped variation.
# Compared to the other variations, it is only ~6MB compared to ~55MB for the flat variation.
# Also, it requires more conditional handling than a simple shell script at this point.
# I could've made this script entirely in Python but I want to see what Oil shell is capable of.
python <<CODE | rofi -dmenu -p "Choose character" | awk '{ print $1 }' | xclip -selection clipboard
import xml.etree.ElementTree as ET
root = ET.fromstring('''$(unzip -p $CACHE/ucd.zip ucd.nounihan.grouped.xml)''')
# Print '<char>' and recurse into '<group>'.
def print_char(element):
if element.tag == '{http://www.unicode.org/ns/2003/ucd/1.0}char':
alias = element.get('na') if element.get('na') else element.get('na1')
codepoint = int(element.get('cp'), 16)
print("{code} {alias}".format(code=chr(codepoint), alias=alias))
elif element.tag == '{http://www.unicode.org/ns/2003/ucd/1.0}group':
for child in list(element):
print_char(child)
valid_nodes = root.findall('${QUERY}')
for point in valid_nodes:
print_char(point)
CODE

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Selects the region, echoes the hex string (in RGBA format) of the average color of the region.
# Depedencies:
# * maim v5.6.3
# * ImageMagick 7.0.10
# It's a small script and the main code is a chain of commands so a pipeline fail is appropriate here.
set -o pipefail
# Make some form of user feedback.
notify-send "Select a region for color picking."
# The color picker code.
# Take note it uses a slop shader named `crosshair` from the shader examples of the official repo at https://github.com/naelstrof/slop.
maim --select --shader crosshair --tolerance 0 --hidecursor | magick convert - -resize 1x1\! -format '%[hex:p{0,0}]' info:-

View File

@ -0,0 +1,124 @@
#!/usr/bin/env nix-shell
#! nix-shell -i oil -p coreutils sqlite unzip ripgrep jq file
# Convert a Newpipe database (assuming it was exported within the app) into OPML v2.
# Dependencies:
# * osh (oil shell) v0.8.12
# * sqlite3 v3.34.0
# * unzip
# * ripgrep v12.1.1
# * jq
# * file
# Use the current Oil features in strict mode.
# This also enables usage of the syntax.
shopt -s strict:all
var FILENAME = $1
# Testing if the given file is a zip file.
file --mime $FILENAME | rg "application/zip" --quiet || exit 1
var channel_id_eggex = / 'https://www.youtube.com/channel/' (word) /
var NEWPIPE_DB = "newpipe.db"
var TEMP_FOLDER_NAME = "newpipe"
# The SQL query to get the required metadata.
var NEWPIPE_DB_QUERY = "
SELECT name, url, service_id, group_concat(tag, ',') AS tags FROM (
SELECT subscriptions.name, subscriptions.url, subscriptions.service_id, '/' || feed_group.name AS tag
FROM subscriptions
LEFT JOIN feed_group_subscription_join AS subs_join
LEFT JOIN feed_group
ON subs_join.subscription_id = subscriptions.uid AND feed_group.uid = subs_join.group_id
) GROUP BY name ORDER BY name COLLATE NOCASE;"
# Print the beginning of the template.
cat <<OPML
<opml version="2.0">
<head>
<title>Newpipe subscriptions</title>
<dateCreated>$(date "+%F %T %z")</dateCreated>
<ownerName>$(whoami)</ownerName>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
OPML
# Simply prints an `<outline>` element formatted approriately for the resulting output.
# Don't mind how it is printed right now. :)
proc print-outline(title, xml_url, html_url, tags = "") {
printf ' <outline type="rss" xmlUrl="%s" htmlUrl="%s" title="%s" text="%s"' $xml_url $html_url $title $title
if test -n $tags {
printf ' category="%s"' $tags
}
printf '/>\n'
}
# Print the channels in the OPML body.
# This only occurs if the given file does have a Newpipe database.
if unzip -l $FILENAME | rg --quiet $NEWPIPE_DB {
# Make the temporary directory (preferably on the current directory to make cleanup easier).
mkdir $TEMP_FOLDER_NAME && unzip -q -u $FILENAME -d $TEMP_FOLDER_NAME
# Setting up some automatic cleanup upon exit.
trap "rm --recursive $TEMP_FOLDER_NAME" EXIT
# Quickly check if a SQLite database is in the Newpipe database folder.
file --mime "${TEMP_FOLDER_NAME}/${NEWPIPE_DB}" | rg --quiet "application/x-sqlite3" || exit 1
# Extract the data from the database and process them individually.
# Note that we formatted the data in CSV to be in one line per object since as of version 0.8.11, Oil has some problems when taking fully nested data from external commands (not yet completely verified).
# We have to rewrite this part once Oil fixes the issue with nested objects.
sqlite3 "${TEMP_FOLDER_NAME}/${NEWPIPE_DB}" "${NEWPIPE_DB_QUERY}" --csv --header \
| dasel select --parser csv --multiple --selector '.[*]' --compact --write json \
| while read channel {
# We have separate each channel as a JSON object per line.
echo $channel | json read :channel
setvar name = channel['name']
setvar url = channel['url']
setvar service_id = channel['service_id']
setvar tags = channel['tags']
# The `service_id` column indicates where the channel came from the selection of platforms PeerTube offers.
# Since the way to handle each platform differs to get the required data, we're throwing them in a case switch.
case $service_id {
# YouTube
'0') {
setvar channel_id = $(echo $url | sed --quiet --regexp-extended "s|$channel_id_eggex|\\1|p")
setvar xml_url = "https://www.youtube.com/feeds/videos.xml?channel_id=${channel_id}"
}
;;
# Peertube instances
'3') {
# This naive solution just goes through the domain with the assumption that the database is exported properly from the app and not tampered with.
# It can go into an infinite loop so take caution for now.
setvar domain = $(echo $url | cut --delimiter='/' --fields='-3')
setvar _domain_part_index = 4
until (Bool($(curl --silent "$domain/api/v1/config/about" | dasel --parser json --selector ".instance.name"))) {
setvar domain = $(echo $url | cut --delimiter='/' --fields="-$_domain_part_index")
setvar _domain_part_index = Int($_domain_part_index) + 1
}
setvar channel_url = $(echo $url | cut --delimiter='/' --fields='4-')
setvar feed_type = $(echo $channel_url | rg "video-channels" --quiet && echo "videoChannelId" || echo "accountId")
setvar channel_id = $(curl "${domain}/api/v1/${channel_url}" --silent | dasel --parser json --selector '.id')
setvar xml_url = "$domain/feeds/videos.atom?$feed_type=$channel_id"
}
;;
}
print-outline $name $xml_url $url $tags
}
}
# Print the remaining parts of the document.
cat <<OPML
</body>
</opml>
OPML

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
# TODO:
# Given a OPML file, convert the OPML into a `urls` file compatible for newsboat.
# It could also accept an OPML through stdin.
import itertools
import fileinput
from pathlib import Path
import sys
import xml.etree.ElementTree as ET
if len(sys.argv) > 1:
opml = ET.parse(sys.argv[1])
else:
opml = ET.fromstring(fileinput.input())
for outline in opml.findall("body/outline"):
categories = [category.strip("/") for category in outline.get("category", "").split(",") if category]
print('{xmlUrl} "~{text}" {category}'.format(xmlUrl = outline.get("xmlUrl"),
text = outline.get("text"),
category = " ".join([ f'"{tag}"' for tag in categories ]) if len(categories) else " "))

View File

@ -0,0 +1,147 @@
#!/usr/bin/env oil
# A quick script on moving a file with embedded data.
# It can only detect certain files and write the metadata with a certain program.
# For the argument, it needs the path of the files to be moved.
# Dependencies:
# * Oil shell v0.8.8
# * vorbis-tools v1.4.2
# * exiftool v12.16
# * file 5.38
# * coreutils 8.32
shopt --set strict:all
var help_section = "A script for embedding metadata and renaming them files.
edit-file-metadata [options...] FILE
Options:
-h, --help Show the help section.
-a, --author [AUTHOR] Set the author.
-d, --date [DATE] Set the date.
-t, --title [TITLE] Set the title.
--skip Skip the prompt for missing metadata
and only change the needed metadata.
This only works if you've set any
of the metadata in the command line.
--json Return a JSON object on stdout.
--move Move the filename from the kebab-case
of the title.
"
var path = ''
var author = ''
var title = ''
var pub_date = ''
var skip = false
var json_data = false
var move = false
while test $len(ARGV) -gt 0 {
case $[ARGV[0]] {
-h|--help)
echo $help_section
exit 0
;;
-a|--author)
setvar author = ARGV[1]
shift 2
;;
-t|--title)
setvar title = ARGV[1]
shift 2
;;
-d|--date)
setvar pub_date = ARGV[1]
shift 2
;;
--skip)
setvar skip = true
shift
;;
--json)
setvar json_data = true
shift
;;
--move)
setvar move = true
shift
;;
*)
setvar path = ARGV[0]
shift
;;
}
}
proc kebab-case(word) {
# Convert into lower case.
setvar word = $(echo $word | tr '[:upper:]' '[:lower:]')
# What happens to this line:
# * Convert all whitespace and dashes into a single dash.
# * Remove all invalid characters (all that are not alphanumeric characters and dashes).
# * Remove leading and trailing dashes.
setvar word = $(echo $word | sed --regexp-extended --expression 's/\s+|-+/-/g' --expression 's/[^.a-z0-9-]//g' --expression 's/^-+|-+\$//g')
echo $word
}
proc prompt(string, :out, prefix = ">> ") {
>&2 printf "%s\\n%s" $string $prefix
read --line
setref out = $_line
}
proc file_parse(path, :out) {
var extension_regex = / '.' ![ '.' ]+ %end /
var file = {}
setvar file['dir'] = $(dirname $path)
setvar file['name'] = $(basename $path | sed --regexp-extended "s|(.+)${extension_regex}|\\1|")
setvar file['ext'] = $(basename $path | sed --regexp-extended "s|.+(${extension_regex})|\\1|")
setvar file['mime_type'] = $(file --mime-type --brief $path)
setref out = file
}
test -f $path || {
>&2 echo "${path} is not a regular file"
exit 1
}
# Prompt for the missing metadata (if it's configured to not skip, anyways).
if (not skip) {
test $title || prompt "What is the title?" :title
test $author || prompt "Who are the authors?" :author
test $pub_date || prompt "When this file published?" :pub_date
}
# Writing up the metadata time!
# Each file type has a different way of embedding metadata so it needs different tools.
# We'll use exiftool as a catch-all since it supports the most out of... 15 file types I considered.
case $(file --mime-type --brief $path) {
"audio/ogg")
vorbiscomment --write $path --tag "TITLE=${title}" --tag "ARTIST=${author}" --tag "DATE=${pub_date}" ||
opustags $path --in-place --delete-all --add "TITLE=${title}" --add "ARTIST=${author}" --add "DATE=${pub_date}"
;;
*)
exiftool -title="${title}" -author="${author}" -date="${pub_date}" ${path}
;;
}
file_parse $path :file_info
if (json_data) {
var metadata = {}
setvar metadata['file'] = file_info
setvar metadata['title'] = $title
setvar metadata['author'] = $author
setvar metadata['date'] = $pub_date
json write :metadata
}
if (move) {
mv $path "${file_info['dir']}/$(kebab-case $title)${file_info['ext']}"
}

View File

@ -0,0 +1,26 @@
#!/usr/bin/env sh
# Extracts the archive.
# The process can vary depending on the file extension.
# Dependencies:
# * tar (GNU tar) 1.32
# Extract each given filename.
for f in $@; do
if [ -n "$(file "$f" | grep -i '7-zip archive data')" ]; then
7z x "$f"
elif [ -n "$(file "$f" | grep -i 'zip archive data')" ]; then
unzip "$f"
elif [ -n "$(file "$f" | grep -i 'POSIX tar archive')" ]; then
tar --extract --file $f # or 'tar xf $f'
elif [ -n "$(file "$f" | grep -i 'gzip compressed data')" ]; then
tar --extract --gzip --file "$f" # or 'tar xzf $f'
elif [ -n "$(file "$f" | grep -i 'bzip2 compressed data')" ]; then
tar --extract --bzip2 --file "$f" # or 'tar xjf $f'
elif [ -n "$(file "$f" | grep -i 'RAR archive data')" ]; then
unrar x "$f"
else
echo "unrecognized format."
fi
done

View File

@ -0,0 +1,23 @@
#!/usr/bin/env nix-shell
#! nix-shell -i oil -p coreutils curl jq
# Generate the config with Duckduckgo bangs.
# Very useful if you really want just to search as you would in Duckduckgo.
const bang_url = "${BANGS_URL:-https://duckduckgo.com/bang.js}"
const config = {}
# We still have to use some external tools like jq since Oil doesn't support nested objects yet.
# For more information, see https://github.com/oilshell/oil/issues/741
curl --silent --location $bang_url | jq 'sort_by(.t) | .[]' --raw-output --compact-output --sort-keys | while read --line {
write -- $_line | json read :bang
var _data = {}
var trigger = bang['t']
setvar _data['name'] = bang['s']
setvar _data['url'] = bang['u']
setvar config[trigger] = _data
}
json write :config

View File

@ -0,0 +1,19 @@
#!/usr/bin/env nix-shell
#! nix-shell --pure -i bash -p curl jq fzf coreutils findutils iputils cacert
# A quick command line interface for creating a gitignore with the API from https://gitignore.io.
# This script comes with a simple caching to avoid creating too much requests.
set -eo pipefail
CACHE_FILE="${XDG_CACHE_DIR:-$HOME/.cache}/gitignore-io.langs.json"
# Check if the language list is downloaded for the last hour (3600 seconds).
if [[ ! -e $CACHE_FILE ]] || test $(expr $(date "+%s") - $(date -r $CACHE_FILE "+%s")) -gt 3600
then
curl --silent --location --output $CACHE_FILE "https://gitignore.io/api/list?format=json"
fi
KEYS=$(jq 'keys | .[] | @text' --raw-output $CACHE_FILE | fzf --multi | while read lang; do echo " .[\"$lang\"].contents"; done | paste -s -d ',')
jq "$KEYS" --raw-output $CACHE_FILE

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail
TEMPLATES_DIR="$HOME/templates"
while [[ ! -a "$TEMPLATES_DIR/$TEMPLATE/cookiecutter.json" ]]
do
TEMPLATE="$TEMPLATE/$(ls "$TEMPLATES_DIR/$TEMPLATE" | fzf)"
done
cookiecutter "$TEMPLATES_DIR/$TEMPLATE"

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# A script that utilizes OCR for a screenshot and copies the text to the clipboard.
# Dependencies:
# * tesseract 4.1.1
# * leptonica-1.79.0
# * The Tesseract English data
# * Image libraries (e.g., `libgif`, `libwebp`)
# * xclip - version 0.13
# * maim - version 5.6.3
# It's a small script anyways so why not.
# I feel like this is one of the appropriate solutions especially that there is potential for erreneous feedback.
set -o pipefail
notify-send "Select a region for the OCR"
maim --select --hidecursor | magick mogrify -modulate 100,0 -resize 400% png:- | tesseract - stdout | xclip -selection clipboard

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Parse various code from image selection with zbarimg and maim.
# Depedencies:
# * maim v5.6.3
# * zbarimg v0.23.1
# * GNU awk v5.1.0
# * perl v5.30.2
# This is a small script so pipeline fails can be accepted here.
set -o pipefail
notify-send "Select a region for the barcode (QR codes, ISBN, bar codes)"
maim --select --hidecursor --quiet | zbarimg - --quiet --oneshot --raw | xclip -selection clipboard

View File

@ -0,0 +1,332 @@
#!/usr/bin/env bash
# This is a fork of rofi-screenshot (original at https://github.com/ceuk/rofi-screenshot/), basically a menu for all of your screenshoting and screencasting needs using rofi as the frontend.
# This script is meant to be modified for your specific need so feel free to do that.
# Btw, this script also uses its own Rofi theme so be sure to update it accordingly.
#############
# CONSTANTS #
#############
readonly _script_name=$(basename $0)
readonly _record_process_name='(/\S+)*ffmpeg\s.*\sx11grab\s.*'
readonly _process_id="$$"
readonly screenshot_directory="$(xdg-user-dir PICTURES)/screenshots"
readonly screenshot_msg_header="Screenshot"
readonly video_directory="$(xdg-user-dir VIDEOS)/recordings"
readonly video_msg_header="Screencast"
readonly date_filename_format="+%F-%H-%M-%S"
# Exit the script on USR1 signal.
# This is useful for exiting out of the whole script even in subshells.
trap 'notify-send "rofi-screenshot-menu has exited" && exit 1' 10
mkdir -p $screenshot_directory
mkdir -p $video_directory
#####################
# UTILITY FUNCTIONS #
#####################
# Setting the default command for ffmpeg.
ffmpeg() {
command ffmpeg -hide_banner -loglevel error -nostdin "$@"
}
# Set the default command for rofi.
rofi() {
command rofi -theme themes/fds-center-menu "$@" || kill -USR1 "$_process_id"
}
# Set the default command for slop.
slop() {
command slop "$@" || kill -USR1 "$_process_id"
}
# Convert a video to GIF.
# $1 - The input file.
# $2 - The output file.
video_to_gif() {
local input="$1"
local output="$2"
ffmpeg -i "$input" -vf palettegen -f image2 -c:v png - |
ffmpeg -i "$input" -i - -filter_complex paletteuse "$output"
}
# Create a countdown with desktop notifications.
# $1 - The duration of the countdown.
# $2 - The header of the notification.
_countdown() {
local counter="$((${1:-3}))"
local msg="${2:-Countdown}"
while [[ $counter -ne 0 ]]; do
notify-send "$msg" "Countdown in $counter seconds" --expire-time 1000
sleep 1
counter=$((counter - 1))
done
}
# Check for the recording process.
_check() {
pgrep --full --exact --newest "$_record_process_name" 1>/dev/null
}
# Kill the recording process.
_kill() {
pkill --full --exact --newest "$_record_process_name"
}
######################
# SCREENSHOT OPTIONS #
######################
# Most of the functions here have helpful documentations like the following function.
# Pretty handy, eh?
# Capture region to clipboard.
# $1 - Delay (in seconds) before screenshot.
# If it's >=0, there's no countdown (obviously).
capture_region_to_clipboard() {
notify-send "$screenshot_msg_header" "Select a region to capture"
local geometry=$(slop -n -f '-g %g ')
local delay=${1:-0}
if [ $delay -gt 0 ]; then
_countdown $delay "Screenshot"
fi
ffcast -q "$geometry" png /tmp/screenshot_clip.png
xclip -selection clipboard -t image/png /tmp/screenshot_clip.png && \
notify-send "$screenshot_msg_header" "Region copied to clipboard"
rm /tmp/screenshot_clip.png
}
# Capture region to file.
# $1 - Delay (in seconds) before screenshot.
# If the argument is set >=0, there's no countdown.
capture_region_to_file() {
notify-send "$screenshot_msg_header" "Select a region to capture"
dt=$(date "$date_filename_format")
local image_file="$screenshot_directory/$dt.png"
local geometry=$(slop -n -f '-g %g ')
local delay=${1:-0}
if [ $delay -gt 0 ]; then
_countdown $delay "Screenshot"
fi
ffcast -q "$geometry" png "$image_file"
notify-send "$screenshot_msg_header" "Region saved as $image_file"
}
# Capture screen to clipboard.
# Since delaying a screen capture is pretty easy, there's no delay option.
# Just make one of your own, please.
capture_screen_to_clipboard() {
ffcast -q png /tmp/screenshot_clip.png
xclip -selection clipboard -t image/png /tmp/screenshot_clip.png
rm /tmp/screenshot_clip.png
notify-send "$screenshot_msg_header" "Screenshot copied to clipboard"
}
# Capture screen to file.
# (See, I have written very helpful comments like this one.)
capture_screen_to_file() {
dt=$(date "$date_filename_format")
local image_file="$screenshot_directory/$dt.png"
ffcast -q png "$image_file"
notify-send "Screenshot" "Screenshot saved as $image_file"
}
######################
# SCREENCAST OPTIONS #
######################
# Record region to GIF.
# $1 - Delay (in seconds) before recording.
record_region_to_gif() {
notify-send "$video_msg_header" "Select a region to record"
dt=$(date "$date_filename_format")
local geometry=$(slop -n -f '-g %g ' && _countdown)
local delay=${1:-0}
if [ $delay -gt 0 ]; then
_countdown $delay "Screencast"
fi
ffcast -q rec /tmp/screenshot_gif.mkv
notify-send "$video_msg_header" "Converting to gif... (this can take a while)"
local recording_file="$video_directory/$dt.gif"
video_to_gif /tmp/screenshot_gif.mp4 $recording_file
rm /tmp/screenshot_gif.mp4
notify-send "$video_msg_header" "Recording saved as $recording_file"
}
record_screen_to_gif() {
dt=$(date "$date_filename_format")
ffcast -q rec /tmp/screenshot_gif.mp4
notify-send "$video_msg_header" "Converting to GIF... (this can take a while)"
local recording_file="$video_directory/$dt.gif"
video_to_gif /tmp/screenshot_gif.mp4 "$screenshot_directory/$dt.gif"
rm /tmp/screenshot_gif.mp4
notify-send "$video_msg_header" "Recording saved to $screenshot_directory"
}
# Record region to MKV.
# $1 - Delay (in seconds) before recording.
record_region_to_mkv() {
notify-send "$video_msg_header" "Select a region to record"
dt=$(date "$date_filename_format")
local delay=${1:-0}
if [ $delay -ge 0 ]; then
_countdown $delay "Screencast"
fi
local geometry=$(slop -n -f '-g %g ' && _countdown)
local video_file="$video_directory/$dt.mkv"
ffcast -q "$geometry" rec "$video_file"
notify-send "$video_msg_header" "Recording saved as $video_file"
}
record_screen_to_mkv() {
dt=$(date "$date_filename_format")
local video_file="$video_directory/$dt.mkv"
ffcast -q rec "$video_file"
notify-send "$video_msg_header" "Recording saved as $video_file"
}
######################
# COMMAND LINE STUFF #
######################
get_options() {
echo "Capture Region --> Clip"
echo "Capture Region --> File"
echo "Capture Screen --> Clip"
echo "Capture Screen --> File"
echo "Record Region --> File (GIF)"
echo "Record Screen --> File (GIF)"
echo "Record Region --> File (MKV)"
echo "Record Screen --> File (MKV)"
}
# Checks if the shell has the following binary in $PATH through the `hash` builtin.
# $1 - The utility to look for.
check_deps() {
if ! hash $1 2>/dev/null; then
echo "Error: This script requires $1"
exit 1
fi
}
# The help string.
_help="Usage: $_script_name [OPTIONS]
Launches a Rofi menu for your screenshoting and screencasting needs.
Options:
-h, --help Prints the help section.
--stop Stop if there's an active process (e.g., a recording).
--check Exits successfully if there's an active process.
The 'algorithm' for checking is very naive as it
checks for a specific name so be sure to check the
source code for yourself and update it accordingly.
"
main() {
# Check dependencies.
check_deps slop
check_deps ffcast
check_deps ffmpeg
check_deps xclip
check_deps rofi
# Parsing the arguments.
# Since getopts does not support long options so we'll have to roll our own.
while [[ $# -gt 0 ]];
do
case $1 in
-h|--help)
printf "$_help" && exit 0
;;
--stop)
_kill
exit $!
;;
--check)
_check
exit $!
;;
*)
shift
;;
esac
done
# Get choice from Rofi.
choice=$( (get_options) | rofi -dmenu -i -fuzzy -p "Screenshot and screencast options" )
# If user has not picked anything, exit.
if [[ -z "${choice// }" ]]; then
exit 1
fi
# Run the selected command.
case $choice in
'Capture Region --> Clip')
delay=$(rofi -dmenu -p "How many seconds for delay?")
capture_region_to_clipboard $delay
;;
'Capture Screen --> Clip')
delay=$(rofi -dmenu -p "How many seconds for delay?")
capture_screen_to_clipboard $delay
;;
'Capture Region --> File')
delay=$(rofi -dmenu -p "How many seconds for delay?")
capture_region_to_file $delay
;;
'Capture Screen --> File')
delay=$(rofi -dmenu -p "How many seconds for delay?")
_countdown $delay
capture_screen_to_file
;;
'Record Region --> File (GIF)')
delay=$(rofi -dmenu -p "How many seconds for delay?")
record_region_to_gif $delay
;;
'Record Screen --> File (GIF)')
delay=$(rofi -dmenu -p "How many seconds for delay?")
_countdown $delay
record_screen_to_gif
;;
'Record Region --> File (MKV)')
delay=$(rofi -dmenu -p "How many seconds for delay?")
record_region_to_mkv $delay
;;
'Record Screen --> File (MKV)')
delay=$(rofi -dmenu -p "How many seconds for delay?")
_countdown $delay
record_screen_to_mkv
;;
esac
}
main $1

View File

@ -0,0 +1,278 @@
#! /usr/bin/env nix-shell
#! nix-shell -i oil -p coreutils moreutils ffmpeg gnused ripgrep file
shopt --set strict:all
const show_help = "A small script for splitting files into tracks, perfect for full album releases and audiobooks.
Based from Luke Smith's booksplit script
(https://raw.githubusercontent.com/LukeSmithxyz/voidrice/091d7e54c5c1ed77201ce1254aa2623a2801c9f2/.local/bin/booksplit).
split-album [options...] [\$ALBUM_FILE \$TIMESTAMP_FILE]
Options:
-h, --help Show the help section.
--tutorial Show a helpful tutorial-esque description of the program.
--audio-file [file] Set the audio file to be split.
--timestamp-file [file] Set the timestamp file to be used for splitting.
-t, --title [title] Set the title of the album.
-d, --date [date] Set the publication date of the album.
-a, --author [author] Set the author of the album.
--json Print the JSON data for use with other applications.
--skip Skip the extraction part, useful for printing data with '--json' or testing the timestamp file.
--strict Set to be strict, exiting when an invalid timestamp is encountered.
Environment variables:
EXTENSION The extension to be used. This is used in conjunction with FFmpeg
where it can detect the codec to be converted automatically with it.
When any of the required metadata is missing (i.e., title, date, author), it will be prompted.
"
const show_descriptive_help = "This script splits an album with a timestamp file.
You're always going to see using this script like the following:
split-album \$AUDIO_FILE \$TIMESTAMP_FILE
The timestamp file contains a starting timestamp (in HH:MM:SS[.MS]) and the title of the chapter/track.
For more information, see https://trac.ffmpeg.org/wiki/Seeking.
Lines starting with '#' and empty lines will be ignored.
The following is an example of the content of a timestamp file.
\`\`\`
00:00:00 Introduction
00:03:54 It's the R-rated scene
00:25:43 Boring exposition at the cafe
00:36:54 Expedition time
00:41:51 Fighting time
00:42:22 Shower scene
\`\`\`
You can also create a timestamp file in JSON format.
It is the equivalent of the 'chapters' key from the JSON output (i.e., '--json').
The equivalent JSON of the previous example would be this:
\`\`\`
[
{
\"timestamp\": \"00:00:00\",
\"title\": \"Introduction\"
},
{
\"timestamp\": \"00:03:54\",
\"title\": \"It's the R-rated scene\"
},
{
\"timestamp\": \"00:25:43\",
\"title\": \"Boring exposition at the cafe\"
},
{
\"timestamp\": \"00:36:54\",
\"title\": \"Expedition time\"
},
{
\"timestamp\": \"00:41:51\",
\"title\": \"Fighting time\"
},
{
\"timestamp\": \"00:42:22\",
\"title\": \"Shower scene\"
}
]
\`\`\`
There will be a folder created with the safe name of the album (in kebab-case) containing the split tracks.
The original file will be kept, do what you want with it.
"
proc warnf(msg, @args) {
>&2 printf "${msg}\\n" @args
}
proc errorf(msg, @args) {
>&2 printf "${msg}\\n" @args
exit 1
}
proc prompt(msg, :out, prefix = ">> ") {
>&2 printf '%s\n%s' $msg $prefix
read --line
setref out = $_line
}
proc kebab-case(word) {
write -- $word | sed --regexp-extended --expression 's/./\L&/g' --expression 's/\s+/-/g' --expression 's/[^a-z0-9-]//g' --expression 's/^-+|-+$//g' --expression 's/-+/-/g'
}
proc main {
# This could be configured by setting the 'EXTENSION' environment variable.
const EXTENSION = ${EXTENSION:-"opus"}
# Set up the variables.
var audio_file = ''
var timestamp_file = ''
var album = ''
var author = ''
var pub_date = ''
var prints_json = false
var strict_mode = false
var skip = false
# Parse the arguments.
while test $len(ARGV) -gt 0 {
case $[ARGV[0]] {
-h|--help)
write -- $show_help
exit
;;
--tutorial)
write -- $show_descriptive_help
exit
;;
--audio-file)
setvar audio_file = ARGV[1]
shift 2
;;
--timestamp-file)
setvar timestamp_file = ARGV[1]
shift 2
;;
-a|--author)
setvar author = ARGV[1]
shift 2
;;
-d|--date)
setvar pub_date = ARGV[1]
shift 2
;;
-t|--title)
setvar album = ARGV[1]
shift 2
;;
--strict)
setvar strict_mode = true
shift
;;
--skip)
setvar skip = true
shift
;;
--json)
setvar prints_json = true
shift
;;
*)
setvar audio_file = ARGV[0]
setvar timestamp_file = ARGV[1]
shift 2
;;
}
}
# Check the files if it is valid.
test -f $audio_file || errorf '%s is not a regular file' $audio_file
test -f $timestamp_file || errorf '%s is not a regular file' $timestamp_file
# Prompt for the missing values if not passed from the command line.
test $album || prompt "What is the title of the album?" :album
test $author || prompt "Who is the author of the album?" :author
test $pub_date || prompt "When is the album published?" :pub_date
# Populate the output data.
# This is going to be used throughout the processing.
# Additionally, the object will be printed when `--json` flag is passed.
const output_data = {}
setvar output_data['file'] = $audio_file
setvar output_data['chapters'] = []
setvar output_data['album'] = $album
setvar output_data['author'] = $author
setvar output_data['date'] = $pub_date
setvar output_data['extension'] = $EXTENSION
# The following variable stores an eggex, a simplified notation for regular expressions.
# Pretty nice to use especially that literals are quoted and classes are not.
const timestamp_regex = / %start digit{2,} ':' digit{2} ':' digit{2} <'.' digit+>? %end /
# We'll keep track whether the pipeline has encountered an error.
# If it has, the script will exit throughout various points of the process.
var has_error = false
# Deserialize the given input into the chapters data.
# This script accept several formats from a JSON file to a plain-text file derived from Luke Smith's 'booksplit' script.
case $(file --mime-type --brief $timestamp_file) {
"application/json")
json read :chapters < $timestamp_file
setvar output_data['chapters'] = chapters
;;
# The text file is formatted quite similarly to the required format from the booksplit script.
# I improved some things in the format such as allowing comments (i.e., lines starting with '#') and empty lines allowing for cleaner input.
"text/plain")
sed --regexp-extended --expression '/^\s*$/d' --expression '/^#/d' $timestamp_file | while read --line {
# We'll build the chapter data to be added later to the output data.
var chapter = {}
setvar chapter['title'] = $(write -- $_line | cut -d' ' -f2-)
setvar chapter['timestamp'] = $(write -- $_line | cut -d' ' -f1)
# Mark the input to be erreneous if the timestamp format is not valid.
# This will cause the script to exit in the next part of the process.
# We won't be exiting immediately to give all possible errors.
write -- ${chapter['timestamp']} | rg --quiet $timestamp_regex || {
warnf "'%s' %s is not a valid timestamp" ${chapter['timestamp']} ${chapter['title']}
setvar has_error = true
continue
}
_ output_data['chapters'].append(chapter)
}
;;
}
# Exit if the script is set as strict and has erreneous input.
# If the user cares about the input, they have to set it to strict mode.
if (strict_mode and has_error) { exit 1 }
# Set parts of the output data and prepare for the splitting process.
const title_slug = $(kebab-case $album)
setvar output_data['directory'] = $(realpath --canonicalize-missing $title_slug)
mkdir -p $title_slug
# Rather than sequentially segmenting the audio, we'll extract the starting and ending timestamps of each segment then feed it to a job queue that can execute jobs in parallel.
# Take note we don't have the ending timestamp of each segment so we need a way to look back into items.
const chapter_len = len(output_data['chapters'])
var job_queue = %()
# Iterate through the chapters and populate the job queue.
# We'll also fill up the rest of the chapter-related data into the output data.
for index in @(seq $[chapter_len]) {
var index = Int(index)
setvar chapter = output_data['chapters'][index - 1]
var start = chapter['timestamp']
var end = output_data['chapters'][index]['timestamp'] if index !== chapter_len else null
var filename = $(printf "%.2d-%s.%s" $index $(kebab-case ${chapter['title']}) $EXTENSION)
setvar output_data['chapters'][index - 1]['file'] = filename
# Check for incorrect timestamp order and set the pipeline as erreneous if it is.
# We can't let the splitting process proceed since it will surely make problematic output.
if (start > end and end is not null) {
warnf '%s (start) is ahead compared to %s (end)' $start $end
setvar has_error = true
}
append :job_queue ">&2 printf '[%d/%d] %s\\n' $[index] $[chapter_len] \"$[output_data['chapters'][index - 1]['title']]\"; ffmpeg -loglevel quiet -nostdin -i '${audio_file}' -ss ${start} $['-to ' + end if index !== chapter_len else ''] ${title_slug}/${filename}"
}
# Exit the process if an error detected.
if (has_error) { exit 1 }
# Start the splitting process if the `--skip` is absent.
if (not skip) { parallel -- @job_queue }
# Print the output data as JSON if the `--json` flag is passed.
if (prints_json) { json write :output_data }
}
main @ARGV

View File

@ -0,0 +1,29 @@
#!/usr/bin/env sh
# Dependencies:
# * echo
# * kill
# * pgrep from procps-ng 3.3.15
help_usage="Close if the program is already running.
Otherwise, open the specified program.
Useful for programs that should have one instance running
at a time.
Note that it uses pgrep for searching the existance of
the program.
Usage: $0 <BINARY_NAME>
"
if [[ $# -lt 1 ]]; then
echo "$help_usage"
exit 0
fi
kill $(pgrep $1) 2>/dev/null
if [[ $? != 0 ]]; then
$1 2>/dev/null
fi

View File

@ -0,0 +1,6 @@
#!/usr/bin/env sh
# A simple prompt script.
# Based from Luke Smith's prompt script.
# https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/prompt
[ "$(printf "No\\nYes" | rofi -theme themes/dmenu -dmenu -p "$1")" = "Yes" ] && $2

View File

@ -0,0 +1,24 @@
#!/bin/sh
# Removing all rules at startup to prevent duplicating rules.
bspc rule -r "*"
# Set up the desktops (workspaces) for the monitor
bspc monitor -d I II III IV V
bspc config border_width 2
bspc config window_gap 9
bspc config split_ratio 0.50
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config focused_border_color "#88C0D0"
bspc config focus_follows_pointer true
# Set the default cursor to pointer
xsetroot -cursor_name left_ptr
# Rules
bspc rule -a code-oss desktop=^2
bspc rule -a firefox desktop=^1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -0,0 +1,435 @@
[global]
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a window manager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern window managers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = mouse
# The geometry of the window:
# [{width}]x{height}[+/-{x}+/-{y}]
# The geometry of the message window.
# The height is measured in number of notifications everything else
# in pixels. If the width is omitted but the height is given
# ("-geometry x2"), the message window expands over the whole screen
# (dmenu-like). If width is 0, the window expands to the longest
# message displayed. A positive x is measured from the left, a
# negative from the right side of the screen. Y is measured from
# the top and down respectively.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
geometry = "350x50-10+50"
# Show how many messages are currently hidden (because of geometry).
indicate_hidden = yes
# Shrink window if it's smaller than the width. Will be ignored if
# width is 0.
shrink = no
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing window manager is
# present (e.g. xcompmgr, compiz, etc.).
transparency = 10
# The height of the entire notification. If the height is smaller
# than the font height and padding combined, it will be raised
# to the font height and padding.
notification_height = 0
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
separator_height = 2
# Padding between text and separator.
padding = 8
# Horizontal padding.
horizontal_padding = 8
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 2
# Defines color of the frame around the notification window.
frame_color = "#D8DEE9"
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Sort messages by urgency.
sort = yes
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
# A client can set the 'transient' hint to bypass this. See the rules
# section for how to disable this if necessary
idle_threshold = 120
### Text ###
font = Iosevka 12
# The spacing between lines. If the height is smaller than the
# font height, it will get raised to the font height.
line_height = 0
# Possible values are:
# full: Allow a small subset of html markup in notifications:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
#
# strip: This setting is provided for compatibility with some broken
# clients that send markup even though it's not enabled on the
# server. Dunst will try to strip the markup but the parsing is
# simplistic so using this option outside of matching rules for
# specific applications *IS GREATLY DISCOURAGED*.
#
# no: Disable markup parsing, incoming notifications will be treated as
# plain text. Dunst will not advertise that it has the body-markup
# capability if this is set as a global setting.
#
# It's important to note that markup inside the format option will be parsed
# regardless of what this is set to.
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "<b>%s</b>\n%b"
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 60
# Split notifications into multiple lines if they don't fit into
# geometry.
word_wrap = yes
# When word_wrap is set to no, specify where to make an ellipsis in long lines.
# Possible values are "start", "middle" and "end".
ellipsize = middle
# Ignore newlines '\n' in notifications.
ignore_newline = no
# Stack together notifications with the same content
stack_duplicates = true
# Hide the count of stacked notifications with the same content
hide_duplicate_count = false
# Display indicators for URLs (U) and actions (A).
show_indicators = yes
### Icons ###
# Align icons left/right/off
icon_position = left
# Scale larger icons down to this size, set to 0 to disable
max_icon_size = 32
# Paths to default icons.
icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/
### History ###
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = yes
# Maximum amount of notifications kept in history
history_length = 20
### Misc/Advanced ###
# dmenu path.
dmenu = /usr/bin/dmenu -p dunst:
# Browser for opening urls in context menu.
browser = /usr/bin/firefox -new-tab
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
# Define the title of the windows spawned by dunst
title = Dunst
# Define the class of the windows spawned by dunst
class = Dunst
# Print a notification on startup.
# This is mainly for error detection, since dbus (re-)starts dunst
# automatically after a crash.
startup_notification = false
# Manage dunst's desire for talking
# Can be one of the following values:
# crit: Critical features. Dunst aborts
# warn: Only non-fatal warnings
# mesg: Important Messages
# info: all unimportant stuff
# debug: all less than unimportant stuff
verbosity = mesg
# Define the corner radius of the notification window
# in pixel size. If the radius is 0, you have no rounded
# corners.
# The radius will be automatically lowered if it exceeds half of the
# notification height to avoid clipping text and/or icons.
corner_radius = 0
### Legacy
# Use the Xinerama extension instead of RandR for multi-monitor support.
# This setting is provided for compatibility with older nVidia drivers that
# do not support RandR and using it on systems that support RandR is highly
# discouraged.
#
# By enabling this setting dunst will not be able to detect when a monitor
# is connected or disconnected which might break follow mode if the screen
# layout changes.
force_xinerama = false
### mouse
# Defines action of mouse event
# Possible values are:
# * none: Don't do anything.
# * do_action: If the notification has exactly one action, or one is marked as default,
# invoke it. If there are multiple and no default, open the context menu.
# * close_current: Close current notification.
# * close_all: Close all notifications.
mouse_left_click = close_current
mouse_middle_click = do_action
mouse_right_click = close_all
# Experimental features that may or may not work correctly. Do not expect them
# to have a consistent behaviour across releases.
[experimental]
# Calculate the dpi to use on a per-monitor basis.
# If this setting is enabled the Xft.dpi value will be ignored and instead
# dunst will attempt to calculate an appropriate dpi value for each monitor
# using the resolution and physical size. This might be useful in setups
# where there are multiple screens with very different dpi values.
per_monitor_dpi = false
[shortcuts]
# Shortcuts are specified as [modifier+][modifier+]...key
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key).
# Xev might be helpful to find names for keys.
# Close notification.
close = ctrl+space
# Close all notifications.
close_all = ctrl+shift+space
# Redisplay last message(s).
# On the US keyboard layout "grave" is normally above TAB and left
# of "1". Make sure this key actually exists on your keyboard layout,
# e.g. check output of 'xmodmap -pke'
history = ctrl+grave
# Context menu.
context = ctrl+shift+period
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#2E3440"
foreground = "#ECEFF4"
timeout = 10
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#2E3440"
foreground = "#D8DEE9"
timeout = 10
# Icon for notifications with normal urgency, uncomment to enable
#icon = /path/to/icon
[urgency_critical]
background = "#2E3440"
foreground = "#A3BE8C"
frame_color = "#A3BE8C"
timeout = 0
# Icon for notifications with critical urgency, uncomment to enable
#icon = /path/to/icon
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
#
# Messages can be matched by
# appname (discouraged, see desktop_entry)
# body
# category
# desktop_entry
# icon
# match_transient
# msg_urgency
# stack_tag
# summary
#
# and you can override the
# background
# foreground
# format
# frame_color
# fullscreen
# new_icon
# set_stack_tag
# set_transient
# timeout
# urgency
#
# Shell-like globbing will get expanded.
#
# Instead of the appname filter, it's recommended to use the desktop_entry filter.
# GLib based applications export their desktop-entry name. In comparison to the appname,
# the desktop-entry won't get localized.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: if you don't want a notification to be displayed, set the format
# to "".
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
# Disable the transient hint so that idle_threshold cannot be bypassed from the
# client
#[transient_disable]
# match_transient = yes
# set_transient = no
#
# Make the handling of transient notifications more strict by making them not
# be placed in history.
#[transient_history_ignore]
# match_transient = yes
# history_ignore = yes
# fullscreen values
# show: show the notifications, regardless if there is a fullscreen window opened
# delay: displays the new notification, if there is no fullscreen window active
# If the notification is already drawn, it won't get undrawn.
# pushback: same as delay, but when switching into fullscreen, the notification will get
# withdrawn from screen again and will get delayed like a new notification
#[fullscreen_delay_everything]
# fullscreen = delay
#[fullscreen_show_critical]
# msg_urgency = critical
# fullscreen = show
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# format = ""
#[history-ignore]
# # This notification will not be saved in history
# summary = "foobar"
# history_ignore = yes
#[skip-display]
# # This notification will not be displayed, but will be included in the history
# summary = "foobar"
# skip_display = yes
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
#[stack-volumes]
# appname = "some_volume_notifiers"
# set_stack_tag = "volume"
#
[screenshot]
appname = "maim"
desktop_entry = "maim"
# vim: ft=cfg

View File

@ -0,0 +1,97 @@
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
(setq user-full-name "Gabriel Arazas"
user-mail-address "foo.dogsquared@gmail.com")
(setq doom-font (font-spec :family "Iosevka" :size 16)
doom-serif-font (font-spec :family "Source Serif Pro"))
(setq doom-theme 'doom-nord)
(setq org-directory "~/writings/orgnotes"
org-roam-directory "~/writings/wiki"
org-roam-dailies-directory (f-join org-roam-directory "daily"))
(setq global-display-line-numbers-mode t
display-line-numbers-type 'relative
projectile-project-search-path '("~/projects/software/" "~/writings/"))
(setq
org-id-link-to-org-use-id t
+file-templates-dir (expand-file-name "templates" doom-private-dir)
+wiki-directory "~/writings/wiki"
org-journal-dir "~/writings/journal"
org-journal-file-format "%F"
enable-local-variables "query"
image-use-external-converter t
org-startup-with-inline-images t)
(add-to-list 'org-modules 'org-habit)
(add-to-list 'org-modules 'org-checklist)
(defvar my/wiki-asset-directory-name "assets")
(defvar my/wiki-exercises-directory "challenges")
(defun my/create-assets-folder ()
"A quick convenient function to create an assets folder in the wiki folder."
(interactive)
(if (and (not (string= (f-base (buffer-file-name))
my/wiki-asset-directory-name))
(f-descendant-of-p (buffer-file-name)
(expand-file-name +wiki-directory)))
(f-mkdir my/wiki-asset-directory-name
(f-join my/wiki-asset-directory-name (file-name-sans-extension (buffer-file-name))))
(message "Not in the wiki directory.")))
(after! tex
(TeX-engine-set "luatex")
(add-to-list 'safe-local-variable-values
'(TeX-command-extra-options . "-shell-escape")))
(after! org
(setq
org-capture-templates `(
("i" "inbox" entry
(file ,(f-join org-directory "inbox.org"))
,(concat "* TODO %?\n"
"entered on %<%F %T %:z>"))
("p" "project" entry
(file ,(f-join org-directory "projects.org"))
,(concat "* PROJ %?\n"
"- [ ] %?"))
("c" "org-protocol-capture" entry
(file ,(f-join org-directory "inbox.org"))
"* TODO [[%:link][%:description]]\n%x"
:immediate-finish t))))
;; Custom keybindings
(map!
(:when (featurep! :tools wiki)
:leader
:prefix "nr" :desc "Create the asset folder" "m" #'my/create-assets-folder)
(:when (featurep! :editor format)
:n "g=" #'+format/buffer))
;; A workaround for electric-indent plugin.
;; See https://github.com/hlissner/doom-emacs/issues/3172 for more details.
(add-hook 'org-mode (lambda ()
(electric-indent-local-mode -1)))
;; Automate updating timestamps on save.
(add-hook! 'before-save-hook 'time-stamp)
;; Load a custom configuration for muh wiki.
(add-hook! 'counsel-projectile-mode-hook (lambda ()
(message (file-name-directory (buffer-file-name)))))
(load-file (f-join +wiki-directory "config.el"))
;;; config.el ends here

View File

@ -0,0 +1,191 @@
;;; init.el -*
;; This file controls what Doom modules are enabled and what order they load in.
;; Remember to run 'doom sync' after modifying it!
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find information about all of Doom's modules
;; and what flags they support.
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;; 'C-c g k' for non-vim users) to view its documentation. This works on
;; flags as well (those symbols that start with a plus).
;;
;; Alternatively, press 'gd' (or 'C-c g d') on a module to browse its
;; directory (for easy access to its source code).
(doom! :input
;;chinese
japanese
:completion
(company +childframe) ; the ultimate code completion backend
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
ivy ; a search engine for love and life
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
doom-quit ; DOOM quit-message prompts when you quit Emacs
;;fill-column ; a `fill-column' indicator
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra
indent-guides ; highlighted indent columns
modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink the current line after jumping
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
ligatures ; ligatures or substitute text with pretty symbols
;;tabs ; an tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
format ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
word-wrap ; soft wrapping with language-aware indent
:emacs
(dired +ranger) ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
;;spell ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
;;ansible
biblio
(debugger +lsp) ; FIXME stepping through code, to help you add bugs
direnv
;;docker
editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
(lookup
+dictionary
+offline) ; navigate your code and its documentation
lsp
;;macos ; MacOS-specific commands
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
rgb ; creating color strings
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
upload ; map local to remote projects via ssh/ftp
:lang
;;agda ; types of types of types of types...
assembly ; assembly for fun or debugging
(cc +lsp) ; C/C++/Obj-C madness
clojure ; java with a lisp
common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
csharp ; unity, .NET, and mono shenanigans
data ; config/data formats
(dart +flutter) ; paint ui and not much else
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
ess ; emacs speaks statistics
;;faust ; dsp, but you get to keep your soul
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
(gdscript +lsp) ; the language I waited for
;;(go +lsp) ; the hipster dialect
;;(haskell +dante) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ;
;;(java +meghanada) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
(latex +latexmk) ; writing papers in Emacs has never been so fun
;;lean
;;factor
;;ledger ; an accounting system in Emacs
lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
nim ; python + lisp at the speed of c
nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org +gnuplot
+hugo
+journal
+noter
+pandoc
+present) ; organize your plain life in plain text
raku ; write code no one else can comprehend
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
(python +lsp
+pyright
+cython) ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
racket ; a DSL for DSLs
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
scheme ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
:email
;;(mu4e +gmail)
;;notmuch
;;(wanderlust +gmail)
:app
;;calendar
;;irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
:config
;;literate
(default +bindings +smartparens)
:tools
(wiki +anki
+biblio
+graph))

View File

@ -0,0 +1,42 @@
#+title: tools/wiki
#+date: 2021-05-05 00:27:26 +08:00
#+date_modified: 2021-05-21 11:12:10 +08:00
#+language: en
* Description
This module set up my personal wiki configuration with Emacs primarily with org-roam.
Just like Emacs itself, tried my best to make it fully configurable.
The setup uses org-roam v2.
** Module flags
- ~+anki~ enables Anki cards editing with [[https://github.com/louietan/anki-editor/][anki-editor]].
- ~+biblio~ enables reference management with [[https://github.com/jkitchin/org-ref][org-ref]] and [[https://github.com/org-roam/org-roam-bibtex][org-roam-bibtex]].
- ~+dendron~ adds [[https://dendron.so/][Dendron]]-inspired features with [[https://github.com/vicrdguez/dendroam][dendroam]].
- ~+graph~ adds a graphical user interface for your notes.
- ~+markdown~ adds Markdown support in org-roam.
** Plugins
- [[https://github.com/org-roam/org-roam/][org-roam]] v2
- [[https://github.com/louietan/anki-editor/][anki-editor]]
- [[https://github.com/vicrdguez/dendroam][dendroam]]
- [[https://github.com/nobiot/md-roam][md-roam]]
- [[https://github.com/jkitchin/org-ref][org-ref]]
- [[https://github.com/org-roam/org-roam-bibtex][org-roam-bibtex]]
- [[https://github.com/org-roam/org-roam-ui][org-roam-ui]]
* Prerequisites
This module has a handful of requirements to work properly.
- SQLite v3 binary is installed in order for org-roam to work.
- The ~+anki~ feature requires Anki and the setup described from the [[https://github.com/louietan/anki-editor][project README]].

View File

@ -0,0 +1,91 @@
;;; tools/wiki/config.el --- The configuration for foo-dogsquared's wiki as a module.
;;; -*- lexical-binding: t; -*-
;;; Commentary:
;; My custom configuration for setting up my personal wiki.
;; Also a good opportunity for training my Elisp-fu.
(require 'f)
;; Code
(defvar +wiki-directory "~/wiki")
(defun +org-roam-split-to-random-node ()
"Open a split window sensibly for a random note."
; TODO: Create a window, open a random note, and that's it.
(interactive)
(split-window-sensibly)
(other-window 1)
(org-roam-node-random))
(when (featurep! +biblio)
(defvar +wiki-references-filename "references.bib")
(defvar +wiki-bibliography-note-filename "references.org")
(defvar +wiki-bibliography-file (f-join +wiki-directory +wiki-references-filename))
(defvar +wiki-bibliography-note (f-join +wiki-directory +wiki-bibliography-note-filename))
(defun +wiki/biblio-setup ()
"Setup the variables for the wiki config."
(setq +wiki-bibliography-file (f-join +wiki-directory +wiki-references-filename)
+wiki-bibliography-note (f-join +wiki-directory +wiki-bibliography-note-filename)
org-cite-global-bibliography `(,+wiki-bibliography-file)
org-ref-default-bibliography +wiki-bibliography-file
org-ref-bibliography-notes +wiki-bibliography-note
bibtex-completion-bibliography +wiki-bibliography-file
bibtex-completion-notes-path +wiki-directory))
(use-package! org-roam-bibtex
:after org-roam
:preface
:config
(require 'org-ref)
(+wiki/biblio-setup)))
(when (featurep! +anki)
(defvar +anki-cards-directory-name "cards")
(defvar +anki-cards-directory (f-join +wiki-directory +anki-cards-directory-name))
(defun +anki-editor-push-all-notes-to-anki ()
(interactive)
(anki-editor-push-notes nil nil (directory-files-recursively +anki-cards-directory "\\.*org" nil)))
(defun +anki-editor-reset-note ()
"Reset the Anki note in point by deleting the note ID and the deck."
(interactive)
(org-entry-delete (point) anki-editor-prop-note-id)
(org-entry-delete (point) anki-editor-prop-deck))
(defun +anki-editor-reset-all-notes ()
"Reset the Anki notes in the current buffer by deleting the note ID and the deck."
(interactive)
(anki-editor-map-note-entries #'+anki-editor-reset-note))
(use-package! anki-editor
:hook (org-mode . anki-editor-mode)
:preface
(defvar +wiki-directory nil)
:init
(map! :localleader
:map org-roam-mode-map
(:prefix ("C" . "Anki cards")
:desc "Push all cards in current document" :n "p" #'anki-editor-push-notes
:desc "Push all cards in cards directory to Anki" :n "P" #'+anki-editor-push-all-notes-to-anki
:desc "Retry to push failed cards" :n "r" #'anki-editor-retry-failure-notes
:desc "Insert a card in current document" :n "i" #'anki-editor-insert-note
:desc "Create a cloze region" :n "I" #'anki-editor-cloze-region
:desc "Export the subtree as HTML" :n "e" #'anki-editor-export-subtree-to-html
:desc "Remove all anki-editor-related properties in a card" :n "d" #'+anki-editor-reset-note
:desc "Remove all properties in all notes" :n "D" #'+anki-editor-reset-all-notes))
:config
(setq anki-editor-create-decks 't
+anki-cards-directory (f-join +wiki-directory +anki-cards-directory-name))))
(when (featurep! +dendron)
(use-package! dendroam
:after org-roam))
(when (featurep! +graph)
(use-package! websocket
:after org-roam)
(use-package! org-roam-ui
:after org-roam
:hook (org-roam . org-roam-ui-mode)))
;;; config.el ends here

View File

@ -0,0 +1,17 @@
;;; tools/wiki/doctor.el -*- lexical-binding: t; -*-
(unless (executable-find "sqlite3")
(warn! "Couldn't find SQLite executable."))
(unless (featurep! :lang org)
(warn! "Doom module ':lang org' is not enabled. This is a pointless addition to your configuration WTF"))
(when (featurep! :lang org +roam)
(warn! "org-roam v1 is installed. This module is primarily catered for org-roam v2."))
(when (featurep! +biblio)
(unless (executable-find "anystyle")
(warn! "Couldn't find AnyStyle CLI. The PDF scrapper from org-roam-bibtex will not work."))
(unless (featurep! :tools biblio)
(warn! "Doom module ':tools biblio' is not enabled. Completion functions will not work.")))

View File

@ -0,0 +1,32 @@
;; -*- no-byte-compile: t; -*-
;;; tools/wiki/packages.el
;; The main package for creating a wiki.
(package! org-roam
:recipe (:host github :repo "org-roam/org-roam"))
(when (featurep! +biblio)
(package! org-ref
:recipe (:host github :repo "jkitchin/org-ref"))
(package! org-roam-bibtex
:recipe (:host github :repo "org-roam/org-roam-bibtex")))
(when (featurep! +anki)
(package! anki-editor
:recipe (:host github
:repo "louietan/anki-editor")
:pin "546774a453ef4617b1bcb0d1626e415c67cc88df"))
(when (featurep! +markdown)
(package! md-roam
:recipe (:host github :repo "nobiot/md-roam" :branch "v2")))
(when (featurep! +dendron)
(package! dendroam
:recipe (:host github :repo "vicrdguez/dendroam")))
(when (featurep! +graph)
(package! simple-httpd)
(package! websocket)
(package! org-roam-ui
:recipe (:host github :repo "org-roam/org-roam-ui" :files ("*.el" "out"))))

View File

@ -0,0 +1,55 @@
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
;; To install a package with Doom you must declare them here, run 'doom sync' on
;; the command line, then restart Emacs for the changes to take effect.
;; Alternatively, use M-x doom/reload.
;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;(unpin! pinned-package)
;; ...or multiple packages
;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t)
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;(package! some-package)
;; To install a package directly from a particular repo, you'll need to specify
;; a `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format
;(package! another-package
; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;(package! this-package
; :recipe (:host github :repo "username/repo"
; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, for whatever reason,
;; you can do so here with the `:disable' property:
;(package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;(package! builtin-package :recipe (:nonrecursive t))
;(package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see raxod502/straight.el#279)
;(package! builtin-package :recipe (:branch "develop"))
;;;;;;;;;;;;
; PACKAGES ;
;;;;;;;;;;;;
;; Inline errors? Hoorah!
(package! flycheck-inline)

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Create a box
# key: box
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# --
┌${1:$(make-string (+ 2 (string-width yas-text)) ?\-)}┐
| $1 |
└${1:$(make-string (+ 2 (string-width yas-text)) ?\-)}┘

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Shorthand for e.g.
# key: copyright
# --
${1:Copyright © (format-time-string "%Y")} ${2:(user-full-name)} <`(user-mail-address)`>

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Shorthand for eg
# key: eg
# --
(e.g., $1) $0

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Em dash
# key: em
# --
— $0

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Shorthand for i.e. in parenthesis
# key: ie
# --
(i.e., $1) $0

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Print today's datetime in ISO format.
# key: now
# --
`(format-time-string "%F %T %:z")` $0

View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# contributor: Gabriel Arazas
# name: The ending signature useful for email.
# key: sign
# uuid: sign
# --
${1:Sincerely,}
${2:`user-full-name`}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Print today's date in ISO format.
# key: today
# --
`(format-time-string "%F")` $0

View File

@ -0,0 +1,25 @@
# -*- mode: snippet -*-
# name: Graph without considering integers
# key: agraph
# --
\begin{figure}[${1:ht}]
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel=${2:$x$},
ylabel=${3:$y$},
axis lines = middle,
grid=major,
axis equal=false,
tick style={very thick},
major tick style=thick,
minor tick num=2,
domain=${4:-10}:${5:10},$6
]
\addplot[samples=${7:$$(+ (string-to-number (or (yas-field-value 5) "0")) (string-to-number (or (yas-field-value 4) "0")))}, $8]{${9:x}\};
\end{axis}
\end{tikzpicture}
\caption{$10}
\label{fig!${11:$10}}
\end{figure}
`(yas-field-value 4)`

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Boldface text
# key: bf
# --
\textbf{$1}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: \equation
# key: eq
# --
\begin{equation}
\label{math!$1}
$2
\end{equation}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Italic text
# key: it
# --
\textit{$1}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: List item for lists
# key: li
# --
\item{$1}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: LaTeX math block
# key: mb
# --
\begin{equation*}
$1
\end{equation*}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Math inline block
# key: mi
# --
$$1$

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Ordered list
# key: ol
# --
\begin{enumerate}
$1
\end{enumerate}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: \section
# key: sec
# uuid: sec
# --
\section{$1}
\label{sect!$1}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: \subsection
# key: subsec
# uuid: subsec
# --
\subsection{$1}
\label{subsect!$1}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Teletype text
# key: tt
# --
\texttt{$1}

View File

@ -0,0 +1,72 @@
\documentclass[class=memoir, crop=false, oneside, 14pt]{standalone}
% all of the packages to be used
\usepackage[nocomments]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{fontawesome}
\usepackage[english]{babel}
\usepackage[rgb]{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{fancyhdr}
\usepackage{minted}
\usepackage[most]{tcolorbox}
\usepackage[colorlinks=true, linkcolor=., urlcolor=blue]{hyperref}
\usepackage{kpfonts}
% using the fancy header package
% http://linorg.usp.br/CTAN/macros/latex/contrib/fancyhdr/fancyhdr.pdf
\pagestyle{fancy}
% fill the header with the format
\fancyhead[L]{\doctitle}
\fancyhead[R]{\nouppercase{\rightmark}}
% fill the footer with the format
\fancyfoot[C]{\nouppercase{\leftmark}}
\fancyfoot[R]{\thepage}
% set the width of the horizontal bars in the header
\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{1pt}
% set the paragraph formatting
\renewcommand{\baselinestretch}{1.35}
% set chapter style
\chapterstyle{bianchi}
% set chapter spacing for easier reading on digital screen
\setlength{\beforechapskip}{-\beforechapskip}
% document metadata
\author{${1:"Gabriel Arazas"}}
\title{${2:"New Title"}}
\date{`!p
`}
\begin{document}
% Frontmatter of the class note if it's compiled standalone
\renewcommand{\abstractname}{Summary}
\maketitle
\newpage
\frontmatter
\chapter{Preface}
$3
\newpage
\tableofcontents
\newpage
\listoffigures
\newpage
\mainmatter
% Core content (HINT: always start with chapter LaTeX tag)
$0
\end{document}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Unordered list
# key: ul
# --
\begin{itemize}
$1
\end{itemize}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Org-Mode appendix block
# key: appendix
# --
:properties:
:appendix: t
:end:

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Org mode basic block
# key: begin
# --
#+begin_$1
$0
#+end_$1

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Org-Mode dynamic blocks
# key: block
# --
#+begin: ${1:<PARAMETERS>}
$2
#+end:

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Org-Mode boldface
# key: bf
# --
*$1* $0

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Org-Mode comment block
# key: comment
# --
#+begin_comment
$0
#+end_comment

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Org-Mode definition list
# key: dl
# --
- ${1:<TERM>} :: ${2:<DEFINITION>}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Org-Mode drawer
# key: drawer
# --
:${1:<DRAWERNAME>}:
$2
:END:

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Org-Mode footnotes
# key: foot
# --
[fn:: $1]

View File

@ -0,0 +1,13 @@
# -*- mode: snippet -*-
# name: Org-Mode header
# key: header
# --
`(let* ((headerlevel (cl-gcd (read-number "What is the header level?: ")))
(str ""))
(if (= headerlevel 1)
(setq str (concat str (s-repeat 4 "\n")))
(setq str (concat str (s-repeat 2 "\n"))))
(setq str (concat str (make-string headerlevel ?*)))
str)` ${1:<HEADER>}
$0

Some files were not shown because too many files have changed in this diff Show More