diff --git a/i3/config b/.config/i3/config similarity index 88% rename from i3/config rename to .config/i3/config index 522010d..39cfc0e 100644 --- a/i3/config +++ b/.config/i3/config @@ -17,19 +17,20 @@ for_window [class="Plasmoidviewer"] floating enable; border none for_window [class="plasmashell" window_type="notification"] border none, move position 70 ppt 81 ppt no_focus [class="plasmashell" window_type="notification"] # no title bars -default_border pixel 1 -default_floating_border pixel 1 +default_border pixel 4 +default_floating_border pixel 4 gaps inner 10 gaps outer 5 +smart_borders on # picom as compositor -exec_always --no-startup-id picom -cb +exec_always --no-startup-id picom --config $HOME/.config/picom/picom.conf -b # dunst as notification daemon # also fixes slack freeze problem on messages exec_always --no-startup-id dunst # fix scaling -exec "xrandr --dpi 96" +exec --no-startup-id "xrandr --dpi 120" # ibus for easy unicode input support exec_always --no-startup-id "ibus-daemon -drx --panel /usr/lib/ibus/ibus-ui-gtk3" exec --no-startup-id nm-applet @@ -53,9 +54,11 @@ font pango:Noto Sans 14 set $mod Mod4 -set $locker /usr/bin/i3lock-fancy -bindsym $mod+Ctrl+Shift+l exec --no-startup-id $locker -exec --no-startup-id xautolock -time 10 -locker /usr/bin/i3lock-fancy -notify 10 -notifier "notify-send -u critical -t 10000 -- 'Screen locking in 10s'" +set $locker /usr/bin/i3lock +bindsym $mod+Ctrl+Shift+l exec --no-startup-id loginctl lock-session +exec --no-startup-id xset s 300 +exec --no-startup-id xset dpms 600 +exec --no-startup-id xss-lock -- i3lock -n & bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl s 10%- bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl s +10% @@ -64,7 +67,7 @@ bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle -bindsym $mod+Return exec "konsole --hide-menubar" +bindsym $mod+Return exec --no-startup-id "konsole --hide-menubar" bindsym $mod+Shift+Return exec --no-startup-id "konsole -e ranger" bindsym $mod+Shift+q kill bindsym $mod+Shift+c reload diff --git a/i3status/config b/.config/i3status/config similarity index 100% rename from i3status/config rename to .config/i3status/config diff --git a/picom/picom.conf b/.config/picom/picom.conf similarity index 98% rename from picom/picom.conf rename to .config/picom/picom.conf index 5bd3384..de38535 100644 --- a/picom/picom.conf +++ b/.config/picom/picom.conf @@ -24,7 +24,6 @@ shadow-offset-x = -7; # The top offset for shadows, in pixels. (defaults to -15) # shadow-offset-y = -15 shadow-offset-y = -7; - # Red color value of shadow (0.0 - 1.0, defaults to 0). # shadow-red = 0 @@ -103,15 +102,14 @@ fade-out-step = 0.03; # Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) # inactive-opacity = 1 -inactive-opacity = 1.0; +inactive-opacity = 1.0; # Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) # frame-opacity = 1.0 frame-opacity = 0.9; # Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows. -# inactive-opacity-override = true -inactive-opacity-override = true; +inactive-opacity-override = false # Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) # active-opacity = 1.0 @@ -209,8 +207,8 @@ blur-background-exclude = [ # Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. # `xrender` is the default one. # -# backend = "glx" -backend = "xrender"; +backend = "glx" +# backend = "xrender"; # Enable/disable VSync. # vsync = false @@ -408,9 +406,7 @@ opacity-rule = [ "0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'", "0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'", "0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'", - "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'" - "100:class_g = focused" - "100:class_g = !focused" + "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'", ]; wintypes: diff --git a/polybar/config.ini b/.config/polybar/config.ini similarity index 90% rename from polybar/config.ini rename to .config/polybar/config.ini index 8169c66..a41674e 100644 --- a/polybar/config.ini +++ b/.config/polybar/config.ini @@ -22,7 +22,7 @@ background-alt = #373B41 foreground = #C5C8C6 primary = #F0C674 secondary = #8ABEB7 -alert = #A54242 +alert = #E60053 disabled = #707880 [bar/bar1] @@ -37,11 +37,11 @@ foreground = ${colors.foreground} line-size = 3pt -border-size = 4pt +border-size = 0 border-color = #00000000 padding-left = 0 -padding-right = 1 +padding-right = 0 module-margin = 1 @@ -54,7 +54,7 @@ font-2 = NotoSansSymbols2:style=Regular:size=14;4 #font-0 = monospace:size=14;2 modules-left = xworkspaces xwindow -modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth battery date +modules-right = updates-arch filesystem pulseaudio memory cpu wlan eth battery date cursor-click = pointer cursor-scroll = ns-resize @@ -100,7 +100,7 @@ interval = 25 mount-0 = / -label-mounted = 🖴 %{F#F0C674}%mountpoint%%{F-} %free% (%percentage_used%%) +label-mounted = %{F#F0C674}🖴 %mountpoint%%{F-} %free% (%percentage_used%%) label-unmounted = %mountpoint% not mounted label-unmounted-foreground = ${colors.disabled} @@ -187,4 +187,12 @@ label-foreground = ${colors.primary} screenchange-reload = true pseudo-transparency = true +[module/updates-arch] +type = custom/script +exec = "$HOME/.config/polybar/scripts/arch/arch_updates.sh -s" +tail = true +format-prefix = "⟳ " +format-prefix-foreground = "${colors.primary}" +click-left = "kill -USR1 %pid%" +click-right = "kill -USR2 %pid%" ; vim:ft=dosini diff --git a/polybar/launch.sh b/.config/polybar/launch.sh similarity index 100% rename from polybar/launch.sh rename to .config/polybar/launch.sh diff --git a/.config/polybar/scripts/arch/arch_updates.sh b/.config/polybar/scripts/arch/arch_updates.sh new file mode 100755 index 0000000..68b8a37 --- /dev/null +++ b/.config/polybar/scripts/arch/arch_updates.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +OUTPUT="" +UPDATE_LIST="" +LOG_FILE=/tmp/polybar-pacman.log +SLEEP_PID=0 +N_UPDATES=0 + +trap 'exit' SIGINT +trap "check_for_updates" USR1 +trap "notify" USR2 + +log() { + #echo "[$(date -Is)]" "$@" >> $LOG_FILE + : +} + +main_loop() { + echo '' > ${TMP_DIR}/status + check_for_updates + status +} + +status_loop() { + while true; do + check_for_updates + sleep 600 & + SLEEP_PID=$! + wait + done + +} + +check_for_updates() { + # enumerate update list + log "Checking updates" + echo "⌛" + UPDATE_LIST=$(checkupdates | nl -w2 -s '. ') + # count lines + new_n_updates=$(echo "$UPDATE_LIST" | wc -l) + [ "$new_n_updates" -gt "$N_UPDATES" ] && notify + N_UPDATES="$new_n_updates" + if [ ! $N_UPDATES -gt 0 ]; then + OUTPUT="%{T-}0%{T-}" + else + OUTPUT="%{T2}%{F#e60053}$N_UPDATES" + fi + echo "$OUTPUT" +} + +notify() { + notification=$(echo "$UPDATE_LIST" | column -t -L -o " " | sed 's/->//g') + notify-send -t 0 "Updates" "$notification" +} + + + upgrade() { + if [ -s ${TMP_DIR}repo.pkgs ]; then + [ -s ${TMP_DIR}aur.pkgs ] && urxvt -tr -sh 20 -fg white -bg black -e sh -c "aur sync -c -u --noview && sudo pacman -Syu --noconfirm" || \ + urxvt -tr -sh 20 -fg white -bg black -e sh -c "sudo pacman -Syu --noconfirm" + echo "%{T7}0%{T-}" > ${TMP_DIR}status && >| ${TMP_DIR}repo.pkgs && >| ${TMP_DIR}aur.pkgs + elif [ -s ${TMP_DIR}aur.pkgs ]; then + urxvt -tr -sh 20 -fg white -bg black -e sh -c "aur sync -c -u --noview && sudo pacman -Syu --noconfirm" + echo "%{T7}0%{T-}" > ${TMP_DIR}status && >| ${TMP_DIR}repo.pkgs && >| ${TMP_DIR}aur.pkgs + else + notify-send "No updates" + fi + } + + flagged() { + url="https://www.archlinux.org/packages/" + options="sort=&arch=any&arch=x86_64&repo=Community&repo=Core&repo=Extra&repo=Multilib&q=&maintainer=&flagged=Flagged" + page_number=2 + status=1 + flagged_packages=$(curl "$url?$options" 2> /dev/null | \ + grep "/packages/extra/\|/packages/core/\|/packages/community/\|/packages/multilib/\|20\|span class=\"flagged\"") + local_packages=$(pacman -Q | sed 's/\(.*\ \)\(.*$\)/\1/') + + while [ $status -eq 1 ]; do + flagged_packages+=$'\n'"$(curl $url?page=$page_number\&$options 2> /dev/null | \ + grep "/packages/extra/\|/packages/core/\|/packages/community/\|/packages/multilib/\|20\|error-page\|span class=\"flagged\"")" + echo $flagged_packages | grep "error-page" > /dev/null + status=$? + page_number="$((page_number+1))" + done + + flagged_packages=$(echo "$flagged_packages" | sed 'N;N;N;s/\n/ /g;s/">/ /g' | awk '{print $7,$11,($12),($13) }' | \ + sed 's/<\/span><\/td>//;s//(/g;;s/<\/td>/)/g' | column -t -o " ") + notify-send -t 60000 "$(cat <(echo "Outdated Repo packages") \ + <(awk 'FNR==NR{a[$1];next}($1 in a){print}' <(echo "$local_packages") <(echo "$flagged_packages") | nl -s '.') \ + <(echo) \ + <(echo "Outdated AUR packages") \ + <(aur search -qi $(aur repo -a | sed 's/:.*//') | grep "Out-of-date" | sed -e 's/aur\///' -e 's/(.*%)//' | nl -s '.'))" + } + + [[ $# -eq 0 ]] && main_loop + [[ $1 == "-s" ]] && status_loop + [[ $1 == "-n" ]] && notify + [[ $1 == "-c" ]] && clean + [[ $1 == "--flagged" ]] && flagged + diff --git a/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc similarity index 100% rename from sxhkd/sxhkdrc rename to .config/sxhkd/sxhkdrc diff --git a/README.md b/README.md index 1ee5242..94a8226 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,13 @@ ## Requirements ~~~ bash -sudo pacman -S - < pkglist.txt +grep -v "^#" pkglist.txt | sudo pacman -S --needed - ~~~ +``` bash +grep -v "^#" pkglist_aur.txt | yay -S --needed - +``` + ## IBus Configuration Add diff --git a/bin/dim_screens.sh b/bin/dim_screens.sh new file mode 100755 index 0000000..75b050f --- /dev/null +++ b/bin/dim_screens.sh @@ -0,0 +1,37 @@ +#!/bin/zsh +# vim:ft=sh + +OUTPUTS=($(xrandr -q | sed -n "s/^\(\S*\) connected.*$/\1/p")) +FADE_STEPS=200 +FADE_DURATION=10 +BRIGHTNESS=($(xrandr --verbose | sed -n 's/\s*Brightness: \([0-9]*\.[0-9]*\).*$/\1/p')) + + +reset_brightness() { + for ((i=1; i<=$#OUTPUTS; i++)); do + xrandr --output ${OUTPUTS[$i]} --brightness ${BRIGHTNESS[$i]} + done +} + + +fade() { + local level + start_time=$(date +%s.%6N) + for factor in {$FADE_STEPS..0};do + factor=$((1.0 * $factor / $FADE_STEPS)) + sleep_until=$(( $start_time + (1.0 - $factor) * $FADE_DURATION )) + for ((i=1; i<=$#OUTPUTS; i++));do + xrandr --output ${OUTPUTS[$i]} --brightness $(($factor * ${BRIGHTNESS[$i]})) + done + now=$(date +%s.%6N) + sleep_time=$(( $sleep_until - $now )) + [[ $sleep_time > 0.0 ]] && sleep $sleep_time + done +} + +trap 'exit 0' TERM INT + +trap "reset_brightness; kill %%" EXIT +fade +sleep 2147483647 & +wait diff --git a/create_links.sh b/create_links.sh index c71e90f..f64674c 100755 --- a/create_links.sh +++ b/create_links.sh @@ -3,30 +3,44 @@ FILE_PATH=$(readlink -f "$0") REPO_DIR=$(dirname "$FILE_PATH") BACKUP_DIR="$REPO_DIR/backup" -mkdir -p "$BACKUP_DIR" -FILE_DST=("$HOME/.zshrc" "$HOME/.vimrc" "$HOME/.gitconfig") -for f_out in "${FILE_DST[@]}" +files=($(find $REPO_DIR/home/ -type f)) +for file in ${files[@]} do - FNAME="$(basename -- $f_out)" - F_SRC="$REPO_DIR/$FNAME" - if [ -f $f_out ] && [ ! -L "$f_out" ]; then - echo "Replacing '$f_out' with symlink." - i=0 - F_BACKUP_BASE="$BACKUP_DIR/$FNAME" - F_BACKUP=$F_BACKUP_BASE - while [ -e "$F_BACKUP" ]; do - printf -v F_BACKUP '%s.backup%04d' "$F_BACKUP_BASE" "$(( i++ ))" - done - echo "Moving '$f_out' to '$F_BACKUP'" - mv "$f_out" "$F_BACKUP" - ln -sv "$F_SRC" "$f_out" - else - echo "$f_out does not exist as regular file." - if [ -e "$f_out" ]; then - echo "There is already a symlink for $f_out. Skipping..." + file_base=$(basename -- "$file") + dest=$HOME/$file_base + if [ -L "$dest" ]; then + if [ ! -e "$dest" ];then + echo "Remove broken link: $dest" + rm "$dest" else - ln -sv "$F_SRC" "$f_out" + echo "Already installed: $dest" + continue fi + elif [ -e "$dest" ]; then + echo "Skipping already existing file, please remove manually: $dest" + continue fi + ln -sv $file $dest +done + +files=($(find "$REPO_DIR/.config" -mindepth 1 -maxdepth 1 -type d)) +for file in ${files[@]} +do + base=$(basename -- "$file") + dest="$HOME/.config/$base" + if [ -L "$dest" ];then + if [ ! -e "$dest" ];then + echo "Remove broken link: $dest" + rm "$dest" + else + echo "Already installed: $dest" + continue + fi + elif [ -e "$dest" ]; then + echo "Already exstis: $dest" + echo "Backing up..." + mv "$dest" "$BACKUP_DIR/" + fi + ln -sv $file $dest done diff --git a/.gitconfig b/home/.gitconfig similarity index 100% rename from .gitconfig rename to home/.gitconfig diff --git a/.vimrc b/home/.vimrc similarity index 92% rename from .vimrc rename to home/.vimrc index 773c6ad..70489f3 100644 --- a/.vimrc +++ b/home/.vimrc @@ -19,6 +19,7 @@ augroup WrapLine autocmd FileType txt setlocal wrap autocmd FileType rst setlocal wrap augroup End +autocmd FileType sh setlocal shiftwidth=2 softtabstop=2 expandtab " highlight current line set cursorline " enable line numbers diff --git a/.zshrc b/home/.zshrc similarity index 100% rename from .zshrc rename to home/.zshrc diff --git a/pkglist.txt b/pkglist.txt index 867792f..f2b06f7 100644 --- a/pkglist.txt +++ b/pkglist.txt @@ -1,6 +1,6 @@ picom nitrogen -i3-gaps +i3-wm i3lock polybar xautolock @@ -8,9 +8,9 @@ i3status dunst sxhkd dex -ranger network-manager-applet xautolock polkit-kde-agent -# for reading battery status acpi +arandr +autorandr diff --git a/pkglist_aur.txt b/pkglist_aur.txt index d87794b..79467b7 100644 --- a/pkglist_aur.txt +++ b/pkglist_aur.txt @@ -1 +1,2 @@ i3lock-fancy-git +ranger-git