Merge refactored code

NOTE: This was unintentionally squashed so some details were lost

* Include max CPU temp in Conky
* New tint2 theme
This commit is contained in:
2Shirt 2021-01-10 19:55:19 -07:00
parent 118012d7e2
commit 1353de44f7
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
15 changed files with 90 additions and 92 deletions

View file

@ -38,8 +38,9 @@ def get_data():
return data return data
def parse_data(data): def get_max_temp(data):
cpu_temps = [] cpu_temps = []
max_cpu_temp = '??° C'
for adapter, sources in data.items(): for adapter, sources in data.items():
if not CPU_REGEX.search(adapter): if not CPU_REGEX.search(adapter):
continue continue
@ -47,15 +48,18 @@ def parse_data(data):
for labels in sources.values(): for labels in sources.values():
for label, temp in sorted(labels.items()): 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 continue
cpu_temps.append(temp) cpu_temps.append(temp)
cpu_temps = [f'{int(temp)}°' for temp in cpu_temps] # Format data
if not cpu_temps: if cpu_temps:
cpu_temps.append('??°') max_cpu_temp = int(max(cpu_temps))
return ' | '.join(cpu_temps) max_cpu_temp = f'{max_cpu_temp:02d}° C'
# Done
return max_cpu_temp
if __name__ == '__main__': if __name__ == '__main__':
sensor_data = get_data() sensor_data = get_data()
print(f' {parse_data(sensor_data)}') print(get_max_temp(sensor_data))

View file

@ -10,6 +10,9 @@ sudo sed -i -r "s/^(Server = )/#\1/" /etc/pacman.conf
# Disable signature checks # Disable signature checks
sudo sed -i -r "s/^SigLevel.*/SigLevel = Never/" /etc/pacman.conf sudo sed -i -r "s/^SigLevel.*/SigLevel = Never/" /etc/pacman.conf
# Init Pacman keyring
sudo systemctl start pacman-init.service
# Refresh package databases # Refresh package databases
sudo pacman -Sy sudo pacman -Sy

View file

@ -6,10 +6,28 @@
## Height: | 24 | 10 (titlebar) | term_y | 24 | 30 (Tint2) | ## Height: | 24 | 10 (titlebar) | term_y | 24 | 30 (Tint2) |
## X Offset: 20 - 5 (shadow?) ## X Offset: 20 - 5 (shadow?)
## Y Offset: 24 - 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 source ~/.screen_data
term_width="$(echo "$width_px - 240" | bc)" if [[ "${dpi}" -ge 192 ]]; then
term_height="$(echo "$height_px - 88" | bc)" 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" && "$@"

View file

@ -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

View file

