Compare commits

...

65 commits

Author SHA1 Message Date
3548a10425
Bump font awesome version 2022-10-23 18:14:38 -04:00
a0149c2327
Move polybar to bottom 2022-10-23 18:13:05 -04:00
78b21f4b15
Update everforest colors 2022-10-23 18:13:04 -04:00
62e1e93fa3
Bring settings in line with other branches 2022-10-23 18:13:04 -04:00
7e1cbe0c3b
Update install script 2022-10-23 18:13:04 -04:00
e80eb54b5c
Update install.sh 2022-10-23 18:13:02 -04:00
bf45f8c05e
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 18:12:45 -04:00
554f1234ee
Separate Xresources files for now 2022-10-23 18:12:45 -04:00
34e9cfd656
Updated install.sh 2022-10-23 18:12:43 -04:00
67565ed4d4
Update install.sh 2022-10-23 18:12:29 -04:00
13e2569b56
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 18:12:28 -04:00
219db6cd26
Separate Xresources files for now 2022-10-23 18:12:28 -04:00
deb88f67af
Updated install.sh 2022-10-23 18:12:28 -04:00
2b8f584840
Initial commit 2022-10-23 18:12:28 -04:00
d603f310a4
Resolve conflicts from git rebase main 2022-10-23 18:12:28 -04:00
38405fd69f
Resolve conflicts from git rebase main 2022-10-23 18:12:28 -04:00
35b3de2cfd
Update install.sh 2022-10-23 18:12:26 -04:00
c8e4fad1cb
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 18:12:09 -04:00
b4c7d2559c
Separate Xresources files for now 2022-10-23 18:12:09 -04:00
b172088596
Updated install.sh 2022-10-23 18:12:07 -04:00
310378f959
Update install.sh 2022-10-23 18:11:43 -04:00
1046a33ffc
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 18:11:19 -04:00
ac771ff87b
Separate Xresources files for now 2022-10-23 18:09:54 -04:00
e3be3f6b30
Updated install.sh 2022-10-23 18:09:51 -04:00
6ac7399173
Rebase 2022-10-23 18:08:11 -04:00
52cf9964ac
Resolve conflicts from git rebase main 2022-10-23 18:07:17 -04:00
c865f6d9da
Update everforest colors 2022-10-23 18:02:41 -04:00
2a8d53fd1b
Bring settings in line with other branches 2022-10-23 18:02:41 -04:00
ad3ecf08d7
Add config 2022-10-23 18:02:41 -04:00
9f0e44e070
Update install script 2022-10-23 18:02:41 -04:00
928e83c479
Remove deprecated setting 2022-10-23 18:02:41 -04:00
45791c3b09
Update install.sh 2022-10-23 18:02:40 -04:00
a2af80bf09
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 18:02:40 -04:00
4eb7c5172a
Separate Xresources files for now 2022-10-23 18:02:40 -04:00
c4ab321b23
Updated install.sh 2022-10-23 18:02:40 -04:00
b882c96747
Update install.sh 2022-10-23 18:02:40 -04:00
78d052c4a7
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 18:02:38 -04:00
f5bc96c1d5
Separate Xresources files for now 2022-10-23 18:01:49 -04:00
25342f6311
Updated install.sh 2022-10-23 18:01:47 -04:00
8ff6a6a860
Initial commit 2022-10-23 17:59:11 -04:00
9b0257ee5d
Resolve conflicts from git rebase main 2022-10-23 17:30:53 -04:00
c0b16d84d0
Update install.sh 2022-10-23 17:21:19 -04:00
7d7e8908f2
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 17:21:19 -04:00
3759901f0e
Separate Xresources files for now 2022-10-23 17:21:19 -04:00
08af8636a6
Updated install.sh 2022-10-23 17:21:19 -04:00
a4b4aef3a4
Updated for Font Awesome 6 2022-10-23 17:21:19 -04:00
59de208949
Added .profile (again) 2022-10-23 17:21:19 -04:00
02bb619d83
Remove dpi setting from .Xresources 2022-10-23 17:21:19 -04:00
02727b2dc0
Show icons in rofi app menu 2022-10-23 17:21:19 -04:00
5f8e412669
Added teams-for-linux 2022-10-23 17:21:19 -04:00
5daa458081
Update install.sh 2022-10-23 17:21:18 -04:00
51976ad1d7
Merged zenburn and gruvbox colors to same Xresources 2022-10-23 17:21:18 -04:00
b354222b8a
Separate Xresources files for now 2022-10-23 17:21:18 -04:00
39177eba28
Updated install.sh 2022-10-23 17:21:18 -04:00
d3f7059081
Added and changed to zenburn theme globally 2022-10-23 17:21:18 -04:00
bd95b14070
Added rule for KeePassXC 2022-10-23 17:21:18 -04:00
93b8406834
Removed ranger 2022-10-23 17:21:18 -04:00
38a7985761
Default to 1080p 2022-10-23 17:21:18 -04:00
06ee0e95c2
Rebase 2022-10-23 17:21:16 -04:00
96bc55b90d
Rebase conflicts resolve 2022-10-23 17:19:34 -04:00
21a27a9bda
Resolve conflicts from git rebase maiN 2022-10-23 17:19:33 -04:00
171d3edd66
Added xsettingsd 2022-10-23 16:50:02 -04:00
c4caa65fcf
Update .gitignore.main 2022-10-23 16:49:10 -04:00
2539f6ac96
Import changes from laptop-hidpi branch 2022-10-23 16:45:02 -04:00
1b902820f4
sink-nicknames option replaced with node-nicknames 2022-10-11 21:23:03 -04:00
24 changed files with 4990 additions and 68 deletions

View file

