From de5453b1131d04101bde7283b97f46d0ff8114f1 Mon Sep 17 00:00:00 2001 From: Keyitdev <70140437+Keyitdev@users.noreply.github.com> Date: Mon, 11 Apr 2022 18:56:53 +0200 Subject: [PATCH] Update: Updated scripts, changed HDMI name. --- config/i3/config | 4 +-- config/polybar/polybar-rounded/config.ini | 2 +- config/polybar/polybar-square/config.ini | 2 +- install-on-arch.sh | 23 ++++++++------ scripts/brightness_hdmi | 38 +++++++++++++++++++++++ scripts/mute | 3 +- scripts/volume | 3 +- 7 files changed, 58 insertions(+), 17 deletions(-) create mode 100755 scripts/brightness_hdmi diff --git a/config/i3/config b/config/i3/config index 97e6016..f658c3d 100755 --- a/config/i3/config +++ b/config/i3/config @@ -93,8 +93,8 @@ bindsym $mod+space focus mode_toggle bindsym $mod+i exec betterlockscreen -l # monitor settings -bindsym $mod+n exec xrandr --auto --output eDP --mode 1920x1080 --right-of HDMI-A-0 && i3-msg restart & -bindsym $mod+m exec xrandr --auto --output HDMI-A-0 --off && i3-msg restart & +bindsym $mod+n exec xrandr --auto --output eDP-1 --mode 1920x1080 --right-of HDMI-1 && i3-msg restart & +bindsym $mod+m exec xrandr --auto --output HDMI-1 --off && i3-msg restart & # toggle polybar bindsym $mod+o exec $HOME/.config/polybar/launch.sh diff --git a/config/polybar/polybar-rounded/config.ini b/config/polybar/polybar-rounded/config.ini index 2e9c555..86098d6 100755 --- a/config/polybar/polybar-rounded/config.ini +++ b/config/polybar/polybar-rounded/config.ini @@ -283,7 +283,7 @@ cursor-scroll = ; If unspecified, the application will pick the first one it finds. ; $ polybar -m | cut -d ':' -f 1 ; $ xrandr -q | grep " connected" | cut -d ' ' -f1 -monitor = HDMI-A-0 +monitor = HDMI-1 ; Use the specified monitor as a fallback if the main one is not found. monitor-fallback = diff --git a/config/polybar/polybar-square/config.ini b/config/polybar/polybar-square/config.ini index d83b67c..c02134e 100755 --- a/config/polybar/polybar-square/config.ini +++ b/config/polybar/polybar-square/config.ini @@ -275,7 +275,7 @@ cursor-scroll = ; If unspecified, the application will pick the first one it finds. ; $ polybar -m | cut -d ':' -f 1 ; $ xrandr -q | grep " connected" | cut -d ' ' -f1 -monitor = HDMI-A-0 +monitor = HDMI-1 ; Use the specified monitor as a fallback if the main one is not found. monitor-fallback = diff --git a/install-on-arch.sh b/install-on-arch.sh index 2eceaee..409c8d9 100755 --- a/install-on-arch.sh +++ b/install-on-arch.sh @@ -203,16 +203,21 @@ copy_flies(){ echo -e "\n[*4*] Files copied." } -copy_scripts(){ - echo -e "[*5*] Coping scripts." +copy_other_files(){ + echo -e "[*5*] Coping scripts, fonts and wallpapers." DATE=$(date +%s) if [ -d /usr/local/bin ]; then echo "[*] /usr/local/bin configs detected, backing up..." + sudo mkdir /usr/local/bin$DATE sudo mv /usr/local/bin/* /usr/local/bin$DATE fi sudo mkdir -p /usr/local/bin sudo cp -frd ./scripts/* /usr/local/bin - echo -e "\n[*5*] Scripts copied." + echo -e "\n[*] Scripts copied." + sudo cp ./fonts/* /usr/share/fonts/ + echo -e "\n[*] Fonts copied." + cp ./wallpapers/* $HOME/Pictures/wallpapers/ + echo -e "\n[*] Wallpapers copied." } make_default_directories(){ @@ -246,24 +251,24 @@ other_dependencies(){ sudo cp /usr/share/sddm/themes/sddm-astronaut-theme/Fonts/* /usr/share/fonts/ echo "[Theme] Current=sddm-astronaut-theme" | sudo tee /etc/sddm.conf + + echo -e "\n[*] Installing ohmyzsh (in background)" + kitty sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" & if [ -d $HOME/.config/nvim ]; then echo "[*] nvim theme detected, backing up..." sudo mv $HOME/.config/nvim $HOME/.config/nvim$DATE fi echo -e "\n[*] Installing nvim theme" - git clone --depth 10 https://github.com/kabinspace/AstroVim.git $HOME/.config/nvim - nvim +PackerSync - - echo -e "\n[*] Installing ohmyzsh" - sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + kitty git clone --depth 10 https://github.com/kabinspace/AstroVim.git $HOME/.config/nvim + kitty nvim +PackerSync } system_update aur_helper install_packages copy_flies -copy_scripts +copy_other_files make_default_directories other_dependencies diff --git a/scripts/brightness_hdmi b/scripts/brightness_hdmi new file mode 100755 index 0000000..be91b0f --- /dev/null +++ b/scripts/brightness_hdmi @@ -0,0 +1,38 @@ +#!/bin/bash + +dir_icons="/usr/local/bin/icons" +MON="HDMI-1" # Discover monitor name with: xrandr | grep " connected" +STEP=10 # Step Up/Down brightnes by: 5 = ".05", 10 = ".10", etc. + +CurrBright=$( xrandr --verbose --current | grep ^"$MON" -A5 | tail -n1 ) +CurrBright="${CurrBright##* }" # Get brightness level with decimal place + +Left=${CurrBright%%"."*} # Extract left of decimal point +Right=${CurrBright#*"."} # Extract right of decimal point + +MathBright="0" +[[ "$Left" != 0 && "$STEP" -lt 10 ]] && STEP=10 # > 1.0, only .1 works +[[ "$Left" != 0 ]] && MathBright="$Left"00 # 1.0 becomes "100" +[[ "${#Right}" -eq 1 ]] && Right="$Right"0 # 0.5 becomes "50" +MathBright=$(( MathBright + Right )) + +dunstify -a "Brightness" \ + "Brightness" \ + "Current brightness is $MathBright%" \ + -r 100 \ + -i "$dir_icons"/sun.svg + +[[ "$1" == "up" || "$1" == "+" ]] && MathBright=$(( MathBright + STEP )) +[[ "$1" == "down" || "$1" == "-" ]] && MathBright=$(( MathBright - STEP )) +[[ "${MathBright:0:1}" == "-" ]] && MathBright=0 # Negative not allowed +[[ "$MathBright" -gt 150 ]] && MathBright=150 # Can't go over 1.50 + +if [[ "${#MathBright}" -eq 3 ]] ; then + MathBright="$MathBright"000 # Pad with lots of zeros + CurrBright="${MathBright:0:1}.${MathBright:1:2}" +else + MathBright="$MathBright"000 # Pad with lots of zeros + CurrBright=".${MathBright:0:2}" +fi + +xrandr --output "$MON" --brightness "$CurrBright" # Set new brightness diff --git a/scripts/mute b/scripts/mute index 21d5a4b..c5e9e72 100755 --- a/scripts/mute +++ b/scripts/mute @@ -2,8 +2,7 @@ dir="/usr/local/bin/icons" -cur_vol=$(pactl list sinks | grep '^[[:space:]]Volume:' | \ - head -n $(( SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') +cur_vol=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master) | sed 's/%//g') MUTE=$(pacmd list-sinks | awk '/muted/ { print $2 }' | head -1) affirmative="yes" negative="no" diff --git a/scripts/volume b/scripts/volume index 394ed8c..6a71010 100755 --- a/scripts/volume +++ b/scripts/volume @@ -2,8 +2,7 @@ dir_icons="/usr/local/bin/icons" -cur_vol=$(pactl list sinks | grep '^[[:space:]]Volume:' | \ - head -n $(( "$SINK" + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') +cur_vol=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master) | sed 's/%//g') vol_quiet=33 vol_loud=66