From 124db298f257dae26bd7db5e964b5daf41df24e1 Mon Sep 17 00:00:00 2001 From: Aaron Helton Date: Fri, 7 Oct 2022 22:23:42 -0400 Subject: [PATCH] More sensible setup and add a system file --- bin/setup-configs.sh | 37 ++++++++++++++++++++++ bin/setup-packages.sh | 44 ++++++++++++++++++++++++++ bin/setup-sys.sh | 5 +++ config => configs/i3config | 24 ++------------- tmux.conf => configs/tmux.conf | 0 vimrc => configs/vimrc | 0 setup.sh | 56 ++++------------------------------ sys-files/logind.conf | 50 ++++++++++++++++++++++++++++++ 8 files changed, 145 insertions(+), 71 deletions(-) create mode 100755 bin/setup-configs.sh create mode 100755 bin/setup-packages.sh create mode 100755 bin/setup-sys.sh rename config => configs/i3config (93%) rename tmux.conf => configs/tmux.conf (100%) rename vimrc => configs/vimrc (100%) create mode 100644 sys-files/logind.conf diff --git a/bin/setup-configs.sh b/bin/setup-configs.sh new file mode 100755 index 0000000..b489887 --- /dev/null +++ b/bin/setup-configs.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Setup the various configuration files throughout the system and install any additional +# git packages or files necessary to make them work. + +CWD=$(pwd) + +link_config_file () { + mv $2 $2.bak + ln -s $CWD/configs/$1 $2 +} + +CWD=$(pwd) +echo "Current working directory is:" +echo $CWD + +# Assume zsh is installed and install oh-my-zsh and change shell +curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh > install_zsh.sh +chmod +x ./install_zsh.sh +RUNZSH='no' ./install_zsh.sh +rm ./install_zsh.sh + +# # Install the NERDFonts patched fonts for use in powerline packages +# cd $HOME +# mkdir -p ./src/git +# cd ./src/git +# git clone https://github.com/ryanoasis/nerd-fonts --depth=1 +# cd ./nerd-fonts +# ./install.sh +# cd $CWD +# +# # Install Vundle for use with Vim +# git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim + +# Symlink necessary config files +link_config_file i3config $HOME/.config/i3/config +link_config_file vimrc $HOME/.vimrc +link_config_file tmux.conf $HOME/.tmux.conf diff --git a/bin/setup-packages.sh b/bin/setup-packages.sh new file mode 100755 index 0000000..626b08e --- /dev/null +++ b/bin/setup-packages.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +if [ "$EUID" -eq 0 ] + then echo "Please do not run this script as root." + exit +fi + +packages=( + # Base Packages + "base" + + # Terminal Programs + "zsh" + "tmux" + "screen" + "nmon" + "htop" + "gvim" + "terminator" + + # "Desktop Environment" lol + "i3" + "dmenu" + "feh" + "nitrogen" + "firefox" + "xfce4" + "xfce4-goodies" + "networkmanager" + "blueberry" + + # "Development Tools" + "base-devel" + "cmake" + "git" + "rustup" +) + +package_list="" +for package in ${packages[@]}; do + package_list="$package_list $package" +done + +sudo pacman -Syu $package_list diff --git a/bin/setup-sys.sh b/bin/setup-sys.sh new file mode 100755 index 0000000..c899807 --- /dev/null +++ b/bin/setup-sys.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Fix the power button to hibernate instead of shutdown, hibernate on laptop lid shut +mv /etc/systemd/logind.conf /etc/systemd/logind.conf.bak +ln -sv ./sys-files/logind.conf /etc/systemd/logind.conf diff --git a/config b/configs/i3config similarity index 93% rename from config rename to configs/i3config index 9c24c5b..64edcf6 100644 --- a/config +++ b/configs/i3config @@ -35,30 +35,11 @@ bindsym $mod+c kill # start program launcher bindsym $mod+p exec --no-startup-id dmenu_run -# launch categorized menu -#bindsym $mod+z exec --no-startup-id morc_menu - -################################################################################################ -## sound-section - DO NOT EDIT if you wish to automatically upgrade Alsa -> Pulseaudio later! ## -################################################################################################ - -#exec --no-startup-id volumeicon -#bindsym $mod+Ctrl+m exec terminal -e 'alsamixer' -#bindsym $mod+Ctrl+m exec pavucontrol - -################################################################################################ - # Screen brightness controls -# bindsym XF86MonBrightnessUp exec "xbacklight -inc 10; notify-send 'brightness up'" -# bindsym XF86MonBrightnessDown exec "xbacklight -dec 10; notify-send 'brightness down'" +bindsym XF86MonBrightnessUp exec "xbacklight -inc 10; notify-send 'brightness up'" +bindsym XF86MonBrightnessDown exec "xbacklight -dec 10; notify-send 'brightness down'" # Start Applications -#bindsym $mod+Ctrl+b exec terminal -e 'bmenu' -#bindsym $mod+F2 exec palemoon -#bindsym $mod+F3 exec pcmanfm -# bindsym $mod+F3 exec ranger -#bindsym $mod+Shift+F3 exec pcmanfm_pkexec -#bindsym $mod+F5 exec terminal -e 'mocp' #bindsym $mod+t exec --no-startup-id pkill picom #bindsym $mod+Ctrl+t exec --no-startup-id picom -b #bindsym $mod+Shift+d --release exec "killall dunst; exec notify-send 'restart dunst'" @@ -233,6 +214,7 @@ bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcu # Set shut down, restart and locking features #bindsym $mod+0 mode "$mode_system" +bindsym XF86PowerOff mode "$mode_system" set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown mode "$mode_system" { bindsym l exec --no-startup-id i3exit lock, mode "default" diff --git a/tmux.conf b/configs/tmux.conf similarity index 100% rename from tmux.conf rename to configs/tmux.conf diff --git a/vimrc b/configs/vimrc similarity index 100% rename from vimrc rename to configs/vimrc diff --git a/setup.sh b/setup.sh index 8e4c1c3..551b296 100755 --- a/setup.sh +++ b/setup.sh @@ -1,53 +1,9 @@ #!/bin/bash -if [ "$EUID" -eq 0 ] - then echo "Please do not run this script as root." - exit -fi +# This is the main setup file to be run on a new Arch-based system. +# This file only invokes the other files under the bin directory. +# Run those individual files if you only need a part of the setup. -packages=( - # Base Packages - "base" - - # Terminal Programs - "tmux" - "screen" - "nmon" - "htop" - "gvim" - "terminator" - - # "Desktop Environment" lol - "i3" - "dmenu" - "feh" - "nitrogen" - "firefox" - "xfce4" - "xfce4-goodies" - "networkmanager" - "blueberry" - - # "Development Tools" - "base-devel" - "cmake" - "git" - "rustup" -) - -package_list="" -for package in ${packages[@]}; do - package_list="$package_list $package" -done - -sudo pacman -Syu $package_list - -cd $HOME -mkdir -p ./src/git -cd ./src/git -git clone https://github.com/ryanoasis/nerd-fonts --depth=1 -cd ./nerd-fonts -./install.sh -cd $HOME - -git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim +source ./bin/setup-packages.sh +source ./bin/setup-configs.sh +source ./bin/setup-sys.sh diff --git a/sys-files/logind.conf b/sys-files/logind.conf new file mode 100644 index 0000000..6c650dd --- /dev/null +++ b/sys-files/logind.conf @@ -0,0 +1,50 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Entries in this file show the compile time defaults. Local configuration +# should be created by either modifying this file, or by creating "drop-ins" in +# the logind.conf.d/ subdirectory. The latter is generally recommended. +# Defaults can be restored by simply deleting this file and all drop-ins. +# +# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config. +# +# See logind.conf(5) for details. + +[Login] +#NAutoVTs=6 +#ReserveVT=6 +#KillUserProcesses=no +#KillOnlyUsers= +#KillExcludeUsers=root +#InhibitDelayMaxSec=5 +#UserStopDelaySec=10 +#HandlePowerKey=poweroff +HandlePowerKey=hibernate +#HandlePowerKeyLongPress=ignore +#HandleRebootKey=reboot +#HandleRebootKeyLongPress=poweroff +#HandleSuspendKey=suspend +#HandleSuspendKeyLongPress=hibernate +#HandleHibernateKey=hibernate +#HandleHibernateKeyLongPress=ignore +#HandleLidSwitch=suspend +HandleLidSwitch=hibernate +#HandleLidSwitchExternalPower=suspend +#HandleLidSwitchDocked=ignore +#PowerKeyIgnoreInhibited=no +#SuspendKeyIgnoreInhibited=no +#HibernateKeyIgnoreInhibited=no +#LidSwitchIgnoreInhibited=yes +#RebootKeyIgnoreInhibited=no +#HoldoffTimeoutSec=30s +#IdleAction=ignore +#IdleActionSec=30min +#RuntimeDirectorySize=10% +#RuntimeDirectoryInodesMax= +#RemoveIPC=yes +#InhibitorsMax=8192 +#SessionsMax=8192