@ -1,4 +1,3 @@
install.sh install.sh
Xresources Xresources
bin/mirror-outputs bin/mirror-outputs
@ -15,6 +14,7 @@ config/polybar/*
!config/polybar/custom_modules.ini !config/polybar/custom_modules.ini
!config/ranger !config/ranger
!config/rofi !config/rofi
!config/xsettingsd
emacs.d/* emacs.d/*
!emacs.d/init.el !emacs.d/init.el
!emacs.d/snippets !emacs.d/snippets

23
.gitignore.single-monitor Normal file
View file

@ -0,0 +1,23 @@
config/*
!config/bspwm
config/bspwm/*
!config/bspwm/bspwmrc
!config/dunst
!config/kitty
!config/nvim
config/nvim/*
!config/nvim/init.vim
!config/polybar
config/polybar/*
!config/polybar/config.ini
!config/polybar/colors.ini
!config/polybar/modules.ini
!config/polybar/custom_modules.ini
!config/ranger
!config/rofi
!config/sxhkd
config/sxhkd/*
!config/sxhkd/sxhkdrc
emacs.d/*
!emacs.d/init.el
!emacs.d/snippets

151
Xresources Normal file
View file

@ -0,0 +1,151 @@
! -----------------------------------------------------------------------------
! Colors: gruvbox-dark, forest night, zenburn
! Source: https://github.com/morhetz/gruvbox-generalized
! https://github.com/jef/forest-night-xresources
! https://github.com/jnurmine/Zenburn
! -----------------------------------------------------------------------------
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
!---------!
! Gruvbox !
! --------!
! hard contrast: *background: #1d2021
! medium contrast: *background: #282828
! soft contrast: *background: #32302f
! *background: #1d2021
! *foreground: #ebdbb2
! ! Black + DarkGrey
! *color0: #282828
! *color8: #928374
! ! DarkRed + Red
! *color1: #cc241d
! *color9: #fb4934
! ! DarkGreen + Green
! *color2: #98971a
! *color10: #b8bb26
! ! DarkYellow + Yellow
! *color3: #d79921
! *color11: #fabd2f
! ! DarkBlue + Blue
! *color4: #458588
! *color12: #83a598
! ! DarkMagenta + Magenta
! *color5: #b16286
! *color13: #d3869b
! ! DarkCyan + Cyan
! *color6: #689d6a
! *color14: #8ec07c
! ! LightGrey + White
! *color7: #a89984
! *color15: #ebdbb2
!------------!
! Everforest !
!------------!
! special
*.foreground: #d8caac
*.background: #323d43
*.cursorColor: #7fbbb3
! black
*.color0: #4a555b
*.color8: #525c62
! red
*.color1: #e26c6e
*.color9: #e68183
! green
*.color2: #9bb86f
*.color10: #a7c080
! yellow
*.color3: #d5b26b
*.color11: #dbbc7f
! blue
*.color4: #6eb2a9
*.color12: #7fbbb3
! magenta
*.color5: #cf87a9
*.color13: #d699b6
! cyan
*.color6: #72b783
*.color14: #83c092
! white
*.color7: #d0bf9b
*.color15: #d8caac
!---------!
! Zenburn !
!---------!
! *background: #3f3f3f
! *foreground: #dcdccc
! ! Black + DarkGrey
! *color0: #282828
! *color8: #709080
! ! DarkRed + Red
! *color1: #705050
! *color9: #dca3a3
! ! DarkGreen + Green
! *color2: #60b48a
! *color10: #c3bf9f
! ! DarkYellow + Yellow
! *color3: #f0deae
! *color11: #dfcf9f
! ! DarkBlue + Blue
! *color4: #506070
! *color12: #94bff3
! ! DarkMagenta + Magenta
! *color5: #dc8cc3
! *color13: #ec93d3
! ! DarkCyan + Cyan
! *color6: #8cd0d3
! *color14: #93e0e3
! ! LightGrey + White
! *color7: #dcdccc
! *color15: #ffffff
!!! urxvt
URxvt.perl-ext-common: default,matcher
URxvt*buffered: true
URxvt*saveLines: 5000
URxvt*cursorBlink: true
URxvt*borderless: 1
URxvt*internalBorder: 20
URxvt*scrollBar: false
URxvt.url-launcher: /usr/bin/xdg-open
URxvt.matcher.button: 1
URxvt.clipboard.autocopy: true
! do not scroll with output
URxvt*scrollTtyOutput: false
! scroll in relation to buffer (with mouse scroll or Shift+Page Up)
URxvt*scrollWithBuffer: true
! scroll back to the bottom on keypress
URxvt*scrollTtyKeypress: true
! disable scrollback buffer in secondary screen (allows scrolling pager when using 'less' etc)
URxvt.secondaryScreen: 1
URxvt.secondaryScroll: 0
! Disable printing the terminal contents when pressing PrintScreen.
URxvt.print-pipe: "cat > /dev/null"
!! copy/paste
! disable default ctrl-shift binding
URxvt.iso14755: false
URxvt.iso14755_52: false
! disable default copy/paste bindings
URxvt.keysym.Control-Meta-c: builtin-string:
URxvt.keysym.Control-Meta-v: builtin-string:
! new copy/paste bindings
URxvt.keysym.Shift-Control-V: eval:paste_clipboard
URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
!! font
!URxvt.letterSpace: -1
URxvt.font: xft:Hack:regular:size=12, \
xft:Font Awesome 6 Brands:Regular:size=10, \
xft:Font Awesome 6 Free:Solid:size=10, \
xft:Font Awesome 6 Free:Regular:size=10

1
bashrc
View file

@ -13,4 +13,5 @@ alias r="urxvt -name Ranger -e ranger & disown"
alias kssh="/usr/bin/kitty +kitten ssh" alias kssh="/usr/bin/kitty +kitten ssh"
neofetch neofetch
[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh [ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
## Simple script to mirror all connected displays for presentations ## Simple script to mirror all connected displays for presentations
RESOLUTION=3840x2160 RESOLUTION=1920x1080
xrandr --listmonitors | sed -n '1!p' | sed -e 's/\s[0-9].*\s\([a-zA-Z0-9\-]*\)$/\1/g' | xargs -n 1 -- bash -xc 'xrandr --output $0 --mode '$RESOLUTION' --pos 0x0 --rotate normal' xrandr --listmonitors | sed -n '1!p' | sed -e 's/\s[0-9].*\s\([a-zA-Z0-9\-]*\)$/\1/g' | xargs -n 1 -- bash -xc 'xrandr --output $0 --mode '$RESOLUTION' --pos 0x0 --rotate normal'

53
config/bspwm/bspwmrc Executable file
View file

@ -0,0 +1,53 @@
#!/bin/bash
bspc monitor DP-0 -d 1 2 3 4 5 6 7 8 9 10
bspc config border_width 2
bspc config window_gap 5
bspc config top_padding 0
bspc config bottom_padding 32
bspc config split_ratio 0.50
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc rule -a Galculator state=floating
bspc rule -a vlc state=floating
bspc rule -a Blueman-manager state=floating
bspc rule -a Bitwarden state=floating
bspc rule -a Leafpad state=floating
bspc rule -a KeePassXC state=floating
bspc rule -a firefox desktop='^1' follow=on
bspc rule -a Chromium desktop='^2' follow=on
bspc rule -a Ranger desktop='^3' follow=on
bspc rule -a Thunar desktop='3' follow=on
bspc rule -a Evince desktop='^4' follow=on
bspc rule -a Soffice desktop='^4' follow=on
bspc rule -a Xsane desktop='^4' follow=on state=floating
bspc rule -a Steam desktop='^5' follow=on state=floating
bspc rule -a Lutris desktop='^5' follow=on state=floating
bspc rule -a origin.exe desktop='^5' state=floating
bspc rule -a kitty desktop='^6' follow=on
bspc rule -a URxvt desktop='^6' follow=on
bspc rule -a Emacs desktop='^7' follow=on state=tiled
bspc rule -a jetbrains-pycharm-ce desktop='^7' follow=on
bspc rule -a Clementine desktop='^8' follow=on
bspc rule -a discord desktop='^9' follow=on
bspc rule -a Spotify desktop='^8' follow=on
bspc rule -a Element desktop='^9'
bspc rule -a Slack desktop='^9'
bspc rule -a teams-for-linux desktop='^9'
bspc rule -a tutanota-desktop desktop='^10'
### Focus on 1st workspace by default
bspc desktop -f 1
### Autostart
grep -x sxhkd > /dev/null || sxhkd &
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
xidlehook --not-when-audio --not-when-fullscreen --timer 360 "xset s activate" "" &
~/.local/bin/dual-polybar-launcher &
sh ~/.fehbg &
dex -ae bspwm &

View file

@ -11,31 +11,24 @@ cursor #7fbbb3
# black # black
color0 #4a555b color0 #4a555b
color8 #525c62 color8 #525c62
# red # red
color1 #e26c6e color1 #e26c6e
color9 #e68183 color9 #e68183
# green # green
color2 #9bb86f color2 #9bb86f
color10 #a7c080 color10 #a7c080
# yellow # yellow
color3 #d5b26b color3 #d5b26b
color11 #dbbc7f color11 #dbbc7f
# blue # blue
color4 #6eb2a9 color4 #6eb2a9
color12 #7fbbb3 color12 #7fbbb3
# magenta # magenta
color5 #cf87a9 color5 #cf87a9
color13 #d699b6 color13 #d699b6
# cyan # cyan
color6 #72b783 color6 #72b783
color14 #83c092 color14 #83c092
# white # white
color7 #d0bf9b color7 #d0bf9b
color15 #d8caac color15 #d8caac

133
config/polybar/config.ini Normal file
View file

@ -0,0 +1,133 @@
[global/wm]
include-file = ~/.config/polybar/colors.ini
include-file = ~/.config/polybar/modules.ini
include-file = ~/.config/polybar/custom_modules.ini
margin-bottom = 0
margin-top = 0
[bar/one]
monitor = DP-0
monitor-fallback =
monitor-strict = false
enable-ipc = true
override-redirect = true
bottom = true
fixed-center = true
width = 100%
height = 32
offset-x = 0%
offset-y = 0%
;dpi-x = 216
;dpi-y = 216
background = ${color.background}
foreground = ${color.foreground}
radius-top = 0.0
radius-bottom = 0.0
line-size = 0
line-color = ${color.background}
border-bottom-size = 0
border-bottom-color = ${color.foreground}
padding = 1
module-margin-left = 1
module-margin-right = 0
seperator =
dim-value = 1.0
locale = en_US.UTF-8
font-0 = Hack:size=10;3
font-1 = Font Awesome 6 Free:style=Solid:size=12;3
font-2 = Font Awesome 6 Free:style=Regular:size=12;3
font-3 = Font Awesome 6 Brands:style=Regular:size=12;3
modules-left = workspaces sep title
modules-center = spotify
modules-right = keyboard sep pulseaudio-control sep date sep powermenu
tray-position = right
tray-detached = false
tray-maxsize = 16
tray-background = ${color.background}
tray-offset-x = 0
tray-offset-y = 0
tray-padding = 0
tray-scale = 1.0
wm-name = bspwm
wm-restack = bspwm
scroll-up = bspwm-desknext
scroll-down = bspwm-deskprev
click-left =
click-middle =
click-right =
;scroll-up = bspc desktop -f prev.local
;;scroll-down = bspc desktop -f next.local
;double-click-left =
;double-click-middle =
;double-click-right =
;cursor-click =
;cursor-scroll =
;
;[bar/two]
;monitor = eDP-1
;monitor-fallback =
;monitor-strict = false
;enable-ipc = true
;override-redirect = true
;bottom = true
;fixed-center = true
;width = 100%
;height = 32
;offset-x = 0%
;offset-y = 0%
;background = ${color.background}
;foreground = ${color.foreground}
;radius-top = 0.0
;radius-bottom = 0.0
;line-size = 0
;line-color = ${color.background}
;border-bottom-size = 0
;border-bottom-color = ${color.foreground}
;padding = 1
;module-margin-left = 1
;module-margin-right = 1
;seperator =
;dim-value = 1.0
;locale = en_US.UTF-8
;
;font-0 = Hack:size=10;3
;font-1 = Font Awesome 6 Free:style=Solid:size=12;3
;font-2 = Font Awesome 6 Free:style=Regular:size=12;3
;font-3 = Font Awesome 6 Brands:style=Regular:size=12;3
;modules-left = workspaces sep title
;modules-center = spotify
;modules-right = cpu sep memory sep filesystem
;
;tray-position = none
;tray-detached = false
;tray-maxsize = 16
;tray-background = ${color.background}
;tray-offset-x = 0
;tray-offset-y = 0
;tray-padding = 0
;tray-scale = 1.0
;
;wm-name = bspwm
;wm-restack = bspwm
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
;click-left =
;click-middle =
;click-right =
;;scroll-up = bspc desktop -f prev.local
;;scroll-down = bspc desktop -f next.local
;double-click-left =
;double-click-middle =
;double-click-right =
;cursor-click =
;cursor-scroll =
;
;[settings]
;screenchange-reload = false

View file

@ -88,7 +88,7 @@ label-foreground = ${color.dark-blue}
# You can copy-paste your options for each possible action, which is more # You can copy-paste your options for each possible action, which is more
# trouble-free but repetitive, or apply only the relevant ones (for example # trouble-free but repetitive, or apply only the relevant ones (for example
# --sink-blacklist is only needed for next-sink). # --sink-blacklist is only needed for next-sink).
exec = pulseaudio-control --icons-volume " , , " --icon-muted " " --node-nicknames-from "device.name" listen exec = pulseaudio-control --icons-volume " , , " --icon-muted " " --node-nicknames-from "device.profile.description" listen
#exec = pulseaudio-control --icons-volume " , , " --icon-muted " " --sink-nicknames-from "device.description" --sink-nickname "alsa_output.pci-0000_00_1b.0.analog-stereo: Speakers" --sink-nickname "alsa_output.usb-Kingston_HyperX_Virtual_Surround_Sound_00000000-00.analog-stereo: Headphones" listen #exec = pulseaudio-control --icons-volume " , , " --icon-muted " " --sink-nicknames-from "device.description" --sink-nickname "alsa_output.pci-0000_00_1b.0.analog-stereo: Speakers" --sink-nickname "alsa_output.usb-Kingston_HyperX_Virtual_Surround_Sound_00000000-00.analog-stereo: Headphones" listen
click-right = exec pavucontrol & click-right = exec pavucontrol &
click-left = pulseaudio-control togmute click-left = pulseaudio-control togmute

675
config/ranger/LICENSE Normal file
View file

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

62
config/ranger/commands.py Normal file
View file

@ -0,0 +1,62 @@
# This is a sample commands.py. You can add your own commands here.
#
# Please refer to commands_full.py for all the default commands and a complete
# documentation. Do NOT add them all here, or you may end up with defunct
# commands when upgrading ranger.
# A simple command for demonstration purposes follows.
# -----------------------------------------------------------------------------
from __future__ import (absolute_import, division, print_function)
# You can import any python module as needed.
import os
# You always need to import ranger.api.commands here to get the Command class:
from ranger.api.commands import Command
# Any class that is a subclass of "Command" will be integrated into ranger as a
# command. Try typing ":my_edit<ENTER>" in ranger!
class my_edit(Command):
# The so-called doc-string of the class will be visible in the built-in
# help that is accessible by typing "?c" inside ranger.
""":my_edit <filename>
A sample command for demonstration purposes that opens a file in an editor.
"""
# The execute method is called when you run this command in ranger.
def execute(self):
# self.arg(1) is the first (space-separated) argument to the function.
# This way you can write ":my_edit somefilename<ENTER>".
if self.arg(1):
# self.rest(1) contains self.arg(1) and everything that follows
target_filename = self.rest(1)
else:
# self.fm is a ranger.core.filemanager.FileManager object and gives
# you access to internals of ranger.
# self.fm.thisfile is a ranger.container.file.File object and is a
# reference to the currently selected file.
target_filename = self.fm.thisfile.path
# This is a generic function to print text in ranger.
self.fm.notify("Let's edit the file " + target_filename + "!")
# Using bad=True in fm.notify allows you to print error messages:
if not os.path.exists(target_filename):
self.fm.notify("The given file does not exist!", bad=True)
return
# This executes a function from ranger.core.acitons, a module with a
# variety of subroutines that can help you construct commands.
# Check out the source, or run "pydoc ranger.core.actions" for a list.
self.fm.edit_file(target_filename)
# The tab method is called when you press tab, and should return a list of
# suggestions that the user will tab through.
# tabnum is 1 for <TAB> and -1 for <S-TAB> by default
def tab(self, tabnum):
# This is a generic tab-completion function that iterates through the
# content of the current directory.
return self._tab_directory_content()

File diff suppressed because it is too large Load diff

760
config/ranger/rc.conf Normal file
View file

@ -0,0 +1,760 @@
# ===================================================================
# This file contains the default startup commands for ranger.
# To change them, it is recommended to create either /etc/ranger/rc.conf
# (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom
# commands there.
#
# If you copy this whole file there, you may want to set the environment
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
#
# The purpose of this file is mainly to define keybindings and settings.
# For running more complex python code, please create a plugin in "plugins/" or
# a command in "commands.py".
#
# Each line is a command that will be run before the user interface
# is initialized. As a result, you can not use commands which rely
# on the UI such as :delete or :mark.
# ===================================================================
# ===================================================================
# == Options
# ===================================================================
# Which viewmode should be used? Possible values are:
# miller: Use miller columns which show multiple levels of the hierarchy
# multipane: Midnight-commander like multipane view showing all tabs next
# to each other
set viewmode miller
#set viewmode multipane
# How many columns are there, and what are their relative widths?
set column_ratios 1,3,4
# Which files should be hidden? (regular expression)
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
# Show hidden files? You can toggle this by typing 'zh'
set show_hidden false
# Ask for a confirmation when running the "delete" command?
# Valid values are "always", "never", "multiple" (default)
# With "multiple", ranger will ask only if you delete multiple files at once.
set confirm_on_delete multiple
# Use non-default path for file preview script?
# ranger ships with scope.sh, a script that calls external programs (see
# README.md for dependencies) to preview images, archives, etc.
#set preview_script ~/.config/ranger/scope.sh
# Use the external preview script or display simple plain text or image previews?
set use_preview_script true
# Automatically count files in the directory, even before entering them?
set automatically_count_files true
# Open all images in this directory when running certain image viewers
# like feh or sxiv? You can still open selected files by marking them.
set open_all_images true
# Be aware of version control systems and display information.
set vcs_aware false
# State of the four backends git, hg, bzr, svn. The possible states are
# disabled, local (only show local info), enabled (show local and remote
# information).
set vcs_backend_git enabled
set vcs_backend_hg disabled
set vcs_backend_bzr disabled
set vcs_backend_svn disabled
# Truncate the long commit messages to this length when shown in the statusbar.
set vcs_msg_length 50
# Use one of the supported image preview protocols
set preview_images false
# Set the preview image method. Supported methods:
#
# * w3m (default):
# Preview images in full color with the external command "w3mimgpreview"?
# This requires the console web browser "w3m" and a supported terminal.
# It has been successfully tested with "xterm" and "urxvt" without tmux.
#
# * iterm2:
# Preview images in full color using iTerm2 image previews
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
# with image preview support.
#
# This feature relies on the dimensions of the terminal's font. By default, a
# width of 8 and height of 11 are used. To use other values, set the options
# iterm2_font_width and iterm2_font_height to the desired values.
#
# * terminology:
# Previews images in full color in the terminology terminal emulator.
# Supports a wide variety of formats, even vector graphics like svg.
#
# * urxvt:
# Preview images in full color using urxvt image backgrounds. This
# requires using urxvt compiled with pixbuf support.
#
# * urxvt-full:
# The same as urxvt but utilizing not only the preview pane but the
# whole terminal window.
#
# * kitty:
# Preview images in full color using kitty image protocol.
# Requires python PIL or pillow library.
# If ranger does not share the local filesystem with kitty
# the transfer method is changed to encode the whole image;
# while slower, this allows remote previews,
# for example during an ssh session.
# Tmux is unsupported.
#
# * ueberzug:
# Preview images in full color with the external command "ueberzug".
# Images are shown by using a child window.
# Only for users who run X11 in GNU/Linux.
set preview_images_method w3m
# Delay in seconds before displaying an image with the w3m method.
# Increase it in case of experiencing display corruption.
set w3m_delay 0.02
# Manually adjust the w3mimg offset when using a terminal which needs this
set w3m_offset 0
# Default iTerm2 font size (see: preview_images_method: iterm2)
set iterm2_font_width 8
set iterm2_font_height 11
# Use a unicode "..." character to mark cut-off filenames?
set unicode_ellipsis false
# BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic).
# Requires the python-bidi pip package
set bidi_support false
# Show dotfiles in the bookmark preview box?
set show_hidden_bookmarks true
# Which colorscheme to use? These colorschemes are available by default:
# default, jungle, snow, solarized
set colorscheme default
# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
set preview_files true
set preview_directories true
set collapse_preview true
# Wrap long lines in plain text previews?
set wrap_plaintext_previews false
# Save the console history on exit?
set save_console_history true
# Draw the status bar on top of the browser window (default: bottom)
set status_bar_on_top false
# Draw a progress bar in the status bar which displays the average state of all
# currently running tasks which support progress bars?
set draw_progress_bar_in_status_bar true
# Draw borders around columns? (separators, outline, both, or none)
# Separators are vertical lines between columns.
# Outline draws a box around all the columns.
# Both combines the two.
set draw_borders none
# Display the directory name in tabs?
set dirname_in_tabs false
# Enable the mouse support?
set mouse_enabled true
# Display the file size in the main column or status bar?
set display_size_in_main_column true
set display_size_in_status_bar true
# Display the free disk space in the status bar?
set display_free_space_in_status_bar true
# Display files tags in all columns or only in main column?
set display_tags_in_all_columns true
# Set a title for the window? Updates both `WM_NAME` and `WM_ICON_NAME`
set update_title false
# Set the tmux/screen window-name to "ranger"?
set update_tmux_title true
# Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature.
set shorten_title 3
# Show hostname in titlebar?
set hostname_in_titlebar true
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
set tilde_in_titlebar false
# How many directory-changes or console-commands should be kept in history?
set max_history_size 20
set max_console_history_size 50
# Try to keep so much space between the top/bottom border when scrolling:
set scroll_offset 8
# Flush the input after each key hit? (Noticeable when ranger lags)
set flushinput true
# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
set padding_right true
# Save bookmarks (used with mX and `X) instantly?
# This helps to synchronize bookmarks between multiple ranger
# instances but leads to *slight* performance loss.
# When false, bookmarks are saved when ranger is exited.
set autosave_bookmarks true
# Save the "`" bookmark to disk. This can be used to switch to the last
# directory by typing "``".
set save_backtick_bookmark true
# You can display the "real" cumulative size of directories by using the
# command :get_cumulative_size or typing "dc". The size is expensive to
# calculate and will not be updated automatically. You can choose
# to update it automatically though by turning on this option:
set autoupdate_cumulative_size false
# Turning this on makes sense for screen readers:
set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
set sort natural
# Additional sorting options
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
set xterm_alt_key false
# Whether to include bookmarks in cd command
set cd_bookmarks true
# Changes case sensitivity for the cd command tab completion
set cd_tab_case sensitive
# Use fuzzy tab completion with the "cd" command. For example,
# ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
set cd_tab_fuzzy false
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
# disable this feature.
set preview_max_size 0
# The key hint lists up to this size have their sublists expanded.
# Otherwise the submaps are replaced with "...".
set hint_collapse_threshold 10
# Add the highlighted file to the path in the titlebar
set show_selection_in_titlebar true
# The delay that ranger idly waits for user input, in milliseconds, with a
# resolution of 100ms. Lower delay reduces lag between directory updates but
# increases CPU load.
set idle_delay 2000
# When the metadata manager module looks for metadata, should it only look for
# a ".metadata.json" file in the current directory, or do a deep search and
# check all directories above the current one as well?
set metadata_deep_search false
# Clear all existing filters when leaving a directory
set clear_filters_on_dir_change false
# Disable displaying line numbers in main column.
# Possible values: false, absolute, relative.
set line_numbers false
# When line_numbers=relative show the absolute line number in the
# current line.
set relative_current_zero false
# Start line numbers from 1 instead of 0
set one_indexed false
# Save tabs on exit
set save_tabs_on_exit false
# Enable scroll wrapping - moving down while on the last item will wrap around to
# the top and vice versa.
set wrap_scroll false
# Set the global_inode_type_filter to nothing. Possible options: d, f and l for
# directories, files and symlinks respectively.
set global_inode_type_filter
# This setting allows to freeze the list of files to save I/O bandwidth. It
# should be 'false' during start-up, but you can toggle it by pressing F.
set freeze_files false
# Print file sizes in bytes instead of the default human-readable format.
set size_in_bytes false
# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words
# give a warning when you nest ranger in a subshell started by ranger.
# Special value "error" makes the warning more visible.
set nested_ranger_warning true
# ===================================================================
# == Local Options
# ===================================================================
# You can set local options that only affect a single directory.
# Examples:
# setlocal path=~/downloads sort mtime
# ===================================================================
# == Command Aliases in the Console
# ===================================================================
alias e edit
alias q quit
alias q! quit!
alias qa quitall
alias qa! quitall!
alias qall quitall
alias qall! quitall!
alias setl setlocal
alias filter scout -prts
alias find scout -aets
alias mark scout -mr
alias unmark scout -Mr
alias search scout -rs
alias search_inc scout -rts
alias travel scout -aefklst
# ===================================================================
# == Define keys for the browser
# ===================================================================
# Basic
map Q quitall
map q quit
copymap q ZZ ZQ
map R reload_cwd
map F set freeze_files!
map <C-r> reset
map <C-l> redraw_window
map <C-c> abort
map <esc> change_mode normal
map ~ set viewmode!
map i display_file
map <A-j> scroll_preview 1
map <A-k> scroll_preview -1
map ? help
map W display_log
map w taskview_open
map S shell $SHELL
map : console
map ; console
map ! console shell%space
map @ console -p6 shell %%s
map # console shell -p%space
map s console shell%space
map r chain draw_possible_programs; console open_with%space
map f console find%space
map cd console cd%space
map <C-p> chain console; eval fm.ui.console.history_move(-1)
# Change the line mode
map Mf linemode filename
map Mi linemode fileinfo
map Mm linemode mtime
map Mh linemode humanreadablemtime
map Mp linemode permissions
map Ms linemode sizemtime
map MH linemode sizehumanreadablemtime
map Mt linemode metatitle
# Tagging / Marking
map t tag_toggle
map ut tag_remove
map "<any> tag_toggle tag=%any
map <Space> mark_files toggle=True
map v mark_files all=True toggle=True
map uv mark_files all=True val=False
map V toggle_visual_mode
map uV toggle_visual_mode reverse=True
# For the nostalgics: Midnight Commander bindings
map <F1> help
map <F2> rename_append
map <F3> display_file
map <F4> edit
map <F5> copy
map <F6> cut
map <F7> console mkdir%space
map <F8> console delete
#map <F8> console trash
map <F10> exit
# In case you work on a keyboard with dvorak layout
map <UP> move up=1
map <DOWN> move down=1
map <LEFT> move left=1
map <RIGHT> move right=1
map <HOME> move to=0
map <END> move to=-1
map <PAGEDOWN> move down=1 pages=True
map <PAGEUP> move up=1 pages=True
map <CR> move right=1
#map <DELETE> console delete
map <INSERT> console touch%space
# VIM-like
copymap <UP> k
copymap <DOWN> j
copymap <LEFT> h
copymap <RIGHT> l
copymap <HOME> gg
copymap <END> G
copymap <PAGEDOWN> <C-F>
copymap <PAGEUP> <C-B>
map J move down=0.5 pages=True
map K move up=0.5 pages=True
copymap J <C-D>
copymap K <C-U>
# Jumping around
map H history_go -1
map L history_go 1
map ] move_parent 1
map [ move_parent -1
map } traverse
map { traverse_backwards
map ) jump_non
map gh cd ~
map ge cd /etc
map gu cd /usr
map gd cd /dev
map gl cd -r .
map gL cd -r %f
map go cd /opt
map gv cd /var
map gm cd /media
map gi eval fm.cd('/run/media/' + os.getenv('USER'))
map gM cd /mnt
map gs cd /srv
map gp cd /tmp
map gr cd /
map gR eval fm.cd(ranger.RANGERDIR)
map g/ cd /
map g? cd /usr/share/doc/ranger
# External Programs
map E edit
map du shell -p du --max-depth=1 -h --apparent-size
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
map yp yank path
map yd yank dir
map yn yank name
map y. yank name_without_extension
# Filesystem Operations
map = chmod
map cw console rename%space
map a rename_append
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
map pp paste
map po paste overwrite=True
map pP paste append=True
map pO paste overwrite=True append=True
map pl paste_symlink relative=False
map pL paste_symlink relative=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
map pd console paste dest=
map p`<any> paste dest=%any_path
map p'<any> paste dest=%any_path
map dD console delete
map dT console trash
map DD shell trash-put %s
map dd cut
map ud uncut
map da cut mode=add
map dr cut mode=remove
map dt cut mode=toggle
map yy copy
map uy uncut
map ya copy mode=add
map yr copy mode=remove
map yt copy mode=toggle
# Temporary workarounds
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
# Searching
map / console search%space
map n search_next
map N search_next forward=False
map ct search_next order=tag
map cs search_next order=size
map ci search_next order=mimetype
map cc search_next order=ctime
map cm search_next order=mtime
map ca search_next order=atime
# Tabs
map <C-n> tab_new
map <C-w> tab_close
map <TAB> tab_move 1
map <S-TAB> tab_move -1
map <A-Right> tab_move 1
map <A-Left> tab_move -1
map gt tab_move 1
map gT tab_move -1
map gn tab_new
map gc tab_close
map uq tab_restore
map <a-1> tab_open 1
map <a-2> tab_open 2
map <a-3> tab_open 3
map <a-4> tab_open 4
map <a-5> tab_open 5
map <a-6> tab_open 6
map <a-7> tab_open 7
map <a-8> tab_open 8
map <a-9> tab_open 9
map <a-r> tab_shift 1
map <a-l> tab_shift -1
# Sorting
map or set sort_reverse!
map oz set sort=random
map os chain set sort=size; set sort_reverse=False
map ob chain set sort=basename; set sort_reverse=False
map on chain set sort=natural; set sort_reverse=False
map om chain set sort=mtime; set sort_reverse=False
map oc chain set sort=ctime; set sort_reverse=False
map oa chain set sort=atime; set sort_reverse=False
map ot chain set sort=type; set sort_reverse=False
map oe chain set sort=extension; set sort_reverse=False
map oS chain set sort=size; set sort_reverse=True
map oB chain set sort=basename; set sort_reverse=True
map oN chain set sort=natural; set sort_reverse=True
map oM chain set sort=mtime; set sort_reverse=True
map oC chain set sort=ctime; set sort_reverse=True
map oA chain set sort=atime; set sort_reverse=True
map oT chain set sort=type; set sort_reverse=True
map oE chain set sort=extension; set sort_reverse=True
map dc get_cumulative_size
# Settings
map zc set collapse_preview!
map zd set sort_directories_first!
map zh set show_hidden!
map <C-h> set show_hidden!
copymap <C-h> <backspace>
copymap <backspace> <backspace2>
map zI set flushinput!
map zi set preview_images!
map zm set mouse_enabled!
map zp set preview_files!
map zP set preview_directories!
map zs set sort_case_insensitive!
map zu set autoupdate_cumulative_size!
map zv set use_preview_script!
map zf console filter%space
copymap zf zz
# Filter stack
map .d filter_stack add type d
map .f filter_stack add type f
map .l filter_stack add type l
map .m console filter_stack add mime%space
map .n console filter_stack add name%space
map .# console filter_stack add hash%space
map ." filter_stack add duplicate
map .' filter_stack add unique
map .| filter_stack add or
map .& filter_stack add and
map .! filter_stack add not
map .r filter_stack rotate
map .c filter_stack clear
map .* filter_stack decompose
map .p filter_stack pop
map .. filter_stack show
# Bookmarks
map `<any> enter_bookmark %any
map '<any> enter_bookmark %any
map m<any> set_bookmark %any
map um<any> unset_bookmark %any
map m<bg> draw_bookmarks
copymap m<bg> um<bg> `<bg> '<bg>
# Generate all the chmod bindings with some python help:
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
# ===================================================================
# == Define keys for the console
# ===================================================================
# Note: Unmapped keys are passed directly to the console.
# Basic
cmap <tab> eval fm.ui.console.tab()
cmap <s-tab> eval fm.ui.console.tab(-1)
cmap <ESC> eval fm.ui.console.close()
cmap <CR> eval fm.ui.console.execute()
cmap <C-l> redraw_window
copycmap <ESC> <C-c>
copycmap <CR> <C-j>
# Move around
cmap <up> eval fm.ui.console.history_move(-1)
cmap <down> eval fm.ui.console.history_move(1)
cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1)
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
cmap <a-b> eval fm.ui.console.move_word(left=1)
cmap <a-f> eval fm.ui.console.move_word(right=1)
copycmap <a-b> <a-left>
copycmap <a-f> <a-right>
# Line Editing
cmap <backspace> eval fm.ui.console.delete(-1)
cmap <delete> eval fm.ui.console.delete(0)
cmap <C-w> eval fm.ui.console.delete_word()
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
cmap <C-k> eval fm.ui.console.delete_rest(1)
cmap <C-u> eval fm.ui.console.delete_rest(-1)
cmap <C-y> eval fm.ui.console.paste()
# And of course the emacs way
copycmap <ESC> <C-g>
copycmap <up> <C-p>
copycmap <down> <C-n>
copycmap <left> <C-b>
copycmap <right> <C-f>
copycmap <home> <C-a>
copycmap <end> <C-e>
copycmap <delete> <C-d>
copycmap <backspace> <C-h>
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
# and <backspace2> (code 127). To be sure, use both.
copycmap <backspace> <backspace2>
# This special expression allows typing in numerals:
cmap <allow_quantifiers> false
# ===================================================================
# == Pager Keybindings
# ===================================================================
# Movement
pmap <down> pager_move down=1
pmap <up> pager_move up=1
pmap <left> pager_move left=4
pmap <right> pager_move right=4
pmap <home> pager_move to=0
pmap <end> pager_move to=-1
pmap <pagedown> pager_move down=1.0 pages=True
pmap <pageup> pager_move up=1.0 pages=True
pmap <C-d> pager_move down=0.5 pages=True
pmap <C-u> pager_move up=0.5 pages=True
copypmap <UP> k <C-p>
copypmap <DOWN> j <C-n> <CR>
copypmap <LEFT> h
copypmap <RIGHT> l
copypmap <HOME> g
copypmap <END> G
copypmap <C-d> d
copypmap <C-u> u
copypmap <PAGEDOWN> n f <C-F> <Space>
copypmap <PAGEUP> p b <C-B>
# Basic
pmap <C-l> redraw_window
pmap <ESC> pager_close
copypmap <ESC> q Q i <F3>
pmap E edit_file
# ===================================================================
# == Taskview Keybindings
# ===================================================================
# Movement
tmap <up> taskview_move up=1
tmap <down> taskview_move down=1
tmap <home> taskview_move to=0
tmap <end> taskview_move to=-1
tmap <pagedown> taskview_move down=1.0 pages=True
tmap <pageup> taskview_move up=1.0 pages=True
tmap <C-d> taskview_move down=0.5 pages=True
tmap <C-u> taskview_move up=0.5 pages=True
copytmap <UP> k <C-p>
copytmap <DOWN> j <C-n> <CR>
copytmap <HOME> g
copytmap <END> G
copytmap <C-u> u
copytmap <PAGEDOWN> n f <C-F> <Space>
copytmap <PAGEUP> p b <C-B>
# Changing priority and deleting tasks
tmap J eval -q fm.ui.taskview.task_move(-1)
tmap K eval -q fm.ui.taskview.task_move(0)
tmap dd eval -q fm.ui.taskview.task_remove()
tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
tmap <delete> eval -q fm.ui.taskview.task_remove()
# Basic
tmap <C-l> redraw_window
tmap <ESC> taskview_close
copytmap <ESC> q Q w <C-c>

284
config/ranger/rifle.conf Normal file
View file

@ -0,0 +1,284 @@
# vim: ft=cfg
#
# This is the configuration file of "rifle", ranger's file executor/opener.
# Each line consists of conditions and a command. For each line the conditions
# are checked and if they are met, the respective command is run.
#
# Syntax:
# <condition1> , <condition2> , ... = command
#
# The command can contain these environment variables:
# $1-$9 | The n-th selected file
# $@ | All selected files
#
# If you use the special command "ask", rifle will ask you what program to run.
#
# Prefixing a condition with "!" will negate its result.
# These conditions are currently supported:
# match <regexp> | The regexp matches $1
# ext <regexp> | The regexp matches the extension of $1
# mime <regexp> | The regexp matches the mime type of $1
# name <regexp> | The regexp matches the basename of $1
# path <regexp> | The regexp matches the absolute path of $1
# has <program> | The program is installed (i.e. located in $PATH)
# env <variable> | The environment variable "variable" is non-empty
# file | $1 is a file
# directory | $1 is a directory
# number <n> | change the number of this command to n
# terminal | stdin, stderr and stdout are connected to a terminal
# X | A graphical environment is available (darwin, Xorg, or Wayland)
#
# There are also pseudo-conditions which have a "side effect":
# flag <flags> | Change how the program is run. See below.
# label <label> | Assign a label or name to the command so it can
# | be started with :open_with <label> in ranger
# | or `rifle -p <label>` in the standalone executable.
# else | Always true.
#
# Flags are single characters which slightly transform the command:
# f | Fork the program, make it run in the background.
# | New command = setsid $command >& /dev/null &
# r | Execute the command with root permissions
# | New command = sudo $command
# t | Run the program in a new terminal. If $TERMCMD is not defined,
# | rifle will attempt to extract it from $TERM.
# | New command = $TERMCMD -e $command
# Note: The "New command" serves only as an illustration, the exact
# implementation may differ.
# Note: When using rifle in ranger, there is an additional flag "c" for
# only running the current file even if you have marked multiple files.
#-------------------------------------------
# Websites
#-------------------------------------------
# Rarely installed browsers get higher priority; It is assumed that if you
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
# other hand are often only installed as fallback browsers.
ext x?html?, has surf, X, flag f = surf -- file://"$1"
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has dwb, X, flag f = dwb -- "$@"
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
ext x?html?, has luakit, X, flag f = luakit -- "$@"
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
ext x?html?, has midori, X, flag f = midori -- "$@"
ext x?html?, has opera, X, flag f = opera -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
ext x?html?, has links2, terminal = links2 "$@"
ext x?html?, has links, terminal = links "$@"
ext x?html?, has lynx, terminal = lynx -- "$@"
ext x?html?, has w3m, terminal = w3m "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
# Define the "editor" for text files as first action
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
#--------------------------------------------
# Scripts
#-------------------------------------------
ext py = python -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext sh = sh -- "$1"
ext php = php -- "$1"
#--------------------------------------------
# Audio without X
#-------------------------------------------
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
#--------------------------------------------
# Video/Audio with a GUI
#-------------------------------------------
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
mime ^video|audio, has totem, X, flag f = totem -- "$@"
mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
#--------------------------------------------
# Video without X
#-------------------------------------------
mime ^video, terminal, !X, has mpv = mpv -- "$@"
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
#-------------------------------------------
# Documents
#-------------------------------------------
ext pdf, has llpp, X, flag f = llpp "$@"
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has mupdf, X, flag f = mupdf "$@"
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
ext pdf, has evince, X, flag f = evince -- "$@"
ext pdf, has atril, X, flag f = atril -- "$@"
ext pdf, has okular, X, flag f = okular -- "$@"
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
ext pdf, has open, X, flag f = open "$@"
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
ext djvu, has zathura,X, flag f = zathura -- "$@"
ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
ext djvu, has djview, X, flag f = djview -- "$@"
ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
ext epub, has zathura, X, flag f = zathura -- "$@"
ext epub, has mupdf, X, flag f = mupdf -- "$@"
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
ext cbr, has zathura, X, flag f = zathura -- "$@"
ext cbz, has zathura, X, flag f = zathura -- "$@"
#-------------------------------------------
# Images
#-------------------------------------------
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
mime ^image, has imv, X, flag f = imv -- "$@"
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh -- "$@"
mime ^image, has mirage, X, flag f = mirage -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has eog, X, flag f = eog -- "$@"
mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has nomacs, X, flag f = nomacs -- "$@"
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"
#-------------------------------------------
# Archives
#-------------------------------------------
# avoid password prompt by providing empty password
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
# This requires atool
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
# Listing and extracting archives without atool:
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
ext zip, has unzip = unzip -l "$1" | less
ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done
ext ace, has unace = unace l "$1" | less
ext ace, has unace = for file in "$@"; do unace e "$file"; done
ext rar, has unrar = unrar l "$1" | less
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
#-------------------------------------------
# Fonts
#-------------------------------------------
mime ^font, has fontforge, X, flag f = fontforge "$@"
#-------------------------------------------
# Flag t fallback terminals
#-------------------------------------------
# Rarely installed terminal emulators get higher priority; It is assumed that
# if you install a rare terminal emulator, you probably use it.
# gnome-terminal/konsole/xterm on the other hand are often installed as part of
# a desktop environment or as fallback terminal emulators.
mime ^ranger/x-terminal-emulator, has terminology = terminology -e "$@"
mime ^ranger/x-terminal-emulator, has kitty = kitty -- "$@"
mime ^ranger/x-terminal-emulator, has alacritty = alacritty -e "$@"
mime ^ranger/x-terminal-emulator, has sakura = sakura -e "$@"
mime ^ranger/x-terminal-emulator, has lilyterm = lilyterm -e "$@"
#mime ^ranger/x-terminal-emulator, has cool-retro-term = cool-retro-term -e "$@"
mime ^ranger/x-terminal-emulator, has termite = termite -x '"$@"'
#mime ^ranger/x-terminal-emulator, has yakuake = yakuake -e "$@"
mime ^ranger/x-terminal-emulator, has guake = guake -ne "$@"
mime ^ranger/x-terminal-emulator, has tilda = tilda -c "$@"
mime ^ranger/x-terminal-emulator, has st = st -e "$@"
mime ^ranger/x-terminal-emulator, has terminator = terminator -x "$@"
mime ^ranger/x-terminal-emulator, has urxvt = urxvt -e "$@"
mime ^ranger/x-terminal-emulator, has pantheon-terminal = pantheon-terminal -e "$@"
mime ^ranger/x-terminal-emulator, has lxterminal = lxterminal -e "$@"
mime ^ranger/x-terminal-emulator, has mate-terminal = mate-terminal -x "$@"
mime ^ranger/x-terminal-emulator, has xfce4-terminal = xfce4-terminal -x "$@"
mime ^ranger/x-terminal-emulator, has konsole = konsole -e "$@"
mime ^ranger/x-terminal-emulator, has gnome-terminal = gnome-terminal -- "$@"
mime ^ranger/x-terminal-emulator, has xterm = xterm -e "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
#-------------------------------------------
# Generic file openers
#-------------------------------------------
label open, has xdg-open = xdg-open -- "$@"
label open, has open = open -- "$@"
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
######################################################################
# The actions below are left so low down in this file on purpose, so #
# they are never triggered accidentally. #
######################################################################
# Execute a file as program/script.
mime application/x-executable = "$1"
# Move the file to trash using trash-cli.
label trash, has trash-put = trash-put -- "$@"
label trash = mkdir -p -- ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash; mv -- "$@" ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash

350
config/ranger/scope.sh Executable file
View file

@ -0,0 +1,350 @@
#!/usr/bin/env bash
set -o noclobber -o noglob -o nounset -o pipefail
IFS=$'\n'
## If the option `use_preview_script` is set to `true`,
## then this script will be called and its output will be displayed in ranger.
## ANSI color codes are supported.
## STDIN is disabled, so interactive scripts won't work properly
## This script is considered a configuration file and must be updated manually.
## It will be left untouched if you upgrade ranger.
## Because of some automated testing we do on the script #'s for comments need
## to be doubled up. Code that is commented out, because it's an alternative for
## example, gets only one #.
## Meanings of exit codes:
## code | meaning | action of ranger
## -----+------------+-------------------------------------------
## 0 | success | Display stdout as preview
## 1 | no preview | Display no preview at all
## 2 | plain text | Display the plain content of the file
## 3 | fix width | Don't reload when width changes
## 4 | fix height | Don't reload when height changes
## 5 | fix both | Don't ever reload
## 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
## 7 | image | Display the file directly as an image
## Script arguments
FILE_PATH="${1}" # Full path of the highlighted file
PV_WIDTH="${2}" # Width of the preview pane (number of fitting characters)
## shellcheck disable=SC2034 # PV_HEIGHT is provided for convenience and unused
PV_HEIGHT="${3}" # Height of the preview pane (number of fitting characters)
IMAGE_CACHE_PATH="${4}" # Full path that should be used to cache image preview
PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise.
FILE_EXTENSION="${FILE_PATH##*.}"
FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')"
## Settings
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
HIGHLIGHT_TABWIDTH=${HIGHLIGHT_TABWIDTH:-8}
HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
OPENSCAD_IMGSIZE=${RNGR_OPENSCAD_IMGSIZE:-1000,1000}
OPENSCAD_COLORSCHEME=${RNGR_OPENSCAD_COLORSCHEME:-Tomorrow Night}
handle_extension() {
case "${FILE_EXTENSION_LOWER}" in
## Archive
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
atool --list -- "${FILE_PATH}" && exit 5
bsdtar --list --file "${FILE_PATH}" && exit 5
exit 1;;
rar)
## Avoid password prompt by providing empty password
unrar lt -p- -- "${FILE_PATH}" && exit 5
exit 1;;
7z)
## Avoid password prompt by providing empty password
7z l -p -- "${FILE_PATH}" && exit 5
exit 1;;
## PDF
pdf)
## Preview as text conversion
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | \
fmt -w "${PV_WIDTH}" && exit 5
mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | \
fmt -w "${PV_WIDTH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
exit 1;;
## BitTorrent
torrent)
transmission-show -- "${FILE_PATH}" && exit 5
exit 1;;
## OpenDocument
odt|ods|odp|sxw)
## Preview as text conversion
odt2txt "${FILE_PATH}" && exit 5
## Preview as markdown conversion
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
exit 1;;
## XLSX
xlsx)
## Preview as csv conversion
## Uses: https://github.com/dilshod/xlsx2csv
xlsx2csv -- "${FILE_PATH}" && exit 5
exit 1;;
## HTML
htm|html|xhtml)
## Preview as text conversion
w3m -dump "${FILE_PATH}" && exit 5
lynx -dump -- "${FILE_PATH}" && exit 5
elinks -dump "${FILE_PATH}" && exit 5
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
;;
## JSON
json)
jq --color-output . "${FILE_PATH}" && exit 5
python -m json.tool -- "${FILE_PATH}" && exit 5
;;
## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected
## by file(1).
dff|dsf|wv|wvc)
mediainfo "${FILE_PATH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
;; # Continue with next handler on failure
esac
}
handle_image() {
## Size of the preview if there are multiple options or it has to be
## rendered from vector graphics. If the conversion program allows
## specifying only one dimension while keeping the aspect ratio, the width
## will be used.
local DEFAULT_SIZE="1920x1080"
local mimetype="${1}"
case "${mimetype}" in
## SVG
# image/svg+xml|image/svg)
# convert -- "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
# exit 1;;
## DjVu
# image/vnd.djvu)
# ddjvu -format=tiff -quality=90 -page=1 -size="${DEFAULT_SIZE}" \
# - "${IMAGE_CACHE_PATH}" < "${FILE_PATH}" \
# && exit 6 || exit 1;;
## Image
image/*)
local orientation
orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )"
## If orientation data is present and the image actually
## needs rotating ("1" means no rotation)...
if [[ -n "$orientation" && "$orientation" != 1 ]]; then
## ...auto-rotate the image according to the EXIF data.
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
fi
## `w3mimgdisplay` will be called for all images (unless overriden
## as above), but might fail for unsupported types.
exit 7;;
## Video
# video/*)
# # Thumbnail
# ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
# exit 1;;
## PDF
# application/pdf)
# pdftoppm -f 1 -l 1 \
# -scale-to-x "${DEFAULT_SIZE%x*}" \
# -scale-to-y -1 \
# -singlefile \
# -jpeg -tiffcompression jpeg \
# -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
# && exit 6 || exit 1;;
## ePub, MOBI, FB2 (using Calibre)
# application/epub+zip|application/x-mobipocket-ebook|\
# application/x-fictionbook+xml)
# # ePub (using https://github.com/marianosimone/epub-thumbnailer)
# epub-thumbnailer "${FILE_PATH}" "${IMAGE_CACHE_PATH}" \
# "${DEFAULT_SIZE%x*}" && exit 6
# ebook-meta --get-cover="${IMAGE_CACHE_PATH}" -- "${FILE_PATH}" \
# >/dev/null && exit 6
# exit 1;;
## Font
application/font*|application/*opentype)
preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png"
if fontimage -o "${preview_png}" \
--pixelsize "120" \
--fontname \
--pixelsize "80" \
--text " ABCDEFGHIJKLMNOPQRSTUVWXYZ " \
--text " abcdefghijklmnopqrstuvwxyz " \
--text " 0123456789.:,;(*!?') ff fl fi ffi ffl " \
--text " The quick brown fox jumps over the lazy dog. " \
"${FILE_PATH}";
then
convert -- "${preview_png}" "${IMAGE_CACHE_PATH}" \
&& rm "${preview_png}" \
&& exit 6
else
exit 1
fi
;;
## Preview archives using the first image inside.
## (Very useful for comic book collections for example.)
# application/zip|application/x-rar|application/x-7z-compressed|\
# application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
# local fn=""; local fe=""
# local zip=""; local rar=""; local tar=""; local bsd=""
# case "${mimetype}" in
# application/zip) zip=1 ;;
# application/x-rar) rar=1 ;;
# application/x-7z-compressed) ;;
# *) tar=1 ;;
# esac
# { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \
# { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \
# { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
# { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
#
# fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
# [ print(l, end='') for l in sys.stdin if \
# (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
# sort -V | head -n 1)
# [ "$fn" = "" ] && return
# [ "$bsd" ] && fn=$(printf '%b' "$fn")
#
# [ "$tar" ] && tar --extract --to-stdout \
# --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
# fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
# [ "$bsd" ] && bsdtar --extract --to-stdout \
# --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6
# [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}"
# [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \
# "${IMAGE_CACHE_PATH}" && exit 6
# [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \
# "${IMAGE_CACHE_PATH}" && exit 6
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
# ;;
esac
# openscad_image() {
# TMPPNG="$(mktemp -t XXXXXX.png)"
# openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \
# --imgsize="${OPENSCAD_IMGSIZE/x/,}" \
# -o "${TMPPNG}" "${1}"
# mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
# }
# case "${FILE_EXTENSION_LOWER}" in
# ## 3D models
# ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
# ## is hardcoded as jpeg. So we make a tempfile.png and just
# ## move/rename it to jpg. This works because image libraries are
# ## smart enough to handle it.
# csg|scad)
# openscad_image "${FILE_PATH}" && exit 6
# ;;
# 3mf|amf|dxf|off|stl)
# openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
# ;;
# esac
}
handle_mime() {
local mimetype="${1}"
case "${mimetype}" in
## RTF and DOC
text/rtf|*msword)
## Preview as text conversion
## note: catdoc does not always work for .doc files
## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/
catdoc -- "${FILE_PATH}" && exit 5
exit 1;;
## DOCX, ePub, FB2 (using markdown)
## You might want to remove "|epub" and/or "|fb2" below if you have
## uncommented other methods to preview those formats
*wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml)
## Preview as markdown conversion
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
exit 1;;
## XLS
*ms-excel)
## Preview as csv conversion
## xls2csv comes with catdoc:
## http://www.wagner.pp.ru/~vitus/software/catdoc/
xls2csv -- "${FILE_PATH}" && exit 5
exit 1;;
## Text
text/* | */xml)
## Syntax highlight
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
exit 2
fi
if [[ "$( tput colors )" -ge 256 ]]; then
local pygmentize_format='terminal256'
local highlight_format='xterm256'
else
local pygmentize_format='terminal'
local highlight_format='ansi'
fi
env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
--out-format="${highlight_format}" \
--force -- "${FILE_PATH}" && exit 5
env COLORTERM=8bit bat --color=always --style="plain" \
-- "${FILE_PATH}" && exit 5
pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
-- "${FILE_PATH}" && exit 5
exit 2;;
## DjVu
image/vnd.djvu)
## Preview as text conversion (requires djvulibre)
djvutxt "${FILE_PATH}" | fmt -w "${PV_WIDTH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
exit 1;;
## Image
image/*)
## Preview as text conversion
# img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
exiftool "${FILE_PATH}" && exit 5
exit 1;;
## Video and audio
video/* | audio/*)
mediainfo "${FILE_PATH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
exit 1;;
esac
}
handle_fallback() {
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5
exit 1
}
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
handle_image "${MIMETYPE}"
fi
handle_extension
handle_mime "${MIMETYPE}"
handle_fallback
exit 1

View file

@ -0,0 +1,187 @@
/* ==========================================================================
Everforest dark theme for rofi
Based on the Everforest color scheme for Vim by sainnhe
https://github.com/sainnhe/everforest/
========================================================================== */
* {
/* Theme settings */
highlight: bold italic;
scrollbar: true;
/* Everforest colors */
everforest-bg0: #323d43;
everforest-bg1: #525c6d;
everforest-fg: #d8cacc;
everforest-black: #4a555b;
everforest-dark-grey: #525c62;
everforest-dark-red: #e26c6e;
everforest-red: #e68183;
everforest-dark-yellow: #d5b26b;
everforest-yellow: #dbbc7f;
everforest-dark-blue: #6eb2a9;
everforest-blue: #7fbbb3;
everforest-dark-magenta: #cf87a9;
everforest-magenta: #d699b6;
everforest-dark-cyan: #72b783;
everforest-cyan: #83c092;
everforest-light-grey: #d8caac;
everforest-white: #d8caac;
/* Theme colors */
background: @everforest-bg0;
background-color: @background;
foreground: @everforest-fg;
border-color: @everforest-dark-yellow;
separatorcolor: @border-color;
scrollbar-handle: @border-color;
normal-background: @background;
normal-foreground: @foreground;
alternate-normal-background: @everforest-bg1;
alternate-normal-foreground: @foreground;
selected-normal-background: @everforest-dark-cyan;
selected-normal-foreground: @everforest-black;
active-background: @everforest-yellow;
active-foreground: @background;
alternate-active-background: @active-background;
alternate-active-foreground: @active-foreground;
selected-active-background: @everforest-cyan;
selected-active-foreground: @active-foreground;
urgent-background: @everforest-dark-red;
urgent-foreground: @background;
alternate-urgent-background: @urgent-background;
alternate-urgent-foreground: @urgent-foreground;
selected-urgent-background: @everforest-red;
selected-urgent-foreground: @urgent-foreground;
}
window {
background-color: @background;
border: 2;
padding: 2;
}
mainbox {
border: 0;
padding: 0;
}
message {
border: 2px 0 0;
border-color: @separatorcolor;
padding: 1px;
}
textbox {
highlight: @highlight;
text-color: @foreground;
}
listview {
border: 2px solid 0 0;
padding: 2px 0 0;
border-color: @separatorcolor;
spacing: 2px;
scrollbar: @scrollbar;
}
element {
border: 0;
padding: 2px;
}
element.normal.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}
element.normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
element.normal.active {
background-color: @active-background;
text-color: @active-foreground;
}
element.selected.normal {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
}
element.selected.urgent {
background-color: @selected-urgent-background;
text-color: @selected-urgent-foreground;
}
element.selected.active {
background-color: @selected-active-background;
text-color: @selected-active-foreground;
}
element.alternate.normal {
background-color: @alternate-normal-background;
text-color: @alternate-normal-foreground;
}
element.alternate.urgent {
background-color: @alternate-urgent-background;
text-color: @alternate-urgent-foreground;
}
element.alternate.active {
background-color: @alternate-active-background;
text-color: @alternate-active-foreground;
}
scrollbar {
width: 4px;
border: 0;
handle-color: @scrollbar-handle;
handle-width: 8px;
padding: 0;
}
mode-switcher {
border: 2px 0 0;
border-color: @separatorcolor;
}
inputbar {
spacing: 0;
text-color: @normal-foreground;
padding: 2px;
children: [ prompt, textbox-prompt-sep, entry, case-indicator ];
}
case-indicator,
entry,
prompt,
button {
spacing: 0;
text-color: @normal-foreground;
}
button.selected {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
}
textbox-prompt-sep {
expand: false;
str: ":";
text-color: @normal-foreground;
margin: 0 0.3em 0 0;
}
element-text, element-icon {
background-color: inherit;
text-color: inherit;
}

