From a33c3b0f7b3f13ea48275cceb724dd3bc59b0a09 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 14 May 2021 10:17:10 -0400 Subject: [PATCH] Revert "Remove sxhkd" Similar to the other revert commits, keeping my sxhkd config is useful if I want to use bspwm in the future, since I won't have to re-create it later. --- sxhkd/.config/sxhkd/dropdown.sh | 24 +++++++++ sxhkd/.config/sxhkd/screenshot.sh | 10 ++++ sxhkd/.config/sxhkd/sxhkdrc | 89 +++++++++++++++++++++++++++++++ sxhkd/README.md | 16 ++++++ 4 files changed, 139 insertions(+) create mode 100755 sxhkd/.config/sxhkd/dropdown.sh create mode 100755 sxhkd/.config/sxhkd/screenshot.sh create mode 100644 sxhkd/.config/sxhkd/sxhkdrc create mode 100644 sxhkd/README.md diff --git a/sxhkd/.config/sxhkd/dropdown.sh b/sxhkd/.config/sxhkd/dropdown.sh new file mode 100755 index 0000000..50cfa18 --- /dev/null +++ b/sxhkd/.config/sxhkd/dropdown.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# New Start: A modern Arch workflow built with an emphasis on functionality. +# Copyright (C) 2018 Donovan Glover + +DROPDOWN_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2) +DROPDOWN_SCALE=$(($DROPDOWN_DPI / 96)) + +c='kitty' # Class +i='dropdown' # Instance +x='kitty --name' # Executable + +# Note: This solution will not work with termite since it registers two ids. +# See https://github.com/thestinger/termite/issues/634 for more information. + +id=$(xdo id -n $i) +rectangle=$((1700 * $DROPDOWN_SCALE))x$((600 * $DROPDOWN_SCALE)) +offset=+$((110 * $DROPDOWN_SCALE))+$((100 * $DROPDOWN_SCALE)) + +bspc rule -r $c:$i +bspc rule -a $c:$i sticky=on state=floating rectangle=$rectangle$offset + +([ -z "$id" ]) && ($x $i) || + ([[ $(xprop -id "$id" | awk '/window state: / {print $3}') == 'Withdrawn' ]] && + xdo show -n $i || xdo hide -n $i) diff --git a/sxhkd/.config/sxhkd/screenshot.sh b/sxhkd/.config/sxhkd/screenshot.sh new file mode 100755 index 0000000..f6a5821 --- /dev/null +++ b/sxhkd/.config/sxhkd/screenshot.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# New Start: A modern Arch workflow built with an emphasis on functionality. +# Copyright (C) 2017-2018 Donovan Glover + +SCREENSHOT_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2) +SCREENSHOT_SCALE=$(($SCREENSHOT_DPI / 96)) + +DATETIME=`date +%F_%H%M%S` +shotgun ~/$DATETIME.png +feh ~/$DATETIME.png --geometry $((1600 * $SCREENSHOT_SCALE))x$((900 * $SCREENSHOT_SCALE)) --scale-down diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc new file mode 100644 index 0000000..67c0407 --- /dev/null +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -0,0 +1,89 @@ +# New Start: A modern Arch workflow built with an emphasis on functionality. +# Copyright (C) 2017-2018 Donovan Glover + +# Reload sxhkd / Quit bspwm +super + {_, alt} + Escape + {pkill -USR1 -x sxhkd,bspc quit} + +# Take a screenshot +super + p + ~/.config/sxhkd/screenshot.sh + +# Open a new terminal window +super + {_,shift} + Return + kitty {_,--name floating} + +# Toggle a dropdown terminal +super + backslash + ~/.config/sxhkd/dropdown.sh + +# toggle polybar: top_padding depends on the height you set in polybar/config +super + o + (xdotool search --class --onlyvisible "Polybar" && \ + (xdo hide -N "Polybar" && bspc config top_padding 0)) || \ + (xdo show -N "Polybar" && bspc config top_padding $(cat ~/.cache/polybar/bspwm_top_padding)) + +# Change the wal color scheme +alt + m + wal -o ~/.config/wal/done.sh -i ~/Pictures/Wallpapers + +alt + z + ~/.config/rofi/launch.sh + +# ==================== +# ======= Node ======= +# ==================== + +# Close the focused window +super + {_,shift} + q + bspc node -{c,k} + +# Switch to / Swap with the node in the specified direction +super + {_,shift} + {h,j,k,l} + bspc node -{f,s} {west,south,north,east} + +# Switch to the next / previous node (includes monocle layout) +super + {_,shift} + n + bspc node -f {next,prev} + +# FLAGS: Toggle between node flags +super + {x,y} + bspc node -g {sticky,private} + +# FLAGS: Push and pop windows from the hidden stack +super + {_,shift} + b + bspc node {-g hidden,$(bspc query -N -n .hidden | tail -n 1) -g hidden=off} + +# STATES: Toggle between node states +super + {t,r,f,space} + bspc node focused -t ~{tiled,pseudo_tiled,fullscreen,floating} + +# PRESELECT: The direction to create a new node +super + ctrl + {h,j,k,l,space} + bspc node -p {west,south,north,east,cancel} + +# RATIO: The size of a new node +super + ctrl + {1-9} + bspc node -o 0.{1-9} + +# ======================= +# ======= Desktop ======= +# ======================= + +# Focus a certain desktop / Send a node to a certain desktop +super + {_,shift} + {1-9,0} + bspc {desktop -f,node -d} '^{1-9,10}' + +# Move to the next desktop on the current monitor +alt + {_, shift} + Tab + bspc desktop -f {next,prev}.local + +# Easily go back and forth between the last desktop used +alt + a + bspc desktop -f last + +# Switch between tiled and monocle desktop layouts +super + c + bspc desktop -l next + +# vim:ft=sxhkdrc diff --git a/sxhkd/README.md b/sxhkd/README.md new file mode 100644 index 0000000..61b8992 --- /dev/null +++ b/sxhkd/README.md @@ -0,0 +1,16 @@ +# sxhkd + +[sxhkd][sxhkd] is a hotkey daemon for X11. + +## Use Cases + +sxhkd can be used to: + +- Bind any key combination to whatever shell command you want +- Control windows in [bspwm](/bspwm) through `bspc` + +You should not use sxhkd if: + +- You use a desktop environment that sets keybinds for you + +[sxhkd]: https://github.com/baskerville/sxhkd