Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ ReflowComments: false

IndentWidth: 2
TabWidth: 2
UseTab: Never
ContinuationIndentWidth: 0
UseTab: ForContinuationAndIndentation
ContinuationIndentWidth: 2

AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left
BreakBeforeBraces: Attach

ColumnLimit: 180
ColumnLimit: 0
MaxEmptyLinesToKeep: 2

AllowShortFunctionsOnASingleLine: false
Expand Down
1 change: 1 addition & 0 deletions .clangd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CompileFlags:
- -pedantic
- -Wall
- -Wno-deprecated-declarations
- -Wno-empty-translation-unit
- -Os
- -I/usr/X11R6/include
- -I/usr/include/freetype2
Expand Down
87 changes: 87 additions & 0 deletions .config/dunst/dunstrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[global]
### 显示设置 ###
monitor = 0
follow = keyboard

### 几何布局 ###
width = (111,444)
height = (0,222)
origin = top-right
offset = (25,50)
scale = 0
notification_limit = 0

### 进度条 ###
progress_bar = true
progress_bar_height = 5
progress_bar_frame_width = 0
progress_bar_min_width = 0
progress_bar_max_width = 444

indicate_hidden = yes
transparency = 3
separator_height = 2
padding = 9
horizontal_padding = 11
text_icon_padding = 0
frame_width = 6
frame_color = "#373e4d"
gap_size = 8
separator_color = "#404859"
sort = yes
idle_threshold = 120

### 文本 ###
font = JetBrainsMono Nerd Font Mono 12
line_height = 0
markup = full
format = "<span size='x-large' weight='bold' color='#f9f9f9'>%s</span>\n%b"
alignment = left
vertical_alignment = center
ellipsize = middle
ignore_newline = no
stack_duplicates = true
hide_duplicate_count = false
show_indicators = no
show_age_threshold = 60

### 图标 ###
icon_position = left
min_icon_size = 48
max_icon_size = 80
sticky_history = true
history_length = 20
enable_recursive_icon_lookup = false

### 杂项 ###
dmenu = "rofi -theme-str '@import "action.rasi"' -no-show-icons -no-lazy-grab -no-plugins -dmenu -mesg 'Context Menu'"
browser = "firefox -new-tab"
always_run_script = true
title = Dunst
class = Dunst
corner_radius = 8
ignore_dbusclose = false
force_xwayland = false
force_xinerama = false
mouse_left_click = do_action
mouse_middle_click = close_all
mouse_right_click = close_current

## 紧急程度 ###
[urgency_low]
timeout = 3
background = "#373e4d"
foreground = "#f9f9f9"
highlight = "#f48ee8"

[urgency_normal]
timeout = 6
background = "#373e4d"
foreground = "#f9f9f9"
highlight = "#f48ee8"

