making rofi work a lil better

This commit is contained in:
Chris Cochrun 2021-09-27 17:13:21 -05:00
parent 9daaa96d74
commit 38e0f2f923
14 changed files with 156 additions and 79 deletions

@ -1 +1 @@
Subproject commit 0fb85341916b6de1c5cd6ddf3e8472292a93a303 Subproject commit 048cf41e0aa5a391948d62e6168d6e54279cf627

View file

@ -8,7 +8,7 @@
(local beautiful (require "beautiful")) (local beautiful (require "beautiful"))
(local xresources (require "beautiful.xresources")) (local xresources (require "beautiful.xresources"))
;; Notification library ;; Notification library
(local naughty (require "naughty")) ;; (local naughty (require "naughty"))
(local menubar (require "menubar")) (local menubar (require "menubar"))
;; Enable hotkeys help widget for VIM and other apps ;; Enable hotkeys help widget for VIM and other apps
;; when client with a matching name is opened: ;; when client with a matching name is opened:
@ -20,27 +20,27 @@
;; my splits ;; my splits
(local clientrules (require "rules")) (local clientrules (require "rules"))
(local keybindings (require "keybindings")) (local keybindings (require "keybindings"))
(local notifications (require "notifications")) ;; (local notifications (require "notifications"))
;; Error handling ;; Error handling
;; Check if awesome encountered an error during startup and fall back to ;; Check if awesome encountered an error during startup and fall back to
;; another config (This code will only ever execute for the fallback config) ;; another config (This code will only ever execute for the fallback config)
(when awesome.startup_errors ;; (when awesome.startup_errors
(naughty.notify {:preset naughty.config.presets.critical ;; (naughty.notify {:preset naughty.config.presets.critical
:title "Oops, there were errors during startup!" ;; :title "Oops, there were errors during startup!"
:text awesome.startup_errors})) ;; :text awesome.startup_errors}))
;; Handle runtime errors after startup ;; Handle runtime errors after startup
(do ;; (do
(var in_error false) ;; (var in_error false)
(awesome.connect_signal "debug::error" (fn [err] ;; (awesome.connect_signal "debug::error" (fn [err]
;; Make sure we don't go into an endless error loop ;; ;; Make sure we don't go into an endless error loop
(when (not in_error) ;; (when (not in_error)
(set in_error true) ;; (set in_error true)
(naughty.notify {:preset naughty.config.presets.critical ;; (naughty.notify {:preset naughty.config.presets.critical
:title "Oops, an error happened!" ;; :title "Oops, an error happened!"
:text (tostring err)}) ;; :text (tostring err)})
(set in_error false))))) ;; (set in_error false)))))
@ -616,18 +616,18 @@
;; Rules ;; Rules
(ruled.client.append_rules clientrules) (ruled.client.append_rules clientrules)
(ruled.notification.connect_signal ;; (ruled.notification.connect_signal
"request::rules" ;; "request::rules"
(fn [] ;; (fn []
(ruled.notification.append_rules notifications ;; (ruled.notification.append_rules notifications
;; { ;; ;; {
;; :rule { } ;; ;; :rule { }
;; :properties { ;; ;; :properties {
;; :border-width 0 ;; ;; :border-width 0
;; :border_color "#000000" ;; ;; :border_color "#000000"
;; :opacity 0.9 ;; ;; :opacity 0.9
;; :shape gears.shape.rounded_rect}} ;; ;; :shape gears.shape.rounded_rect}}
))) ;; )))
;; Signals ;; Signals
;; Signal function to execute when a new client appears. ;; Signal function to execute when a new client appears.
@ -688,14 +688,15 @@
(awful.screen.focus 1) (awful.screen.focus 1)
(awful.spawn "picom --experimental-backend") (awful.spawn.once "picom --experimental-backend")
(awful.spawn "/usr/lib/polkit-kde-authentication-agent-1") (awful.spawn.once "/usr/lib/polkit-kde-authentication-agent-1")
(awful.spawn "feh --bg-fill /usr/share/wallpapers/Flow/contents/images/5120x2880.jpg") (awful.spawn.once "feh --bg-fill /usr/share/wallpapers/Flow/contents/images/5120x2880.jpg")
(awful.spawn "caffeine") (awful.spawn.once "caffeine")
(awful.spawn "bluetoothctl power on") (awful.spawn.once "bluetoothctl power on")
(awful.spawn "nextcloud --background") (awful.spawn.once "nextcloud --background")
(awful.spawn "rbw-agent") (awful.spawn.once "rbw-agent")
(awful.spawn "jellyfin-mpv-shim") (awful.spawn.once "jellyfin-mpv-shim")
(awful.spawn "xset r rate 220 90") (awful.spawn.once "xset r rate 220 90")
(awful.spawn.once "autorandr -c")
(awful.spawn "autorandr -c") (awful.spawn.once "xcape -e 'Super_L=Super_L|Control_L|Escape'")
(awful.spawn.once "latte-dock")

