Compare commits

..

24 Commits

Author SHA1 Message Date
f02c5dbc0b minor patches 2025-10-01 10:57:19 +02:00
ab9f2e41a5 feat: changed layout to fib dindle 2025-07-16 16:12:02 +02:00
7b365e95a7 fix: readded monocle layout for fullscreens 2025-07-15 15:32:49 +02:00
d400b7b0e9 feat: changed default tiling modes 2025-07-05 21:13:10 +02:00
e965863d95 fix: bar changes 2025-07-02 20:29:01 +02:00
66fa978463 feat: themes 2025-07-02 16:18:43 +02:00
e63c8cbfd4 fix: battery calculation 2025-07-02 16:17:49 +02:00
7b00729d64 bar typo fix 2025-03-28 13:23:33 +01:00
802582ceec changed terminal and updated bar 2025-03-28 12:47:26 +01:00
2e00516fd0 feat: changed mic mute to equibot toggle mute 2025-03-12 21:42:14 +01:00
26303b95e9 fix: fixed button mapping and added documentation 2025-02-21 13:57:35 +01:00
cc72b2eff6 fix: button maps and flake fixes 2025-02-21 12:14:04 +01:00
dfc7fb0e2e feat: added mouse binds 2025-02-21 10:39:36 +01:00
688c3654cd feat: enabled pertag layout patch 2025-01-07 11:48:21 +01:00
7d75c147d7 fix: font sizes 2024-12-31 00:30:42 +01:00
3c8140601d feat: minor layout, xkb and font tweaks 2024-12-31 00:12:56 +01:00
e528e0865f feat: cycle layouts 2024-12-28 15:31:07 +01:00
2c83076d18 chore: removed result 2024-12-28 15:30:37 +01:00
dc05a9f0df fix: ignore result 2024-12-28 15:30:09 +01:00
24eb4817db feat: flextime deluxe 2024-12-28 15:10:44 +01:00
b158739c63 fix: removed double binding 2024-12-28 12:55:13 +01:00
97dd5ae052 feat: more migration stuff 2024-12-27 19:52:29 +01:00
ccb50b0234 fix: compilation fixes 2024-12-27 17:40:38 +01:00
261eac2d36 feat: nixified 2024-12-27 17:04:25 +01:00
11 changed files with 2703 additions and 2182 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

2
.gitignore vendored
View File

@@ -4,3 +4,5 @@ dwm-msg
config.h
patches.h
.legacy/
.direnv/
result

400
bar.sh
View File