[urgency_critical]
timeout = 0
background = "#373e4d"
foreground = "#f9f9f9"
highlight = "#f48ee8"
110 changes: 110 additions & 0 deletions .config/fastfetch/config.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/master/doc/json_schema.json",
"logo": {
"type": "kitty",
"height": 20,
"source": "~/.config/fastfetch/logo.png",
"padding": {
"top": 3,
"left": 5
}
},
"display": {
"separator": " ➜ "
},
"modules": [
"break",
"break",
"break",
{
"type": "os",
"key": "OS ",
"keyColor": "31"
},
{
"type": "kernel",
"key": " ├ kernel ",
"keyColor": "31"
},
{
"type": "packages",
"key": " ├ packages",
"format": "{} (pacman)",
"keyColor": "31"
},
{
"type": "shell",
"key": " └ shell ",
"keyColor": "31"
},
"break",
{
"type": "wm",
"key": "WM ",
"keyColor": "32"
},
{
"type": "command",
"key": " ├ wm theme ",
"format": "{} (dwm theme)",
"text": "echo ${DWM_THEME:-onedark}",
"keyColor": "32"
},
{
"type": "command",
"key": " ├ icons ",
"format": "{}",
"text": "echo ${DWM_ICONS:-dwmStatus}",
"keyColor": "32"
},
{
"type": "terminal",
"key": " ├ terminal ",
"keyColor": "32"
},
{
"type": "terminalfont",
"key": " └ terminal font",
"keyColor": "32"
},
"break",
{
"type": "host",
"key": "PC ",
"format": "{5} {1} Type {2}",
"keyColor": "33"
},
{
"type": "cpu",
"key": " ├ cpu ",
"keyColor": "33"
},
{
"type": "gpu",
"key": " ├ gpu ",
"keyColor": "33"
},
{
"type": "memory",
"key": " ├ memory ",
"keyColor": "33"
},
{
"type": "swap",
"key": " ├ swap ",
"keyColor": "33"
},
{
"type": "disk",
"key": " ├ disk ",
"keyColor": "33"
},
{
"type": "display",
"key": " └ display",
"keyColor": "33"
},
"break",
"colors"
]
}
Binary file added .config/fastfetch/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion DWM/config/picom.conf → .config/picom/picom.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rules = (
{ match = "fullscreen", opacity = 1.00, corner-radius = 0.0 },

# 应用窗口配置
{ match = "class_g = 'dwm'", opacity = 1.00, corner-radius = 12.0, fade = false },
{ match = "class_g = 'dwm'", opacity = 1.00, corner-radius = 6.0, fade = false },
{ match = "class_g = 'fcitx'", opacity = 1.00, corner-radius = 0.0, fade = false },
{ match = "class_g = 'obs'", opacity = 1.00, corner-radius = 0.0, fade = false },
{ match = "class_g = 'Gimp'", opacity = 1.00, corner-radius = 0.0, fade = false },
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
*.o
*.rej
*.orig
*.tmp
*.log
dwm
tmp
117 changes: 84 additions & 33 deletions DWM/autostart.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,86 @@
#!/bin/bash

_thisdir=$(cd $(dirname $0);pwd)

settings() {
[ $1 ] && sleep $1
xset -b # 关闭蜂鸣器
syndaemon -i 1 -t -K -R -d # 设置使用键盘时触控板短暂失效
$_thisdir/scripts/set_screen.sh two # 设置显示器 设置键盘映射
setxkbmap -layout us -variant colemak -option -option caps:swapescape -option lv3:ralt_alt
}

daemons() {
[ $1 ] && sleep $1
$_thisdir/scripts/statusbar.sh cron & # 开启状态栏定时更新
xss-lock -- $_thisdir/scripts/blurlock.sh & # 开启自动锁屏程序
fcitx5 & # 开启输入法
flameshot & # 开启截图程序后台板
dunst -conf $_thisdir/config/dunst.conf & # 开启通知弹窗
picom --config $_thisdir/config/picom.conf >> /dev/null 2>&1 &
}

cron() {
[ $1 ] && sleep $1
let i=10
while true; do
[ $((i % 10)) -eq 0 ] && $_thisdir/scripts/set_screen.sh check
[ $((i % 300)) -eq 0 ] && feh --randomize --bg-fill ~/Pictures/wallpaper/*.png
sleep 10; let i+=10 # 更新壁纸和监视器
done
}

settings & # 初始化设置项
daemons & # 后台程序项
cron & # 定时任务项
theme=${DWM_THEME:-"onedark"}

# shellcheck source=themes/onedark/bar.t
source "$DWM/themes/$theme/bar.t"
mkdir -p "$DWM/.tmp/"
touch "$DWM/.tmp/dwm-statusbar-placeholder.tmp"
touch "$DWM/.tmp/pkgupdates.tmp"
touch "$DWM/.tmp/network.tmp"
touch "$DWM/.tmp/wifilst.tmp"
pipe="$DWM/.tmp/pipe.tmp"

battery() {
bats='󰠈󰠉󰠊󰠋󰠌󰠍󰠎󰠏󰠐󰠇󰠇󰢜󰂆󰂇󰂈󰢝󰂉󰢞󰂊󰂋󰂅󰂅'
val=$(acpi | sed -n 's/.* \([0-9]\+\)%.*/\1/p' | head -1)
icon=${bats:$(("$val" / 10 + $(acpi | grep -q 'Discharging' && echo '0' || echo '11'))):1}
printf '^b%s^^c%s^ %s ^d^' "$blk" "$blu" "$icon"
printf '^b%s^^c%s^ %s ^d^' "$blk" "$blu" "$val"
}

brightness() {
val=$(brightnessctl | sed -n 's/.*(\([0-9]\+\)%).*/\1/p')
printf '^b%s^^c%s^  ^d^' "$blk" "$red"
printf '^b%s^^c%s^ %.0f ^d^' "$blk" "$red" "$val"
}

clock() {
printf '^b%s^^c%s^ 󰥔 ^d^' "$dbl" "$blk"
printf '^b%s^^c%s^ %s ^d^' "$blu" "$blk" "$(date '+%a, %H:%M %p') "
}

cpu() {
val=$(grep -o "^[^ ]*" /proc/loadavg)
printf '^b%s^^c%s^ CPU ^d^' "$grn" "$blk"
printf '^b%s^^c%s^ %s ^d^' "$gry" "$wht" "$val"
}

mem() {
val=$(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)
printf '^b%s^^c%s^  ^d^' "$blk" "$blu"
printf '^b%s^^c%s^ %s ^d^' "$blk" "$blu" "$val"
}

pkgupdates() {
val=$(cat "$DWM/.tmp/pkgupdates.tmp" | wc -l)
if [ "$val" -eq 0 ]; then
printf '^b%s^^c%s^ 󰬬 Fully Updated ^d^' "$blk" "$grn"
else
printf '^b%s^^c%s^ 󰬬 %s updates ^d^' "$blk" "$wht" "$val"
fi
}

vol() {
if amixer get Master | grep -q -E '\[off\]|\[0%\]'; then
printf '^b%s^^c%s^ 󰝟 ^d^' "$blk" "$red"
else
printf '^b%s^^c%s^ 󰕾 ^d^' "$blk" "$grn"
fi
}

wlan() {
case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in
up) printf '^b%s^^c%s^ 󰖩 ^b%s^^c%s^ Connected ^d^' "$red" "$blk" "$gry" "$wht" ;;
*) printf '^b%s^^c%s^ 󰖪 ^b%s^^c%s^ Disconnected ^d^' "$red" "$blk" "$gry" "$wht" ;;
esac
}

