forked from andonome/lk
		
	Merge branch 'dev' into vhs
This commit is contained in:
		
							
								
								
									
										75
									
								
								system/lf.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								system/lf.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | |||||||
|  | --- | ||||||
|  | title: "lf - The Light File Manager" | ||||||
|  | tags: [ "Documentation", "File Browser" ] | ||||||
|  | --- | ||||||
|  |  | ||||||
|  | ## Config File | ||||||
|  |  | ||||||
|  | If you don't have a `~/.config/lf/lfrc` file, you can probably find an example in `/usr/share/examples/lf`. | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | cp -r /usr/share/examples/lf ~/.config/ | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Go straight to root with two keys. | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | map g/ cd / | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Have lf open a file with the default program when you press 'o', using the program `mimeo`. | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | map o &mimeo $f | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Change that default text editor to look at the extension first. | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | cmd open ${{ | ||||||
|  |     case $(file --mime-type $f -b) in | ||||||
|  |         application/x-sc) sc-im $fx;; | ||||||
|  |         text/html) w3m $fx;; | ||||||
|  |         text/*) $EDITOR $fx;; | ||||||
|  |         video/*) nohup mpv $fx --really-quiet >/dev/null &;; | ||||||
|  |         *) nohup $OPENER $fx >/dev/null &;; | ||||||
|  |     esac | ||||||
|  | }} | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | The idea here is to use the default `$OPENER` for lf, but first check extensions. | ||||||
|  | Note the extra `mpv` commands to leave the video to play, without blocking the terminal. | ||||||
|  |  | ||||||
|  | ### Interesting Options | ||||||
|  |  | ||||||
|  | You can set the screen ratio with | ||||||
|  | `set ratios 1:2:3` | ||||||
|  |  | ||||||
|  | That leaves it as a small initial pane, a medium pane, and a large pane for file previews. | ||||||
|  |  | ||||||
|  | ### Rename | ||||||
|  |   | ||||||
|  | The standard renaming is bad, because you have to re-type the file extension. | ||||||
|  | Use this instead: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | # rename current file without overwrite | ||||||
|  | cmd rename %echo 'name: ' ; read name ; extension="${f##*.}" && newname="$name.$extension"; [ "$f" = "$extension" ] && newname="$name"; [ ! -e "$newname" ] && mv "$f" "$newname" || echo file exists | ||||||
|  | map r push :rename<enter> | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | If you try to rename `image_1.png` with this command, you can type in `cats`, and the result will be `cats.png`. | ||||||
|  |  | ||||||
|  | ## Image Previews | ||||||
|  |  | ||||||
|  | First, install `ueberzug` (to show images). | ||||||
|  | Then clone the lfrun repo. | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | git clone https://github.com/cirala/lfimg.git | ||||||
|  |  | ||||||
|  | cd lfimg | ||||||
|  |  | ||||||
|  | sudo make install | ||||||
|  | ``` | ||||||
|  |  | ||||||
| @@ -1,77 +0,0 @@ | |||||||
| # Ubuntu |  | ||||||
| https://linuxconfig.org/vnc-server-on-ubuntu-18-04-bionic-beaver-linux |  | ||||||
|  |  | ||||||
|  |  | ||||||
| # On server |  | ||||||
|  |  | ||||||
| Enable remote desktop access. |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| sudo apt install vnc4server xfce4 xfce4-goodies |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| Disable the vncserver desktop: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| vncserver -kill :1 |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| Replace the config in ~/.vnc/xstartup with: |  | ||||||
|  |  | ||||||
| `#!/bin/bash` |  | ||||||
|  |  | ||||||
| `startxfce4 &` |  | ||||||
|  |  | ||||||
| # Arch |  | ||||||
|  |  | ||||||
| Install tigervnc, then run it to set a password: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| vncserver |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| You'll get a session number. |  | ||||||
|  |  | ||||||
| Shut it down with the 'kill' command and the session's number: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| vncserver -kill :1 |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| This will forward over port 5900+x where x is the session number.  For the first server, that's port 5901. |  | ||||||
|  |  | ||||||
| # Create a systemd service |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| sudo vim /etc/systemd/system/vncserver@:1.service |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| Then enter: |  | ||||||
|  |  | ||||||
| > [Unit] |  | ||||||
| > Description=Remote desktop service (VNC) |  | ||||||
| > After=syslog.target network.target |  | ||||||
| >  |  | ||||||
| > [Service] |  | ||||||
| > Type=simple |  | ||||||
| > User=foo |  | ||||||
| > PAMName=login |  | ||||||
| > PIDFile=/home/%u/.vnc/%H%i.pid |  | ||||||
| > ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' |  | ||||||
| > ExecStart=/usr/bin/vncserver %i -geometry 1440x900 -alwaysshared -fg |  | ||||||
| > ExecStop=/usr/bin/vncserver -kill %i |  | ||||||
| >  |  | ||||||
| > [Install] |  | ||||||
| > WantedBy=multi-user.target |  | ||||||
|  |  | ||||||
| Then enable that service: |  | ||||||
|  |  | ||||||
| ```bash |  | ||||||
| sudo systemctl start vncserver@:1.service |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user