142
config/sxhkd/sxhkdrc Normal file
View file

@ -0,0 +1,142 @@
#
# wm independent hotkeys
#
# terminal emulator
super + Return
kitty
# program launcher
super + @space
rofi -modi drun, run -show drun -show-icons
# power menu
super + @End
rofi -show power-menu -modi power-menu:/usr/bin/rofi-power-menu
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
# Show list of open windows
alt + @Tab
rofi -show window
# Lock the screen
ctrl + alt + l
xset s activate
# Screenshot
Print
maim | xclip -selection clipboard -t image/png
alt + Print
maim -s | xclip -selection clipboard -t image/png
shift + Print
maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png
# bspwm hotkeys
#
# quit/restart bspwm
super + alt + {q,r}
bspc {quit,wm -r}
# close and kill
super + {_,shift + }q
bspc node -{c,k}
# alternate between the tiled and monocle layout
super + m
bspc desktop -l next
# send the newest marked node to the newest preselected node
super + y
bspc node newest.marked.local -n newest.!automatic.local
# swap the current node and the biggest window
super + g
bspc node -s biggest.window
#
# state/flags
#
# set the window state
super + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# set the node flags
super + ctrl + {m,x,y,z}
bspc node -g {marked,locked,sticky,private}
#
# focus/swap
#
# focus the node in the given direction
super + {_,shift + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# focus the node for the given path jump
super + {p,b,comma,period}
bspc node -f @{parent,brother,first,second}
# focus the next/previous window in the current desktop
super + {_,shift + }c
bspc node -f {next,prev}.local.!hidden.window
# focus the next/previous desktop in the current monitor
super + bracket{left,right}
bspc desktop -f {prev,next}.local
# focus the last node/desktop
super + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer node in the focus history
super + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
super + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
#
# preselect
#
# preselect the direction
super + ctrl + {h,j,k,l}
bspc node -p {west,south,north,east}
# preselect the ratio
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# cancel the preselection for the focused node
super + ctrl + space
bspc node -p cancel
# cancel the preselection for the focused desktop
super + ctrl + shift + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
#
# move/resize
#
# expand a window by moving one of its side outward
super + alt + {h,j,k,l}
bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
# contract a window by moving one of its side inward
super + alt + shift + {h,j,k,l}
bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}

