Debian10最小化搭建dwm开发环境

基础环境

  • 选择安装发行版:Debian10含非自由固件
  • 选择发行版版本:amd64,standard live

基础配置
个人开发机为thinkpad x390,debian10 standard版本默认安装完毕后无wifi相关配置包,需要手动下载wpa_supplicant以及dhcpcd基础deb,第一次apt update/upgrade需要手动配网

dwm安装

sudo apt install libx11-dev libxft-dev libxinerama-dev xorg

dwm配置

# $HOME/.xinitrc
# 禁止触控板
xinput disable "Elan Touchpad"

# 解决ibus下chrome无法输入中文
export GTK_IM_MODULE=xim
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=xim
ibus-daemon -drx

# dwm状态栏显示CPU温度、剩余内存、音量大小、剩余电量、时间
while true
do
        CPU=$(sed 's/000$/°C/' /sys/class/thermal/thermal_zone0/temp)
        MEMORY=$(free -h | awk '(NR==2){ print $7 }')
        VOL=$(amixer get Master | awk -F'[][]' 'END{ print $2 }')
        CHARGE=$(cat /sys/class/power_supply/BAT0/capacity)
        DATE=$(date "+%a %d-%m-%y %H:%M")

        xsetroot -name "CPU:$CPU|MEM:$MEMORY|VOL:$VOL|BAT:$CHARGE%|$DATE"
        sleep 3s
done &

# 通过startx命令手动启动dwm
exec dwm

电源管理
TLP

音量调节

#!/bin/sh

case "$1" in
  U|u|[U,u]p)
    amixer -qM set Master 5%+ umute
    ;;
  D|d|[D,d]own|[D,d]o)
    amixer -qM set Master 5%- umute
    ;;
  M|m|[M,m]u|[M,m]ute)
    amixer set Master toggle
    ;;
esac

亮度调节

#!/bin/sh

CURBR="$(xrandr --current --verbose|grep 'Brightness:'|head -1|awk '{print $2}')"
STEP="0.05"
MAXBR="1.0"
MINBR="0"
echo "current brightness" $CURBR

case "$1" in
    U|u|[U,u]p)
        # increase brightness by 5%
        _brightness=$(echo $CURBR+$STEP|bc)
        echo "desired new brightness" $_brightness
        _res=$(echo "$_brightness <= $MAXBR"|bc)
        if [ "$_res" -eq 1 ]; then
            echo "new brightness" $_brightness
            xrandr --output eDP-1 --brightness $_brightness
        fi
        ;;
    D|d|[D,d]own|[D,d]o)
        # increase brightness by 5%
        _brightness=$(echo $CURBR-$STEP|bc)
        echo "desired new brightness" $_brightness
        _res=$(echo "$_brightness >= $MINBR"|bc)
        if [ "$_res" -eq 1 ]; then
            echo "new brightness" $_brightness
            xrandr --output eDP-1 --brightness $_brightness
        fi
        ;;
    *)
        echo "Usage: $0 [up|down]"
        exit 1
        ;;
esac
posted @ 2020-08-01 22:36  rdwr  阅读(911)  评论(0编辑  收藏  举报