View file

@ -176,6 +176,8 @@
;; rofi ;; rofi
(awful.key [] "Menu" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh")) (awful.key [] "Menu" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh"))
{:description "launch rofi" :group "launcher"}) {:description "launch rofi" :group "launcher"})
(awful.key [modkey ctrl] "Escape" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh"))
{:description "launch rofi" :group "launcher"})
(awful.key [modkey] "space" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh")) (awful.key [modkey] "space" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh"))
{:description "launch rofi" :group "launcher"}) {:description "launch rofi" :group "launcher"})
(awful.key [modkey] "w" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/windows.sh")) (awful.key [modkey] "w" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/windows.sh"))

View file

@ -1,12 +1,23 @@
(defwindow example (defwindow example
:monitor 0 :monitor 0
:geometry (geometry :x "0%" :geometry (geometry :x "0%"
:y "20px" :y "80px"
:width "90%" :width "20%"
:height "30px" :height "60px"
:anchor "top center") :anchor "top center")
:stacking "fg" :stacking "fg"
:reserve (struts :distance "40px" :side "top") :windowtype "dialog"
:windowtype "dock" :wm-ignore true
:wm-ignore false volslider)
"example content")
(deflisten volume
:initial "getvol"
'tail -F /tmp/vol')
(defwidget volslider []
(box :orientation "horizontal"
:halign "center"
volume
(scale :value volume
:min 0
:max 100)))

View file

