Switch to rofi.

This commit is contained in:
Bartek Stalewski 2023-02-22 16:19:33 +01:00
parent e8e2fb2fb5
commit 122f54d3ae
6 changed files with 20 additions and 19 deletions

View File

@ -1,9 +1,9 @@
#!/bin/sh
div="----------"
div="---"
set_output() {
sel_sink=$(printf "$sinks\\n$div\\nback\\nexit" | dmenu -c -l 10 -i)
sel_sink=$(printf "$sinks\\n$div\\nback\\n$div\\nexit" | rofi -dmenu -i -p "select output device")
case "$sel_sink" in
back) show_current ;;
exit) exit ;;
@ -14,7 +14,7 @@ set_output() {
}
set_input() {
sel_source=$(printf "$sources\\n$div\\nBluetooth profile\\n$div\\nback\\nexit" | dmenu -c -l 10 -i)
sel_source=$(printf "$sources\\n$div\\nbluetooth profile\\n$div\\nback\\n$div\\nexit" | rofi -dmenu -i -p "select input device")
case "$sel_source" in
back) show_current ;;
exit) exit ;;
@ -29,7 +29,7 @@ set_bt_profile() {
bt_sink=$(pactl list cards | awk -F'"' '/device.name.*bluez/ {print $2}')
[ -z "${bt_sink}" ] &&
{ notify-send -t 2000 -u critical "ﳌ no headphones connected"; exit; }
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | dmenu -c -l 5 -i)
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | rofi -dmenu -i -p "select bluettoth profile")
case "$profile_chosen" in
back) show_current ;;
exit) exit ;;
@ -44,15 +44,15 @@ set_bt_profile() {
show_current() {
def_snk=$(pactl list | grep -A 1 "Name: $(pactl get-default-sink)\$" | awk -F': ' '/Description: / {print $2}')
def_src=$(pactl list | grep -A 1 "Name: $(pactl get-default-source)\$" | awk -F': ' '/Description: / {print $2}')
chosen=$(printf "Output: $def_snk\\nInput: $def_src" | dmenu -c -l 2)
chosen=$(printf "output: $def_snk\\ninput: $def_src" | rofi -dmenu -i -p "current audio devices")
if [ "$1" = "no_switch" ]; then
case "$chosen" in
*) notify-send -t 2000 -u critical "婢 no device to switch" ;;
esac
else
case "$chosen" in
Output*) set_output ;;
Input*) set_input ;;
output*) set_output ;;
input*) set_input ;;
esac
fi
}

View File

@ -9,7 +9,7 @@
#
# Constants
divider="----------"
div="---"
goback="back"
# Checks if bluetooth controller is powered on
@ -215,13 +215,13 @@ device_menu() {
fi
paired=$(device_paired $mac)
trusted=$(device_trusted $mac)
options="$connected\n$paired\n$trusted\n$divider\n$goback\nexit"
options="$connected\n$paired\n$trusted\n$div\n$goback\n$div\nexit"
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
# Match chosen option to command
case $chosen in
"" | $divider)
"" | $div)
echo "no option chosen."
;;
$connected)
@ -253,7 +253,7 @@ show_menu() {
pairable=$(pairable_on)
discoverable=$(discoverable_on)
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nexit"
options="$devices\n$div\n$power\n$scan\n$pairable\n$discoverable\nexit"
else
power="power: off"
options="$power\nexit"
@ -263,7 +263,7 @@ show_menu() {
# Match chosen option to command
case $chosen in
"" | $divider)
"" | $div)
echo "No option chosen."
;;
$power)
@ -287,7 +287,7 @@ show_menu() {
}
# command to pipe into, can add any options here
rofi_command="dmenu -c -l 20 -i -p"
rofi_command="rofi -dmenu -i -p"
case "$1" in
--status)

View File

@ -1,6 +1,6 @@
#!/bin/sh
chosen=$(cut -d ';' -f1 $XDG_CONFIG_HOME/qtile/chars/* | dmenu -l 30 -i | sed "s/ .*//")
chosen=$(cut -d ';' -f1 $XDG_CONFIG_HOME/qtile/chars/* | rofi -dmenu -i -p "select character to copy" | sed "s/ .*//")
[ -z "$chosen" ] && exit
if [ -n "$1" ]; then

View File

@ -4,7 +4,7 @@
mkdir -p ~/.config ~/.local/bin
# link config
for i in foot gtk-3.0 kanshi neofetch qtile zathura; do
for i in foot gtk-3.0 kanshi neofetch qtile rofi zathura; do
rm -rf ~/.config/${i}
ln -sf $(pwd)/${i} ~/.config
done

View File

@ -31,7 +31,7 @@ groups = [
Group("0", label="\uf2bb", matches=[Match(wm_class=["workfx"])]),
ScratchPad("scratchpad", [
DropDown(
"spterm", "sh -c 'BROWSER=firefox st'",
"spterm", "foot",
on_focus_lost_hide=False,
width=0.40,
height=0.50,
@ -76,9 +76,9 @@ keys = [
Key([mod, "shift"], "e", lazy.group["scratchpad"].dropdown_toggle('spwork')),
Key([mod, "shift"], "i", lazy.spawn("grim")),
Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work foot -o url.launch=workfx\ \${url}'")),
Key([mod, "control"], "a", lazy.spawn("dmenu-audio")),
Key([mod, "control"], "b", lazy.spawn("dmenu-bluetooth")),
Key([mod, "control"], "e", lazy.spawn("dmenu-chars")),
Key([mod, "control"], "a", lazy.spawn("selector-audio")),
Key([mod, "control"], "b", lazy.spawn("selector-bluetooth")),
Key([mod, "control"], "e", lazy.spawn("selector-chars")),
# WM control
Key([mod], "f", lazy.window.toggle_floating()),
Key([mod], "q", lazy.window.kill()),

View File

@ -0,0 +1 @@
@theme "/usr/local/share/rofi/themes/glue_pro_blue.rasi"