Skip to content

Instantly share code, notes, and snippets.

@abiosoft
Last active October 7, 2018 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abiosoft/943424ea06adf20389d84486ea67805a to your computer and use it in GitHub Desktop.
Save abiosoft/943424ea06adf20389d84486ea67805a to your computer and use it in GitHub Desktop.
i3blocks
# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
#
# List of valid properties:
#
# align
# color
# command
# full_text
# instance
# interval
# label
# min_width
# name
# separator
# separator_block_width
# short_text
# signal
# urgent
# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
# Change $SCRIPT_DIR to the location of your scripts!
command=$HOME/.config/i3blocks/$BLOCK_NAME/$BLOCK_NAME
separator_block_width=15
markup=pango
[click_apps]
full_text= 
command=i3-msg exec "rofi -show drun -show-icons -location 2 -yoffset 25" > /dev/null
[click_files]
full_text= 
command=i3-msg exec 'bash -c "caja $HOME"' > /dev/null
[click_terminal]
full_text= 
command=mate-terminal
[click_new_workspace]
full_text= 
command=sh $HOME/.config/i3/workspace.sh > /dev/null
[click_windows]
full_text= 
command=rofi -show window -show-icons -location 2 -yoffset 25
[separator_title]
command=echo -n ' '
interval=once
separator=false
[title_icon]
full_text= 
separator=false
separator_block_width=0
[title]
command=bash $HOME/.config/i3/windowtitle.sh
interval=2
separator=false
separator_block_width=0
[click_close]
full_text= 
command=i3-msg kill > /dev/null
# separator=false
# separator_block_width=0
[click_toggle_float]
full_text= 
command=i3-msg floating toggle > /dev/null
separator=false
separator_block_width=0
#
[click_move_workspace]
full_text= 
command=bash ~/.config/i3/move2workspace.sh rofi > /dev/null
separator=false
separator_block_width=0
[separator_notify]
command=echo -n ' '
interval=once
[power]
full_text= 
command=bash ~/.config/i3/leave.sh > /dev/null
# Volume indicator
#
# The first parameter sets the step (and units to display)
# The second parameter overrides the mixer selection
# See the script for details.
# [volume]
# command=$SCRIPT_DIR/volume
# label=♪
# label=VOL
# interval=once
# signal=10
#STEP=5%
# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
label=MEM
separator=false
interval=30
# [memory]
# label=SWAP
# instance=swap
# separator=false
# interval=30
# Disk usage
#
# The directory defaults to $HOME if the instance is not specified.
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
# [disk]
# label=HOME
#DIR=/mnt/data
# interval=30
# Network interface monitoring
#
# If the instance is not specified, use the interface used for default route.
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
#[iface]
##IFACE=wlan0
#color=#00FF00
#interval=10
#separator=false
#[wifi]
##INTERFACE=wlp3s0
#label=wifi:
#interval=10
#separator=false
# [bandwidth]
#INTERFACE=eth0
# interval=5
# CPU usage
#
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
# [cpu_usage]
# label=CPU
# interval=10
# min_width=CPU 100.00%
#separator=false
# [load_average]
# label=LOAD
# interval=10
# Battery indicator
#
# The battery instance defaults to 0.
[battery]
label=BAT
#label=⚡
interval=30
# Date Time
#
[time]
command=date '+%Y-%m-%d %I:%M%p'
interval=5
# Generic media player support
#
# This displays "ARTIST - SONG" if a music is playing.
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
#[mediaplayer]
#instance=spotify
#interval=5
#signal=10
# OpenVPN support
#
# Support multiple VPN, with colors.
#[openvpn]
#interval=20
# Temperature
#
# Support multiple chips, though lm-sensors.
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
#[temperature]
#label=TEMP
#interval=10
# Key indicators
#
# Add the following bindings to i3 config file:
#
# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
#[keyindicator]
#KEY=CAPS
#markup=pango
#interval=once
#signal=11
#[keyindicator]
#KEY=NUM
#markup=pango
#interval=once
#signal=11
#
#!/usr/bin/env bash
OPTIONS=$(cat <<EOF
Lock Screen
Logout
------
Shutdown
EOF
)
A=$(printf "$OPTIONS" | rofi -dmenu -p leave -location 3 -yoffset 25 -lines 5 -width 400)
if [ $? -ne 0]; then
exit 0
fi
if [ "$A" = "Lock Screen" ]; then
xdotool key ctrl+alt+l
elif [ "$A" = "Logout" ]; then
mate-session-save --logout-dialog
elif [ "$A" = "Shutdown" ]; then
mate-session-save --shutdown-dialog
fi
sudo apt install cmake cmake-data pkg-config libcairo2-dev libxcb1-dev libxcb-util0-dev libxcb-randr0-dev libxcb-composite0-dev python-xcbgen xcb-proto libxcb-image0-dev libxcb-ewmh-dev libxcb-icccm4-dev libxcb-xkb-dev libxcb-xrm-dev libxcb-cursor-dev libasound2-dev libpulse-dev i3-wm libjsoncpp-dev libmpdclient-dev libcurl4-openssl-dev libnl-3-dev
git clone --recursive https://github.com/jaagr/polybar
mkdir polybar/build
cd polybar/build
cmake ..
sudo make install
# gaps
udo apt install -y libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf libxcb-xrm0 libxcb-xrm-dev automake
cd /tmp
# clone the repository
git clone https://www.github.com/Airblader/i3 i3-gaps
cd i3-gaps
# compile & install
autoreconf --force --install
rm -rf build/
mkdir -p build && cd build/
# Disabling sanitizers is important for release versions!
# The prefix and sysconfdir are, obviously, dependent on the distribution.
../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers
make
sudo make install
#!/usr/bin/env bash
id=$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')
name=$(xdotool getactivewindow getwindowname)
app=$(wmctrl -l -x | grep ${id:2} | awk -F' ' '{print $3}' | awk -F'.' ' {print $2} ')
[ "$name" = "" ] && echo "no open window" && exit
name="$app - $name"
echo ${name:0:100}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment