From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 2 Nov 2024 17:45:38 +0000 (+0100)
Subject: Improve raspi setup.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Bdb.prefix%7D%7D/day_todos?a=commitdiff_plain;h=ebd65715acc425872c06b0155ebabf2d60419283;p=config

Improve raspi setup.
---

diff --git a/many_releases/aptmark/raspi b/many_releases/aptmark/raspi
index 6db4efe..537a645 100644
--- a/many_releases/aptmark/raspi
+++ b/many_releases/aptmark/raspi
@@ -5,6 +5,8 @@ raspi-firmware
 # to boot into a graphical environment
 greetd
 sway
+# for waybar script
+calc
 # for sound
 pulseaudio
 # for setting console keyboard via /etc/default/keyboard 
@@ -16,6 +18,8 @@ mpv
 firefox-esr
 # for convenience
 foot
+less
 sudo
 vim
 ack
+man-db
diff --git a/many_releases/etc/raspi/greetd/config.toml b/many_releases/etc/raspi/greetd/config.toml
index d07e7c9..d7b50f8 100644
--- a/many_releases/etc/raspi/greetd/config.toml
+++ b/many_releases/etc/raspi/greetd/config.toml
@@ -1,5 +1,5 @@
 [terminal]
 vt = 7 
 [default_session]
-command = "/home/plom/.on_session_start.sh"
+command = "~/.nonpath_bins/on_session_start.sh"
 user = "plom"
diff --git a/many_releases/home/desktop/.config/sway/config b/many_releases/home/desktop/.config/sway/config
index ccd2b50..e995681 100644
--- a/many_releases/home/desktop/.config/sway/config
+++ b/many_releases/home/desktop/.config/sway/config
@@ -1,4 +1,37 @@
-include /etc/sway/config
-output * background #551199 solid_color
-bindsym $mod+Shift+p exec swaynag -t warning -m 'Really exit sway/end Wayland session?' -B 'Yes, exit sway' 'swaymsg exit'
+# because these are included by /etc/sway/config for probably good reason …
+include /etc/sway/config-vars.d/*
+include /etc/sway/config.d/*
+
+# simple green background
+output * background #559911 solid_color
+
+# keyboard layout
 input * xkb_layout "de"
+
+# waybar
+bar {
+  position top
+  status_command ~/.nonpath_bins/status.sh
+}
+
+# keybindings
+set $mod Mod4
+
+bindsym $mod+Return exec foot
+bindsym $mod+Shift+q kill
+bindsym $mod+Shift+p exit
+
+bindsym $mod+f fullscreen
+bindsym $mod+space focus mode_toggle
+bindsym $mod+Shift+space floating toggle
+
+bindsym $mod+Left focus left
+bindsym $mod+Down focus down
+bindsym $mod+Up focus up
+bindsym $mod+Right focus right
+
+bindsym $mod+Shift+Left move left
+bindsym $mod+Shift+Down move down
+bindsym $mod+Shift+Up move up
+bindsym $mod+Shift+Right move right
+
diff --git a/many_releases/home/raspi/.nonpath_bins/on_session_start.sh b/many_releases/home/raspi/.nonpath_bins/on_session_start.sh
new file mode 100755
index 0000000..380e79f
--- /dev/null
+++ b/many_releases/home/raspi/.nonpath_bins/on_session_start.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/sh
+# Iinitalize anything we want in our sessions opened by greetd.
+
+# Workaround to pulseaudio daemon somehow not respecting setting these with
+# ~/.config/pulse/default.pa – note that the first pactl call also seems
+# necessary, probably for forcing some init routines without which the pacmd
+# calls that follow won't work; TODO: find cleaner solutions 
+pactl list sinks > /dev/null
+pacmd set-default-sink alsa_output.platform-fef05700.hdmi.hdmi-stereo
+pacmd set-sink-volume alsa_output.platform-fef05700.hdmi.hdmi-stereo 65536 
+
+# Wayland environment.
+/usr/bin/sway
diff --git a/many_releases/home/raspi/.nonpath_bins/status.sh b/many_releases/home/raspi/.nonpath_bins/status.sh
new file mode 100755
index 0000000..418a52b
--- /dev/null
+++ b/many_releases/home/raspi/.nonpath_bins/status.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# see sway-bar(5) and swaybar-protocol(7)
+printf '{ "version": 1 }\n[\n' 
+while true; do
+  printf '  [\n'
+  printf '    {"full_text": "%s"},\n' "$(ip -4 addr show scope global | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
+  printf '    {"full_text": "%d° C"},\n' $(calc "$(cat /sys/class/thermal/thermal_zone0/temp) // 1000")
+  printf '    {"full_text": "%.1f GHz"},\n' $(calc "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq) / 1000000")
+  printf '    {"full_text": "%s"},\n' "$(date +'%Y-%m-%d %X')"
+  printf '  ],\n'
+  sleep 1
+done
diff --git a/many_releases/home/raspi/.on_session_start.sh b/many_releases/home/raspi/.on_session_start.sh
deleted file mode 100755
index bcbba4d..0000000
--- a/many_releases/home/raspi/.on_session_start.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/sh
-# Iinitalize anything we want in our sessions opened by greetd.
-
-# Workaround to pulseaudio daemon somehow not respecting setting these with
-# ~/.config/pulse/default.pa – note that the first pactl call also seems
-# necessary, probably for forcing some init routines without which the pacmd
-# calls that follow won't work; TODO: find cleaner solutions 
-pactl list sinks > /dev/null
-pacmd set-default-sink alsa_output.platform-fef05700.hdmi.hdmi-stereo
-pacmd set-sink-volume alsa_output.platform-fef05700.hdmi.hdmi-stereo 32768 
-
-# Wayland environment.
-/usr/bin/sway