@ -192,6 +192,9 @@ function update_live_env() {
# SSH # SSH
mkdir -p "$SKEL_DIR/.ssh" mkdir -p "$SKEL_DIR/.ssh"
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa" 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" cp "$ROOT_DIR/setup/linux/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
# Root user # Root user

View file

@ -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 fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;'
alias hexedit='hexedit --color' alias hexedit='hexedit --color'
alias hw-info='sudo hw-info | less -S' alias hw-info='sudo hw-info | less -S'
alias ip='ip -brief -color' alias ip='ip -br -c'
alias less='less -S' alias less='less -S'
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias mkdir='mkdir -p' alias mkdir='mkdir -p'

View file

@ -0,0 +1 @@
%wheel ALL=(ALL) NOPASSWD: ALL

View file

@ -7,13 +7,6 @@ set -o errtrace
set -o nounset set -o nounset
set -o pipefail set -o pipefail
sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen
locale-gen locale-gen
# Sudo
echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# SSH
#rm /root/.ssh/id*
#rm /root/.zlogin

View file

@ -20,6 +20,7 @@ conky.config = {
border_inner_margin = 5, border_inner_margin = 5,
border_outer_margin = 0, border_outer_margin = 0,
border_width = 2, border_width = 2,
default_graph_height = 24,
draw_borders = false, draw_borders = false,
draw_graph_borders = true, draw_graph_borders = true,
show_graph_range = false, show_graph_range = false,
@ -79,12 +80,10 @@ Date:${alignr}${time %F}
Time:${alignr}${time %H:%M} Time:${alignr}${time %H:%M}
Uptime:${alignr}${uptime_short} Uptime:${alignr}${uptime_short}
CPU: ${if_match ${cpu cpu0}<10} ${cpu cpu0}\ CPU: ${exec "max-cpu-temp"}${alignr}${freq_g} GHz
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\ ${cpugraph cpu0}
${else}${cpu cpu0}${endif}${endif}% Used${alignr}${freq_g} GHz
${cpugraph cpu0 ${gap_x},${width} ${color} ${color}}
RAM: ${mem} Used${alignr}${memmax} RAM: ${mem} Used${alignr}${memmax}
${memgraph ${gap_x},${width} ${color} ${color}} ${memgraph}
#Network #Network
${alignc}S H O R T C U T K E Y S ${alignc}S H O R T C U T K E Y S

View file

@ -234,7 +234,7 @@
</menu> </menu>
<separator/> <separator/>
<item label="Exit"> <action name="Execute"> <item label="Exit"> <action name="Execute">
<execute>oblogout</execute> <execute>menu_powermenu</execute>
</action> </item> </action> </item>
</menu> </menu>
</openbox_menu> </openbox_menu>

View file

@ -59,7 +59,7 @@
<keepBorder>yes</keepBorder> <keepBorder>yes</keepBorder>
<animateIconify>yes</animateIconify> <animateIconify>yes</animateIconify>
<font place="ActiveWindow"> <font place="ActiveWindow">
<name>sans</name> <name>Hack</name>
<size>8</size> <size>8</size>
<!-- font size in points --> <!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
@ -68,7 +68,7 @@
<!-- 'italic' or 'normal' --> <!-- 'italic' or 'normal' -->
</font> </font>
<font place="InactiveWindow"> <font place="InactiveWindow">
<name>sans</name> <name>Hack</name>
<size>8</size> <size>8</size>
<!-- font size in points --> <!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
@ -77,7 +77,7 @@
<!-- 'italic' or 'normal' --> <!-- 'italic' or 'normal' -->
</font> </font>
<font place="MenuHeader"> <font place="MenuHeader">
<name>sans</name> <name>Hack</name>
<size>9</size> <size>9</size>
<!-- font size in points --> <!-- font size in points -->
<weight>normal</weight> <weight>normal</weight>
@ -86,7 +86,7 @@
<!-- 'italic' or 'normal' --> <!-- 'italic' or 'normal' -->
</font> </font>
<font place="MenuItem"> <font place="MenuItem">
<name>sans</name> <name>Hack</name>
<size>9</size> <size>9</size>
<!-- font size in points --> <!-- font size in points -->
<weight>normal</weight> <weight>normal</weight>
@ -95,7 +95,7 @@
<!-- 'italic' or 'normal' --> <!-- 'italic' or 'normal' -->
</font> </font>
<font place="ActiveOnScreenDisplay"> <font place="ActiveOnScreenDisplay">
<name>sans</name> <name>Hack</name>
<size>9</size> <size>9</size>
<!-- font size in points --> <!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
@ -104,7 +104,7 @@
<!-- 'italic' or 'normal' --> <!-- 'italic' or 'normal' -->
</font> </font>
<font place="InactiveOnScreenDisplay"> <font place="InactiveOnScreenDisplay">
<name>sans</name> <name>Hack</name>
<size>9</size> <size>9</size>
<!-- font size in points --> <!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
@ -319,7 +319,7 @@
</keybind> </keybind>
<keybind key="C-A-r"> <keybind key="C-A-r">
<action name="Execute"> <action name="Execute">
<command>rofi -combi-modi window,drun,run -show combi -modi combi</command> <command>launcher_slate</command>
</action> </action>
</keybind> </keybind>
<keybind key="C-A-s"> <keybind key="C-A-s">
@ -344,7 +344,7 @@
</keybind> </keybind>
<keybind key="C-A-x"> <keybind key="C-A-x">
<action name="Execute"> <action name="Execute">
<command>wk-exit</command> <command>menu_powermenu</command>
</action> </action>
</keybind> </keybind>
<keybind key="W-d"> <keybind key="W-d">
@ -369,7 +369,7 @@
</keybind> </keybind>
<keybind key="W-r"> <keybind key="W-r">
<action name="Execute"> <action name="Execute">
<command>rofi -combi-modi window,drun,run -show combi -modi combi</command> <command>launcher_slate</command>
</action> </action>
</keybind> </keybind>
<keybind key="W-s"> <keybind key="W-s">
@ -394,7 +394,7 @@
</keybind> </keybind>
<keybind key="W-x"> <keybind key="W-x">
<action name="Execute"> <action name="Execute">
<command>wk-exit</command> <command>menu_powermenu</command>
</action> </action>
</keybind> </keybind>
<keybind key="XF86AudioRaiseVolume"> <keybind key="XF86AudioRaiseVolume">

View file

@ -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'"
];

View file

@ -107,7 +107,7 @@ border_color_pressed = #d64937 100
#------------------------------------- #-------------------------------------
# Panel # Panel
panel_items = TESC panel_items = TSC
panel_size = 100% 30 panel_size = 100% 30
panel_margin = 0 0 panel_margin = 0 0
panel_padding = 0 0 0 panel_padding = 0 0 0
@ -247,10 +247,3 @@ tooltip_padding = 2 2
tooltip_background_id = 7 tooltip_background_id = 7
tooltip_font_color = #d8d8d8 100 tooltip_font_color = #d8d8d8 100
tooltip_font = Hack 12 tooltip_font = Hack 12
#-------------------------------------
# Sensors
execp = new
execp_command = tint2-sensors
execp_interval = 1
execp_font_color = #ffffff

View file

@ -3,7 +3,6 @@
## Calculate DPI, update settings if necessary, then start desktop apps ## 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_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... " echo -n "Getting display details... "
@ -29,11 +28,7 @@ dpi="${dpi:-0}"
# Save data # Save data
echo "width_px=$width_px" > "$HOME/.screen_data" echo "width_px=$width_px" > "$HOME/.screen_data"
echo "height_px=$height_px" >> "$HOME/.screen_data" echo "height_px=$height_px" >> "$HOME/.screen_data"
echo "dpi=$dpi" >> "$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 "Done" echo "Done"
@ -42,10 +37,11 @@ if [[ "${dpi}" -ge 192 ]]; then
echo -n "Updating settings for HiDPI... " echo -n "Updating settings for HiDPI... "
# Conky # Conky
sed -i 's/minimum_size 180 0/minimum_size 360 0/' "${HOME}/.conkyrc_base" sed -i 's/default_graph_height = 24/default_graph_height = 48/' "${HOME}/.config/conky/base.conf"
sed -i 's/maximum_width 180/maximum_width 360/' "${HOME}/.conkyrc_base" sed -i 's/gap_x = 20/gap_x = 40/' "${HOME}/.config/conky/base.conf"
sed -i 's/gap_x 20/gap_x 40/' "${HOME}/.conkyrc_base" sed -i 's/gap_y = 24/gap_y = 48/' "${HOME}/.config/conky/base.conf"
sed -i 's/gap_y 24/gap_y 48/' "${HOME}/.conkyrc_base" 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 # Fonts
sed -i 's/!Xft.dpi: 192/Xft.dpi: 192/' "${HOME}/.Xresources" 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/' \ sed -i 's/systray_icon_size = 24/systray_icon_size = 48/' \
"${HOME}/.config/tint2/tint2rc" "${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 # Done
echo "Done" echo "Done"
fi 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 # Update conky
echo -n "Updating conky... " echo -n "Updating conky... "
$HOME/.update_conky $HOME/.update_conky

View file

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
dbus-update-activation-environment --systemd DISPLAY dbus-update-activation-environment --systemd DISPLAY
export DISPLAY_SESSION="Openbox"
export PATH="$HOME/.config/rofi/bin:$PATH"
eval $(ssh-agent) eval $(ssh-agent)
export SSH_AUTH_SOCK export SSH_AUTH_SOCK
xrdb -merge $HOME/.Xresources xrdb -merge $HOME/.Xresources