Tint2 Bumblebee status

Do you sometimes need to know if your hybrid (Optimus) laptop is currently running Intel or Nvidia graphics? In GNOME there was an extension for that. Out of boredom I took a look at its code, which resulted in a short script, that can be used in the Tint2 panel.

screenshot

Save this as ~/scripts/tint2_bbswitch_status.sh and make executable:

#!/bin/bash

bb_status=$(cat /proc/acpi/bbswitch | awk -F ' ' '{print $2}')

if [ "$bb_status" = "ON" ]; then
  echo ~/scripts/nvidia.svg
fi

Right-click the picture below, save as ~/scripts/nvidia.svg

nvidia icon

Then add the executor to the ~/.config/tint2/tint2rc file:

#-------------------------------------
# Executor 5
execp = new
execp_command = ~/scripts/tint2_bbswitch_status.sh
execp_interval = 2
execp_has_icon = 1
execp_cache_icon = 0
execp_continuous = 0
execp_markup = 0
execp_tooltip = 
execp_lclick_command = 
execp_rclick_command = 
execp_mclick_command = 
execp_uwheel_command = 
execp_dwheel_command = 
execp_font_color = #ffffff 100
execp_padding = 0 0
execp_background_id = 3
execp_centered = 1
execp_icon_w = 26
execp_icon_h = 26