From 6408b1abff57c8f2c1d24a7ce5114f6cb8fa4758 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 20:11:06 -0700 Subject: [PATCH 01/19] Fixed ROOT_DIR under new organization --- setup/build_linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/build_linux b/setup/build_linux index 17547a33..c94b21a8 100755 --- a/setup/build_linux +++ b/setup/build_linux @@ -10,7 +10,7 @@ set -o pipefail # Prep DATE="$(date +%F)" DATETIME="$(date +%F_%H%M)" -ROOT_DIR="$(realpath $(dirname "$0"))" +ROOT_DIR="$(realpath $(dirname "$0")/..)" BUILD_DIR="$ROOT_DIR/setup/BUILD_LINUX" LIVE_DIR="$BUILD_DIR/live" LOG_DIR="$BUILD_DIR/logs" From 0e602bb504d615459af78a23509c6a5f7379d03e Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 20:11:25 -0700 Subject: [PATCH 02/19] Replaced 'which' with 'command -v' * Allows use under new Arch base package --- setup/build_linux | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/build_linux b/setup/build_linux index c94b21a8..392692e3 100755 --- a/setup/build_linux +++ b/setup/build_linux @@ -19,9 +19,9 @@ REPO_DIR="$BUILD_DIR/repo" SKEL_DIR="$LIVE_DIR/airootfs/etc/skel" TEMP_DIR="$BUILD_DIR/temp" MIRRORLIST_SOURCE='https://www.archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&ip_version=4&use_mirror_status=on' -if which nano >/dev/null 2>&1; then +if command -v nano >/dev/null 2>&1; then EDITOR=nano -elif which vim >/dev/null 2>&1; then +elif command -v vim >/dev/null 2>&1; then EDITOR=vim else EDITOR=vi @@ -130,7 +130,7 @@ function copy_live_env() { function run_elevated() { prog="$1" shift - if which sudo >/dev/null 2>&1; then + if command -v sudo >/dev/null 2>&1; then if ! sudo "$prog" $*; then echo "ERROR: Failed to run '$prog'" if ask "Retry?"; then From df2e4927d271c098cab4efbb1083ddac78af6276 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 21:20:17 -0700 Subject: [PATCH 03/19] Made add-known-networks executable --- scripts/add-known-networks | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/add-known-networks diff --git a/scripts/add-known-networks b/scripts/add-known-networks old mode 100644 new mode 100755 From bff3bbdc86c19b599e7bae92c8aff1158b2ff2f1 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 21:58:49 -0700 Subject: [PATCH 04/19] Added cdtmp alias --- setup/linux/include/airootfs/etc/skel/.aliases | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/linux/include/airootfs/etc/skel/.aliases b/setup/linux/include/airootfs/etc/skel/.aliases index b0068be3..88eb4070 100644 --- a/setup/linux/include/airootfs/etc/skel/.aliases +++ b/setup/linux/include/airootfs/etc/skel/.aliases @@ -4,6 +4,7 @@ alias 7z3='7z a -t7z -mx=3' alias 7z5='7z a -t7z -mx=5' alias 7z7='7z a -t7z -mx=7' alias 7z9='7z a -t7z -mx=9' +alias cdtmp='cd $(mktemp -d)' alias ddrescue='sudo ddrescue --ask --min-read-rate=64k -vvvv' alias diff='colordiff -ur' alias du='du -sch --apparent-size' From f91df9f4e7bb82682c9699c39fea949abef92e1d Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 21:59:11 -0700 Subject: [PATCH 05/19] Fixed hw-diags and ddrescue-tui launchers (again) --- scripts/ddrescue-tui | 2 +- scripts/hw-diags | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ddrescue-tui b/scripts/ddrescue-tui index acfb315b..3f648b66 100755 --- a/scripts/ddrescue-tui +++ b/scripts/ddrescue-tui @@ -12,7 +12,7 @@ if [[ "$os_name" != "Linux" ]]; then exit 1 fi -source ./launch-in-tmux +source launch-in-tmux SESSION_NAME="ddrescue-tui" WINDOW_NAME="ddrescue TUI" diff --git a/scripts/hw-diags b/scripts/hw-diags index c6c5f4f1..16684630 100755 --- a/scripts/hw-diags +++ b/scripts/hw-diags @@ -2,7 +2,7 @@ # ## Wizard Kit: HW Diagnostics Launcher -source ./launch-in-tmux +source launch-in-tmux SESSION_NAME="hw-diags" WINDOW_NAME="Hardware Diagnostics" From e9b1fe78192f5f2c744b11265588cbadda829073 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 21:59:40 -0700 Subject: [PATCH 06/19] Adjusted clone settings filename * Use source path if the model wasn't detected * Avoids names like "Clone_.json" --- scripts/wk/hw/ddrescue.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/wk/hw/ddrescue.py b/scripts/wk/hw/ddrescue.py index 55ad30f5..36ebce2b 100644 --- a/scripts/wk/hw/ddrescue.py +++ b/scripts/wk/hw/ddrescue.py @@ -305,6 +305,13 @@ class State(): working_dir=self.working_dir, )) + def _get_clone_settings_path(self): + """get Clone settings file path, returns pathlib.Path obj.""" + description = self.source.details['model'] + if not description: + description = self.source.path.name + return pathlib.Path(f'{self.working_dir}/Clone_{description}.json') + def _fix_tmux_layout(self, forced=True): """Fix tmux layout based on cfg.ddrescue.TMUX_LAYOUT.""" layout = cfg.ddrescue.TMUX_LAYOUT @@ -373,9 +380,7 @@ class State(): def _load_settings(self, discard_unused_settings=False): """Load settings from previous run, returns dict.""" settings = {} - settings_file = pathlib.Path( - f'{self.working_dir}/Clone_{self.source.details["model"]}.json', - ) + settings_file = self._get_clone_settings_path() # Try loading JSON data if settings_file.exists(): @@ -423,9 +428,7 @@ class State(): def _save_settings(self, settings): """Save settings for future runs.""" - settings_file = pathlib.Path( - f'{self.working_dir}/Clone_{self.source.details["model"]}.json', - ) + settings_file = self._get_clone_settings_path() # Try saving JSON data try: From c161ebac2a23fa18f0f6a97fd43f5d9607931969 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 22:11:07 -0700 Subject: [PATCH 07/19] Save ddrescue results to log at exit * Instead of printing them since it should be run in tmux * And as such the results would be obscured from the user anyway --- scripts/wk/hw/ddrescue.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/wk/hw/ddrescue.py b/scripts/wk/hw/ddrescue.py index 36ebce2b..f9b0d023 100644 --- a/scripts/wk/hw/ddrescue.py +++ b/scripts/wk/hw/ddrescue.py @@ -1697,8 +1697,9 @@ def main(): break # Save results to log - std.print_standard(' ') - std.print_report(state.generate_report()) + LOG.info('') + for line in state.generate_report(): + LOG.info(' %s', std.strip_colors(line)) def mount_raw_image(path): From 23fb36cd8aae52ce3550d60fc35768c1de72bab2 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 23:18:37 -0700 Subject: [PATCH 08/19] Added upload-logs script --- scripts/upload-logs | 90 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 scripts/upload-logs diff --git a/scripts/upload-logs b/scripts/upload-logs new file mode 100755 index 00000000..aea4d318 --- /dev/null +++ b/scripts/upload-logs @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# vim: sts=2 sw=2 ts=2 +"""Wizard Kit: Upload Logs""" + +import datetime +import os +import pathlib + +import pytz +import requests + +import wk + + +# STATIC VARIABLES +LOG_DIR = pathlib.Path('~/Logs').expanduser().resolve() +PLATFORM = wk.std.PLATFORM.replace('Darwin', 'macOS') +TIMEZONE = pytz.timezone(wk.cfg.main.LINUX_TIME_ZONE) +NOW = datetime.datetime.now(tz=TIMEZONE) + + +# Safety check +if PLATFORM not in ('macOS', 'Linux'): + raise OSError(f'This script is not supported under {PLATFORM}') + + +# Functions +def main(): + """Upload logs for review.""" + lines = [] + try_and_print = wk.std.TryAndPrint() + + # Set log + wk.log.update_log_path(dest_name='Upload-Logs', timestamp=True) + + # Instructions + wk.std.print_success(f'{wk.cfg.main.KIT_NAME_FULL}: Upload Logs') + wk.std.print_standard('') + wk.std.print_standard('Please state the reason for the review.') + wk.std.print_info(' End note with an empty line.') + wk.std.print_standard('') + + # Get reason note + while True: + text = wk.std.input_text('> ') + if not text: + lines.append('') + break + lines.append(text) + with open(f'{LOG_DIR}/__reason__.txt', 'a') as _f: + _f.write('\n'.join(lines)) + + # Compress and upload logs + result = try_and_print.run( + message='Uploading logs...', + function=upload_log_dir, + reason='Review', + ) + if not result['Failed']: + raise SystemExit(1) + + +def upload_log_dir(reason='Testing'): + """Upload compressed log_dir to the crash server.""" + server = wk.cfg.net.CRASH_SERVER + dest = pathlib.Path(f'~/{reason}_{NOW.strftime("%Y-%m-%dT%H%M%S%z")}.txz') + dest = dest.expanduser().resolve() + data = None + + # Compress LOG_DIR (relative to parent dir) + os.chdir(LOG_DIR.parent) + cmd = ['tar', 'caf', dest.name, LOG_DIR.name] + proc = wk.exe.run_program(cmd, check=False) + + # Upload compressed data + url = f'{server["Url"]}/{dest.name}' + result = requests.put( + url, + data=dest.read_bytes(), + headers=server['Headers'], + auth=(server['User'], server['Pass']), + ) + + # Check result + if not result.ok: + raise wk.std.GenericError('Failed to upload logs') + + +if __name__ == '__main__': + main() From d8730139686cd828a788349a0999964a9eb25b88 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 13 Jan 2020 23:19:18 -0700 Subject: [PATCH 09/19] Explicitly request Python 3 --- scripts/upload-logs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upload-logs b/scripts/upload-logs index aea4d318..c31b6014 100755 --- a/scripts/upload-logs +++ b/scripts/upload-logs @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # vim: sts=2 sw=2 ts=2 """Wizard Kit: Upload Logs""" From d0e69683b5594877ab6fc52b3d18b1ab07ceb074 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 14:56:48 -0700 Subject: [PATCH 10/19] Changed Linux build path --- setup/build_linux | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/build_linux b/setup/build_linux index 392692e3..27f9a055 100755 --- a/setup/build_linux +++ b/setup/build_linux @@ -11,10 +11,10 @@ set -o pipefail DATE="$(date +%F)" DATETIME="$(date +%F_%H%M)" ROOT_DIR="$(realpath $(dirname "$0")/..)" -BUILD_DIR="$ROOT_DIR/setup/BUILD_LINUX" +BUILD_DIR="$ROOT_DIR/setup/BUILD" LIVE_DIR="$BUILD_DIR/live" LOG_DIR="$BUILD_DIR/logs" -OUT_DIR="$ROOT_DIR/setup/OUT_LINUX" +OUT_DIR="$ROOT_DIR/setup/OUT" REPO_DIR="$BUILD_DIR/repo" SKEL_DIR="$LIVE_DIR/airootfs/etc/skel" TEMP_DIR="$BUILD_DIR/temp" From 6686a4d495bb04dedd3e6b9411d0e35b4c3259da Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 14:57:31 -0700 Subject: [PATCH 11/19] Set wallpaper in .update_x not .start_desktop_apps * Setting a wallpaper isn't really starting a desktop app anyway --- setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps | 1 - setup/linux/include_x/airootfs/etc/skel/.update_x | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps b/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps index d4a9abe2..2e33ed8f 100755 --- a/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps +++ b/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps @@ -3,7 +3,6 @@ ## 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 & diff --git a/setup/linux/include_x/airootfs/etc/skel/.update_x b/setup/linux/include_x/airootfs/etc/skel/.update_x index e8829371..0202750e 100755 --- a/setup/linux/include_x/airootfs/etc/skel/.update_x +++ b/setup/linux/include_x/airootfs/etc/skel/.update_x @@ -91,6 +91,11 @@ xset -dpms xrdb -merge $HOME/.Xresources echo "Done" +# Set wallpaper +echo -n "Setting wallpaper... " +feh --bg-fill "$HOME/.wallpaper" +echo "Done" + # Start desktop apps for i3 if fgrep -q "i3" /proc/cmdline; then i3-msg exec $HOME/.start_desktop_apps From 145103556041147f91cd52f3722202bae0b16518 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 15:12:43 -0700 Subject: [PATCH 12/19] Don't update conkyrc directly * By using a temp file and comparing we can avoid excessive reloading of conky --- .../include_x/airootfs/etc/skel/.update_conky | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/setup/linux/include_x/airootfs/etc/skel/.update_conky b/setup/linux/include_x/airootfs/etc/skel/.update_conky index 0e45e13d..653f90eb 100755 --- a/setup/linux/include_x/airootfs/etc/skel/.update_conky +++ b/setup/linux/include_x/airootfs/etc/skel/.update_conky @@ -1,24 +1,30 @@ #!/bin/bash +# vim: sts=2 sw=2 ts=2 + +CONFIG_BASE="${HOME}/.conkyrc_base" +CONFIG_NEW="${HOME}/.conkyrc_new" +CONFIG_REAL="${HOME}/.conkyrc" IF_LIST=($(ip l \ | egrep '^[0-9]+:\s+(eth|en|wl)' \ | sed -r 's/^[0-9]+:\s+(\w+):.*/\1/' \ | sort)) -# Reset conkyrc to default -rm "${HOME}/.conkyrc" -cp "${HOME}/.conkyrc_base" "${HOME}/.conkyrc" +# Build new config from the default +rm "${CONFIG_NEW}" +cp "${CONFIG_BASE}" "${CONFIG_NEW}" -# Add interfaces to conkyrc +# Add interfaces to conkyrc_new for i in "${IF_LIST[@]}"; do if [[ "${i:0:1}" == "e" ]]; then - sed -i -r "s/#Network/Wired:\${alignr}\${addr $i}\n#Network/" $HOME/.conkyrc + sed -i -r "s/#Network/Wired:\${alignr}\${addr $i}\n#Network/" "${CONFIG_NEW}" else - sed -i -r "s/#Network/Wireless:\${alignr}\${addr $i}\n#Network/" $HOME/.conkyrc + sed -i -r "s/#Network/Wireless:\${alignr}\${addr $i}\n#Network/" "${CONFIG_NEW}" fi done -# Remove '#Network' line to prevent duplicating lines if this script is re-run -sed -i -r "s/#Network//" $HOME/.conkyrc - -# vim: sts=2 sw=2 ts=2 +# Replace config if there were changes +if ! diff -q "${CONFIG_NEW}" "${CONFIG_REAL}" >/dev/null 2>&1; then + rm "${CONFIG_REAL}" + cp "${CONFIG_NEW}" "${CONFIG_REAL}" +fi From 627c86ce7f3f5a256e5f438c5bc649c30525479a Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 15:16:15 -0700 Subject: [PATCH 13/19] Removed unused .conky_start script --- setup/linux/include_x/airootfs/etc/skel/.conky_start | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100755 setup/linux/include_x/airootfs/etc/skel/.conky_start diff --git a/setup/linux/include_x/airootfs/etc/skel/.conky_start b/setup/linux/include_x/airootfs/etc/skel/.conky_start deleted file mode 100755 index c7230b17..00000000 --- a/setup/linux/include_x/airootfs/etc/skel/.conky_start +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -CONKY_RC="$HOME/.conkyrc" -if [[ -f "/run/archiso/bootmnt/arch/conky.rc" ]]; then - CONKY_RC="/run/archiso/bootmnt/arch/conky.rc" -fi - -sleep 2s && conky -c "${CONKY_RC}" -dq -sleep 5s && killall conky -c "${CONKY_RC}" -dq - From ac134b0a3ff9aba99c12866aa07ef5bd2d01d6bd Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 17:18:16 -0700 Subject: [PATCH 14/19] Updated Conky configs * Converted config to new Lua format * Moved config to ~/.config/conky/ * .update_conky updated to work with above changes * Dropped Disk and Network I/O sections --- .../airootfs/etc/skel/.config/conky/base.conf | 102 +++++++++++ .../include_x/airootfs/etc/skel/.conkyrc_base | 165 ------------------ .../include_x/airootfs/etc/skel/.update_conky | 7 +- 3 files changed, 106 insertions(+), 168 deletions(-) create mode 100644 setup/linux/include_x/airootfs/etc/skel/.config/conky/base.conf delete mode 100644 setup/linux/include_x/airootfs/etc/skel/.conkyrc_base diff --git a/setup/linux/include_x/airootfs/etc/skel/.config/conky/base.conf b/setup/linux/include_x/airootfs/etc/skel/.config/conky/base.conf new file mode 100644 index 00000000..36ce95bc --- /dev/null +++ b/setup/linux/include_x/airootfs/etc/skel/.config/conky/base.conf @@ -0,0 +1,102 @@ +--[[ +WizardKit: Conky Config + +Based on the Bunsen Labs / Crunchbang Conky configs. +]] + +conky.config = { + -- Window properties + background = true, + double_buffer = true, + own_window = true, + own_window_class = 'Conky', + own_window_hints = undecorated,below,skip_taskbar,skip_pager,sticky, + own_window_transparent = false, + own_window_type = 'desktop', + own_window_argb_value = 224, + own_window_argb_visual = true, + + -- Borders & Graphs + border_inner_margin = 5, + border_outer_margin = 0, + border_width = 2, + draw_borders = false, + draw_graph_borders = true, + show_graph_range = false, + show_graph_scale = false, + stippled_borders = 5, + + -- Colors + -- default_color 656667 # Waldorf original colour + -- default_color 7a7a7a # Flame & Bunsen Grey + -- default_color 929292 # Labs Grey + color0 = 'B0E0E6', -- PowderBlue + color1 = '778899', -- LightSlateGray + color2 = 'D8BFD8', -- Thistle + color3 = '9ACD32', -- YellowGreen + color4 = 'FFA07A', -- LightSalmon + color5 = 'FFDEAD', -- NavajoWhite + color6 = '00BFFF', -- DeepSkyBlue + color7 = '5F9EA0', -- CadetBlue + color8 = 'BDB76B', -- DarkKhaki + color9 = 'CD5C5C', -- IndianRed + default_color = 'C0C0C0', -- Silver + default_outline_color = 'black', + default_shade_color = 'black', + + -- Font + draw_outline = false, + draw_shades = false, + extra_newline = false, + font = 'Inconsolata:bold:size=9', + uppercase = false, + use_xft = true, + + -- Size & Placement + alignment = 'top_right', + gap_x = 20, + gap_y = 24, + maximum_width = 180, + minimum_height = 5, + minimum_width = 180, + + -- Misc + cpu_avg_samples = 2, + net_avg_samples = 2, + no_buffers = true, + out_to_console = false, + out_to_ncurses = false, + out_to_stderr = false, + out_to_x = true, + update_interval = 1.0, + use_spacer = 'none', +} + +conky.text = [[ +${color}${alignc}S Y S T E M I N F O +${hr} +Date:${alignr}${time %F} +Time:${alignr}${time %H:%M} +Uptime:${alignr}${uptime_short} + +CPU: ${if_match ${cpu cpu0}<10} ${cpu cpu0}\ +${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\ +${else}${cpu cpu0}${endif}${endif}% Used${alignr}${freq_g} GHz +${cpugraph cpu0 ${gap_x},${width} ${color} ${color}} +RAM: ${mem} Used${alignr}${memmax} +${memgraph ${gap_x},${width} ${color} ${color}} + +#Network +${alignc}S H O R T C U T K E Y S +${hr} +[Super] + d${alignr}HW Diagnostics +[Super] + f${alignr}File Manager +[Super] + i${alignr}HW Information +[Super] + m${alignr}Mount Volumes +[Super] + r${alignr}Run Dialog +[Super] + s${alignr}SMART Check +[Super] + t${alignr}Terminal +[Super] + v${alignr}View Temps +[Super] + w${alignr}Web Browser +[Super] + x${alignr}Logout +]] diff --git a/setup/linux/include_x/airootfs/etc/skel/.conkyrc_base b/setup/linux/include_x/airootfs/etc/skel/.conkyrc_base deleted file mode 100644 index af09dd8f..00000000 --- a/setup/linux/include_x/airootfs/etc/skel/.conkyrc_base +++ /dev/null @@ -1,165 +0,0 @@ -# For commands above TEXT check: -# http://conky.sourceforge.net/config_settings.html -# -# For commands available below TEXT check: -# http://conky.sourceforge.net/variables.html - -# Bunsen Labs Conky help threads -# http://crunchbang.org/forums/viewtopic.php?pid=371424#p371424 - -# beta tested by: smacz -# Enjoy! :) - -# pkill -xf "conky -q -c $HOME/.config/conky/BL-Default.conkyrc" & -### Begin Window Settings ##################### -own_window yes -#own_window_type override -own_window_transparent no -own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky -own_window_colour 000000 -own_window_class Conky -#own_window_title Bunsen Labs Default Conky -own_window_title Default Conky - -### ARGB can be used for real transparency -### NOTE that a composite manager is required for real transparency. -### This option will not work as desired (in most cases) in conjunction with -### own_window_type normal -own_window_argb_visual yes # Options: yes or no - -### When ARGB visuals are enabled, this use this to modify the alpha value -### Use: own_window_type normal -### Use: own_window_transparent no -### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity. -own_window_argb_value 224 - -minimum_size 180 0 ### width | height -maximum_width 180 - -gap_x 20 ### left | right -gap_y 24 ### up | down - -alignment tr -####################### End Window Settings ### -### Font Settings ############################# -# Use Xft (anti-aliased font and stuff) -use_xft yes -xftfont Inconsolata:bold:size=9 -#xftfont Liberation Sans:size=9 - -# Alpha of Xft font. Must be a value at or between 1 and 0 ### -xftalpha 1 -# Force UTF8? requires XFT ### -override_utf8_locale yes - -uppercase no -######################### End Font Settings ### -### Colour Settings ########################### -draw_shades no #yes -default_shade_color 000000 - -draw_outline no # amplifies text if yes -default_outline_color 000000 - -#default_color 656667 # Waldorf original colour -#default_color 7a7a7a # Flame & Bunsen Grey -#default_color 929292 # Labs Grey -default_color C0C0C0 # Silver -color0 B0E0E6 # PowderBlue -color1 778899 # LightSlateGray -color2 D8BFD8 # Thistle -color3 9ACD32 # YellowGreen -color4 FFA07A # LightSalmon -color5 FFDEAD # NavajoWhite -color6 00BFFF # DeepSkyBlue -color7 5F9EA0 # CadetBlue -color8 BDB76B # DarkKhaki -color9 CD5C5C # IndianRed -####################### End Colour Settings ### -### Borders Section ########################### -draw_borders no -# Stippled borders? -stippled_borders 5 -# border margins -border_inner_margin 5 -border_outer_margin 0 -# border width -border_width 2 -# graph borders -draw_graph_borders yes #no -#default_graph_size 15 40 -####################### End Borders Section ### -### Miscellaneous Section ##################### -# Boolean value, if true, Conky will be forked to background when started. -background yes - -# Adds spaces around certain objects to stop them from moving other things -# around, this only helps if you are using a mono font -# Options: right, left or none -use_spacer none - -# Default and Minimum size is 256 - needs more for single commands that -# "call" a lot of text IE: bash scripts -text_buffer_size 6144 - -# Subtract (file system) buffers from used memory? -no_buffers yes - -# change GiB to G and MiB to M -short_units yes - -# Like it says, ot pads the decimals on % values -# doesn't seem to work since v1.7.1 -pad_percents 2 - -# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use -# $image lots. Set to 0 to disable the image cache. -imlib_cache_size 0 - -# Use the Xdbe extension? (eliminates flicker) -# It is highly recommended to use own window with this one -# so double buffer won't be so big. -double_buffer yes - -# Maximum size of user text buffer, i.e. layout below TEXT line in config file -# (default is 16384 bytes) -# max_user_text 16384 - -# Desired output unit of all objects displaying a temperature. Parameters are -# either "fahrenheit" or "celsius". The default unit is degree Celsius. -# temperature_unit Fahrenheit - -################# End Miscellaneous Section ### -#### ${font Monospace:bold:size=10}${alignc}${execpi 600 $HOME/.config/conky/scripts/bunsenweather.sh} -update_interval 1 - -TEXT -${color}${alignc}S Y S T E M I N F O -${hr} -Date:${alignr}${time %F} -Time:${alignr}${time %H:%M} -Uptime:${alignr}${uptime_short} - -CPU: ${if_match ${cpu cpu0}<10} ${cpu cpu0}\ -${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\ -${else}${cpu cpu0}${endif}${endif}% Used${alignr}${freq_g} GHz -${cpugraph cpu0 ${gap_x},${width} ${color} ${color}} -RAM: ${mem} Used${alignr}${memmax} -${memgraph ${gap_x},${width} ${color} ${color}} -Disk I/O: -${diskiograph ${gap_x},${width} ${color} ${color}} -Down: ${downspeed}${goto 115}Up:${alignr}${upspeed} - -#Network -${alignc}S H O R T C U T K E Y S -${hr} -[Super] + d${alignr}HW Diagnostics -[Super] + f${alignr}File Manager -[Super] + i${alignr}HW Information -[Super] + m${alignr}Mount Volumes -[Super] + r${alignr}Run Dialog -[Super] + s${alignr}SMART Check -[Super] + t${alignr}Terminal -[Super] + v${alignr}View Temps -[Super] + w${alignr}Web Browser -[Super] + x${alignr}Logout diff --git a/setup/linux/include_x/airootfs/etc/skel/.update_conky b/setup/linux/include_x/airootfs/etc/skel/.update_conky index 653f90eb..0e1445df 100755 --- a/setup/linux/include_x/airootfs/etc/skel/.update_conky +++ b/setup/linux/include_x/airootfs/etc/skel/.update_conky @@ -1,9 +1,9 @@ #!/bin/bash # vim: sts=2 sw=2 ts=2 -CONFIG_BASE="${HOME}/.conkyrc_base" -CONFIG_NEW="${HOME}/.conkyrc_new" -CONFIG_REAL="${HOME}/.conkyrc" +CONFIG_BASE="${HOME}/.config/conky/base.conf" +CONFIG_NEW="${HOME}/.config/conky/new.conf" +CONFIG_REAL="${HOME}/.config/conky/conky.conf" IF_LIST=($(ip l \ | egrep '^[0-9]+:\s+(eth|en|wl)' \ @@ -22,6 +22,7 @@ for i in "${IF_LIST[@]}"; do sed -i -r "s/#Network/Wireless:\${alignr}\${addr $i}\n#Network/" "${CONFIG_NEW}" fi done +sed -i -r "s/#Network//" "${CONFIG_NEW}" # Replace config if there were changes if ! diff -q "${CONFIG_NEW}" "${CONFIG_REAL}" >/dev/null 2>&1; then From f16a01c6fb52786f3f32019b0d0ec6d0ab88bfd4 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 17:56:49 -0700 Subject: [PATCH 15/19] Adjusted startup configuration * picom replaced compton * Fix conky config for i3 use in .update_x * Improved detection of current WM in .start_desktop_apps and .update_conky --- setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps | 4 ++-- setup/linux/include_x/airootfs/etc/skel/.update_conky | 5 +++++ setup/linux/include_x/airootfs/etc/skel/.zlogin | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps b/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps index 2e33ed8f..d6d2b5ca 100755 --- a/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps +++ b/setup/linux/include_x/airootfs/etc/skel/.start_desktop_apps @@ -3,7 +3,7 @@ ## Start desktop apps based on WM # Start common apps -compton --backend xrender --xrender-sync --xrender-sync-fence & +picom --backend xrender --xrender-sync --xrender-sync-fence & sleep 1s x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared & conky & @@ -11,7 +11,7 @@ nm-applet & volumeicon & # Start WM specific apps -if fgrep -q "i3" /proc/cmdline; then +if ! [[ "${I3SOCK:-}" == "" ]]; then # i3 i3-msg restart else diff --git a/setup/linux/include_x/airootfs/etc/skel/.update_conky b/setup/linux/include_x/airootfs/etc/skel/.update_conky index 0e1445df..b97a86c1 100755 --- a/setup/linux/include_x/airootfs/etc/skel/.update_conky +++ b/setup/linux/include_x/airootfs/etc/skel/.update_conky @@ -24,6 +24,11 @@ for i in "${IF_LIST[@]}"; do done sed -i -r "s/#Network//" "${CONFIG_NEW}" +# Fix under i3 +if ! [[ "${I3SOCK:-}" == "" ]]; then + sed -i -r 's/(own_window_type)(.*)(desktop)/\1\2override/' "${CONKY_NEW}" +fi + # Replace config if there were changes if ! diff -q "${CONFIG_NEW}" "${CONFIG_REAL}" >/dev/null 2>&1; then rm "${CONFIG_REAL}" diff --git a/setup/linux/include_x/airootfs/etc/skel/.zlogin b/setup/linux/include_x/airootfs/etc/skel/.zlogin index 1b005d4d..65a23ed1 100644 --- a/setup/linux/include_x/airootfs/etc/skel/.zlogin +++ b/setup/linux/include_x/airootfs/etc/skel/.zlogin @@ -5,7 +5,6 @@ if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then # Update settings if using i3 if fgrep -q "i3" /proc/cmdline; then - sed -i -r 's/#(own_window_type override)/\1/' ~/.conkyrc sed -i -r 's/openbox-session/i3/' ~/.xinitrc fi From 92cfe54f981749858dcb9470ba7b2c4288dc638e Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 18:54:19 -0700 Subject: [PATCH 16/19] Added desktop shortcuts from dev branch --- .../airootfs/etc/skel/.config/i3/config | 18 +++++-- .../airootfs/etc/skel/.config/openbox/rc.xml | 50 +++++++++++++++++++ 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/setup/linux/include_x/airootfs/etc/skel/.config/i3/config b/setup/linux/include_x/airootfs/etc/skel/.config/i3/config index bc92b2d8..170cd333 100644 --- a/setup/linux/include_x/airootfs/etc/skel/.config/i3/config +++ b/setup/linux/include_x/airootfs/etc/skel/.config/i3/config @@ -9,6 +9,8 @@ # # Please see http://i3wm.org/docs/userguide.html for a complete reference! +set $alt Mod1 +set $ctrl Control set $mod Mod4 # Configure border style @@ -24,8 +26,8 @@ bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%- #decreas bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle # mute sound # alt+tab navi -bindsym Mod1+Tab workspace next -bindsym Mod1+Shift+Tab workspace prev +bindsym $alt+Tab workspace next +bindsym $alt+Shift+Tab workspace prev # change borders bindsym $mod+u border none @@ -57,7 +59,7 @@ bindsym $mod+Return exec i3-sensible-terminal # kill focused window bindsym $mod+Shift+q kill bindsym $mod+q kill -bindsym Mod1+F4 kill +bindsym $alt+F4 kill # start dmenu (a program launcher) #bindsym $mod+Shift+d exec dmenu_run @@ -66,8 +68,17 @@ bindsym Mod1+F4 kill # installed. #bindsym $mod+Shift+d exec --no-startup-id i3-dmenu-desktop bindsym $mod+r exec "rofi -combi-modi window,drun,run -show combi -modi combi" +bindsym $ctrl+$alt+r exec "rofi -combi-modi window,drun,run -show combi -modi combi" # misc app shortcuts +bindsym $ctrl+$alt+d exec "urxvt -title 'Hardware Diagnostics' -e hw-diags" +bindsym $ctrl+$alt+f exec "thunar ~" +bindsym $ctrl+$alt+i exec "hardinfo" +bindsym $ctrl+$alt+m exec "urxvt -title 'Mount All Volumes' -e mount-all-volumes gui" +bindsym $ctrl+$alt+s exec "urxvt -title 'Hardware Diagnostics' -e hw-diags --quick" +bindsym $ctrl+$alt+t exec "urxvt" +bindsym $ctrl+$alt+v exec "urxvt -title 'Hardware Sensors' -e watch -c -n1 -t hw-sensors" +bindsym $ctrl+$alt+w exec "firefox" bindsym $mod+d exec "urxvt -title 'Hardware Diagnostics' -e hw-diags" bindsym $mod+f exec "thunar ~" bindsym $mod+i exec "hardinfo" @@ -239,6 +250,7 @@ mode "resize" { bindsym $mod+Shift+r mode "resize" # "System" menu +bindsym $ctrl+$alt+x mode "$mode_system" bindsym $mod+x mode "$mode_system" set $mode_system (l)ock, (e)xit, (r)eboot, (s)hutdown, (c)onfig, (i)3 mode "$mode_system" { diff --git a/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml b/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml index e99f37ad..a61daa47 100644 --- a/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml +++ b/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml @@ -297,6 +297,56 @@ root-menu + + + urxvt -title "Hardware Diagnostics" -e hw-diags + + + + + thunar + + + + + hardinfo + + + + + urxvt -title "Mount all Volumes" -e mount-all-volumes gui + + + + + rofi -combi-modi window,drun,run -show combi -modi combi + + + + + urxvt -title "Hardware Diagnostics" -e hw-diags --quick + + + + + urxvt + + + + + urxvt -title "Hardware Sensors" -e watch -c -n1 -t hw-sensors + + + + + firefox + + + + + oblogout + + urxvt -title "Hardware Diagnostics" -e hw-diags From 7f9cb9917d121a875a96ae48457ac32f80eed4ee Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 18:57:27 -0700 Subject: [PATCH 17/19] Replaced oblogout with new wk-exit script * Dropped oblogout due to Python2 dependencies --- scripts/wk-exit | 31 +++++++++++++++++++ .../include_x/airootfs/etc/oblogout.conf | 20 ------------ .../airootfs/etc/skel/.config/openbox/rc.xml | 4 +-- setup/linux/packages/live_add_x | 1 - 4 files changed, 33 insertions(+), 23 deletions(-) create mode 100755 scripts/wk-exit delete mode 100644 setup/linux/include_x/airootfs/etc/oblogout.conf diff --git a/scripts/wk-exit b/scripts/wk-exit new file mode 100755 index 00000000..3c100bc9 --- /dev/null +++ b/scripts/wk-exit @@ -0,0 +1,31 @@ +#!/bin/bash +# +## WizardKit: GUI exit script +# Inspired by: https://github.com/cramermarius/rofi-menus/blob/master/scripts/powermenu.sh + +actions="Restart\nPoweroff\nLogout" +temp_file="$(mktemp --suffix=.png)" + +# Show blurred background +import -window root "${temp_file}" +convert "${temp_file}" -blur 0x4 "${temp_file}" +feh -F "${temp_file}" & +feh_pid="$!" + +# Show menu +selection="$(echo -e "$actions" | rofi -i -lines 3 -dmenu -p "Power Menu")" + +# Done +kill "${feh_pid}" +case $selection in + Logout) + wk-power-command logout + ;; + Poweroff) + wk-power-command poweroff + ;; + Restart) + wk-power-command reboot + ;; +esac + diff --git a/setup/linux/include_x/airootfs/etc/oblogout.conf b/setup/linux/include_x/airootfs/etc/oblogout.conf deleted file mode 100644 index ea5606ef..00000000 --- a/setup/linux/include_x/airootfs/etc/oblogout.conf +++ /dev/null @@ -1,20 +0,0 @@ -[settings] -usehal = false - -[looks] -opacity = 70 -bgcolor = black -buttontheme = foom -#buttons = cancel, logout, restart, shutdown, suspend, hibernate, lock -buttons = restart, shutdown, logout - -[shortcuts] -cancel = Escape -shutdown = S -restart = R -logout = L - -[commands] -shutdown = /usr/local/bin/wk-power-command poweroff -restart = /usr/local/bin/wk-power-command reboot -logout = /usr/local/bin/wk-power-command logout diff --git a/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml b/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml index a61daa47..08222f27 100644 --- a/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml +++ b/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml @@ -344,7 +344,7 @@ - oblogout + wk-exit @@ -394,7 +394,7 @@ - oblogout + wk-exit diff --git a/setup/linux/packages/live_add_x b/setup/linux/packages/live_add_x index ab7d23b3..02ade591 100644 --- a/setup/linux/packages/live_add_x +++ b/setup/linux/packages/live_add_x @@ -24,7 +24,6 @@ mpv network-manager-applet noto-fonts noto-fonts-cjk -oblogout openbox-patched otf-font-awesome-4 papirus-icon-theme From 45608e834656a1dd927b17d78d6d7cddebd4bbf4 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 19:00:56 -0700 Subject: [PATCH 18/19] Fixed shortcuts for hw-sensors --- setup/linux/include_x/airootfs/etc/skel/.config/i3/config | 4 ++-- .../linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup/linux/include_x/airootfs/etc/skel/.config/i3/config b/setup/linux/include_x/airootfs/etc/skel/.config/i3/config index 170cd333..91e754b8 100644 --- a/setup/linux/include_x/airootfs/etc/skel/.config/i3/config +++ b/setup/linux/include_x/airootfs/etc/skel/.config/i3/config @@ -77,7 +77,7 @@ bindsym $ctrl+$alt+i exec "hardinfo" bindsym $ctrl+$alt+m exec "urxvt -title 'Mount All Volumes' -e mount-all-volumes gui" bindsym $ctrl+$alt+s exec "urxvt -title 'Hardware Diagnostics' -e hw-diags --quick" bindsym $ctrl+$alt+t exec "urxvt" -bindsym $ctrl+$alt+v exec "urxvt -title 'Hardware Sensors' -e watch -c -n1 -t hw-sensors" +bindsym $ctrl+$alt+v exec "urxvt -title 'Hardware Sensors' -e hw-sensors" bindsym $ctrl+$alt+w exec "firefox" bindsym $mod+d exec "urxvt -title 'Hardware Diagnostics' -e hw-diags" bindsym $mod+f exec "thunar ~" @@ -85,7 +85,7 @@ 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" -bindsym $mod+v exec "urxvt -title 'Hardware Sensors' -e watch -c -n1 -t hw-sensors" +bindsym $mod+v exec "urxvt -title 'Hardware Sensors' -e hw-sensors" bindsym $mod+w exec "firefox" focus_follows_mouse no diff --git a/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml b/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml index 08222f27..28d9e8bd 100644 --- a/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml +++ b/setup/linux/include_x/airootfs/etc/skel/.config/openbox/rc.xml @@ -334,7 +334,7 @@ - urxvt -title "Hardware Sensors" -e watch -c -n1 -t hw-sensors + urxvt -title "Hardware Sensors" -e hw-sensors @@ -384,7 +384,7 @@ - urxvt -title "Hardware Sensors" -e watch -c -n1 -t hw-sensors + urxvt -title "Hardware Sensors" -e hw-sensors From a01f3d04b6d281d7246bb6370a864e3f101619bc Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 16 Jan 2020 19:18:12 -0700 Subject: [PATCH 19/19] Updated mount-all-volumes * Added gui argument to open Thunar after mounting --- scripts/mount-all-volumes | 7 +++++++ scripts/wk/os/linux.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/mount-all-volumes b/scripts/mount-all-volumes index fb703011..1e8b3353 100755 --- a/scripts/mount-all-volumes +++ b/scripts/mount-all-volumes @@ -2,6 +2,8 @@ """Wizard Kit: Mount all volumes""" # vim: sts=2 sw=2 ts=2 +import sys + import wk @@ -19,6 +21,11 @@ def main(): wk.std.print_info('Results') wk.std.print_report(report, indent=2) + # GUI mode + if 'gui' in sys.argv: + wk.std.pause('Press Enter to exit...') + wk.exe.popen_program(['nohup', 'thunar', '/media']) + if __name__ == '__main__': if wk.std.PLATFORM != 'Linux': diff --git a/scripts/wk/os/linux.py b/scripts/wk/os/linux.py index 253b1dd0..a62013ca 100644 --- a/scripts/wk/os/linux.py +++ b/scripts/wk/os/linux.py @@ -138,9 +138,9 @@ def mount_volumes(device_path=None, read_write=False, scan_corestorage=False): # Attempt to mount volume if not already_mounted: - mount(vol.path, read_write=read_write) - proc = run_program(cmd, check=False) - if proc.returncode: + try: + mount(vol.path, read_write=read_write) + except RuntimeError: result += 'Failed to mount' report.append(std.color_string(result, 'RED')) continue