From 1353de44f71b2c01ef66e257050cfa1916a89fa1 Mon Sep 17 00:00:00 2001
From: 2Shirt <2xShirt@gmail.com>
Date: Sun, 10 Jan 2021 19:55:19 -0700
Subject: [PATCH] Merge refactored code
NOTE: This was unintentionally squashed so some details were lost
* Include max CPU temp in Conky
* New tint2 theme
---
scripts/{tint2-sensors => max-cpu-temp} | 18 ++++++-----
scripts/pacinit | 3 ++
scripts/resize-and-run | 24 ++++++++++++--
scripts/wk-exit | 31 -------------------
setup/build_linux | 3 ++
.../profile_base/airootfs/etc/skel/.aliases | 2 +-
.../airootfs/etc/sudoers.d/wheel_nopass | 1 +
.../airootfs/root/customize_airootfs.sh | 7 -----
.../airootfs/etc/skel/.config/conky/base.conf | 9 +++---
.../etc/skel/.config/openbox/menu.xml | 2 +-
.../airootfs/etc/skel/.config/openbox/rc.xml | 20 ++++++------
.../etc/skel/.config/picom/picom.conf | 26 ++++++++++++++++
.../airootfs/etc/skel/.config/tint2/tint2rc | 9 +-----
.../profile_gui/airootfs/etc/skel/.update_x | 25 ++++-----------
.../profile_gui/airootfs/etc/skel/.xinitrc | 2 ++
15 files changed, 90 insertions(+), 92 deletions(-)
rename scripts/{tint2-sensors => max-cpu-temp} (79%)
delete mode 100755 scripts/wk-exit
create mode 100644 setup/linux/profile_base/airootfs/etc/sudoers.d/wheel_nopass
create mode 100644 setup/linux/profile_gui/airootfs/etc/skel/.config/picom/picom.conf
diff --git a/scripts/tint2-sensors b/scripts/max-cpu-temp
similarity index 79%
rename from scripts/tint2-sensors
rename to scripts/max-cpu-temp
index e5e31145..54a4ac3b 100755
--- a/scripts/tint2-sensors
+++ b/scripts/max-cpu-temp
@@ -38,8 +38,9 @@ def get_data():
return data
-def parse_data(data):
+def get_max_temp(data):
cpu_temps = []
+ max_cpu_temp = '??° C'
for adapter, sources in data.items():
if not CPU_REGEX.search(adapter):
continue
@@ -47,15 +48,18 @@ def parse_data(data):
for labels in sources.values():
for label, temp in sorted(labels.items()):
- if NON_TEMP_REGEX.search(label):
+ if 'input' not in label or NON_TEMP_REGEX.search(label):
continue
cpu_temps.append(temp)
- cpu_temps = [f'{int(temp)}°' for temp in cpu_temps]
- if not cpu_temps:
- cpu_temps.append('??°')
- return ' | '.join(cpu_temps)
+ # Format data
+ if cpu_temps:
+ max_cpu_temp = int(max(cpu_temps))
+ max_cpu_temp = f'{max_cpu_temp:02d}° C'
+
+ # Done
+ return max_cpu_temp
if __name__ == '__main__':
sensor_data = get_data()
- print(f' {parse_data(sensor_data)}')
+ print(get_max_temp(sensor_data))
diff --git a/scripts/pacinit b/scripts/pacinit
index eda3f960..63797ab9 100755
--- a/scripts/pacinit
+++ b/scripts/pacinit
@@ -10,6 +10,9 @@ sudo sed -i -r "s/^(Server = )/#\1/" /etc/pacman.conf
# Disable signature checks
sudo sed -i -r "s/^SigLevel.*/SigLevel = Never/" /etc/pacman.conf
+# Init Pacman keyring
+sudo systemctl start pacman-init.service
+
# Refresh package databases
sudo pacman -Sy
diff --git a/scripts/resize-and-run b/scripts/resize-and-run
index a96ba005..08245ee3 100755
--- a/scripts/resize-and-run
+++ b/scripts/resize-and-run
@@ -6,10 +6,28 @@
## Height: | 24 | 10 (titlebar) | term_y | 24 | 30 (Tint2) |
## X Offset: 20 - 5 (shadow?)
## Y Offset: 24 - 5 (shadow?)
+conky_width=180
+gap_x=20
+gap_y=24
+picom_shadow=5
+tint2_height=30
+titlebar_height=10
source ~/.screen_data
-term_width="$(echo "$width_px - 240" | bc)"
-term_height="$(echo "$height_px - 88" | bc)"
+if [[ "${dpi}" -ge 192 ]]; then
+ conky_width=360
+ gap_x=40
+ gap_y=48
+ picom_shadow=5
+ tint2_height=60
+ titlebar_height=20
+fi
-wmctrl -r :ACTIVE: -e "0,15,19,$term_width,$term_height" && "$@"
+offset_x=$(echo "$gap_x - $picom_shadow" | bc)
+offset_y=$(echo "$gap_y - $picom_shadow" | bc)
+term_width="$(echo "$width_px - ($gap_x * 3) - $conky_width" | bc)"
+term_height="$(echo "$height_px - ($gap_y * 2) - $titlebar_height - $tint2_height" | bc)"
+
+sleep 0.1s
+wmctrl -r :ACTIVE: -e "0,$offset_x,$offset_y,$term_width,$term_height" && "$@"
diff --git a/scripts/wk-exit b/scripts/wk-exit
deleted file mode 100755
index 3c100bc9..00000000
--- a/scripts/wk-exit
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/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/build_linux b/setup/build_linux
index 035b2a43..ab70ac92 100755
--- a/setup/build_linux
+++ b/setup/build_linux
@@ -192,6 +192,9 @@ function update_live_env() {
# SSH
mkdir -p "$SKEL_DIR/.ssh"
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa"
+ if ! grep -qv "^#" "$ROOT_DIR/setup/linux/authorized_keys"; then
+ echo "WARNING: No authorized SSH keys found." 1>&2
+ fi
cp "$ROOT_DIR/setup/linux/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
# Root user
diff --git a/setup/linux/profile_base/airootfs/etc/skel/.aliases b/setup/linux/profile_base/airootfs/etc/skel/.aliases
index 34bb9b36..da30b470 100644
--- a/setup/linux/profile_base/airootfs/etc/skel/.aliases
+++ b/setup/linux/profile_base/airootfs/etc/skel/.aliases
@@ -11,7 +11,7 @@ alias du='du -sch --apparent-size'
alias fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;'
alias hexedit='hexedit --color'
alias hw-info='sudo hw-info | less -S'
-alias ip='ip -brief -color'
+alias ip='ip -br -c'
alias less='less -S'
alias ls='ls --color=auto'
alias mkdir='mkdir -p'
diff --git a/setup/linux/profile_base/airootfs/etc/sudoers.d/wheel_nopass b/setup/linux/profile_base/airootfs/etc/sudoers.d/wheel_nopass
new file mode 100644
index 00000000..7c499c26
--- /dev/null
+++ b/setup/linux/profile_base/airootfs/etc/sudoers.d/wheel_nopass
@@ -0,0 +1 @@
+%wheel ALL=(ALL) NOPASSWD: ALL
diff --git a/setup/linux/profile_base/airootfs/root/customize_airootfs.sh b/setup/linux/profile_base/airootfs/root/customize_airootfs.sh
index 7801ce9b..b562ea91 100755
--- a/setup/linux/profile_base/airootfs/root/customize_airootfs.sh
+++ b/setup/linux/profile_base/airootfs/root/customize_airootfs.sh
@@ -7,13 +7,6 @@ set -o errtrace
set -o nounset
set -o pipefail
-
sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen
locale-gen
-# Sudo
-echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
-
-# SSH
-#rm /root/.ssh/id*
-#rm /root/.zlogin
diff --git a/setup/linux/profile_gui/airootfs/etc/skel/.config/conky/base.conf b/setup/linux/profile_gui/airootfs/etc/skel/.config/conky/base.conf
index 895c32ba..3a562e87 100644
--- a/setup/linux/profile_gui/airootfs/etc/skel/.config/conky/base.conf
+++ b/setup/linux/profile_gui/airootfs/etc/skel/.config/conky/base.conf
@@ -20,6 +20,7 @@ conky.config = {
border_inner_margin = 5,
border_outer_margin = 0,
border_width = 2,
+ default_graph_height = 24,
draw_borders = false,
draw_graph_borders = true,
show_graph_range = false,
@@ -79,12 +80,10 @@ 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}}
+CPU: ${exec "max-cpu-temp"}${alignr}${freq_g} GHz
+${cpugraph cpu0}
RAM: ${mem} Used${alignr}${memmax}
-${memgraph ${gap_x},${width} ${color} ${color}}
+${memgraph}
#Network
${alignc}S H O R T C U T K E Y S
diff --git a/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/menu.xml b/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/menu.xml
index 2d560235..7af3b3c9 100644
--- a/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/menu.xml
+++ b/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/menu.xml
@@ -234,7 +234,7 @@
-
- oblogout
+ menu_powermenu
diff --git a/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/rc.xml b/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/rc.xml
index b78baba7..bb871df9 100644
--- a/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/rc.xml
+++ b/setup/linux/profile_gui/airootfs/etc/skel/.config/openbox/rc.xml
@@ -59,7 +59,7 @@
yes
yes
- sans
+ Hack
8
bold
@@ -68,7 +68,7 @@
- sans
+ Hack
8
bold
@@ -77,7 +77,7 @@
- sans
+ Hack
9
normal
@@ -86,7 +86,7 @@
- sans
+ Hack
9
normal
@@ -95,7 +95,7 @@
- sans
+ Hack
9
bold
@@ -104,7 +104,7 @@
- sans
+ Hack
9
bold
@@ -319,7 +319,7 @@
- rofi -combi-modi window,drun,run -show combi -modi combi
+ launcher_slate
@@ -344,7 +344,7 @@
- wk-exit
+ menu_powermenu
@@ -369,7 +369,7 @@
- rofi -combi-modi window,drun,run -show combi -modi combi
+ launcher_slate
@@ -394,7 +394,7 @@
- wk-exit
+ menu_powermenu
diff --git a/setup/linux/profile_gui/airootfs/etc/skel/.config/picom/picom.conf b/setup/linux/profile_gui/airootfs/etc/skel/.config/picom/picom.conf
new file mode 100644
index 00000000..3a07836a
--- /dev/null
+++ b/setup/linux/profile_gui/airootfs/etc/skel/.config/picom/picom.conf
@@ -0,0 +1,26 @@
+# Picom Settings
+#shadow = false;
+#fading = false
+#inactive-opacity = 1;
+#frame-opacity = 1;
+#backend = "xrender";
+#vsync = true
+#mark-wmwin-focused = true;
+#mark-ovredir-focused = true;
+#detect-rounded-corners = true;
+#detect-client-opacity = true;
+#refresh-rate = 0
+#detect-transient = true
+#detect-client-leader = true
+#use-damage = true
+#log-level = "warn";
+
+# My Stuff
+opacity-rule = [
+ "95:class_g = 'termite' && !_NET_WM_STATE@:32a",
+ "0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'",
+ "0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'",
+ "0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'",
+ "0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'",
+ "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'"
+];
diff --git a/setup/linux/profile_gui/airootfs/etc/skel/.config/tint2/tint2rc b/setup/linux/profile_gui/airootfs/etc/skel/.config/tint2/tint2rc
index 3b6248bc..7f6a69bb 100644
--- a/setup/linux/profile_gui/airootfs/etc/skel/.config/tint2/tint2rc
+++ b/setup/linux/profile_gui/airootfs/etc/skel/.config/tint2/tint2rc
@@ -107,7 +107,7 @@ border_color_pressed = #d64937 100
#-------------------------------------
# Panel
-panel_items = TESC
+panel_items = TSC
panel_size = 100% 30
panel_margin = 0 0
panel_padding = 0 0 0
@@ -247,10 +247,3 @@ tooltip_padding = 2 2
tooltip_background_id = 7
tooltip_font_color = #d8d8d8 100
tooltip_font = Hack 12
-
-#-------------------------------------
-# Sensors
-execp = new
-execp_command = tint2-sensors
-execp_interval = 1
-execp_font_color = #ffffff
diff --git a/setup/linux/profile_gui/airootfs/etc/skel/.update_x b/setup/linux/profile_gui/airootfs/etc/skel/.update_x
index 2f049532..2cc26c43 100755
--- a/setup/linux/profile_gui/airootfs/etc/skel/.update_x
+++ b/setup/linux/profile_gui/airootfs/etc/skel/.update_x
@@ -3,7 +3,6 @@
## Calculate DPI, update settings if necessary, then start desktop apps
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... "
@@ -29,11 +28,7 @@ dpi="${dpi:-0}"
# Save data
echo "width_px=$width_px" > "$HOME/.screen_data"
echo "height_px=$height_px" >> "$HOME/.screen_data"
-
-# Calculate URxvt default window size
-width_urxvt="$(echo "${width_px} * 112/1280" | bc)"
-height_urxvt="$(echo "${height_px} * 33/720" | bc)"
-offset_urxvt="24"
+echo "dpi=$dpi" >> "$HOME/.screen_data"
echo "Done"
@@ -42,10 +37,11 @@ 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"
- sed -i 's/gap_x 20/gap_x 40/' "${HOME}/.conkyrc_base"
- sed -i 's/gap_y 24/gap_y 48/' "${HOME}/.conkyrc_base"
+ sed -i 's/default_graph_height = 24/default_graph_height = 48/' "${HOME}/.config/conky/base.conf"
+ sed -i 's/gap_x = 20/gap_x = 40/' "${HOME}/.config/conky/base.conf"
+ sed -i 's/gap_y = 24/gap_y = 48/' "${HOME}/.config/conky/base.conf"
+ sed -i 's/maximum_width = 180/maximum_width = 360/' "${HOME}/.config/conky/base.conf"
+ sed -i 's/minimum_width = 180/minimum_width = 360/' "${HOME}/.config/conky/base.conf"
# Fonts
sed -i 's/!Xft.dpi: 192/Xft.dpi: 192/' "${HOME}/.Xresources"
@@ -67,19 +63,10 @@ if [[ "${dpi}" -ge 192 ]]; then
sed -i 's/systray_icon_size = 24/systray_icon_size = 48/' \
"${HOME}/.config/tint2/tint2rc"
- # URxvt
- 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)
-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
diff --git a/setup/linux/profile_gui/airootfs/etc/skel/.xinitrc b/setup/linux/profile_gui/airootfs/etc/skel/.xinitrc
index 54dc1428..bae960f2 100755
--- a/setup/linux/profile_gui/airootfs/etc/skel/.xinitrc
+++ b/setup/linux/profile_gui/airootfs/etc/skel/.xinitrc
@@ -1,6 +1,8 @@
#!/bin/sh
dbus-update-activation-environment --systemd DISPLAY
+export DISPLAY_SESSION="Openbox"
+export PATH="$HOME/.config/rofi/bin:$PATH"
eval $(ssh-agent)
export SSH_AUTH_SOCK
xrdb -merge $HOME/.Xresources