From b3460e92ce916d7a0f46066ab707d6c1cd46cab0 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 5 Nov 2020 22:29:58 -0600 Subject: [PATCH] Fix tmuxswitcher --- apps/de/libinput/sway-gestures.conf | 4 ++-- apps/de/sway/config | 17 ++++++++++++- apps/shell/fish/aliases.fish | 4 ++++ apps/shell/fish/config.fish | 37 +++++++---------------------- bin/lib/sudo_setup | 2 ++ bin/tmuxswitcher | 10 +++++--- bin/vimpager | 7 ------ env/desktop/sway/config.d/main | 5 ---- env/laptop/sway/config.d/main | 14 ----------- 9 files changed, 40 insertions(+), 60 deletions(-) delete mode 100755 bin/vimpager delete mode 100644 env/desktop/sway/config.d/main diff --git a/apps/de/libinput/sway-gestures.conf b/apps/de/libinput/sway-gestures.conf index 5b307fe..a355da2 100644 --- a/apps/de/libinput/sway-gestures.conf +++ b/apps/de/libinput/sway-gestures.conf @@ -1,5 +1,5 @@ -gesture swipe left 3 bspc desktop -f next -gesture swipe right 3 bspc desktop -f prev +# TODO: sway gestures? +gesture swipe left 3 swaymsg workspace back_and_forth gesture swipe right 2 swaymsg seat seat0 cursor press BTN_EXTRA && swaymsg seat seat0 cursor release BTN_EXTRA gesture swipe left 2 swaymsg seat seat0 cursor press BTN_SIDE && swaymsg seat seat0 cursor release BTN_SIDE diff --git a/apps/de/sway/config b/apps/de/sway/config index ee9fa40..0d84237 100644 --- a/apps/de/sway/config +++ b/apps/de/sway/config @@ -17,6 +17,17 @@ focus_follows_mouse no input type:keyboard { repeat_delay 200 repeat_rate 60 + # I have a keyboard that takes care of this on my workstation, so we only enable + # this on laptops + # xkb_options ctrl:nocaps +} + +input type:touchpad { + dwt enabled + tap enabled + natural_scroll enabled + middle_emulation enabled + pointer_accel 0.33 } bindsym $mod+control+space exec makoctl dismiss @@ -151,4 +162,8 @@ bar { swaybar_command waybar } -include $ENV_PATH/sway/config.d/main +# TODO: exec_always? +exec gammastep -t 6500:3500 -l 39.0:-94.5 +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' + +include $HOME/.env/sway/config.d/main diff --git a/apps/shell/fish/aliases.fish b/apps/shell/fish/aliases.fish index 41ff505..f9591ac 100755 --- a/apps/shell/fish/aliases.fish +++ b/apps/shell/fish/aliases.fish @@ -166,3 +166,7 @@ end # grep aliases alias rg "rg --text" alias grep "rg" + +alias vim nvim +alias vi nvim + diff --git a/apps/shell/fish/config.fish b/apps/shell/fish/config.fish index 1bcbe59..3a44e25 100755 --- a/apps/shell/fish/config.fish +++ b/apps/shell/fish/config.fish @@ -17,27 +17,15 @@ set -Ux TERMINAL kitty set -Ux BROWSER firefox-developer-edition set -Ux ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_bytes 1024000" # iex history set -Ux LESS "-r" - -# set our EDITOR to neovim if we've got it -set -Ux EDITOR vim -if has_command nvim - set -Ux EDITOR nvim - set -Ux MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!' -end -alias ovim 'command vim' # always have an alias to normal vim just in case -alias vim $EDITOR -alias vi $EDITOR - -# more sane ls colors -set -Ux LS_COLORS 'ow=01;36;40' +set -Ux LS_COLORS 'ow=01;36;40' # more sane ls colors +set -Ux EDITOR nvim +set -Ux MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!' has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git' test -f ~/.fzf/shell/key-bindings.fish && source ~/.fzf/shell/key-bindings.fish -function fish_greeting - fortune -end +function fish_greeting; fortune; end # we assume the user uses "$HOME" to just store their mess of dotfiles and other # nonsense that clutters it up and that they have a preferred starting @@ -53,21 +41,14 @@ else if test -f /opt/asdf-vm/asdf.fish source /opt/asdf-vm/asdf.fish end -# load a per-device config last so anything can be overridden +if set -q $__HM_SESS_VARS_SOURCED; and test -f $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh + exec bash -c "source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh; exec fish" +end + +# load a per-device, secret config last so anything can be overridden for cf in config.fish .hidden/config.fish set f $ENV_PATH/$cf test -f $f && source $f end mkdir -p $NOTES_PATH $USER_LOGS_PATH $SCROTS_PATH - -# start a tmux session by default if possible and we're not already in -# a terminal multiplexer -if has_command tmux && string match -v -q '*tmux*' $TERM && string match -v -q '*screen*' $TERM - tmux start-server - tmux attach -t default || tmux new -s default -end - -if set -q $__HM_SESS_VARS_SOURCED; and test -f $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh - exec bash -c "source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh; exec fish" -end diff --git a/bin/lib/sudo_setup b/bin/lib/sudo_setup index 2afc834..f730ba0 100755 --- a/bin/lib/sudo_setup +++ b/bin/lib/sudo_setup @@ -9,6 +9,8 @@ fi dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/../../" && pwd) source "${dfp}/bin/lib/setup_helpers.bash" +cp "$dfp/apps/de/sway/dm-entry" "/usr/share/wayland-sessions/lsway.desktop" + links=( # display manager files "apps/de/sway/init" "/usr/bin/sway-lytedev" diff --git a/bin/tmuxswitcher b/bin/tmuxswitcher index 7fb87f4..73c9882 100755 --- a/bin/tmuxswitcher +++ b/bin/tmuxswitcher @@ -1,9 +1,13 @@ #!/usr/bin/env sh fmt='#{session_id}:|#S|(#{session_attached} attached)' -{ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \ +t="tmux switch-client -t" +[ -z "$TMUX" ] && t="tmux attach-session -t" + +sess="$({ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \ | awk '!seen[$1]++' \ | column -t -s'|' \ | fzf -q '$' --reverse --prompt 'switch session: ' -1 \ - | cut -d':' -f1 \ - | xargs tmux switch-client -t + | cut -d':' -f1)" + +$t $sess diff --git a/bin/vimpager b/bin/vimpager deleted file mode 100755 index 106fd04..0000000 --- a/bin/vimpager +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env sh - -nvim \ - -c 'let nosession=1' \ - -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' \ - "$@" \ - - diff --git a/env/desktop/sway/config.d/main b/env/desktop/sway/config.d/main deleted file mode 100644 index 9e2d74f..0000000 --- a/env/desktop/sway/config.d/main +++ /dev/null @@ -1,5 +0,0 @@ -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' diff --git a/env/laptop/sway/config.d/main b/env/laptop/sway/config.d/main index 383168f..5f4b763 100644 --- a/env/laptop/sway/config.d/main +++ b/env/laptop/sway/config.d/main @@ -1,19 +1,5 @@ -output eDP-1 res 1600x900 pos 0 0 - exec libinput-gestures -c $HOME/.config/dotfiles/apps/de/libinput/sway-gestures.conf -exec gammastep -t 6500:3500 -l 39.0:-94.5 -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' - bindswitch lid:toggle exec swaylock - -input type:touchpad { - dwt enabled - tap enabled - natural_scroll enabled - middle_emulation enabled - pointer_accel 0.33 -} - input type:keyboard { xkb_options ctrl:nocaps }