-
# various sections of sway config
# ===== input =====
input * {
xkb_layout de
tap enabled
dwt disabled
dwtp disabled
natural_scroll disabled
drag_lock disabled
# accel_profile flat
# pointer_accel -0.6
# pointer_accel 0
}
# ===== keybinds =====
# Start a temp terminal
bindsym $mod+Shift+Return exec $term -e d26r temp bash
# screen-message
bindsym $mod+s exec sm -i -a 1 -f '#203' ' 🧌 '
# mic shortcuts: start with open mic (hold Alt+x to mute),
# press Alt+Shift+x to switch to/from ptt (hold Alt+x to unmute).
# also decreases speaker volume in ptt mode while unmuted.
exec pactl set-source-mute @DEFAULT_SOURCE@ no
bindsym --no-repeat Mod1+Shift+x exec bash -c 'if [[ -f /tmp/mark-micmute-ptt ]]; then rm /tmp/mark-micmute-ptt; pactl set-source-mute @DEFAULT_SOURCE@ no; else touch /tmp/mark-micmute-ptt; pactl set-source-mute @DEFAULT_SOURCE@ yes; fi'
bindsym --no-repeat Mod1+x exec bash -c 'if [[ -f /tmp/mark-micmute-ptt ]]; then pactl set-sink-volume mark_combine_out_5 50%; sleep 0.1; pactl set-source-mute @DEFAULT_SOURCE@ no; else pactl set-source-mute @DEFAULT_SOURCE@ yes; fi'
bindsym --no-repeat --release Mod1+x exec bash -c 'sleep 0.05; if [[ -f /tmp/mark-micmute-ptt ]]; then pactl set-sink-volume mark_combine_out_5 100%; sleep 0.05; pactl set-source-mute @DEFAULT_SOURCE@ yes; else pactl set-source-mute @DEFAULT_SOURCE@ no; fi'
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+f floating toggle
# default bind
bindsym $mod+Shift+space floating toggle
# ===== layout keybinds =====
# bindsym $mod+w layout tabbed # default, would put all windows of the same container into tabs
bindsym $mod+w splitv ; layout tabbed # puts the current window as the only tab, next opened windows join it in its spot
bindsym $mod+e layout toggle split # default, unchanged
bindsym $mod+Shift+w split none # undo splith/splitv/split+tab
# ===== bar =====
bar {
position bottom
# [...]
}
-
#!/bin/sh
# Press Logo+Alt+$K to turn $K into an inverted key.
# Key down and up events for $K will be swapped.
# Press Logo+Alt+$K again to return $K to a normal key.
# Setup (in sway config);
# dotool needs to be running for the virtual keyboard input to work
# exec dotoold
# usage: call this script from your sway config, with the key as the only argument:
# exec ~/.config/sway/dotool_key_invert w
S="$0"
K="$1"
A="$2"
I="$3"
# necessary due to https://github.com/swaywm/sway/issues/6961 and our use of --input-device
swaymsg seat '*' keyboard_grouping none
setup() {
# unbind the key
swaymsg -- unbindsym "$K"
"$(dirname "$S")/dotool_other_keyboards" "$S" "$K" un
# release the key to avoid holding it down forever
echo "keyup $K" | dotoolc
# bind the combination to `seton`
swaymsg -- bindsym "Mod1+Mod4+$K" exec "'$S' '$K' on"
}
seton() {
# bind the key
"$(dirname "$S")/dotool_other_keyboards" "$S" "$K" bd
# start holding down the key
echo "keydown $K" | dotoolc
# bind the combination to `setup`
swaymsg -- bindsym "Mod1+Mod4+$K" exec "'$S' '$K' off"
}
case "$A" in
bd) swaymsg -- bindsym --no-repeat --input-device="$I" "$K" exec "echo 'keyup $K' | dotoolc";
swaymsg -- bindsym --release --input-device="$I" "$K" exec "echo 'keydown $K' | dotoolc";;
un) swaymsg -- unbindsym --no-repeat --input-device="$I" "$K";
swaymsg -- unbindsym --release --input-device="$I" "$K";;
on) seton;;
*) setup;;
esac
-
#!/bin/sh
# Press Logo+Alt+Ctrl+$K to turn $K into a toggle key.
# Pressing $K then alternates key down and up events.
# Press Logo+Alt+Ctrl+$K again to return $K to a normal key.
# Setup (in sway config);
# dotool needs to be running for the virtual keyboard input to work
# exec dotoold
# usage: call this script from your sway config, with the key as the only argument:
# exec ~/.config/sway/dotool_key_toggle w
S="$0"
K="$1"
A="$2"
I="$3"
# necessary due to https://github.com/swaywm/sway/issues/6961 and our use of --input-device
swaymsg seat '*' keyboard_grouping none
keyup() { echo "keyup $K" | dotoolc; }
keydn() { echo "keydown $K" | dotoolc; }
thenup() { swaymsg -- bindsym --input-device="$I" "$K" exec "'$S' '$K' up '$I'"; }
thendn() { swaymsg -- bindsym --input-device="$I" "$K" exec "'$S' '$K' dn '$I'"; }
setup() {
# unbind the key
swaymsg -- unbindsym "$K"
"$(dirname "$S")/dotool_other_keyboards" "$S" "$K" un
# release the key to avoid holding it down forever
keyup
# bind the combination to `seton`
swaymsg -- bindsym "Mod1+Mod4+Ctrl+$K" exec "'$S' '$K' on"
}
seton() {
# bind the key
"$(dirname "$S")/dotool_other_keyboards" "$S" "$K" bd
# bind the combination to `setup`
swaymsg -- bindsym "Mod1+Mod4+Ctrl+$K" exec "'$S' '$K' off"
}
case "$A" in
bd) thendn;;
up) keyup; thendn;;
dn) keydn; thenup;;
un) swaymsg -- unbindsym --input-device="$I" "$K";;
on) seton;;
*) setup;;
esac
-
#!/bin/bash
swaymsg -t get_inputs -r | jq -r \
'.[] | select((.type == "keyboard") and (.identifier | contains("dotool") | not)) | .identifier' | \
xargs -d '\n' -n 1 -- "$@"
-
#!/bin/sh
# mark this file as executable,
# then change your sway config (.config/sway/)
# by replacing swaylock with this script:
#
# [...]
# bindsym $mod+Shift+s exec ~/.config/sway/swaylock_mark
# [...]
swayidle -w timeout 2 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' &
swaylock --color 000000
kill $(jobs -p)
-
#!/bin/bash
# mark this file as executable,
# then change your sway config (.config/sway/):
#
# [...]
# bar {
# [...]
#
# # When the status_command prints a new line to stdout, swaybar updates.
# status_command ~/.config/sway/swaystatus_mark
#
# [...]
# }
# [...]
while true; do
BatteryStatus="$(upower -i /org/freedesktop/UPower/devices/battery_BAT0)"
echo "$BatteryStatus" >&2
Perc="$(echo "$BatteryStatus" | grep -i 'percentage' | grep -ioE '\-?[01-9,.]+%')"
Watt="$(echo "$BatteryStatus" | grep -i 'energy-rate' | grep -ioE '\-?[01-9,.]+ ?W' | grep -ioE '\-?[01-9]+' | head -n 1)"
Remaining="$(echo "$BatteryStatus" | grep -i 'time to empty' | grep -ioE '\-?[01-9,.]+.*')"
Time="$(date +'%H:%M:%S | %F')"
printf '%s, %sW → %s | %s \n' "$Perc" "$Watt" "$Remaining" "$Time"
snooze -H '*' -M '*' -S '/5' || sleep 5
done