From ff58229b230fa547cd73db4556bb9be65dcae1e7 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Tue, 14 Jul 2020 15:36:35 +0200 Subject: [PATCH] Add wofi support. --- Makefile | 1 + config/wofi/style.css | 26 ++++++++++++++++++++++++++ wofi_windows.sh | 10 ++++++++++ 3 files changed, 37 insertions(+) create mode 100644 config/wofi/style.css create mode 100755 wofi_windows.sh diff --git a/Makefile b/Makefile index cd5a05f..b3c6a13 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ FILES = bashrc bash_profile vimrc zshrc gitconfig screenrc commonshrc liquidprom config/khal config/vdirsyncer/config config/khard \ config/rofi-pass gdbinit notmuch-config \ config/fish tridactylrc config/sway/config config/mpv/mpv.conf \ + config/wofi \ $(wildcard sbt/0.13/*.sbt sbt/0.13/plugins/*.sbt) \ $(wildcard sbt/1.0/plugins/*.sbt) diff --git a/config/wofi/style.css b/config/wofi/style.css new file mode 100644 index 0000000..fed57a7 --- /dev/null +++ b/config/wofi/style.css @@ -0,0 +1,26 @@ +window { + margin: 0px; + border: 1px solid #666; + background-color: #222; + color: white; + font-family: "Fira Code"; +} + +#input { + padding: 5px; + border: none; + background-color: #333; + color: white; +} + +#inner-box, #input, #outer-box, #text { + margin: 5px; +} + +#scroll { + margin: 0px; +} + +#entry:selected { + background-color: #555; +} diff --git a/wofi_windows.sh b/wofi_windows.sh new file mode 100755 index 0000000..2681fe2 --- /dev/null +++ b/wofi_windows.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Get available windows +windows=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.type=="con"),select(.type=="floating_con")|(.id|tostring)+" "+.app_id+": "+.name') + +# Select window with rofi +selected=$(echo "$windows" | wofi --show dmenu -i | awk '{print $1}') + +# Tell sway to focus said window +swaymsg "[con_id=$selected]" focus