From e798503f6f2db6fd3382e5ba62dbbbe9a2820b33 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 12 Jun 2019 16:37:04 -0600 Subject: [PATCH 1/5] Save RAM details to CpuObj --- .bin/Scripts/functions/hw_diags.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index ea19e90f..fe390e12 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -52,6 +52,12 @@ class CpuObj(): continue self.lscpu[_field] = _data + # Get RAM details as well + ram_details = get_ram_details() + self.ram_total = human_readable_size(ram_details.pop('Total', 0)).strip() + self.ram_dimms = [ + '{}x {}'.format(v, k) for k, v in sorted(ram_details.items())] + def generate_cpu_report(self): """Generate CPU report with data from all tests.""" report = [] @@ -59,11 +65,8 @@ class CpuObj(): report.append(' {}'.format(self.name)) # Include RAM details - ram_details = get_ram_details() - ram_total = human_readable_size(ram_details.pop('Total', 0)).strip() - ram_dimms = ['{}x {}'.format(v, k) for k, v in sorted(ram_details.items())] report.append('{BLUE}RAM{CLEAR}'.format(**COLORS)) - report.append(' {} ({})'.format(ram_total, ', '.join(ram_dimms))) + report.append(' {} ({})'.format(self.ram_total, ', '.join(self.ram_dimms))) # Tests for test in self.tests.values(): From b8e09e83ce03eda01a268763b3b7888fe4df439f Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 27 Jun 2019 18:57:45 -0600 Subject: [PATCH 2/5] Fixed issue #124 --- .linux_items/include/airootfs/etc/skel/.update_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.linux_items/include/airootfs/etc/skel/.update_network b/.linux_items/include/airootfs/etc/skel/.update_network index fb3ec990..5ab2a78c 100755 --- a/.linux_items/include/airootfs/etc/skel/.update_network +++ b/.linux_items/include/airootfs/etc/skel/.update_network @@ -3,7 +3,7 @@ ## Setup network and update hostname # Wait for WiFi -sleep 1s +sleep 3s # Set hostname IP="$(ip a show scope global \ From 747277b121b2a5bb6705e0c73add27faada034d9 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 27 Jun 2019 20:11:02 -0600 Subject: [PATCH 3/5] Adjusted Super+t keyboard shortcut * Now it opens to a standard urxvt window (no tmux attaching) --- .linux_items/include_x/airootfs/etc/skel/.config/i3/config | 2 +- .linux_items/include_x/airootfs/etc/skel/.config/openbox/rc.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.linux_items/include_x/airootfs/etc/skel/.config/i3/config b/.linux_items/include_x/airootfs/etc/skel/.config/i3/config index 102b50f5..ea9d6829 100644 --- a/.linux_items/include_x/airootfs/etc/skel/.config/i3/config +++ b/.linux_items/include_x/airootfs/etc/skel/.config/i3/config @@ -73,7 +73,7 @@ bindsym $mod+f exec "thunar ~" bindsym $mod+i exec "hardinfo" bindsym $mod+m exec "urxvt -title 'Mount All Volumes' -e mount-all-volumes gui" bindsym $mod+s exec "urxvt -title 'Hardware Diagnostics' -e hw-diags --quick" -bindsym $mod+t exec "urxvt -e zsh -c 'tmux new-session -A -t general; zsh'" +bindsym $mod+t exec "urxvt" bindsym $mod+v exec "urxvt -title 'Hardware Sensors' -e watch -c -n1 -t hw-sensors" bindsym $mod+w exec "firefox" diff --git a/.linux_items/include_x/airootfs/etc/skel/.config/openbox/rc.xml b/.linux_items/include_x/airootfs/etc/skel/.config/openbox/rc.xml index e563ec04..e99f37ad 100644 --- a/.linux_items/include_x/airootfs/etc/skel/.config/openbox/rc.xml +++ b/.linux_items/include_x/airootfs/etc/skel/.config/openbox/rc.xml @@ -329,7 +329,7 @@ - urxvt -e zsh -c 'tmux new-session -A -t general; zsh' + urxvt From 18daa41e2a00e62df8a7c846c4e35d3f67a3c7f9 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 27 Jun 2019 20:13:09 -0600 Subject: [PATCH 4/5] Trimmed down motd --- .linux_items/include/airootfs/etc/motd | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.linux_items/include/airootfs/etc/motd b/.linux_items/include/airootfs/etc/motd index c84d47a0..2a0a183b 100644 --- a/.linux_items/include/airootfs/etc/motd +++ b/.linux_items/include/airootfs/etc/motd @@ -1,9 +1,2 @@ -Welcome to the ______ - -Some common commands: -% hw-diags -% hw-info -% mount-all-volumes -% mount-backup-shares -% connect-to-network +Welcome to the ______ From 91d8185ede7f76e4337e114e9e741fa05573c5df Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 27 Jun 2019 20:14:14 -0600 Subject: [PATCH 5/5] Updated startup scripts * Moved starting apps from .update_x into .start_desktop_apps * This allowed .update_x to be shown on screen during startup * Included "... Done" messages for clarity * Removed x_ok logic (didn't really work) * Replaced with a generic message that _should_ be left on screen if X fails --- .../include/airootfs/etc/skel/.update_network | 4 +++ .../include_x/airootfs/etc/skel/.Xauthority | 0 .../airootfs/etc/skel/.config/i3/config | 2 +- .../etc/skel/.config/openbox/autostart | 4 ++- .../airootfs/etc/skel/.start_desktop_apps | 24 +++++++++++++ .../include_x/airootfs/etc/skel/.update_x | 35 ++++++++----------- .../include_x/airootfs/etc/skel/.xinitrc | 1 + .../include_x/airootfs/etc/skel/.zlogin | 22 ++++++------ 8 files changed, 58 insertions(+), 34 deletions(-) create mode 100644 .linux_items/include_x/airootfs/etc/skel/.Xauthority create mode 100755 .linux_items/include_x/airootfs/etc/skel/.start_desktop_apps diff --git a/.linux_items/include/airootfs/etc/skel/.update_network b/.linux_items/include/airootfs/etc/skel/.update_network index 5ab2a78c..6939afac 100755 --- a/.linux_items/include/airootfs/etc/skel/.update_network +++ b/.linux_items/include/airootfs/etc/skel/.update_network @@ -3,9 +3,12 @@ ## Setup network and update hostname # Wait for WiFi +echo -n "Waiting for network... " sleep 3s +echo "Done" # Set hostname +echo -n "Updating hostname... " IP="$(ip a show scope global \ | grep inet \ | head -1 \ @@ -19,4 +22,5 @@ fi if [[ "${NEW_HOSTNAME:+x}" ]]; then sudo hostnamectl set-hostname "${NEW_HOSTNAME}" fi +echo "Done" diff --git a/.linux_items/include_x/airootfs/etc/skel/.Xauthority b/.linux_items/include_x/airootfs/etc/skel/.Xauthority new file mode 100644 index 00000000..e69de29b diff --git a/.linux_items/include_x/airootfs/etc/skel/.config/i3/config b/.linux_items/include_x/airootfs/etc/skel/.config/i3/config index ea9d6829..bc92b2d8 100644 --- a/.linux_items/include_x/airootfs/etc/skel/.config/i3/config +++ b/.linux_items/include_x/airootfs/etc/skel/.config/i3/config @@ -320,4 +320,4 @@ bar { height 26 } -exec --no-startup-id /home/tech/.update_x +exec urxvt -title "Initializing..." -e /home/tech/.update_x diff --git a/.linux_items/include_x/airootfs/etc/skel/.config/openbox/autostart b/.linux_items/include_x/airootfs/etc/skel/.config/openbox/autostart index 13b9088c..1f96ce36 100755 --- a/.linux_items/include_x/airootfs/etc/skel/.config/openbox/autostart +++ b/.linux_items/include_x/airootfs/etc/skel/.config/openbox/autostart @@ -1,3 +1,5 @@ #openbox-autostart -$HOME/.update_x & +/usr/bin/urxvt -title "Initializing..." -e "$HOME/.update_x" +"$HOME/.start_desktop_apps" & + diff --git a/.linux_items/include_x/airootfs/etc/skel/.start_desktop_apps b/.linux_items/include_x/airootfs/etc/skel/.start_desktop_apps new file mode 100755 index 00000000..d4a9abe2 --- /dev/null +++ b/.linux_items/include_x/airootfs/etc/skel/.start_desktop_apps @@ -0,0 +1,24 @@ +#!/bin/env bash +# +## Start desktop apps based on WM + +# Start common apps +feh --bg-fill "$HOME/.wallpaper" +compton --backend xrender --xrender-sync --xrender-sync-fence & +sleep 1s +x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared & +conky & +nm-applet & +volumeicon & + +# Start WM specific apps +if fgrep -q "i3" /proc/cmdline; then + # i3 + i3-msg restart +else + # openbox + openbox --restart + tint2 & + cbatticon --hide-notification & +fi + diff --git a/.linux_items/include_x/airootfs/etc/skel/.update_x b/.linux_items/include_x/airootfs/etc/skel/.update_x index d7baea80..e8829371 100755 --- a/.linux_items/include_x/airootfs/etc/skel/.update_x +++ b/.linux_items/include_x/airootfs/etc/skel/.update_x @@ -5,6 +5,8 @@ REGEX_XRANDR='^.* ([0-9]+)x([0-9]+)\+[0-9]+\+[0-9]+.* ([0-9]+)mm x ([0-9]+)mm.*$' REGEX_URXVT='(URxvt.geometry:\s+).*' +echo -n "Getting display details... " + # Get screen data xrandr_str="$(xrandr | grep mm | head -1)" width_px="$(echo "${xrandr_str}" | sed -r "s/${REGEX_XRANDR}/\1/")" @@ -29,8 +31,12 @@ width_urxvt="$(echo "${width_px} * 112/1280" | bc)" height_urxvt="$(echo "${height_px} * 33/720" | bc)" offset_urxvt="24" +echo "Done" + # Update settings if necessary if [[ "${dpi}" -ge 192 ]]; then + echo -n "Updating settings for HiDPI... " + # Conky sed -i 's/minimum_size 180 0/minimum_size 360 0/' "${HOME}/.conkyrc_base" sed -i 's/maximum_width 180/maximum_width 360/' "${HOME}/.conkyrc_base" @@ -64,6 +70,9 @@ if [[ "${dpi}" -ge 192 ]]; then width_urxvt="$(echo "${width_urxvt} / 2" | bc)" height_urxvt="$(echo "${height_urxvt} / 2" | bc)" offset_urxvt="$(echo "${offset_urxvt} * 2" | bc)" + + # Done + echo "Done" fi # Update URxvt (Always) @@ -71,33 +80,19 @@ urxvt_geometry="${width_urxvt}x${height_urxvt}+${offset_urxvt}+${offset_urxvt}" sed -i -r "s/${REGEX_URXVT}/\1${urxvt_geometry}/" "${HOME}/.Xresources" # Update conky +echo -n "Updating conky... " $HOME/.update_conky +echo "Done" # Update X +echo -n "Updating X... " xset s off xset -dpms xrdb -merge $HOME/.Xresources +echo "Done" -# Start common desktop apps -feh --bg-fill "$HOME/.wallpaper" -compton --backend xrender --xrender-sync --xrender-sync-fence & -sleep 1s -x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared & -conky & -nm-applet & -volumeicon & - -# Start WM specific apps +# Start desktop apps for i3 if fgrep -q "i3" /proc/cmdline; then - # i3 - i3-msg restart -else - # openbox - openbox --restart - tint2 & - cbatticon --hide-notification & + i3-msg exec $HOME/.start_desktop_apps fi -# Prevent Xorg from being killed by .zlogin -touch "/tmp/x_ok" - diff --git a/.linux_items/include_x/airootfs/etc/skel/.xinitrc b/.linux_items/include_x/airootfs/etc/skel/.xinitrc index 7085a4df..54dc1428 100755 --- a/.linux_items/include_x/airootfs/etc/skel/.xinitrc +++ b/.linux_items/include_x/airootfs/etc/skel/.xinitrc @@ -3,5 +3,6 @@ dbus-update-activation-environment --systemd DISPLAY eval $(ssh-agent) export SSH_AUTH_SOCK +xrdb -merge $HOME/.Xresources exec openbox-session diff --git a/.linux_items/include_x/airootfs/etc/skel/.zlogin b/.linux_items/include_x/airootfs/etc/skel/.zlogin index 8901bb31..1b005d4d 100644 --- a/.linux_items/include_x/airootfs/etc/skel/.zlogin +++ b/.linux_items/include_x/airootfs/etc/skel/.zlogin @@ -1,7 +1,7 @@ setterm -blank 0 -powerdown 0 2>/dev/null if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then # Connect to network and update hostname - $HOME/.update_network + "${HOME}/.update_network" # Update settings if using i3 if fgrep -q "i3" /proc/cmdline; then @@ -11,18 +11,16 @@ if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then # Start X or HW-diags if ! fgrep -q "nox" /proc/cmdline; then - # Kill Xorg after 30 seconds if it doesn't fully initialize - (sleep 30s; if ! [[ -f "/tmp/x_ok" ]]; then pkill '(Xorg|startx)'; fi) & + # Show freeze warning + echo "" + echo "NOTE: Not all GPUs/displays are supported." + echo " If the system is frozen on this screen" + echo " please restart and try CLI mode instead" + echo "" - # Try starting X - startx >/dev/null - - # Run Hw-Diags CLI if necessary - if ! [[ -f "/tmp/x_ok" ]]; then - echo "There was an issue starting Xorg, starting CLI interface..." - sleep 2s - hw-diags --cli - fi + # Start x + echo "Starting X..." + startx >/dev/null 2>&1 else hw-diags --cli fi