diff --git a/Makefile b/Makefile index f2feca5..ffed8b5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ MAKEFILE_PATH ?= $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +all: install default: install install: diff --git a/apps/de/sway/config b/apps/de/sway/config index ae3f61e..3ddb841 100644 --- a/apps/de/sway/config +++ b/apps/de/sway/config @@ -12,6 +12,7 @@ set $right l set $term term set $fterm floating-term set $menu app-launcher +set $fileexplorer thunar output * bg $HOME/.wallpaper fill @@ -29,8 +30,9 @@ bindsym $mod+t exec $term bindsym $mod+Alt+Return exec urxvt bindsym $mod+Shift+Alt+Return exec kitty bindsym $mod+c kill -bindsym $mod+Shift+c kill # TODO: kill -9 +bindsym $mod+Shift+c kill # TODO: kill -9? bindsym $mod+Space exec $menu +bindsym $mod+e exec $fileexplorer bindsym $mod+Shift+r reload bindsym $mod+Control+Escape exit bindsym $mod+Shift+e exit @@ -44,7 +46,6 @@ bindsym $mod+$down focus down bindsym $mod+$up focus up bindsym $mod+$right focus right -# TODO: this should nudge if floating? bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up @@ -87,8 +88,6 @@ bindsym $mod+Shift+0 move container to workspace 10 bindsym $mod+b splith bindsym $mod+v splitv -bindsym $mod+e layout toggle split - bindsym $mod+Shift+f fullscreen bindsym $mod+f floating toggle bindsym $mod+s floating disable @@ -159,6 +158,7 @@ client.focused #66d9ef #66d9ef #66d9ef #66d9ef #66d9ef client.focused_inactive #111111 #111111 #ffffff #111111 #111111 client.unfocused #111111 #111111 #ffffff #111111 #111111 +exec swayidle -w timeout 300 'swaylock -f -c 000000' timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -f -c 000000' exec mako exec gammastep -t 6500:3500 -l 39.0:-94.5 exec_always makoctl reload @@ -166,5 +166,3 @@ exec_always notify-send -a "Sway" -i ~/.wallpaper "Sway configuration loaded." include $ENV_PATH/sway/config.d/* -exec mako -exec libinput-gestures -c $DOTFILES_PATH/apps/de/libinput/sway-gestures.conf diff --git a/apps/de/waybar/style.css b/apps/de/waybar/style.css index 23dc311..a6f4d73 100644 --- a/apps/de/waybar/style.css +++ b/apps/de/waybar/style.css @@ -43,9 +43,8 @@ window#waybar.empty { color: #111111; } -#workspaces button.empty { +#workspaces button.persistent { color: #666666; - /* background-color: #111111; */ } #workspaces button.urgent { diff --git a/apps/git/config b/apps/git/config index cd1bf95..2d67dba 100644 --- a/apps/git/config +++ b/apps/git/config @@ -64,3 +64,5 @@ [include] path = $ENV_PATH/gitconfig +[color] + ui = auto diff --git a/apps/rofi/theme b/apps/rofi/theme new file mode 100644 index 0000000..e5a7355 --- /dev/null +++ b/apps/rofi/theme @@ -0,0 +1,172 @@ +/** + * rofi -dump-theme output. + * Rofi version: 1.6.0 + **/ +* { + red: rgba ( 220, 50, 47, 100 % ); + selected-active-foreground: var(background); + lightfg: rgba ( 88, 104, 117, 100 % ); + separatorcolor: var(foreground); + urgent-foreground: var(red); + alternate-urgent-background: var(lightbg); + lightbg: rgba ( 238, 232, 213, 100 % ); + background-color: rgba ( 0, 0, 0, 0 % ); + border-color: var(foreground); + normal-background: var(background); + selected-urgent-background: var(red); + alternate-active-background: var(lightbg); + spacing: 2; + blue: rgba ( 38, 139, 210, 100 % ); + alternate-normal-foreground: var(foreground); + urgent-background: var(background); + selected-normal-foreground: var(lightbg); + active-foreground: var(blue); + background: rgba ( 253, 246, 227, 100 % ); + selected-active-background: var(blue); + active-background: var(background); + selected-normal-background: var(lightfg); + alternate-normal-background: var(lightbg); + foreground: rgba ( 0, 43, 54, 100 % ); + selected-urgent-foreground: var(background); + normal-foreground: var(foreground); + alternate-urgent-foreground: var(red); + alternate-active-foreground: var(blue); +} +element { + padding: 1px ; + spacing: 5px ; + border: 0; +} +element normal.normal { + background-color: var(normal-background); + text-color: var(normal-foreground); +} +element normal.urgent { + background-color: var(urgent-background); + text-color: var(urgent-foreground); +} +element normal.active { + background-color: var(active-background); + text-color: var(active-foreground); +} +element selected.normal { + background-color: var(selected-normal-background); + text-color: var(selected-normal-foreground); +} +element selected.urgent { + background-color: var(selected-urgent-background); + text-color: var(selected-urgent-foreground); +} +element selected.active { + background-color: var(selected-active-background); + text-color: var(selected-active-foreground); +} +element alternate.normal { + background-color: var(alternate-normal-background); + text-color: var(alternate-normal-foreground); +} +element alternate.urgent { + background-color: var(alternate-urgent-background); + text-color: var(alternate-urgent-foreground); +} +element alternate.active { + background-color: var(alternate-active-background); + text-color: var(alternate-active-foreground); +} +element-text { + background-color: rgba ( 0, 0, 0, 0 % ); + highlight: inherit; + text-color: inherit; +} +element-icon { + background-color: rgba ( 0, 0, 0, 0 % ); + size: 1.2000ch ; + text-color: inherit; +} +window { + padding: 0; + background-color: var(background); + border: 0; + font: 'Iosevka Term'; +} +mainbox { + padding: 0; + border: 0; +} +message { + padding: 1px ; + border-color: var(separatorcolor); + border: 0px ; +} +textbox { + text-color: var(foreground); +} +listview { + padding: 2px 0px 0px ; + scrollbar: false; + border-color: var(separatorcolor); + spacing: 5px ; + fixed-height: 0; + border: 0px ; +} +scrollbar { + width: 4px ; + padding: 0; + handle-width: 8px ; + border: 0; + handle-color: var(normal-foreground); +} +sidebar { + border-color: var(separatorcolor); + border: 2px dash 0px 0px ; +} +button { + spacing: 0; + text-color: var(normal-foreground); +} +button selected { + background-color: var(selected-normal-background); + text-color: var(selected-normal-foreground); +} +num-filtered-rows { + expand: false; + text-color: rgba ( 128, 128, 128, 100 % ); +} +num-rows { + expand: false; + text-color: rgba ( 128, 128, 128, 100 % ); +} +textbox-num-sep { + expand: false; + str: "/"; + text-color: rgba ( 128, 128, 128, 100 % ); +} +inputbar { + padding: 1px ; + spacing: 0px ; + text-color: var(normal-foreground); + children: [ prompt,textbox-prompt-colon,entry,num-filtered-rows,textbox-num-sep,num-rows,case-indicator ]; +} +case-indicator { + spacing: 0; + text-color: var(normal-foreground); +} +entry { + placeholder-color: rgba ( 128, 128, 128, 100 % ); + spacing: 0; + placeholder: "Type to filter"; + text-color: var(normal-foreground); +} +prompt { + spacing: 0; + text-color: var(normal-foreground); +} +textbox-prompt-colon { + margin: 0px 0.3000em 0.0000em 0.0000em ; + expand: false; + str: ":"; + text-color: inherit; +} +mode-switcher { + border: 0px ; +} diff --git a/apps/shell/fish/key-bindings.fish b/apps/shell/fish/key-bindings.fish index dfc06f8..6f1a54e 100755 --- a/apps/shell/fish/key-bindings.fish +++ b/apps/shell/fish/key-bindings.fish @@ -20,6 +20,7 @@ function fish_user_key_bindings bind -M insert \ce end-of-line bind -M insert \ca beginning-of-line bind -M insert \cw forward-word + bind -M insert \ct tmuxswitcher bind -M insert \cv edit_command_buffer bind -M default \cv edit_command_buffer diff --git a/apps/shell/tmux/conf b/apps/shell/tmux/conf index 5482a21..303a37b 100644 --- a/apps/shell/tmux/conf +++ b/apps/shell/tmux/conf @@ -108,6 +108,11 @@ bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" # bind-key -T copy-mode-vi "y" send -X copy-selection bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel -X 'clip' +# various control binds +bind-key n command-prompt -p "New Session:" "new-session -s '%1'" +bind-key K kill-pane +bind-key C-S-k kill-session -C + set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.config/tmux/plugins/" # list of plugins diff --git a/bin/archupdate b/bin/archupdate index 142feb4..2374972 100755 --- a/bin/archupdate +++ b/bin/archupdate @@ -1,6 +1,6 @@ #!/usr/bin/env bash -pacaur -Syyu --noconfirm --noedit +pacaur -Syu --noconfirm --noedit # TODO: update kernel with a flag? # yes | pacman -Syu && kexec -l --initrd=/boot/initramfs-linux.img /boot/vmlinuz-linux && kexec -e diff --git a/bin/clipshot b/bin/clipshot index 1e663ab..033999e 100755 --- a/bin/clipshot +++ b/bin/clipshot @@ -1,16 +1,30 @@ #!/usr/bin/env bash +set -x + +umask 077 +d="$(date +"%Y-%m-%d_%H-%M-%S")" +fn="$SCROTS_PATH/clipshot_$d.png" + if is_wayland; then - grim -g "$(slurp -d)" - | wl-copy + dim="$(slurp -d)" + if [ $? -eq 0 ]; then + grim -g "$dim" - | wl-copy + wl-paste -n > "$fn" + echo "$fn" + # grim -g "$dim" - | tee "$fn" | wl-copy -f + else + exit 1 + fi else pkill unclutter sleep 0.1 - fn="$SCROTS_PATH/clipshot_$(date +"%Y-%m-%d_%H-%M-%S").png" import "$fn" - chmod 700 "$fn" < "$fn" xclip -t image/png -i -selection clipboard < "$fn" xclip -t image/png -i -selection primary < "$fn" xclip -t image/png -i -selection secondary < "$fn" xclip -t image/png -i -selection buffer-cut unclutter & + echo "$fn" fi +set -x diff --git a/bin/fzf-history-weight b/bin/fzf-history-weight new file mode 100755 index 0000000..f5e3ff7 --- /dev/null +++ b/bin/fzf-history-weight @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +rf="$1" # history count record file +cf="$1" # all choices file + +touch "$record" +app="$( + < "$rf" awk 'NF{NF--};1' | cat - "$cf" | \ + sort | uniq -c | sort -nr | \ + sd '^\s+' '' | \ + cut -d' ' -f2- | \ + fzf + )" +echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE" +echo "$app" diff --git a/bin/fzfp b/bin/fzfp index 83d0943..9204aad 100755 --- a/bin/fzfp +++ b/bin/fzfp @@ -6,7 +6,11 @@ FZFP_PASS_DIR="$HOME/.password-store" FZFP_HEIGHT="${FZFP_HEIGHT:-40%}" FZFP_PROMPT="${FZFP_PROMPT:-"$FZFP_PASS_CMD@$FZFP_PASS_DIR> "}" FZFP_PASS_OPTS="${FZFP_PASS_OPTS:-}" + cd "$FZFP_PASS_DIR" || { echo "Could not cd to $FZFP_PASS_DIR" >&2; exit 1; } -pp="$(fd gpg | sd ".gpg" "" | fzf --height "$FZFP_HEIGHT" --prompt "$FZFP_PROMPT")" -"${FZFP_PASS_CMD}" $FZFP_PASS_OPTS "$@" "$pp" + +# TODO: weighted history (see ./launch) +"${FZFP_PASS_CMD}" $FZFP_PASS_OPTS "$@" \ + "$(fd gpg | sd ".gpg" "" | fzf --height "$FZFP_HEIGHT" --prompt "$FZFP_PROMPT")" + cd - >/dev/null || return 1 diff --git a/bin/pass-chooser b/bin/pass-chooser index f36e334..f870783 100755 --- a/bin/pass-chooser +++ b/bin/pass-chooser @@ -1,15 +1,3 @@ #!/usr/bin/env sh -# TODO: can we use fzfp here? -floating-term \ - bash -c " - cd $HOME/.password-store - fd gpg | - sd '.gpg\$' '' | - fzf --height 100% --prompt 'fzf-pass> ' > /tmp/fzfp-key - pass \"\$(cat /tmp/fzfp-key)\" | - head -n 1 | - sd '\s+\$' '' | - nohup clip &>/dev/null & - notify-send -a 'pass' 'Password in Clipboard' - " +env WAYLAND_DEBUG=1 FZFP_HEIGHT="100%" floating-term bash -c "fzfp | head -n 1 | wl-copy &" diff --git a/bin/pass-otp b/bin/pass-otp new file mode 100755 index 0000000..92f9a1d --- /dev/null +++ b/bin/pass-otp @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# TODO: check for pass + +key="$1"; shift +args=("$@") + +otp="$(set -e; pass "$key" 2>/dev/null | grep -Pi '^otp.*: ?.*$' | cut -d ':' -f 2 | sed 's/ //g')" +otp_status="$?" +[[ $otp_status != 0 ]] && { echo "pass command failed with exit code $otp_status"; exit 1; } +[[ -z $otp ]] && { echo "No OTP secret found for pass entry '$key'"; exit 2; } +simple-otp "$otp" diff --git a/bin/scrup b/bin/scrup index fb18a17..6aabed8 100755 --- a/bin/scrup +++ b/bin/scrup @@ -1,9 +1,19 @@ #!/usr/bin/env bash -f="${HOME}/.scrup.png" +set -x -pkill unclutter -sleep 0.1 -import "${f}" -upload "${f}" "scrup-$(date +%Y-%m-%d_%H-%M-%S).png" "scrots" -unclutter & +remote_dir="scrots" +url_prefix="https://files.lyte.dev/$remote_dir" + +u="$(uuid -v4)" +d="$(date +%Y-%m-%d_%H-%M-%S)" + +fn="$(clipshot)" +if [ $? -eq 0 ]; then + echo "Scrot captured. Uploading..." + upload "${fn}" "scrup-$u-$d.png" "$remote_dir" + echo "$url_prefix/scrup-$u-$d.png" | clip + notify-send "Scrot uploaded. URL in clipboard." +else + exit 1 +fi diff --git a/bin/simple-otp b/bin/simple-otp new file mode 100755 index 0000000..889fdc4 --- /dev/null +++ b/bin/simple-otp @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# TODO: check for oathtool + +key="$1"; shift +args=("$@") + +oathtool --totp=sha1 -b "$key" "${args[@]}" diff --git a/bin/upload b/bin/upload index 1cc7063..00970aa 100755 --- a/bin/upload +++ b/bin/upload @@ -2,13 +2,13 @@ # TODO: progress bar! -HOST="ld" +HOST="faceless" f="${1}" fname="${2:-$(basename "${f}")}" subdir="${3:-uploads}" -internal_dir="/home/daniel/services/data/files/${subdir}" -url="https://lyte.dev/${subdir}/${fname}" +internal_dir="/home/daniel/files/${subdir}" +url="https://files.lyte.dev/${subdir}/${fname}" [ "${f}" = "" ] && echo "No file provided. Exiting." >&2 && exit 2 [ ! -f "${f}" ] && echo "File '$f' does not exist. Exiting." >&2 && exit 1 @@ -18,11 +18,9 @@ if [ "$(curl -s -o /dev/null -w "%{http_code}" "${url}")" -eq 200 ]; then exit 3 fi -ssh ld mkdir -p "${internal_dir}" -rsync --progress --no-owner --no-group --no-perms --stats --ignore-existing "${f}" "${HOST}:${internal_dir}/${fname}" | tee "${HOME}/.upload.log" +ssh "$HOST" mkdir -p "${internal_dir}" +rsync --progress --no-owner --no-group --chmod=644 --ignore-existing "${f}" "${HOST}:${internal_dir}/${fname}" | tee "${HOME}/.upload.log" code="$?" -# shellcheck disable=SC2029 -ssh ld chmod a+r "${internal_dir}/${fname}" echo "Uploaded to: ${url}" if [ "$code" -ne 0 ]; then diff --git a/bofa.json b/bofa.json new file mode 100644 index 0000000..e4d4630 --- /dev/null +++ b/bofa.json @@ -0,0 +1,28 @@ +{ + "date": "d/m/Y", + "default_account": 1, + "delimiter": "comma", + "headers": true, + "ignore_duplicate_lines": true, + "ignore_duplicate_transactions": true, + "rules": true, + "skip_form": false, + "specifics": [ + "AppendHash" + ], + "roles": [ + "date_transaction", + "description", + "amount", + ], + "do_mapping": [true, true ,true], + "mapping": { + "3": { + "Savings Account": 3 + }, + "4": { + "Savings Account": 3 + } + }, + "version": 2 +} diff --git a/env/desktop/nix/base.nix b/env/desktop/nix/base.nix new file mode 100644 index 0000000..0ea6280 --- /dev/null +++ b/env/desktop/nix/base.nix @@ -0,0 +1,105 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + # TODO: fork? + (import "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos") + ]; + + home-manager.users.daniel = { + } + + # TODO: bootloader will vary by device + boot = { + supportedFilesystems = [ "exfat" ]; + loader = { + grub = { + enable = true; + version = 2; + device = "/dev/sda"; + }; + }; + }; + + networking = { + hostName = "nether"; + useDHCP = true; + firewall = { + allowedTCPPorts = [ 22 80 443 7770 ]; + allowedUDPPorts = [ 53 57 63 67 7770 ]; + # enable = false; + }; + }; + + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + time.timeZone = "America/Chicago"; + + environment = { + systemPackages = with pkgs; [ + wget lsof vim git curl fish fzf neovim + ]; + variables.EDITOR = "nvim"; + }; + + services = { + openssh.enable = true; + + xserver = { + enable = true; + layout = "us"; + libinput.enable = true; + desktopManager.plasma5.enable = true; + }; + }; + + fonts = { + enableFontDir = true; + enableGhostscriptFonts = true; + + fontconfig = { + enable = true; + antialias = true; + useEmbeddedBitmaps = true; + + defaultFonts = { + serif = [ "Iosevka Type" ]; + sansSerif = [ "Iosevka Type" ]; + monospace = [ "Iosevka Type" ]; + }; + }; + + fonts = with pkgs; [ + iosevka + nerdfonts + ]; + }; + + sound.enable = true; + hardware.pulseaudio.enable = true; + + users.extraUsers.daniel = { + isNormalUser = true; + group = "users"; + extraGroups = [ "wheel" ]; + home = "/home/daniel/.home"; + shell = pkgs.fish; + createHome = true; + uid = 1000; + }; + + nixpkgs.config = { + allowUnfree = true; + }; + + system.stateVersion = "20.03"; +} diff --git a/env/laptop/sway/config.d/main b/env/laptop/sway/config.d/main index 189497b..048496c 100644 --- a/env/laptop/sway/config.d/main +++ b/env/laptop/sway/config.d/main @@ -14,3 +14,5 @@ input type:touchpad { input type:keyboard { xkb_options ctrl:nocaps } + +exec libinput-gestures -c $DOTFILES_PATH/apps/de/libinput/sway-gestures.conf diff --git a/readme.md b/readme.md index 6e58e88..6c82ca9 100644 --- a/readme.md +++ b/readme.md @@ -61,5 +61,5 @@ cd '~/.config/dotfiles' && ./setup.bash # follow the instructions! [upstream]: https://git.faceless.lytedev.io/lytedev/dotfiles [github]: https://github.com/lytedev/dotfiles -[desktop-screenshot]: https://lyte.dev/unix/desktop-screenshot.png +[desktop-screenshot]: https://files.lyte.dev/unix/desktop-screenshot.png [1]: https://smallstep.com/blog/ssh-tricks-and-tips/