Switch to alacritty, spruce up i3 config

work
Matthew Ess 2020-01-01 19:31:37 -05:00
parent 70ae873ac1
commit 1088e9171b
3 changed files with 124 additions and 8 deletions

View File

@ -44,7 +44,11 @@
fonts = { fonts = {
enableDefaultFonts = true; enableDefaultFonts = true;
fonts = with pkgs; [ source-code-pro fira-code ]; fonts = with pkgs; [ source-code-pro fira-code fira-code-symbols ];
fontconfig = {
enable = true;
defaultFonts = { monospace = [ "Fira Code" ]; };
};
}; };
# Select internationalisation properties. # Select internationalisation properties.
@ -70,11 +74,6 @@
wget wget
]; ];
environment.variables = {
EDITOR = "vim";
BROWSER = "firefox";
};
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;

View File

@ -7,6 +7,11 @@ let
in { in {
home = { home = {
sessionVariables = {
EDITOR = "vim";
BROWSER = "firefox";
TERMINAL = "alacritty";
};
packages = with pkgs; [ packages = with pkgs; [
# nix utilities # nix utilities
nixfmt nixfmt
@ -44,10 +49,15 @@ in {
jorgebucaran/fish-getopts jorgebucaran/fish-getopts
matthewess/fish-autovenv matthewess/fish-autovenv
''; '';
".config/fish/functions/systemctl.fish".source = ./scripts/systemctl.fish;
}; };
}; };
nixpkgs = { config.allowUnfree = true; }; nixpkgs = { config.allowUnfree = true; };
programs = { programs = {
alacritty = {
enable = true;
settings = { font.normal.family = "Fira Code"; };
};
bat.enable = true; bat.enable = true;
broot.enable = true; broot.enable = true;
command-not-found.enable = true; command-not-found.enable = true;
@ -63,6 +73,7 @@ in {
curl https://git.io/fisher --create-dirs -sLo $XDG_CONFIG_HOME/fish/functions/fisher.fish curl https://git.io/fisher --create-dirs -sLo $XDG_CONFIG_HOME/fish/functions/fisher.fish
fish -c fisher fish -c fisher
end end
fish_vi_key_bindings
set VIRTUAL_ENV_DISABLE_PROMPT true set VIRTUAL_ENV_DISABLE_PROMPT true
''; '';
}; };
@ -130,7 +141,6 @@ in {
}; };
ssh.enable = true; ssh.enable = true;
starship.enable = true; starship.enable = true;
termite.enable = true;
}; };
services = { services = {
gnome-keyring.enable = true; gnome-keyring.enable = true;
@ -150,13 +160,34 @@ in {
i3 = { i3 = {
enable = true; enable = true;
config = rec { config = rec {
assigns = {
"1: web" = [{ class = "Firefox"; }];
"2: devel" = [ { class = "Alacritty"; } { class = "Atom"; } ];
};
modifier = "Mod4"; modifier = "Mod4";
keybindings = lib.mkOptionDefault { keybindings = lib.mkOptionDefault {
"${modifier}+c" = "exec 'CM_ONESHOT=1 clipmenud'"; "${modifier}+c" = "exec CM_ONESHOT=1 clipmenud";
"${modifier}+v" = "exec clipmenu"; "${modifier}+v" = "exec clipmenu";
"${modifier}+Escape" = "exec i3lock-fancy"; "${modifier}+Escape" = "exec i3lock-fancy";
"${modifier}+0" = "workspace number 0";
"${modifier}+1" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
}; };
workspaceLayout = "tabbed";
}; };
extraConfig = ''
exec --no-startup-id firefox
exec --no-startup-id atom
exec --no-startup-id alacritty
for_window [class="Firefox"] focus
'';
}; };
}; };
}; };

86
scripts/systemctl.fish Normal file
View File

