From ebd65715acc425872c06b0155ebabf2d60419283 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 2 Nov 2024 18:45:38 +0100 Subject: [PATCH] Improve raspi setup. --- many_releases/aptmark/raspi | 4 ++ many_releases/etc/raspi/greetd/config.toml | 2 +- .../home/desktop/.config/sway/config | 39 +++++++++++++++++-- .../on_session_start.sh} | 2 +- .../home/raspi/.nonpath_bins/status.sh | 12 ++++++ 5 files changed, 54 insertions(+), 5 deletions(-) rename many_releases/home/raspi/{.on_session_start.sh => .nonpath_bins/on_session_start.sh} (97%) create mode 100755 many_releases/home/raspi/.nonpath_bins/status.sh 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/.on_session_start.sh b/many_releases/home/raspi/.nonpath_bins/on_session_start.sh similarity index 97% rename from many_releases/home/raspi/.on_session_start.sh rename to many_releases/home/raspi/.nonpath_bins/on_session_start.sh index bcbba4d..380e79f 100755 --- a/many_releases/home/raspi/.on_session_start.sh +++ b/many_releases/home/raspi/.nonpath_bins/on_session_start.sh @@ -7,7 +7,7 @@ # 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 +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 -- 2.30.2