Marty Oehme
6ac552d3d5
Added a simple wayland configuration. Currently set up simple wayland configuration based on river window manager and waybar. Rivercarro is the layout manager, being the same in principle as rivertile, the default layout manager for river, only it comes with smart gaps (gaps turn off if there is only one window open) and monocle mode (give one window all space). Runs `keyd` in the background to replace the old `xcape` capslock switching (capslock is escape and if held control). Uses `swaybg` to set a wallpaper. Added powermenu and lockscreen scripts. Improved lockscreen script to detect and work for wayland. Moved old rofi mode 'powermenu' to more general powermenu script, which works with any rofi-like selector (dmenu, bemenu, wofi, etc.) Loses some of its design quality but since it was wonky anyway, and I rarely see the menu, we could repurpose its functionality for a more general powermenu concept. Currently hardcoded for `bemenu` but can be easily swapped and possibly even extended back to rofi. Fixed file upload link sharing to clipboard. Updated rofi-pass to pass-pick. Made rofi-pass universal and less integrated to rofi - that's also the reason for the name change. `pass-pick` works with rofi (default), bemenu or dmenu. In theory it should also work with any other picker that contains a stdin listing function similar to dmenu. It has been definitely tested both on rofi and bemenu. The best user experience still reigns on rofi, where available keys are displayed on the picker and the keys themselves make the most sense. But all functions can be reached from bemenu as well, though the key mappings are more arbitrary and can not be changed as in rofi. The autofilling tool works with both xdotool and ydotool, so should work both on X11 and on Wayland. Ydotool ideally requires its daemon to be running, otherwise some of the typing may get gut off. Otherwise no change should be necessary. Updated qutebrowser open_download for bemenu. Updated download opening script to work with both rofi and bemenu. Prefers original rofi implementation but works with both, and can be set to use a custom dmenu-like file picker as well. Add brightnessctl and removed custom audio / brightness scripts since they became unnecessary. Updated bootstrap script to include system files: With `keyd` taking its configuration from the `/etc` directory and not home, a second stow stage was necessary. These stow files are in a module called `system-packages` inside the top-level `bootstrap` stow package. They will not be installed by the default dotfile stow invocation but have been integrated as an extra step into the install script. Installing this module requires sudo privileges! Switched vifm überzug to sixel graphics rendering. überzug relies on X11 functionality to work, while sixel does not. Unfortunately, alacritty does not work with sixel graphics yet, only foot does (somewhat). Waybar currently runs the gruvbox dark soft color scheme. Added the old polybar archupdates script to waybar and extended it to output json format with additional metadata that waybar can read. Can still output the old plaintext format that polybar expects. Added a wireguard connection to waybar,shows if currently connected to either a wireguard or tun VPN service. If so, shows an icon in the waybar - that can be hovered over to show the full assigned IP address. Added an upcoming event display to waybar, a simple event indicator to show upcoming events on the calendar, on hovering over it the tooltip lists all upcoming events. Added `screenshot` script to take simple screenshots and rectangle region shots of the current output. Can be invoked through the river shortcut PrintScr: `PrintScr` - Fullscreen screenshot `Mod+PrintScr` - Region screenshot `Shift+PrintScr` - Fullscreen screenshot and file upload `Mod+Shift+PrintScr` - Region screenshot and file upload Extended `sharefile` to take paths through stdin and make use of `fd` if it is found on the system.
143 lines
3.3 KiB
Bash
Executable file
143 lines
3.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# nmcli WireGuard abstraction layer for use with my waybar module and rofi custom menu script
|
|
#
|
|
# requires nmcli on your path
|
|
# install to the same directory as wireguard-rofi.sh
|
|
#
|
|
# usage: ./wireguard.sh [menu|toggle NAME]
|
|
# no argument: print current connections
|
|
# json: print waybar-ready json output
|
|
# menu: print all connections
|
|
# toggle NAME: toggle connection NAME
|
|
|
|
if ! command -v nmcli >/dev/null 2>&1; then
|
|
echo "err: nmcli not found"
|
|
exit 1
|
|
fi
|
|
|
|
nargs=$#
|
|
showmenu="no"
|
|
dotoggle="no"
|
|
printjson="no"
|
|
if [[ $nargs == 1 ]]; then
|
|
if [[ $1 == "menu" ]]; then
|
|
showmenu="yes"
|
|
elif [[ $1 == "json" ]]; then
|
|
printjson="yes"
|
|
fi
|
|
elif [[ $nargs == 2 ]]; then
|
|
if [[ $1 == "toggle" ]]; then
|
|
dotoggle="yes"
|
|
conn="$2"
|
|
fi
|
|
fi
|
|
|
|
nmclicmd="nmcli connection"
|
|
wgconns="$nmclicmd show"
|
|
wgactive="$wgconns --active"
|
|
|
|
connected=()
|
|
available=()
|
|
|
|
function print_as_json() {
|
|
text="嬨" # only prints a single icon when connected
|
|
# text="${1}" # use this line to show all output in text
|
|
alt="${1}"
|
|
tooltip="${1}"
|
|
[ -n "$1" ] && class="connected" || class="disconnected"
|
|
printf "{\"text\": \"%s\", \"alt\": \"%s\", \"tooltip\": \"%s\", \"class\": \"%s\"}" \
|
|
"$text" \
|
|
"$alt" \
|
|
"$tooltip" \
|
|
"$class"
|
|
}
|
|
|
|
function get_conns {
|
|
while read -r name _ type device; do
|
|
if [[ $type != "wireguard" && ($type != "tun" || $device != "proton0") ]]; then
|
|
continue
|
|
fi
|
|
|
|
if [[ $device != "--" ]]; then
|
|
while read -r key value; do
|
|
if [[ $key != "ipv4.addresses:" ]]; then
|
|
continue
|
|
fi
|
|
connected+=("$name: $value")
|
|
done < <($wgconns "$name")
|
|
else
|
|
available+=("$name")
|
|
fi
|
|
done < <($1)
|
|
}
|
|
|
|
function print_conns {
|
|
local first="yes"
|
|
local array_print="$1[@]"
|
|
local array_print=("${!array_print}")
|
|
if [[ $2 == "list" ]]; then
|
|
for c in "${array_print[@]}"; do
|
|
output="$1: $c"
|
|
done
|
|
else
|
|
output=""
|
|
for c in "${array_print[@]}"; do
|
|
if [[ "$first" != "yes" ]]; then
|
|
output+=" | "
|
|
fi
|
|
output+="$c"
|
|
first="no"
|
|
done
|
|
fi
|
|
if [[ "$printjson" == "yes" ]]; then
|
|
print_as_json "$output"
|
|
else
|
|
echo "$output"
|
|
fi
|
|
}
|
|
|
|
function array_contains {
|
|
local array_has="$1[@]"
|
|
local array_has=("${!array_has}")
|
|
local element="$2"
|
|
for e in "${array_has[@]}"; do
|
|
if [[ "$e" == *"$element"* ]]; then
|
|
echo "yes"
|
|
return
|
|
fi
|
|
done
|
|
echo "no"
|
|
}
|
|
|
|
if [[ $nargs == 0 ]]; then
|
|
get_conns "$wgactive"
|
|
print_conns connected
|
|
|
|
elif [[ $showmenu == "yes" ]]; then
|
|
get_conns "$wgconns"
|
|
print_conns connected "list"
|
|
print_conns available "list"
|
|
|
|
elif [[ $printjson == "yes" ]]; then
|
|
get_conns "$wgactive"
|
|
print_conns connected
|
|
|
|
elif
|
|
[[ $dotoggle == "yes" ]]
|
|
then
|
|
get_conns "$wgconns"
|
|
|
|
if [[ "$(array_contains connected "$conn")" == "yes" ]]; then
|
|
$nmclicmd down "$conn"
|
|
elif [[ "$(array_contains available "$conn")" == "yes" ]]; then
|
|
$nmclicmd up "$conn"
|
|
else
|
|
echo "err: connection not found"
|
|
exit 1
|
|
fi
|
|
|
|
else
|
|
echo "err: wrong args"
|
|
exit 1
|
|
fi
|