xset b off # turn off beeps
setxkbmap -layout us -variant colemak -option -option caps:swapescape -option lv3:ralt_alt
syndaemon -i 1 -t -K -R -d # ignore tappad when keys are pressed
fcitx5 &
cat "$HOME/.config/dunst/dunstrc" "$DWM/themes/$theme/dunstrc" >"$DWM/.tmp/dunstrc.tmp"
dunst -conf "$DWM/.tmp/dunstrc.tmp" >>/dev/null 2>&1 &
picom --config "$HOME/.config/picom/picom.conf" >>/dev/null 2>&1 &
xsetroot -name "$(cat "$DWM/.tmp/dwm-statusbar-placeholder.tmp")" # pre-render to avoid initial delay
tick=0
while true; do
status="$(pkgupdates)&$(battery)&$(brightness)&$(cpu)&$(mem)&$(wlan)&$(clock)&$(vol)"
echo "$status" >"$DWM/.tmp/dwm-statusbar-placeholder.tmp"
xsetroot -name "$(cat "$DWM/.tmp/dwm-statusbar-placeholder.tmp")"
[ "$((tick % 3600))" -eq 0 ] && checkupdates >"$pipe" && mv "$pipe" "$DWM/.tmp/pkgupdates.tmp"
[ "$((tick % 2400))" -eq 0 ] && nmcli --field 'SECURITY,SSID' --terse device wifi list >"$pipe" && mv "$pipe" "$DWM/.tmp/wifilst.tmp"
[ "$((tick % 1200))" -eq 0 ] && speedtest-cli --simple >"$pipe" && mv "$pipe" "$DWM/.tmp/network.tmp"
sleep 1 && tick=$(((tick + 1) % 3600))
done
Loading