@ -0,0 +1,86 @@
set -l systemd_version (systemctl --version | string match "systemd*" | string replace -r "\D*(\d+)\D.*" '$1')
set -l commands list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart \
isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help \
reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump \
list-dependencies snapshot delete daemon-reload daemon-reexec show-environment set-environment unset-environment \
default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root list-timers \
set-property
if test $systemd_version -gt 208 2>/dev/null
set commands $commands cat
if test $systemd_version -gt 217 2>/dev/null
set commands $commands edit
end
end
set -l types services sockets mounts service_paths targets automounts timers
function __fish_systemd_properties
# We need to call the main systemd binary (the thing that is run as PID1).
# Unfortunately, it's usually not in $PATH.
if test -f /usr/lib/systemd/systemd
/usr/lib/systemd/systemd --dump-configuration-items | string replace -rf '(.+)=(.+)$' '$1\t$2'
else if test -f /lib/systemd/systemd # Debian has not merged /lib and /usr/lib
/lib/systemd/systemd --dump-configuration-items | string replace -rf '(.+)=(.+)$' '$1\t$2'
end
end
# All systemctl commands
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a "$commands"
#### Units commands
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a start -d 'Start one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a stop -d 'Stop one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a restart -d 'Restart one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a status -d 'Runtime status about one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a enable -d 'Enable one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a disable -d 'Disable one or more units'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a isolate -d 'Start a unit and dependencies and disable all others'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a set-default -d 'Set the default target to boot into'
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a set-property -d 'Sets one or more properties of a unit'
# Command completion done via argparse.
complete -c systemctl -a '(_fish_systemctl)' -f
# These "--x=help" outputs always have lines like "Available unit types:". We use the fact that they end in a ":" to filter them out.
complete -f -c systemctl -s t -l type -d 'List of unit types' -xa '(systemctl --type=help --no-legend --no-pager | string match -v "*:")'
complete -f -c systemctl -l state -d 'List of unit states' -xa '(systemctl --state=help --no-legend --no-pager | string match -v "*:")'
complete -f -c systemctl -s p -l property -a '(__fish_systemd_properties)'
complete -f -c systemctl -s a -l all -d 'Show all units or properties'
complete -f -c systemctl -s r -l recursive -d 'Show also units of local containers'
complete -f -c systemctl -l reverse -d 'Show reverse dependencies between units'
complete -f -c systemctl -l after -d 'Show units ordered before specified unit' -n "__fish_seen_subcommand_from list-dependencies"
complete -f -c systemctl -l before -d 'Show units ordered after specified unit' -n "__fish_seen_subcommand_from list-dependencies"
complete -f -c systemctl -s l -l full -d 'Do not ellipsize anything'
complete -f -c systemctl -l show-types -d 'Show the type of the socket'
complete -f -c systemctl -l job-mode -d 'How to deal with queued jobs' -xa 'fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush'
complete -f -c systemctl -s i -l ignore-inhibitors -d 'Ignore inhibitor locks on shutdown or sleep'
complete -f -c systemctl -s q -l quiet -d 'Suppress output to STDOUT'
complete -f -c systemctl -l no-block -d 'Do not wait for the requested operation to finish'
complete -f -c systemctl -l no-legend -d 'Do not print header and footer'
# system and user/global are mutually exclusive
complete -f -c systemctl -l user -d 'Talk to the service manager of the calling user' -n "not __fish_contains_opt system"
complete -f -c systemctl -l system -d 'Talk to the service manager of the system.' -n "not __fish_contains_opt system global"
complete -f -c systemctl -l global -d 'Enable or disable for all users' -n "not __fish_contains_opt system"
complete -f -c systemctl -l no-wall -d 'Do not send wall message before halt'
complete -f -c systemctl -l no-reload -d 'Do not reload daemon configuration'
complete -f -c systemctl -l no-ask-password -d 'Disable asking for password'
complete -f -c systemctl -l kill-who -d 'Send signal to which process' -xa 'main control all'
complete -f -c systemctl -s s -l signal -d 'Which signal to send' -xa 'SIGTERM SIGINT SIGSTOP SIGKILL SIGHUP SIGCONT'
complete -f -c systemctl -s f -l force -d 'Overwrite conflicting existing symlinks'
# --root needs a path
complete -r -c systemctl -l root -d 'Use alternative root path'
complete -f -c systemctl -l runtime -d 'Make changes only temporarily'
complete -f -r -c systemctl -s n -l lines -d 'Number of journal lines to show' -a "(seq 1 1000)"
complete -f -c systemctl -s o -l output -d 'Control journal formatting' -xa 'short short-monotonic verbose export json json-pretty json-sse cat'
complete -f -c systemctl -l plain -d 'list-dependencies flat, not as tree'
complete -f -c systemctl -s H -l host -d 'Execute the operation on a remote host' -a "(__fish_print_hostnames)"
complete -x -c systemctl -s M -l machine -d 'Execute operation on a VM or container' -a "(__fish_systemd_machines)"
complete -f -c systemctl -s h -l help -d 'Print a short help and exit'
complete -f -c systemctl -l version -d 'Print a short version and exit'
complete -f -c systemctl -l no-pager -d 'Do not pipe output into a pager'
# New options since systemd 220
if test $systemd_version -gt 219 2>/dev/null
complete -f -c systemctl -l firmware-setup -n "__fish_seen_subcommand_from reboot" -d "Reboot to EFI setup"
complete -f -c systemctl -l now -n "__fish_seen_subcommand_from enable" -d "Also start unit"
complete -f -c systemctl -l now -n "__fish_seen_subcommand_from disable mask" -d "Also stop unit"
end