From b8a49b9fab3645718dc8ec8b1743cf2139c943d5 Mon Sep 17 00:00:00 2001 From: Alexander Bell Date: Fri, 16 May 2025 23:01:16 +0200 Subject: [PATCH] autoboot directly into hyprlock and skipping login --- .bash_profile | 3 + .bashrc | 155 ++++++++++++++++++++++++++++++++++++- .config/hypr/hyprland.conf | 2 +- .config/hypr/hyprlock.conf | 2 +- install.bash | 21 ++--- 5 files changed, 170 insertions(+), 13 deletions(-) diff --git a/.bash_profile b/.bash_profile index 503d7b1..8fa2cf1 100644 --- a/.bash_profile +++ b/.bash_profile @@ -2,6 +2,9 @@ # ~/.bash_profile # +# Launch Hyprland and Hyprlock on launch +[[ -z $DISPLAY && $(tty) = /dev/tty1 ]] && exec Hyprland + [[ -f ~/.bashrc ]] && . ~/.bashrc # Set default theme to dark diff --git a/.bashrc b/.bashrc index 6686549..eff22f6 100644 --- a/.bashrc +++ b/.bashrc @@ -5,12 +5,78 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return +####################################################### # Aliases +####################################################### + alias ls='ls --color=auto' alias grep='grep --color=auto' PS1='[\u@\h \W]\$ ' alias l='ls -la' alias lg='lazygit' +alias mkdir='mkdir -p' + +# Edit this .bashrc file +alias ebrc='edit ~/.bashrc' + +# Change directory aliases +alias home='cd ~' +alias cd..='cd ..' +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' + +# aliases for multiple directory listing commands +alias la='ls -Alh' # show hidden files +alias ls='ls -aFh --color=always' # add colors and file type extensions +alias lx='ls -lXBh' # sort by extension +alias lk='ls -lSrh' # sort by size +alias lc='ls -ltcrh' # sort by change time +alias lu='ls -lturh' # sort by access time +alias lr='ls -lRh' # recursive ls +alias lt='ls -ltrh' # sort by date +alias lm='ls -alh |more' # pipe through 'more' +alias lw='ls -xAh' # wide listing format +alias ll='ls -Fls' # long listing format +alias labc='ls -lap' # alphabetical sort +alias lf="ls -l | egrep -v '^d'" # files only +alias ldir="ls -l | egrep '^d'" # directories only +alias lla='ls -Al' # List and Hidden Files +alias las='ls -A' # Hidden Files +alias lls='ls -l' # List + +# Set the default editor +if command -v nvim &> /dev/null; then + export EDITOR=nvim + export VISUAL=nvim + alias vim='nvim' + alias vi='nvim' + alias svi='sudo nvim' + alias vis='nvim "+set si"' +else + export EDITOR=vim + export VISUAL=vim +fi +alias spico='sudo pico' +alias snano='sudo nano' + +# Search files in the current folder +alias f="find . | grep " + +# Search command line history +alias h="history | grep " + +# Show open ports +alias openports='netstat -nape --inet' + +# Search running processes +alias p="ps aux | grep " +alias topcpu="/bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10" + +####################################################### +# VARIABL EXPORTS +####################################################### # Fix Electron scaling issues by forcing wayland export ELECTRON_ENABLE_OZONE=1 @@ -21,6 +87,41 @@ export GDK_DPI_SCALE=1 # Force Firefox to run in wayland export MOZ_ENABLE_WAYLAND=1 +# Expand the history size +export HISTFILESIZE=10000 +export HISTSIZE=500 +export HISTTIMEFORMAT="%F %T" # add timestamp to history + +# Don't put duplicate lines in the history and do not add lines that start with a space +export HISTCONTROL=erasedups:ignoredups:ignorespace + +# Causes bash to append to history instead of overwriting it so if you start a new terminal, you have old session history +shopt -s histappend +PROMPT_COMMAND='history -a' + +####################################################### +# Launch on boot +####################################################### + +# Fastfetch +if command -v fastfetch &> /dev/null; then + # Only run fastfetch if we're in an interactive shell + if [[ $- == *i* ]]; then + fastfetch + fi +fi + +# Disable the bell +if [[ $iatest -gt 0 ]]; then bind "set bell-style visible"; fi + +# Use bash-completion, if available +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion + +####################################################### +# Functions +####################################################### + # Yazi function y() { local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd @@ -31,4 +132,56 @@ function y() { rm -f -- "$tmp" } -fastfetch +# Extracts any archive(s) (if unp isn't installed) +extract() { + for archive in "$@"; do + if [ -f "$archive" ]; then + case $archive in + *.tar.bz2) tar xvjf $archive ;; + *.tar.gz) tar xvzf $archive ;; + *.bz2) bunzip2 $archive ;; + *.rar) rar x $archive ;; + *.gz) gunzip $archive ;; + *.tar) tar xvf $archive ;; + *.tbz2) tar xvjf $archive ;; + *.tgz) tar xvzf $archive ;; + *.zip) unzip $archive ;; + *.Z) uncompress $archive ;; + *.7z) 7z x $archive ;; + *) echo "don't know how to extract '$archive'..." ;; + esac + else + echo "'$archive' is not a valid file!" + fi + done +} + +# Searches for text in all files in the current folder +ftext() { + # -i case-insensitive + # -I ignore binary files + # -H causes filename to be printed + # -r recursive search + # -n causes line number to be printed + # optional: -F treat search term as a literal, not a regular expression + # optional: -l only print filenames and not the matching lines ex. grep -irl "$1" * + grep -iIHrn --color=always "$1" . | less -r +} + +####################################################### +# Ricing +####################################################### + +# To have colors for ls and all grep commands such as grep, egrep and zgrep +export CLICOLOR=1 +export LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.xml=00;31:' + +# Check if ripgrep is installed and change grep to ripgrep if available +if command -v rg &> /dev/null; then + # Alias grep to rg if ripgrep is installed + alias grep='rg' +else + # Alias grep to /usr/bin/grep with GREP_OPTIONS if ripgrep is not installed + alias grep="/usr/bin/grep $GREP_OPTIONS" +fi +unset GREP_OPTIONS diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index a28abcb..6e703d5 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -31,7 +31,7 @@ $lockscreen = hyprlock # Autostart necessary processes (like notifications daemons, status bars, etc.) exec-once = waybar -exec-once = hyprpaper & hypridle +exec-once = hyprpaper & hypridle & $lockscreen exec-once = dunst exec-once = [workspace 2 silent] $browser exec-once = [workspace 1 silent] $terminal diff --git a/.config/hypr/hyprlock.conf b/.config/hypr/hyprlock.conf index 615ce5b..2c166d3 100644 --- a/.config/hypr/hyprlock.conf +++ b/.config/hypr/hyprlock.conf @@ -45,7 +45,7 @@ input-field { outline_thickness = 3 inner_color = rgba(0, 0, 0, 0.3) - outer_color = rgba(f26d00ff) rgba(fcd705ff) 45deg + outer_color = rgba(f26d00ff) rgba(fce4b8ff) 45deg check_color = rgba(00ff99ee) rgba(ff6633ee) 120deg fail_color = rgba(ff6633ee) rgba(ff0066ee) 40deg diff --git a/install.bash b/install.bash index dc2e760..9f59030 100644 --- a/install.bash +++ b/install.bash @@ -8,10 +8,11 @@ ln -s ~/dotfiles/.conf/hyprpaper ~/.config/hyprpaper ln -s ~/dotfiles/.conf/fastfetch ~/.config/fastfetch ln -s ~/dotfiles/.conf/mimeapps.list ~/.config/mimeapps.list ln -s ~/dotfiles/wallpapers ~/wallpapers +ln -s ~/dotfiles/.fonts ~/.fonts -# Move application .desktop files -# Desktop files are used to create recognizable applications or force apps to use wayland -cp .local/share/applications/* ~/.local/share/applications/ +# Fix Electron Apps Wayland scaling issue: +# If app doesn't work, add "--no-sandbox" to app in /usr/share/applications/ +ln -s ~/dotfiles/.conf/environment.d ~/.config/environment.d # Hyperland stuff # uwsm needed for launching hypr on boot @@ -27,16 +28,16 @@ pacman -S yazi ffmpeg poppler fd p7zip # Use amdctl for undervolting pacman -S btop ripgrep bat neovim nano grim slurp dust fastfetch imv wl-clipboard amdctl -# Font -# Delete all fonts in /usr/share/fonts -pacman -S ttf-inconsolata-lgc-nerd - # Networking # For connecting to eduroam install config with this script: https://cat.eduroam.org/ # wpa_supplicant is dependency of networkmanager that was not installed for some reason. # Run networkmanager with "nmcli dev wifi connect 'ssid' password 'password'" pacman -S networkmanager wpa_supplicant -# Fix Electron Apps Wayland scaling issue: -# If app doesn't work, add "--no-sandbox" to app in /usr/share/applications/ -ln -s ~/dotfiles/.conf/environment.d ~/.config/environment.d +# Launch directly into hyprlock and skipping login +echo '[Service]\nExecStart=\nExecStart=-/sbin/agetty --noreset --noclear --autologin alex %I $TERM' | sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf > /dev/null && sudo systemctl enable getty@tty1 + +################################################################### +# MANUAL CONFIGURATION REQUIRED +################################################################### +