1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-22 08:21:27 +00:00

add herbstluftwm

This commit is contained in:
Horhik 2022-08-04 19:27:25 +03:00
parent dbe8ca455b
commit f520434bc7
6 changed files with 540 additions and 0 deletions

View file

@ -0,0 +1,230 @@
#!/usr/bin/env bash
# this is a simple config for herbstluftwm
hc() {
herbstclient "$@"
herbstclient attr theme.title_when multiple_tabs
}
hc emit_hook reload
xsetroot -solid '#fe8019'
# remove all existing keybindings
hc keyunbind --all
# keybindings
# if you have a super key you will be much happier with Mod set to Mod4
Mod1=Mod1 # Use alt as the main modifier
Mod=Mod4 # Use the super key as the main modifier
hc keybind $Mod-Shift-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close
hc keybind $Mod-Return spawn "${TERMINAL:-alacritty}" # use your $TERMINAL with xterm as fallback
# basic movement in tiling and floating mode
# focusing clients
hc keybind $Mod-Left focus left
hc keybind $Mod-Down focus down
hc keybind $Mod-Up focus up
hc keybind $Mod-Right focus right
hc keybind $Mod-h focus left
hc keybind $Mod-j focus down
hc keybind $Mod-k focus up
hc keybind $Mod-l focus right
# moving clients in tiling and floating mode
hc keybind $Mod-Shift-Left shift left
hc keybind $Mod-Shift-Down shift down
hc keybind $Mod-Shift-Up shift up
hc keybind $Mod-Shift-Right shift right
hc keybind $Mod-Shift-h shift left
hc keybind $Mod-Shift-j shift down
hc keybind $Mod-Shift-k shift up
hc keybind $Mod-Shift-l shift right
# splitting frames
# create an empty frame at the specified direction
hc keybind $Mod-Control-u split bottom 0.5
hc keybind $Mod-Control-o split right 0.5
# let the current frame explode into subframes
hc keybind $Mod-Control-space split explode
# resizing frames and floating clients
resizestep=0.02
hc keybind $Mod-Control-h resize left +$resizestep
hc keybind $Mod-Control-j resize down +$resizestep
hc keybind $Mod-Control-k resize up +$resizestep
hc keybind $Mod-Control-l resize right +$resizestep
hc keybind $Mod-Control-Left resize left +$resizestep
hc keybind $Mod-Control-Down resize down +$resizestep
hc keybind $Mod-Control-Up resize up +$resizestep
hc keybind $Mod-Control-Right resize right +$resizestep
# tags
tag_names=( {1..9} )
tag_keys=( {1..9} 0 )
hc rename default "${tag_names[0]}" || true
for i in "${!tag_names[@]}" ; do
hc add "${tag_names[$i]}"
key="${tag_keys[$i]}"
if [ -n "$key" ] ; then
hc keybind "$Mod-$key" use_index "$i"
hc keybind "$Mod-Shift-$key" move_index "$i"
fi
done
# cycle through tags
hc keybind $Mod-period use_index +1 --skip-visible
hc keybind $Mod-comma use_index -1 --skip-visible
# layouting
hc keybind $Mod-r remove
hc keybind $Mod-s floating toggle
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-Control-f tiling toggle
hc keybind $Mod-Shift-f set_attr clients.focus.floating toggle
hc keybind $Mod-Shift-d set_attr clients.focus.decorated toggle
hc keybind $Mod-Control-m set_attr clients.focus.minimized true
hc keybind $Mod-Control-Shift-m jumpto last-minimized
hc keybind $Mod-Control-p pseudotile toggle
# The following cycles through the available layouts within a frame, but skips
# layouts, if the layout change wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame, the grid layout is skipped.
hc keybind $Mod1-space \
or , and . compare tags.focus.curframe_wcount = 2 \
. cycle_layout +1 vertical horizontal max vertical grid \
, cycle_layout +1
# mouse
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
# focus
hc keybind $Mod-BackSpace cycle_monitor
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-Shift-Tab cycle_all -1
hc keybind $Mod-c cycle
hc keybind $Mod-i jumpto urgent
# theme
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
hc set frame_border_active_color '#fe8019'
hc set frame_border_normal_color '#101010cc'
hc set frame_bg_normal_color '#3c383633'
hc set frame_bg_active_color '#fe801922'
hc set frame_border_width 0
hc set always_show_frame on
hc set frame_bg_transparent off
hc set frame_transparent_width 2
hc set frame_gap 0
# "#fe8019" "#d65d0e" "#af3a03'
hc attr theme.title_height 10
hc attr theme.title_when always
hc attr theme.title_font 'Mononoki Nerd Font:pixelsize=12' # example using Xft
# hc attr theme.title_font '-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
hc attr theme.title_depth 3 # space below the title's baseline
hc attr theme.active.color '#fe8019'
hc attr theme.title_color '#ffffff'
hc attr theme.normal.color '#fe801955'
hc attr theme.urgent.color '#7811A1'
hc attr theme.tab_color '#3c3836'
hc attr theme.active.tab_color '#ffffff00'
hc attr theme.active.tab_outer_color '#fe8019'
hc attr theme.active.tab_title_color '#f9f5d7'
hc attr theme.normal.title_color '#f2e5bc'
hc attr theme.inner_width 1
hc attr theme.inner_color black
hc attr theme.border_width 1
hc attr theme.fullscreen.border_width 1
hc attr theme.floating.border_width 1
hc attr theme.floating.outer_width 1
hc attr theme.floating.outer_color black
hc attr theme.active.inner_color '#fe8019'
hc attr theme.urgent.inner_color '#9A65B0'
hc attr theme.normal.inner_color '#3c3836'
# copy inner color to outer_color
for state in active urgent normal ; do
hc substitute C theme.${state}.inner_color \
attr theme.${state}.outer_color C
done
hc attr theme.tiling.outer_width 1
hc attr theme.background_color '#141414'
hc set window_gap 0
hc set frame_padding 0
hc set smart_window_surroundings off
hc set smart_frame_surroundings on
hc set mouse_recenter_gap 0
hc pad 1 30
hc pad 0 30
# rules
hc unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3
hc rule focus=on # normally focus new clients
hc rule floatplacement=smart
#hc rule focus=off # normally do not focus new clients
# give focus to most common terminals
#hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' 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 fixedsize floating=on
hc set tree_style '╾│ ├└╼─┐'
# unlock, just to be sure
hc unlock
# do multi monitor setup here, e.g.:
# hc set_monitors 1280x1024+0+0 1280x1024+1280+0
# or simply:
# hc detect_monitors
# find the panel
panel=~/.config/herbstluftwm/panel.sh
[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
for monitor in $(hc list_monitors | cut -d: -f1) ; do
# start it on each monitor
"$panel" "$monitor" &
done
hc keybind $Mod-p spawn rofi -show drun
hc keybind $Mod-Shift-s spawn flameshot gui
hc keybind $Mod-Shift-e spawn rofi -show emoji
#hc keybind $Mod-Shift-p spawn rofi-pass
#hc keybind $Mod-Shift-p spawn quickeepass ~/.password-store/Passwords.kdbx
# SCRATCHPADS
hc keybind $Mod-u spawn ~/.config/herbstluftwm/scratchpad.sh "hlwmScratch1" "alacritty --class=hlwmScratch1"
hc keybind $Mod-d spawn ~/.config/herbstluftwm/scratchpad.sh "hlwmScratchemascratch" "emacs --name hlwmScratchemascratch --title hlwmScratchemascratch"
hc keybind $Mod-Shift-m spawn ~/.config/herbstluftwm/scratchpad.sh "hlwmScratchVolume" "alacritty --class=hlwmScratchVolume -e pulsemixer"
hc keybind $Mod-Shift-d spawn ~/.config/herbstluftwm/scratchpad.sh "obsidian" "~.local/bin/Obsidian.AppImage"
hc keybind $Mod1-Control-space spawn emacsclient --eval "(emacs-everywhere)"
# put this somewhere after 'hc unrule -F' line
hc rule instance~hlwmScratch.* floating=on floatplacement=center # float all instances which contains 'hlwmScratch'
#Change Language
hc keybind $Mod-space spawn ~/.config/herbstluftwm/changelang
hc keybind $Mod1-shift spawn ~/.config/herbstluftwm/changelang
picom &
feh --bg-scale ~/Pictures/backgrounds/berries.jpg
syncthing &
~/.config/herbstluftwm/bar | lemonbar -n "herbstluftwm" -B "#000" -F "#fff" -f "mononoki Nerd Font:style=Bold:size=9" &

View file

@ -0,0 +1,133 @@
#!/bin/sh
export MAIN_DISK="/dev/nvme0n1p7"
#module GruvboxColors where
backgroundColor="#282828"
currentLineColor="#fabd2f"
selectionColor="#665c54"
foregroundColor="#ebdbb2"
foregroundSecondColor="#fbf1c1"
commentColor="#458588"
cyanColor="#83a598"
greenColor="#8ec07c"
greenDarkerColor="#689d6a"
orangeColor="#fe8019"
pinkColor="#d3869b"
purpleColor="#b16286"
redColor="#cc241d"
yellowColor="#fabd2f"
battery ()
{
val=$(acpi | grep -oh "[[:digit:]]*%" | grep -oh "[0-9]*")
echo %{F$greenColor}$val
#case $val in
# [1-9][0-9][0-9])
# echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
# ;;
# [5-9][0-9])
# echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
# ;;
#[1-4][0-9])
# echo "<fc=$yellowColor>—{ </fc>$val<fc=$yellowColor>%}</fc>"
# ;;
#[1-9])
# echo "<fc=$orangeColor>—{ </fc>$val<fc=$orangeColor>%}</fc>"
# ;;
#0)
# echo "<fc=$redColor> </fc>"
# ;;
#*)
# echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
# ;;
#esac
}
volume ()
{
#maybe change to Right, Left, Mono
val=$(pulsemixer --get-volume | grep -oP '^.* ')
echo $val
#case $val in
# 100)
# echo "<fc=$redColor>—{ $val%}</fc>"
#;;
# [5-9][0-9])
# echo "<fc=$orangeColor>—{ $val%}</fc>"
# ;;
#[1-4][0-9])
# echo "<fc=$yellowColor>—{ $val%}</fc>"
# ;;
#[1-9])
# echo "<fc=$greenDarkerColor>—{ $val%}</fc>"
# ;;
#0)
# echo "<fc=$currentLineColor>—{}</fc>"
# ;;
#*)
# echo "<fc=$redColor>—{ $val%}</fc>"
#esac
}
diskspace ()
{
#might be another /dev/sda...
val="$(df $MAIN_DISK | grep -oh '[0-9]*%' | tail -n 1 )"
echo %{F$purpleColor}$val
}
wifi ()
{
val=$(iw dev | awk '$1=="ssid"{print $2}')
echo %{F$redColor}$val
}
#
# name=$(iwgetid -r)
#if [ $name != " " ];
# then
# #echo "<fc=$cyanColor>—{ </fc> $name<fc=$cyanColor>}</fc>"
# echo "$name"
# else
# echo 睊 off
# fi
layout ()
{
#echo "<fc=$orangeColor>—{ </fc>"$(xkblayout-state print %s)"<fc=$orangeColor>}</fc>"
echo "$(xkb-switch -p)"
}
timeanddate ()
{
#echo "<fc=$yellowColor>—{</fc>" "<fc=$yellowColor>$(date +'%T')}</fc>"
echo "$(date +'%T')"
}
calendar ()
{
echo "$(date +'%d/%m/%Y')"
}
toggl_timer () {
toggl=$($HOME/.local/scripts/toggl-current)
toggl_duration=$(echo $toggl | jq -r '.data .duration')
toggl_description=$(echo $toggl | jq -r '.data .description')
curr_time=$(date +%s)
duration_sec=$((curr_time + toggl_duration))
#duration=$(echo $((duration_sec / (60 * 60))):$((duration_sec / 60 - duration_sec / (60 * 60) * 60)):$((duration_sec % 60)))
echo "$duration"
}
COLOR_UNDERLINE="#ff0000"
kek="%{U$COLOR_UNDERLINE}%{+u}${line#?}%{-u}$PADDING"
while true
do
echo "%{S1}%{c}$(timeanddate)--$(calendar)%{r}wifi:$(wifi)--disk:$(diskspace)--vol:$(volume)%--bat:$(battery)%"
sleep 5
done
#echo "$kek%{$(volume)}%{$(layout)}%{$(diskspace)}%{$(timeanddate)}"
#<fc=$greenDarkerColor>—{</fc>$(calendar)<fc=$greenDarkerColor>}——</fc>"
#echo "                                          "

View file

@ -0,0 +1,2 @@
#! /bin/sh
setxkbmap us,ru && xkb-switch -n

View file

@ -0,0 +1,60 @@
#!/usr/bin/env bash
# File: scratchpad.sh
# Description: Script to toggle or create scratchpad windows
# Author: RayZ0rr (https://github.com/RayZ0rr)
name="$1"
command="${@: 2}"
clientsArray=( $(herbstclient foreach C clients. echo C | awk 'BEGIN{ORS=" "} {print $1}') )
for client in "${clientsArray[@]}" ; do
id=$(echo $client | cut -d '.' -f 2)
instanceName="$(herbstclient get_attr ${client}.instance)"
# className=$(herbstclient get_attr "${client}.class")
# titleName="$(herbstclient get_attr ${client}.title)"
if [[ "${instanceName}" == "${name}" ]] ; then # If the scratchpad window exists
visible_wid="$(xdotool search --onlyvisible --classname "${name}" | tail -1 2> /dev/null)"
if [[ -z "$visible_wid" ]]; then # If the scratchpad window is not visible
echo "${name} found. Showing scratchpad."
herbstclient bring ${id} # Bring scratchpad to focus
exit $?
else # If the scratchpad window is visible
echo "Hiding instance of ${name}."
herbstclient set_attr "${client}.minimized" true # Hide scratchpad
exit 0
fi
fi
done
if [[ $# -ne 2 ]]; then # If a command to launch it was not provided
echo "${name} not found. A command was not provided to launch it."
exit 1
fi
echo "${name} not found. Executing: '${command}'."
$command
# if ! eval "${@: 2}" ; then
if ! [ $? -eq 0 ]; then
echo "Provided command '${command}' failed"
exit 1
fi
# Wait for application to be available
while [[ -z "$wid" ]]; do
sleep 0.05;
wid="$(xdotool search --classname "${name}" | tail -1 2> /dev/null)"
done
exit 0

View file

@ -0,0 +1,115 @@
#!/bin/sh
backgroundColor="#282828"
currentLineColor="#fabd2f"
selectionColor="#665c54"
foregroundColor="#ebdbb2"
foregroundSecondColor="#fbf1c1"
commentColor="#458588"
cyanColor="#83a598"
greenColor="#8ec07c"
greenDarkerColor="#689d6a"
orangeColor="#fe8019"
pinkColor="#d3869b"
purpleColor="#b16286"
redColor="#cc241d"
yellowColor="#fabd2f"
battery ()
{
val=$(acpi | grep -oh "[[:digit:]]*%" | grep -oh "[0-9]*")
case $val in
[1—9][0—9][0—9])
echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
;;
[5—9][0—9])
echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
;;
[1—4][0—9])
echo "<fc=$yellowColor>—{ </fc>$val<fc=$yellowColor>%}</fc>"
;;
[1-9])
echo "<fc=$redColor>—{ </fc>$val<fc=$redColor>%}</fc>"
;;
0)
echo "<fc=$redColor> </fc>"
;;
*)
echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
;;
esac
}
volume ()
{
#maybe change to Right, Left, Mono
val=$(amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }'| grep -oh "[0-9]*")
case $val in
100)
echo "<fc=$redColor>—{ $val%}</fc>"
;;
[5-9][0-9])
echo "<fc=$yellowColor>—{ $val%}</fc>"
;;
[1-4][0-9])
echo "<fc=$pinkColor>—{ $val%}</fc>"
;;
[1-9])
echo "<fc=$greenDarkerColor>—{ $val%}</fc>"
;;
0)
echo "<fc=$selectionColor>—{0%}</fc>"
;;
*)
echo "<fc=$redColor>—{ $val%}</fc>"
esac
}
diskspace ()
{
#might be another /dev/sda...
echo "<fc=$pinkColor>—{ </fc>"$(df $MAIN_DISK | grep -oh "[0-9]*%" | tail -n 1)"<fc=$pinkColor>}</fc>"
}
wifi ()
{
name=$(iwgetid -r)
if [ $name != " " ];
then
echo "<fc=$cyanColor>—{ </fc>$name<fc=$cyanColor>}</fc>"
else
echo 睊 off
fi
}
layout ()
{
echo "<fc=$orangeColor>—{ </fc>"$(xkblayout-state print %s)"<fc=$orangeColor>}</fc>"
}
timeanddate ()
{
echo "<fc=$yellowColor>—{</fc>" "<fc=$yellowColor>$(date +'%T')}</fc>"
}
calendar ()
{
echo "<fc=$greenDarkerColor> </fc>"$(date +'%d/%m/%Y')
}
toggl_timer () {
toggl=$($HOME/.local/scripts/toggl-current)
toggl_duration=$(echo $toggl | jq -r '.data .duration')
toggl_description=$(echo $toggl | jq -r '.data .description')
curr_time=$(date +%s)
duration_sec=$((curr_time + toggl_duration))
duration=$(echo $((duration_sec / (60 * 60))):$((duration_sec / 60 - duration_sec / (60 * 60) * 60)):$((duration_sec % 60)))
echo "<fc=$greenDarkerColor>—{$toggl_description(</fc>"$duration"<fc=$greenDarkerColor>)}</fc>"
}
echo "$(wifi)$(battery)$(volume)$(layout)$(diskspace)$(timeanddate)<fc=$greenDarkerColor>—{</fc>$(calendar)<fc=$greenDarkerColor>}——</fc>"
#echo "                                          "