Initial commit for public dots
This commit is contained in:
222
.config/herbstluftwm/autostart
Executable file
222
.config/herbstluftwm/autostart
Executable file
@ -0,0 +1,222 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# source colors
|
||||
#
|
||||
|
||||
. "${HOME}/.cache/wal/colors.sh"
|
||||
|
||||
#
|
||||
# initial settings
|
||||
#
|
||||
|
||||
# hc is shorter than herbstclient :)
|
||||
hc() {
|
||||
herbstclient "$@"
|
||||
}
|
||||
|
||||
# set mod keys
|
||||
C=Control
|
||||
S=Shift
|
||||
M=Mod4
|
||||
A=Mod1
|
||||
|
||||
# reset hooks and bindings
|
||||
hc emit_hook reload
|
||||
hc keyunbind --all
|
||||
|
||||
scripts="$XDG_CONFIG_HOME/herbstluftwm/scripts"
|
||||
|
||||
#
|
||||
# variables
|
||||
#
|
||||
|
||||
terminal=kitty
|
||||
launcher="dmenu_run -nb $color0 -nf $color15 -sb $color1 -sf $color15"
|
||||
file_manager=thunar
|
||||
browser=firefox
|
||||
calculator=dcalc
|
||||
music_player="$terminal -e ncmpcpp"
|
||||
feed_reader="$terminal -e newsboat"
|
||||
screen_locker="i3lock -c 000000"
|
||||
|
||||
#
|
||||
# movement and control
|
||||
#
|
||||
|
||||
# basics
|
||||
hc keybind $M-w close_and_remove
|
||||
hc keybind $M-e close
|
||||
hc keybind $M-t reload
|
||||
hc keybind $M-q spawn sh $scripts/exitmenu
|
||||
|
||||
# focus
|
||||
hc keybind $M-h focus left
|
||||
hc keybind $M-j focus down
|
||||
hc keybind $M-k focus up
|
||||
hc keybind $M-l focus right
|
||||
|
||||
# shift
|
||||
hc keybind $M-$S-h shift left
|
||||
hc keybind $M-$S-j shift down
|
||||
hc keybind $M-$S-k shift up
|
||||
hc keybind $M-$S-l shift right
|
||||
|
||||
# split focused frame
|
||||
hc keybind $M-y chain , split left 0.5 , focus left
|
||||
hc keybind $M-u chain , split bottom 0.5 , focus down
|
||||
hc keybind $M-i chain , split top 0.5 , focus up
|
||||
hc keybind $M-o chain , split right 0.5 , focus right
|
||||
|
||||
# split root frame
|
||||
hc keybind $M-$S-y chain , split left 0.5 '' , focus left
|
||||
hc keybind $M-$S-u chain , split bottom 0.5 '' , focus down
|
||||
hc keybind $M-$S-i chain , split top 0.5 '' , focus up
|
||||
hc keybind $M-$S-o chain , split right 0.5 '' , focus right
|
||||
|
||||
# frame splitting
|
||||
hc keybind $M-p split explode
|
||||
hc keybind $M-r remove
|
||||
|
||||
# resize
|
||||
resizestep=0.04
|
||||
hc keybind $M-$C-h resize left $resizestep
|
||||
hc keybind $M-$C-j resize down $resizestep
|
||||
hc keybind $M-$C-k resize up $resizestep
|
||||
hc keybind $M-$C-l resize right $resizestep
|
||||
|
||||
# cycle
|
||||
hc keybind $M-n cycle +1
|
||||
hc keybind $M-m cycle_monitor
|
||||
|
||||
# cycle layouts
|
||||
hc keybind $M-Tab \
|
||||
or , and . compare tags.focus.curframe_wcount = 2 \
|
||||
. cycle_layout +1 vertical horizontal max vertical grid \
|
||||
, cycle_layout +1
|
||||
|
||||
# rotate and mirror
|
||||
hc keybind $M-apostrophe mirror vertical
|
||||
hc keybind $M-semicolon mirror horizontal
|
||||
hc keybind $M-slash rotate
|
||||
|
||||
# window attributes
|
||||
hc keybind $M-$C-e floating toggle
|
||||
hc keybind $M-$C-w fullscreen toggle
|
||||
hc keybind $M-$C-q set_attr clients.focus.floating toggle
|
||||
|
||||
# toggles
|
||||
hc keybind $M-$S-w spawn sh $scripts/togglemaster
|
||||
|
||||
# media keys
|
||||
hc keybind XF86AudioMute spawn pulsemixer --toggle-mute
|
||||
hc keybind XF86AudioLowerVolume spawn pulsemixer --change-volume -5
|
||||
hc keybind XF86AudioRaiseVolume spawn pulsemixer --change-volume +5
|
||||
hc keybind XF86MonBrightnessDown spawn light -U 5
|
||||
hc keybind XF86MonBrightnessUp spawn light -A 5
|
||||
|
||||
# mouse
|
||||
hc mouseunbind all
|
||||
hc mousebind $M-Button1 move
|
||||
hc mousebind $M-Button2 zoom
|
||||
hc mousebind $M-Button3 resize
|
||||
|
||||
#
|
||||
# application launchers
|
||||
#
|
||||
|
||||
hc keybind $M-Return spawn $terminal
|
||||
hc keybind $M-space spawn $launcher
|
||||
|
||||
hc keybind $M-grave spawn flameshot gui
|
||||
hc keybind $M-1 spawn $file_manager
|
||||
hc keybind $M-2 spawn $browser
|
||||
hc keybind $M-3 spawn $calculator
|
||||
hc keybind $M-4 spawn $music_player
|
||||
hc keybind $M-5 spawn $feed_reader
|
||||
hc keybind $M-6 spawn virt-manager
|
||||
hc keybind $M-0 spawn $screen_locker
|
||||
|
||||
#
|
||||
# tags
|
||||
#
|
||||
|
||||
tag_names=(a s d f g z x c v b)
|
||||
tag_keys=(a s d f g z x c v b)
|
||||
|
||||
hc rename default "${tag_names[0]}" || true
|
||||
for i in "${!tag_names[@]}"; do
|
||||
hc add "${tag_names[$i]}"
|
||||
key="${tag_keys[$i]}"
|
||||
if ! [ -z "$key" ]; then
|
||||
hc keybind $M-$key use_index $i
|
||||
hc keybind $M-$S-$key move_index $i
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# theme
|
||||
#
|
||||
|
||||
hc attr theme.tiling.reset 1
|
||||
hc attr theme.floating.reset 1
|
||||
|
||||
hc set frame_border_active_color $color8
|
||||
hc set frame_border_normal_color $color0
|
||||
hc set frame_border_width 0
|
||||
hc set frame_transparent_width 0
|
||||
hc set frame_gap 12
|
||||
hc set always_show_frame off
|
||||
hc set frame_bg_transparent on
|
||||
|
||||
hc attr theme.active.color $color8
|
||||
hc attr theme.normal.color $color0
|
||||
hc attr theme.urgent.color $color1
|
||||
hc attr theme.inner_color black
|
||||
hc attr theme.floating.outer_color black
|
||||
hc attr theme.border_width 2
|
||||
hc attr theme.floating.border_width 2
|
||||
|
||||
hc set window_gap 0
|
||||
hc set frame_padding 0
|
||||
hc set mouse_recenter_gap 0
|
||||
hc set smart_window_surroundings off
|
||||
hc set smart_frame_surroundings off
|
||||
|
||||
#
|
||||
# rules
|
||||
#
|
||||
|
||||
hc unrule -F
|
||||
hc rule focus=on
|
||||
|
||||
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on
|
||||
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
|
||||
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
|
||||
|
||||
hc rule class=Cadence floating=on
|
||||
hc rule class=Lxpolkit floating=on
|
||||
hc rule class=Dragon-drag-and-drop floating=on
|
||||
|
||||
#
|
||||
# settings
|
||||
#
|
||||
|
||||
hc set focus_follows_mouse 1
|
||||
|
||||
#
|
||||
# autolaunch
|
||||
#
|
||||
|
||||
# panel
|
||||
hc detect_monitors
|
||||
panel=~/.config/herbstluftwm/panel/panel.sh
|
||||
for monitor in $(hc list_monitors | cut -d: -f1); do
|
||||
"$panel" "$monitor" &
|
||||
done
|
||||
|
||||
picom --experimental-backends &
|
||||
pidof dunst || dunst &
|
||||
pidof mpd || mpd &
|
||||
pidof flameshot || flameshot &
|
||||
wal -R && ~/.fehbg
|
||||
222
.config/herbstluftwm/panel/panel.sh
Executable file
222
.config/herbstluftwm/panel/panel.sh
Executable file
@ -0,0 +1,222 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. "${HOME}/.cache/wal/colors.sh"
|
||||
|
||||
quote() {
|
||||
local q="$(printf '%q ' "$@")"
|
||||
printf '%s' "${q% }"
|
||||
}
|
||||
|
||||
hc_quoted="$(quote "${herbstclient_command[@]:-herbstclient}")"
|
||||
hc() { "${herbstclient_command[@]:-herbstclient}" "$@"; }
|
||||
monitor=${1:-0}
|
||||
geometry=($(hc monitor_rect "$monitor"))
|
||||
if [ -z "$geometry" ]; then
|
||||
echo "Invalid monitor $monitor"
|
||||
exit 1
|
||||
fi
|
||||
# geometry has the format W H X Y
|
||||
x=$((${geometry[0]} + 12))
|
||||
y=$((${geometry[1]} + 12))
|
||||
panel_width=$((${geometry[2]} - 24))
|
||||
panel_height=29
|
||||
font="*mono*"
|
||||
|
||||
####
|
||||
# Try to find textwidth binary.
|
||||
# In e.g. Ubuntu, this is named dzen2-textwidth.
|
||||
if which textwidth &>/dev/null; then
|
||||
textwidth="textwidth"
|
||||
elif which dzen2-textwidth &>/dev/null; then
|
||||
textwidth="dzen2-textwidth"
|
||||
elif which xftwidth &>/dev/null; then # For guix
|
||||
textwidth="xtfwidth"
|
||||
else
|
||||
echo "This script requires the textwidth tool of the dzen2 project."
|
||||
exit 1
|
||||
fi
|
||||
####
|
||||
# true if we are using the svn version of dzen2
|
||||
# depending on version/distribution, this seems to have version strings like
|
||||
# "dzen-" or "dzen-x.x.x-svn"
|
||||
if dzen2 -v 2>&1 | head -n 1 | grep -q '^dzen-\([^,]*-svn\|\),'; then
|
||||
dzen2_svn="true"
|
||||
else
|
||||
dzen2_svn=""
|
||||
fi
|
||||
|
||||
if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
|
||||
mawk needs "-W interactive" to line-buffer stdout correctly
|
||||
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
|
||||
uniq_linebuffered() {
|
||||
awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
|
||||
}
|
||||
else
|
||||
# other awk versions (e.g. gawk) issue a warning with "-W interactive", so
|
||||
# we don't want to use it there.
|
||||
uniq_linebuffered() {
|
||||
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
|
||||
}
|
||||
fi
|
||||
|
||||
# get the current pulseaudio volume, or state incase muted
|
||||
pulsegetvol() {
|
||||
if [ $(pulsemixer --get-mute) == 1 ]; then
|
||||
echo -ne "^fg($foreground)muted\n"
|
||||
else
|
||||
volume=$(pulsemixer --get-volume | awk '{print $1; exit}')
|
||||
echo -n "^fg($foreground)$volume"
|
||||
fi
|
||||
}
|
||||
|
||||
# using pactl we can subscribe to pulseaudio and check for changes
|
||||
pulsesub() {
|
||||
pactl subscribe | grep --line-buffered "change.*sink" | while read -r line; do
|
||||
echo -ne "pulseaudio\t$(pulsegetvol)\n"
|
||||
done
|
||||
}
|
||||
|
||||
# used when reloading / quitting, kills all event generators as they no longer have a use
|
||||
list_descendants() {
|
||||
local children=$(ps -o pid= --ppid "$1")
|
||||
for pid in $children; do
|
||||
list_descendants "$pid"
|
||||
done
|
||||
echo "$children"
|
||||
}
|
||||
|
||||
hc pad $monitor $(($panel_height + 12))
|
||||
|
||||
{
|
||||
### Event generator ###
|
||||
# based on different input data (mpc, date, hlwm hooks, ...) this generates events, formed like this:
|
||||
# <eventname>\t<data> [...]
|
||||
# e.g.
|
||||
# date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29
|
||||
|
||||
#mpc idleloop player &
|
||||
pulsesub &
|
||||
while true; do
|
||||
# "date" output is checked once a second, but an event is only
|
||||
# generated if the output changed compared to the previous run.
|
||||
date +$"date ^fg($foreground)%a %b %d %H:%M"
|
||||
sleep 1 || break
|
||||
done > >(uniq_linebuffered) &
|
||||
hc --idle
|
||||
} 2>/dev/null | {
|
||||
IFS=$'\t' read -ra tags <<<"$(hc tag_status $monitor)"
|
||||
visible=true
|
||||
date=""
|
||||
windowtitle=""
|
||||
volume="$(pulsegetvol)"
|
||||
while true; do
|
||||
|
||||
### Output ###
|
||||
# This part prints dzen data based on the _previous_ data handling run,
|
||||
# and then waits for the next event to happen.
|
||||
|
||||
separator="^bg()^fg($color8)|"
|
||||
# draw tags
|
||||
for i in "${tags[@]}"; do
|
||||
case ${i:0:1} in
|
||||
'#')
|
||||
# tag is focused
|
||||
echo -n "^bg($color2)^fg()"
|
||||
;;
|
||||
':')
|
||||
# tag is not empty
|
||||
echo -n "^bg()^fg($foreground)"
|
||||
;;
|
||||
'!')
|
||||
# tag containts an urgent window
|
||||
echo -n "^bg($color6)^fg()"
|
||||
;;
|
||||
'-')
|
||||
# tag is viewed on a non-focused monitor
|
||||
echo -n "^bg($color1)^fg()"
|
||||
;;
|
||||
*)
|
||||
# tag is empty
|
||||
echo -n "^bg()^fg($color8)"
|
||||
;;
|
||||
esac
|
||||
if [ ! -z "$dzen2_svn" ]; then
|
||||
# clickable tags if using SVN dzen
|
||||
echo -n "^ca(1,$hc_quoted focus_monitor \"$monitor\" && "
|
||||
echo -n "$hc_quoted use \"${i:1}\") ${i:1} ^ca()"
|
||||
else
|
||||
# non-clickable tags if using older dzen
|
||||
echo -n " ${i:1} "
|
||||
fi
|
||||
done
|
||||
echo -n "$separator"
|
||||
echo -n "^bg()^fg() ${windowtitle//^/^^}"
|
||||
# small adjustments
|
||||
right="$volume $separator $date"
|
||||
right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
|
||||
# get width of right aligned text.. and add some space..
|
||||
width=$($textwidth "$font" "$right_text_only ")
|
||||
echo -n "^pa($(($panel_width - $width)))$right"
|
||||
echo
|
||||
|
||||
### Data handling ###
|
||||
# This part handles the events generated in the event loop, and sets
|
||||
# internal variables based on them. The event and its arguments are
|
||||
# read into the array cmd, then action is taken depending on the event
|
||||
# name.
|
||||
# "Special" events (quit_panel/togglehidepanel/reload) are also handled
|
||||
# here.
|
||||
|
||||
# wait for next event
|
||||
IFS=$'\t' read -ra cmd || break
|
||||
# find out event origin
|
||||
case "${cmd[0]}" in
|
||||
tag*)
|
||||
#echo "resetting tags" >&2
|
||||
IFS=$'\t' read -ra tags <<<"$(hc tag_status $monitor)"
|
||||
;;
|
||||
date)
|
||||
#echo "resetting date" >&2
|
||||
date="${cmd[@]:1}"
|
||||
;;
|
||||
quit_panel)
|
||||
kill $(list_descendants $$)
|
||||
exit
|
||||
;;
|
||||
togglehidepanel)
|
||||
currentmonidx=$(hc list_monitors | sed -n '/\[FOCUS\]$/s/:.*//p')
|
||||
if [ "${cmd[1]}" -ne "$monitor" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "${cmd[1]}" = "current" ] && [ "$currentmonidx" -ne "$monitor" ]; then
|
||||
continue
|
||||
fi
|
||||
echo "^togglehide()"
|
||||
if $visible; then
|
||||
visible=false
|
||||
hc pad $monitor 0
|
||||
else
|
||||
visible=true
|
||||
hc pad $monitor $(($panel_height + 12))
|
||||
fi
|
||||
;;
|
||||
reload)
|
||||
kill $(list_descendants $$)
|
||||
exit
|
||||
;;
|
||||
focus_changed | window_title_changed)
|
||||
windowtitle="${cmd[@]:2}"
|
||||
;;
|
||||
pulseaudio)
|
||||
volume="${cmd[@]:1}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
### dzen2 ###
|
||||
# After the data is gathered and processed, the output of the previous block
|
||||
# gets piped to dzen2.
|
||||
|
||||
} 2>/dev/null | dzen2 -w $panel_width -x $x -y $y -fn mononoki-15 -h $panel_height \
|
||||
-e "button3=;button4=exec:$hc_quoted use_index -1;button5=exec:$hc_quoted use_index +1" \
|
||||
-ta l -bg "$background" -fg "$foreground"
|
||||
23
.config/herbstluftwm/scripts/exitmenu
Executable file
23
.config/herbstluftwm/scripts/exitmenu
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
dmenu="dmenu -p exit"
|
||||
choice=$(echo -e "shutdown\nrestart\nlogoff\nscreenlock" | $dmenu)
|
||||
|
||||
case $choice in
|
||||
|
||||
shutdown)
|
||||
sudo halt
|
||||
;;
|
||||
|
||||
restart)
|
||||
sudo shutdown -r now
|
||||
;;
|
||||
|
||||
logoff)
|
||||
herbstclient quit
|
||||
;;
|
||||
|
||||
screenlock)
|
||||
i3lock -c 000000
|
||||
;;
|
||||
|
||||
esac
|
||||
10
.config/herbstluftwm/scripts/resizestep
Executable file
10
.config/herbstluftwm/scripts/resizestep
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
dmenu="dmenu -p resize"
|
||||
|
||||
resizestep=$(echo -e "0.04\n0.01\n0.004\n0.001" | $dmenu)
|
||||
|
||||
confpath=$XDG_CONFIG_HOME/herbstluftwm/autostart
|
||||
|
||||
source <(awk -v RS='' '/M=Mod/' $confpath)
|
||||
source <(awk -v RS='' '/key\(\)/' $confpath)
|
||||
source <(grep "resizestep" $confpath | grep -v "^resizestep=")
|
||||
30
.config/herbstluftwm/scripts/togglemaster
Executable file
30
.config/herbstluftwm/scripts/togglemaster
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
dmenu="dmenu -p toggle"
|
||||
|
||||
choice=$(echo -e "picom\nwindowcovering\nframeborderwidth\nresizestep" | $dmenu)
|
||||
|
||||
case $choice in
|
||||
|
||||
picom)
|
||||
pidof picom && killall picom || picom --experimental-backends
|
||||
;;
|
||||
|
||||
windowcovering)
|
||||
herbstclient set hide_covered_windows toggle
|
||||
;;
|
||||
|
||||
frameborderwidth)
|
||||
frameborderwidth=$(echo -e "enter width..." | dmenu)
|
||||
herbstclient set frame_border_width $frameborderwidth
|
||||
;;
|
||||
|
||||
resizestep)
|
||||
resizestep=$(echo -e "0.04\n0.01\n0.004\n0.001" | dmenu)
|
||||
confpath=~/.config/herbstluftwm/autostart
|
||||
source <(awk -v RS='' '/M=Mod/' $confpath)
|
||||
source <(awk -v RS='' '/key\(\)/' $confpath)
|
||||
source <(grep "resizestep" $confpath | grep -v "^resizestep=")
|
||||
;;
|
||||
|
||||
esac
|
||||
6
.config/herbstluftwm/scripts/volume
Executable file
6
.config/herbstluftwm/scripts/volume
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
dmenu="dmenu -p volume"
|
||||
|
||||
volume=$(echo -e "0\n25\n50\n75\n100" | $dmenu)
|
||||
pulsemixer --set-volume $volume
|
||||
Reference in New Issue
Block a user