diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 5f4d5a09..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016-2021 Henrik Lissner.
-
-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.
diff --git a/README.md b/README.md
deleted file mode 100644
index f6041ecb..00000000
--- a/README.md
+++ /dev/null
@@ -1,128 +0,0 @@
-[![Made with Doom Emacs](https://img.shields.io/badge/Made_with-Doom_Emacs-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white)](https://github.com/hlissner/doom-emacs)
-[![NixOS Unstable](https://img.shields.io/badge/NixOS-unstable-blue.svg?style=flat-square&logo=NixOS&logoColor=white)](https://nixos.org)
-
-**Hey,** you. You're finally awake. You were trying to configure your OS declaratively, right? Walked right into that NixOS ambush, same as us, and those dotfiles over there.
-
-
-
-
-
-
-
-
-
-------
-
-| | |
-|-|-|
-| **Shell:** | zsh + zgen |
-| **DM:** | lightdm + lightdm-mini-greeter |
-| **WM:** | bspwm + polybar |
-| **Editor:** | [Doom Emacs][doom-emacs] (and occasionally [vim]) |
-| **Terminal:** | st |
-| **Launcher:** | rofi |
-| **Browser:** | firefox |
-| **GTK Theme:** | [Ant Dracula](https://github.com/EliverLara/Ant-Dracula) |
-
------
-
-## Quick start
-
-1. Yoink the latest build of [NixOS 21.05][nixos].
-2. Boot into the installer.
-3. Do your partitions and mount your root to `/mnt` ([for example](hosts/kuro/README.org))
-4. Install these dotfiles:
-5. `nix-shell -p git nixFlakes`
-6. `git clone https://github.com/hlissner/dotfiles /mnt/etc/nixos`
-7. Install NixOS: `nixos-install --root /mnt --flake /mnt/etc/nixos#XYZ`, where
- `XYZ` is [the host you want to install](hosts/). Use `#generic` for a
- simple, universal config, or create a sub-directory in `hosts/` for your device. See [host/kuro] for an example.
-8. Reboot!
-9. Change your `root` and `$USER` passwords!
-
-## Management
-
-And I say, `bin/hey`. [What's going on?](http://hemansings.com/)
-
-```
-Usage: hey [global-options] [command] [sub-options]
-
-Available Commands:
- check Run 'nix flake check' on your dotfiles
- gc Garbage collect & optimize nix store
- generations Explore, manage, diff across generations
- help [SUBCOMMAND] Show usage information for this script or a subcommand
- rebuild Rebuild the current system's flake
- repl Open a nix-repl with nixpkgs and dotfiles preloaded
- rollback Roll back to last generation
- search Search nixpkgs for a package
- show [ARGS...]
- ssh HOST [COMMAND] Run a bin/hey command on a remote NixOS system
- swap PATH [PATH...] Recursively swap nix-store symlinks with copies (or back).
- test Quickly rebuild, for quick iteration
- theme THEME_NAME Quickly swap to another theme module
- update [INPUT...] Update specific flakes or all of them
- upgrade Update all flakes and rebuild system
-
-Options:
- -d, --dryrun Don't change anything; preform dry run
- -D, --debug Show trace on nix errors
- -f, --flake URI Change target flake to URI
- -h, --help Display this help, or help for a specific command
- -i, -A, -q, -e, -p Forward to nix-env
-```
-
-## Frequently asked questions
-
-+ **Why NixOS?**
-
- Because declarative, generational, and immutable configuration is a godsend
- when you have a fleet of computers to manage.
-
-+ **How do you manage secrets?**
-
- With [agenix].
-
-+ **How do I change the default username?**
-
- 1. Set the `USER` environment variable the first time you run `nixos-install`:
- `USER=myusername nixos-install --root /mnt --flake /path/to/dotfiles#XYZ`
- 2. Or change `"hlissner"` in modules/options.nix.
-
-+ **Why did you write bin/hey?**
-
- I envy Guix's CLI and want similar for NixOS, but its toolchain is spread
- across many commands, none of which are as intuitive: `nix`,
- `nix-collect-garbage`, `nixos-rebuild`, `nix-env`, `nix-shell`.
-
- I don't claim `hey` is the answer, but everybody likes their own brew.
-
-+ **How 2 flakes?**
-
- Would it be the NixOS experience if I gave you all the answers in one,
- convenient place?
-
- No. Suffer my pain:
-
- + [A three-part tweag article that everyone's read.](https://www.tweag.io/blog/2020-05-25-flakes/)
- + [An overengineered config to scare off beginners.](https://github.com/nrdxp/nixflk)
- + [A minimalistic config for scared beginners.](https://github.com/colemickens/nixos-flake-example)
- + [A nixos wiki page that spells out the format of flake.nix.](https://nixos.wiki/wiki/Flakes)
- + [Official documentation that nobody reads.](https://nixos.org/learn.html)
- + [Some great videos on general nixOS tooling and hackery.](https://www.youtube.com/channel/UC-cY3DcYladGdFQWIKL90SQ)
- + A couple flake configs that I
- [may](https://github.com/LEXUGE/nixos)
- [have](https://github.com/bqv/nixrc)
- [shamelessly](https://git.sr.ht/~dunklecat/nixos-config/tree)
- [rummaged](https://github.com/utdemir/dotfiles)
- [through](https://github.com/purcell/dotfiles).
- + [Some notes about using Nix](https://github.com/justinwoo/nix-shorts)
- + [What helped me figure out generators (for npm, yarn, python and haskell)](https://myme.no/posts/2020-01-26-nixos-for-development.html)
- + [What y'all will need when Nix drives you to drink.](https://www.youtube.com/watch?v=Eni9PPPPBpg)
-
-
-[doom-emacs]: https://github.com/hlissner/doom-emacs
-[vim]: https://github.com/hlissner/.vim
-[nixos]: https://releases.nixos.org/?prefix=nixos/unstable/
-[host/kuro]: https://github.com/hlissner/dotfiles/tree/master/hosts/kuro
-[agenix]: https://github.com/ryantm/agenix
diff --git a/backup.nix b/backup.nix
new file mode 100644
index 00000000..8fa6f01c
--- /dev/null
+++ b/backup.nix
@@ -0,0 +1,34 @@
+{
+ # Assumes the remote borg backup server has already been initialized
+ # borg init --encryption-key=repokey-blake2 -rsh 'ssh -i /run/keys/id_ed25519_borgbase' 20779@hk-s020.rsync.net:
+ services.borgbackup.jobs = {
+ backupTaskwarriorRsync = {
+ paths = [ "/var/lib/taskserver" ];
+ doInit = true;
+ repo = "20779@hk-s020.rsync.net:taskwarrior" ;
+ encryption = {
+ mode = "repokey-blake2";
+ passCommand = "cat /run/keys/rsync";
+ };
+ environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
+ compression = "auto,lzma";
+ startAt = "weekly";
+ extraArgs = "--remote-path=borg1";
+ };
+ };
+ services.borgbackup.jobs = {
+ backupShaarliRsync = {
+ paths = [ "/var/www/shaarli-config/data/datastore.php" "/var/www/shaarli-config/config" "/var/www/shaarli-config/.json.config" ];
+ doInit = true;
+ repo = "20779@hk-s020.rsync.net:shaarli" ;
+ encryption = {
+ mode = "repokey-blake2";
+ passCommand = "cat /run/keys/rsync";
+ };
+ environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
+ compression = "auto,lzma";
+ startAt = "weekly";
+ extraArgs = "--remote-path=borg1";
+ };
+ };
+}
diff --git a/bin/autoclicker b/bin/autoclicker
deleted file mode 100755
index 7a39f10c..00000000
--- a/bin/autoclicker
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-
-while true; do
- xdotool mousedown 1
- sleep 0.01
- xdotool mouseup 1
- sleep 0.01
-done
diff --git a/bin/bspwm/focus b/bin/bspwm/focus
deleted file mode 100755
index af8b1fb2..00000000
--- a/bin/bspwm/focus
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env bash
-
-# Script: bspc-focus
-# Author: Henrik Lissner
-# Usage:
-# bspc-focus [-m] (west|south|north|east)
-# bspc-focus south
-# bspc-focus -m west
-#
-# Focus the next window in direction. If -m is supplied, jump to the next
-# monitor in that direction.
-#
-# The behavior of the base 'bspc node -f' is odd when crossing screens. It will
-# focus the last selected window on that screen, rather than the window on the
-# connecting edge, which is unintuitive.
-
-set -e
-
-leap=
-if [[ $1 == -m ]]; then
- leap=1; shift
-fi
-dir=$1
-opposite=
-
-case $dir in
- west) opposite=east ;;
- east) opposite=west ;;
- north) opposite=north ;;
- south) opposite=south ;;
- *) >&2 echo "Not a valid direction: $dir"
- exit 1
-esac
-
-if [[ -n $leap ]]; then
- # jump to monitor in direction
- bspc monitor -f "$dir"
-else
- # jump to window in direction (unless at edge of last monitor)
- if ! bspc node -f "$dir.local"; then
- if [[ $(bspc query -M -m "$dir") ]]; then
- bspc monitor -f "$dir"
- # Ensure we start at the edge of the window we arrived from
- while bspc node -f "$opposite.local"; do :; done
- fi
- fi
-fi
diff --git a/bin/bspwm/presel b/bin/bspwm/presel
deleted file mode 100755
index ecd5ffba..00000000
--- a/bin/bspwm/presel
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -i zsh -p jshon
-
-# Script: bspc-presel
-# Author: Henrik Lissner
-# Usage:
-# bspc-presel RATIO
-# bspc-presel 0.2
-#
-# Wrote this to invert the ratio on east/south-bound preselections. In English
-# that means bspc node -p 0.2 should resize the preselection to 20%, whether or
-# not it's on the west or east side of the window (or north or south side),
-# which isn't the case by default.
-#
-# NOTE: We use zsh for this because bash chokes on float arithmetic.
-
-ratio="$1"
-case "$(bspc query -T -n focused | jshon -e presel -e splitDir | tr -d \")" in
- west|north) bspc node -o $ratio ;;
- east|south) bspc node -o $(( 1.0 - ratio )) ;;
-esac
diff --git a/bin/bspwm/subtract-presel b/bin/bspwm/subtract-presel
deleted file mode 100755
index 4b44478a..00000000
--- a/bin/bspwm/subtract-presel
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -i zsh -p jshon wmutils-core
-
-# Script: bspc-subtract-presel
-# Author: Henrik Lissner (w/ credit to @Chrysostomus)
-# Usage:
-# bspc-resize-to-presel
-#
-# (Adapted from Chrysostomus/bspwm-scripts/bin/resizetopresel.sh)
-#
-# This script resizes the current window by "subtracting" the bspwm preselection
-# on the current node. In English, that means this will reduce the window's
-# width by 20%:
-#
-# bspc node -p east -o 0.2 && bspc-subtract-presel
-#
-# NOTE: We use zsh for this because bash chokes on float arithmetic.
-
-# Check if the brother node is a receptacle
-if [[ $(bspc query -T -n @brother/ | jshon -e client) = null ]]; then
- # Yep, it's a receptacle. Get the real dimensions
- eval $(grep "window_gap" ~/.config/bspwm/rc.d/theme | tr -cd [0-9])
- # Get orientation
- wattr xywh $(pfw) | read focused_x focused_y focused_width focused_height
- receptacle_y=$(bspc query -T -n @brother/ | jshon -e rectangle -e y)
- if [[ "$focused_y" -eq "$receptacle_y" ]]; then
- receptacle_width=$(bspc query -T -n @brother/ | jshon -e rectangle -e width)
- receptacle_x=$(bspc query -T -n @brother/ | jshon -e rectangle -e x)
- # receptacle and window have the same height, so they are side by side
- if [[ receptacle_x -gt focused_x ]]; then
- echo "receptacle is right of the window"
- # get the true window dimension
- true_dim=$(( receptacle_width + gap ))
- # kill the repectacle
- for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done
- # resize the window
- bspc node @east -r -$true_dim || bspc node @west -r +$true_dim
- else
- echo "receptacle is left of the window"
- # get the true window dimension
- true_dim=$(( receptacle_width + gap ))
- # kill the repectacle
- for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done
- # resize the window
- bspc node @west -r +$true_dim || bspc node @east -r -$true_dim
- fi
- else
- receptacle_height=$(bspc query -T -n @brother/ | jshon -e rectangle -e height)
- # width is necessarily equal if height is not, because the nodes are
- # brothers Window are on the top of each other
- if [[ receptacle_y -gt focused_y ]]; then
- echo "receptacle is below the window"
- # get the true window dimension
- true_dim=$(( receptacle_height + gap))
- # kill the repectacle
- for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done
- # resize the window
- bspc node @south -r -$true_dim || bspc node @north -r +$true_dim
- else
- echo "receptacle is above the window"
- # get the true window dimension
- true_dim=$(( receptacle_height + gap))
- # kill the repectacle
- for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done
- # resize the window
- bspc node @north -r +$true_dim || bspc node @south -r -$true_dim
- fi
- fi
- echo $true_dim
- exit 0
-fi
-
-# If the focused window is not preselected, do nothing
-[[ "$(bspc query -T -n focused | jshon -e presel)" == null ]] && exit 0
-
-dir=$(bspc query -T -n focused | jshon -e presel -e splitDir | tr -d \")
-ratio=$(bspc query -T -n focused | jshon -e presel -e splitRatio)
-case "$dir" in
- west)
- cur=$(bspc query -T -n focused | jshon -e rectangle -e width)
- bspc node @west -r +$((${cur}*${ratio})) || \
- bspc node @east -r -$((${cur}*${ratio}))
- ;;
- east)
- cur=$(bspc query -T -n focused | jshon -e rectangle -e width)
- bspc node @east -r -$((${cur}*(1.0-${ratio}))) || \
- bspc node @west -r +$((${cur}*${ratio}))
- ;;
-
- north)
- cur=$(bspc query -T -n focused | jshon -e rectangle -e height)
- bspc node @north -r +$((${cur}*${ratio})) || \
- bspc node @south -r -$((${cur}*${ratio}))
- ;;
- south)
- cur=$(bspc query -T -n focused | jshon -e rectangle -e height)
- bspc node @south -r -$(( ${cur} * (1.0 - ${ratio}) )) || \
- bspc node @north -r +$(( ${cur} * ${ratio} ))
-esac
-
-bspc node -p cancel
diff --git a/bin/bspwm/swap b/bin/bspwm/swap
deleted file mode 100755
index 8dd025f0..00000000
--- a/bin/bspwm/swap
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env bash
-
-# Script: bspc-swap
-# Author: Henrik Lissner
-# Usage:
-# bspc-swap [-m] (west|south|north|east)
-# bspc-swap south
-# bspc-swap -m west
-#
-# Swaps current window with the window in a direction. If -m is set, move window
-# to the next monitor in that direction.
-#
-# The behavior of the base 'bspc node -s' is odd when crossing screens. It will
-# swaps with the last selected window on that screen, rather than the window on
-# the connecting edge, which is unintuitive.
-
-set -e
-
-leap=
-if [[ $1 == -m ]]; then
- leap=1
- dir=$2
-else
- dir=$1
-fi
-
-case $dir in west|south|north|east) ;;
- *) >&2 echo "Not a valid direction: $dir"
- exit 1
-esac
-
-if [[ -n $leap ]]; then
- # move window to monitor in direction
- old_id=$(bspc query -N -n focused)
- if [[ $(bspc query -M -m "$dir") ]]; then
- bspc node -m "$dir"
- bspc node -f "$old_id"
- fi
-else
- # move window in direction
- old_id=$(bspc query -N -n focused)
- if bspc node -s "$dir.local"; then
- bspc node -f "$old_id"
- elif [[ -n $(bspc query -M -m "$dir") ]]; then
- bspc node -m "$dir"
- bspc node -f "$old_id"
- fi
-fi
diff --git a/bin/hey b/bin/hey
deleted file mode 100755
index 4d80aa42..00000000
--- a/bin/hey
+++ /dev/null
@@ -1,385 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -p ruby_2_7 -i "ruby -S" --quiet
-
-DESC = <<~DESC
- Nix's CLI has a poor user story, in my opinion. It could be better; Guix is a
- good role model here. I wrote this script to abstract the more common
- workflows, like rebuilding (nixos-rebuild), cleaning up (nix-collect-garbage),
- package/env management (nix-env), updating, rolling back, etc. As well as some
- utility operations (like managing generations, building remotely, or swapping
- themes on the fly).
-
- Because I can go months without shaving yaks in NixOS, exact flags or details
- are often and easily forgotten. This spares me that fumbling phase and also
- serves as a reference.
-
- Note: `hey` can also be used as a shortcut for nix-env:
-
- hey -q
- hey -iA nixos.htop
- hey -e htop
-DESC
-
-require 'shellwords'
-require 'optparse'
-
-module Hey
- extend self
- Command = Struct.new(:name, :desc, :args, :opts, :fn)
-
- @@opts = {}
- @@alias = {}
- @@commands = {}
- @@cli = nil
- def self.defcmd names, &block
- names = (names.kind_of?(Array) ? names : [names]).map(&:to_s)
- names.drop(1).each { |n| @@alias[n] = names.first }
- cli = Command.new names.first, [], []
- cli.opts = OptionParser.new do |opt|
- opt.banner = "Usage: #{opt.program_name} #{cli.name} [options]"
- opt.separator "\nOptions:"
- opt.on_tail('-h', '--help', 'Prints this help') { puts opt; exit }
- end
- @@cli = cli
- fn = block.call cli
- cli.fn = lambda do |args|
- begin
- cli.opts.banner +=
- (cli.args ? " #{cli.args.join ' '}" : "") +
- (cli.desc ? "\n\n#{cli.desc[0]}\n\n#{cli.desc[1..].join "\n"}" : "")
- cli.opts.order!(args, into: @@opts)
- fn.call args
- ensure @@cli = nil end
- end
- @@commands[cli.name] = @@cli
- end
- def self.opts(*args) @@cli.opts.on(*args) end
- def self.args(*args) @@cli.args = args end
- def self.desc(*args) @@cli.desc = args end
- def self.sh(args, sudo: false, noerror: false)
- raise ArgumentError unless args.kind_of?(Array)
- args.unshift('sudo') if sudo
- args.compact!
- if @@opts[:dryrun]
- print "#{args}\n"
- return true
- else
- result = system "#{args.shelljoin} 2>&1"
- exit($?.exitstatus) unless noerror or result
- return result
- end
- end
- def self.rebuild(*args, sudo: false, host: nil)
- host ||= ENV['HOST'] || `hostname`.rstrip
- sh ["nixos-rebuild",
- "--flake", "#{@@opts[:flake]}##{host}",
- "--option", "pure-eval", "no",
- *args], sudo: sudo
- end
-
- #
- defcmd :repl do
- desc "Open a nix-repl with nixpkgs and dotfiles preloaded"
- lambda do |args|
- tempfile = '/tmp/dotfiles-repl.nix'
- File.write('/tmp/dotfiles-repl.nix', "(builtins.getFlake \"#{@@opts[:flake]}\")")
- begin
- sh ["nix", "repl", "", tempfile, *args]
- ensure
- File.delete tempfile
- end
- end
- end
-
- defcmd [:check, :ch] do
- desc "Run 'nix flake check' on your dotfiles"
- lambda do |args|
- sh ["nix", "flake", "check", @@opts[:flake]]
- end
- end
-
- defcmd :show do
- desc "[ARGS...]", "Run 'nix flake show' on your dotfiles"
- lambda do |args|
- sh ["nix", "flake", "show", @@opts[:flake]]
- end
- end
-
- defcmd :theme do
- desc 'Quickly swap to another theme module'
- args "THEME_NAME"
- lambda do |args|
- ENV["THEME"] = args.shift
- rebuild "--fast", "test"
- end
- end
-
- defcmd [:test, :t] do
- desc "Quickly rebuild, for quick iteration"
- lambda do |args|
- rebuild "--fast", "test", *args
- end
- end
-
- defcmd [:rebuild, :re] do
- desc "Rebuild the current system's flake"
- opts '--build-host HOST', "Where to build the flake"
- opts '--target-host HOST', "Where to deploy the built derivations"
- opts '--host HOST', "The target nixosConfiguration to build"
- opts '--user', "Rebuild as user, rather than root"
- opts '--fast', "Equivalent to --no-build-nix --show-trace for quick rebuilding"
- lambda do |args|
- Dir.chdir(@@opts[:flake]) do
- args = ["switch"] unless args.length > 0
- rebuild(*(@@opts[:"build-host"] ? ["--build-host", @@opts[:"build-host"]] : []),
- *(@@opts[:"target-host"] ? ["--target-host", @@opts[:"target-host"]] : []),
- @@opts[:fast] ? "--fast" : nil,
- @@opts[:debug] ? "--show-trace" : nil,
- *args,
- sudo: !@@opts[:user],
- host: @@opts[:host])
- end
- end
- end
-
- defcmd :rollback do
- desc "Roll back to last generation"
- lambda do |_args|
- rebuild "--rollback", "switch"
- end
- end
-
- defcmd [:update, :u] do
- desc "Update specific flakes or all of them"
- args "[INPUT...]"
- lambda do |args|
- if args.empty?
- puts "Updating all flakes.."
- sh ["nix", "flake", "update", @@opts[:flake]]
- else
- puts "Trying to update flakes: #{args.join ' '}"
- sh ["nix", "flake", "lock"]
- .concat(args.map { |f| [ "--update-input", f ]}.flatten)
- .concat([@@opts[:flake]])
- end
- end
- end
-
- defcmd [:upgrade, :up] do
- desc "Update all flakes and rebuild system"
- lambda do |_args|
- update
- rebuild :switch
- end
- end
-
- defcmd [:search, :s] do
- desc "Search nixpkgs for a package"
- lambda do |args|
- sh ["nix", "search", "nixpkgs", *args]
- end
- end
-
- defcmd :swap do
- desc "Recursively swap nix-store symlinks with copies (or back).",
- "The purpose is so you can have copies of your dotfiles that can be modified in",
- "place (so you can iterate on them quickly instead of 'hey re'ing between",
- "changes). Run again to restore the old link(s).\n",
- "Warning: backup your copies, or they will be destroyed when restored!"
- args "PATH", "[PATH...]"
- lambda do |args|
- for target in args
- if File.directory? target
- files = Dir.glob("#{target}/**/*.nix-store-backup")
- if files.length > 0
- puts "There are swapped files here. Unswapping!"
- call :swap, *files
- else
- puts "Swapping files in #{target}"
- call :swap, *(Dir.glob("#{target}/**/*")
- .select { |f| File.symlink? f }
- .select { |l| File.readlink(l).match '^/nix/store/' })
- end
- elsif File.file? "#{target}.nix-store-backup"
- puts "Unswapping #{target}"
- sh [:mv, '-i', "#{target}.nix-store-backup", target]
- elsif File.file? target
- puts "Swapping #{target}"
- sh [:mv, target, "#{target}.nix-store-backup"]
- sh [:cp, "#{target}.nix-store-backup", target]
- else
- puts "Not a valid target: #{target}"
- exit 1
- end
- end
- end
- end
-
- defcmd :gc do
- desc "Garbage collect & optimize nix store"
- opts "-a", "--all", "GC both the user and system profiles"
- opts "-s", "--system", "Only GC the system profile"
- lambda do |_args|
- if @@opts[:all] or @@opts[:system]
- puts "Cleaning up your system profile..."
- sh %w{nix-collect-garbage -d}, sudo: true
- sh %w{nix-store --optimise}, sudo: true
- # Clear out left-over secrets. The switch-to-configuration call below will
- # regenerate them.
- if File.exists?("/run/secrets/*")
- sh %w{rm -rf /run/secrets/*}, sudo: true
- end
- # nix-collect-garbage is a Nix tool, not a NixOS tool. It won't delete old
- # boot entries until you do a nixos-rebuild (which means we'll always have
- # 2 boot entries at any time). Instead, we properly delete them by
- # reloading the current environment.
- sh %w{nix-env --delete-generations old --profile /nix/var/nix/profiles/system}, sudo: true
- sh %w{/nix/var/nix/profiles/system/bin/switch-to-configuration switch}, sudo: true
- end
- if @@opts[:all] or not @@opts[:system]
- puts "Cleaning up your user profile..."
- sh %w{nix-collect-garbage -d}
- end
- end
- end
-
- defcmd :ssh do
- desc "Run a bin/hey command on a remote NixOS system",
- "If COMMAND is one of switch, test, or boot (if omitted, 'test' is assumed),",
- "that host's config is built locally and then copied to the remote over ssh.",
- "This will prompt you for your root password, as it temporarily opens root ssh",
- "access (via your existing ssh key) to the remote -- which is immediately removed",
- "upon completion.",
- "",
- "If COMMAND is anything else, it merely runs 'nix run github:hlissner/dotfiles",
- "-- COMMAND' on the rmeote."
- args "HOST", "[COMMAND]"
- opts '--host HOST', "The nixos config to build and deploy to HOST"
- lambda do |args|
- target, command = args.take(2)
- command ||= "test"
- if command.match(/switch|test|boot/)
- puts "Enabling root ssh access on #{target}. Enter root password for remote system:"
- if sh ["ssh", "-t", target,
- "sudo mkdir -p /root/.ssh && sudo cp -f ~/.ssh/authorized_keys /root/.ssh/"],
- noerror: true
- begin
- puts "Building #{@@opts[:flake]}##{@@opts[:host] || target} for #{target}"
- call "rebuild", ["--user",
- "--host", @@opts[:host] || target,
- "--build-host", "localhost",
- "--target-host", "root@#{target}",
- command]
- ensure
- puts "Undoing root ssh access on #{target}"
- sh ["ssh", "-t", "root@#{target}", "rm -f /root/.ssh/authorized_keys"]
- end
- end
- else
- command = "nix run github:hlissner/dotfiles -- #{command}"
- puts "Running '#{command}' on #{target}"
- sh ["ssh", "-t", target, command]
- end
- end
- end
-
- # TODO Generalize this to nix profiles
- defcmd [:generations, :gen] do
- desc "Explore, manage, diff across generations"
- opts '--diff FROM TO', "Diff profiles FROM with TO (numbers)"
- opts '-r', '--remove PROFILE', "Delete PROFILE from history"
- lambda do |args|
- profile = "/nix/var/nix/profiles/system"
- case args.shift
- when "diff"
- from, to = *args
- if from == to
- puts "Comparing the same profile! Aborting..."
- exit 1
- elsif [from, to].compact.select do |gen|
- File.exists? "#{profile}-#{gen}-link" or
- puts "Generation #{gen} does not exist!"
- end.length != [from, to].compact.length
- exit 2
- end
- from = from ? "#{profile}-#{from}-link" : profile
- to = to ? "#{profile}-#{to}-link" : profile
- fromDevs = `nix-store -q --references #{from}`.split
- toDevs = `nix-store -q --references #{to}`.split
- puts (fromDevs - toDevs).map { |d| "\e[31m-#{d}\e[0m" }
- puts (toDevs - fromDevs).map { |d| "\e[32m+#{d}\e[0m" }
- when /ls|list/
- sh ["nix-env", "--list-generations", "--profile", profile], sudo: true
- when "remove"
- sh ["nix-env", "--delete-generations", "--profile", profile, *args], sudo: true
- when "switch"
- puts "Targeted rollback not supported yet" # TODO Is this true?
- exit 1
- end
- end
- end
-
- class UsageError < StandardError; end
- defcmd [:help, :h] do
- desc "Show usage information for this script or a subcommand"
- args "[SUBCOMMAND]"
- lambda do |args|
- raise UsageError unless args.first
- call args.first, ["-h", *args.drop(1)]
- end
- end
-
- #
- def self.call command, args
- cmd = command.to_s
- cmd = @@alias[cmd] while cmd and not @@commands.key?(cmd)
- if cmd
- @@commands[cmd].fn.call args
- elsif command
- puts "Couldn't recognize command '#{command}'"
- exit 1
- else
- raise UsageError
- end
- end
-
- def self.run args=[]
- opts = OptionParser.new do |opt|
- opt.banner = "Usage: hey [global-options] [command] [sub-options]\n\n" + DESC
- opt.separator "\n\nAvailable Commands:"
- opt.separator (@@commands.values
- .reject { |c| c.desc.empty? }
- .sort { |a,b| a.name <=> b.name }
- .map { |c| " %-22s %s\n" % ["#{c.name} #{c.args.join ' '}",
- c.desc[0]]})
- opt.separator "\nOptions:"
- opt.on '-d', '--dryrun', "Don't change anything; preform dry run"
- opt.on '-D', '--debug', "Show trace on nix errors"
- opt.on '-f', '--flake URI', "Change target flake to URI"
- opt.on '-h', '--help', "Display this help, or help for a specific command"
- opt.on(*%w{-i -A -q -e -p}, "Forward to nix-env") { sh ["nix-env", *ARGV]; exit }
- end
- opts.order!(args, into: @@opts)
- if @@opts[:flake] and @@opts[:flake].include? "#"
- @@opts[:flake], @@opts[:host] = @@opts[:flake].split '#'
- end
- if not @@opts[:flake] or @@opts[:flake].empty?
- @@opts[:flake] = File.expand_path('../', File.dirname(__FILE__))
- end
-
- begin
- args.unshift("help") if @@opts[:help]
- if args.length == 0
- puts "Error: No command specified!"
- puts
- raise UsageError
- else
- call args.first, args.drop(1)
- end
- rescue UsageError
- puts opts
- end
- end
-end
-
-Hey.run ARGV.dup
diff --git a/bin/mov2gif b/bin/mov2gif
deleted file mode 100755
index 5b0bad4f..00000000
--- a/bin/mov2gif
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -i bash -p ffmpeg gifsicle
-
-# Uses ffmpeg to convert a video file to a gif file. Optimizes the final result
-# with gifsicle.
-#
-# Requires: ffmpeg gifsicle
-#
-# Example:
-# mov2gif some-vid.mp4 output.gif
-# mov2gif -f 10 -s 00:00:10 -t 00:00:05 some-vid.mp4 output.gif
-
-set -e
-PALETTE="/tmp/palette.png"
-
-usage() {
- cat <&2 echo "$OPTARG requires an argument"
- usage
- exit 1
- ;;
- *) >&2 echo "Not a valid arg: $opt"
- usage
- exit 1
- ;;
- esac
-done
-shift $((OPTIND-1))
-
-#
-if (($# == 0)); then
- >&2 echo "No movie file specified"
- exit
-elif [[ ! -f $1 ]]; then
- >&2 echo "$1 does not exist"
- exit
-fi
-
-src="$1"
-dest="${2:-${src%.*}.gif}"
-flags="fps=${fps}$scale"
-
-# stats_mode=full favors motion, causing the resulting palette to better
-# accomodate fades and transitions.
-ffmpeg -v warning $start $duration -i "file:$src" -vf "$flags,palettegen=stats_mode=full" -y "$PALETTE"
-ffmpeg -v warning $start $duration -i "file:$src" -i "$PALETTE" -lavfi "$flags [x]; [x][1:v] paletteuse" -y "$dest"
-
-gifsicle -O3 "$dest" -o "$dest"
diff --git a/bin/myip b/bin/myip
deleted file mode 100755
index 0ac81c6f..00000000
--- a/bin/myip
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env zsh
-# Echos your local or WAN IP
-
-if [[ $1 == -w ]]; then
- wan=1
- shift
-fi
-
-if [[ -n $wan ]]; then
- dig +short myip.opendns.com @resolver1.opendns.com
-else
- IF=$(netstat -rn | awk '/^0.0.0.0/ {thif=substr($0,74,10); print thif;} /^default.*UG/ {thif=substr($0,65,10); print thif;}')
- if command -v ifconfig >/dev/null; then
- ifconfig ${NET_IF} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
- elif command -v ip >/dev/null; then
- ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'
- else
- >&2 echo "No easy way to grab your IP"
- exit 1
- fi
-fi
diff --git a/bin/optimimg b/bin/optimimg
deleted file mode 100755
index 03bf63a0..00000000
--- a/bin/optimimg
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env zsh
-
-# Optimize image files (losslessly by default)
-#
-# Examples:
-# imgoptim image.jpg image.png image.gif
-# imgoptim directory_of_images/
-# imgoptim directory_of_images/*.png
-#
-# Requires:
-# PNGs: optipng, pngquant (lossy)
-# JPGs: jpegtran, jpegoptim (lossy)
-# GIFs: gifsicle
-#
-# Packages (same name on homebrew & arch linux)
-# optipng [pngquant] libjpeg-turbo [jpegoptim] gifsicle
-
-set -e
-unset CDPATH
-
-_usage() {
- cat <&2 echo "$OPTARG requires an argument"; _usage; exit 1;;
- *) >&2 echo "Not a valid arg: $opt"; _usage; exit 1;;
- esac
-done
-shift $((OPTIND-1))
-
-cmds=( optipng jpegtran gifsicle )
-[[ -n $lossy ]] && cmds=( $cmds pngquant jpegoptim )
-for cmd in ${cmds[@]}; do
- if ! command -v $cmd >/dev/null; then
- >&2 echo "$cmd isn't installed"
- error=1
- fi
-done
-if [[ -n $error ]]; then
- >&2 echo "There were errors, aborting"
- exit 1
-fi
-
-for file in $@; do
- if [[ -d $file ]]; then
- imgoptim $file/*
- elif [[ -f $file ]]; then
- pre_size=$(_filesize "$file")
- case ${file##*.} in
- png)
- [[ -n $lossy ]] && pngquant $file
- optipng -nc -nb -o7 $file
- ;;
- gif)
- gifsicle --batch --optimize=3 "$file"
- ;;
- jpg|jpeg)
- [[ -n $lossy ]] && jpegoptim --max=90 "$file"
- jpegtran -copy none -optimize -progressive -outfile "$file" "$file"
- ;;
- *)
- printf "Unrecognized file '$file': ignored"
- ;;
- esac
- post_size=$(_filesize "$file")
- perc=$(echo "((${pre_size} - ${post_size}) / ${pre_size}) * 100" | bc -l)
- printf "* %s: %d => %d (%.2f%% reduction)\n" "$file" "${pre_size}" "${post_size}" "$perc"
- fi
-done
diff --git a/bin/optimpdf b/bin/optimpdf
deleted file mode 100755
index 167e90ba..00000000
--- a/bin/optimpdf
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-
-# Compress pdf files using ghostscript.
-#
-# Defaults to 72 dpi.
-#
-# Usage:
-# pdfoptim SRC [TARGET] [DPI]
-#
-# Requires: ghostscript (gs)
-
-optimize() {
- # Adapted from Alfred Klomp's shrinkpdf script
- #
- gs -q -dNOPAUSE -dBATCH -dSAFER \
- -sDEVICE=pdfwrite \
- -dPDFSETTINGS=/screen \
- -dCompatibilityLevel=1.3 \
- -dEmbedAllFonts=true \
- -dSubsetFonts=true \
- -dAutoRotatePages=/None \
- -dMonoImageResolution=$3 \
- -dMonoImageDownsampleType=/Bicubic \
- -dGrayImageResolution=$3 \
- -dGrayImageDownsampleType=/Bicubic \
- -dColorImageResolution=$3 \
- -dColorImageDownsampleType=/Bicubic \
- -sOutputFile="$2" \
- "$1"
-}
-
-src="$1"
-dest="${2:--}"
-dpi="${3:-72}"
-
-optimize "$src" "$dest" "$dpi" || exit $?
diff --git a/bin/rofi/appmenu b/bin/rofi/appmenu
deleted file mode 100755
index 3156c692..00000000
--- a/bin/rofi/appmenu
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env sh
-rofi -show drun \
- -modi drun,run \
- -show-icons \
- -theme theme/appmenu.rasi
diff --git a/bin/rofi/browsermenu b/bin/rofi/browsermenu
deleted file mode 100755
index cdb42e28..00000000
--- a/bin/rofi/browsermenu
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -p ruby_2_7 rubyPackages_2_7.sqlite3 -i "ruby -S" --quiet
-
-# Open your browser bookmarks or history in your default browser. Currently
-# works with Firefox, Brave, and qutebrowser.
-
-require 'shellwords'
-require 'sqlite3'
-require 'json'
-require 'fileutils'
-require 'cgi'
-
-def rofi items, *args
- cmd = [*%w{rofi -dmenu -theme theme/bookmarkmenu.rasi -markup-rows -multi-select -p browser -i}, *args]
- IO.popen(cmd.compact.shelljoin, "r+") do |pipe|
- pipe.puts items.keys.join "\n"
- pipe.close_write
- (pipe.gets || "").split "\n"
- end
-end
-
-def db file, command
- copy = "/tmp/browsermenu-db-#{File.basename(file)}"
- begin
- # Copy the sqlite database because history/bookmark info is usually small
- # and may be locked by an open browser.
- unless File.exists? copy
- FileUtils.cp file, copy
- FileUtils.chmod 0400, copy, verbose: true
- end
- results = []
- db = SQLite3::Database.open copy
- db.execute(command).each { |r| results.push r }
- results
- ensure
- File.delete copy
- end
-end
-
-def walk_json children
- result = []
- for c in children
- if c['children']
- result += walk_json c['children']
- else
- result.push [ c['name'], c['url'] ]
- end
- end
- result
-end
-
-def get_bookmarks browser
- bookmarks = []
- case browser
- when :firefox
- # In my nixos dotfiles I hardcode the default profile to $USER.profile,
- # which makes this lookup easier, but means this script won't work on any
- # other system.
- user = ENV['USER']
- ["#{ENV['HOME']}/.mozilla/firefox/#{user}.default",
- "#{ENV['XDG_CONFIG_HOME']}/firefox/.mozilla/firefox/#{user}.default",
- "#{ENV['XDG_DATA_HOME']}/mozilla/firefox/#{user}.default"].each do |dir|
- if Dir.exists? dir
- db "#{dir}/places.sqlite",
- ["SELECT DISTINCT mb.title, mp.url FROM moz_bookmarks mb",
- "INNER JOIN moz_places mp ON mp.id = mb.fk",
- "WHERE mb.type = 1 AND mb.title IS NOT NULL",
- "ORDER BY mp.frecency DESC",
- "LIMIT 200"].join(' ')
- end
- end
- when :brave
- f = File.read "#{ENV['XDG_CONFIG_HOME']}/BraveSoftware/Brave-Browser/Default/Bookmarks"
- data = JSON.parse f
- walk_json data["roots"]["bookmark_bar"]["children"]
- when :qutebrowser
- bookmarks = File.readlines "#{ENV['XDG_CONFIG_HOME']}/qutebrowser/bookmarks/urls"
- bookmarks.map { |s| s.strip.split(' ', 2).reverse }
- end
-end
-
-def get_history browser
- case browser
- when :firefox
- # In my nixos dotfiles I hardcode the default profile to $USER.profile,
- # which makes this lookup easier, but means this script won't work on any
- # other system.
- user = ENV['USER']
- ["#{ENV['HOME']}/.mozilla/firefox/#{user}.default",
- "#{ENV['XDG_CONFIG_HOME']}/firefox/.mozilla/firefox/#{user}.default",
- "#{ENV['XDG_DATA_HOME']}/mozilla/firefox/#{user}.default"].each do |dir|
- if Dir.exists? dir
- return db "#{dir}/places.sqlite",
- ["SELECT title, url",
- "FROM moz_places",
- "WHERE title<>''",
- "ORDER BY last_visit_date DESC"].join(' ')
- end
- end
- return []
- when :brave
- db "#{ENV['XDG_CONFIG_HOME']}/BraveSoftware/Brave-Browser/Default/History",
- "SELECT title, url FROM urls GROUP BY url ORDER BY last_visit_time DESC LIMIT 200"
- when :qutebrowser
- db "#{ENV['XDG_DATA_HOME']}/qutebrowser/history.sqlite",
- ["SELECT title, url FROM History",
- "WHERE title != ''",
- "GROUP BY url",
- "ORDER BY atime DESC"].join(' ')
- end
-end
-
-def list urls
- items = urls.map do |x|
- x.map! { |x| CGI.escapeHTML x }
- [x[0].empty? ?
- "#{x[1]}" :
- "#{x[0]} #{x[1]}",
- x[1]]
- end.to_h
- selected = rofi items
- selected.map { |key| items[key] }
-end
-
-type, browser = *ARGV
-browser = (browser || ENV['BROWSER']).to_sym
-urls = if type == 'history'
- get_history browser
-else
- get_bookmarks browser
-end
-urls = list urls
-if urls.empty?
- puts "No URL selected. Aborting..."
- exit 1
-end
-Process.detach fork { exec ENV['BROWSER'], *urls }
diff --git a/bin/rofi/bwmenu b/bin/rofi/bwmenu
deleted file mode 100755
index b43cb375..00000000
--- a/bin/rofi/bwmenu
+++ /dev/null
@@ -1,260 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -p ruby_2_7 -i "ruby -S"
-
-# A rofi client for vaultwarden. Similar to passmenu, but uses rofi. (Badly)
-# written in ruby because data persistence and frontend logic would be a pain to
-# write in bash or zsh. I'll refactor this later perhaps. Maybe.
-
-require 'shellwords'
-require 'json'
-require 'optparse'
-require 'uri'
-require 'base64'
-require 'fileutils'
-
-PersistentData = Struct.new(:path, :ttl, :pid, :data) do
- DATADIR = "#{ENV['XDG_DATA_HOME']}/bwmenu"
-
- def self.load name, ttl: nil
- path = "#{DATADIR}/#{name}"
- data = JSON::load(Base64.decode64(File.read(path))) if File.exists?(path)
- d = PersistentData.new *(data || {}).values
- d.path = path
- d.ttl = ttl
- d
- end
-
- def expire
- File.delete(self.path) if File.exists?(self.path)
- end
-
- def save data = nil, onfinish = nil
- self.data = data if data
- FileUtils.mkdir_p DATADIR unless File.directory?(DATADIR)
- File.open(self.path, 'w') do |f|
- f.chmod 0600
- f.write Base64.encode64(self.to_h.to_json)
- end
- if self.pid and system("ps -f p #{self.pid}")
- Process.kill self.pid
- end
- if self.ttl
- self.pid = fork do
- Signal.trap('TERM') { throw :terminate }
- catch :terminate do
- sleep self.ttl
- end
- onfinish.call(self, data) if onfinish.respond_to? :call
- self.expire
- end
- end
- end
-end
-
-module BW
- extend self
-
- EXE = {}
- def self.bin exe
- EXE[exe] = `which #{exe} 2>/dev/null`.rstrip unless EXE[exe]
- raise "Couldn't find #{exe} in PATH" if EXE[exe].empty?
- EXE[exe]
- end
-
- def self.sh *args, input: nil, sudo: false, nooutput: false
- exe, *args = args.flatten.compact.map(&:to_s)
- bin exe
- cmd = [sudo ? "sudo" : nil, exe, *args.shelljoin].compact.join(' ')
- $stderr.puts "$ #{cmd}"
- if input
- IO.popen(cmd, "r+") do |pipe|
- pipe.puts input
- pipe.close_write
- (pipe.gets || "").rstrip unless nooutput
- end
- else
- (`#{cmd}` || "").rstrip
- end
- end
-
- def self.rofi items, *args
- input = items.keys.join("\n") if items
- result = sh(['rofi', '-dmenu', '-markup-rows',
- '-theme', 'theme/passmenu.rasi',
- *args],
- input: input)
- if items
- items[result]
- else
- result
- end
- end
-
- def self.notify message, title: nil, urgency: "normal"
- sh 'notify-send', '-u', urgency, '-a', "Vaultwarden", *[title, message].compact
- end
-
- def self.error message
- $stderr.puts message
- notify message, urgency: 'low'
- exit 1
- end
-
- def self.bw *args
- sh [:bw, '--session', @@session_id, *args]
- end
-
- def self.xclip *args, **opts
- sh :xclip, '-selection', 'clipboard', *args, **opts
- end
-
- @@session = nil
- @@session_id = nil
- def self.run argv
- opts = {}
- OptionParser.new do |opt|
- opt.banner = "Usage: bwmenu [options] [URL]"
- opt.on '--autolock TTL', "How long to keep the vault open"
- opt.on '--autoclear TTL' "How long to keep secrets in the clipboard"
- opt.on '--debug', "Be more verbose"
- opt.on '-f', '--field FIELD', "Extract specific field from selected entry; accepts 'whole' for whole entry"
- opt.on '-o', '--output', "Write output to stdout rather than the clipboard"
- opt.on '--select', "Select first entry"
- opt.on '--select-if-only', "Select first entry if only entry"
- opt.on '--default ID', "Highlight item with ID by default"
- opt.on '-r', "Resume where you last left off"
- end.parse! argv, into: opts
-
- clipboard_ttl = opts[:autoclear] || 20
- vault_ttl = opts[:autolock] || 900
-
- @@session = PersistentData.load :session, ttl: vault_ttl
- if @@session.data
- sid, data = @@session.data
- @@session_id = sid
- else
- pass = rofi nil, %w{-p Master\ Password -password -lines 0}
- error "No password given. Aborting..." if pass.empty?
- sid = sh [:bw, :unlock, '--raw', pass]
- error "Failed to unlock vault. Aborting..." unless $?.success?
- @@session_id = sid
- data = JSON.parse(bw(:list, :items))
- @@session.save [sid, data]
- end
- raise "No session ID" unless @@session_id
-
- last = PersistentData.load :last_id
- last_id, last_field = last.data if last
- if opts[:r] and last_id.data
- selected = data.find { |u| u['id'] == last_id }
- else
- select_type = opts[:"select-if-only"] ? :if_only : opts[:select]
- selected = list_items data, argv.first,
- default: opts[:default],
- select: select_type
- end
-
- begin
- error "Nothing selected. Aborting..." if selected.empty?
- last_id = selected['id']
- item = show_item selected, field: opts[:field]
- if not item
- error "Nothing selected. Aborting..." if selected.empty?
- elsif item.respond_to? :call
- item.call
- elsif opts[:output]
- puts item.rstrip
- else
- notify "Copied to clipboard for #{clipboard_ttl} seconds"
- xclip '-in', input: item.rstrip, nooutput: true
- clipboard = PersistentData.load :clipboard, ttl: clipboard_ttl
- clipboard.save(
- item.rstrip,
- lambda { |_, data| xclip('-in', '/dev/null') if item.rstrip == xclip('-out') }
- )
- end
- ensure
- last.save [ last_id, last_field ]
- end
- end
-
- #
- def list_items data, query = nil, default: nil, select: false
- rofiData = {}
- rofiData["Sync Vault"] = lambda { notify "Sync vault", bw(:sync) },
- rofiData["Open Vault in Browser"] = lambda { sh ENV['BROWSER'], bw(:config, :server) }
- data = data.map do |i|
- default_id = i['id'] if i['id'] == default
- icon = ["", "", "", ""][i['type'] - 1]
- case i['type']
- when 1 # logins
- urls = (i['login']['uris'] || []).filter_map do |u|
- return unless u['uri']
- uri = URI(u['uri'])
- not i['name'].include?((uri.hostname || uri.path).downcase) and
- uri.hostname || uri.path
- end
- subtitle = urls.join ", " if i['type'] == 1
- subtitle = " (#{subtitle})" unless urls.empty?
- when 2 # secure notes
- when 3 # cards
- subtitle = " (#{i['card']['brand'].downcase})"
- when 4 # identities
- end
- ["#{icon} #{i['name']}#{subtitle}", i]
- end
- case select
- when :if_only
- return data[0][1] if data.length == 1
- when true
- return data[0][1]
- end
- rofi rofiData.merge(data.to_h), '-p', 'Vaultwarden', '-filter', (query || "")
- end
-
- def show_item item, field: nil
- return item.to_json if field == 'whole'
- preamble = {}
- data = {}
- case item['type']
- when 1 # logins
- url = item['login']['uris'][0]['uri']
- preamble[" Launch #{url}"] = lambda { sh ENV['BROWSER'], url }
- data['Username'] = item['login']['username']
- data['Password'] = item['login']['password']
- data['TOTP'] = bw :get, :totp, url if item['login']['totp']
- return (data[field.capitalize] || item[field]) if field
- when 2 # secure notes
- data['Notes'] = item['notes']
- return item[field] if field
- when 3 # cards
- cardInfo = item['card']
- data['Card Type'] = cardInfo['brand']
- data['Card Name'] = cardInfo['cardholderName']
- data['Card Number'] = cardInfo['number']
- data['Expiry Date'] = "#{cardInfo['expMonth']}/#{cardInfo['expYear']}"
- data['Security Code'] = cardInfo['code']
- return cardInfo[field] if field
- when 4 # identities
- item['identity'].each { |k,v| data[k] = v if v }
- return item['identity'][field] if field
- end
- (item['fields'] || []).each do |field|
- data[field['name']] = field['value']
- end
- maxLength = data.keys.map(&:length).max + 5
- rofiData = {}
- preamble.merge(data).each do |label, value|
- if value.kind_of? String
- valueLabel = value
- valueLabel = value.gsub /./, '*' if label == 'Password'
- rofiData["%-#{maxLength}s %s" % [label, valueLabel]] = value
- else
- rofiData[label] = value
- end
- end
- rofi rofiData, '-p', item['name']
- end
-end
-
-BW.run ARGV.dup
diff --git a/bin/rofi/filemenu b/bin/rofi/filemenu
deleted file mode 100755
index f5ee1fba..00000000
--- a/bin/rofi/filemenu
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env sh
-cd $HOME
-DIR="$(fd -L -d 4 --type d . | rofi -dmenu -i -p "~/" -theme theme/filemenu.rasi)"
-if [ -d "$DIR" ]; then
- cd "$DIR"
- if [[ $1 == "-x" ]]; then
- scratch
- else
- xst
- fi
-fi
diff --git a/bin/rofi/passmenu b/bin/rofi/passmenu
deleted file mode 100755
index bdca124e..00000000
--- a/bin/rofi/passmenu
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env bash
-
-# Prompts for a pass entry, then for a specific field. Similar to passmenu, but
-# uses rofi, and can resume from a previous session.
-#
-# Example: passmenu [RESUME]
-
-ROFI_CMD='rofi -dmenu -theme theme/passmenu.rasi'
-MSG_CMD='notify-send'
-set -e
-shopt -s nullglob globstar
-
-for prog in xclip pass; do
- if ! command -v "$prog" >/dev/null; then
- >&2 echo "$prog not installed, aborting"
- exit 1
- fi
-done
-
-if [[ $1 == -r ]]; then
- resume=1; shift
-fi
-
-url=
-# Get qutebrowser's current url
-win=$(xdotool getactivewindow)
-if [[ -n $win ]]; then
- winname=$(xdotool getwindowname $win)
- if [[ $winname =~ " - Mozilla Firefox$" ]]; then
- url=${winname% - Mozilla*}
- url=${url##* - }
- while (( ${#url//[^.]/} > 1 )); do
- url=${url#*.}
- done
- fi
-fi
-
-LAST_ENTRY_FILE=/tmp/_upm
-if [[ -n $resume && -f $LAST_ENTRY_FILE ]]; then
- entry="$(<$LAST_ENTRY_FILE)"
-else
- prefix=${PASSWORD_STORE_DIR-~/.password-store}
- password_files=( "$prefix"/**/*.gpg )
- password_files=( "${password_files[@]#"$prefix"/}" )
- password_files=( "${password_files[@]%.gpg}" )
- entry=$(printf "%s\n" "${password_files[@]}" | $ROFI_CMD -p "..." -filter "$url")
-fi
-
-if [[ -z $entry ]]; then
- $MSG_CMD "Error!" "Failed to select $entry"
- exit 1
-fi
-
-echo "$entry" >/tmp/_upm
-secrets="$(pass show "$entry")"
-if [[ -n $secrets ]]; then
- fields=$(awk -F': ' 'NR>1 && !/^otpauth:/ {print $1}' <<<"$secrets")
- field=$(printf "password\n%s\notp\n" "${fields[@]}" | $ROFI_CMD -p "$entry")
- case $field in
- password) pass -c "$entry" ;;
- otp) printf "%s" "$(pass otp -c "$entry")" ;;
- *) printf "%s" "$(awk -v "key=$field:" '$1 == key {print $2}' <<<"$secrets")" | xclip -selection clipboard -in ;;
- esac
- $MSG_CMD "Success!" "Copied $entry/$field to clipboard for 45s"
-else
- $MSG_CMD "Error!" "Failed to retrieve $entry"
- exit 2
-fi
diff --git a/bin/rofi/powermenu b/bin/rofi/powermenu
deleted file mode 100755
index daeb1dc7..00000000
--- a/bin/rofi/powermenu
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env sh
-
-rofi_command="rofi -theme theme/powermenu.rasi"
-
-### Options ###
-power_off="\tShutdown"
-reboot="\tReboot"
-lock="\tLock"
-suspend="鈴\tSleep"
-log_out="\tLogout"
-# Variable passed to rofi
-options="$power_off\n$reboot\n$lock\n$suspend\n$log_out"
-
-case "$(echo -e "$options" | $rofi_command -dmenu -selected-row 2)" in
- $power_off)
- systemctl poweroff
- ;;
- $reboot)
- systemctl reboot
- ;;
- $lock)
- zzz
- ;;
- $suspend)
- dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause
- systemctl suspend
- ;;
- $log_out)
- bspc quit
- ;;
-esac
diff --git a/bin/rofi/spotifymenu b/bin/rofi/spotifymenu
deleted file mode 100644
index e69de29b..00000000
diff --git a/bin/rofi/windowmenu b/bin/rofi/windowmenu
deleted file mode 100755
index a0128aac..00000000
--- a/bin/rofi/windowmenu
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env sh
-rofi -show window \
- -show-icons \
- -theme theme/windowmenu.rasi
diff --git a/bin/scratch b/bin/scratch
deleted file mode 100755
index 93e5019f..00000000
--- a/bin/scratch
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Toggle a scratch terminal window. A scratch terminal is a disposable terminal
-# for one-off, quick commands that don't warrant a dedicated terminal.
-
-SCRID=scratch
-CMD=${1:-'tmux new-session -A -s scratch -n scratch'}
-focused=$(xdotool getactivewindow)
-scratch=$(xdotool search --onlyvisible --classname $SCRID)
-if [[ -n $scratch ]]; then
- if [[ $focused == $scratch ]]; then
- xdotool windowkill $scratch
- else
- xdotool windowactivate $scratch
- fi
-elif command -v urxvt >/dev/null; then
- urxvt -name $SCRID \
- -e $SHELL -c "$CMD"
-elif command -v xst >/dev/null; then
- xst -t $SCRID -n $SCRID -c $SCRID \
- -f "$(xrdb -query | grep 'scratch\.font' | cut -f2)" \
- -e $SHELL -c "$CMD"
-else
- >&2 echo "No shell to launch the scratch terminal with"
- exit 1
-fi
diff --git a/bin/scrcap b/bin/scrcap
deleted file mode 100755
index 5304ba87..00000000
--- a/bin/scrcap
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -i bash -p maim slop
-
-# A script that takes a screenshot (prompts you for what region/window to
-# capture) and stores it in the clipboard.
-
-tmp=$(mktemp)
-trap "rm -f '$tmp'" EXIT
-
-# Delay for long enough that we can refocus the targeted window
-if maim --delay=${2:-1} -us >"$tmp"; then
- xclip -selection clipboard -t image/png "$tmp" &&
- notify-send "Screenshot saved" "Copied image to clipboard"
-else
- notify-send -u low "Aborted screenshot"
-fi
diff --git a/bin/scrrec b/bin/scrrec
deleted file mode 100755
index a333674d..00000000
--- a/bin/scrrec
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/env cached-nix-shell
-#! nix-shell -i bash -p ffmpeg slop
-
-# Select a region and record it.
-#
-# If given a gif, it will record an mp4 and convert it afterwards using the
-# mov2gif script included in this repo (which is powered by gifsicle and
-# ffmpeg).
-#
-# Usage: scrrec somefile.mp4
-# scrrec another.gif
-
-is_script=
-geom=
-delay=1
-count=3
-fps=30
-stopfile=/tmp/_stop
-while getopts c:d:f:g:ps opt; do
- case $opt in
- c) count=$OPTARG ;;
- d) delay="$OPTARG" ;;
- f) fps=$OPTARG ;;
- g) geom="$OPTARG" ;;
- p) picom= ;;
- s) is_script=1 ;;
- esac
-done
-shift $((OPTIND-1))
-
-##
-select-region() {
- if [[ $geom ]]; then
- echo "${geom//[x+]/ }"
- else
- slop -nof "%w %h %x %y"
- fi
-}
-
-countdown() {
- if (( count > 0 )); then
- for ((i=count;i>0;i--)); do
- if [[ $is_script ]]; then
- notify-send -u critical -t 1000 "Recording in $i"
- else
- echo "Recording in $i"
- fi
- sleep 1
- done
- elif [[ $is_script ]]; then
- notify-send -u critical "Starting recording..."
- else
- echo "Started recording..."
- fi
-}
-
-recording-start() {
- local ffmpeg_opts="-y -f x11grab -show_region 1 -ss $delay -s ${4}x${5} -i :0.0+${2},${3} -framerate ${fps}"
- local dest=${1:-./rec.mp4}
- local mp4dest=
- [[ $dest == *.gif ]] && mp4dest="${dest%.*}.mp4"
- countdown
- ffmpeg $ffmpeg_opts "${mp4dest:-$dest}" &
- pid=$!
- echo $pid >$stopfile
- wait $pid
- rm -f $stopfile
- if [[ -f "$mp4dest" ]]; then
- mov2gif "$mp4dest" "$dest" && rm -fv "$mp4dest"
- fi
- echo -n "$dest" | xclip -selection clipboard -in
- notify-send "Screencast successful" "Saved to $dest\nAnd copied to your clipboard!"
-}
-
-
-# If a recording session is already active, stop that one.
-if [[ -n "$is_script" && -f "$stopfile" ]]; then
- kill $(cat $stopfile)
- echo "Stopped previous recording"
- exit 0
-fi
-
-read -r W H X Y < <(select-region)
-[[ -z "$W$H$X$Y" ]] && exit 1
-
-# picom with blur and/or transparencies cause unbearable flickering in
-# recordings, so temporarily disable it.
-picom=
-if systemctl is-enabled --user picom >/dev/null; then
- systemctl --user stop picom
- picom=1
-fi
-cleanup() { [[ $picom ]] && systemctl --user start picom; }
-trap cleanup EXIT
-
-# Let 'er rip
-recording-start "$1" "$X" "$Y" "$W" "$H"
-
-# vim:set ft=sh shiftwidth=2:
diff --git a/bin/since b/bin/since
deleted file mode 100755
index ffe053e2..00000000
--- a/bin/since
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env zsh
-set -e
-(( $# > 0 )) || exit
-
-# Displays the time since $1 in a human readable format (e.g. 4h 25m 55s). If
-# given a file, the modified time is used. If $1 == "--", then this script acts
-# as a converter, converting $2 into human a readable format, e.g. since -- 72
-# #=> 1m 12s
-
-# TODO: A help fallback
-# TODO: Options parsing?
-
-# If given a file, give time since last modification
-(( $# == 1 )) && [[ -f $1 ]] && arg=reference || arg=date
-
-if [[ $1 == -- ]]; then
- t="$2"
-else
- now=$(date +%s)
- then=$(date --$arg="$*" +%s)
-
- t=$(( now - then ))
-fi
-
-# Bash doesn't support floating point arithmetic like zsh does, so use bc to do
-# our arithmetic.
-zmodload zsh/mathfunc
-t=$(( abs(t) ))
-weeks=$(( t / 60 / 60 / 24 / 7 ))
-days=$(( t / 60 / 60 / 24 % 7 ))
-hours=$(( t / 60 / 60 % 24 ))
-minutes=$(( t / 60 % 60 ))
-seconds=$(( t % 60 ))
-(( weeks > 0 )) && echo -n "${weeks}w "
-(( days > 0 )) && echo -n "${days}d "
-(( hours > 0 )) && echo -n "${hours}h "
-(( minutes > 0 )) && echo -n "${minutes}m "
-echo -n "${seconds}s"
diff --git a/bin/spell b/bin/spell
deleted file mode 100755
index a1d0ea82..00000000
--- a/bin/spell
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-
-# Find the correct spelling of a word. Uses (and requires) fzf to select the
-# correct word. This output can be piped to something like dict to find
-# definitions/synonyms.
-#
-# Requires: aspell, fzf
-# Usage: spell mispeling
-# Example: dict $(spell mispeling)
-
-result=$(echo "$@" | aspell -a | tail -n-2)
-if [[ "$result" == '*' ]]; then
- echo "$@"
-else
- words=$(echo "$result" | sed $'s/[:,] /\\\n/g' | tail -n +2)
- if (( $(wc -l <<< "$words") > 1 )) && command -v sk >/dev/null; then
- fzf <<< "$words"
- else
- echo "$words"
- fi
-fi
diff --git a/bin/timein b/bin/timein
deleted file mode 100755
index c530a245..00000000
--- a/bin/timein
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env bash
-
-open=open
-[[ $OSTYPE == linux* ]] && open=xdg-open
-
-$open https://time.is/$1 2>/dev/null &
diff --git a/bin/zzz b/bin/zzz
deleted file mode 100755
index 99d90d79..00000000
--- a/bin/zzz
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-
-# If -f, then put computer to sleep.
-# Otherwise, lock screen and turn off monitor.
-
-if [[ $1 == -h ]]; then
- bin=${0##*/}
- echo "Usage: $bin [-f]"
- echo
- echo " $bin # put display to sleep"
- echo " $bin -f # put computer to sleep"
-elif [[ $1 == -f ]]; then
- echo "Going to sleep..."
- systemctl suspend
-else
- echo "Shutting my eyes..."
- if command -v slock >/dev/null; then
- pgrep slock >/dev/null || slock &
- fi
- sleep 1
- xset dpms force off
-fi
diff --git a/box.nix b/box.nix
new file mode 100644
index 00000000..553460ae
--- /dev/null
+++ b/box.nix
@@ -0,0 +1,28 @@
+{ config, pkgs, ... }:
+
+{
+ imports = [
+ ./common.nix
+ ./mossnet.nix
+ ];
+
+ users.extraUsers."anish".extraGroups = [ "jackaudio" ];
+
+# services.xserver = {
+# enable = true;
+# displayManager.gdm.enable = true;
+# desktopManager.gnome3.enable = true;
+# };
+
+ # task whisperer broken
+ #nixpkgs.config.allowBroken = true;
+
+ # virtual box
+ virtualisation.virtualbox.host.enable = true;
+
+ # ErgoDox Firmware (doesn't compile)
+ # environment.systemPackages = with pkgs; [
+ # qmk_firmware
+ # ];
+}
+
diff --git a/hosts/common.nix b/common.nix
similarity index 58%
rename from hosts/common.nix
rename to common.nix
index 3ce7a772..0790f579 100644
--- a/hosts/common.nix
+++ b/common.nix
@@ -1,14 +1,16 @@
{ config, pkgs, ... }:
{
-# imports = [
-# ./nvim.nix
+ imports = [
+ ./nvim.nix
# ./unstable.nix
-# ];
+ ];
environment.systemPackages = with pkgs; [
+ tailscale
htop
+ fzf
iftop
wget
curl
@@ -16,6 +18,7 @@
bat
fd
ag
+ wpa_supplicant
tcpdump
whois
mtr
@@ -27,51 +30,52 @@
zip
unzip
rsync
- #tmux
+ tmux
pwgen
glow
+ jq
gitAndTools.gitFull
#neovim defined in ./nvim.nix
- #firefox
- #fractal
- #pinentry_gnome
+ # wofi
+ # firefox
+ # fractal
+ # pinentry_gnome
+ pinentry_curses
pass
gcc
less
- mpv
- zathura
+ # mpv
+ # zathura
#qmk_firmware
+ python3
gdb
- vcv-rack
+ # vcv-rack
#xdotool
#neofetch
#calibre
#openvpn
- gimp
+ #gimp
xxd
- kitty
+ # tilix
+ # kitty
taskwarrior
- #gnupg
+ gnupg
openjdk
glslviewer
- filezilla
- signal-desktop
- #wire-desktop
- #tdesktop
- #feedreader
- newsflash
- syncthing
+ #filezilla
+ # signal-desktop
+ # wire-desktop
+ # tdesktop
+ # feedreader
+ #newsflash
+# syncthing
dijo
- #kdeconnect
#ssb-patchwork
- #gnome3.gnome-tweaks
- #gnome3.pomodoro
- #gnomeExtensions.gsconnect
- #gnomeExtensions.taskwhisperer
+ #gnomeExtensions.taskwhisperer
#gnome3.networkmanager-openvpn
#python3Packages.youtube-dl
#appimage-run
- #home-manager
+ home-manager
libreoffice
fontconfig
#hugo
@@ -82,14 +86,18 @@
supercollider
haskellPackages.tidal
pandoc
+ # calibre
];
programs.bash.enableCompletion = true;
+ programs.gnupg.agent.enable = true;
+ programs.gnupg.agent.pinentryFlavor = "curses";
+ programs.gnupg.agent.enableSSHSupport = true;
# needed for vcv-rack
nixpkgs.config.allowUnfree = true;
- #system.copySystemConfiguration = true;
+ system.copySystemConfiguration = true;
#services.syncthing = {
# enable = true;
# openDefaultPorts = true;
@@ -99,12 +107,14 @@
#};
#zsh powerlevel10k
- programs.zsh.enable = true;
- programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
- users.users.anish.shell = pkgs.zsh;
+ #programs.zsh.enable = true;
+ #programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
+ users.users.anish.shell = pkgs.bash;
#android
programs.adb.enable = true;
users.users.anish.extraGroups = ["adbusers"];
+ #ssh
+ services.sshd.enable = true;
}
diff --git a/config/.gitignore b/config/.gitignore
deleted file mode 100644
index 59ba8777..00000000
--- a/config/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-result
-result/*
diff --git a/config/awesome/init.fnl b/config/awesome/init.fnl
deleted file mode 100644
index f9247628..00000000
--- a/config/awesome/init.fnl
+++ /dev/null
@@ -1,111 +0,0 @@
-(local gears (require :gears))
-(local awful (require :awful))
-(local naughty (require :naughty))
-(require :awful.autofocus)
-
-(local wincmd (require :commands.window))
-(local tagcmd (require :commands.tag))
-(local pa (require :utils.pulseaudio))
-(local input (require :utils.input))
-
-
-(fn initialize [bindings]
- ;; Error handling
- ;; Check if awesome encountered an error during startup and fell back to
- ;; another config (This code will only ever execute for the fallback config)
- (let [preset { :timeout 0 :bg "#000000" :fg "#ff0000" :max_height 1080 }]
- (when awesome.startup_errors
- (naughty.notify {:preset preset
- :title "Oops, there were errors during startup!"
- :text awesome.startup_errors}))
-
- (var in-error false)
- (awesome.connect_signal
- "debug::error"
- (fn []
- ;; Make sure we don't go into an endless error loop
- (when (not in-error)
- (set in-error true)
- (naughty.notify {:preset preset
- :title "Oops, an error happened!"
- :text (tostring err)})
- (naughty.notify {:preset preset
- :title "Oops, an error happened!"
- :text (tostring err)})
- (set in-error false)))))
-
- (root.keys bindings.global-keys)
-
- (naughty.notify {:text "Glorious fennel"})
- (gears.wallpaper.set "#282c34"))
-
-
-(local
- bindings
- {
- :global-keys
- (gears.table.join
-
- (input.key-group
- "awesome"
- [[:mod] :s hotkeys_popup.show_help "show help"]
- [[:mod :shift] :r awesome.restart "reload config"]
- )
-
- (input.key-group
- "exec"
- [[:mod] :space (fn [] (awful.util.spawn "rofi -show run")) "app launcher"]
- [[:mod] :e (fn [] (awful.util.spawn "emacsclient -c -n -e '(switch-to-buffer nil)'")) "emacs"]
- [[:mod] :v (fn []
- (let [option "gopass ls --flat"
- prompt "rofi -dmenu -p pass"
- action "xargs --no-run-if-empty gopass show -c"
- cmd (.. option " | " prompt " | " action)]
- (awful.spawn.easy_async_with_shell cmd (fn []))))
- "secret vault"]
- [[:mod] :Return (fn [] (awful.spawn "xst")) "open terminal"]
- [[] :XF86AudioMute pa.toggle-muted "⏼ audio muted"]
- [[] :XF86AudioMicMute pa.toggle-mic-mute "⏼ mic muted"]
- [[] :XF86AudioRaiseVolume (fn [] (pa.adjust-volume 5)) "raise volume"]
- [[] :XF86AudioLowerVolume (fn [] (pa.adjust-volume -5)) "lower volume"]
- )
-
- (input.key-group
- "client"
- [[:mod] :h (fn [] (awful.client.focus.bydirection :left)) "focus left"]
- [[:mod] :j (fn [] (awful.client.focus.bydirection :down)) "focus down"]
- [[:mod] :k (fn [] (awful.client.focus.bydirection :up)) "focus up"]
- [[:mod] :l (fn [] (awful.client.focus.bydirection :right)) "focus right"]
- [[:mod] :n (fn [] (awful.client.focus.byidx 1)) "focus next"]
- [[:mod] :p (fn [] (awful.client.focus.byidx -1)) "focus previous"]
- [[:mod :shift] :j (fn [] (awful.client.swap.byidx 1)) "swap next with previous"]
- [[:mod :shift] :k (fn [] (awful.client.swap.byidx -1)) "swap next with previous"]
- )
- )
-
- :client-keys
- (gears.table.join
- (input.key-group
- "client"
- [[:mod] :n wincmd.minimize "minimize"]
- [[:mod] :t wincmd.toggle-ontop "⏼ keep on top"]
- [[:mod] :m wincmd.toggle-maximized "⏼ maximize"]
- [[:mod] :f wincmd.toggle-fullscreen "⏼ fullscreen"]
- [[:mod :ctrl] :space awful.client.floating.toggle "⏼ floating"]
- [[:mod :ctrl] :Return wincmd.move-to-master "move to master"]
- [[:mod :ctrl] :m wincmd.toggle-maximize-vertical "⏼ max vertically"]
- [[:mod :shift] :m wincmd.toggle-maximize-horizontal "⏼ max horizontally"]
- [[:mod :shift] :c wincmd.close "close"]
- ))
-
- :client-buttons
- (gears.table.join
- (input.mousebind [] input.left-click client.mouse-raise)
- (input.mousebind [:mod] input.left-click client.mouse-drag-move)
- (input.mousebind [:mod] input.right-click client.mouse-drag-resize)
- )
- })
-
-
-;;
-(initialize bindings)
diff --git a/config/bspwm/bspwmrc b/config/bspwm/bspwmrc
deleted file mode 100755
index b942f75a..00000000
--- a/config/bspwm/bspwmrc
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-
-# case $HOSTNAME in
-# kuro) export LAN=eno1 ;;
-# shiro) export LAN=wlp3s0 ;;
-# esac
-
-export MONITOR=$(xrandr -q | grep primary | cut -d' ' -f1)
-export MONITORS=( $(xrandr -q | grep ' connected' | cut -d' ' -f1) )
-MONITOR=${MONITOR:-${MONITORS[0]}}
-
-# Only have workspaces for primary monitor
-bspc monitor $MONITOR -d {1,2,3,4,5}
-
-bspc config remove_disabled_monitors true
-bspc config remove_unplugged_monitors true
-
-
-# Rules
-bspc rule -r '*'
-
-bspc rule -a Pinentry state=floating center=on
-bspc rule -a Emacs split_ratio=0.28 state=tiled
-bspc rule -a Firefox split_ratio=0.32
-bspc rule -a feh state=fullscreen
-bspc rule -a 'Emacs:org*' state=floating
-bspc rule -a 'Emacs:scratch' state=floating
-bspc rule -a 'Emacs:emacs-everywhere' state=floating sticky=on
-bspc rule -a '*:scratch' state=floating sticky=on center=on border=off rectangle=1000x800+0+0
-
-#
-for file in $XDG_CONFIG_HOME/bspwm/rc.d/*; do
- source "$file"
-done
diff --git a/config/docker/aliases.zsh b/config/docker/aliases.zsh
deleted file mode 100644
index 2c026a79..00000000
--- a/config/docker/aliases.zsh
+++ /dev/null
@@ -1,14 +0,0 @@
-alias dk=docker
-alias dkc=docker-compose
-alias dkm=docker-machine
-alias dkl='dk logs'
-alias dkcl='dkc logs'
-
-dkclr() {
- dk stop $(docker ps -a -q)
- dk rm $(docker ps -a -q)
-}
-
-dke() {
- dk exec -it "$1" "${@:1}"
-}
diff --git a/config/emacs/aliases.zsh b/config/emacs/aliases.zsh
deleted file mode 100644
index 13931848..00000000
--- a/config/emacs/aliases.zsh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env zsh
-
-e() { pgrep emacs && emacsclient -n "$@" || emacs -nw "$@" }
-ediff() { emacs -nw --eval "(ediff-files \"$1\" \"$2\")"; }
-eman() { emacs -nw --eval "(switch-to-buffer (man \"$1\"))"; }
-ekill() { emacsclient --eval '(kill-emacs)'; }
diff --git a/config/gimp/menurc b/config/gimp/menurc
deleted file mode 100644
index 2dbd2812..00000000
--- a/config/gimp/menurc
+++ /dev/null
@@ -1,1344 +0,0 @@
-; gimp-2.10 GtkAccelMap rc-file -*- scheme -*-
-; this file is an automated accelerator map dump
-;
-; (gtk_accel_path "/file/file-menu" "")
-; (gtk_accel_path "/tools/tools-opacity-set-to-default" "")
-; (gtk_accel_path "/context/context-background-value-decrease" "")
-; (gtk_accel_path "/vectors/vectors-color-tag-brown" "")
-; (gtk_accel_path "/tools/tools-opacity-increase-skip" "greater")
-(gtk_accel_path "/tools/tools-vector" "p")
-; (gtk_accel_path "/view/view-scroll-left" "")
-; (gtk_accel_path "/vectors/vectors-color-tag-orange" "")
-; (gtk_accel_path "/tools/tools-airbrush-rate-increase" "")
-; (gtk_accel_path "/tools/tools-spacing-set-to-default" "")
-; (gtk_accel_path "/view/view-show-statusbar" "")
-; (gtk_accel_path "/layers/layers-opacity-transparent" "")
-; (gtk_accel_path "/image/image-convert-u8" "")
-; (gtk_accel_path "/view/view-zoom-8-1-accel" "KP_4")
-; (gtk_accel_path "/context/context-background-value-set" "")
-; (gtk_accel_path "/context/context-paint-mode-menu" "")
-; (gtk_accel_path "/filters/filters-motion-blur-linear" "")
-; (gtk_accel_path "/filters/filters-gegl-graph" "")
-; (gtk_accel_path "/context/context-brush-select-set" "")
-; (gtk_accel_path "/edit/edit-copy" "c")
-; (gtk_accel_path "/context/context-brush-shape-circle" "")
-; (gtk_accel_path "/windows/windows-display-0001" "")
-(gtk_accel_path "/plug-in/plug_in_bump_map" "m")
-; (gtk_accel_path "/vectors/vectors-lock-content" "")
-; (gtk_accel_path "/context/context-opacity-opaque" "")
-; (gtk_accel_path "/view/view-color-management-menu" "")
-; (gtk_accel_path "/filters/filters-spherize" "")
-; (gtk_accel_path "/channels/channels-new-last-values" "")
-; (gtk_accel_path "/vectors/vectors-merge-visible" "")
-; (gtk_accel_path "/plug-in/plug-in-spheredesigner" "")
-; (gtk_accel_path "/plug-in/script-fu-slide" "")
-; (gtk_accel_path "/filters/filters-curves" "")
-; (gtk_accel_path "/channels/channels-lock-position" "")
-; (gtk_accel_path "/context/context-brush-menu" "")
-; (gtk_accel_path "/context/context-foreground-blue-decrease" "")
-; (gtk_accel_path "/context/context-colors-menu" "")
-; (gtk_accel_path "/edit/edit-undo-clear" "")
-; (gtk_accel_path "/context/context-gradient-select-first" "")
-; (gtk_accel_path "/layers/layers-color-tag-brown" "")
-; (gtk_accel_path "/plug-in/plug-in-imagemap" "")
-; (gtk_accel_path "/filters/filters-recent-menu" "")
-; (gtk_accel_path "/plug-in/plug-in-map-object" "")
-; (gtk_accel_path "/layers/layers-text-along-vectors" "")
-; (gtk_accel_path "/dialogs/dialogs-symmetry" "")
-; (gtk_accel_path "/view/view-zoom-revert" "grave")
-; (gtk_accel_path "/plug-in/plug-in-script-fu-console" "")
-; (gtk_accel_path "/filters/filters-plasma" "")
-; (gtk_accel_path "/view/view-color-management-enable" "")
-(gtk_accel_path "/dialogs/dialogs-undo-history" "F9")
-; (gtk_accel_path "/edit/edit-cut" "x")
-; (gtk_accel_path "/context/context-foreground-value-increase-skip" "")
-; (gtk_accel_path "/plug-in/script-fu-addborder" "")
-; (gtk_accel_path "/view/view-display-intent-absolute-colorimetric" "")
-; (gtk_accel_path "/file/file-export-to" "")
-; (gtk_accel_path "/vectors/vectors-color-tag-menu" "")
-; (gtk_accel_path "/context/context-background-red-decrease" "")
-; (gtk_accel_path "/tools/tools-airbrush-rate-maximum" "")
-; (gtk_accel_path "/tools/tools-operation" "")
-; (gtk_accel_path "/view/view-fullscreen" "F11")
-; (gtk_accel_path "/tools/tools-spacing-minimum" "")
-; (gtk_accel_path "/context/context-brush-radius-decrease-skip" "")
-; (gtk_accel_path "/view/view-zoom-2-1" "2")
-(gtk_accel_path "/dialogs/dialogs-brushes" "")
-; (gtk_accel_path "/context/context-foreground-blue-maximum" "")
-; (gtk_accel_path "/context/context-foreground-red-increase" "")
-; (gtk_accel_path "/view/view-snap-to-vectors" "")
-(gtk_accel_path "/image/image-properties" "F8")
-; (gtk_accel_path "/drawable/drawable-rotate-270" "")
-; (gtk_accel_path "/plug-in/script-fu-predator" "")
-; (gtk_accel_path "/tools/tools-hardness-increase-percent" "")
-; (gtk_accel_path "/plug-in/plug-in-colorify" "")
-(gtk_accel_path "/view/view-show-grid" "apostrophe")
-; (gtk_accel_path "/image/image-color-management-enabled" "")
-; (gtk_accel_path "/tools/tools-angle-increase" "")
-; (gtk_accel_path "/vectors/vectors-color-tag-violet" "")
-; (gtk_accel_path "/context/context-background-saturation-decrease-skip" "")
-; (gtk_accel_path "/layers/layers-composite-mode-union" "")
-; (gtk_accel_path "/channels/channels-color-tag-blue" "")
-; (gtk_accel_path "/windows/windows-dialogs-menu" "")
-; (gtk_accel_path "/tools/tools-gegl" "")
-; (gtk_accel_path "/tool-options/tool-options-reset" "")
-; (gtk_accel_path "/layers/layers-delete" "")
-; (gtk_accel_path "/view/view-display-intent-menu" "")
-; (gtk_accel_path "/vectors/vectors-edit" "")
-; (gtk_accel_path "/filters/filters-illusion" "")
-; (gtk_accel_path "/context/context-colormap-foreground-previous" "")
-; (gtk_accel_path "/layers/layers-lock-content" "")
-; (gtk_accel_path "/file/file-create-menu" "")
-(gtk_accel_path "/plug-in/plug_in_iwarp" "x")
-; (gtk_accel_path "/tools/tools-spacing-decrease-skip" "")
-; (gtk_accel_path "/filters/filters-dropshadow" "")
-; (gtk_accel_path "/layers/layers-alpha-selection-add" "")
-; (gtk_accel_path "/context/context-background-green-increase" "")
-; (gtk_accel_path "/plug-in/script-fu-make-brush-rectangular-feathered" "")
-; (gtk_accel_path "/patterns/patterns-delete" "")
-; (gtk_accel_path "/context/context-brush-radius-menu" "")
-(gtk_accel_path "/view/view-scroll-page-right" "Page_Down")
-; (gtk_accel_path "/layers/layers-blend-space-menu" "")
-; (gtk_accel_path "/dockable/dialogs-histogram" "")
-; (gtk_accel_path "/layers/layers-opacity-opaque" "")
-; (gtk_accel_path "/context/context-background-saturation-increase" "")
-; (gtk_accel_path "/dialogs/dialogs-dynamics-editor" "")
-; (gtk_accel_path "/layers/layers-composite-space-menu" "")
-(gtk_accel_path "/file/file-revert" "F12")
-; (gtk_accel_path "/filters/filters-fattal-2002" "")
-; (gtk_accel_path "/tools/tools-color-average-radius-set" "")
-; (gtk_accel_path "/filters/filters-distorts-menu" "")
-(gtk_accel_path "/tools/tools-fuzzy-select" "w")
-; (gtk_accel_path "/documents/documents-reload-previews" "")
-; (gtk_accel_path "/debug/debug-show-image-graph" "")
-; (gtk_accel_path "/brushes/brushes-show-in-file-manager" "")
-; (gtk_accel_path "/context/context-brush-angle-maximum" "")
-; (gtk_accel_path "/view/view-zoom-selection" "")
-(gtk_accel_path "/tools/tools-cage" "")
-; (gtk_accel_path "/file/file-open-location" "")
-; (gtk_accel_path "/plug-in/plug-in-blur" "")
-; (gtk_accel_path "/layers/layers-opacity-decrease" "")
-; (gtk_accel_path "/context/context-foreground-hue-decrease-skip" "")
-; (gtk_accel_path "/plug-in/plug-in-oilify" "")
-(gtk_accel_path "/layers/layers-mask-add" "o")
-; (gtk_accel_path "/filters/filters-diffraction-patterns" "")
-; (gtk_accel_path "/image/image-convert-rgb" "")
-; (gtk_accel_path "/tools/tools-spacing-decrease-percent" "")
-; (gtk_accel_path "/context/context-gradient-select-last" "")
-; (gtk_accel_path "/plug-in/plug-in-emboss" "")
-; (gtk_accel_path "/file/file-create-template" "")
-; (gtk_accel_path "/vectors/vectors-color-tag-yellow" "")
-; (gtk_accel_path "/layers/layers-preserve-transparency" "")
-; (gtk_accel_path "/dockable/dockable-view-type-grid" "")
-; (gtk_accel_path "/view/view-navigation-window" "")
-; (gtk_accel_path "/windows/windows-tabs-position-bottom" "")
-; (gtk_accel_path "/context/context-brush-angle-set" "")
-; (gtk_accel_path "/documents/documents-raise-or-open" "")
-; (gtk_accel_path "/context/context-background-blue-decrease" "")
-; (gtk_accel_path "/context/context-foreground-green-set" "")
-(gtk_accel_path "/tools/tools-levels" "l")
-; (gtk_accel_path "/plug-in/plug-in-script-fu-server" "")
-; (gtk_accel_path "/dock/dock-move-to-screen-menu" "")
-; (gtk_accel_path "/windows/windows-tabs-position-right" "")
-; (gtk_accel_path "/plug-in/script-fu-line-nova" "")
-; (gtk_accel_path "/layers/layers-color-tag-blue" "")
-; (gtk_accel_path "/tools/tools-object-1-set" "")
-; (gtk_accel_path "/dialogs/dialogs-indexed-palette" "")
-; (gtk_accel_path "/channels/channels-new" "")
-; (gtk_accel_path "/edit/edit-named-paste" "")
-; (gtk_accel_path "/tools/tools-hardness-minimum" "")
-; (gtk_accel_path "/plug-in/color-decode-ycocg" "")
-; (gtk_accel_path "/filters/filters-menu" "")
-; (gtk_accel_path "/tools/tools-opacity-set" "")
-; (gtk_accel_path "/dockable/dialogs-toolbox" "b")
-; (gtk_accel_path "/plug-in/gimp-help-using-fileformats" "")
-; (gtk_accel_path "/edit/edit-strong-redo" "y")
-; (gtk_accel_path "/filters/filters-alien-map" "")
-; (gtk_accel_path "/plug-in/gimp-online-bugs-features" "")
-; (gtk_accel_path "/tools/tools-object-2-last" "")
-; (gtk_accel_path "/tools/tools-paintbrush-force-set" "")
-; (gtk_accel_path "/vectors/vectors-linked" "")
-; (gtk_accel_path "/filters/filters-gaussian-blur-selective" "")
-; (gtk_accel_path "/filters/filters-unsharp-mask" "")
-; (gtk_accel_path "/fonts/fonts-refresh" "")
-; (gtk_accel_path "/file/file-open-recent-menu" "")
-; (gtk_accel_path "/tools/tools-hardness-decrease" "")
-; (gtk_accel_path "/layers/layers-mask-show" "")
-; (gtk_accel_path "/view/view-softproof-intent-absolute-colorimetric" "")
-; (gtk_accel_path "/brushes/brushes-open-as-image" "")
-; (gtk_accel_path "/plug-in/python-fu-palette-offset" "")
-; (gtk_accel_path "/tools/tools-angle-decrease" "")
-; (gtk_accel_path "/context/context-background-blue-set" "")
-; (gtk_accel_path "/plug-in/plug-in-normalize" "")
-; (gtk_accel_path "/tools/tools-opacity-increase-percent" "")
-; (gtk_accel_path "/context/context-background-value-decrease-skip" "")
-; (gtk_accel_path "/patterns/patterns-new" "")
-; (gtk_accel_path "/plug-in/script-fu-spinning-globe" "")
-; (gtk_accel_path "/windows/windows-menu" "")
-; (gtk_accel_path "/tools/tools-object-1-first" "")
-; (gtk_accel_path "/image/image-flip-horizontal" "")
-; (gtk_accel_path "/plug-in/plug-in-sharpen" "")
-; (gtk_accel_path "/tools/tools-force-decrease-percent" "")
-; (gtk_accel_path "/context/context-brush-hardness-set" "")
-; (gtk_accel_path "/select/select-stroke-last-values" "")
-; (gtk_accel_path "/filters/filters-long-shadow" "")
-; (gtk_accel_path "/context/context-brush-radius-increase-percent" "")
-; (gtk_accel_path "/plug-in/plug-in-animationoptimize-diff" "")
-; (gtk_accel_path "/tools/tools-perspective-clone" "")
-; (gtk_accel_path "/image/colors-auto-menu" "")
-; (gtk_accel_path "/vectors/vectors-selection-to-vectors-advanced" "")
-; (gtk_accel_path "/plug-in/script-fu-unsharp-mask" "")
-; (gtk_accel_path "/context/context-background-saturation-decrease" "")
-(gtk_accel_path "/tools/tools-rect-select" "m")
-; (gtk_accel_path "/tools/tools-angle-set-to-default" "")
-; (gtk_accel_path "/view/view-zoom-in-skip" "")
-; (gtk_accel_path "/filters/filters-semi-flatten" "")
-; (gtk_accel_path "/tools/tools-opacity-maximum" "")
-; (gtk_accel_path "/dockable/dockable-tab-style-preview-name" "")
-; (gtk_accel_path "/plug-in/python-fu-palette-sort" "")
-; (gtk_accel_path "/tools/tools-airbrush-flow-decrease" "")
-; (gtk_accel_path "/plug-in/plug-in-dog" "")
-; (gtk_accel_path "/edit/edit-paste-as-new-layer" "")
-; (gtk_accel_path "/channels/channels-visible" "")
-; (gtk_accel_path "/debug/debug-mem-profile" "")
-; (gtk_accel_path "/context/context-foreground-hue-maximum" "")
-; (gtk_accel_path "/tool-options/tool-options-restore-preset-menu" "")
-; (gtk_accel_path "/dockable/dialogs-undo-history" "")
-; (gtk_accel_path "/tools/tools-paintbrush-hardness-set" "")
-; (gtk_accel_path "/filters/filters-stretch-contrast" "")
-; (gtk_accel_path "/filters/filters-color-to-alpha" "")
-; (gtk_accel_path "/context/context-brush-aspect-maximum" "")
-; (gtk_accel_path "/dockable/dialogs-templates" "")
-; (gtk_accel_path "/plug-in/script-fu-ripply-anim" "")
-(gtk_accel_path "/view/view-show-menubar" "f")
-; (gtk_accel_path "/filters/filters-web-menu" "")
-; (gtk_accel_path "/dockable/dialogs-cursor" "")
-; (gtk_accel_path "/filters/filters-exposure" "")
-; (gtk_accel_path "/tools/tools-spacing-increase" "")
-; (gtk_accel_path "/tools/tools-foreground-select-brush-size-set" "")
-; (gtk_accel_path "/context/context-background-hue-decrease-skip" "")
-; (gtk_accel_path "/select/select-shrink" "")
-; (gtk_accel_path "/view/view-scroll-horizontal" "")
-; (gtk_accel_path "/select/select-fill-last-values" "")
-; (gtk_accel_path "/image/image-resize-to-selection" "")
-; (gtk_accel_path "/plug-in/script-fu-tile-blur" "")
-; (gtk_accel_path "/filters/filters-color-temperature" "")
-; (gtk_accel_path "/plug-in/script-fu-paste-as-pattern" "")
-; (gtk_accel_path "/tools/tools-paintbrush-aspect-ratio-set" "")
-; (gtk_accel_path "/plug-in/plug-in-gfig" "")
-; (gtk_accel_path "/context/context-foreground-hue-set" "")
-; (gtk_accel_path "/tools/tools-gradient" "g")
-(gtk_accel_path "/select/select-none" "d")
-; (gtk_accel_path "/edit/edit-named-cut" "")
-; (gtk_accel_path "/context/context-palette-select-set" "")
-; (gtk_accel_path "/channels/channels-select-next" "")
-; (gtk_accel_path "