diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2026-01-23 11:00:52 -0500 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2026-01-23 11:00:52 -0500 |
| commit | 6e8fbf36e07f9dd671880c4231131e0e38c2d384 (patch) | |
| tree | efb9f3cf29b7b31f915c7b29dd4785a8d893980e | |
| parent | 1df6a929cb0f540b2b8caf8f127afc3ad6c2468c (diff) | |
bash and more proj stuff
| -rw-r--r-- | .bash_profile | 11 | ||||
| -rw-r--r-- | .bashrc | 40 | ||||
| -rw-r--r-- | .config/sway/config | 6 | ||||
| -rw-r--r-- | README.md | 12 | ||||
| -rwxr-xr-x | scripts/focus-sway | 10 | ||||
| -rwxr-xr-x | scripts/open-emacs | 14 | ||||
| -rwxr-xr-x | scripts/open-emacs-project | 30 |
7 files changed, 113 insertions, 10 deletions
diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..ab83345 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,11 @@ +if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" +fi + +# Environment Variables +export EDITOR="/bin/emacs" + +# Auto-start sway on tty1 +if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then + exec sway +fi @@ -0,0 +1,40 @@ +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +. /etc/profile +export PATH="$HOME/dotfiles/scripts/:$PATH" + +# Completion +if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion +elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion +fi + +# History +export HISTSIZE=2000 +export HISTFILESIZE=2000 # Equivalent to SAVEHIST +export HISTCONTROL=ignorespace # Equivalent to setopt hist_ignore_space + +# Misc options +shopt -s autocd # Equivalent to setopt autocd +shopt -s extglob # Equivalent to setopt extendedglob + +# Disable Beep (Equivalent to unsetopt BEEP) +bind 'set bell-style none' + +# Aliases +alias ls='ls --color=auto' +alias grep='grep --color=auto' + +# Flow control +stty -ixon + +RESET='\[\e[0m\]' +BOLD='\[\e[1m\]' +COLOR_USER='\[\e[38;5;153m\]' +COLOR_DIR='\[\e[38;5;47m\]' +COLOR_GIT='\[\e[38;5;105m\]' +COLOR_END='\[\e[38;5;15m\]' + +PS1="${BOLD}${COLOR_USER}\u ${COLOR_DIR}\w ${COLOR_GIT}\$(git-ps1)${COLOR_END}$ ${RESET}" diff --git a/.config/sway/config b/.config/sway/config index 34e4671..496f818 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -56,6 +56,10 @@ default_border pixel # Kill focused window bindsym $mod+d kill + # emacs + bindsym $mod+e exec open-emacs + bindsym $mod+Shift+e exec open-emacs-project + # Start your launcher bindsym $mod+Return exec $menu @@ -72,7 +76,7 @@ default_border pixel bindsym $mod+Shift+c reload # Exit sway (logs you out of your Wayland session) - bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + bindsym $mod+Shift+q exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' # # Moving around: # @@ -26,12 +26,6 @@ Fonts and style: Config files can be installed by running `stow .` Since there are probably conflicts with your existing files, you can use the `--adopt` flag and then `git restore .`. ## TODO -- [x] Git branch in PS1 -- [x] Hyprpaper -- [x] Cursor -- [x] Status bar -- [x] Screenshot -- [x] Idle -- [x] Sound -- [x] Improve zsh completion and highlighting -- [ ] Emacs vterm and projectile detached/tmux like workflow +- [x] emacs project launcher script +- [ ] better sleeping +- [ ] battery reminders diff --git a/scripts/focus-sway b/scripts/focus-sway new file mode 100755 index 0000000..e3c63fb --- /dev/null +++ b/scripts/focus-sway @@ -0,0 +1,10 @@ +#!/bin/bash + +# Get available windows +windows=$(swaymsg -t get_tree | jq -r '.nodes[1].nodes[].nodes[] | .. | (.id|tostring) + " " + .name?' | grep -e "[0-9]* ." ) + +# Select window with rofi +selected=$(echo "$windows" | swenu -coil 10 | awk '{print $1}') + +# Tell sway to focus said window +swaymsg [con_id="$selected"] focus diff --git a/scripts/open-emacs b/scripts/open-emacs new file mode 100755 index 0000000..15b0794 --- /dev/null +++ b/scripts/open-emacs @@ -0,0 +1,14 @@ +#!/bin/bash + +emacsclient -e '(message "")' 2>&1 >/dev/null || emacs --daemon & + +emacs_attached() { + [ "$(emacsclient -e '(- (length (frame-list)) 1)')" = 0 ] && return 1 || return 0 +} + +if emacs_attached; then + # focus emacs + swaymsg [con_id="$(swaymsg -t get_tree | jq -r '.nodes[1].nodes[].nodes[] | .. | (.id|tostring) + " " + .name?' | grep -e "[0-9]* ." | grep Emacs | awk '{print $1}')"] focus +else + emacsclient -c +fi diff --git a/scripts/open-emacs-project b/scripts/open-emacs-project new file mode 100755 index 0000000..a5e4338 --- /dev/null +++ b/scripts/open-emacs-project @@ -0,0 +1,30 @@ +#!/bin/bash + +emacsclient -e '(message "")' 2>&1 >/dev/null || emacs --daemon & + +find_dirs() { + echo $(emacsclient -e "(proj--get-paths)" | sed -ze 's/(\(.*\))/\1/') | xargs -n1 +} + +emacs_attached() { + [ "$(emacsclient -e '(- (length (frame-list)) 1)')" = 0 ] && return 1 || return 0 +} + +switch_to() { + if emacs_attached; then + emacsclient -e "(proj-set-dir \"$1\")" + else + emacsclient -ce "(proj-set-dir \"$1\")" + fi +} + +# get selected +selected=$(find_dirs | swenu -coil 15) +[ -z "$selected" ] && exit 1; +selected="${selected/\~/$HOME}" + +# set emacs project +switch_to "$selected" + +# focus emacs +swaymsg [con_id="$(swaymsg -t get_tree | jq -r '.nodes[1].nodes[].nodes[] | .. | (.id|tostring) + " " + .name?' | grep -e "[0-9]* ." | grep Emacs | awk '{print $1}')"] focus |
