Fix app launcher, playing with rofi in other ways

This commit is contained in:
Daniel Flanagan 2017-04-27 17:22:57 -05:00
parent 2df1a4e92f
commit 9bfc834685
8 changed files with 52 additions and 12 deletions

6
apps/rofi/config Normal file
View file

@ -0,0 +1,6 @@
rofi.lines: 10
rofi.width: 25
rofi.matching: fuzzy
rofi.separator-style: none
rofi.hide-scrollbar: true
rofi.line-margin: 5

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
LAUNCHER_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^-]*\).*$/\1/p' | head -n 1)
LAUNCHER_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:.*\-\([^-]*\)$/\1/p' | head -n 1)
HIGHLIGHT_COLOR=$(xrdb -query | sed -ne 's/.*color1*:\s*\(.*\)$/\1/p' | head -n 1)
BACKGROUND_COLOR=$(xrdb -query | sed -ne 's/.*background:\s*\(.*\)$/\1/p' | head -n 1)
FOREGROUND_COLOR=$(xrdb -query | sed -ne 's/.*foreground:\s*\(.*\)$/\1/p' | head -n 1)
rofi -show run -font "$LAUNCHER_FONT $LAUNCHER_FONT_SIZE" -lines 16 -width 25 -padding 8 -fuzzy -bw "$BORDER_WIDTH" -color-enabled -color-window "$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_COLOR","$BACKGROUND_COLOR" -color-normal "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$FOREGROUND_COLOR" -separator-style none -hide-scrollbar

View file

@ -3,7 +3,7 @@ no-dnd-shadow = true;
no-dock-shadow = false;
clearshadow = true;
shadow-radius = 7;
shadow-offset-x = -12;
shadow-offset-x = -10;
shadow-offset-y = -7;
shadow-opacity = 1.0;
shadow-red = 0.0;
@ -22,6 +22,9 @@ fade-in-step = 0.06;
fade-out-step = 0.06;
alpha-step = 0.1;
inactive-dim = 0.5;
focus-exclude = [
"n:e:rofi"
]
mark-wmwin-focused = true;
mark-ovredir-focused = false;

View file

@ -166,7 +166,7 @@ super + shift + Return
# spawn the app launcher
super + space
"$DOTFILES_PATH/de/app-launcher"
"$DOTFILES_PATH/scripts/bin/app-launcher" -modi run -show run
# lock the desktop
super + ctrl + shift + l
@ -212,6 +212,10 @@ XF86AudioPrev
{_,shift + }XF86MonBrightnessDown
xbacklight - 10
# open rofi as a window switcher
super + w
"$DOTFILES_PATH/scripts/bin/app-launcher" -modi window,run -show window
# close the current application
super + c
bspc node -c

19
scripts/bin/app-launcher Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
source "$DOTFILES_PATH/de/bar/bar.bash" --just-vars
LAUNCHER_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^-]*\).*$/\1/p' | head -n 1)
LAUNCHER_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:.*\-\([^-]*\)$/\1/p' | head -n 1)
HIGHLIGHT_COLOR=$(xrdb -query | sed -ne 's/.*color4*:\s*\(.*\)$/\1/p' | head -n 1)
HIGHLIGHT_FOREGROUND_COLOR=$(xrdb -query | sed -ne 's/.*background:\s*\(.*\)$/\1/p' | head -n 1)
BACKGROUND_COLOR=$(xrdb -query | sed -ne 's/.*background:\s*\(.*\)$/\1/p' | head -n 1)
FOREGROUND_COLOR=$(xrdb -query | sed -ne 's/.*foreground:\s*\(.*\)$/\1/p' | head -n 1)
for i in "$@";
do
params=" $params $i"
done
echo "$params" >> "$HOME/.sxhkd.log"
rofi -font "$LAUNCHER_FONT $LAUNCHER_FONT_SIZE" -padding $GAP -bw "$BORDER_WIDTH" -color-enabled -color-window "$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR" -color-normal "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" -color-normal "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" -color-active "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" -color-urgent "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" -monitor -4 $params

14
scripts/bin/wifi-list Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# wip
SSID=$(nmcli device wifi | tail -n +2 | "$DOTFILES_PATH/scripts/bin/app-launcher" -i --display-mode "wifi" -p "wifi:" -dmenu -width 50 | sed -re 's/^\s*\*//' | awk '{print $1}')
RESULT=$(nmcli device wifi connect "$SSID")
if echo "$RESULT" | grep -q -E '^Error: Connection activation failed: \(7\)'; then
# TODO: currently, the first attempt to connect fails and then we wait for
# a rescan before trying again
sleep 10
PASSWORD=$(: | "$DOTFILES_PATH/scripts/bin/app-launcher" --display-mode "Password:" -dmenu -p "wifi_password:" -width 50)
nmcli device wifi connect "$SSID" password "$PASSWORD"
fi

3
setup
View file

@ -64,6 +64,9 @@ links=(
# terminal emulator
"$dfp/apps/alacritty/" "$XDG_CONFIG_HOME/alacritty"
# rofi config
"$dfp/apps/rofi/config" "$XDG_CONFIG_HOME/rofi/config"
# bar files
"$dfp/de/bar/polybar-config" "$XDG_CONFIG_HOME/polybar/config"

View file

@ -4,7 +4,7 @@ export GOPATH="$HOME/.go"
# PATH=$PATH:$APPENDED_PATH
PATH=$PATH:"$GOPATH/bin"
PATH=$PATH:"$DOTFILES_PATH/bin"
PATH=$PATH:"$DOTFILES_PATH/scripts/bin"
if [ -d "$HOME/.bin" ]; then
PATH=$PATH:"$HOME/.bin"