View file

@ -0,0 +1,6 @@
Net/IconThemeName "Papirus-Dark"
Net/ThemeName "Materia-dark"
Xft/Hinting 1
Xft/HintStyle "hintfull"
Xft/Antialias 1
Xft/RGBA "rgb"

View file

@ -6,9 +6,10 @@
(scroll-bar-mode -1) ; Disable visible scrollbar (scroll-bar-mode -1) ; Disable visible scrollbar
(tool-bar-mode -1) ; Disable the toolbar (tool-bar-mode -1) ; Disable the toolbar
(tooltip-mode -1) ; Disable tooltips (tooltip-mode -1) ; Disable tooltips
(set-fringe-mode 10) ; Give some breathing room (set-fringe-mode 10) ; Add come extra space to the left/right sides
(menu-bar-mode -1) ; Disable the menu bar (menu-bar-mode -1) ; Disable the menu bar
(setq-default custom-file null-device) ; Write customizations not in this file to the null device (AKA stop littering in my init.el) (setq-default custom-file null-device) ; Write customizations not in this file to the null device (AKA stop littering in my init.el)
(setq confirm-kill-processes nil) ; Stop asking about running processes on exit
;; Visible bell ;; Visible bell
(setq visible-bell t) (setq visible-bell t)
@ -67,11 +68,11 @@
conf-mode-hook)) conf-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 1)))) (add-hook mode (lambda () (display-line-numbers-mode 1))))
;; Show vertical line at column 80 to keep code clean in prog-mode ;; Show vertical line at column 80 in prog-mode
(setq-default fill-column 80) (setq-default fill-column 80)
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode) (add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
; Override some modes which derive from the above ; No line numbers in org-mode
(dolist (mode '(org-mode-hook)) (dolist (mode '(org-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0)))) (add-hook mode (lambda () (display-line-numbers-mode 0))))
@ -121,9 +122,7 @@
(setq custom-safe-themes t) (setq custom-safe-themes t)
;; (use-package everforest ;; (use-package everforest
;; :straight (:type git :repo "https://git.sr.ht/~theorytoe/everforest-theme") ;; :straight (:type git :repo "https://git.sr.ht/~theorytoe/everforest-theme"))
;; :config
;; (load-theme 'everforest-hard-dark t))
;; (use-package gruvbox-theme ;; (use-package gruvbox-theme
;; :config ;; :config
@ -292,7 +291,8 @@
(eval-when-compile (eval-when-compile
(require 'cl-lib)) (require 'cl-lib))
(require 'dap-python) (require 'dap-python)
(require 'dap-node) ;(require 'dap-node)
(require 'dap-lldb)
:bind :bind
(:map dap-mode-map (:map dap-mode-map
("<f5>" . dap-debug) ("<f5>" . dap-debug)
@ -335,8 +335,9 @@
;; C/C++ ;; C/C++
;(setq-default c-default-style "k&r") (setq dap-lldb-debug-program '("/usr/bin/lldb-vscode"))
;(setq-default c-basic-offset 2) (setq-default c-default-style "k&r")
(setq-default c-basic-offset 2)
;(use-package ccls ;(use-package ccls
; :hook ((c-mode c++-mode objc-mode cuda-mode) . ; :hook ((c-mode c++-mode objc-mode cuda-mode) .
@ -348,9 +349,9 @@
;; Golang ;; Golang
(use-package go-mode ;; (use-package go-mode
:config ;; :config
(add-hook 'before-save-hook #'lsp-organize-imports)) ;; (add-hook 'before-save-hook #'lsp-organize-imports))
;; Java ;; Java
@ -358,35 +359,35 @@
;; JavaScript/TypeScript, HTML, CSS ;; JavaScript/TypeScript, HTML, CSS
(setq css-indent-level 2) ;; (setq css-indent-level 2)
(setq css-indent-offset 2) ;; (setq css-indent-offset 2)
(setq js-indent-level 2) ;; (setq js-indent-level 2)
(add-to-list 'auto-mode-alist '("\\.mjs\\'" . js-mode)) ;; (add-to-list 'auto-mode-alist '("\\.mjs\\'" . js-mode))
(use-package js2-mode ;; (use-package js2-mode
:config ;; :config
(add-to-list 'interpreter-mode-alist '("#!/usr/bin/env node" . js2-mode)) ;; (add-to-list 'interpreter-mode-alist '("#!/usr/bin/env node" . js2-mode))
;(setq js2-strict-missing-semi-warning t) ;; ;(setq js2-strict-missing-semi-warning t)
(setq js2-mode-show-strict-warnings t) ;; (setq js2-mode-show-strict-warnings t)
:hook (js-mode . js2-minor-mode)) ;; :hook (js-mode . js2-minor-mode))
(use-package typescript-mode ;; (use-package typescript-mode
:config ;; :config
(setq typescript-indent-level 2) ;; (setq typescript-indent-level 2)
:mode ("\\.ts\\'" . typescript-mode) ;; :mode ("\\.ts\\'" . typescript-mode)
("\\.tsx\\'" . typescript-mode)) ;; ("\\.tsx\\'" . typescript-mode))
(use-package restclient ;; (use-package restclient
:init ;; :init
(use-package company-restclient) ;; (use-package company-restclient)
:mode ("\\.http\\'" . restclient-mode)) ;; :mode ("\\.http\\'" . restclient-mode))
(use-package rainbow-mode ;; (use-package rainbow-mode
:hook ;; :hook
((js-mode . rainbow-mode) ;; ((js-mode . rainbow-mode)
(typescript-mode . rainbow-mode) ;; (typescript-mode . rainbow-mode)
(web-mode . rainbow-mode))) ;; (web-mode . rainbow-mode)))
;; (use-package skewer-mode ;; (use-package skewer-mode
;; :init ;; :init
@ -403,36 +404,36 @@
;; (use-package simple-httpd) ;; (use-package simple-httpd)
(use-package web-mode ;; (use-package web-mode
:config ;; :config
(setq web-mode-code-indent-offset 2) ;; (setq web-mode-code-indent-offset 2)
(setq web-mode-markup-indent-offset 2) ;; (setq web-mode-markup-indent-offset 2)
(setq web-mode-attribute-indent-offset 2) ;; (setq web-mode-attribute-indent-offset 2)
:mode ;; :mode
(("\\.phtml\\'" . web-mode) ;; (("\\.phtml\\'" . web-mode)
("\\.tpl\\.php\\'" . web-mode) ;; ("\\.tpl\\.php\\'" . web-mode)
("\\.jsp\\'" . web-mode) ;; ("\\.jsp\\'" . web-mode)
("\\.as[cp]x\\'" . web-mode) ;; ("\\.as[cp]x\\'" . web-mode)
("\\.erb\\'" . web-mode) ;; ("\\.erb\\'" . web-mode)
("\\.mustache\\'" . web-mode) ;; ("\\.mustache\\'" . web-mode)
("\\.djhtml\\'" . web-mode) ;; ("\\.djhtml\\'" . web-mode)
("\\.jst.ejs\\'" . web-mode) ;; ("\\.jst.ejs\\'" . web-mode)
("\\.html?\\'" . web-mode))) ;; ("\\.html?\\'" . web-mode)))
(use-package jsdoc ;; (use-package jsdoc
:straight (jsdoc :type git :host github :repo "isamert/jsdoc.el") ;; :straight (jsdoc :type git :host github :repo "isamert/jsdoc.el")
:bind ("C-c C-n" . jsdoc)) ;; :bind ("C-c C-n" . jsdoc))
;; LaTeX ;; LaTeX
(use-package lsp-latex) ;; (use-package lsp-latex)
(setq lsp-tex-server 'digestif) ;; (setq lsp-tex-server 'digestif)
;; Protocol Buffers ;; Protocol Buffers
(use-package protobuf-mode) ;; (use-package protobuf-mode)
;; Python ;; Python
@ -450,6 +451,17 @@
:config :config
(setq numpydoc-insert-examples-block nil)) (setq numpydoc-insert-examples-block nil))
(use-package conda
:init
(setq conda-anaconda-home (expand-file-name "/opt/miniconda3"))
(setq conda-env-home-directory (expand-file-name "~/.conda/envs"))
(conda-env-initialize-interactive-shells)
;(conda-env-autoactivate-mode)
:hook
('find-file-hook . (lambda ()
(when (bound-and-true-p conda-project-env-path)
(conda-env-activate-for-buffer)))))
;; Rust ;; Rust
;(use-package rust-mode) ;(use-package rust-mode)
@ -467,7 +479,9 @@
;; Syntax checking ;; Syntax checking
(use-package flycheck (use-package flycheck
:hook (lsp-mode . flycheck-mode)) :hook (lsp-mode . flycheck-mode)
:config
(setq flycheck-python-flake8-executable "flake8"))
;; Templating ;; Templating
(use-package yasnippet (use-package yasnippet
@ -481,3 +495,4 @@
(use-package yasnippet-snippets) (use-package yasnippet-snippets)
;;; End init.el ;;; End init.el

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# key : 161
# group: school
# name : cs hw header
# --
# Author: $1
# Date: `(format-time-string "%m-%d-%Y")`$0
# Description: $2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 240 KiB

81
install.sh Executable file
View file

@ -0,0 +1,81 @@
#!/bin/bash
backup=~/dotfiles_backup
log_file=~/dotfiles_install.log
dotfiles_dir=~/.dotfiles
config_dir=~/.config
bin_dir=~/.local/bin
## Logging
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>$log_file 2>&1
## Backup current files and folders
mkdir -p $backup
cp -a ~/.bash_profile $backup/
cp -a ~/.bashrc $backup/
cp -a ~/.profile $backup/
cp -a ~/.emacs $backup/
cp -a ~/.emacs.d $backup/
cp -a ~/.Xresources $backup/
cp -a $config_dir/bspwm $backup/
cp -a $config_dir/dunst $backup/
cp -a $config_dir/kitty $backup/
cp -a $config_dir/nvim $backup/
cp -a $config_dir/polybar $backup/
cp -a $bin_dir $backup/
# Delete current files and folders
rm -rf ~/.bash_profile
rm -rf ~/.bashrc
rm -rf ~/.profile
rm -rf ~/.emacs
rm -rf ~/.emacs.d
rm -rf ~/.Xresources
rm -rf $config_dir/bspwm
rm -rf $config_dir/dunst
rm -rf $config_dir/kitty
rm -rf $config_dir/nvim
rm -rf $config_dir/polybar
rm -rf $bin_dir
# Create HOME symlinks
ln -sf $dotfiles_dir/bashrc ~/.bashrc
ln -sf $dotfiles_dir/bash_profile ~/.bash_profile
ln -sf $dotfiles_dir/profile ~/.profile
ln -sf $dotfiles_dir/emacs.d ~/.emacs.d
ln -sf $dotfiles_dir/xinitrc ~/.xinitrc
ln -sf $dotfiles_dir/vimrc ~/.vimrc
ln -sf $dotfiles_dir/Xresources ~/.Xresources
# Create $config_dir, sub-directories, and symlinks
mkdir -p $config_dir/{bspwm,dunst,kitty,nvim,polybar,rofi,sxhkd}
ln -sf $dotfiles_dir/config/bspwm/bspwmrc $config_dir/bspwm/bspwmrc
ln -sf $dotfiles_dir/config/dunst/dunstrc $config_dir/dunst/dunstrc
ln -sf $dotfiles_dir/config/kitty/kitty.conf $config_dir/kitty/kitty.conf
#ln -sf $dotfiles_dir/config/kitty/gruvbox.conf $config_dir/kitty/gruvbox.conf
ln -sf $dotfiles_dir/config/kitty/zenburn.conf $config_dir/kitty/zenburn.conf
ln -sf $dotfiles_dir/config/nvim/init.vim $config_dir/nvim/init.vim
ln -sf $dotfiles_dir/config/polybar/config.ini $config_dir/polybar/config.ini
ln -sf $dotfiles_dir/config/polybar/colors.ini $config_dir/polybar/colors.ini
ln -sf $dotfiles_dir/config/polybar/modules.ini $config_dir/polybar/modules.ini
ln -sf $dotfiles_dir/config/polybar/custom_modules.ini $config_dir/polybar/custom_modules.ini
ln -sf $dotfiles_dir/config/rofi/config.everforest.rasi $config_dir/rofi/config.rasi
#ln -sf $dotfiles_dir/config/rofi/config.gruvbox.rasi $config_dir/rofi/config.rasi
#ln -sf $dotfiles_dir/config/rofi/config.zenburn.rasi $config_dir/rofi/config.rasi
ln -sf $dotfiles_dir/config/sxhkd/sxhkdrc $config_dir/sxhkd/sxhkdrc
# Create $bin_dir and symlinks
mkdir -p $bin_dir
ln -sf $dotfiles_dir/bin/mirror-outputs $bin_dir
ln -sf $dotfiles_dir/bin/single-polybar-launcher $bin_dir
ln -sf $dotfiles_dir/bin/toggle-wifi $bin_dir
# Finishing up
source ~/.bashrc
source ~/.bash_profile
source ~/.profile
xrdb ~/.Xresources

4
profile Normal file
View file

@ -0,0 +1,4 @@
# make Java behave when not using a DE
export _JAVA_AWT_WM_NONREPARENTING=1
# add .local/bin to $PATH
export PATH="$HOME/.local/bin:$PATH"

View file

@ -48,5 +48,6 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then
unset f unset f
fi fi
numlockx &
xsetroot -cursor_name left_ptr & xsetroot -cursor_name left_ptr &
exec bspwm exec bspwm