Skip to content

Instantly share code, notes, and snippets.

@primetoxinz
Created January 10, 2018 02:56
Show Gist options
  • Save primetoxinz/acd3d1f2b1de5bc71e5ce5ba03cd3f2e to your computer and use it in GitHub Desktop.
Save primetoxinz/acd3d1f2b1de5bc71e5ce5ba03cd3f2e to your computer and use it in GitHub Desktop.
i3
#!/bin/bash
case $BLOCK_BUTTON in
1) gsimplecal ;;
esac
date '+%A %Y-%m-%d %H:%M:%S'
#!/bin/bash
SERVICE='htop'
function htop() {
if ! ps ax | grep -v grep | grep $SERVICE > /dev/null
then
terminator -x htop
fi
}
case $BLOCK_BUTTON in
1) htop ;;
esac
/usr/lib/i3blocks/cpu_usage
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod1
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font fira sans 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness
# Touchpad controls
bindsym XF86TouchpadToggle exec /some/path/toggletouchpad.sh # toggle touchpad
# Media player controls
bindsym XF86AudioPlay exec playerctl toggle
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
#lock
bindsym $mod+Control+0 exec playerctl pause & i3lock -i ~/Pictures/wallpaper.png && systemctl hibernate
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
#pcmanfm
bindsym $mod+i exec pcmanfm
# kill focused window
bindsym $mod+Shift+q kill
bindsym $mod+F4 exec xkill
# start dmenu (a program launcher)
bindsym $mod+d exec rofi -show run
bindsym $mod+shift+d exec teiler
bindsym $mod+shift+ctrl+p exec teiler --quick image area
bindsym $mod+shift+F10 exec ~/.screenlayout/main.sh
bindsym $mod+shift+F11 exec ~/.screenlayout/dual.sh
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+t layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
exec nm-applet
exec nextcloud.AppImage
exec nvidia-led no-animation 0
exec twmnd
exec /usr/bin/lxqt-policykit-agent
## Volume control
# Path to volume control, without trailing slash
set $volumepath ~/.local/share/i3-volume
# Command for the status line (used with -t, must also use -u)
set $statuscmd i3blocks
# Signal used to update the status line (used with -u, must also use -t)
# i3blocks uses SIGRTMIN+10 by default
# i3status uses SIGUSR1 by default
set $statussig SIGUSR1
# Amount to increase/decrease volume as a percentage (used with -i, -d)
set $volumestep 5
# Symbolic name for sink (numeric index not supported) (used with -s $sinkname)
# Recommended: comment out this setting and omit the -s option to use default sink
# List sink names: pacmd list-sinks | awk -F "[<>]" '/^\s+name: <.*>/{print $2}'
#set $sinkname alsa_output.pci-0000_00_1b.0.analog-stereo
bindsym XF86AudioRaiseVolume exec $volumepath/volume -i $volumestep -n -t $statuscmd -u $statussig
bindsym XF86AudioLowerVolume exec $volumepath/volume -d $volumestep -n -t $statuscmd -u $statussig
bindsym XF86AudioMute exec $volumepath/volume -m -n -t $statuscmd -u $statussig
new_window pixel 0
## Base16 Grayscale Dark
# Author: Alexandre Gavioli (https://github.com/Alexx2/)
#
# You can use these variables anywhere in the i3 configuration file.
set $base00 #101010
set $base01 #252525
set $base02 #464646
set $base03 #525252
set $base04 #ababab
set $base05 #b9b9b9
set $base06 #e3e3e3
set $base07 #f7f7f7
set $base08 #7c7c7c
set $base09 #999999
set $base0A #a0a0a0
set $base0B #8e8e8e
set $base0C #868686
set $base0D #686868
set $base0E #747474
set $base0F #5e5e5e
# Basic bar configuration using the Base16 variables.
bar {
tray_output DVI-I-1
status_command i3blocks
position top
colors {
background $base00
separator $base01
statusline $base04
# State Border BG Text
focused_workspace $base05 $base0D $base00
active_workspace $base05 $base03 $base00
inactive_workspace $base03 $base01 $base05
urgent_workspace $base08 $base08 $base00
binding_mode $base00 $base0A $base00
}
}
# Basic color configuration using the Base16 variables for windows and borders.
# Property Name Border BG Text Indicator Child Border
client.focused $base05 $base0D $base00 $base0D $base0D
client.focused_inactive $base01 $base01 $base05 $base03 $base01
client.unfocused $base01 $base00 $base05 $base01 $base01
client.urgent $base08 $base08 $base00 $base08 $base08
client.placeholder $base00 $base00 $base05 $base00 $base00
client.background $base07
#assign [class="firefox"] 1
assign [class="QtCreator"] 2
assign [class="Hearth Launcher|MultiMC5"] 3
assign [class="jetbrains-idea"] 5
assign [class="Minecraft.*|.*EntryPoint.*"] 6
assign [class="Subl3"] 9
assign [class="discord"] 10
assign [class=".*twitch.*"] 9
# 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.
command=/usr/lib/i3blocks/$BLOCK_NAME
separator_block_width=15
markup=none
[mediaplayer]
command=~/.config/i3blocks/mpd
interval=1
signal=10
[volume]
command=~/.config/i3blocks/volume
label=VOL
instance=Master
interval=5
signal=10
[iface]
color=#00FF00
interval=10
separator=true
[cpu_usage]
label=CPU
interval=10
min_width=CPU: 100.00%
command=~/.config/i3blocks/cpu
separator=true
[time]
command=~/.config/i3blocks/clock
interval=1
#!/bin/bash
# Pass the password in the block instance
if [[ -n $BLOCK_INSTANCE ]]; then
password=("-h" "$BLOCK_INSTANCE@localhost")
fi
filter() {
echo -n '['
tr '\n' ' ' | grep -Po '.*(?= \[playing\])|paused' | tr -d '\n'
echo -n ']'
}
case $BLOCK_BUTTON in
1) terminator -e ncmpcpp | filter ;;
2) mpc $password toggle | filter ;;
3) mpc $password next | filter ;; # right click, pause/unpause
4) mpc $password volume +5 | filter ;; # scroll up, previous
5) mpc $password volume -5 | filter ;; # scroll down, next
*) mpc $password status | filter ;;
esac
#!/bin/bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------
# The second parameter overrides the mixer selection
# For PulseAudio users, use "pulse"
# For Jack/Jack2 users, use "jackplug"
# For ALSA users, you may use "default" for your primary card
# or you may use hw:# where # is the number of the card desired
MIXER="default"
[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse"
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
MIXER="${2:-$MIXER}"
# The instance option sets the control to report and configure
# This defaults to the first control of your selected mixer
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
head -n1
)}"
# The first parameter sets the step to change the volume by (and units to display)
# This may be in in % or dB (eg. 5% or 3dB)
STEP="${1:-5%}"
#------------------------------------------------------------------------
capability() { # Return "Capture" if the device is a capture device
amixer -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}
volume() {
amixer -D $MIXER get $SCONTROL $(capability)
}
format() {
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "MUTE" : "'
# If dB was selected, print that instead
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='"; exit}'
perl -ne "$perl_filter"
}
#------------------------------------------------------------------------
case $BLOCK_BUTTON in
1) pavucontrol ;;
3) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
esac
volume | format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment