Add wofi-bluetooth
This commit is contained in:
parent
8c940ee2c4
commit
80e36930da
5 changed files with 105 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ in
|
|||
./gammastep.nix
|
||||
./waybar.nix
|
||||
./wofi.nix
|
||||
./wofi-bluetooth.nix
|
||||
./yubikey-touch-detector.nix
|
||||
];
|
||||
} // (lib.mkIf nixosConfig.jalr.gui.enable {
|
||||
|
|
|
|||
5
home-manager/modules/sway/wofi-bluetooth.nix
Normal file
5
home-manager/modules/sway/wofi-bluetooth.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ nixosConfig, lib, pkgs, ... }:
|
||||
|
||||
lib.mkIf nixosConfig.jalr.bluetooth.enable {
|
||||
home.packages = [ pkgs.wofi-bluetooth ];
|
||||
}
|
||||
|
|
@ -16,4 +16,5 @@ in
|
|||
jalr = prev.recurseIntoAttrs {
|
||||
contact = callPackage ./contact-page { };
|
||||
};
|
||||
wofi-bluetooth = callPackage ./wofi-bluetooth/wofi-bluetooth.nix { };
|
||||
}
|
||||
|
|
|
|||
30
pkgs/wofi-bluetooth/wofi-bluetooth.nix
Normal file
30
pkgs/wofi-bluetooth/wofi-bluetooth.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, makeWrapper
|
||||
, bluez
|
||||
, wofi
|
||||
, rofi-bluetooth
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "wofi-bluetooth";
|
||||
version = rofi-bluetooth.version;
|
||||
src = rofi-bluetooth.src;
|
||||
patches = [
|
||||
./wofi-bluetooth.patch
|
||||
];
|
||||
buildInputs = [ wofi ];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -D --target-directory=$out/bin/ ./rofi-bluetooth
|
||||
|
||||
mv $out/bin/rofi-bluetooth $out/bin/wofi-bluetooth
|
||||
|
||||
wrapProgram $out/bin/wofi-bluetooth \
|
||||
--prefix PATH ":" ${lib.makeBinPath [ bluez wofi ] }
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
68
pkgs/wofi-bluetooth/wofi-bluetooth.patch
Normal file
68
pkgs/wofi-bluetooth/wofi-bluetooth.patch
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
--- a/rofi-bluetooth
|
||||
+++ b/rofi-bluetooth
|
||||
@@ -7,14 +7,14 @@
|
||||
#
|
||||
# Author: Nick Clyde (clydedroid)
|
||||
#
|
||||
-# A script that generates a rofi menu that uses bluetoothctl to
|
||||
+# A script that generates a wofi menu that uses bluetoothctl to
|
||||
# connect to bluetooth devices and display status info.
|
||||
#
|
||||
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
|
||||
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
|
||||
#
|
||||
# Depends on:
|
||||
-# Arch repositories: rofi, bluez-utils (contains bluetoothctl)
|
||||
+# Arch repositories: wofi, bluez-utils (contains bluetoothctl)
|
||||
|
||||
# Constants
|
||||
divider="---------"
|
||||
@@ -231,8 +231,8 @@
|
||||
trusted=$(device_trusted "$mac")
|
||||
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
|
||||
|
||||
- # Open rofi menu, read chosen option
|
||||
- chosen="$(echo -e "$options" | $rofi_command "$device_name")"
|
||||
+ # Open wofi menu, read chosen option
|
||||
+ chosen="$(echo -e "$options" | $wofi_command "$device_name")"
|
||||
|
||||
# Match chosen option to command
|
||||
case "$chosen" in
|
||||
@@ -254,7 +254,7 @@
|
||||
esac
|
||||
}
|
||||
|
||||
-# Opens a rofi menu with current bluetooth status and options to connect
|
||||
+# Opens a wofi menu with current bluetooth status and options to connect
|
||||
show_menu() {
|
||||
# Get menu options
|
||||
if power_on; then
|
||||
@@ -269,15 +269,16 @@
|
||||
pairable=$(pairable_on)
|
||||
discoverable=$(discoverable_on)
|
||||
|
||||
- # Options passed to rofi
|
||||
+ # Options passed to wofi
|
||||
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
|
||||
else
|
||||
power="Power: off"
|
||||
options="$power\nExit"
|
||||
fi
|
||||
|
||||
- # Open rofi menu, read chosen option
|
||||
- chosen="$(echo -e "$options" | $rofi_command "Bluetooth")"
|
||||
+ lines="$(echo -e "$options" | wc -l)"
|
||||
+ # Open wofi menu, read chosen option
|
||||
+ chosen="$(echo -e "$options" | $wofi_command "Bluetooth" -L "$lines")"
|
||||
|
||||
# Match chosen option to command
|
||||
case "$chosen" in
|
||||
@@ -305,7 +306,7 @@
|
||||
}
|
||||
|
||||
# Rofi command to pipe into, can add any options here
|
||||
-rofi_command="rofi -dmenu $* -p"
|
||||
+wofi_command="wofi -d -i -p"
|
||||
|
||||
case "$1" in
|
||||
--status)
|
||||
Loading…
Add table
Add a link
Reference in a new issue