This commit is contained in:
Thies Lennart Alff 2023-05-23 21:27:44 +02:00
parent b649bc1101
commit e16331dca4
15 changed files with 212 additions and 47 deletions

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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/\|<td>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/\|<td>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/<td>/(/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

View file

@ -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

37
bin/dim_screens.sh Executable file
View file

@ -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

View file

@ -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

View file

@ -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

View file

View file

@ -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

View file

@ -1 +1,2 @@
i3lock-fancy-git
ranger-git