Clean up and document

This commit is contained in:
M1dgard 2018-04-30 17:19:00 +02:00
parent b138b157a0
commit 2a2dc0a021
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4
8 changed files with 46 additions and 8 deletions

View file

@ -20,11 +20,12 @@ The Arch Linux package to install is between parentheses.
* i3-gaps ([community/i3-gaps](https://www.archlinux.org/packages/community/x86_64/i3-gaps/))
* Rofi ([community/rofi](https://www.archlinux.org/packages/community/x86_64/rofi/))
* Polybar ([aur/polybar](https://aur.archlinux.org/packages/polybar))
* python-notify2 ([aur/python-notify2](https://aur.archlinux.org/packages/python-notify2/<Paste>))
* python-notify2 ([aur/python-notify2](https://aur.archlinux.org/packages/python-notify2/))
* Mozilla's Fira fonts ([community/otf-fira-mono](https://www.archlinux.org/packages/community/x86_64/otf-fira-mono/) and [community/otf-fira-sans](https://www.archlinux.org/packages/community/x86_64/otf-fira-sans/)). I might change this soon if I play with some patched Fira derivates
* xfce4-terminal ([extra/xfce4-terminal](https://www.archlinux.org/packages/extra/x86_64/xfce4-terminal/), but you can choose your own terminal of course if you want)
* NeoVim ([community/neovim](https://www.archlinux.org/packages/community/x86_64/neovim/))
* acpilight ([aur/acpilight](https://aur.archlinux.org/packages/acpilight/), an xbacklight replacement that directly uses the kernel's API, works without X)
* xrandr and arandr ([extra/xorg-xrandr](https://www.archlinux.org/packages/extra/x86_64/xorg-xrandr/) and [community/arandr](https://www.archlinux.org/packages/community/any/arandr/))
* unclutter ([community/unclutter](https://www.archlinux.org/packages/community/x86_64/unclutter/), hide the mouse when it hasn't moved for some time)
* driver for your video card that supports GLX

15
i3/README.md Normal file
View file

@ -0,0 +1,15 @@
# i3 configuration and some general desirable Desktop Environment scripts
## `backlight.sh`
Control screen brightness in a logarithmic fashion. Linear backlight control just annoys me: I want fine-grained control over low brightnesses and quickly change the value at high brightnesses.
It assumes the minimum brightness is 0 (light off) and the maximum brightness is 100. This is the behaviour of [acpilight](https://github.com/wavexx/acpilight/), a replacement for xorg-xbacklight (which doesn't work on my laptop for some reason).
Use `backlight.sh up` or `backlight.sh down` to increase or decrease the backlight brightess. If you want to adjust the speed with which it changes, adjust `change_percent` in the script.
## `screens.sh`
Toggle between screen configurations. The script is pretty ad-hoc. It detects which configuration you're in and switches to the next desirable one.
## `terminal.sh`

View file

@ -1,5 +1,22 @@
#!/bin/bash
# Control screen brightness in a logarithmic fashion. Linear backlight control
# just annoys me: I want fine-grained control over low brightnesses and quickly
# change the value at high brightnesses.
#
# We assume the minimum brightness is 0 (light off) and the maximum brightness
# is 100. This is the behaviour of
# [acpilight](https://github.com/wavexx/acpilight/), a replacement for
# xorg-xbacklight (which doesn't work on my laptop for some reason).
#
# Use `backlight.sh up` or `backlight.sh down` to increase or decrease the
# backlight brightess. If you want to adjust the speed with which it changes,
# adjust `change_percent` below.
# Multiply the current brightness by this percentage. This has to be an integer
change_percent=162
# Don't start a new transition if the previous one isn't done yet
pgrep -u $UID -x xbacklight >/dev/null && exit
@ -7,11 +24,11 @@ pgrep -u $UID -x xbacklight >/dev/null && exit
current_brightness=$(xbacklight -get)
case $1 in
up)
target=$((current_brightness * 15 / 10))
target=$((current_brightness * $change_percent / 100))
[ $target -ne $current_brightness ] || target=$((target + 1))
;;
down)
target=$((current_brightness * 10 / 15))
target=$((current_brightness * 100 / $change_percent))
[ $target -ne $current_brightness ] || target=$((target - 1))
;;
esac

View file

@ -1,5 +1,8 @@
#!/bin/bash
# Legacy battery monitor. I'm writing a better one, I should publish it some
# time.
level_critical=5
level_low=10
level_low_max_backlight=8

View file

@ -82,9 +82,10 @@ bindsym Mod1+l exec --no-startup-id i3lock --image="$HOME/Pictures/background/Re
# start a terminal
bindsym $mod+Return exec $term
bindsym $mod+KP_Enter exec $term
bindsym XF86Calculator exec "$termexec --zoom 3 -x bash -c 'exec-with-shortcut; zsh'"
bindsym Ctrl+Mod4+t exec --no-startup-id "notify-send -a 'i3' -u normal 'You'\''re on i3, $usertitle.' 'Don'\''t try to Ctrl+Alt+T me. Use $mod+Enter like a real $usertype.'"
bindsym Ctrl+Mod1+t exec --no-startup-id "notify-send -a 'i3' -u normal 'You'\''re on i3, $usertitle.' 'Don'\''t try to Ctrl+Alt+T me. Use $mod+Enter like a real $usertype.'"
# start a terminal and execute the command `exec-with-shortcut` from your PATH in it
bindsym XF86Calculator exec "$termexec --zoom 3 -x bash -c 'exec-with-shortcut; zsh'"
# start web browser
set $browser TZ=UTC firefox
@ -96,7 +97,7 @@ bindsym XF86MyComputer exec $filemanager
# change display layout
bindsym $mod+XF86Display exec arandr
bindsym XF86Display exec --no-startup-id $HOME/.config/i3/screens.sh
bindsym XF86Display exec --no-startup-id $HOME/.config/i3/monitors.sh
#############################

View file

@ -1,8 +1,9 @@
#!/bin/bash
# If a window with a path in its title is focused, open a terminal with that location as working directory.
# Like this, terminals are opened in the same directory as the currently focused one, if no command is running.
# This is very hackish, but it works.
# If a window with a path in its title is focused, open a terminal with that
# location as working directory. Like this, terminals are opened in the same
# directory as the currently focused one, if no command is running. This is
# very hackish, but it works.
if [[ $(xtitle) =~ (^| )(~?)(/.*) ]]; then
path="${BASH_REMATCH[3]}"