aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2025-06-15 12:38:40 +0100
committerJustine Smithies <justine@smithies.me.uk>2025-06-15 12:38:40 +0100
commitb90ad8355b4b71ad328aba0943a62a123fb5b88d (patch)
tree58d8bba26b6a2a866af4abe138961adb2c32e9d3 /.config
parentd029adec94282882510be0d4398709a818b880ad (diff)
Initial commit for MaomaoWM - Still a WIP
Diffstat (limited to '.config')
-rw-r--r--.config/waybar/config87
-rwxr-xr-x.config/waybar/scripts/battery.sh53
-rwxr-xr-x.config/waybar/scripts/brightnesscontrol.sh40
-rwxr-xr-x.config/waybar/scripts/calendar.sh26
-rwxr-xr-x.config/waybar/scripts/date-time.sh12
-rwxr-xr-x.config/waybar/scripts/idleinhibit.sh28
-rwxr-xr-x.config/waybar/scripts/swayidle-update.sh7
-rwxr-xr-x.config/waybar/scripts/volumecontrol.sh130
-rw-r--r--.config/waybar/style.css250
9 files changed, 633 insertions, 0 deletions
diff --git a/.config/waybar/config b/.config/waybar/config
new file mode 100644
index 0000000..ad3478b
--- /dev/null
+++ b/.config/waybar/config
@@ -0,0 +1,87 @@
+{
+ "layer": "top",
+ "height": 20,
+ "spacing": 5,
+ "margin-top" :5,
+ "margin-right" :10,
+ "margin-left" :10,
+
+ "modules-left": [
+ "dwl/tags",
+ "dwl/window",
+ ],
+
+ "modules-center": ["custom/clock"],
+
+ "modules-right": [
+ //"custom/scratchpad-indicator",
+ "idle_inhibitor",
+ "custom/brightness",
+ "custom/audio",
+ "custom/battery",
+ ],
+
+ "dwl/tags": {
+ "num-tags": 9,
+ "tag-labels": ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ },
+
+ "dwl/window": {
+ "format": "<span color='#202020' bgcolor='#d3869b' > 󰣆 </span> {app_id} - {title}",
+ "icon":false,
+ "max-length": 100,
+ },
+
+ "custom/scratchpad-indicator": {
+ "format": "<span color='#202020' bgcolor='#8ec07c' >  </span> {}",
+ "return-type": "json",
+ "interval": 1,
+ "exec": "~/.local/bin/scratchpad-indicator.sh"
+ },
+
+ "idle_inhibitor": {
+ "format": "<span color='#202020' bgcolor='#458588' > {icon} </span>",
+ "format-icons": {
+ "activated": "",
+ "deactivated": ""
+ }
+ },
+
+ "custom/brightness": {
+ "format": "<span color='#202020' bgcolor='#d79921'>  </span> {}%",
+ "return-type": "json",
+ "exec": "~/.config/waybar/scripts/brightnesscontrol.sh",
+ "on-click": "~/.config/waybar/scripts/brightnesscontrol.sh down",
+ "on-click-right": "~/.config/waybar/scripts/brightnesscontrol.sh up",
+ "interval" : 1,
+ "tooltip" : false
+ },
+
+ "custom/battery": {
+ "format-icons": ["󰂎","󰁺","󰁻","󰁽","󰁾","󰁿","󰂀","󰂁","󰂂","󰁹"],
+ "format": "<span color='#202020' bgcolor='#689d6a' > {icon}{alt} </span> {}%",
+ "return-type": "json",
+ "interval": 1,
+ "exec": "~/.config/waybar/scripts/battery.sh",
+ "tooltip": false
+ },
+
+ "custom/audio": {
+ "format": "{}%",
+ "return-type": "json",
+ "interval": 1,
+ "exec": "~/.config/waybar/scripts/volumecontrol.sh",
+ "on-scroll-up": "~/.config/waybar/scripts/volumecontrol.sh up",
+ "on-scroll-down": "~/.config/waybar/scripts/volumecontrol.sh down",
+ "on-click": "~/.config/waybar/scripts/volumecontrol.sh mute",
+ "tooltip": false
+ },
+
+ "custom/clock": {
+ "format": "<span color='#202020' bgcolor='#689d6a' >  </span> {}",
+ "return-type": "json",
+ "interval": 1,
+ "exec": "~/.config/waybar/scripts/date-time.sh",
+ "on-click": "~/.config/waybar/scripts/calendar.sh show"
+ },
+}
diff --git a/.config/waybar/scripts/battery.sh b/.config/waybar/scripts/battery.sh
new file mode 100755
index 0000000..73fe1cd
--- /dev/null
+++ b/.config/waybar/scripts/battery.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# Send a notification if battery is low, change status in info file accordingly
+notify_low () {
+
+ # Battery isn't much but is charging (don't notify)
+ [ "$status" = "on-line" ] && return
+
+ # Battery critically low
+ if [ "$capacity" -le 10 ] && ! grep -q critically-low "$lowinfo"; then
+ notify-send -i "$HOME/.config/icons/critical-battery.png" -u critical "Battery critically low!"
+ echo critically-low >"$lowinfo"
+
+ # Battery is low
+ elif [ "$capacity" -le 20 ] && ! grep -q low "$lowinfo"; then
+ notify-send -i "$HOME/.config/icons/low-battery.png" -t 5500 "Battery low!"
+ echo low >"$lowinfo"
+ fi
+}
+
+status="$(apm | grep -E "AC Line status:" | sed -n -e 's/^.*AC Line status: //p')"
+capacity="$(apm | grep -E "Remaining battery life:" | head -1 | sed -n -e 's/^.*Remaining battery life: //p' | sed 's/.$//')"
+
+# Get the low battery status from file ~/.cache/battery-low-status
+lowinfo="$HOME/.cache/battery-low-status"
+[ ! -e "$lowinfo" ] && touch "$lowinfo"
+
+
+case $1 in
+ left-click)
+ ;;
+ *)
+ # Set charging icon and capacity icon
+ [ "$status" = "on-line" ] && charging_icon="" || charging_icon=""
+ [ "$capacity" -gt 100 ] && capacity=100
+ if [ "$capacity" -lt 15 ]; then capacity_icon=' '
+ elif [ "$capacity" -lt 40 ]; then capacity_icon=' '
+ elif [ "$capacity" -lt 60 ]; then capacity_icon=' '
+ elif [ "$capacity" -lt 90 ]; then capacity_icon=' '
+ else capacity_icon=' '
+ fi
+
+ # Report low battery
+ [ "$capacity" -le 20 ] && notify_low
+
+ # Reset low battery information in these cases
+ { [ "$capacity" -gt 20 ] || [ "$status" = "Charging" ]; } && [ -n "$(cat "$lowinfo")" ] && echo "" >"$lowinfo"
+
+ text=$capacity
+ alt=" "$charging_icon
+ echo "{\"text\": \"$text"\", \"alt\": \"$alt"\", \"tooltip\":\"$tooltip\", \"class\": \"$class\", \"percentage\":"$capacity"}"
+ ;;
+esac
diff --git a/.config/waybar/scripts/brightnesscontrol.sh b/.config/waybar/scripts/brightnesscontrol.sh
new file mode 100755
index 0000000..a59e410
--- /dev/null
+++ b/.config/waybar/scripts/brightnesscontrol.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# You can call this script like this:
+# brightnessControl up
+# brightnessControl down
+
+# Script inspired by these wonderful people:
+# https://github.com/dastorm/volume-notification-dunst/blob/master/volume.sh
+# https://gist.github.com/sebastiencs/5d7227f388d93374cebdf72e783fbd6a
+
+send_notification() {
+ icon="/usr/share/icons/Adwaita/symbolic/status/daytime-sunrise-symbolic.svg"
+ brightness=$(backlight -q)
+ # Make the bar with the special character ─ (it's not dash -)
+ # https://en.wikipedia.org/wiki/Box-drawing_character
+ bar=$(seq -s "─" 0 $((brightness / 10 )) | sed 's/[0-9]//g')
+ # Send the notification
+ fyi -i "$icon" --hint=string:x-canonical-private-synchronous:brightness -u normal "$bar $brightness"
+}
+
+case $1 in
+ up)
+ backlight + 4
+ backlight > ~/.cache/brightness
+ send_notification
+ # canberra-gtk-play -i audio-volume-change
+ ;;
+ down)
+ backlight - 4
+ backlight > ~/.cache/brightness
+ send_notification
+ # canberra-gtk-play -i audio-volume-change
+ ;;
+ *)
+ text=$(backlight -q)
+ icon=""
+ # printf "%s" "$icon $brightness" "%"
+ echo "{\"text\":\""$text"\", \"tooltip\":\""$tooltip"\"}"
+ ;;
+esac
diff --git a/.config/waybar/scripts/calendar.sh b/.config/waybar/scripts/calendar.sh
new file mode 100755
index 0000000..82ddd92
--- /dev/null
+++ b/.config/waybar/scripts/calendar.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Calendar script
+
+ShowCalendar() {
+ fyi -a "Calendar" --hint string:x-canonical-private-synchronous:calendar " 📅 Calendar" "$(cal | sed "s/\<$(date +%-d)\>/<span color='#fabd2f'><b>$(date +%-d)<\/b><\/span>/")"
+}
+
+EditCalendar() {
+ echo
+}
+
+case "$1" in
+ show)
+ ShowCalendar
+ ;;
+
+ edit)
+ EditCalendar
+ ;;
+
+ *)
+ echo $"Usage: ${0##*/} {show|edit}"
+ exit 1
+
+esac
diff --git a/.config/waybar/scripts/date-time.sh b/.config/waybar/scripts/date-time.sh
new file mode 100755
index 0000000..6ce5e30
--- /dev/null
+++ b/.config/waybar/scripts/date-time.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+DaySuffix() {
+ case `date +%-d` in
+ 1|21|31) echo "st";;
+ 2|22) echo "nd";;
+ 3|23) echo "rd";;
+ *) echo "th";;
+ esac
+}
+text=$(date "+%A %-d`DaySuffix` %B %Y - %H:%M ")
+
+echo "{\"text\":\""$text"\", \"tooltip\":\""$tooltip"\"}"
diff --git a/.config/waybar/scripts/idleinhibit.sh b/.config/waybar/scripts/idleinhibit.sh
new file mode 100755
index 0000000..c24f715
--- /dev/null
+++ b/.config/waybar/scripts/idleinhibit.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Swayidle toggle
+toggle() {
+ if pgrep "swayidle" > /dev/null
+ then
+ pkill swayidle
+ notify-send --hint=string:x-canonical-private-synchronous:idleinhibit -u normal " Swayidle Inactive"
+ else
+ sh "$HOME/.config/river/scripts/swayidle-update.sh"
+ notify-send --hint=string:x-canonical-private-synchronous:idleinhibit -u normal " Swayidle Active"
+ fi
+}
+
+case $1 in
+ toggle)
+ toggle
+ ;;
+ *)
+ if pgrep "swayidle" > /dev/null
+ then
+ icon=""
+ else
+ icon=""
+ fi
+ printf "%s" "$icon "
+ ;;
+esac
diff --git a/.config/waybar/scripts/swayidle-update.sh b/.config/waybar/scripts/swayidle-update.sh
new file mode 100755
index 0000000..f451b38
--- /dev/null
+++ b/.config/waybar/scripts/swayidle-update.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+pkill -f swayidle
+read -r wallpaper<"$HOME/.cache/wallpaper"
+swayidle -w \
+ timeout 300 "swaylock -f -i $wallpaper" \
+ timeout 600 "wlopm --off \*;swaylock -F -i $wallpaper" resume "wlopm --on \*" \
+ before-sleep "swaylock -f -i $wallpaper" &
diff --git a/.config/waybar/scripts/volumecontrol.sh b/.config/waybar/scripts/volumecontrol.sh
new file mode 100755
index 0000000..3359046
--- /dev/null
+++ b/.config/waybar/scripts/volumecontrol.sh
@@ -0,0 +1,130 @@
+#!/bin/sh
+
+# You can call this script like this:
+# volumecontrol up
+# volumecontrol down
+# volumecontrol mute
+
+get_volume() {
+ # pactl get-sink-volume @DEFAULT_SINK@ | grep '%' | cut -d '%' -f 1 | cut -d ' ' -f 6
+ echo "scale=1; $(mixer vol | grep 'vol.volume=' | cut -d '=' -f 2 | cut -d ':' -f 1)*100" | bc | cut -d '.' -f 1
+}
+
+is_mute() {
+ # pactl get-sink-mute @DEFAULT_SINK@ | grep 'Mute: yes' >> /dev/null
+ mixer vol | grep 'vol.mute=on' >> /dev/null
+}
+
+send_notification() {
+ volume=$(get_volume)
+ # Make the bar with the special character ─ (it's not dash -)
+ # https://en.wikipedia.org/wiki/Box-drawing_character
+ if [ "$volume" = "100" ]; then
+ icon=""
+ elif [ "$volume" -ge "89" ] && [ "$volume" -le "100" ]; then
+ icon=""
+ elif [ "$volume" -ge "79" ] && [ "$volume" -le "90" ]; then
+ icon=""
+ elif [ "$volume" -ge "69" ] && [ "$volume" -le "80" ]; then
+ icon=""
+ elif [ "$volume" -ge "59" ] && [ "$volume" -le "70" ]; then
+ icon=""
+ elif [ "$volume" -ge "49" ] && [ "$volume" -le "60" ]; then
+ icon=""
+ elif [ "$volume" -ge "39" ] && [ "$volume" -le "50" ]; then
+ icon=""
+ elif [ "$volume" -ge "29" ] && [ "$volume" -le "40" ]; then
+ icon=""
+ elif [ "$volume" -ge "19" ] && [ "$volume" -le "30" ]; then
+ icon=""
+ elif [ "$volume" -ge "9" ] && [ "$volume" -le "20" ]; then
+ icon=""
+ elif [ "$volume" -gt "0" ] && [ "$volume" -le "10" ]; then
+ icon=""
+ elif [ "$volume" -eq "0" ]; then
+ icon=""
+ class="muted"
+ fi
+bar=$(seq -s "─" $(($volume/5)) | sed 's/[0-9]//g')
+# Send the notification
+fyi --hint=string:x-canonical-private-synchronous:volumecontrol -u normal "$icon $bar $volume"
+}
+
+case $1 in
+ up)
+ # pactl set-sink-mute @DEFAULT_SINK@ 0
+ mixer vol.mute=off
+ # Up the volume (+ 2%)
+ # pactl set-sink-volume @DEFAULT_SINK@ +2%
+ mixer vol.volume=+2%
+ mixer vol > ~/.cache/audio-volume
+ send_notification
+ # canberra-gtk-play -i audio-volume-change
+ ;;
+ down)
+ # pactl set-sink-mute @DEFAULT_SINK@ 0
+ mixer vol.mute=off
+ # pactl set-sink-volume @DEFAULT_SINK@ -2%
+ mixer vol.volume=-2%
+ mixer vol > ~/.cache/audio-volume
+ send_notification
+ # canberra-gtk-play -i audio-volume-change
+ ;;
+ mute)
+ # Toggle mute
+ # pactl set-sink-mute @DEFAULT_SINK@ toggle
+ mixer vol.mute=toggle
+ mixer vol > ~/.cache/audio-volume
+ if is_mute ; then
+ icon="󰝟"
+ class="muted"
+ text="<span color='#202020' bgcolor='#ff00aa' > $icon </span> $volume"
+ fyi --hint=string:x-canonical-private-synchronous:volumecontrol -u normal "$icon Audio Muted"
+ else
+ send_notification
+ # canberra-gtk-play -i audio-volume-change
+ fi
+ ;;
+ *)
+ volume="$(get_volume)"
+
+ if [ "$volume" = "100" ]; then
+ icon=""
+ elif [ "$volume" -ge "89" ] && [ "$volume" -le "100" ]; then
+ icon=""
+ elif [ "$volume" -ge "79" ] && [ "$volume" -le "90" ]; then
+ icon=""
+ elif [ "$volume" -ge "69" ] && [ "$volume" -le "80" ]; then
+ icon=""
+ elif [ "$volume" -ge "59" ] && [ "$volume" -le "70" ]; then
+ icon=""
+ elif [ "$volume" -ge "49" ] && [ "$volume" -le "60" ]; then
+ icon=""
+ elif [ "$volume" -ge "39" ] && [ "$volume" -le "50" ]; then
+ icon=""
+ elif [ "$volume" -ge "29" ] && [ "$volume" -le "40" ]; then
+ icon=""
+ elif [ "$volume" -ge "19" ] && [ "$volume" -le "30" ]; then
+ icon=""
+ elif [ "$volume" -ge "9" ] && [ "$volume" -le "20" ]; then
+ icon=""
+ elif [ "$volume" -gt "0" ] && [ "$volume" -le "10" ]; then
+ icon=""
+ elif [ "$volume" -eq "0" ]; then
+ icon="󰝟"
+ class="muted"
+ fi
+
+
+if is_mute || [ "$class" = 'muted' ]; then
+ icon="󰝟"
+ class="muted"
+ text="<span color='#202020' bgcolor='#cc241d' > $icon </span> $volume"
+ else
+ text="<span color='#202020' bgcolor='#d65d0e' > $icon </span> $volume"
+fi
+
+alt=$icon
+echo "{\"text\": \"$text"\", \"alt\": \"$alt"\", \"tooltip\":\"$tooltip\", \"class\": \"$class\", \"percentage\":"$volume"}"
+ ;;
+esac
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
new file mode 100644
index 0000000..923d175
--- /dev/null
+++ b/.config/waybar/style.css
@@ -0,0 +1,250 @@
+/* ================================ */
+/* Common CSS */
+/* ================================ */
+* {
+ /* `otf-font-awesome` is required to be installed for icons */
+ padding: 0;
+ margin: 0;
+ min-height: 0;
+ border-radius: 0;
+ border: none;
+ text-shadow: none;
+ transition: none;
+ box-shadow: none;
+}
+
+/* the whole window */
+window#waybar {
+ color: #fff4d2;
+ background: none;
+}
+
+window#waybar.hidden {
+ opacity: 1;
+}
+
+#tags,
+/* #tags button, */
+/* #tags button.occupied, */
+/* #tags button.focused, */
+/* #tags button.urgent, */
+/* #tags button:not(.occupied):not(.focused), */
+#workspaces button,
+#workspaces button:hover,
+#workspaces button.visible,
+#workspaces button.visible:hover,
+#workspaces button.active,
+#workspaces button.active:hover,
+#workspaces button.urgent,
+#window,
+#idle_inhibitor,
+#language,
+#custom-scratchpad-indicator,
+#custom-brightness,
+#custom-memory,
+#custom-battery,
+#custom-battery.critical,
+#custom-battery.warning,
+#custom-audio,
+#custom-clock {
+ font-family: GoMono Nerd Font;
+ font-size: 12px;
+ font-weight: 800;
+ color: #202020;
+ background: #202020;
+ border: 2px solid #202020;
+}
+
+#window,
+#idle_inhibitor,
+#language,
+#custom-scratchpad-indicator,
+#custom-brightness,
+#custom-memory,
+#custom-battery,
+#custom-battery.critical,
+#custom-battery.warning,
+#custom-audio,
+#clock {
+ padding-right: 4px;
+}
+
+/* ================================ */
+/* workspaces module */
+/* ================================ */
+#workspaces {
+ margin: 0px;
+}
+
+#workspaces button {
+ color: #fff4d2;
+ padding: 0 4px;
+ margin: 0px 3px;
+ min-width: 15px;
+}
+
+#workspaces button:hover {
+ background: #d3869b;
+}
+
+#workspaces button.visible {
+ background: #8ec07c;
+}
+
+#workspaces button.visible:hover {
+ background: #8ec07c;
+}
+
+#workspaces button.active {
+ background: #8ec07c;
+}
+
+#workspaces button.active:hover {
+ background: #8ec07c;
+}
+
+#workspaces button.urgent {
+ background: #cc241d;
+}
+
+/* ================================ */
+/* window */
+/* ================================ */
+
+#window {
+ color: #d3869b;
+ margin-right: 4px;
+}
+
+window#waybar.empty #window {
+ background-color: transparent;
+ color: transparent;
+ border-bottom: none;
+ box-shadow: none;
+ padding-right: 0px;
+ padding-left: 0px;
+ margin-left: 0px;
+ margin-right: 0px;
+}
+
+/* ================================ */
+/* idle_inhibitor */
+/* ================================ */
+
+#idle_inhibitor {
+ color: #458588;
+ padding: 0;
+}
+
+/* ================================ */
+/* language */
+/* ================================ */
+
+#language {
+ color: #fb4934;
+}
+
+/* ================================ */
+/* custom-audio */
+/* ================================ */
+#custom-audio {
+ color: #d65d0e;
+}
+
+#custom-audio.muted {
+ color: #cc241d;
+}
+
+/* ================================ */
+/* custom-brightness */
+/* ================================ */
+#custom-brightness {
+ color: #d79921;
+}
+
+/*================================= */
+/* custom-scratchpad-indicator */
+/*==================================*/
+#custom-scratchpad-indicator {
+ color: #8ec07c;
+}
+
+/* ================================ */
+/* pulseaudio */
+/* ================================ */
+#pulseaudio {
+ color: #83a598;
+}
+
+#pulseaudio.muted {
+ color: #fb4934;
+}
+
+/* ================================ */
+/* custom-battery */
+/* ================================ */
+#custom-battery {
+ color: #689d6a;
+}
+
+#custom-battery.warning {
+ color: #fe8019;
+}
+
+#custom-battery.critical {
+ color: #cc241d;
+}
+
+/* ================================ */
+/* clock */
+/* ================================ */
+#custom-clock {
+ color: #689d6a;
+}
+
+/* ================================ */
+/* Tags */
+/* ================================ */
+
+#tags {
+ margin: 0px;
+}
+
+#tags button {
+ color: #928374;
+ background: #3c3836;
+ padding: 0 4px;
+ margin: 0px 2px;
+ min-width: 15px;
+}
+
+#tags button:hover {
+ color: #fff4d2;
+ background: #fe8019;
+}
+
+#tags button:not(.occupied):not(.focused) {
+ /* font-size: 0; */
+ /* min-width: 0; */
+ /* min-height: 0; */
+ /* margin: 0; */
+ /* padding: 0; */
+ /* color: transparent; */
+ /* background-color: transparent; */
+}
+
+#tags button.occupied {
+ color: #fff4d2;
+ background: #98971a;
+}
+
+#tags button.focused {
+ color: #fff4d2;
+ background: #fe8019;
+}
+
+#tags button.urgent {
+ color: #fff4d2;
+ background: #cc241d;
+}
+