Skip to content

Instantly share code, notes, and snippets.

@xyzshantaram
Last active January 3, 2019 17:17
Show Gist options
  • Save xyzshantaram/8da48dceea1f8941ada8b548519b7716 to your computer and use it in GitHub Desktop.
Save xyzshantaram/8da48dceea1f8941ada8b548519b7716 to your computer and use it in GitHub Desktop.
i3 config files
echo $(sensors | awk '{print $4}' | tr -d '\n' | cut -b 2-5)
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
#
# This config file uses keycodes (bindsym) and was written for the QWERTY
# layout.
#
# To get a config file with the same key positions, but for your current
# layout, use the i3-config-wizard
#
exec --no-startup-id hsetroot -bg "#002244"
set $mod2 Mod1
set $mod Mod4
exec --no-startup-id teamviewer
exec --no-startup-id redshift-gtk
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monofur for powerline 14
# 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 these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
set $up l
set $down k
set $left j
set $right semicolon
# use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec konsole
# kill focused window
bindsym $mod+Shift+q kill
# start Synapse (a program launcher)
bindsym $mod+d exec synapse
# 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+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right 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+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right 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
# use window title, but no border
bindsym $mod+t border normal 0
# use no window title and a thick border
bindsym $mod+y border pixel 3
# use neither window title nor border
bindsym $mod+u border none
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w 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
# move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#Multimedia keys
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% && killall -SIGUSR1 i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% && killall -SIGUSR1 i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle && killall -SIGUSR1 i3status
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "Work"
set $ws2 "Comms"
set $ws3 "Media"
set $ws4 "TeamViewer"
set $ws5 "Work 2"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# 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 -m "Shutdown options: " -f pango:Hermit -b 'Shut down' 'sudo shutdown -h now' -b 'Logout' 'i3-msg exit' -b 'Reboot' 'sudo shutdown -r now'
bindsym Print exec flameshot gui
# 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 $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
# 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 or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
mode "mouse" {
# set your three speeds here
set $mol 1
set $slow 15
set $quick 50
# Mouse movement (slow/fine-tuned) -- arrow keys
bindsym Left exec xdotool mousemove_relative -- -$slow 0
bindsym Down exec xdotool mousemove_relative 0 $slow
bindsym Up exec xdotool mousemove_relative -- 0 -$slow
bindsym Right exec xdotool mousemove_relative $slow 0
# Mouse movement (quicker) -- arrow keys
bindsym Shift+Left exec xdotool mousemove_relative -- -$quick 0
bindsym Shift+Down exec xdotool mousemove_relative 0 $quick
bindsym Shift+Up exec xdotool mousemove_relative -- 0 -$quick
bindsym Shift+Right exec xdotool mousemove_relative $quick 0
# Mouse movement (molasses) -- arrow keys
bindsym $mod2+Shift+Left exec xdotool mousemove_relative -- -$mol 0
bindsym $mod2+Shift+Down exec xdotool mousemove_relative 0 $mol
bindsym $mod2+Shift+Up exec xdotool mousemove_relative -- 0 -$mol
bindsym $mod2+Shift+Right exec xdotool mousemove_relative $mol 0
# Left Click
bindsym s exec xdotool click 1
# Middle Click
bindsym d exec xdotool click 2
# Right Click
bindsym f exec xdotool click 3
# Left Click-and-drag
bindsym Shift+s exec xdotool mousedown 1
# Middle Click-and-drag
bindsym Shift+d exec xdotool mousedown 2
# Right Click-and-drag
bindsym Shift+f exec xdotool mousedown 3
# Left Drag release
bindsym $mod2+s exec xdotool mouseup 1
# Middle Drag release
bindsym $mod2+d exec xdotool mouseup 2
# Right Drag release
bindsym $mod2+f exec xdotool mouseup 3
# return to normal keybindings -- IMPORTANT!!
bindsym Escape mode "default"
}
bindsym $mod+Shift+m mode "mouse"
# class border bground text indicator child_border
client.focused #007fff #007fff #34282c #394BF4 #000077
client.focused_inactive #555555 #002244 #d1d0ce #88C7FF #000077
client.unfocused #555555 #555555 #d1d0ce #FFFFFF #000077
client.urgent #CC4545 #CC4545 #FFFFFF #900000 #000077
client.placeholder #555555 #363689 #FFFFFF #5252D1 #000077
client.background #FFFFFF
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command python3 ~/status2.py
position top
font pango:monofur for powerline 14
colors {
#color class border back. text
focused_workspace #007fff #007fff #34282c
active_workspace #555555 #555555 #ffffff
inactive_workspace #000000 #000000 #888888
urgent_workspace #cc4545 #cc4545 #ffffff
}
}
bar {
tray_output none
font pango:monofur for powerline 14
position bottom
status_command python3 ~/statusFori3.py
workspace_buttons no
}
#######################################################################
# automatically start i3-config-wizard to offer the user to create a
# keysym-based config which used their favorite modifier (alt or windows)
#
# i3-config-wizard will not launch if there already is a config file
# in ~/.i3/config.
#
# Please remove the following exec line:
#######################################################################
exec i3-config-wizard
from i3pystatus import IntervalModule
import subprocess # custom addition
class NetDown(IntervalModule):
settings = (
("format",
"format string used for output. {speed_DL} is the download speed returned by speedtest_cli"),
('display_if', 'snippet that gets evaluated. if true, displays the module output'),
"color",
)
format = "↓ {speed_DL} MB/s"
display_if = 'True'
color = "007FFF"
def run(self):
speed_DL = float(subprocess.check_output(["/usr/bin/bash", "/usr/bin/pyDLSpeed"]).decode('UTF-8'))
if eval(self.display_if):
self.output = {
"full_text": self.format.format(speed_DL=speed_DL),
"color": self.color,
}
rom i3pystatus import IntervalModule
import subprocess # custom addition
class NetUp(IntervalModule):
settings = (
("format",
"format string used for output. {speed_UL} is the download speed returned by speedtest_cli"),
('display_if', 'snippet that gets evaluated. if true, displays the module output'),
"color",
)
format = "↑ {speed_UL} MB/s"
display_if = 'True'
color = "007FFF"
def run(self):
speed_UL = float(subprocess.check_output(["/usr/bin/bash", "/usr/bin/pyULSpeed"]).decode('UTF-8'))
if eval(self.display_if):
self.output = {
"full_text": self.format.format(speed_UL=speed_UL),
"color": self.color,
}
speedtest-cli --bytes --simple | awk '{print $2}' | sed -n '2 p'
speedtest-cli --bytes --simple | awk '{print $2}' | sed -n '3 p'
from i3pystatus import Status
from i3pystatus import NetUp
from i3pystatus import NetDown
from i3pystatus import mem
status = Status()
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format="%d-%m-%y %T (It is a %A) ",)
volString = "🎵: {volume} %"
status.register("pulseaudio",
format=volString,)
# FIX THIS YOU DUMMY
#BASICALLY, TODO: WRITE NEW SCRIPTS FOR NET SPEED UP AND DOWN
status.register("NetDown",
format="↓ {speed_DL} MB/s",
interval = 300)
status.register("NetUp",
format="↑ {speed_UL} MB/s",
interval = 300)
status.run()
#coding=utf-8
# - *- coding: utf- 8 - *-
from i3pystatus import Status
from i3pystatus import mem
from i3pystatus import cpu_usage
from i3pystatus import temp
import subprocess
def getClr(a):
clr = '#007fff'
if a >= 50.0:
clr = '#FFFF00'
if a >= 70.0:
clr = '#FFA500'
if a >= 80.0:
clr = '#FF0000'
return clr
status = Status()
# Shows your CPU temperature, if you have an Intel CPU]
# WARNING TEMP CLASS IS HEAVILY MODIFIED AND HAS EXTERNAL DEPENDS TO WORK SID
status.register("temp",
format="temp: {temp} °C",
interval = 0.1
)
status.register("cpu_freq",
format = "freq: {avgg} GHz,",
color = '#007fff',
interval = 0.1,
)
status.register("cpu_usage",
format= "CPU usage is {usage:.2f}%,",
color = '#007fff',
interval = 0.1,
)
status.register("mem",
format="{used_mem:.0f}/{total_mem:.0f} MB, [{percent_used_mem}% used.]",
)
# Shows pulseaudio default sink volume
#
# Note: requires libpulseaudio from PyPI
status.run()
from i3pystatus import IntervalModule
import subprocess # custom addition
# HIGHLY MODIFIED DO NOT TRUST
class Temperature(IntervalModule):
"""
Shows CPU temperature of Intel processors
AMD is currently not supported as they can only report a relative temperature, which is pretty useless
"""
settings = (
("format",
"format string used for output. {temp} is the temperature in degrees celsius"),
('display_if', 'snippet that gets evaluated. if true, displays the module output'),
"color",
"file",
"alert_temp",
"alert_color",
)
format = "{temp} °C"
file = "/sys/class/thermal/thermal_zone0/temp"
display_if = 'True'
color = "007FFF"
def run(self):
temp = float(subprocess.check_output(["/usr/bin/bash", "/usr/bin/HighestCPUTemp"]).decode('UTF-8'))
if temp >= 50.0:
color = "FFFF00"
if temp >= 65.0:
color = "FFA500"
if temp >= 80.0:
color = "FF0000"
if eval(self.display_if):
self.output = {
"full_text": self.format.format(temp=temp),
"color": self.color,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment