From 500d092c7a8436b63da44388c5ae9df01212dc05 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sat, 17 May 2025 23:05:51 +0200 Subject: [PATCH] Updated scripts --- bashrc_arch | 60 ++++++++++++++++++++++++++++++ bashrc => bashrc_ubuntu | 38 +++++++++---------- config/hypr/hyprland.conf | 8 ++-- config/hypr/hyprland_CMBOX.conf | 1 + config/hypr/hyprland_SIMONBOX.conf | 1 + config/hypr/hyprland_STEAMBOX.conf | 1 + config/nvim/init.lua | 1 + start_nvim.sh | 11 ++++++ tmux.conf | 17 ++++----- update_arch.sh | 18 ++++----- update_ubuntu.sh | 8 ++-- 11 files changed, 116 insertions(+), 48 deletions(-) create mode 100644 bashrc_arch rename bashrc => bashrc_ubuntu (76%) create mode 100755 start_nvim.sh diff --git a/bashrc_arch b/bashrc_arch new file mode 100644 index 0000000..0012fe1 --- /dev/null +++ b/bashrc_arch @@ -0,0 +1,60 @@ +# If not running interactively, don't do anything +case $- in +*i*) ;; +*) return ;; +esac + +# if [[ ! $TERM =~ linux ]]; then +# if [[ $TERM =~ tmux ]]; then +# source ~/.local/share/blesh/ble.sh --noattach +# fi +# fi + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.npm/bin:$PATH" + +EDITOR=/usr/bin/nvim +SUDO_EDITOR=/usr/bin/nvim +VISUAL=/usr/bin/nvim + +alias lz="lazygit" +alias vi="nvim" +alias vim="nvim" +alias ls="eza -1 -l --icons=auto --git-repos --git -h -g -o --no-permissions" +alias lsa="eza -1 -l --icons=auto --git-repos --git -h -g -o --no-permissions -a" +alias lss="eza -1 -l --icons=auto --git-repos --git -h -g --total-size -o --no-permissions -a" + +if [[ ! $TERM =~ linux ]]; then + # if [[ $TERM =~ tmux ]]; then + source ~/.fzf.bash + eval "$(zoxide init bash)" + eval "$(starship init bash)" + # else + # if which tmux >/dev/null 2>&1; then + # tmux new-session + # fi + # fi +else + wrappedhl +fi diff --git a/bashrc b/bashrc_ubuntu similarity index 76% rename from bashrc rename to bashrc_ubuntu index a94b287..7c640c8 100644 --- a/bashrc +++ b/bashrc_ubuntu @@ -4,11 +4,11 @@ case $- in *) return ;; esac -if [[ ! $TERM =~ linux ]]; then - if [[ $TERM =~ tmux ]]; then - source ~/.local/share/blesh/ble.sh --noattach - fi -fi +# if [[ ! $TERM =~ linux ]]; then +# if [[ $TERM =~ tmux ]]; then +# source ~/.local/share/blesh/ble.sh --noattach +# fi +# fi # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options @@ -52,20 +52,16 @@ alias lss="eza -1 -l --icons=auto --git-repos --git -h -g --total-size -o --no-p eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" -if [[ ! $TERM =~ linux ]]; then - if [[ $TERM =~ tmux ]]; then - source ~/.fzf.bash - eval "$(zoxide init bash)" - eval "$(starship init bash)" - [[ ! ${BLE_VERSION-} ]] || ble-attach - fi - - # TMUX - if [[ ! $TERM =~ tmux ]]; then - if which tmux >/dev/null 2>&1; then - tmux new-session - fi - fi -else - wrappedhl +if [[ $TERM =~ tmux ]]; then + source ~/.fzf.bash + eval "$(zoxide init bash)" + eval "$(starship init bash)" + # [[ ! ${BLE_VERSION-} ]] || ble-attach +fi + +# TMUX +if [[ ! $TERM =~ tmux ]]; then + if which tmux >/dev/null 2>&1; then + tmux new-session + fi fi diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index baf598d..b5537e7 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -6,6 +6,7 @@ monitor=,preffered,auto,1 ################### ### MY PROGRAMS ### ################### +$nvim = alacritty -e ~/linuxbox/start_nvim.sh $terminal = alacritty $browser = brave --new-window --hide-crash-restore-bubble @@ -18,11 +19,8 @@ exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec-once = udiskie exec-once = waybar -exec-once = systemctl --user start hypridle exec-once = systemctl --user start sunshine -exec-once = [workspace 1] $terminal tmux new-session -d 'nvim' - ############################# ### ENVIRONMENT VARIABLES ### ############################# @@ -173,6 +171,7 @@ bind = $mainMod, K, layoutmsg, preselect u bind = $mainMod, M, exec, com.moonlight_stream.Moonlight bind = $mainMod, F, exec, walker --modules applications bind = $mainMod CTRL, W, exec, $browser +bind = $mainMod , N, exec, $nvim bind = ALT, Tab, workspace, e+1 bind = ALT SHIFT, Tab, workspace, emptyn bind = , PRINT, exec, hyprshot -m region @@ -189,7 +188,6 @@ bind = $mainMod, W, togglespecialworkspace, web bind = $mainMod, V, togglespecialworkspace, mixer bind = $mainMod, A, togglespecialworkspace, ranger bind = $mainMod, T, togglespecialworkspace, timer -bind = $mainMod, N, togglespecialworkspace, nm # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l @@ -288,7 +286,7 @@ windowrulev2 = size 450 253, initialTitle:^(Discord Popout)$ windowrulev2 = float, onworkspace:special:discord windowrulev2 = float, initialTitle:^(.*Discord.*)$ windowrulev2 = size 80% 80%, initialTitle:^(.*Discord.*)$ -workspace = special:discord, on-created-empty:flatpak run io.github.equicord.equibop +workspace = special:discord, on-created-empty:flatpak run com.discordapp.Discord windowrulev2 = workspace special:discord, initialTitle:^(.*Discord.*)$ windowrulev2 = opacity 1.0 0.9, initialTitle:^(Discord Popout)$ windowrulev2 = float, initialTitle:^(Discord Popout)$ diff --git a/config/hypr/hyprland_CMBOX.conf b/config/hypr/hyprland_CMBOX.conf index 934b0a9..300d6b2 100644 --- a/config/hypr/hyprland_CMBOX.conf +++ b/config/hypr/hyprland_CMBOX.conf @@ -1 +1,2 @@ exec-once = /home/cm/linuxbox/set-xr18-2ch.sh +exec-once = [workspace 1] $nvim diff --git a/config/hypr/hyprland_SIMONBOX.conf b/config/hypr/hyprland_SIMONBOX.conf index 9a7e898..f74872d 100644 --- a/config/hypr/hyprland_SIMONBOX.conf +++ b/config/hypr/hyprland_SIMONBOX.conf @@ -1,3 +1,4 @@ exec-once = blueman-applet +exec-once = systemctl --user start hypridle env = GBM_BACKEND, nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME, nvidia diff --git a/config/hypr/hyprland_STEAMBOX.conf b/config/hypr/hyprland_STEAMBOX.conf index 6220d03..bdae69d 100644 --- a/config/hypr/hyprland_STEAMBOX.conf +++ b/config/hypr/hyprland_STEAMBOX.conf @@ -1,4 +1,5 @@ exec-once = /home/cm/linuxbox/set-xr18-2ch.sh exec-once = sudo udisksctl mount -b /dev/sda1 +exec-once = systemctl --user start hypridle env = GBM_BACKEND, nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME, nvidia diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 79266c0..aabefcd 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -366,6 +366,7 @@ require("lazy").setup({ -- GUI ------------------------------------------------------ { "mrjones2014/smart-splits.nvim", + lazy = false, opts = { at_edge = "stop", }, diff --git a/start_nvim.sh b/start_nvim.sh new file mode 100755 index 0000000..a8c294b --- /dev/null +++ b/start_nvim.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Name of the tmux session +SESSION_NAME="nvim" + +# Check if the tmux session already exists +if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then + tmux attach-session -t "$SESSION_NAME" +else + tmux new-session -s "$SESSION_NAME" "nvim" +fi diff --git a/tmux.conf b/tmux.conf index 2f43d16..431e3b0 100644 --- a/tmux.conf +++ b/tmux.conf @@ -32,9 +32,9 @@ set -g @smart-splits_resize_right_key 'M-l' # --"-- set -g @smart-splits_resize_step_size '3' # change the step-size for resizing. -bind -n C-M-h split-window -h -b -c "#{pane_current_path}" -bind -n C-M-l split-window -h -c "#{pane_current_path}" -bind -n C-M-j split-window -v -c "#{pane_current_path}" +bind -n C-M-h if -F "#{@pane-is-vim}" 'split-window -h -b -c "#{pane_current_path}" "nvim"' 'split-window -h -b' +bind -n C-M-l if -F "#{@pane-is-vim}" 'split-window -h -c "#{pane_current_path}" "nvim"' 'split-window -h' +bind -n C-M-j split-window -v -p 10 -c "#{pane_current_path}" bind -n C-M-k split-window -v -b -c "#{pane_current_path}" bind -n M-1 select-window -t 1 @@ -43,9 +43,8 @@ bind -n M-3 select-window -t 3 bind -n M-4 select-window -t 4 bind -n M-5 select-window -t 5 bind -n M-n select-window -n - -bind -n M-c new-window -bind -n M-x confirm kill-pane +bind -n M-Enter new-window +bind -n M-c kill-pane bind -n C-g display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "lazygit" @@ -71,6 +70,6 @@ set-window-option -g window-status-current-format '#[bg=#87afd7,fg=#000000] #I ' # Switching panes should change the foreground color but not border colors. set -g window-style 'bg=default,fg=#c6c6c6' -set -g window-active-style 'bg=default,fg=white' -set -g pane-border-style 'bg=#000000,fg=#262626' -set -g pane-active-border-style 'bg=#000000,fg=#000000' +set -g window-active-style 'bg=default,fg=#c6c6c6' +set -g pane-border-style 'bg=#262626,fg=#000000' +set -g pane-active-border-style 'bg=#262626,fg=#000000' diff --git a/update_arch.sh b/update_arch.sh index 04906c7..ca45b70 100755 --- a/update_arch.sh +++ b/update_arch.sh @@ -169,7 +169,7 @@ sudo pacman --noconfirm --needed -S timeshift bc git-lfs cmake gawk wget gettext yay --noconfirm -S --needed --aur downgrade rustup update stable rustup default stable -ln -sf ~/linuxbox/bashrc ~/.bashrc +ln -sf ~/linuxbox/bashrc_arch ~/.bashrc mkdir -p ~/.local/bin ln -sf ~/linuxbox/update_wrapper.sh ~/.local/bin/update sudo localectl set-locale LANG=en_US.UTF-8 @@ -268,13 +268,13 @@ if [ "${ROLES[TERMINAL]}" == "yes" ]; then ~/.fzf/install --all source ~/.fzf.bash - printf -- '\033[33m Installing ble.sh\n\033[37m' - if [ -d ~/ble.sh ]; then rm -rf ~/ble.sh; fi - cd ~ - git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git - make -C ble.sh install - if [ -d ~/ble.sh ]; then rm -rf ~/ble.sh; fi - ln -sf ~/linuxbox/blerc ~/.blerc + # printf -- '\033[33m Installing ble.sh\n\033[37m' + # if [ -d ~/ble.sh ]; then rm -rf ~/ble.sh; fi + # cd ~ + # git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git + # make -C ble.sh install + # if [ -d ~/ble.sh ]; then rm -rf ~/ble.sh; fi + # ln -sf ~/linuxbox/blerc ~/.blerc printf -- '\033[33m Installing LSP servers\n\033[37m' sudo pacman --noconfirm --needed -S prettier stylua python-black shfmt lua-language-server bash-language-server ccls vscode-html-languageserver vscode-json-languageserver marksman pyright yaml-language-server vscode-css-languageserver clang @@ -311,7 +311,7 @@ fi if [ "${ROLES[DESKTOP_BASE]}" == "yes" ]; then printf -- '\033[33m Installing desktop base utilities\n\033[37m' sudo pacman --noconfirm --needed -S feh - flatpak install -y flathub io.github.equicord.equibop + flatpak install -y flathub com.discordapp.Discord flatpak install -y flathub com.behringer.XAirEdit flatpak install -y flathub com.moonlight_stream.Moonlight flatpak install -y flathub com.github.vikdevelop.timer diff --git a/update_ubuntu.sh b/update_ubuntu.sh index fdc2957..164ce76 100755 --- a/update_ubuntu.sh +++ b/update_ubuntu.sh @@ -74,7 +74,7 @@ fi printf -- '\033[33m Installing system packages\n\033[37m' mkdir -p ~/.local/bin sudo apt install -y gawk imagemagick gpg ninja-build gettext cmake unzip curl build-essential libssl-dev libffi-dev file libudev-dev pkg-config locales btop ncdu ranger timeshift -ln -sf ~/linuxbox/bashrc ~/.bashrc +ln -sf ~/linuxbox/bashrc_ubuntu ~/.bashrc if [ "$WSL" == "yes" ]; then ln -sf ~/linuxbox/gitconfig.work ~/.gitconfig else @@ -319,9 +319,9 @@ printf -- '\033[33m Installing LSP servers\n\033[37m' printf -- '\033[33m Installing LSP servers\n\033[37m' rustup component add rust-analyzer clippy rustfmt sudo npm i -g bash-language-server pyright -sudo npm install --save-dev prettier -sudo apt install -y shfmt clangd clang-format -pipx install black +sudo npm install --save-dev prettier +sudo apt install -y shfmt clangd clang-format +pipx install black pipx install isort pipx install mdformat brew install lua-language-server marksman