@ -4,6 +4,7 @@ description = ""
# Directories to index. # Directories to index.
dirs = [ dirs = [
"~/dotfiles", "~/dotfiles",
"~/.dotfiles",
"~/org", "~/org",
"~/Downloads", "~/Downloads",
"~/Documents", "~/Documents",
@ -14,6 +15,8 @@ dirs = [
"~/nextcloud", "~/nextcloud",
"~/.dotemacs", "~/.dotemacs",
"~/.emacs.d", "~/.emacs.d",
"~/storage/tfc",
"~/storage/nextcloud",
] ]
Dirs = [ Dirs = [

View file

@ -21,11 +21,13 @@
((session-restore-prompt :always-restore))) ((session-restore-prompt :always-restore)))
(define-configuration (prompt-buffer) (define-configuration (prompt-buffer)
((default-modes (append '(vi-insert-mode ((default-modes
) %slot-default%)))) (append
'(vi-insert-mode)
%slot-default%))))
(define-configuration browser (define-configuration browser
((external-editor-program '("/usr/bin/emacsclient")))) ((external-editor-program '("/usr/bin/emacsclient"))))
;; Create a function to launch mpv with given url ;; Create a function to launch mpv with given url
(defun mpv (url) (defun mpv (url)
@ -34,32 +36,37 @@
;; Create a function to download videos with youtube-dl in alacritty ;; Create a function to download videos with youtube-dl in alacritty
(defun youtube-dl (url) (defun youtube-dl (url)
"Download videos and audio with youtube-dl in alacritty for feedback" "Download videos and audio with youtube-dl in alacritty for feedback"
(uiop:run-program (list "alacritty" "-e" "youtube-dl" "-o ~/Videos/%(title)s.%(ext)s" url))) (uiop:run-program
(list "alacritty" "-e" "youtube-dl" "-o ~/Videos/%(title)s.%(ext)s" url)))
;; Let's create a function to hint videos, convert the url to a sting, and play them in MPV ;; Let's create a function to hint videos, convert the url to a sting, and play them in MPV
(define-command hint-mpv (&key nyxt/web-mode::annotate-visible-only-p) (define-command hint-mpv (&key nyxt/web-mode::annotate-visible-only-p)
"Show a set of element hints, and copy the URL of the user inputted one." "Show a set of element hints, and copy the URL of the user inputted one."
(nyxt/web-mode:query-hints "Copy element URL" (nyxt/web-mode:query-hints "Copy element URL"
(lambda (nyxt/web-mode::result) (lambda (nyxt/web-mode::result)
;; this converts the url to a string to be used in mpv ;; this converts the url to a string to be used in mpv
(let* ((url (format nil "~a" (let*
(url (first nyxt/web-mode::result))))) ((url
;; here we take that string and pipe it into mpv (format nil "~a"
(mpv url))) (url (first nyxt/web-mode::result)))))
;; here we take that string and pipe it into mpv
(mpv url)))
:annotate-visible-only-p :annotate-visible-only-p
nyxt/web-mode::annotate-visible-only-p)) nyxt/web-mode::annotate-visible-only-p))
;; Let's create a function to hint videos, convert the url to a sting, and download with ytdl ;; Let's create a function to hint videos, convert the url to a sting, and download with ytdl
(define-command hint-ytdl (&key nyxt/web-mode::annotate-visible-only-p) (define-command hint-ytdl (&key nyxt/web-mode::annotate-visible-only-p)
"Show a set of element hints, and copy the URL of the user inputted one." "Show a set of element hints, and copy the URL of the user inputted one."
(nyxt/web-mode:query-hints "Copy element URL" (nyxt/web-mode:query-hints "Copy element URL"
(lambda (nyxt/web-mode::result) (lambda (nyxt/web-mode::result)
;; this converts the url to a string to be used in mpv ;; this converts the url to a string to be used in mpv
(let* ((url (format nil "~a" (let*
(url (first nyxt/web-mode::result))))) ((url
;; here we take that string and pipe it into mpv (format nil "~a"
(youtube-dl url))) (url (first nyxt/web-mode::result)))))
;; here we take that string and pipe it into mpv
(youtube-dl url)))
:annotate-visible-only-p :annotate-visible-only-p
nyxt/web-mode::annotate-visible-only-p)) nyxt/web-mode::annotate-visible-only-p))
@ -79,17 +86,20 @@
(define-mode chris-mode () (define-mode chris-mode ()
"Dummy mode for the custom key bindings in `*chris-keymap*'." "Dummy mode for the custom key bindings in `*chris-keymap*'."
((keymap-scheme (keymap:make-scheme ((keymap-scheme
scheme:vi-normal *chris-keymap*)) (keymap:make-scheme
scheme:vi-normal *chris-keymap*))
(visible-in-status-p nil))) (visible-in-status-p nil)))
(define-configuration buffer (define-configuration buffer
((default-modes (append '(vi-normal-mode ((default-modes
auto-mode (append
reduce-tracking-mode '(vi-normal-mode
force-https-mode auto-mode
chris-mode) reduce-tracking-mode
%slot-default%)))) force-https-mode
chris-mode)
%slot-default%))))
(define-configuration buffer (define-configuration buffer
((search-engines ((search-engines

View file

@ -13,6 +13,14 @@ configuration {
threads: 0; threads: 0;
scroll-method: 0; scroll-method: 0;
disable-history: false; disable-history: false;
kb-accept-entry: "Return";
kb-remove-to-eol: "Control-D";
kb-remove-char-back: "BackSpace";
kb-mode-complete: "Control-M";
kb-row-down: "Control-j";
kb-row-up: "Control-k";
kb-row-left: "Control-h";
kb-row-right: "Control-l";
} }
* { * {

View file

@ -8,4 +8,11 @@ else
#echo "this is not hidpi" #echo "this is not hidpi"
fi fi
rofi -no-lazy-grab -show emoji -modi emoji -theme launchers-git/"$style".rasi rofi -no-lazy-grab -show emoji -modi emoji -theme launchers-git/"$style".rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done

View file

@ -8,4 +8,10 @@ else
#echo "this is not hidpi" #echo "this is not hidpi"
fi fi
rofi -no-lazy-grab -show drun -modi drun -theme launchers-git/"$style".rasi rofi -no-lazy-grab -show drun -modi drun -theme launchers-git/"$style".rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done

View file

@ -8,4 +8,10 @@ else
#echo "this is not hidpi" #echo "this is not hidpi"
fi fi
rofi -no-lazy-grab -show run -modi run -theme launchers-git/"$style".rasi rofi -no-lazy-grab -show run -modi run -theme launchers-git/"$style".rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done

View file

@ -7,4 +7,10 @@ else
#echo "this is not hidpi" #echo "this is not hidpi"
fi fi
lolcate | rofi -dmenu -p "File Search:" -i -matching regex -theme ~/.config/rofi/launchers-git/$style-rbw.rasi | xargs -r0 xdg-open lolcate | rofi -dmenu -p "File Search:" -i -matching regex -theme ~/.config/rofi/launchers-git/$style-rbw.rasi | xargs -r0 xdg-open $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done

View file

@ -2,6 +2,7 @@
exec ydotoold & exec ydotoold &
exec libinput-gestures-setup start service & exec libinput-gestures-setup start service &
exec xcape -e 'Super_L=Super_L|Control_L|Escape'
sleep 2 sleep 2

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Check to see if firefox is running # Check to see if firefox is running
if [ $(pgrep -c qutebrowser) -gt 0 ]; then if pgrep -x qutebrowser > /dev/null; then
if [ $XDG_SESSION_TYPE = "x11" ]; then if [ $XDG_SESSION_TYPE = "x11" ]; then
#X11 #X11

View file

@ -24,7 +24,15 @@ list_passwords() {
passwords=$(rbw list) passwords=$(rbw list)
prompt='search for passwords...' prompt='search for passwords...'
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi) SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
# Ask whether pass, user or both are required # Ask whether pass, user or both are required
@ -34,7 +42,15 @@ options=("Password" \
"QR-Code" \ "QR-Code" \
"OTP") "OTP")
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="..." -theme ~/.config/rofi/launchers-git/$style.rasi) option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="..." -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
echo $option echo $option