Many changes
This commit is contained in:
3
modules/bspwm/default.nix
Normal file
3
modules/bspwm/default.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{ ... }: {
|
||||
services.xserver.windowManager.bspwm.enable = true;
|
||||
}
|
||||
77
modules/bspwm/home.nix
Normal file
77
modules/bspwm/home.nix
Normal file
@@ -0,0 +1,77 @@
|
||||
{ pkgs, lib, config, ... }: {
|
||||
imports = [
|
||||
../qutesearch/home.nix
|
||||
../tint2/home.nix
|
||||
../rofi/home.nix
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
pkgs.feh
|
||||
pkgs.flameshot
|
||||
];
|
||||
|
||||
services.network-manager-applet.enable = true;
|
||||
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
extraPortals = [
|
||||
pkgs.xdg-desktop-portal-kde
|
||||
];
|
||||
configPackages = [
|
||||
pkgs.xdg-desktop-portal-kde
|
||||
];
|
||||
};
|
||||
|
||||
# handled by home manager
|
||||
# home.sessionVariables = {
|
||||
# # Tell java it's in no-reparenting land
|
||||
# "_JAVA_AWT_WM_NONREPARENTING" = 1;
|
||||
# };
|
||||
|
||||
services.sxhkd.enable = true;
|
||||
xdg.configFile."sxhkd/sxhkdrc" = {
|
||||
source = ./sxhkdrc;
|
||||
executable = true;
|
||||
};
|
||||
|
||||
home.file.".local/bin" = {
|
||||
source = ./scripts;
|
||||
recursive = true;
|
||||
executable = true;
|
||||
};
|
||||
|
||||
xsession.windowManager.bspwm = {
|
||||
enable = true;
|
||||
|
||||
monitors = {
|
||||
"eDP-1" = [ "I" "II" "III" "IV" "V" ];
|
||||
};
|
||||
|
||||
settings = {
|
||||
border_width = 1;
|
||||
window_gap = 4;
|
||||
split_ratio = 0.52;
|
||||
|
||||
pointer_modifier = "super";
|
||||
pointer_action1 = "move";
|
||||
pointer_action2 = "resize_corner";
|
||||
|
||||
focus_follows_pointer = true;
|
||||
pointer_follows_focus = true;
|
||||
};
|
||||
|
||||
rules = {
|
||||
Gimp = {
|
||||
state = "floating";
|
||||
};
|
||||
};
|
||||
|
||||
startupPrograms = [
|
||||
# "pgrep -x sxhkd > /dev/null || sxhkd &"
|
||||
"wmname LG3D"
|
||||
# "xsetroot -cursor_name left_ptr &"
|
||||
"tint2"
|
||||
"feh --bg-scale ${config.custom.wallpaper}"
|
||||
];
|
||||
};
|
||||
}
|
||||
3
modules/bspwm/scripts/bsp-float
Executable file
3
modules/bspwm/scripts/bsp-float
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Open an app in float mode
|
||||
bspc rule -a \* -o state=floating && $@
|
||||
14
modules/bspwm/scripts/bsp-floating-only
Executable file
14
modules/bspwm/scripts/bsp-floating-only
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -z $1 ]; then
|
||||
# FLOATING_DESKTOP_ID=$(bspc query -D -d '^3')
|
||||
FLOATING_DESKTOP_ID=$1
|
||||
|
||||
bspc subscribe node_add | while read -a msg ; do
|
||||
desk_id=${msg[2]}
|
||||
wid=${msg[4]}
|
||||
[ "$FLOATING_DESKTOP_ID" = "$desk_id" ] && bspc node "$wid" -t floating
|
||||
done
|
||||
else
|
||||
echo "No desktop provided"
|
||||
fi
|
||||
60
modules/bspwm/scripts/bsp-smove
Executable file
60
modules/bspwm/scripts/bsp-smove
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A more fluid way of moving windows with BSPWM, which is meant to be
|
||||
# implemented in SXHKD. If there is a window in the given direction,
|
||||
# swap places with it. Else if there is a receptacle move to it
|
||||
# ("consume" its place). Otherwise create a receptacle in the given
|
||||
# direction by splitting the entire viewport (circumvents the tiling
|
||||
# scheme while respecting the current split ratio configuration). In
|
||||
# the latter scenario, inputting the direction twice will thus move the
|
||||
# focused window out of its current layout and into the receptacle.
|
||||
#
|
||||
# Part of my dotfiles: https://gitlab.com/protesilaos/dotfiles
|
||||
#
|
||||
# Copyright (c) 2019 Protesilaos Stavrou <info@protesilaos.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
[ "$#" -eq 1 ] || { echo "Pass only one argument: north,east,south,west"; exit 1; }
|
||||
|
||||
# Check if argument is a valid direction.
|
||||
case "$1" in
|
||||
north|east|south|west)
|
||||
dir="$1"
|
||||
;;
|
||||
*)
|
||||
echo "Not a valid argument."
|
||||
echo "Use one of: north,east,south,west"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
_query_nodes() {
|
||||
bspc query -N -n "$@"
|
||||
}
|
||||
|
||||
# Do not operate on floating windows!
|
||||
[ -z "$(_query_nodes focused.floating)" ] || { echo "Only move tiled windows."; exit 1; }
|
||||
|
||||
receptacle="$(_query_nodes 'any.leaf.!window')"
|
||||
|
||||
# This regulates the behaviour documented in the description.
|
||||
if [ -n "$(_query_nodes "${dir}.!floating")" ]; then
|
||||
bspc node -s "$dir"
|
||||
elif [ -n "$receptacle" ]; then
|
||||
bspc node focused -n "$receptacle" --follow
|
||||
else
|
||||
bspc node @/ -p "$dir" -i && bspc node -n "$receptacle" --follow
|
||||
fi
|
||||
17
modules/bspwm/scripts/bsp-status
Executable file
17
modules/bspwm/scripts/bsp-status
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
declare -A layout_symbols
|
||||
|
||||
layout_symbols[monocle]="mono"
|
||||
layout_symbols[tiled]="tiled"
|
||||
|
||||
send_symbol() {
|
||||
echo ${layout_symbols[$1]}
|
||||
}
|
||||
|
||||
# Optional, sends first output. This requires jq
|
||||
send_symbol $(bspc query -T --desktop focused | jq -r '.layout')
|
||||
|
||||
bspc subscribe desktop_layout | while read -a msg ; do
|
||||
send_symbol ${msg[3]}
|
||||
done
|
||||
37
modules/bspwm/scripts/bsp-toggle-visibility
Executable file
37
modules/bspwm/scripts/bsp-toggle-visibility
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
cat <<EOF
|
||||
Usage: $(basename "${0}") process_name [executable_name] [--take-first]
|
||||
process_name As recognized by 'xdo' command
|
||||
executable_name As used for launching from terminal
|
||||
--take-first In case 'xdo' returns multiple process IDs
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get id of process by class name and then fallback to instance name
|
||||
id=$(xdo id -N "${1}" || xdo id -n "${1}")
|
||||
|
||||
executable=${1}
|
||||
shift
|
||||
|
||||
while [ -n "${1}" ]; do
|
||||
case ${1} in
|
||||
--take-first)
|
||||
id=$(head -1 <<<"${id}" | cut -f1 -d' ')
|
||||
;;
|
||||
*)
|
||||
executable=${1}
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
${executable}
|
||||
else
|
||||
while read -r instance; do
|
||||
bspc node "${instance}" --flag hidden --to-monitor focused --focus
|
||||
done <<<"${id}"
|
||||
fi
|
||||
1830
modules/bspwm/scripts/pfetch
Executable file
1830
modules/bspwm/scripts/pfetch
Executable file
File diff suppressed because it is too large
Load Diff
9
modules/bspwm/scripts/rofi-ask
Executable file
9
modules/bspwm/scripts/rofi-ask
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Take password prompt from STDIN, print password to STDOUT
|
||||
# the sed piece just removes the colon from the provided
|
||||
# prompt: rofi -p already gives us a colon
|
||||
rofi -dmenu \
|
||||
-password \
|
||||
-no-fixed-num-lines \
|
||||
-p "$(printf "$1" | sed s/://)"
|
||||
5
modules/bspwm/scripts/sxhkd-help
Executable file
5
modules/bspwm/scripts/sxhkd-help
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
awk '/^[a-z]/ && last {print "<small>",$0,"\t",last,"</small>"} {last=""} /^#/{last=$0}' ~/.config/sxhkd/sxhkdrc{,.common} |
|
||||
column -t -s $'\t' |
|
||||
rofi -dmenu -i -markup-rows -no-show-icons -width 1000 -lines 15
|
||||
9
modules/bspwm/scripts/tabc-smart-detach
Executable file
9
modules/bspwm/scripts/tabc-smart-detach
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
id=$(bspc query -N -n);
|
||||
if [ "$(tabc printclass $id)" == "tabbed" ]; then
|
||||
bspc node -p $1;
|
||||
tabc detach $id;
|
||||
else \
|
||||
tabc attach $id $(bspc query -N -n $1);
|
||||
fi
|
||||
176
modules/bspwm/sxhkdrc
Executable file
176
modules/bspwm/sxhkdrc
Executable file
@@ -0,0 +1,176 @@
|
||||
#
|
||||
# wm independent hotkeys
|
||||
#
|
||||
|
||||
# Open kitty
|
||||
super + Return
|
||||
kitty
|
||||
|
||||
# Open floating kitty
|
||||
super + shift + Return
|
||||
bsp-float kitty
|
||||
|
||||
# launch program (drun)
|
||||
super + @space
|
||||
rofi -show drun
|
||||
|
||||
# launch program (standard run)
|
||||
super + shift + @space
|
||||
rofi -show run
|
||||
|
||||
# make sxhkd reload its configuration files:
|
||||
super + Escape
|
||||
pkill -USR1 -x sxhkd; notify-send 'Key daemon reloaded'
|
||||
|
||||
# Start a qutebrowser search
|
||||
super + o
|
||||
qutesearch
|
||||
|
||||
# Show keybinds
|
||||
super + slash
|
||||
sxhkd-help
|
||||
|
||||
# Show clipmenu
|
||||
super + v
|
||||
rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
|
||||
|
||||
super + shift + v
|
||||
greenclip clear
|
||||
|
||||
#
|
||||
# bspwm hotkeys
|
||||
#
|
||||
|
||||
# quit/restart bspwm
|
||||
super + shift + {q,r}
|
||||
bspc {quit,wm -r}
|
||||
|
||||
# close and kill
|
||||
super + {_,shift + }w
|
||||
bspc node -{c,k}
|
||||
|
||||
super + q
|
||||
bspc node -c
|
||||
|
||||
# superernate between the tiled and monocle layout
|
||||
super + m
|
||||
bspc desktop -l next
|
||||
|
||||
# send the newest marked node to the newest preselected node
|
||||
super + y
|
||||
bspc node newest.marked.local -n newest.!automatic.local
|
||||
|
||||
# swap the current node and the biggest window
|
||||
super + g
|
||||
bspc node -s biggest.window
|
||||
|
||||
# Reveal hidden kitty (scratchpad)
|
||||
super + alt + Return
|
||||
bsp-toggle-visibility KittyScratch "kitty --class KittyScratch"
|
||||
|
||||
# flameshot
|
||||
super + Print
|
||||
flameshot gui
|
||||
|
||||
#
|
||||
# state/flags
|
||||
#
|
||||
|
||||
# set the window state
|
||||
super + {z,shift + z,x,f}
|
||||
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
|
||||
|
||||
# set the node flags
|
||||
super + ctrl + {m,x,y,z}
|
||||
bspc node -g {marked,locked,sticky,private}
|
||||
|
||||
#
|
||||
# focus/swap
|
||||
#
|
||||
|
||||
# focus the node in the given direction
|
||||
super + {h,j,k,l,Left,Down,Up,Right}
|
||||
bspc node -{f} {west,south,north,east,west,south,north,east}
|
||||
|
||||
# focus the node for the given path jump
|
||||
super + {p,b,comma,period}
|
||||
bspc node -f @{parent,brother,first,second}
|
||||
|
||||
# focus the next/previous window in the current desktop
|
||||
super + {a,d}
|
||||
bspc node -f {next,prev}.local.!hidden.window
|
||||
|
||||
# focus the next/previous desktop in the current monitor
|
||||
super + bracket{left,right}
|
||||
bspc desktop -f {prev,next}.local
|
||||
|
||||
# focus the last node/desktop
|
||||
super + {grave,Tab}
|
||||
bspc {node,desktop} -f last
|
||||
|
||||
# focus the older or newer node in the focus history
|
||||
# super + {o,i}
|
||||
# bspc wm -h off; \
|
||||
# bspc node {older,newer} -f; \
|
||||
# bspc wm -h on
|
||||
|
||||
# focus or send to the given desktop
|
||||
super + {_,shift + }{1-9,0}
|
||||
bspc {desktop -f,node -d} '^{1-9,10}'
|
||||
|
||||
#
|
||||
# preselect
|
||||
#
|
||||
|
||||
# preselect the direction
|
||||
super + ctrl + shift {h,j,k,l,Left,Down,Up,Right}
|
||||
bspc node -p {west,south,north,east,west,south,north,east}
|
||||
|
||||
# preselect the ratio
|
||||
super + ctrl + {1-9}
|
||||
bspc node -o 0.{1-9}
|
||||
|
||||
# cancel the preselection for the focused node
|
||||
super + ctrl + space
|
||||
bspc node -p cancel
|
||||
|
||||
# cancel the preselection for the focused desktop
|
||||
super + ctrl + shift + space
|
||||
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
|
||||
|
||||
#
|
||||
# move/resize
|
||||
#
|
||||
|
||||
# Resize a window by moving one of its side outward/inward
|
||||
super + s ; {h,j,k,l,Left,Down,Up,Right}
|
||||
STEP=20; SELECTION={1,2,3,4,1,2,3,4}; \
|
||||
bspc node -z $(echo "left -$STEP 0,bottom 0 $STEP,top 0 -$STEP,right $STEP 0" | cut -d',' -f$SELECTION) || \
|
||||
bspc node -z $(echo "right -$STEP 0,top 0 $STEP,bottom 0 -$STEP,left $STEP 0" | cut -d',' -f$SELECTION)
|
||||
|
||||
# move a floating window
|
||||
super + {h,j,k,l}
|
||||
bspc node -v {-30 0,0 20,0 -30,20 0}
|
||||
|
||||
# move a window
|
||||
super + shift + {h,j,k,l,Left,Down,Up,Right}
|
||||
bsp-smove {west,south,north,east,west,south,north,east}
|
||||
|
||||
#
|
||||
# tabs
|
||||
#
|
||||
|
||||
# move in/out of tabbed container
|
||||
super + ctrl + {h,j,k,l,Left,Down,Up,Right}
|
||||
tabc-smart-detach {west,south,north,east,west,south,north,east}
|
||||
|
||||
# tab/untab window
|
||||
super + t
|
||||
id=$(bspc query -N -n); \
|
||||
[[ "$(tabc printclass $id)" == "tabbed" ]] \
|
||||
&& tabc detach $id \
|
||||
|| tabc create $id
|
||||
|
||||
# toggle autoattach in tabbed container
|
||||
super + shift + t
|
||||
tabc autoattach $(bspc query -N -n)
|
||||
Reference in New Issue
Block a user