commit 80f63ecb7aab6ba8a0482898b66cf6fe2e7cefa9 from: Isabella date: Thu May 15 11:25:36 2025 UTC Add spectrwm config commit - 130cc17440855baa7585ee42dfaa5ed4102387a7 commit + 80f63ecb7aab6ba8a0482898b66cf6fe2e7cefa9 blob - /dev/null blob + 795fcc62f5110f0c74cf77c8a669dc3043e799f5 (mode 755) --- /dev/null +++ .config/spectrwm/baraction.sh @@ -0,0 +1,129 @@ +# _ _ _ _ +# | |__ __ _ _ __ __ _ ___| |_(_) ___ _ __ ___| |__ +# | '_ \ / _` | '__/ _` |/ __| __| |/ _ \| '_ \ / __| '_ \ +# | |_) | (_| | | | (_| | (__| |_| | (_) | | | |_\__ \ | | | +# |_.__/ \__,_|_| \__,_|\___|\__|_|\___/|_| |_(_)___/_| |_| +# + +#!/bin/sh + +print_date() { + # The date is printed to the status bar by default. + # To print the date through this script, set clock_enabled to 0 + # in spectrwm.conf. Uncomment "print_date" below. + FORMAT="%a %b %d %R %Z %Y" + DATE=`date "+${FORMAT}"` + echo -n "${DATE} " +} + +print_mem() { + MEM=`/usr/bin/top | grep Free: | cut -d " " -f6` + echo -n "Free mem: $MEM " +} + +_print_cpu() { + printf "CPU: %3d%% User %3d%% Nice %3d%% Sys %3d%% Spin %3d%% Int %3d%% Idle " $1 $2 $3 $4 $5 $6 +} + +print_cpu() { + OUT="" + # iostat prints each column justified to 3 chars, so if one counter + # is 100, it jams up agains the preceeding one. sort this out. + while [ "${1}x" != "x" ]; do + if [ ${1} -gt 99 ]; then + OUT="$OUT ${1%100} 100" + else + OUT="$OUT ${1}" + fi + shift; + done + _print_cpu $OUT +} + +print_cpuspeed() { + CPU_SPEED=`/sbin/sysctl hw.cpuspeed | cut -d "=" -f2` + printf "CPU speed: %4d MHz " $CPU_SPEED +} + +print_volume() { + VOLUME=`/usr/bin/sndioctl -n output.level` + # Convert value to percentage. + VOLUME_PERCENTAGE=$(printf "%.0f" "$(echo "$VOLUME * 100" | bc -l)") + + # Print volume with percentage symbol. + printf "+@fg=1;" + printf "Volume: " + printf "%s%%" "$VOLUME_PERCENTAGE" + printf " " + + # Reset colour. + printf "+@fg=3;" +} + +print_bat() { + BAT_STATUS=$1 + BAT_LEVEL=$2 + AC_STATUS=$3 + + # Print status and change colour. + printf "+@fg=1; Power: " + + if [ $AC_STATUS -ne 255 -o $BAT_STATUS -lt 4 ]; then + if [ $AC_STATUS -eq 0 ]; then + echo -n "on battery (${BAT_LEVEL}%)" + else + case $AC_STATUS in + 1) + AC_STRING="on AC: " + ;; + 2) + AC_STRING="on backup AC: " + ;; + *) + AC_STRING="" + ;; + esac; + case $BAT_STATUS in + 4) + BAT_STRING="(no battery)" + ;; + [0-3]) + BAT_STRING="(battery ${BAT_LEVEL}%)" + ;; + *) + BAT_STRING="(battery unknown)" + ;; + esac; + + FULL="${AC_STRING}${BAT_STRING}" + if [ "$FULL" != "" ]; then + echo -n "$FULL" + fi + fi + fi + + # Reset colour. + printf "+@fg=3;" +} + +# cache the output of apm(8), no need to call that every second. +APM_DATA="" +I=0 +while :; do + IOSTAT_DATA=`/usr/sbin/iostat -C -c 2 | tail -n 1 | grep '[0-9]$'` + if [ $I -eq 0 ]; then + APM_DATA=`/usr/sbin/apm -alb` + fi + printf "| " + #print_date + #print_mem + #print_cpu $IOSTAT_DATA + #print_cpuspeed + print_volume + printf "| " + print_bat $APM_DATA + printf " |" + echo "" + I=$(( ( ${I} + 1 ) % 11 )) + sleep 1 +done blob - /dev/null blob + 564471aa04d0524625af327b9445c1c99cf56c8c (mode 644) --- /dev/null +++ .config/spectrwm/spectrwm.conf @@ -0,0 +1,79 @@ +# _ __ +# ___ _ __ ___ ___| |_ _ ____ ___ __ ___ ___ ___ _ __ / _| +# / __| '_ \ / _ \/ __| __| '__\ \ /\ / / '_ ` _ \ / __/ _ \| '_ \| |_ +# \__ \ |_) | __/ (__| |_| | \ V V /| | | | | || (_| (_) | | | | _| +# |___/ .__/ \___|\___|\__|_| \_/\_/ |_| |_| |_(_)___\___/|_| |_|_| +# |_| +# + +## Change modifier key. +modkey = Mod4 + +## Bar settings. +# Enable bar. +bar_enabled = 1 +# Bar goodies on right-hand side. +bar_action = ~/.config/spectrwm/baraction.sh +bar_action_expand = 1 +# Set bar location. +bar_at_bottom = 0 +# Set bar width. +bar_border_width = 8 +# Bar colours. +bar_color[1] = rgb:8/8/8 +bar_border[1] = rgb:8/8/8 +bar_font_color[1] = rgb:75/30/5, rgb:5/75/5, rgb:90/75/5, rgb:80/5/5 +# Bar fonts. +bar_font = Terminus:pixelsize=14:antialias=true +bar_font_pua = Typicons:pixelsize=14:antialias=true +# Set maximum workspaces. +bar_workspace_limit = 10 +# Bar text alignment. +bar_justify = center +# Bar layout. +bar_format = +|L +1<+L+@fg=1;+5<+2<+C +|C+@fg=2;%a %b %d, %I:%M +|R+@fg=3; +A +# Workspace layout. +workspace_indicator = listall,markcurrent +# In-built bar-clock configuration. +clock_enabled = 1 +clock_format = %a %b %d %R +# Disable window-stacking. Only tiling. +stack_enabled = 0 + + +## Window decoration. +# Width of window border. +border_width = 2 +# Window global gap. +region_padding = 1 +# Window neighbour gap. +tile_gap = 0 +# Window border colours. +color_focus = rgb:84/64/32 +color_unfocus = rgb:24/24/24 +# Enable window name. +window_name_enabled = 1 + +## Workspace names. +name = ws[1]:Browser +name = ws[2]:Terminal +name = ws[3]:mpv + +## Automatically start programs. +autorun = ws[1]:redshift -O 4500 +autorun = ws[1]:feh --bg-scale /home/isabella/Pictures/Wallpapers/wallpaper.jpg + +## Keybindings. +# Disable some defaults. +bind[] = MOD+Shift+Delete # Default lock. +bind[] = MOD+Shift+Return # Default terminal. +bind[] = MOD+p # Default launcher. +# Custom. +program[lock] = i3lock -c 330000 +bind[lock] = MOD+Shift+x +program[firefox] = firefox +bind[firefox] = MOD+Shift+f +program[term] = xterm +bind[term] = MOD+Return +program[dmenu] = dmenu_run -b -p "Run:" -nb 'black' -sf 'black' -sb 'darkred' -nf 'red' +bind[dmenu] = MOD+p