From d62e0a6db01b0d853b080d2c09b6453a9ecaed85 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 17 Jul 2016 22:03:09 +0200 Subject: [PATCH] Add some helper functions --- herbstluftwm/.config/herbstluftwm/autostart | 34 ++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index d0cc91a..0ffd2e0 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -1,9 +1,28 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash -# this is a simple config for herbstluftwm +## Helper functions: -hc() { - herbstclient "$@" +# This simple function saves a lot of keystrokes when editing this +# 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 @@ -155,7 +174,6 @@ hc unlock herbstclient set tree_style '╾│ ├└╼─┐' -# do multi monitor setup here, e.g.: -# hc set_monitors 1280x1024+0+0 1280x1024+1280+0 -# or simply: -# hc detect_monitors +## Monitors +# I have two monitors, each with a resolution of 1920x1080. +hc set_monitors 1920x1080+0+0 1920x1080+1920+0