Skip to content

Instantly share code, notes, and snippets.

@ispringle
Last active February 3, 2024 01:10
Show Gist options
  • Save ispringle/2d11f46dc084b75397bb87ab732b1cf6 to your computer and use it in GitHub Desktop.
Save ispringle/2d11f46dc084b75397bb87ab732b1cf6 to your computer and use it in GitHub Desktop.
Arch setup
# ██████╗ █████╗ ██████╗ ██████╗ ██████╗ █████╗ █╗███████╗
# ██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██╔══██╗╚╝██╔════╝
# ██████╔╝███████║██████╔╝██║ ██║███████╗ ╚█████╔╝ ███████╗
# ██╔═══╝ ██╔══██║██╔══██╗██║ ██║██╔═══██╗██╔══██╗ ╚════██║
# ██║ ██║ ██║██║ ██║██████╔╝╚██████╔╝╚█████╔╝ ███████║
# ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚════╝ ╚══════╝
#
# ██╗██████╗
# ██║╚════██╗
# ██║ █████╔╝
# ██║ ╚═══██╗
# ██║██████╔╝
# ╚═╝╚═════╝
#
# ▄████▄ ▒█████ ███▄ █ █████▒██▓ ▄████
# ▒██▀ ▀█ ▒██▒ ██▒ ██ ▀█ █ ▓██ ▒▓██▒ ██▒ ▀█▒
# ▒▓█ ▄ ▒██░ ██▒▓██ ▀█ ██▒▒████ ░▒██▒▒██░▄▄▄░
# ▒▓▓▄ ▄██▒▒██ ██░▓██▒ ▐▌██▒░▓█▒ ░░██░░▓█ ██▓
# ▒ ▓███▀ ░░ ████▓▒░▒██░ ▓██░░▒█░ ░██░░▒▓███▀▒
# ░ ░▒ ▒ ░░ ▒░▒░▒░ ░ ▒░ ▒ ▒ ▒ ░ ░▓ ░▒ ▒
# ░ ▒ ░ ▒ ▒░ ░ ░░ ░ ▒░ ░ ▒ ░ ░ ░
# ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ▒ ░░ ░ ░
# ░ ░ ░ ░ ░ ░ ░
# ░
###############
###VARIABLES###
###############
set $term st #-e /bin/bash
set $mod Mod4
font pango: Hack Nerd Font Regular 9
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec $term #-e tmux
###############
###BEHAVIORS###
###############
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run -nb "$fg" -nf "$bg" -sb "$bg" -sf "$fg"
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# split in horizontal orientation
bindsym $mod+c 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+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
# resize window (you can also use the mouse for that)
mode "resize" {
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
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
########
##GAPS##
########
gaps inner 5
gaps outer 0
smart_gaps on
################
###WORKSPACES###
################
# Workspace variables
set $ws1 "1:home"
set $ws2 "2:www"
set $ws3 "3:term"
set $ws4 "4:code"
set $ws5 "5:mail"
set $ws6 "6:chat"
set $ws7 "7:music"
set $ws8 "8:games"
set $ws9 "9:wiki"
set $ws0 "10:misc"
# 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 $ws0
# 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 $ws0
# 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
######################
##SESSION MANAGEMENT##
######################
set $Locker exec "bash /home/ian/git/hub/xero/glitchlock/glitchlock"
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id $Locker, mode "default"
bindsym e exec --no-startup-id i3-msg exit, mode "default"
bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default"
bindsym r exec --no-startup-id systemctl reboot, mode "default"
bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+shift+e mode "$mode_system"
#########
##THEME##
#########
# set primary gruvbox colorscheme colors
set $bg #282828
set $fg #689d68
set $red #cc241d
set $green #98971a
set $yellow #d79921
set $blue #458588
set $purple #b16286
set $aqua #689d68
set $gray #a89984
set $darkgray #1d2021
bar {
strip_workspace_numbers yes
position top
status_command i3blocks -c ~/.config/i3blocks/config
separator_symbol |
colors {
# bar background color
background $bg
# text color used for blocks that do not have a color specified.
statusline $yellow
# workspaces section
# border backgr text
focused_workspace $blue $blue $darkgray
inactive_workspace $darkgray $darkgray $yellow
active_workspace $darkgray $darkgray $yellow
urgent_workspace $red $red $bg
}
}
client.focused $blue $blue $darkgray $purple $darkgray
client.focused_inactive $darkgray $darkgray $yellow $purple $darkgray
client.unfocused $darkgray $darkgray $yellow $purple $darkgray
client.urgent $red $red $white $red $red
#############
##AUTOSTART##
#############
exec --no-startup-id feh --bg-scale /home/ian/.config/wallpapers/wallpaper
exec --no-startup-id compton -f
exec --no-startup-id dunst
exec --no-startup-id unclutter --timeout 3 --ignore-scrolling --fork
exec --no-startup-id xmodmap ~/.Xmodmap
############
##KEY MAPS##
############
bindsym $mod+Shift+f exec firefox
#keybinding for networkmanager_dmenu
bindsym $mod+i exec networkmanager_dmenu
#Floating Window for Calendar
for_window [class="Yad"] floating enabled
# change volume or toggle mute
bindsym XF86AudioRaiseVolume exec amixer -q -D pulse sset Master 5%+ && pkill -RTMIN+10 i3blocks
bindsym XF86AudioLowerVolume exec amixer -q -D pulse sset Master 5%- && pkill -RTMIN+10 i3blocks
bindsym XF86AudioMute exec amixer -q -D pulse sset Master toggle && pkill -RTMIN+10 i3blocks
bindsym $mod+Shift+s exec sh /home/ian/.config/i3/xdpms.sh
bindsym $mod+Shift+t exec sh /home/ian/.config/13/record.sh
###############
##SCRATCHPADS##
###############
#Dropdown Terminals
exec --no-startup-id st -n term0
for_window [instance="term0"] resize set 625 400
for_window [instance="term0"] border pixel 5
for_window [instance="term0"] floating enable
for_window [instance="term0"] move scratchpad
bindsym $mod+z [instance="term0"] scratchpad show
exec --no-startup-id st -n term1
for_window [instance="term1"] floating enable
for_window [instance="term1"] resize set 625 400
for_window [instance="term1"] move scratchpad
for_window [instance="term1"] border pixel 5
bindsym $mod+q [instance="term1"] scratchpad show
#Open File Prompts
for_window [title="Open Database File"] floating enable
#No titlebars
for_window [class="^.*"] border pixel 1
##############
## DEFAULTS ##
##############
command=/usr/libexec/i3blocks/$BLOCK_NAME
separator_block_width=25
color=#F3F4F5
markup=pango
align=center
#color=#666666
############
## BLOCKS ##
############
[now-playing]
command=bash /home/ian/.config/i3blocks/blocklets/cmus-playing
command=bash /home/ian/.config/i3blocks/blocklets/mopidy-playing
interval=1
[weather]
command=bash ~/.config/i3blocks/blocklets/weather
interval=10
[volume]
command=bash ~/.config/i3blocks/blocklets/volume
#label=VOL
label=
instance=Master
#instance=PCM
interval=once
signal=10
[wifi]
command=bash /home/ian/.config/i3blocks/blocklets/wifi
#label=WIFI
label=直
interval=10
[battery]
command=bash /home/ian/.config/i3blocks/blocklets/battery
#label=BAT
label=
interval=5
[calendar]
command=bash /home/ian/.config/i3blocks/blocklets/calendar
label=
interval=1
[time]
command=bash /home/ian/.config/i3blocks/blocklets/time
label=
interval=1
#!/bin/bash
# Gets battery percentage and charging status from acpi and echos for i3 blocks
STATUS=`acpi -b`
PERCENT=`echo $STATUS | awk '{ print $4 }' | tr -d ,`
CHARGE=`echo $STATUS | awk '{ print $3 }' | tr -d ,`
if [ $CHARGE == "Discharging" ]; then
STAT='↓'
else
STAT='↑'
fi
if [ "<$PERCENT tr '%'" < 10 ]; then
dunstify "Plug in your charger!"
fi
echo $PERCENT $STAT #full
echo $PERCENT $STAT #short
echo "#d3869b" #color
#!/bin/sh
width=200
height=200
datefmt="+%a, %b %d, %Y"
x = 1920
OPTIND=1
while getopts ":f:W:H:" opt; do
case $opt in
f) datefmt="$OPTARG" ;;
W) width="$OPTARG" ;;
H) height="$OPTARG" ;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
case "$BLOCK_BUTTON" in
1|2|3)
# the position of the upper left corner of the popup
#posX=$(($BLOCK_X - $width / 2))
posX=1670
#posY=$(($BLOCK_Y - $height))
posY=18
i3-msg -q "exec yad --calendar \
--width=$width --height=$height \
--undecorated --fixed \
--close-on-unfocus --no-buttons \
--posx=$posX --posy=$posY \
> /dev/null"
esac
date "$datefmt" #full
date "$datefmt" #short
echo "#8ec07c" #color
#!/bin/sh
timefmt="+%k:%M:%S"
_time=$(date "$timefmt")
echo "$_time" " " #short
echo "$_time" " " #long
echo "#ebdbb2" #color
#!/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, eventually 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"
if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
# pulseaudio is running, but not all installations use "pulse"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
[ -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
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
volume | format
echo "#fabd2f"
#!/bin/bash
key=$(</home/ian/.config/i3blocks/blocklets/owm_key)
zip="24504"
response=$(curl --silent \
"http://api.openweathermap.org/data/2.5/weather?appid=$key&zip=$zip&units=imperial")
temp=$(echo $response | jq '.["main"]["temp"]')
humd=$(echo $response | jq '.["main"]["humidity"]')
wind=$(echo $response | jq '.["wind"]["speed"]')
wdir=$(echo $response | jq '.["wind"]["deg"]')
cove=$(echo $response | jq '.["clouds"]["all"]')
rain=$(echo $response | jq '.["rain"]["1h"]')
_tim=$(echo $response | jq '.["dt"]')
sunu=$(echo $response | jq '.["sys"]["sunrise"]')
sund=$(echo $response | jq '.["sys"]["sunset"]')
cond=$(echo $response | jq '.["weather"][0]["main"]' | tr -d \")
desc=$(echo $response | jq '.["weather"][0]["description"]' | tr -d \")
#declare -A conditions=(
# ["Ash"]=""
# ["Clear"]=""
# ["Clouds"]=""
# ["Drizzle"]=""
# ["Dust"]=""
# ["Fog"]=""
# ["Haze"]=""
# ["Rain"]=""
# ["Sand"]=""
# ["Smoke"]=""
# ["Snow"]=""
# ["Squall"]=""
# ["Thunderstorm"]=""
# ["Tornado"]=""
#)
if (( $_tim < $sunu ));
then
declare -A conditions=(
["Ash"]=""
["Clear"]=""
["Clouds"]=""
["Drizzle"]=""
["Dust"]=""
["Fog"]=""
["Haze"]=""
["Rain"]=""
["Sand"]=""
["Smoke"]=""
["Snow"]=""
["Squall"]=""
["Thunderstorm"]=""
["Tornado"]=""
);
elif (( $_tim > $sunu )) || (( $_tim < $sund ));
then
declare -A conditions=(
["Ash"]=""
["Clear"]=""
["Clouds"]=""
["Drizzle"]=""
["Dust"]=""
["Fog"]=""
["Haze"]=""
["Rain"]=""
["Sand"]=""
["Smoke"]=""
["Snow"]=""
["Squall"]=""
["Thunderstorm"]=""
["Tornado"]=""
);
else
declare -A conditions=(
["Ash"]=""
["Clear"]=""
["Clouds"]=""
["Drizzle"]=""
["Dust"]=""
["Fog"]=""
["Haze"]=""
["Rain"]=""
["Sand"]=""
["Smoke"]=""
["Snow"]=""
["Squall"]=""
["Thunderstorm"]=""
["Tornado"]=""
);
fi
width=200
height=200
x=1920
OPTIND=1
while getopts ":f:W:H:" opt; do
case $opt in
f) datefmt="$OPTARG" ;;
W) width="$OPTARG" ;;
H) height="$OPTARG" ;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
case "$BLOCK_BUTTON" in
1|2|3)
# the position of the upper left corner of the popup
#posX=$(($BLOCK_X - $width / 2))
posX=1670
#posY=$(($BLOCK_Y - $height))
posY=18
declare -A weather=(
["temp"]=$temp
["humidity"]=$humd
["wind speed"]=$wind
["wind dir"]=$wdir
["cloud cover"]=$cove
["rain in last hour"]=$rain
["condition"]=$cond
)
i3-msg -q "exec yad --text-info \
--width=$width --height=$height \
--undecorated --fixed \
--close-on-unfocus --no-buttons \
--posx=$posX --posy=$posY \
--title=Weather \
--list --separator= \
--column=Weather
--column=ID:STRING \
"${weather[@]}"
> /dev/null"
esac
sym="${conditions["$cond"]}"
deg="宅"
echo $sym $temp$deg # full
echo $sym $temp$deg # short
echo "#b8bb26" # color
#!/bin/bash
INTERFACE="wlp3s0"
[[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && echo DWN && exit
QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
echo $QUALITY% # full text
echo $QUALITY% # short text
echo "#83a598" # color
i3 config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment