added general purpose file browser with proper launcher
This commit is contained in:
		
							parent
							
								
									02a4409e8a
								
							
						
					
					
						commit
						7c18316e4f
					
				
							
								
								
									
										49
									
								
								bin/rofi-files
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										49
									
								
								bin/rofi-files
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# getting focused pwd
 | 
				
			||||||
 | 
					PID=$(xdotool getwindowfocus getwindowpid)
 | 
				
			||||||
 | 
					child=$PID
 | 
				
			||||||
 | 
					children=()
 | 
				
			||||||
 | 
					while [ -n "$child" ] ; do
 | 
				
			||||||
 | 
					    children+=($child)
 | 
				
			||||||
 | 
					    child=$(pgrep -P $child)
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					last_ps=$(ps ${children[-1]} | grep -v PID | awk '{print $5}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "$last_ps" == "tmux" ] ; then
 | 
				
			||||||
 | 
					    current_pane=$(tmux list-panes | grep '(active)' | grep -o '^[0-9]')
 | 
				
			||||||
 | 
					    cwd=$(tmux display-message -p -t $current_pane -F '#{pane_current_path}')
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    cwd=$(readlink -e /proc/${children[-2]}/cwd)
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# change to the directory
 | 
				
			||||||
 | 
					cd $cwd
 | 
				
			||||||
 | 
					files=$(find * -type f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					selection=$(echo "$files" | rofi-dmenu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# exit on quit
 | 
				
			||||||
 | 
					if [ -z "$selection" ] ; then
 | 
				
			||||||
 | 
					    exit 0
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# grab extension
 | 
				
			||||||
 | 
					extension=$(echo "$selection" | grep -o '.\([a-zA-Z]\+\)$')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# get proper opener
 | 
				
			||||||
 | 
					case "$extension" in
 | 
				
			||||||
 | 
					    '.pdf')     prg="zathura" ;;
 | 
				
			||||||
 | 
					    '.md')      prg="vim" ;;
 | 
				
			||||||
 | 
					    '.png')     prg="feh" ;;
 | 
				
			||||||
 | 
					    '.jpg')     prg="feh" ;;
 | 
				
			||||||
 | 
					    '.jpeg')    prg="feh" ;;
 | 
				
			||||||
 | 
					        *)      prg="xdg-open" ;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ "$1" == '-S' && "$prg" =~ [feh|zathura] ]] ; then
 | 
				
			||||||
 | 
					    swallow $prg "$selection"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    $prg "$selection"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
@ -119,6 +119,7 @@ function M.setup(c)
 | 
				
			|||||||
  overdue = c.overdue or 'OVERDUE'
 | 
					  overdue = c.overdue or 'OVERDUE'
 | 
				
			||||||
  overdue_hi = c.overdue_hi or 'Error'
 | 
					  overdue_hi = c.overdue_hi or 'Error'
 | 
				
			||||||
  date_hi = c.date_hi or 'Conceal'
 | 
					  date_hi = c.date_hi or 'Conceal'
 | 
				
			||||||
 | 
					  week_hi = c.week_hi or 'Question'
 | 
				
			||||||
  pattern_start = c.pattern_start or '<'
 | 
					  pattern_start = c.pattern_start or '<'
 | 
				
			||||||
  pattern_end = c.pattern_end or '>'
 | 
					  pattern_end = c.pattern_end or '>'
 | 
				
			||||||
  date_pattern = c.date_pattern or '(%d%d)%-(%d%d)'
 | 
					  date_pattern = c.date_pattern or '(%d%d)%-(%d%d)'
 | 
				
			||||||
@ -174,8 +175,10 @@ local function draw_due(due, buf, key)
 | 
				
			|||||||
      parsed = { today, today_hi }
 | 
					      parsed = { today, today_hi }
 | 
				
			||||||
    elseif due < 86400 then
 | 
					    elseif due < 86400 then
 | 
				
			||||||
      parsed = { parseDue(due), today_hi }
 | 
					      parsed = { parseDue(due), today_hi }
 | 
				
			||||||
    else
 | 
					    elseif due < 604800 then
 | 
				
			||||||
      parsed = { parseDue(due), due_hi }
 | 
					      parsed = { parseDue(due), due_hi }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      parsed = { parseDue(due), week_hi }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    parsed = { overdue, overdue_hi }
 | 
					    parsed = { overdue, overdue_hi }
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,7 @@ vim.cmd('packadd vimwiki')
 | 
				
			|||||||
require('due_nvim').setup {
 | 
					require('due_nvim').setup {
 | 
				
			||||||
    ft = '*.md',
 | 
					    ft = '*.md',
 | 
				
			||||||
    date_hi = 'Comment',
 | 
					    date_hi = 'Comment',
 | 
				
			||||||
 | 
					    week_hi = 'Structure',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pattern_start = '<',
 | 
					    pattern_start = '<',
 | 
				
			||||||
    pattern_end = '>',
 | 
					    pattern_end = '>',
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit bbb6d4891009de7dab05ad8fc2d39f272d7a751c
 | 
					Subproject commit 94e3b0990017a42fa4581ea3d0bc08b897727d4d
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit a3f17d3baf70df58b9d3544ea30abe52a7a832c2
 | 
					Subproject commit 942fe5faef47b21241e970551eba407bc10d9547
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 23cc4bca2f586c8c2f7d2cb78bbbfec4b7361763
 | 
					Subproject commit a494378f6c106a97e39c62b493c14476f9f7de4f
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit fea8bee382b2051b0137fd2cacf0862823ee69b3
 | 
					Subproject commit dec6a9ecab3e5ec9ceff28b84cabb5c62d05ee9f
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 5b52a0f395065d6cb7b65a00a5e17eaf9ebd64d5
 | 
					Subproject commit ef99f1d90cdb33a52931aed5868785b51fb9411d
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 038e3a6ca59f11b3bb6a94087c1792322d1a1d5c
 | 
					Subproject commit a532fed72ace069e61c0132125b728316f9abd3c
 | 
				
			||||||
@ -51,6 +51,9 @@ bindsym $mod+Shift+q kill
 | 
				
			|||||||
# start dmenu (a program launcher)
 | 
					# start dmenu (a program launcher)
 | 
				
			||||||
bindsym $mod+d exec --no-startup-id rofi-launcher
 | 
					bindsym $mod+d exec --no-startup-id rofi-launcher
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bindsym $mod+o exec --no-startup-id rofi-files
 | 
				
			||||||
 | 
					bindsym $mod+Shift+o exec --no-startup-id rofi-files -S
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# setting up a vimscratch pad to use vimwiki
 | 
					# setting up a vimscratch pad to use vimwiki
 | 
				
			||||||
for_window [instance="todo"] move window to scratchpad
 | 
					for_window [instance="todo"] move window to scratchpad
 | 
				
			||||||
for_window [instance="cal"] move window to scratchpad
 | 
					for_window [instance="cal"] move window to scratchpad
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
- link:
 | 
					- link:
 | 
				
			||||||
    ~/.local/bin/ssh_agent_check: bin/ssh_agent_check
 | 
					    ~/.local/bin/ssh_agent_check: bin/ssh_agent_check
 | 
				
			||||||
    ~/.local/bin/poly_spotify: bin/poly_spotify
 | 
					    ~/.local/bin/poly_spotify: bin/poly_spotify
 | 
				
			||||||
 | 
					    ~/.local/bin/rofi-files: bin/rofi-files
 | 
				
			||||||
    ~/.local/bin/i3-scratchpad.sh: bin/i3-scratchpad.sh
 | 
					    ~/.local/bin/i3-scratchpad.sh: bin/i3-scratchpad.sh
 | 
				
			||||||
    ~/.local/bin/todo_display.sh: bin/todo_display.sh
 | 
					    ~/.local/bin/todo_display.sh: bin/todo_display.sh
 | 
				
			||||||
    ~/.local/bin/display_uptime: bin/display_uptime
 | 
					    ~/.local/bin/display_uptime: bin/display_uptime
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit da928a4c6b65148bfda3138674da1730c143f396
 | 
					Subproject commit 328bcb32590e5057b09bd27a40bc2fb21385fbf3
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit a30145b0f82d06770e924e9eac064ed223a94e6b
 | 
					Subproject commit b474978b2e9435c10ca66f8281352ebc825264f4
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit d698aee479f7fd5ce635568aa9892380d80f8ed7
 | 
					Subproject commit 462ef27cf39db4a837eeecf7135fb65cd0b8789a
 | 
				
			||||||
							
								
								
									
										2
									
								
								src/fzf
									
									
									
									
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								src/fzf
									
									
									
									
									
								
							@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 3364d4d147ade148d8e5dd67609e46f0ef6c50fc
 | 
					Subproject commit 20230402d087858ca9a93aa8fe53d289f29c1836
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 5dccd1801f36efb14e6b43ad90cb9569fe220d1c
 | 
					Subproject commit 6d96a8a4906e91f44ddf97645d5c3c1980212402
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit cb8bdd3e43b50a0610cff3a69959cb27eb407afc
 | 
					Subproject commit 020bbf7d64cc2f0c5d2a4ab96d45b8014ef54ad2
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user