Add some helper functions

This commit is contained in:
Tom Willemse 2016-07-17 22:03:09 +02:00
parent 51d133b556
commit d62e0a6db0

View file

@ -1,9 +1,28 @@
#!/usr/bin/env zsh #!/usr/bin/env bash
# this is a simple config for herbstluftwm ## Helper functions:
hc() { # This simple function saves a lot of keystrokes when editing this
herbstclient "$@" # configuration. Instead of typing "herbstluftwm" everywhere, I can
# just type "hc". This is part of the default configuration.
function hc() { herbstclient "$@" }
# This function picks a random wallpaper from a list collection.
function random-wallpaper() {
find ~/pictures/wallpapers -type f \
-wholename '*/3840x1080/*' -o -wholename '*/patterns/*' \
| shuf -n 1
}
# This function adds an attribute to a herbstluftwm tag that tells it
# which monitor it should appear on, in case I care. Usually I want
# Emacs and my terminal to always appear on my primary monitor, and
# Conkeror/Firefox on my secondary, I don't like it when they get
# switched.
function lock-tag-to-monitor() {
herbstclient chain \
, new_attr string tags.by-name."$1".my-monitor \
, set_attr tags.by-name."$1".my-monitor "$2"
} }
hc emit_hook reload hc emit_hook reload
@ -155,7 +174,6 @@ hc unlock
herbstclient set tree_style '╾│ ├└╼─┐' herbstclient set tree_style '╾│ ├└╼─┐'
# do multi monitor setup here, e.g.: ## Monitors
# hc set_monitors 1280x1024+0+0 1280x1024+1280+0 # I have two monitors, each with a resolution of 1920x1080.
# or simply: hc set_monitors 1920x1080+0+0 1920x1080+1920+0
# hc detect_monitors