@@ -1,179 +1,245 @@
#!/bin/bash
#!/usr/bin/env bash
function lighten_color() {
offset=20
# Global variables for theme tracking
CURRENT_THEME=""
THEME_FILE="$HOME/.current_theme"
LAST_MTIME=0
hex_color=$1
hex_color=${hex_color:1}
red=${hex_color:0:2}
green=${hex_color:2:2}
blue=${hex_color:4:2}
red_dec=$(printf "%d" 0x$red)
green_dec=$(printf "%d" 0x$green)
blue_dec=$(printf "%d" 0x$blue)
if [[ $red_dec -lt 128 ]]; then
red_dec_l=$((red_dec+offset))
green_dec_l=$((green_dec+offset))
blue_dec_l=$((blue_dec+offset))
# Function to read current theme from file
get_current_theme() {
if [ -f "$THEME_FILE" ]; then
cat "$THEME_FILE" 2>/dev/null || echo "dark"
else
red_dec_l=$((red_dec-offset))
green_dec_l=$((green_dec-offset))
blue_dec_l=$((blue_dec-offset))
fi
red=$(printf "%02X" $red_dec_l)
green=$(printf "%02X" $green_dec_l)
blue=$(printf "%02X" $blue_dec_l)
echo "#$red$green$blue"
}
# ^c$var^ = fg color
# ^b$var^ = bg color
interval=0
# load colors
# . ~/.config/bar_themes/onedark
# colors
rosewater=#f4dbd6
flamingo=#f0c6c6
pink=#f5bde6
mauve=#c6a0f6
red=#fb4934
maroon=#ee99a0
peach=#f5a97f
yellow=#eed49f
green=#b8bb26
teal=#8bd5ca
sky=#91d7e3
sapphire=#7dc4e4
blue=#8aadf4
lavender=#b7bdf8
text=#cad3f5
subtext1=#b8c0e0
subtext0=#a5adcb
overlay2=#939ab7
overlay1=#8087a2
overlay0=#6e738d
surface2=#5b6078
surface1=#494d64
surface0=#363a4f
base=#24273a
mantle=#1e2030
crust=#181926
# Special
background=#282828
foreground=#ebdbb2
cursor=#ebdbb2
# Colors
color0=#05090e
color1=#425965
color2=#016b86
color3=#1f7284
color4=#48717a
color5=#358292
color6=#79796b
color7=#828486
color8=#43464a
color9=#597787
color10=#028FB3
color11=#2A99B1
color12=#6097A3
color13=#47AEC3
color14=#A2A28F
color15=#c0c1c2
background0=$(lighten_color $background)
background1=$(lighten_color $background0)
background2=$(lighten_color $background1)
pulse () {
VOL=$(pamixer --get-volume)
STATE=$(pamixer --get-mute)
printf "%s" "$SEP1"
if [ "$STATE" = "true" ] || [ "$VOL" -eq 0 ]; then
printf "AMUT%%"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "A%s%%" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "A%s%%" "$VOL"
else
printf "A%s%%" "$VOL"
fi
printf "%s\n" "$SEP2"
}
cpu() {
cpu_val=$(grep -o "^[^ ]*" /proc/loadavg)
printf "^c$background^ ^b$yellow^ 󰇄 "
printf "^c$background^ ^b$yellow^$cpu_val"
}
battery() {
capacity_0="$(cat /sys/class/power_supply/BAT0/capacity)"
capacity_1="$(cat /sys/class/power_supply/BAT1/capacity)"
capacity="$capacity_0+$capacity_1"
# capacity=$(((capacity_0 + capacity_1) / 2))
printf " B$capacity%% "
}
brightness() {
value=$(cat /sys/class/backlight/*/brightness)
percentage=$(echo "scale=2; $value / 8.54" | bc)
printf "L%.0f%%" "$percentage"
}
mem() {
printf "^c$background^^b$green^  "
printf "^c$background^^b$green^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
}
wlan() {
case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in
up) printf "^c$background^ ^b$blue^ 󰤨 ^c$background^ ^b$blue^Connected" ;;
down) printf "^c$background^ ^b$blue^ 󰤭 ^c$background^ ^b$blue^Disconnected" ;;
esac
}
clock() {
printf " $(date '+%I:%M %P') "
}
today() {
printf " $(date '+%b %e') "
}
net() {
if nc -zw1 c2yz.com 443; then
printf "^c$background^^b$green^ i "
else
printf "^c$background^^b$red^ ! "
echo "dark" # default to dark theme
fi
}
while true; do
# Function to check if theme file has been modified
theme_file_changed() {
if [ -f "$THEME_FILE" ]; then
local current_mtime=$(stat -c %Y "$THEME_FILE" 2>/dev/null || echo 0)
if [ "$current_mtime" -gt "$LAST_MTIME" ]; then
LAST_MTIME="$current_mtime"
return 0 # File was modified
fi
fi
return 1 # No change
}
# [ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates)
# interval=$((interval + 1))
# Function to update theme if changed
update_theme_if_changed() {
if theme_file_changed; then
local new_theme=$(get_current_theme)
if [ "$new_theme" != "$CURRENT_THEME" ]; then
CURRENT_THEME="$new_theme"
set_colors
echo "Bar theme changed to: $CURRENT_THEME" >&2
return 0 # Theme was updated
fi
fi
return 1 # No update
}
# sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
# sleep 1 && xsetroot -name "$(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
if hash dockd 2>/dev/null; then
sleep 1 && xsetroot -name "^c$foreground^^b$background1^ $(brightness) ^b$background0^ $(battery) $(net)^c$foreground^^b$background0^ $(today) ^b$background1^ $(clock) ^b$background2^ $(pulse) "
# Function to set color palette based on theme
set_colors() {
if [ "$CURRENT_THEME" = "light" ]; then
# Rosé Pine Dawn (light) color palette
BASE=#faf4ed
SURFACE=#fffaf3
OVERLAY=#f2e9e1
MUTED=#9893a5
SUBTLE=#797593
TEXT=#575279
LOVE=#b4637a
GOLD=#ea9d34
ROSE=#d7827e
PINE=#286983
FOAM=#56949f
IRIS=#907aa9
HIGHLIGHT_LOW=#f4ede8
HIGHLIGHT_MED=#dfdad9
HIGHLIGHT_HIGH=#cecacd
else
sleep 1 && xsetroot -name "^c$foreground^$(net)^c$foreground^^b$background0^ $(today) ^b$background1^ $(clock) ^b$background2^ $(pulse) "
# Rosé Pine (dark) color palette - default
BASE=#191724
SURFACE=#1f1d2e
OVERLAY=#26233a
MUTED=#6e6a86
SUBTLE=#908caa
TEXT=#e0def4
LOVE=#eb6f92
GOLD=#f6c177
ROSE=#ebbcba
PINE=#31748f
FOAM=#9ccfd8
IRIS=#c4a7e7
HIGHLIGHT_LOW=#21202e
HIGHLIGHT_MED=#403d52
HIGHLIGHT_HIGH=#524f67
fi
}
# Initialize theme
CURRENT_THEME=$(get_current_theme)
if [ -f "$THEME_FILE" ]; then
LAST_MTIME=$(stat -c %Y "$THEME_FILE" 2>/dev/null || echo 0)
fi
set_colors
echo "Bar started with theme: $CURRENT_THEME" >&2
# Function to get CPU usage
get_cpu_usage() {
cpu_usage=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print int(($2+$4-u1) * 100 / (t-t1)); }' \
<(grep 'cpu ' /proc/stat) <(sleep 1; grep 'cpu ' /proc/stat))
echo "^c$FOAM^CPU: $cpu_usage%"
}
# Function to get memory usage
get_memory_usage() {
# Extract used and total memory in kilobytes
mem_info=$(free -k | awk '/^Mem:/ {print $3, $2}')
used_mem=$(echo $mem_info | awk '{print $1}')
total_mem=$(echo $mem_info | awk '{print $2}')
# Calculate memory usage percentage
mem_percent=$(awk "BEGIN {printf \"%.0f%%\", ($used_mem / $total_mem) * 100}")
# Output the result with color
echo "^c$IRIS^MEM: $mem_percent"
}
# Function to get volume level
get_volume() {
# Get the default sink (output device) and its volume/mute status
default_sink=$(pactl get-default-sink)
volume=$(pactl get-sink-volume $default_sink | grep -o '[0-9]*%' | head -1)
is_muted=$(pactl get-sink-mute $default_sink | grep -o 'yes\|no')
# Replace "yes" with "MUT" and "no" with the volume level
if [ "$is_muted" = "yes" ]; then
volume="MUT"
fi
# Get the default source (input device) and its volume/mute status
default_source=$(pactl get-default-source)
mic_level=$(pactl get-source-volume $default_source | grep -o '[0-9]*%' | head -1)
is_mic_muted=$(pactl get-source-mute $default_source | grep -o 'yes\|no')
# Replace "yes" with "MUT" and "no" with the microphone level
if [ "$is_mic_muted" = "yes" ]; then
mic_level="MUT"
fi
# Output the results with colors
echo "^c$PINE^VOL: $volume MIC: $mic_level"
}
# Function to get brightness percentage
get_brightness() {
# Get the current brightness level (adjust path if needed)
brightness=$(cat /sys/class/backlight/intel_backlight/brightness)
max_brightness=$(cat /sys/class/backlight/intel_backlight/max_brightness)
# Calculate brightness percentage
brightness_percent=$(awk "BEGIN {printf \"%.0f%%\", ($brightness / $max_brightness) * 100}")
# Output the result with color
echo "^c$ROSE^BRT: $brightness_percent"
}
# Function to get weighted average battery level
get_battery_level() {
BAT_PATHS=(/sys/class/power_supply/BAT*)
total_now=0
total_full=0
for BAT in "${BAT_PATHS[@]}"; do
if [[ -f "$BAT/energy_now" && -f "$BAT/energy_full" ]]; then
now=$(<"$BAT/energy_now")
full=$(<"$BAT/energy_full")
elif [[ -f "$BAT/charge_now" && -f "$BAT/charge_full" ]]; then
now=$(<"$BAT/charge_now")
full=$(<"$BAT/charge_full")
else
continue
fi
total_now=$((total_now + now))
total_full=$((total_full + full))
done
if [[ $total_full -eq 0 ]]; then
percent=0
else
percent=$((100 * total_now / total_full))
fi
if (( percent < 15 )); then
echo "^c$TEXT^^b$LOVE^BAT: $percent%^b$BASE^"
else
echo "^c$LOVE^BAT: $percent%"
fi
# Get battery levels (adjust paths if needed)
# battery0_level=$(cat /sys/class/power_supply/BAT0/capacity)
# battery1_level=$(cat /sys/class/power_supply/BAT1/capacity)
# battery0_energy_full=$(cat /sys/class/power_supply/BAT0/energy_full)
# battery1_energy_full=$(cat /sys/class/power_supply/BAT1/energy_full)
# Calculate weights based on energy capacity
# weight0=$(awk "BEGIN {printf \"%.2f\", $battery0_energy_full / ($battery0_energy_full + $battery1_energy_full)}")
# weight1=$(awk "BEGIN {printf \"%.2f\", $battery1_energy_full / ($battery0_energy_full + $battery1_energy_full)}")
# Calculate weighted average
# weighted_avg=$(awk "BEGIN {printf \"%.0f%%\", ($battery0_level * $weight0 + $battery1_level * $weight1)}")
# battery0_level=$(cat /sys/class/power_supply/BAT0/capacity)
# echo "^c$LOVE^BAT: $battery0_level%"
# Output the result with color
# echo "^c$LOVE^BAT: $weighted_avg"
}
# Function to get date and time in American 12-hour format
get_datetime() {
datetime=$(date +"%a %d %b %I:%M %p")
echo "^c$GOLD^$datetime"
}
# Function to detect if the system is a laptop
is_laptop() {
# Check if battery and brightness files exist
if [ -d /sys/class/power_supply/BAT0 ] && [ -d /sys/class/backlight/intel_backlight ]; then
return 0 # Laptop
else
return 1 # PC
fi
}
# Main loop to update xsetroot
while true; do
# Check for theme changes on every iteration
update_theme_if_changed
# Combine all status components
if is_laptop; then
# Include battery and brightness for laptops
status="$(get_volume) ^c$TEXT^| $(get_cpu_usage) ^c$TEXT^| $(get_memory_usage) ^c$TEXT^| $(get_brightness) ^c$TEXT^| $(get_battery_level) ^c$TEXT^| $(get_datetime)"
else
# Exclude battery and brightness for PCs
status="$(get_volume) ^c$TEXT^| $(get_cpu_usage) ^c$TEXT^| $(get_memory_usage) ^c$TEXT^| $(get_datetime)"
fi
# Update the root window name with a darker background
xsetroot -name "$status"
# Sleep for 250 milis before updating
sleep 0.25
done

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
{ stdenv, fetchurl, libX11, libXft, libXinerama }:
stdenv.mkDerivation {
name = "dwm-HEAD";
src = builtins.filterSource
(path: type: (toString path) != (toString ./.git)) ./.;
buildInputs = [ libX11 libXft libXinerama ];
prePatch = ''
substituteInPlace config.mk --replace '/usr/local' $out
'';
meta = with stdenv.lib; {
description = "Dynamic window manager for X";
homepage = http://dwm.suckless.org/;
license = licenses.mit;
platforms = platforms.all;
};
}

23
flake.lock generated Normal file
View File

@@ -0,0 +1,23 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"path": "/nix/store/8fwsiv0hd7nw1brkvka0jf1frk3m7qkr-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

48
flake.nix Normal file
View File

@@ -0,0 +1,48 @@
{
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.${system}.dwm = pkgs.stdenv.mkDerivation rec {
pname = "dwm";
version = "custom";
src = ./.;
buildInputs = with pkgs; [
xorg.libX11
xorg.libXft
xorg.libXinerama
];
makeFlags = [ "CC=${pkgs.gcc}/bin/cc" ];
installPhase = ''
mkdir -p $out/bin
cp dwm $out/bin/
'';
meta = with pkgs.lib; {
description = "Dynamic Window Manager";
license = licenses.mit;
maintainers = [ ];
};
};
defaultPackage.${system} = self.packages.${system}.dwm;
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
gnumake
gcc
xorg.libX11
xorg.libX11.dev
xorg.libXft
xorg.libXinerama
];
shellHook = ''
echo "Development shell for dwm ready."
'';
};
};
}

0
patch/dwmc Executable file → Normal file
View File

0
patch/layoutmenu.sh Executable file → Normal file
View File

File diff suppressed because it is too large Load Diff

4
rebuild.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
rm -f config.h patches.h
make clean && make && sudo make install