first commit
This commit is contained in:
3
profiles/desktop/.Xresources
Normal file
3
profiles/desktop/.Xresources
Normal file
@@ -0,0 +1,3 @@
|
||||
#include ".Xresources.d/rxvt-unicode"
|
||||
#include ".Xresources.d/fonts"
|
||||
#include ".Xresources.d/themes/Elementary"
|
||||
6
profiles/desktop/.Xresources.d/fonts
Normal file
6
profiles/desktop/.Xresources.d/fonts
Normal file
@@ -0,0 +1,6 @@
|
||||
Xft.antialias: true
|
||||
Xft.rgba: rgb
|
||||
Xft.hinting: true
|
||||
Xft.hintstyle: hintslight
|
||||
Xft.autohint: true
|
||||
Xft.lcdfilter: lcddefault
|
||||
47
profiles/desktop/.Xresources.d/rxvt-unicode
Normal file
47
profiles/desktop/.Xresources.d/rxvt-unicode
Normal file
@@ -0,0 +1,47 @@
|
||||
! terminal font
|
||||
URxvt.font: xft:Hack Nerd Font:size=10:style=Regular
|
||||
URxvt.boldFont: xft:Hack Nerd Font:size=10:style=Bold
|
||||
URxvt.italicFont: xft:Hack Nerd Font:size=10:style=Italic
|
||||
URxvt.boldItalicFont: xft:Hack Nerd Font:size=10:style=Bold Italic
|
||||
URxvt.letterSpace: -1
|
||||
URxvt.lineSpace: -1
|
||||
|
||||
! scrollback buffer lines - 65535 is max on most machines (64 is default)
|
||||
URxvt.saveLines: 16384
|
||||
|
||||
! scroll bar
|
||||
URxvt.scrollBar: false
|
||||
URxvt.scrollBar_right: false
|
||||
URxvt.scrollBar_floating: false
|
||||
URxvt.scrollstyle: rxvt
|
||||
|
||||
! transparency
|
||||
URxvt.inheritPixmap: true
|
||||
URxvt.transparent: true
|
||||
! URxvt*shading: 0 to 99 darkens, 101 to 200 lightens
|
||||
URxvt.shading: 20
|
||||
|
||||
! The string will be interpreted as if typed into the shell as-is.
|
||||
! In this example, printing will be disabled altogether.
|
||||
URxvt.print-pipe: "cat > /dev/null"
|
||||
|
||||
!-*- Perl extensions -*-
|
||||
URxvt.perl-ext-common: default,selection-to-clipboard,matcher,keyboard-select,url-select,font-size,clipboard
|
||||
URxvt.keysym.M-u: perl:url-select:select_next
|
||||
URxvt.url-select.button: 1
|
||||
URxvt.url-select.launcher: chromium
|
||||
URxvt.url-select.underline: true
|
||||
URxvt.keysym.M-Escape:perl:keyboard-select:activate
|
||||
! The following configuration will automatically update the CLIPBOARD when the PRIMARY selection changes
|
||||
! This is deprecated since Control-Alt-C/V has been implemented since 9.20
|
||||
URxvt.clipboard.autocopy: true
|
||||
URxvt.keysym.C-V: clipboard:paste
|
||||
URxvt.keysym.C-Up: font-size:increase
|
||||
URxvt.keysym.C-Down: font-size:decrease
|
||||
URxvt.keysym.C-S-Up: font-size:incglobal
|
||||
URxvt.keysym.C-S-Down: font-size:decglobal
|
||||
URxvt.keysym.C-equal: font-size:reset
|
||||
URxvt.keysym.C-slash: font-size:show
|
||||
|
||||
! fix geometry
|
||||
URxvt.geometry: 400x400
|
||||
44
profiles/desktop/.Xresources.d/themes/Elementary
Normal file
44
profiles/desktop/.Xresources.d/themes/Elementary
Normal file
@@ -0,0 +1,44 @@
|
||||
!
|
||||
! Generated with :
|
||||
! XRDB2Xreources.py
|
||||
!
|
||||
*.foreground: #efefef
|
||||
*.background: #000000
|
||||
*.cursorColor: #bbbbbb
|
||||
!
|
||||
! Black
|
||||
*.color0: #000000
|
||||
*.color8: #5d5d5d
|
||||
!
|
||||
! Red
|
||||
*.color1: #e1321a
|
||||
*.color9: #ff361e
|
||||
!
|
||||
! Green
|
||||
*.color2: #6ab017
|
||||
*.color10: #7bc91f
|
||||
!
|
||||
! Yellow
|
||||
*.color3: #ffc005
|
||||
*.color11: #ffd00a
|
||||
!
|
||||
! Blue
|
||||
*.color4: #004f9e
|
||||
*.color12: #0071ff
|
||||
!
|
||||
! Magenta
|
||||
*.color5: #ec0048
|
||||
*.color13: #ff1d62
|
||||
!
|
||||
! Cyan
|
||||
*.color6: #2aa7e7
|
||||
*.color14: #4bb8fd
|
||||
!
|
||||
! White
|
||||
*.color7: #f2f2f2
|
||||
*.color15: #ffffff
|
||||
!
|
||||
! Bold, Italic, Underline
|
||||
*.colorBD: #ffffff
|
||||
!*.colorIT:
|
||||
!*.colorUL:
|
||||
85
profiles/desktop/.alacritty.toml
Normal file
85
profiles/desktop/.alacritty.toml
Normal file
@@ -0,0 +1,85 @@
|
||||
[env]
|
||||
TERM = 'xterm-256color'
|
||||
|
||||
[cursor]
|
||||
style = 'Underline'
|
||||
|
||||
[[keyboard.bindings]]
|
||||
key = 'V'
|
||||
mods = 'Control|Alt'
|
||||
action = 'Paste'
|
||||
|
||||
[[keyboard.bindings]]
|
||||
key = 'C'
|
||||
mods = 'Control|Alt'
|
||||
action = 'Copy'
|
||||
|
||||
[[keyboard.bindings]]
|
||||
key = 'V'
|
||||
mods = 'Control|Shift'
|
||||
action = 'None'
|
||||
|
||||
[[keyboard.bindings]]
|
||||
key = 'C'
|
||||
mods = 'Control|Shift'
|
||||
action = 'None'
|
||||
|
||||
# Colors (Elementary)
|
||||
|
||||
[colors.bright]
|
||||
black = '#5d5d5d'
|
||||
blue = '#0071ff'
|
||||
cyan = '#4bb8fd'
|
||||
green = '#7bc91f'
|
||||
magenta = '#ff1d62'
|
||||
red = '#ff361e'
|
||||
white = '#ffffff'
|
||||
yellow = '#ffd00a'
|
||||
|
||||
[colors.cursor]
|
||||
cursor = '#bbbbbb'
|
||||
text = '#ffffff'
|
||||
|
||||
[colors.normal]
|
||||
black = '#000000'
|
||||
blue = '#004f9e'
|
||||
cyan = '#2aa7e7'
|
||||
green = '#6ab017'
|
||||
magenta = '#ec0048'
|
||||
red = '#e1321a'
|
||||
white = '#f2f2f2'
|
||||
yellow = '#ffc005'
|
||||
|
||||
[colors.primary]
|
||||
background = '#000000'
|
||||
foreground = '#efefef'
|
||||
|
||||
[colors.selection]
|
||||
background = '#b5d5ff'
|
||||
text = '#000000'
|
||||
|
||||
[window]
|
||||
opacity = 0.9
|
||||
|
||||
[font]
|
||||
size = 15.0
|
||||
|
||||
[font.offset]
|
||||
x = -1
|
||||
y = -1
|
||||
|
||||
[font.bold]
|
||||
family = 'Hack Nerd Font Mono'
|
||||
style = 'Bold'
|
||||
|
||||
[font.bold_italic]
|
||||
family = 'Hack Nerd Font Mono'
|
||||
style = 'Bold Italic'
|
||||
|
||||
[font.italic]
|
||||
family = 'Hack Nerd Font Mono'
|
||||
style = 'Italic'
|
||||
|
||||
[font.normal]
|
||||
family = 'Hack Nerd Font Mono'
|
||||
style = 'Regular'
|
||||
20
profiles/desktop/.config/Trolltech.conf
Normal file
20
profiles/desktop/.config/Trolltech.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
[Qt]
|
||||
style=GTK+
|
||||
|
||||
[qt]
|
||||
GUIEffects=none
|
||||
KDE\contrast=7
|
||||
KWinPalette\activeBackground=#272727
|
||||
KWinPalette\activeBlend=#272727
|
||||
KWinPalette\activeForeground=#dfdfdf
|
||||
KWinPalette\activeTitleBtnBg=#121212
|
||||
KWinPalette\frame=#121212
|
||||
KWinPalette\inactiveBackground=#1e1e1e
|
||||
KWinPalette\inactiveBlend=#1e1e1e
|
||||
KWinPalette\inactiveForeground=#8b8b8b
|
||||
KWinPalette\inactiveFrame=#121212
|
||||
KWinPalette\inactiveTitleBtnBg=#121212
|
||||
Palette\active=#dfdfdf, #2e2e2e, #dbdbdb, #b2b2b2, #949494, #6d6d6d, #dfdfdf, #ffffff, #ffffff, #1e1e1e, #121212, #b2b2b2, #285616, #ffffff, #5be026, #ad65af, #2d2d2d, #000000, #616161, #dfdfdf, #696969, #285616
|
||||
Palette\disabled=#565656, #2c2c2c, #dbdbdb, #b2b2b2, #949494, #6d6d6d, #5d5d5d, #ffffff, #727272, #1d1d1d, #111111, #b2b2b2, #111111, #565656, #315d1f, #4c344d, #2b2b2b, #000000, #616161, #dfdfdf, #363636, #111111
|
||||
Palette\inactive=#dfdfdf, #2e2e2e, #dbdbdb, #b2b2b2, #949494, #6d6d6d, #dfdfdf, #ffffff, #ffffff, #1e1e1e, #121212, #b2b2b2, #15290d, #dfdfdf, #5be026, #ad65af, #2d2d2d, #000000, #616161, #dfdfdf, #696969, #15290d
|
||||
font="Noto Sans,10,-1,0,400,0,0,0,0,0,0,0,0,0,0,1"
|
||||
171841
profiles/desktop/.config/aacs/KEYDB.cfg
Normal file
171841
profiles/desktop/.config/aacs/KEYDB.cfg
Normal file
File diff suppressed because it is too large
Load Diff
2
profiles/desktop/.config/ctpv/config
Normal file
2
profiles/desktop/.config/ctpv/config
Normal file
@@ -0,0 +1,2 @@
|
||||
priority bat
|
||||
set chafasixel
|
||||
25
profiles/desktop/.config/dunst/dunstrc
Normal file
25
profiles/desktop/.config/dunst/dunstrc
Normal file
@@ -0,0 +1,25 @@
|
||||
[global]
|
||||
font = Hack Nerd Font 12
|
||||
enable_recursive_icon_lookup = true
|
||||
icon_theme = "Numix-Circle"
|
||||
width = 550
|
||||
offset = 10x10
|
||||
gap_size = 5
|
||||
|
||||
[urgency_low]
|
||||
background = "#066d01"
|
||||
foreground = "#eeeeee"
|
||||
frame_color = "#044201"
|
||||
timeout = 5
|
||||
|
||||
[urgency_normal]
|
||||
background = "#066d01"
|
||||
foreground = "#eeeeee"
|
||||
frame_color = "#044201"
|
||||
timeout = 10
|
||||
|
||||
[urgency_critical]
|
||||
background = "#6d0a01"
|
||||
foreground = "#eeeeee"
|
||||
frame_color = "#420601"
|
||||
timeout = 20
|
||||
37
profiles/desktop/.config/foot/foot.ini
Normal file
37
profiles/desktop/.config/foot/foot.ini
Normal file
@@ -0,0 +1,37 @@
|
||||
[main]
|
||||
font=Hack Nerd Font Mono:size=15
|
||||
font-bold=Hack Nerd Font Mono:size=15:style=Bold
|
||||
font-italic=Hack Nerd Font Mono:size=15:style=Italic
|
||||
font-bold-italic=Hack Nerd Font Mono:size=15:style=Bold Italic
|
||||
line-height=17
|
||||
letter-spacing=-1
|
||||
|
||||
[cursor]
|
||||
style=underline
|
||||
|
||||
[key-bindings]
|
||||
clipboard-paste=Control+Alt+v XF86Paste
|
||||
clipboard-copy=Control+Alt+c XF86Copy
|
||||
|
||||
[colors]
|
||||
background=000000
|
||||
foreground=efefef
|
||||
selection-background=b5d5ff
|
||||
selection-foreground=000000
|
||||
regular0=000000
|
||||
regular1=e1321a
|
||||
regular2=6ab017
|
||||
regular3=ffc005
|
||||
regular4=004f9e
|
||||
regular5=ec0048
|
||||
regular6=2aa7e7
|
||||
regular7=f2f2f2
|
||||
bright0=5d5d5d
|
||||
bright1=ff361e
|
||||
bright2=7bc91f
|
||||
bright3=ffd00a
|
||||
bright4=0071ff
|
||||
bright5=ff1d62
|
||||
bright6=4bb8fd
|
||||
bright7=ffffff
|
||||
alpha=0.8
|
||||
25
profiles/desktop/.config/gtk-3.0/settings.ini
Normal file
25
profiles/desktop/.config/gtk-3.0/settings.ini
Normal file
@@ -0,0 +1,25 @@
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=true
|
||||
gtk-button-images=true
|
||||
gtk-cursor-blink=true
|
||||
gtk-cursor-blink-time=1000
|
||||
gtk-cursor-theme-name=Vimix-cursors
|
||||
gtk-cursor-theme-size=24
|
||||
gtk-decoration-layout=icon:minimize,maximize,close
|
||||
gtk-enable-animations=true
|
||||
gtk-enable-event-sounds=1
|
||||
gtk-enable-input-feedback-sounds=1
|
||||
gtk-font-name=Noto Sans, 10
|
||||
gtk-icon-theme-name=Numix-Circle
|
||||
gtk-menu-images=true
|
||||
gtk-modules=colorreload-gtk-module
|
||||
gtk-primary-button-warps-slider=true
|
||||
gtk-sound-theme-name=ocean
|
||||
gtk-theme-name=Materia-dark-compact
|
||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
gtk-toolbar-style=3
|
||||
gtk-xft-antialias=1
|
||||
gtk-xft-dpi=98304
|
||||
gtk-xft-hinting=1
|
||||
gtk-xft-hintstyle=hintslight
|
||||
gtk-xft-rgba=rgb
|
||||
14
profiles/desktop/.config/gtk-4.0/settings.ini
Normal file
14
profiles/desktop/.config/gtk-4.0/settings.ini
Normal file
@@ -0,0 +1,14 @@
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=true
|
||||
gtk-cursor-blink=true
|
||||
gtk-cursor-blink-time=1000
|
||||
gtk-cursor-theme-name=Vimix-cursors
|
||||
gtk-cursor-theme-size=24
|
||||
gtk-decoration-layout=icon:minimize,maximize,close
|
||||
gtk-enable-animations=true
|
||||
gtk-font-name=Noto Sans, 10
|
||||
gtk-icon-theme-name=Numix-Circle
|
||||
gtk-primary-button-warps-slider=true
|
||||
gtk-sound-theme-name=ocean
|
||||
gtk-theme-name=Materia-dark-compact
|
||||
gtk-xft-dpi=98304
|
||||
7
profiles/desktop/.config/i3-quickterm/config.json
Normal file
7
profiles/desktop/.config/i3-quickterm/config.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"term": "alacritty",
|
||||
"shells": {
|
||||
"shell": "zsh -c 'tmuxinator start quake'"
|
||||
},
|
||||
"ratio": 0.5
|
||||
}
|
||||
314
profiles/desktop/.config/i3/config
Normal file
314
profiles/desktop/.config/i3/config
Normal file
@@ -0,0 +1,314 @@
|
||||
# This file has been auto-generated by i3-config-wizard(1).
|
||||
# It will not be overwritten, so edit it as you like.
|
||||
#
|
||||
# Should you change your keyboard layout some time, delete
|
||||
# this file and re-run i3-config-wizard(1).
|
||||
#
|
||||
|
||||
# i3 config file (v4)
|
||||
#
|
||||
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
|
||||
|
||||
set $mod Mod4
|
||||
set $Locker ~/.config/i3/i3lock-multimonitor/lock -i ~/.config/i3/lockscreen.png
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
font pango:Iosevka,Font Awesome 7 Free,Font Awesome 7 Brands 9
|
||||
|
||||
# This font is widely installed, provides lots of unicode glyphs, right-to-left
|
||||
# text rendering and scalability on retina/hidpi displays (thanks to pango).
|
||||
#font pango:DejaVu Sans Mono 12
|
||||
|
||||
# prevent blank screen & auto lock
|
||||
exec --no-startup-id xset s off -dpms
|
||||
|
||||
# Start XDG autostart .desktop files using dex. See also
|
||||
# https://wiki.archlinux.org/index.php/XDG_Autostart
|
||||
exec --no-startup-id dex --autostart --environment i3
|
||||
|
||||
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
|
||||
# they are included here as an example. Modify as you see fit.
|
||||
|
||||
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
|
||||
# screen before suspend. Use loginctl lock-session to lock your screen.
|
||||
exec --no-startup-id xss-lock --transfer-sleep-lock -- $Locker
|
||||
|
||||
# NetworkManager is the most popular way to manage wireless networks on Linux,
|
||||
# and nm-applet is a desktop environment-independent system tray GUI for it.
|
||||
# exec --no-startup-id nm-applet
|
||||
|
||||
# Use pactl to adjust volume in PulseAudio.
|
||||
set $refresh_i3status killall -SIGUSR1 i3status
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1% && $refresh_i3status
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1% && $refresh_i3status
|
||||
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
|
||||
bindsym $mod+F4 exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
|
||||
|
||||
# Pipewire-pulse
|
||||
bindsym $mod+F3 exec pactl set-sink-mute 0 toggle
|
||||
bindsym $mod+F3 --release exec pkill -RTMIN+1 i3blocks
|
||||
bindsym $mod+F1 exec pactl set-sink-volume 0 -1%
|
||||
bindsym $mod+F1 --release exec pkill -RTMIN+1 i3blocks
|
||||
bindsym $mod+F2 exec pactl set-sink-volume 0 +1%
|
||||
bindsym $mod+F2 --release exec pkill -RTMIN+1 i3blocks
|
||||
|
||||
# Media player controls
|
||||
bindsym XF86AudioPlay exec playerctl play-pause
|
||||
bindsym XF86AudioPause exec playerctl play-pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
|
||||
# don't follow focus with mouse
|
||||
focus_follows_mouse no
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# move tiling windows via drag & drop by left-clicking into the title bar,
|
||||
# or left-clicking anywhere into the window while holding the floating modifier.
|
||||
tiling_drag modifier titlebar
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec alacritty
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# start dmenu (a program launcher)
|
||||
#bindsym $mod+d exec --no-startup-id dmenu_run
|
||||
# A more modern dmenu replacement is rofi:
|
||||
# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
|
||||
# There also is i3-dmenu-desktop which only displays applications shipping a
|
||||
# .desktop file. It is a wrapper around dmenu, so you need that installed.
|
||||
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
|
||||
|
||||
# change focus
|
||||
bindsym $mod+h focus left
|
||||
bindsym $mod+j focus down
|
||||
bindsym $mod+k focus up
|
||||
bindsym $mod+l focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move focused window
|
||||
bindsym $mod+Shift+h move left
|
||||
bindsym $mod+Shift+j move down
|
||||
bindsym $mod+Shift+k move up
|
||||
bindsym $mod+Shift+l move right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
# split in horizontal orientation
|
||||
bindsym $mod+Control+h split h
|
||||
|
||||
# split in vertical orientation
|
||||
bindsym $mod+Control+v split v
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# focus the child container
|
||||
#bindsym $mod+d focus child
|
||||
|
||||
# Define names for default workspaces for which we configure key bindings later on.
|
||||
# We use variables to avoid repeating the names in multiple places.
|
||||
set $ws1 "1: "
|
||||
set $ws2 "2: "
|
||||
set $ws3 "3: "
|
||||
set $ws4 "4: "
|
||||
set $ws5 "5: Torrenty"
|
||||
set $ws6 "6: Libreoffice"
|
||||
set $ws7 "7: Wirtualki"
|
||||
set $ws8 "8: Emacs"
|
||||
set $ws9 "9"
|
||||
set $ws10 "10"
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace number $ws1
|
||||
bindsym $mod+2 workspace number $ws2
|
||||
bindsym $mod+3 workspace number $ws3
|
||||
bindsym $mod+4 workspace number $ws4
|
||||
bindsym $mod+5 workspace number $ws5
|
||||
bindsym $mod+6 workspace number $ws6
|
||||
bindsym $mod+7 workspace number $ws7
|
||||
bindsym $mod+8 workspace number $ws8
|
||||
bindsym $mod+9 workspace number $ws9
|
||||
bindsym $mod+0 workspace number $ws10
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace number $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace number $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace number $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace number $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace number $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace number $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace number $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace number $ws10
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
# exit i3 (logs you out of your X session)
|
||||
#bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
|
||||
set $mode_system (l)ock, l(o)gout, (s)uspend, (h)ibernate, (r)eboot, shu(t)down
|
||||
mode "$mode_system" {
|
||||
bindsym l exec --no-startup-id $Locker, mode "default"
|
||||
bindsym o exec --no-startup-id i3-msg exit, mode "default"
|
||||
bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
|
||||
bindsym r exec --no-startup-id systemctl reboot, mode "default"
|
||||
bindsym h exec --no-startup-id systemctl hibernate, mode "default"
|
||||
bindsym t exec --no-startup-id systemctl poweroff -i, mode "default"
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+Shift+e mode "$mode_system"
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
mode "resize" {
|
||||
# These bindings trigger as soon as you enter the resize mode
|
||||
|
||||
# Pressing left will shrink the window’s width.
|
||||
# Pressing right will grow the window’s width.
|
||||
# Pressing up will shrink the window’s height.
|
||||
# Pressing down will grow the window’s height.
|
||||
bindsym h resize shrink width 10 px or 10 ppt
|
||||
bindsym j resize grow height 10 px or 10 ppt
|
||||
bindsym k resize shrink height 10 px or 10 ppt
|
||||
bindsym l resize grow width 10 px or 10 ppt
|
||||
|
||||
# same bindings, but for the arrow keys
|
||||
bindsym Left resize shrink width 10 px or 10 ppt
|
||||
bindsym Down resize grow height 10 px or 10 ppt
|
||||
bindsym Up resize shrink height 10 px or 10 ppt
|
||||
bindsym Right resize grow width 10 px or 10 ppt
|
||||
|
||||
# back to normal: Enter or Escape or $mod+r
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
bindsym $mod+r mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||
# finds out, if available)
|
||||
bar {
|
||||
status_command i3blocks -c ~/.config/i3blocks/i3blocks.conf
|
||||
position top
|
||||
i3bar_command i3bar --transparency
|
||||
tray_output none
|
||||
colors {
|
||||
background #00000099
|
||||
statusline #ffffff
|
||||
separator #000000
|
||||
|
||||
focused_workspace #34003f #6e0284 #ffffff
|
||||
#active_workspace #333333 #5f676a #ffffff
|
||||
inactive_workspace #220028 #35013f #888888
|
||||
urgent_workspace #470801 #630000 #ffffff
|
||||
#binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
|
||||
# gnome-keyring
|
||||
exec --no-startup-id dbus-update-activation-environment --systemd --all
|
||||
exec --no-startup-id gnome-keyring-daemon --start --components=secrets
|
||||
|
||||
# picom
|
||||
exec --no-startup-id picom
|
||||
|
||||
# dunst
|
||||
exec --no-startup-id dunst
|
||||
|
||||
# display wallpaper
|
||||
exec --no-startup-id feh --bg-fill ~/.config/i3/wallpaper.png
|
||||
|
||||
# shortcut for lockscreen
|
||||
bindsym $mod+x exec $Locker
|
||||
|
||||
# set default workspace layout
|
||||
workspace_layout tabbed
|
||||
|
||||
# window assignments
|
||||
assign [class="[Ff]irefox.*"] $ws2
|
||||
assign [class="[Ll]ibre[Ww]olf"] $ws2
|
||||
assign [class="[Cc]hromium"] $ws3
|
||||
assign [class="[Gg]oogle[ -]*[Cc]hrome.*"] $ws3
|
||||
assign [class="[Tt]hunderbird.*"] $ws4
|
||||
assign [class="[Tt]or\s*[Bb]rowser"] $ws10
|
||||
assign [class="[Nn]yxt"] $ws10
|
||||
assign [class="qutebrowser"] $ws10
|
||||
assign [class="[Ll]uakit"] $ws10
|
||||
assign [class="[Vv]irt[ -]*manager"] $ws7
|
||||
assign [class="[Vv]irt[ -]*viewer"] $ws7
|
||||
assign [class="[Qq]emu"] $ws7
|
||||
assign [class="q[Bb]ittorrent"] $ws5
|
||||
assign [class="[Nn]icotine"] $ws5
|
||||
assign [class="[Ll]ibreoffice.*"] $ws6
|
||||
assign [class="[Mm]ullvad.*"] $ws10
|
||||
assign [class="[Qq]t[ -]*[Cc]reator"] $ws10
|
||||
assign [class="[Ee]macs"] $ws8
|
||||
assign [class="[Kk]iwix"] $ws10
|
||||
assign [class="[Gg]alaxy[ -]*[Bb]uds[ -]*[Cc]lient"] $ws10
|
||||
assign [class="[Kk]ee[Pp]ass.*"] $ws10
|
||||
assign [class="[Tt]hunar"] $ws10
|
||||
assign [class="[Pp][Hh][Pp][Ss]torm"] $ws10
|
||||
assign [class="[Rr]uby[Mm]ine"] $ws10
|
||||
assign [class="[Dd]ata[Gg]rip"] $ws10
|
||||
assign [class="[Ww]eb[Ss]torm"] $ws10
|
||||
assign [class="[Jj]etbrains.*"] $ws10
|
||||
for_window [class="[Tt]or\s*[Bb]rowser"] floating enable, border normal
|
||||
for_window [class="[Ff]lame[Ss]hot"] floating enable, border normal
|
||||
|
||||
# color scheme for windows
|
||||
# border background text indicator (a line which shows where the next window will be placed)
|
||||
client.focused #0b4701 #044f00 #ffffff #0b4701
|
||||
client.unfocused #072d00 #023000 #969696 #072d00
|
||||
client.focused_inactive #072d00 #023000 #969696 #072d00
|
||||
client.urgent #630000 #630000 #ffffff #630000
|
||||
|
||||
# hide title bar
|
||||
default_border pixel 1
|
||||
default_floating_border pixel 1
|
||||
|
||||
# start rofi
|
||||
bindsym $mod+d exec --no-startup-id rofi -show combi
|
||||
bindsym $mod+p exec --no-startup-id ~/.local/bin/rofi-pass
|
||||
|
||||
# i3-quickterm
|
||||
bindsym $mod+b exec i3-quickterm shell
|
||||
|
||||
# flameshot (for screenshots)
|
||||
bindsym $mod+Print exec flameshot full -u -p ~/Pictures/Screenshots
|
||||
bindsym $mod+Shift+Print exec flameshot gui -u -p ~/Pictures/Screenshots
|
||||
bindsym Print exec flameshot full -p ~/Pictures/Screenshots
|
||||
bindsym Shift+Print exec flameshot gui -p ~/Pictures/Screenshots
|
||||
1
profiles/desktop/.config/i3/i3lock-multimonitor
Submodule
1
profiles/desktop/.config/i3/i3lock-multimonitor
Submodule
Submodule profiles/desktop/.config/i3/i3lock-multimonitor added at 146d6de67c
BIN
profiles/desktop/.config/i3/lockscreen.png
Normal file
BIN
profiles/desktop/.config/i3/lockscreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
BIN
profiles/desktop/.config/i3/wallpaper.png
Normal file
BIN
profiles/desktop/.config/i3/wallpaper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 877 KiB |
Submodule profiles/desktop/.config/i3blocks/i3blocks-contrib added at 9d66d81da8
76
profiles/desktop/.config/i3blocks/i3blocks.conf
Normal file
76
profiles/desktop/.config/i3blocks/i3blocks.conf
Normal file
@@ -0,0 +1,76 @@
|
||||
# Global properties
|
||||
separator=false
|
||||
separator_block_width=15
|
||||
|
||||
#[essid]
|
||||
#command=~/.config/i3blocks/i3blocks-contrib/essid/essid
|
||||
#interval=60
|
||||
#INTERFACE=wlo1
|
||||
#label=
|
||||
#separator=false
|
||||
#
|
||||
#[wifi]
|
||||
#command=~/.config/i3blocks/i3blocks-contrib/wifi/wifi
|
||||
#INTERFACE=wlo1
|
||||
#interval=60
|
||||
#
|
||||
[iface]
|
||||
command=~/.config/i3blocks/i3blocks-contrib/iface/iface
|
||||
LABEL=
|
||||
ADDRESS_FAMILY=inet6?
|
||||
color=#00FF00
|
||||
interval=10
|
||||
# set this to 1 to display the name of the connected WIFI interface instead of the IP address.
|
||||
display_wifi_name=1
|
||||
|
||||
[load_average]
|
||||
command=~/.config/i3blocks/i3blocks-contrib/load_average/load_average
|
||||
interval=10
|
||||
min_width= 99.99
|
||||
align=center
|
||||
|
||||
[memory]
|
||||
command=~/.config/i3blocks/i3blocks-contrib/memory/memory
|
||||
label=
|
||||
interval=30
|
||||
separator=false
|
||||
|
||||
# [memory]
|
||||
# command=~/.config/i3blocks/i3blocks-contrib/memory/memory
|
||||
# label=
|
||||
# instance=swap
|
||||
# interval=30
|
||||
|
||||
[temperature]
|
||||
command=~/.config/i3blocks/i3blocks-contrib/temperature/temperature
|
||||
label=
|
||||
interval=10
|
||||
T_WARN=70
|
||||
T_CRIT=90
|
||||
SENSOR_CHIP=coretemp-isa-0000
|
||||
min_width= 100.0°C
|
||||
align=center
|
||||
|
||||
[volume-pipewire]
|
||||
command=~/.config/i3blocks/i3blocks-contrib/volume-pipewire/volume-pipewire
|
||||
interval=persist
|
||||
signal=1
|
||||
SUBSCRIBE=1
|
||||
|
||||
[battery]
|
||||
command=~/.config/i3blocks/i3blocks-contrib/battery/battery
|
||||
interval=30
|
||||
#LABEL=BAT
|
||||
LABEL=⚡
|
||||
#BAT_NUMBER=0
|
||||
|
||||
[time]
|
||||
label=
|
||||
command=date '+%d %b %Y %a'
|
||||
interval=1
|
||||
separator=false
|
||||
|
||||
[time]
|
||||
label=
|
||||
command=date '+%H:%M'
|
||||
interval=1
|
||||
114
profiles/desktop/.config/lf/lfrc
Normal file
114
profiles/desktop/.config/lf/lfrc
Normal file
@@ -0,0 +1,114 @@
|
||||
# interpreter for shell commands
|
||||
set shell sh
|
||||
|
||||
# set '-eu' options for shell commands
|
||||
# These options are used to have safer shell commands. Option '-e' is used to
|
||||
# exit on error and option '-u' is used to give error for unset variables.
|
||||
# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
|
||||
# $fx variables contain names with '*' or '?' characters. However, this option
|
||||
# is used selectively within individual commands as it can be limiting at
|
||||
# times.
|
||||
set shellopts '-eu'
|
||||
|
||||
# set internal field separator (IFS) to "\n" for shell commands
|
||||
# This is useful to automatically split file names in $fs and $fx properly
|
||||
# since default file separator used in these variables (i.e. 'filesep' option)
|
||||
# is newline. You need to consider the values of these options and create your
|
||||
# commands accordingly.
|
||||
set ifs "\n"
|
||||
|
||||
# leave some space at the top and the bottom of the screen
|
||||
set scrolloff 10
|
||||
|
||||
# Use the `dim` attribute instead of underline for the cursor in the preview pane
|
||||
set cursorpreviewfmt "\033[7;2m"
|
||||
|
||||
# use enter for shell commands
|
||||
map <enter> shell
|
||||
|
||||
# show the result of execution of previous commands
|
||||
map ` !true
|
||||
|
||||
# execute current file (must be executable)
|
||||
map x $$f
|
||||
map X !$f
|
||||
|
||||
# dedicated keys for file opener actions
|
||||
map o &mimeopen $f
|
||||
map O $mimeopen --ask $f
|
||||
|
||||
# define a custom 'open' command
|
||||
# This command is called when current file is not a directory. You may want to
|
||||
# use either file extensions and/or mime types here. Below uses an editor for
|
||||
# text files and a file opener for the rest.
|
||||
cmd open &{{
|
||||
case $(file --mime-type -Lb $f) in
|
||||
text/*) lf -remote "send $id \$$EDITOR \$fx";;
|
||||
*) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
|
||||
esac
|
||||
}}
|
||||
|
||||
# mkdir command. See wiki if you want it to select created dir
|
||||
map a :push %mkdir<space>
|
||||
|
||||
# define a custom 'rename' command without prompt for overwrite
|
||||
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
|
||||
# map r push :rename<space>
|
||||
|
||||
# make sure trash folder exists
|
||||
# %mkdir -p ~/.trash
|
||||
|
||||
# move current file or selected files to trash folder
|
||||
# (also see 'man mv' for backup/overwrite options)
|
||||
cmd trash %set -f; mv -t ~/.trash $fx
|
||||
|
||||
# define a custom 'delete' command
|
||||
# cmd delete ${{
|
||||
# set -f
|
||||
# printf "$fx\n"
|
||||
# printf "delete? [y/N] "
|
||||
# read ans
|
||||
# [ "$ans" = "y" ] && rm -rf $fx
|
||||
# }}
|
||||
|
||||
# use '<delete>' key for either 'trash' or 'delete' command
|
||||
# map <delete> trash
|
||||
# map <delete> delete
|
||||
|
||||
# extract the current file with the right command
|
||||
# (xkcd link: https://xkcd.com/1168/)
|
||||
cmd extract ${{
|
||||
set -f
|
||||
case $f in
|
||||
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
|
||||
*.tar.gz|*.tgz) tar xzvf $f;;
|
||||
*.tar.xz|*.txz) tar xJvf $f;;
|
||||
*.zip) unzip $f;;
|
||||
*.rar) unrar x $f;;
|
||||
*.7z) 7z x $f;;
|
||||
esac
|
||||
}}
|
||||
|
||||
# compress current file or selected files with tar and gunzip
|
||||
cmd tar ${{
|
||||
set -f
|
||||
mkdir $1
|
||||
cp -r $fx $1
|
||||
tar czf $1.tar.gz $1
|
||||
rm -rf $1
|
||||
}}
|
||||
|
||||
# compress current file or selected files with zip
|
||||
cmd zip ${{
|
||||
set -f
|
||||
mkdir $1
|
||||
cp -r $fx $1
|
||||
zip -r $1.zip $1
|
||||
rm -rf $1
|
||||
}}
|
||||
|
||||
# set previewer
|
||||
set previewer ctpv
|
||||
set cleaner ctpvclear
|
||||
&ctpv -s $id
|
||||
&ctpvquit $id
|
||||
24
profiles/desktop/.config/lf/previewer_sandbox
Normal file
24
profiles/desktop/.config/lf/previewer_sandbox
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
## ~/.config/lf/previewer_sandbox
|
||||
|
||||
set -euo pipefail
|
||||
(
|
||||
exec bwrap \
|
||||
--ro-bind /usr/bin /usr/bin \
|
||||
--ro-bind /usr/share/ /usr/share/ \
|
||||
--ro-bind /usr/lib /usr/lib \
|
||||
--ro-bind /usr/lib64 /usr/lib64 \
|
||||
--symlink /usr/bin /bin \
|
||||
--symlink /usr/bin /sbin \
|
||||
--symlink /usr/lib /lib \
|
||||
--symlink /usr/lib64 /lib64 \
|
||||
--proc /proc \
|
||||
--dev /dev \
|
||||
--ro-bind /etc /etc \
|
||||
--ro-bind ~/.config ~/.config \
|
||||
--ro-bind ~/.cache ~/.cache \
|
||||
--ro-bind "$PWD" "$PWD" \
|
||||
--unshare-all \
|
||||
--new-session \
|
||||
ctpv "$@"
|
||||
)
|
||||
18
profiles/desktop/.config/mako/config
Normal file
18
profiles/desktop/.config/mako/config
Normal file
@@ -0,0 +1,18 @@
|
||||
font=Hack Nerd Font 12
|
||||
icon-path=/usr/share/icons/Numix-Circle
|
||||
width=550
|
||||
border-size=3
|
||||
padding=10,10,10,10
|
||||
background-color=#055d01
|
||||
text-color=#eeeeee
|
||||
border-color=#044201
|
||||
default-timeout=10000
|
||||
|
||||
[urgency="low"]
|
||||
default-timeout=5000
|
||||
|
||||
[urgency="critical"]
|
||||
background-color=#6d0a01
|
||||
text-color=#eeeeee
|
||||
border-color=#420601
|
||||
default-timeout=20000
|
||||
30
profiles/desktop/.config/mpd/mpd.conf
Normal file
30
profiles/desktop/.config/mpd/mpd.conf
Normal file
@@ -0,0 +1,30 @@
|
||||
# Recommended location for database
|
||||
db_file "~/.config/mpd/database"
|
||||
|
||||
# If running mpd using systemd, delete this line to log directly to systemd.
|
||||
#log_file "syslog"
|
||||
|
||||
# The music directory is by default the XDG directory, uncomment to amend and choose a different directory
|
||||
music_directory "~/Music"
|
||||
|
||||
# Uncomment to refresh the database whenever files in the music_directory are changed
|
||||
#auto_update "yes"
|
||||
|
||||
#auto_update_depth "5"
|
||||
|
||||
# Uncomment to enable the functionalities
|
||||
playlist_directory "~/.config/mpd/playlists"
|
||||
#pid_file "~/.config/mpd/pid"
|
||||
state_file "~/.config/mpd/state"
|
||||
sticker_file "~/.config/mpd/sticker.sql"
|
||||
|
||||
bind_to_address "~/.config/mpd/socket"
|
||||
|
||||
restore_paused "yes"
|
||||
|
||||
#max_output_buffer_size "32768"
|
||||
|
||||
audio_output {
|
||||
type "pipewire"
|
||||
name "Pipewire Output"
|
||||
}
|
||||
30
profiles/desktop/.config/ncmpcpp/bindings
Normal file
30
profiles/desktop/.config/ncmpcpp/bindings
Normal file
@@ -0,0 +1,30 @@
|
||||
def_key "j"
|
||||
scroll_down
|
||||
def_key "k"
|
||||
scroll_up
|
||||
def_key "h"
|
||||
previous_column
|
||||
def_key "h"
|
||||
volume_down
|
||||
def_key "l"
|
||||
next_column
|
||||
def_key "l"
|
||||
volume_up
|
||||
def_key "ctrl-b"
|
||||
page_up
|
||||
def_key "ctrl-u"
|
||||
page_up
|
||||
def_key "ctrl-f"
|
||||
page_down
|
||||
def_key "ctrl-d"
|
||||
page_down
|
||||
def_key "g"
|
||||
move_home
|
||||
def_key "G"
|
||||
move_end
|
||||
def_key "n"
|
||||
next_found_item
|
||||
def_key "N"
|
||||
previous_found_item
|
||||
def_key ";"
|
||||
show_lyrics
|
||||
2
profiles/desktop/.config/ncmpcpp/config
Normal file
2
profiles/desktop/.config/ncmpcpp/config
Normal file
@@ -0,0 +1,2 @@
|
||||
seek_time = "2"
|
||||
lyrics_fetchers = tekstowo
|
||||
7
profiles/desktop/.config/nvim/.stylua.toml
Normal file
7
profiles/desktop/.config/nvim/.stylua.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
line_endings = 'Unix'
|
||||
indent_type = 'Spaces'
|
||||
indent_width = 2
|
||||
quote_style = 'AutoPreferSingle'
|
||||
call_parentheses = 'Always'
|
||||
[sort_requires]
|
||||
enabled = true
|
||||
4
profiles/desktop/.config/nvim/after/ftplugin/lua.lua
Normal file
4
profiles/desktop/.config/nvim/after/ftplugin/lua.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
-- set default tab width to 2 spaces
|
||||
vim.opt_local.tabstop = 2 -- number of spaces that a tab counts for
|
||||
vim.opt_local.shiftwidth = 2 -- size of an autoindented shift
|
||||
vim.opt_local.softtabstop = 0 -- indentation size
|
||||
1
profiles/desktop/.config/nvim/after/ftplugin/make.lua
Normal file
1
profiles/desktop/.config/nvim/after/ftplugin/make.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.opt_local.expandtab = false -- use tabs instead of spaces
|
||||
4
profiles/desktop/.config/nvim/after/ftplugin/vim.lua
Normal file
4
profiles/desktop/.config/nvim/after/ftplugin/vim.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
-- set default tab width to 2 spaces
|
||||
vim.opt_local.tabstop = 2 -- number of spaces that a tab counts for
|
||||
vim.opt_local.shiftwidth = 2 -- size of an autoindented shift
|
||||
vim.opt_local.softtabstop = 0 -- indentation size
|
||||
8
profiles/desktop/.config/nvim/init.lua
Normal file
8
profiles/desktop/.config/nvim/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- load settings
|
||||
require('config.settings')
|
||||
|
||||
-- load plugins
|
||||
require('config.lazy')
|
||||
|
||||
-- load keybindings
|
||||
require('config.keybindings')
|
||||
36
profiles/desktop/.config/nvim/lazy-lock.json
Normal file
36
profiles/desktop/.config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
|
||||
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "abf82a65f185bd54adc0679f74b7d6e1ada690c9" },
|
||||
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "c7274c48137396526b59d86232eabcdc7fed8a32" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "c953789db7fd28eafe5eb5659846d34b5024b3cc" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||
"nvim-config-local": { "branch": "main", "commit": "990f3e35e0fba8fb83012d7e85f9a6a77de7f87f" },
|
||||
"nvim-lint": { "branch": "master", "commit": "bcd1a44edbea8cd473af7e7582d3f7ffc60d8e81" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "3f58aeca0c6ece8a9fb8782ea3fcb6024f285be3" },
|
||||
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4967fa48b0fe7a7f92cee546c76bb4bb61bb14d5" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "db15f2e0df2f5db916e511e3fffb682ef2f6354f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" },
|
||||
"orgmode": { "branch": "master", "commit": "c421c7677b7332f5fd543023283a2290cf8dd4ff" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
||||
"undotree": { "branch": "master", "commit": "fc28931fbfba66ab75d9af23fe46ffbbb9de6e8c" },
|
||||
"vim-indent-object": { "branch": "master", "commit": "8ab36d5ec2a3a60468437a95e142ce994df598c6" },
|
||||
"vim-tmux-clipboard": { "branch": "master", "commit": "d4774dc7dfdd4b8a60613355ed32e6a1c18220cf" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
3
profiles/desktop/.config/nvim/lua/config/keybindings.lua
Normal file
3
profiles/desktop/.config/nvim/lua/config/keybindings.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
-- keep in visual mode after indenting
|
||||
vim.keymap.set('v', '<', '<gv')
|
||||
vim.keymap.set('v', '>', '>gv')
|
||||
37
profiles/desktop/.config/nvim/lua/config/lazy.lua
Normal file
37
profiles/desktop/.config/nvim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
|
||||
{ out, 'WarningMsg' },
|
||||
{ '\nPress any key to exit...' },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = '\\'
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require('lazy').setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = 'plugins' },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { 'catppuccin' } },
|
||||
-- configure ui
|
||||
ui = { border = 'rounded' },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true, notify = false },
|
||||
})
|
||||
101
profiles/desktop/.config/nvim/lua/config/settings.lua
Normal file
101
profiles/desktop/.config/nvim/lua/config/settings.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
-- true color support
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- fix transparency issues with alacritty
|
||||
local highlights = {
|
||||
'Normal',
|
||||
'LineNr',
|
||||
'Folded',
|
||||
'NonText',
|
||||
'SpecialKey',
|
||||
'VertSplit',
|
||||
'SignColumn',
|
||||
'EndOfBuffer',
|
||||
'TablineFill', -- this is specific to how I like my tabline to look like
|
||||
}
|
||||
for _, name in pairs(highlights) do
|
||||
vim.cmd.highlight(name .. ' guibg=none ctermbg=none')
|
||||
end
|
||||
|
||||
-- disable arrow keys
|
||||
local all_modes = { 'n', 'i', 'v', 'o' }
|
||||
|
||||
vim.keymap.set(all_modes, '<Up>', '<Nop>', { noremap = true, silent = true })
|
||||
vim.keymap.set(all_modes, '<Down>', '<Nop>', { noremap = true, silent = true })
|
||||
vim.keymap.set(all_modes, '<Left>', '<Nop>', { noremap = true, silent = true })
|
||||
vim.keymap.set(all_modes, '<Right>', '<Nop>', { noremap = true, silent = true })
|
||||
|
||||
vim.o.number = true -- display line numbers
|
||||
vim.opt.clipboard:append({ 'unnamedplus', 'unnamed' }) -- always use clipboard in x11
|
||||
vim.o.encoding = 'UTF-8' -- sets the character encoding used inside vim
|
||||
vim.o.title = true -- when on, the title of the window will be set to the value of 'titlestring'
|
||||
vim.o.signcolumn = 'yes'
|
||||
|
||||
-- spell checking
|
||||
vim.o.spell = true
|
||||
vim.opt.spelllang:append({ 'en_us', 'en_gb', 'pl' })
|
||||
vim.opt.spelloptions:append({ 'camel' })
|
||||
vim.o.spellcapcheck = ''
|
||||
|
||||
-- persistent undo
|
||||
local undodir = vim.fn.stdpath('state') .. 'undo'
|
||||
vim.fn.mkdir(undodir, 'p', '0700')
|
||||
vim.o.undodir = undodir
|
||||
vim.o.undofile = true
|
||||
|
||||
-- set proper file types for files in ~/ansible directory
|
||||
vim.filetype.add({
|
||||
pattern = {
|
||||
[os.getenv('HOME') .. '/ansible/.*%.yml'] = 'yaml.ansible',
|
||||
},
|
||||
})
|
||||
|
||||
-- neovim terminal configuration
|
||||
local augroup_term = vim.api.nvim_create_augroup('augroup_term', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TermOpen', { -- enter insert mode automatically
|
||||
group = augroup_term,
|
||||
pattern = '*',
|
||||
callback = vim.cmd.startinsert,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('TermOpen', { -- disable number lines on terminal buffers
|
||||
group = augroup_term,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.o.number = false
|
||||
vim.o.relativenumber = false
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('TermOpen', { -- allow use ctrl-c on terminal windows
|
||||
group = augroup_term,
|
||||
pattern = '*',
|
||||
callback = function(args)
|
||||
vim.keymap.set('n', '<C-c>', 'i<C-c>', { buffer = args.buf })
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('TermEnter', { -- no sign column
|
||||
group = augroup_term,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.opt_local.signcolumn = false
|
||||
end,
|
||||
})
|
||||
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>') -- esc to exit insert mode
|
||||
|
||||
-- set default tab width to 4 spaces
|
||||
vim.o.tabstop = 4 -- number of spaces that a tab counts for
|
||||
vim.o.shiftwidth = 4 -- number of spaces that are inserted during indent operations
|
||||
vim.o.softtabstop = 4 -- number of spaces that are inserted after pressing tab
|
||||
vim.o.expandtab = true -- use spaces instead of tabs
|
||||
|
||||
-- c/c++ settings
|
||||
vim.opt.cinoptions:append({ 'N-s' })
|
||||
|
||||
-- web dev settings
|
||||
vim.g.html_indent_autotags = 'html,thead,tbody,tfoot'
|
||||
vim.g.html_indent_script1 = 'auto'
|
||||
vim.g.html_indent_style1 = 'auto'
|
||||
|
||||
-- set cursor shape to underline in the normal and command mode,
|
||||
-- in the insert mode change shape to vertical bar, and disable
|
||||
-- blinking in all modes
|
||||
vim.opt.guicursor:append({ 'n-c:hor20', 'i:ver20', 'a:blinkon0' })
|
||||
15
profiles/desktop/.config/nvim/lua/plugins/catppuccin.lua
Normal file
15
profiles/desktop/.config/nvim/lua/plugins/catppuccin.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
return {
|
||||
'catppuccin/nvim',
|
||||
name = 'catppuccin',
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('catppuccin').setup({
|
||||
flavour = 'mocha', -- latte, frappe, macchiato, mocha
|
||||
transparent_background = true, -- disables setting the background color.
|
||||
})
|
||||
|
||||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme('catppuccin')
|
||||
end,
|
||||
}
|
||||
6
profiles/desktop/.config/nvim/lua/plugins/colorizer.lua
Normal file
6
profiles/desktop/.config/nvim/lua/plugins/colorizer.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
-- 'norcalli/nvim-colorizer.lua',
|
||||
-- config = function()
|
||||
-- require('colorizer').setup({ '*' })
|
||||
-- end,
|
||||
}
|
||||
37
profiles/desktop/.config/nvim/lua/plugins/conform.lua
Normal file
37
profiles/desktop/.config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
return {
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local conform = require('conform')
|
||||
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
cpp = { 'clang-format' },
|
||||
c = { 'clang-format' },
|
||||
html = { 'prettier' },
|
||||
css = { 'prettier' },
|
||||
javascript = { 'prettier' },
|
||||
python = { 'autopep8', 'isort' },
|
||||
bash = { 'beautysh' },
|
||||
csh = { 'beautysh' },
|
||||
ksh = { 'beautysh' },
|
||||
sh = { 'beautysh' },
|
||||
zsh = { 'beautysh' },
|
||||
},
|
||||
-- format_on_save = {
|
||||
-- lsp_fallback = true,
|
||||
-- async = false,
|
||||
-- timeout_ms = 1000,
|
||||
-- },
|
||||
})
|
||||
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>cf', function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 1000,
|
||||
})
|
||||
end, { desc = 'Format file or range (in visual mode)' })
|
||||
end,
|
||||
}
|
||||
48
profiles/desktop/.config/nvim/lua/plugins/gitsigns.lua
Normal file
48
profiles/desktop/.config/nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = function()
|
||||
local gitsigns = require('gitsigns')
|
||||
gitsigns.setup({
|
||||
signs = {
|
||||
add = { text = '│' },
|
||||
change = { text = '│' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
-- yadm = {
|
||||
-- enable = false,
|
||||
-- },
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
'nmac427/guess-indent.nvim',
|
||||
config = true,
|
||||
}
|
||||
102
profiles/desktop/.config/nvim/lua/plugins/lspconfig.lua
Normal file
102
profiles/desktop/.config/nvim/lua/plugins/lspconfig.lua
Normal file
@@ -0,0 +1,102 @@
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp', -- LSP source for nvim-cmp,
|
||||
{ 'folke/neodev.nvim', config = true },
|
||||
},
|
||||
config = function()
|
||||
require('vim.lsp.protocol')
|
||||
|
||||
require('mason-lspconfig').setup({
|
||||
automatic_enable = true,
|
||||
})
|
||||
|
||||
vim.lsp.config('*', {
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
completionItem = {
|
||||
snippetSupport = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config('lua_ls', {
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath('config')
|
||||
and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc'))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most
|
||||
-- likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Tell the language server how to find Lua modules same way as Neovim
|
||||
-- (see `:h lua-module-load`)
|
||||
path = {
|
||||
'lua/?.lua',
|
||||
'lua/?/init.lua',
|
||||
},
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
-- Depending on the usage, you might want to add additional paths
|
||||
-- here.
|
||||
'${3rd}/luv/library'
|
||||
-- '${3rd}/busted/library'
|
||||
},
|
||||
-- Or pull in all of 'runtimepath'.
|
||||
-- NOTE: this is a lot slower and will cause issues when working on
|
||||
-- your own configuration.
|
||||
-- See https://github.com/neovim/nvim-lspconfig/issues/3189
|
||||
-- library = {
|
||||
-- vim.api.nvim_get_runtime_file('', true),
|
||||
-- }
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {},
|
||||
},
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = '●', -- Could be '■', '●', '▎', 'x'
|
||||
},
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = ' ',
|
||||
[vim.diagnostic.severity.WARN] = ' ',
|
||||
[vim.diagnostic.severity.INFO] = ' ',
|
||||
[vim.diagnostic.severity.HINT] = ' ',
|
||||
},
|
||||
texthl = {
|
||||
[vim.diagnostic.severity.ERROR] = 'DiagnosticSignError',
|
||||
[vim.diagnostic.severity.WARN] = 'DiagnosticSignWarn',
|
||||
[vim.diagnostic.severity.INFO] = 'DiagnosticSignInfo',
|
||||
[vim.diagnostic.severity.HINT] = 'DiagnosticSignHint',
|
||||
},
|
||||
numhl = {
|
||||
[vim.diagnostic.severity.ERROR] = 'DiagnosticSignError',
|
||||
[vim.diagnostic.severity.WARN] = 'DiagnosticSignWarn',
|
||||
[vim.diagnostic.severity.INFO] = 'DiagnosticSignInfo',
|
||||
[vim.diagnostic.severity.HINT] = 'DiagnosticSignHint',
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
11
profiles/desktop/.config/nvim/lua/plugins/lualine.lua
Normal file
11
profiles/desktop/.config/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {
|
||||
options = {
|
||||
theme = 'catppuccin',
|
||||
section_separators = { left = '', right = '' },
|
||||
component_separators = { left = '', right = '' },
|
||||
},
|
||||
},
|
||||
}
|
||||
75
profiles/desktop/.config/nvim/lua/plugins/mason.lua
Normal file
75
profiles/desktop/.config/nvim/lua/plugins/mason.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
return {
|
||||
'williamboman/mason.nvim',
|
||||
dependencies = {
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
},
|
||||
config = function()
|
||||
require('mason').setup({
|
||||
ui = { border = 'rounded' },
|
||||
})
|
||||
|
||||
require('mason-lspconfig').setup({
|
||||
automatic_enable = true,
|
||||
})
|
||||
|
||||
require('mason-tool-installer').setup({
|
||||
ensure_installed = {
|
||||
-- lua scripting
|
||||
'stylua', -- lua formatter
|
||||
'lua_ls',
|
||||
|
||||
-- vimrc editing
|
||||
'vimls',
|
||||
|
||||
-- editorconfig stuff
|
||||
'editorconfig-checker',
|
||||
|
||||
-- system administration's related stuff
|
||||
'ansiblels',
|
||||
'yamllint',
|
||||
'systemdlint',
|
||||
-- 'nginx_language_server',
|
||||
'dockerls',
|
||||
'docker_compose_language_service',
|
||||
|
||||
-- shell scripting
|
||||
'shellcheck',
|
||||
'bashls',
|
||||
'beautysh',
|
||||
|
||||
-- python
|
||||
'python-lsp-server',
|
||||
'pylint',
|
||||
'autopep8',
|
||||
'mypy',
|
||||
'isort',
|
||||
|
||||
-- c/c++
|
||||
'clangd',
|
||||
'clang-format',
|
||||
'cmakelang',
|
||||
'cmakelint',
|
||||
'checkmake',
|
||||
|
||||
-- latex
|
||||
'texlab',
|
||||
'latexindent',
|
||||
|
||||
-- web development
|
||||
'html',
|
||||
'cssls',
|
||||
'stylelint',
|
||||
'eslint',
|
||||
'standardjs',
|
||||
'jsonlint',
|
||||
|
||||
-- databases
|
||||
'sqlfluff',
|
||||
|
||||
-- misc
|
||||
'jinja_lsp',
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
9
profiles/desktop/.config/nvim/lua/plugins/notify.lua
Normal file
9
profiles/desktop/.config/nvim/lua/plugins/notify.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
'rcarriga/nvim-notify',
|
||||
config = function()
|
||||
vim.notify = require("notify")
|
||||
vim.notify.setup({
|
||||
background_colour = "#000000",
|
||||
})
|
||||
end
|
||||
}
|
||||
10
profiles/desktop/.config/nvim/lua/plugins/nvim-autopairs.lua
Normal file
10
profiles/desktop/.config/nvim/lua/plugins/nvim-autopairs.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
opts = {
|
||||
disable_filetype = { 'TelescopePrompt', 'spectre_panel', 'snacks_picker_input', 'vim' },
|
||||
enable_afterquote = false,
|
||||
enable_bracket_in_quote = false,
|
||||
ignored_next_char = '[%w%.]', -- will ignore alphanumeric and `.` symbol
|
||||
},
|
||||
}
|
||||
76
profiles/desktop/.config/nvim/lua/plugins/nvim-cmp.lua
Normal file
76
profiles/desktop/.config/nvim/lua/plugins/nvim-cmp.lua
Normal file
@@ -0,0 +1,76 @@
|
||||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-buffer', -- source for text in buffer
|
||||
'hrsh7th/cmp-path', -- source for file system paths
|
||||
'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp
|
||||
{ 'L3MON4D3/LuaSnip', config = true }, -- snippets plugin
|
||||
'onsails/lspkind.nvim', -- vs-code like pictograms
|
||||
},
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
local window_style = cmp.config.window.bordered({
|
||||
winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,Search:None',
|
||||
col_offset = -3,
|
||||
side_padding = 0,
|
||||
})
|
||||
cmp.setup({
|
||||
view = {
|
||||
docs = { auto_open = false },
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- use luasnip engine
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = window_style,
|
||||
documentation = window_style,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-g>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
['<C-d>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible_docs() then
|
||||
cmp.close_docs()
|
||||
elseif cmp.visible() then
|
||||
cmp.open_docs()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp', max_item_count = 10, keyword_length = 1 },
|
||||
{ name = 'luasnip', max_item_count = 10, keyword_length = 1 },
|
||||
{ name = 'buffer', max_item_count = 10, keyword_length = 1 },
|
||||
{ name = 'path', max_item_count = 10, keyword_length = 1 },
|
||||
}),
|
||||
formatting = {
|
||||
fields = { 'kind', 'abbr', 'menu' },
|
||||
format = function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, '%s', { trimempty = true })
|
||||
kind.kind = ' ' .. (strings[1] or '') .. ' '
|
||||
kind.menu = ' (' .. (strings[2] or '') .. ')'
|
||||
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
enabled = function()
|
||||
-- disable completion in comments
|
||||
local context = require('cmp.config.context')
|
||||
-- keep command mode completion enabled when cursor is in a comment
|
||||
if vim.api.nvim_get_mode().mode == 'c' then
|
||||
return true
|
||||
else
|
||||
return not context.in_treesitter_capture('comment') and not context.in_syntax_group('Comment')
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
'klen/nvim-config-local',
|
||||
config = function()
|
||||
require('config-local').setup({
|
||||
-- Default options (optional)
|
||||
|
||||
-- Config file patterns to load (lua supported)
|
||||
config_files = { '.nvim.lua', '.nvimrc', '.exrc' },
|
||||
|
||||
-- Where the plugin keeps files data
|
||||
hashfile = vim.fn.stdpath('data') .. '/config-local',
|
||||
|
||||
autocommands_create = true, -- Create autocommands (VimEnter, DirectoryChanged)
|
||||
commands_create = true, -- Create commands (ConfigLocalSource, ConfigLocalEdit, ConfigLocalTrust, ConfigLocalDeny)
|
||||
silent = true, -- Disable plugin messages (Config loaded/denied)
|
||||
lookup_parents = false, -- Lookup config files in parent directories
|
||||
})
|
||||
end,
|
||||
}
|
||||
30
profiles/desktop/.config/nvim/lua/plugins/nvim-lint.lua
Normal file
30
profiles/desktop/.config/nvim/lua/plugins/nvim-lint.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
return {
|
||||
'mfussenegger/nvim-lint',
|
||||
config = function()
|
||||
require('lint').linters_by_ft = {
|
||||
['yaml.ansible'] = { 'ansible_lint' },
|
||||
bash = { 'shellcheck' },
|
||||
make = { 'checkmake' },
|
||||
cmake = { 'cmakelint' },
|
||||
cpp = { 'clangtidy' },
|
||||
c = { 'clangtidy' },
|
||||
editorconfig = { 'editorconfig-checker' },
|
||||
html = { 'tidy' },
|
||||
json = { 'jsonlint' },
|
||||
sql = { 'sqlfluff' },
|
||||
js = { 'standardjs' },
|
||||
css = { 'stylelint' },
|
||||
systemd = { 'systemdlint' },
|
||||
yaml = { 'yamllint' },
|
||||
zsh = { 'zsh' },
|
||||
python = { 'pylint', 'mypy' },
|
||||
}
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
|
||||
callback = function()
|
||||
-- try_lint without arguments runs the linters defined in `linters_by_ft`
|
||||
-- for the current filetype
|
||||
require('lint').try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
lazy = false,
|
||||
config = function()
|
||||
local treesitter = require('nvim-treesitter')
|
||||
treesitter.setup({})
|
||||
treesitter.install({
|
||||
'c',
|
||||
'cpp',
|
||||
'lua',
|
||||
'bash',
|
||||
'json',
|
||||
'yaml',
|
||||
'vim',
|
||||
'dockerfile',
|
||||
'gitignore',
|
||||
'html',
|
||||
'css',
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
'windwp/nvim-ts-autotag',
|
||||
config = function()
|
||||
require('nvim-ts-autotag').setup({
|
||||
opts = {
|
||||
-- Defaults
|
||||
enable_close = true, -- Auto close tags
|
||||
enable_rename = true, -- Auto rename pairs of tags
|
||||
enable_close_on_slash = false, -- Auto close on trailing </
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
11
profiles/desktop/.config/nvim/lua/plugins/orgmode.lua
Normal file
11
profiles/desktop/.config/nvim/lua/plugins/orgmode.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
'nvim-orgmode/orgmode',
|
||||
event = 'VeryLazy',
|
||||
config = function()
|
||||
-- Setup orgmode
|
||||
require('orgmode').setup({
|
||||
org_agenda_files = '~/orgfiles/**/*',
|
||||
org_default_notes_file = '~/orgfiles/refile.org',
|
||||
})
|
||||
end,
|
||||
}
|
||||
21
profiles/desktop/.config/nvim/lua/plugins/telescope.lua
Normal file
21
profiles/desktop/.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.8',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require('telescope').setup({
|
||||
pickers = {
|
||||
find_files = { theme = 'dropdown' },
|
||||
grep_string = { theme = 'dropdown' },
|
||||
live_grep = { theme = 'dropdown' },
|
||||
},
|
||||
})
|
||||
|
||||
-- key bindings
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
'folke/todo-comments.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = true,
|
||||
}
|
||||
37
profiles/desktop/.config/nvim/lua/plugins/trouble.lua
Normal file
37
profiles/desktop/.config/nvim/lua/plugins/trouble.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
return {
|
||||
'folke/trouble.nvim',
|
||||
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
||||
cmd = 'Trouble',
|
||||
keys = {
|
||||
{
|
||||
'<leader>xx',
|
||||
'<cmd>Trouble diagnostics toggle<cr>',
|
||||
desc = 'Diagnostics (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>xX',
|
||||
'<cmd>Trouble diagnostics toggle filter.buf=0<cr>',
|
||||
desc = 'Buffer Diagnostics (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>cs',
|
||||
'<cmd>Trouble symbols toggle focus=false<cr>',
|
||||
desc = 'Symbols (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>cl',
|
||||
'<cmd>Trouble lsp toggle focus=false win.position=right<cr>',
|
||||
desc = 'LSP Definitions / references / ... (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>xL',
|
||||
'<cmd>Trouble loclist toggle<cr>',
|
||||
desc = 'Location List (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>xQ',
|
||||
'<cmd>Trouble qflist toggle<cr>',
|
||||
desc = 'Quickfix List (Trouble)',
|
||||
},
|
||||
},
|
||||
}
|
||||
6
profiles/desktop/.config/nvim/lua/plugins/undotree.lua
Normal file
6
profiles/desktop/.config/nvim/lua/plugins/undotree.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
'mbbill/undotree',
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>ut', vim.cmd.UndotreeToggle)
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
'michaeljsmith/vim-indent-object',
|
||||
config = function() end,
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
'roxma/vim-tmux-clipboard',
|
||||
config = function() end,
|
||||
}
|
||||
18
profiles/desktop/.config/nvim/lua/plugins/which-key.lua
Normal file
18
profiles/desktop/.config/nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
'folke/which-key.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
'<leader>?',
|
||||
function()
|
||||
require('which-key').show({ global = false })
|
||||
end,
|
||||
desc = 'Buffer Local Keymaps (which-key)',
|
||||
},
|
||||
},
|
||||
}
|
||||
39
profiles/desktop/.config/paru/paru.conf
Normal file
39
profiles/desktop/.config/paru/paru.conf
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# $PARU_CONF
|
||||
# /etc/paru.conf
|
||||
# ~/.config/paru/paru.conf
|
||||
#
|
||||
# See the paru.conf(5) manpage for options
|
||||
|
||||
#
|
||||
# GENERAL OPTIONS
|
||||
#
|
||||
[options]
|
||||
PgpFetch
|
||||
Devel
|
||||
Provides
|
||||
DevelSuffixes = -git -cvs -svn -bzr -darcs -always -hg -fossil
|
||||
#AurOnly
|
||||
#BottomUp
|
||||
#RemoveMake
|
||||
SudoLoop
|
||||
#UseAsk
|
||||
#SaveChanges
|
||||
#CombinedUpgrade
|
||||
#CleanAfter
|
||||
#UpgradeMenu
|
||||
#NewsOnUpgrade
|
||||
|
||||
LocalRepo
|
||||
Chroot
|
||||
Sign
|
||||
SignDb
|
||||
#KeepRepoCache
|
||||
|
||||
#
|
||||
# Binary OPTIONS
|
||||
#
|
||||
[bin]
|
||||
#FileManager = vifm
|
||||
MFlags = --nosign
|
||||
#Sudo = doas
|
||||
@@ -0,0 +1,14 @@
|
||||
[github.com*]
|
||||
target=github.com/whiteman808
|
||||
|
||||
[gitlab.com*]
|
||||
target=gitlab.com/whiteman809
|
||||
|
||||
[bitbucket.org*]
|
||||
target=bitbucket.org/whiteman808@paraboletancza.org
|
||||
|
||||
[codeberg.org*]
|
||||
target=codeberg.org/whiteman808
|
||||
|
||||
[git.paraboletancza.org*]
|
||||
target=git.paraboletancza.org/whiteman808
|
||||
319
profiles/desktop/.config/picom/picom.conf
Normal file
319
profiles/desktop/.config/picom/picom.conf
Normal file
@@ -0,0 +1,319 @@
|
||||
#################################
|
||||
# Shadows #
|
||||
#################################
|
||||
|
||||
# Enabled client-side shadows on windows. Note desktop windows
|
||||
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
|
||||
# unless explicitly requested using the wintypes option.
|
||||
#
|
||||
# Can be set per-window using rules.
|
||||
#
|
||||
# Default: false
|
||||
shadow = false;
|
||||
|
||||
# The blur radius for shadows, in pixels.
|
||||
#
|
||||
# Default: 12
|
||||
shadow-radius = 7;
|
||||
|
||||
# The opacity of shadows.
|
||||
#
|
||||
# Range: 0.0 - 1.0
|
||||
# Default: 0.75
|
||||
# shadow-opacity = .75
|
||||
|
||||
# The left offset for shadows, in pixels.
|
||||
#
|
||||
# Default: -15
|
||||
shadow-offset-x = -7;
|
||||
|
||||
# The top offset for shadows, in pixels.
|
||||
#
|
||||
# Default: -15
|
||||
shadow-offset-y = -7;
|
||||
|
||||
# Hex string color value of shadow. Formatted like "#RRGGBB", e.g. "#C0FFEE".
|
||||
#
|
||||
# Default: #000000
|
||||
# shadow-color = "#000000"
|
||||
|
||||
# Crop shadow of a window fully on a particular monitor to that monitor. This is
|
||||
# currently implemented using the X RandR extension.
|
||||
#
|
||||
# Default: false
|
||||
# crop-shadow-to-monitor = false
|
||||
|
||||
|
||||
#################################
|
||||
# Fading #
|
||||
#################################
|
||||
|
||||
# Fade windows in/out when opening/closing and when opacity changes,
|
||||
# unless no-fading-openclose is used. Can be set per-window using rules.
|
||||
#
|
||||
# Default: false
|
||||
fading = false;
|
||||
|
||||
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
|
||||
fade-in-step = 0.03;
|
||||
|
||||
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
|
||||
fade-out-step = 0.03;
|
||||
|
||||
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
|
||||
# fade-delta = 10
|
||||
|
||||
# Do not fade on window open/close.
|
||||
# no-fading-openclose = false
|
||||
|
||||
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
|
||||
# no-fading-destroyed-argb = false
|
||||
|
||||
|
||||
#################################
|
||||
# Transparency / Opacity #
|
||||
#################################
|
||||
|
||||
# Opacity of window titlebars and borders.
|
||||
#
|
||||
# Range: 0.1 - 1.0
|
||||
# Default: 1.0 (disabled)
|
||||
frame-opacity = 0.7;
|
||||
|
||||
# Use fixed inactive dim value, instead of adjusting according to window opacity.
|
||||
#
|
||||
# Default: false
|
||||
# inactive-dim-fixed = true
|
||||
|
||||
#################################
|
||||
# Corners #
|
||||
#################################
|
||||
|
||||
# Sets the radius of rounded window corners. When > 0, the compositor will
|
||||
# round the corners of windows. Does not interact well with
|
||||
# `transparent-clipping`.
|
||||
#
|
||||
# Default: 0 (disabled)
|
||||
corner-radius = 0
|
||||
|
||||
#################################
|
||||
# Blur #
|
||||
#################################
|
||||
|
||||
# Parameters for background blurring, see BLUR section in the man page for more information.
|
||||
# blur-method =
|
||||
# blur-size = 12
|
||||
#
|
||||
# blur-deviation = false
|
||||
#
|
||||
# blur-strength = 5
|
||||
|
||||
# Blur background of semi-transparent / ARGB windows.
|
||||
# Can be set per-window using rules.
|
||||
#
|
||||
# Default: false
|
||||
# blur-background = false
|
||||
|
||||
# Blur background of windows when the window frame is not opaque.
|
||||
# Implies:
|
||||
# blur-background
|
||||
#
|
||||
# Default: false
|
||||
# blur-background-frame = false
|
||||
|
||||
# Use fixed blur strength rather than adjusting according to window opacity.
|
||||
#
|
||||
# Default: false
|
||||
# blur-background-fixed = false
|
||||
|
||||
|
||||
# Specify the blur convolution kernel, with the following format:
|
||||
# example:
|
||||
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
|
||||
# Can also be a pre-defined kernel, see the man page.
|
||||
#
|
||||
# Default: ""
|
||||
blur-kern = "3x3box";
|
||||
|
||||
#################################
|
||||
# General Settings #
|
||||
#################################
|
||||
|
||||
# Enable remote control via D-Bus. See the man page for more details.
|
||||
#
|
||||
# Default: false
|
||||
# dbus = true
|
||||
|
||||
# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
|
||||
# daemon = false
|
||||
|
||||
# Specify the backend to use: `xrender`, `glx`, or `egl`.
|
||||
#
|
||||
# Default: "xrender"
|
||||
backend = "glx"
|
||||
|
||||
# Use higher precision during rendering, and apply dither when presenting the
|
||||
# rendered screen. Reduces banding artifacts, but may cause performance
|
||||
# degradation. Only works with OpenGL.
|
||||
dithered-present = false;
|
||||
|
||||
# Enable/disable VSync.
|
||||
#
|
||||
# Default: false
|
||||
vsync = true;
|
||||
|
||||
# Try to detect windows with rounded corners and don't consider them
|
||||
# shaped windows. The accuracy is not very high, unfortunately.
|
||||
#
|
||||
# Has nothing to do with `corner-radius`.
|
||||
#
|
||||
# Default: false
|
||||
detect-rounded-corners = true;
|
||||
|
||||
# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers
|
||||
# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
|
||||
#
|
||||
# Default: false
|
||||
detect-client-opacity = true;
|
||||
|
||||
# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
|
||||
# rather than listening to 'FocusIn'/'FocusOut' event. May be more accurate,
|
||||
# provided that the WM supports it.
|
||||
#
|
||||
# Default: false
|
||||
# use-ewmh-active-win = false
|
||||
|
||||
# Unredirect all windows if a full-screen opaque window is detected,
|
||||
# to maximize performance for full-screen windows. Known to cause flickering
|
||||
# when redirecting/unredirecting windows.
|
||||
#
|
||||
# Default: false
|
||||
unredir-if-possible = false
|
||||
|
||||
# Delay before unredirecting the window, in milliseconds.
|
||||
#
|
||||
# Default: 0.
|
||||
# unredir-if-possible-delay = 0
|
||||
|
||||
# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
|
||||
# in the same group focused at the same time.
|
||||
#
|
||||
# Default: false
|
||||
detect-transient = true;
|
||||
|
||||
# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
|
||||
# group focused at the same time. This usually means windows from the same application
|
||||
# will be considered focused or unfocused at the same time.
|
||||
# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too.
|
||||
#
|
||||
# Default: false
|
||||
# detect-client-leader = false
|
||||
|
||||
# Use of damage information for rendering. This cause the only the part of the
|
||||
# screen that has actually changed to be redrawn, instead of the whole screen
|
||||
# every time. Should improve performance.
|
||||
#
|
||||
# Default: false
|
||||
use-damage = true;
|
||||
|
||||
# Use X Sync fence to wait for the completion of rendering of other windows,
|
||||
# before using their content to render the current screen.
|
||||
#
|
||||
# Required for explicit sync drivers, such as nvidia.
|
||||
#
|
||||
# Default: false
|
||||
# xrender-sync-fence = false
|
||||
|
||||
# GLX backend: Use specified GLSL fragment shader for rendering window
|
||||
# contents. Read the man page for a detailed explanation of the interface.
|
||||
#
|
||||
# Can be set per-window using rules.
|
||||
#
|
||||
# window-shader-fg = "default"
|
||||
|
||||
# Force all windows to be painted with blending. Useful if you
|
||||
# have a `window-shader-fg` that could turn opaque pixels transparent.
|
||||
#
|
||||
# Default: false
|
||||
# force-win-blend = false
|
||||
|
||||
# Do not use EWMH to detect fullscreen windows.
|
||||
# Reverts to checking if a window is fullscreen based only on its size and coordinates.
|
||||
#
|
||||
# Default: false
|
||||
# no-ewmh-fullscreen = false
|
||||
|
||||
# Dimming bright windows so their brightness doesn't exceed this set value.
|
||||
# Brightness of a window is estimated by averaging all pixels in the window,
|
||||
# so this could comes with a performance hit.
|
||||
# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled.
|
||||
#
|
||||
# Default: 1.0 (disabled)
|
||||
# max-brightness = 1.0
|
||||
|
||||
# Make transparent windows clip other windows like non-transparent windows do,
|
||||
# instead of blending on top of them. e.g. placing a transparent window on top
|
||||
# of another window will cut a "hole" in that window, and show the desktop background
|
||||
# underneath.
|
||||
#
|
||||
# Default: false
|
||||
# transparent-clipping = false
|
||||
|
||||
# Set the log level. Possible values are:
|
||||
# "trace", "debug", "info", "warn", "error"
|
||||
# in increasing level of importance. Case insensitive.
|
||||
# If using the "TRACE" log level, it's better to log into a file
|
||||
# using *--log-file*, since it can generate a huge stream of logs.
|
||||
#
|
||||
# Default: "warn"
|
||||
# log-level = "warn";
|
||||
|
||||
# Set the log file.
|
||||
# If *--log-file* is never specified, logs will be written to stderr.
|
||||
# Otherwise, logs will to written to the given file, though some of the early
|
||||
# logs might still be written to the stderr.
|
||||
# When setting this option from the config file, it is recommended to use an absolute path.
|
||||
#
|
||||
# log-file = "/path/to/your/log/file"
|
||||
|
||||
# Write process ID to a file.
|
||||
# write-pid-path = "/path/to/your/log/file"
|
||||
|
||||
# Rule-based per-window options.
|
||||
#
|
||||
# See WINDOW RULES section in the man page for how these work.
|
||||
rules: ({
|
||||
match = "window_type = 'tooltip'";
|
||||
fade = false;
|
||||
shadow = true;
|
||||
shadow = false;
|
||||
#opacity = 0.75;
|
||||
opacity = 1;
|
||||
full-shadow = false;
|
||||
}, {
|
||||
match = "window_type = 'dock' || "
|
||||
"window_type = 'desktop' || "
|
||||
"_GTK_FRAME_EXTENTS@";
|
||||
blur-background = false;
|
||||
}, {
|
||||
match = "window_type != 'dock'";
|
||||
# shader = "my_shader.frag";
|
||||
}, {
|
||||
match = "window_type = 'dock' || "
|
||||
"window_type = 'desktop'";
|
||||
corner-radius = 0;
|
||||
}, {
|
||||
match = "name = 'Notification' || "
|
||||
"class_g = 'Conky' || "
|
||||
"class_g ?= 'Notify-osd' || "
|
||||
"class_g = 'Cairo-clock' || "
|
||||
"_GTK_FRAME_EXTENTS@";
|
||||
shadow = false;
|
||||
})
|
||||
|
||||
# `@include` directive can be used to include additional configuration files.
|
||||
# Relative paths are search either in the parent of this configuration file
|
||||
# (when the configuration is loaded through a symlink, the symlink will be
|
||||
# resolved first). Or in `$XDG_CONFIG_HOME/picom/include`.
|
||||
#
|
||||
# @include "extra.conf"
|
||||
41
profiles/desktop/.config/qutebrowser/config.py
Normal file
41
profiles/desktop/.config/qutebrowser/config.py
Normal file
@@ -0,0 +1,41 @@
|
||||
## browser config
|
||||
|
||||
# don't load autoconfig
|
||||
config.load_autoconfig(False)
|
||||
|
||||
# appearance
|
||||
config.source('gruvbox.py')
|
||||
|
||||
# editor
|
||||
c.editor.command = ['alacritty', '-T', 'auxiliary text edit', '-e', 'nvim', '{file}', '+call cursor({line}, {column})']
|
||||
|
||||
# auto save session
|
||||
c.auto_save.session = True
|
||||
|
||||
# set dark mode
|
||||
c.colors.webpage.darkmode.enabled = True
|
||||
|
||||
# spell checking
|
||||
c.spellcheck.languages = ['en-US', 'en-GB', 'pl-PL']
|
||||
|
||||
# built-in adblocker
|
||||
c.content.blocking.method = 'both'
|
||||
|
||||
## key bindings
|
||||
|
||||
# swap J and K
|
||||
config.bind('J', 'tab-prev')
|
||||
config.bind('K', 'tab-next')
|
||||
|
||||
# toggle dark mode
|
||||
config.bind('td', 'config-cycle colors.webpage.darkmode.enabled true false')
|
||||
|
||||
# source config
|
||||
config.bind('cs', 'config-source')
|
||||
|
||||
# unfocus text field after exiting insert mode
|
||||
config.bind('<Escape>', 'mode-leave ;; jseval -q document.activeElement.blur()', mode='insert')
|
||||
|
||||
# view videos in mpv
|
||||
config.bind(',m', 'spawn mpv {url}')
|
||||
config.bind(',M', 'hint links spawn mpv {hint-url}')
|
||||
332
profiles/desktop/.config/qutebrowser/gruvbox.py
Normal file
332
profiles/desktop/.config/qutebrowser/gruvbox.py
Normal file
@@ -0,0 +1,332 @@
|
||||
# gruvbox dark hard qutebrowser theme by Florian Bruhin <me@the-compiler.org>
|
||||
#
|
||||
# Originally based on:
|
||||
# base16-qutebrowser (https://github.com/theova/base16-qutebrowser)
|
||||
# Base16 qutebrowser template by theova and Daniel Mulford
|
||||
# Gruvbox dark, hard scheme by Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)
|
||||
|
||||
bg0_hard = "#1d2021"
|
||||
bg0_soft = '#32302f'
|
||||
bg0_normal = '#282828'
|
||||
|
||||
bg0 = bg0_normal
|
||||
bg1 = "#3c3836"
|
||||
bg2 = "#504945"
|
||||
bg3 = "#665c54"
|
||||
bg4 = "#7c6f64"
|
||||
|
||||
fg0 = "#fbf1c7"
|
||||
fg1 = "#ebdbb2"
|
||||
fg2 = "#d5c4a1"
|
||||
fg3 = "#bdae93"
|
||||
fg4 = "#a89984"
|
||||
|
||||
bright_red = "#fb4934"
|
||||
bright_green = "#b8bb26"
|
||||
bright_yellow = "#fabd2f"
|
||||
bright_blue = "#83a598"
|
||||
bright_purple = "#d3869b"
|
||||
bright_aqua = "#8ec07c"
|
||||
bright_gray = "#928374"
|
||||
bright_orange = "#fe8019"
|
||||
|
||||
dark_red = "#cc241d"
|
||||
dark_green = "#98971a"
|
||||
dark_yellow = "#d79921"
|
||||
dark_blue = "#458588"
|
||||
dark_purple = "#b16286"
|
||||
dark_aqua = "#689d6a"
|
||||
dark_gray = "#a89984"
|
||||
dark_orange = "#d65d0e"
|
||||
|
||||
### Completion
|
||||
|
||||
# Text color of the completion widget. May be a single color to use for
|
||||
# all columns or a list of three colors, one for each column.
|
||||
c.colors.completion.fg = [fg1, bright_aqua, bright_yellow]
|
||||
|
||||
# Background color of the completion widget for odd rows.
|
||||
c.colors.completion.odd.bg = bg0
|
||||
|
||||
# Background color of the completion widget for even rows.
|
||||
c.colors.completion.even.bg = c.colors.completion.odd.bg
|
||||
|
||||
# Foreground color of completion widget category headers.
|
||||
c.colors.completion.category.fg = bright_blue
|
||||
|
||||
# Background color of the completion widget category headers.
|
||||
c.colors.completion.category.bg = bg1
|
||||
|
||||
# Top border color of the completion widget category headers.
|
||||
c.colors.completion.category.border.top = c.colors.completion.category.bg
|
||||
|
||||
# Bottom border color of the completion widget category headers.
|
||||
c.colors.completion.category.border.bottom = c.colors.completion.category.bg
|
||||
|
||||
# Foreground color of the selected completion item.
|
||||
c.colors.completion.item.selected.fg = fg0
|
||||
|
||||
# Background color of the selected completion item.
|
||||
c.colors.completion.item.selected.bg = bg4
|
||||
|
||||
# Top border color of the selected completion item.
|
||||
c.colors.completion.item.selected.border.top = bg2
|
||||
|
||||
# Bottom border color of the selected completion item.
|
||||
c.colors.completion.item.selected.border.bottom = c.colors.completion.item.selected.border.top
|
||||
|
||||
# Foreground color of the matched text in the selected completion item.
|
||||
c.colors.completion.item.selected.match.fg = bright_orange
|
||||
|
||||
# Foreground color of the matched text in the completion.
|
||||
c.colors.completion.match.fg = c.colors.completion.item.selected.match.fg
|
||||
|
||||
# Color of the scrollbar handle in the completion view.
|
||||
c.colors.completion.scrollbar.fg = c.colors.completion.item.selected.fg
|
||||
|
||||
# Color of the scrollbar in the completion view.
|
||||
c.colors.completion.scrollbar.bg = c.colors.completion.category.bg
|
||||
|
||||
### Context menu
|
||||
|
||||
# Background color of disabled items in the context menu.
|
||||
c.colors.contextmenu.disabled.bg = bg3
|
||||
|
||||
# Foreground color of disabled items in the context menu.
|
||||
c.colors.contextmenu.disabled.fg = fg3
|
||||
|
||||
# Background color of the context menu. If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.menu.bg = bg0
|
||||
|
||||
# Foreground color of the context menu. If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.menu.fg = fg2
|
||||
|
||||
# Background color of the context menu’s selected item. If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.selected.bg = bg2
|
||||
|
||||
#Foreground color of the context menu’s selected item. If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.selected.fg = c.colors.contextmenu.menu.fg
|
||||
|
||||
### Downloads
|
||||
|
||||
# Background color for the download bar.
|
||||
c.colors.downloads.bar.bg = bg0
|
||||
|
||||
# Color gradient start for download text.
|
||||
c.colors.downloads.start.fg = bg0
|
||||
|
||||
# Color gradient start for download backgrounds.
|
||||
c.colors.downloads.start.bg = bright_blue
|
||||
|
||||
# Color gradient end for download text.
|
||||
c.colors.downloads.stop.fg = c.colors.downloads.start.fg
|
||||
|
||||
# Color gradient stop for download backgrounds.
|
||||
c.colors.downloads.stop.bg = bright_aqua
|
||||
|
||||
# Foreground color for downloads with errors.
|
||||
c.colors.downloads.error.fg = bright_red
|
||||
|
||||
### Hints
|
||||
|
||||
# Font color for hints.
|
||||
c.colors.hints.fg = bg0
|
||||
|
||||
# Background color for hints.
|
||||
c.colors.hints.bg = 'rgba(250, 191, 47, 200)' # bright_yellow
|
||||
|
||||
# Font color for the matched part of hints.
|
||||
c.colors.hints.match.fg = bg4
|
||||
|
||||
### Keyhint widget
|
||||
|
||||
# Text color for the keyhint widget.
|
||||
c.colors.keyhint.fg = fg4
|
||||
|
||||
# Highlight color for keys to complete the current keychain.
|
||||
c.colors.keyhint.suffix.fg = fg0
|
||||
|
||||
# Background color of the keyhint widget.
|
||||
c.colors.keyhint.bg = bg0
|
||||
|
||||
### Messages
|
||||
|
||||
# Foreground color of an error message.
|
||||
c.colors.messages.error.fg = bg0
|
||||
|
||||
# Background color of an error message.
|
||||
c.colors.messages.error.bg = bright_red
|
||||
|
||||
# Border color of an error message.
|
||||
c.colors.messages.error.border = c.colors.messages.error.bg
|
||||
|
||||
# Foreground color of a warning message.
|
||||
c.colors.messages.warning.fg = bg0
|
||||
|
||||
# Background color of a warning message.
|
||||
c.colors.messages.warning.bg = bright_purple
|
||||
|
||||
# Border color of a warning message.
|
||||
c.colors.messages.warning.border = c.colors.messages.warning.bg
|
||||
|
||||
# Foreground color of an info message.
|
||||
c.colors.messages.info.fg = fg2
|
||||
|
||||
# Background color of an info message.
|
||||
c.colors.messages.info.bg = bg0
|
||||
|
||||
# Border color of an info message.
|
||||
c.colors.messages.info.border = c.colors.messages.info.bg
|
||||
|
||||
### Prompts
|
||||
|
||||
# Foreground color for prompts.
|
||||
c.colors.prompts.fg = fg2
|
||||
|
||||
# Border used around UI elements in prompts.
|
||||
c.colors.prompts.border = f'1px solid {bg1}'
|
||||
|
||||
# Background color for prompts.
|
||||
c.colors.prompts.bg = bg3
|
||||
|
||||
# Background color for the selected item in filename prompts.
|
||||
c.colors.prompts.selected.bg = bg2
|
||||
|
||||
### Statusbar
|
||||
|
||||
# Foreground color of the statusbar.
|
||||
c.colors.statusbar.normal.fg = fg2
|
||||
|
||||
# Background color of the statusbar.
|
||||
c.colors.statusbar.normal.bg = bg0
|
||||
|
||||
# Foreground color of the statusbar in insert mode.
|
||||
c.colors.statusbar.insert.fg = bg0
|
||||
|
||||
# Background color of the statusbar in insert mode.
|
||||
c.colors.statusbar.insert.bg = dark_aqua
|
||||
|
||||
# Foreground color of the statusbar in passthrough mode.
|
||||
c.colors.statusbar.passthrough.fg = bg0
|
||||
|
||||
# Background color of the statusbar in passthrough mode.
|
||||
c.colors.statusbar.passthrough.bg = dark_blue
|
||||
|
||||
# Foreground color of the statusbar in private browsing mode.
|
||||
c.colors.statusbar.private.fg = bright_purple
|
||||
|
||||
# Background color of the statusbar in private browsing mode.
|
||||
c.colors.statusbar.private.bg = bg0
|
||||
|
||||
# Foreground color of the statusbar in command mode.
|
||||
c.colors.statusbar.command.fg = fg3
|
||||
|
||||
# Background color of the statusbar in command mode.
|
||||
c.colors.statusbar.command.bg = bg1
|
||||
|
||||
# Foreground color of the statusbar in private browsing + command mode.
|
||||
c.colors.statusbar.command.private.fg = c.colors.statusbar.private.fg
|
||||
|
||||
# Background color of the statusbar in private browsing + command mode.
|
||||
c.colors.statusbar.command.private.bg = c.colors.statusbar.command.bg
|
||||
|
||||
# Foreground color of the statusbar in caret mode.
|
||||
c.colors.statusbar.caret.fg = bg0
|
||||
|
||||
# Background color of the statusbar in caret mode.
|
||||
c.colors.statusbar.caret.bg = dark_purple
|
||||
|
||||
# Foreground color of the statusbar in caret mode with a selection.
|
||||
c.colors.statusbar.caret.selection.fg = c.colors.statusbar.caret.fg
|
||||
|
||||
# Background color of the statusbar in caret mode with a selection.
|
||||
c.colors.statusbar.caret.selection.bg = bright_purple
|
||||
|
||||
# Background color of the progress bar.
|
||||
c.colors.statusbar.progress.bg = bright_blue
|
||||
|
||||
# Default foreground color of the URL in the statusbar.
|
||||
c.colors.statusbar.url.fg = fg4
|
||||
|
||||
# Foreground color of the URL in the statusbar on error.
|
||||
c.colors.statusbar.url.error.fg = dark_red
|
||||
|
||||
# Foreground color of the URL in the statusbar for hovered links.
|
||||
c.colors.statusbar.url.hover.fg = bright_orange
|
||||
|
||||
# Foreground color of the URL in the statusbar on successful load
|
||||
# (http).
|
||||
c.colors.statusbar.url.success.http.fg = bright_red
|
||||
|
||||
# Foreground color of the URL in the statusbar on successful load
|
||||
# (https).
|
||||
c.colors.statusbar.url.success.https.fg = fg0
|
||||
|
||||
# Foreground color of the URL in the statusbar when there's a warning.
|
||||
c.colors.statusbar.url.warn.fg = bright_purple
|
||||
|
||||
### tabs
|
||||
|
||||
# Background color of the tab bar.
|
||||
c.colors.tabs.bar.bg = bg0
|
||||
|
||||
# Color gradient start for the tab indicator.
|
||||
c.colors.tabs.indicator.start = bright_blue
|
||||
|
||||
# Color gradient end for the tab indicator.
|
||||
c.colors.tabs.indicator.stop = bright_aqua
|
||||
|
||||
# Color for the tab indicator on errors.
|
||||
c.colors.tabs.indicator.error = bright_red
|
||||
|
||||
# Foreground color of unselected odd tabs.
|
||||
c.colors.tabs.odd.fg = fg2
|
||||
|
||||
# Background color of unselected odd tabs.
|
||||
c.colors.tabs.odd.bg = bg2
|
||||
|
||||
# Foreground color of unselected even tabs.
|
||||
c.colors.tabs.even.fg = c.colors.tabs.odd.fg
|
||||
|
||||
# Background color of unselected even tabs.
|
||||
c.colors.tabs.even.bg = bg3
|
||||
|
||||
# Foreground color of selected odd tabs.
|
||||
c.colors.tabs.selected.odd.fg = fg2
|
||||
|
||||
# Background color of selected odd tabs.
|
||||
c.colors.tabs.selected.odd.bg = bg0
|
||||
|
||||
# Foreground color of selected even tabs.
|
||||
c.colors.tabs.selected.even.fg = c.colors.tabs.selected.odd.fg
|
||||
|
||||
# Background color of selected even tabs.
|
||||
c.colors.tabs.selected.even.bg = bg0
|
||||
|
||||
# Background color of pinned unselected even tabs.
|
||||
c.colors.tabs.pinned.even.bg = bright_green
|
||||
|
||||
# Foreground color of pinned unselected even tabs.
|
||||
c.colors.tabs.pinned.even.fg = bg2
|
||||
|
||||
# Background color of pinned unselected odd tabs.
|
||||
c.colors.tabs.pinned.odd.bg = bright_green
|
||||
|
||||
# Foreground color of pinned unselected odd tabs.
|
||||
c.colors.tabs.pinned.odd.fg = c.colors.tabs.pinned.even.fg
|
||||
|
||||
# Background color of pinned selected even tabs.
|
||||
c.colors.tabs.pinned.selected.even.bg = bg0
|
||||
|
||||
# Foreground color of pinned selected even tabs.
|
||||
c.colors.tabs.pinned.selected.even.fg = c.colors.tabs.selected.odd.fg
|
||||
|
||||
# Background color of pinned selected odd tabs.
|
||||
c.colors.tabs.pinned.selected.odd.bg = c.colors.tabs.pinned.selected.even.bg
|
||||
|
||||
# Foreground color of pinned selected odd tabs.
|
||||
c.colors.tabs.pinned.selected.odd.fg = c.colors.tabs.selected.odd.fg
|
||||
|
||||
# Background color for webpages if unset (or empty to use the theme's
|
||||
# color).
|
||||
# c.colors.webpage.bg = bg4
|
||||
62
profiles/desktop/.config/ranger/commands.py
Normal file
62
profiles/desktop/.config/ranger/commands.py
Normal 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()
|
||||
1993
profiles/desktop/.config/ranger/commands_full.py
Normal file
1993
profiles/desktop/.config/ranger/commands_full.py
Normal file
File diff suppressed because it is too large
Load Diff
22
profiles/desktop/.config/ranger/preview_sandbox.sh
Executable file
22
profiles/desktop/.config/ranger/preview_sandbox.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
(
|
||||
exec bwrap \
|
||||
--ro-bind /usr/bin /usr/bin \
|
||||
--ro-bind /usr/share/ /usr/share/ \
|
||||
--ro-bind /usr/lib /usr/lib \
|
||||
--ro-bind /usr/lib64 /usr/lib64 \
|
||||
--symlink /usr/bin /bin \
|
||||
--symlink /usr/bin /sbin \
|
||||
--symlink /usr/lib /lib \
|
||||
--symlink /usr/lib64 /lib64 \
|
||||
--proc /proc \
|
||||
--dev /dev \
|
||||
--ro-bind /etc /etc \
|
||||
--ro-bind ~/.config ~/.config \
|
||||
--ro-bind ~/.cache ~/.cache \
|
||||
--ro-bind "$PWD" "$PWD" \
|
||||
--unshare-all \
|
||||
--new-session \
|
||||
bash ~/.config/ranger/scope.sh "$@"
|
||||
)
|
||||
759
profiles/desktop/.config/ranger/rc.conf
Normal file
759
profiles/desktop/.config/ranger/rc.conf
Normal file
@@ -0,0 +1,759 @@
|
||||
# ===================================================================
|
||||
# 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 true
|
||||
|
||||
# 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 ueberzug
|
||||
|
||||
# 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 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
profiles/desktop/.config/ranger/rifle.conf
Normal file
284
profiles/desktop/.config/ranger/rifle.conf
Normal 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
profiles/desktop/.config/ranger/scope.sh
Executable file
350
profiles/desktop/.config/ranger/scope.sh
Executable 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" --wrap=character \
|
||||
-- "${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
|
||||
7
profiles/desktop/.config/rofi/config.rasi
Normal file
7
profiles/desktop/.config/rofi/config.rasi
Normal file
@@ -0,0 +1,7 @@
|
||||
/*-*- mode: css; -*-*/
|
||||
configuration {
|
||||
modi: "drun,run,combi";
|
||||
combi-modi: "drun,run";
|
||||
show-icons: true;
|
||||
}
|
||||
@theme "~/.config/rofi/rounded-purple-dark.rasi"
|
||||
95
profiles/desktop/.config/rofi/rounded-common.rasi
Normal file
95
profiles/desktop/.config/rofi/rounded-common.rasi
Normal file
@@ -0,0 +1,95 @@
|
||||
/* ROUNDED THEME FOR ROFI */
|
||||
/* Author: Newman Sanchez (https://github.com/newmanls) */
|
||||
|
||||
* {
|
||||
font: "Roboto 14";
|
||||
|
||||
background-color: transparent;
|
||||
text-color: @fg0;
|
||||
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
spacing: 0px;
|
||||
}
|
||||
|
||||
window {
|
||||
location: north;
|
||||
y-offset: calc(50% - 176px);
|
||||
width: 480;
|
||||
border-radius: 24px;
|
||||
|
||||
background-color: @bg0;
|
||||
}
|
||||
|
||||
mainbox {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
inputbar {
|
||||
background-color: @bg1;
|
||||
border-color: @bg3;
|
||||
|
||||
border: 2px;
|
||||
border-radius: 16px;
|
||||
|
||||
padding: 8px 16px;
|
||||
spacing: 8px;
|
||||
children: [ prompt, entry ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
text-color: @fg2;
|
||||
}
|
||||
|
||||
entry {
|
||||
placeholder: "Search";
|
||||
placeholder-color: @fg3;
|
||||
}
|
||||
|
||||
message {
|
||||
margin: 12px 0 0;
|
||||
border-radius: 16px;
|
||||
border-color: @bg2;
|
||||
background-color: @bg2;
|
||||
}
|
||||
|
||||
textbox {
|
||||
padding: 8px 24px;
|
||||
}
|
||||
|
||||
listview {
|
||||
background-color: transparent;
|
||||
|
||||
margin: 12px 0 0;
|
||||
lines: 8;
|
||||
columns: 1;
|
||||
|
||||
fixed-height: false;
|
||||
}
|
||||
|
||||
element {
|
||||
padding: 8px 16px;
|
||||
spacing: 8px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
element normal active {
|
||||
text-color: @bg3;
|
||||
}
|
||||
|
||||
element alternate active {
|
||||
text-color: @bg3;
|
||||
}
|
||||
|
||||
element selected normal, element selected active {
|
||||
background-color: @bg3;
|
||||
}
|
||||
|
||||
element-icon {
|
||||
size: 1em;
|
||||
vertical-align: 0.5;
|
||||
}
|
||||
|
||||
element-text {
|
||||
text-color: inherit;
|
||||
}
|
||||
15
profiles/desktop/.config/rofi/rounded-purple-dark.rasi
Normal file
15
profiles/desktop/.config/rofi/rounded-purple-dark.rasi
Normal file
@@ -0,0 +1,15 @@
|
||||
/* ROUNDED THEME FOR ROFI */
|
||||
/* Author: Newman Sanchez (https://github.com/newmanls) */
|
||||
|
||||
* {
|
||||
bg0: #212121F2;
|
||||
bg1: #2A2A2A;
|
||||
bg2: #3D3D3D80;
|
||||
bg3: #AB47BCF2;
|
||||
fg0: #E6E6E6;
|
||||
fg1: #FFFFFF;
|
||||
fg2: #969696;
|
||||
fg3: #3D3D3D;
|
||||
}
|
||||
|
||||
@import "rounded-common.rasi"
|
||||
318
profiles/desktop/.config/sway/config
Normal file
318
profiles/desktop/.config/sway/config
Normal file
@@ -0,0 +1,318 @@
|
||||
## variables ##
|
||||
|
||||
# Logo key. Use Mod1 for Alt.
|
||||
set $mod Mod4
|
||||
set $left h
|
||||
set $down j
|
||||
set $up k
|
||||
set $right l
|
||||
set $term foot
|
||||
set $menu "rofi -modi drun,run -show drun"
|
||||
set $locker "swaylock -f -i ~/.config/sway/lockscreen.png --indicator-radius 100"
|
||||
|
||||
## output configuration ##
|
||||
|
||||
# default wallpaper
|
||||
output * bg ~/.config/sway/wallpaper.png fill
|
||||
|
||||
## sway session ##
|
||||
|
||||
# lock sway session after closing laptop lid
|
||||
bindswitch --locked lid:toggle exec $locker && systemctl sleep
|
||||
|
||||
## input configuration ##
|
||||
|
||||
input type:touchpad {
|
||||
dwt enabled
|
||||
tap enabled
|
||||
natural_scroll disabled
|
||||
middle_emulation enabled
|
||||
}
|
||||
|
||||
input type:keyboard {
|
||||
xkb_layout "pl"
|
||||
}
|
||||
|
||||
## basic key bindings ##
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec $term
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# start your launcher
|
||||
bindsym $mod+d exec $menu
|
||||
|
||||
# rofi-pass
|
||||
bindsym $mod+p exec ~/.local/bin/rofi-pass
|
||||
|
||||
# drop-down terminal
|
||||
# bindsym $mod+b exec foot
|
||||
|
||||
# Drag floating windows by holding down $mod and left mouse button.
|
||||
# Resize them with right mouse button + $mod.
|
||||
# Despite the name, also works for non-floating windows.
|
||||
# Change normal to inverse to use left mouse button for resizing and right
|
||||
# mouse button for dragging.
|
||||
floating_modifier $mod normal
|
||||
|
||||
# shortcut for locking screen
|
||||
bindsym $mod+x exec $locker
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+r reload
|
||||
|
||||
# exit sway (logs you out of your Wayland session)
|
||||
set $mode_system (l)ock, l(o)gout, (s)uspend, (h)ibernate, (r)eboot, shu(t)down
|
||||
mode "$mode_system" {
|
||||
bindsym l exec --no-startup-id $locker, mode "default"
|
||||
bindsym o exec --no-startup-id i3-msg exit, mode "default"
|
||||
bindsym s exec --no-startup-id $locker && systemctl suspend, mode "default"
|
||||
bindsym r exec --no-startup-id systemctl reboot, mode "default"
|
||||
bindsym h exec --no-startup-id systemctl hibernate, mode "default"
|
||||
bindsym t exec --no-startup-id systemctl poweroff -i, mode "default"
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
bindsym $mod+Shift+e mode "$mode_system"
|
||||
|
||||
# special keys to adjust volume via PulseAudio
|
||||
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
|
||||
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -1%
|
||||
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +1%
|
||||
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
|
||||
|
||||
# special keys to adjust brightness via brightnessctl
|
||||
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||
|
||||
# special key to take a screenshot with grim
|
||||
bindsym Print exec grim
|
||||
|
||||
## moving around ##
|
||||
|
||||
# move your focus around
|
||||
bindsym $mod+$left focus left
|
||||
bindsym $mod+$down focus down
|
||||
bindsym $mod+$up focus up
|
||||
bindsym $mod+$right focus right
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move the focused window with the same, but add Shift
|
||||
bindsym $mod+Shift+$left move left
|
||||
bindsym $mod+Shift+$down move down
|
||||
bindsym $mod+Shift+$up move up
|
||||
bindsym $mod+Shift+$right move right
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
## workspaces ##
|
||||
|
||||
# define workspaces
|
||||
set $ws1 "1: "
|
||||
set $ws2 "2: "
|
||||
set $ws3 "3: "
|
||||
set $ws4 "4: "
|
||||
set $ws5 "5: "
|
||||
set $ws6 "6: Libreoffice"
|
||||
set $ws7 "7: Wirtualki"
|
||||
set $ws8 "8: Torrenty"
|
||||
set $ws9 "9: Soulseek"
|
||||
set $ws10 "10: Seamonkey"
|
||||
set $wsF1 "11"
|
||||
set $wsF2 "12"
|
||||
set $wsF3 "13"
|
||||
set $wsF4 "14"
|
||||
set $wsF5 "15"
|
||||
set $wsF6 "16"
|
||||
set $wsF7 "17"
|
||||
set $wsF8 "18"
|
||||
set $wsF9 "19: Tor Browser"
|
||||
set $wsF10 "20: "
|
||||
set $wsF11 "21: KeePass"
|
||||
set $wsF12 "22: Inne"
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace number $ws1
|
||||
bindsym $mod+2 workspace number $ws2
|
||||
bindsym $mod+3 workspace number $ws3
|
||||
bindsym $mod+4 workspace number $ws4
|
||||
bindsym $mod+5 workspace number $ws5
|
||||
bindsym $mod+6 workspace number $ws6
|
||||
bindsym $mod+7 workspace number $ws7
|
||||
bindsym $mod+8 workspace number $ws8
|
||||
bindsym $mod+9 workspace number $ws9
|
||||
bindsym $mod+0 workspace number $ws10
|
||||
bindsym $mod+F1 workspace number $wsF1
|
||||
bindsym $mod+F2 workspace number $wsF2
|
||||
bindsym $mod+F3 workspace number $wsF3
|
||||
bindsym $mod+F4 workspace number $wsF4
|
||||
bindsym $mod+F5 workspace number $wsF5
|
||||
bindsym $mod+F6 workspace number $wsF6
|
||||
bindsym $mod+F7 workspace number $wsF7
|
||||
bindsym $mod+F8 workspace number $wsF8
|
||||
bindsym $mod+F9 workspace number $wsF9
|
||||
bindsym $mod+F10 workspace number $wsF10
|
||||
bindsym $mod+F11 workspace number $wsF11
|
||||
bindsym $mod+F12 workspace number $wsF12
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace number $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace number $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace number $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace number $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace number $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace number $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace number $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace number $ws10
|
||||
bindsym $mod+Shift+F1 move container to workspace number $wsF1
|
||||
bindsym $mod+Shift+F2 move container to workspace number $wsF2
|
||||
bindsym $mod+Shift+F3 move container to workspace number $wsF3
|
||||
bindsym $mod+Shift+F4 move container to workspace number $wsF4
|
||||
bindsym $mod+Shift+F5 move container to workspace number $wsF5
|
||||
bindsym $mod+Shift+F6 move container to workspace number $wsF6
|
||||
bindsym $mod+Shift+F7 move container to workspace number $wsF7
|
||||
bindsym $mod+Shift+F8 move container to workspace number $wsF8
|
||||
bindsym $mod+Shift+F9 move container to workspace number $wsF9
|
||||
bindsym $mod+Shift+F10 move container to workspace number $wsF10
|
||||
bindsym $mod+Shift+F11 move container to workspace number $wsF11
|
||||
bindsym $mod+Shift+F12 move container to workspace number $wsF12
|
||||
|
||||
# window assignments
|
||||
assign [app_id="[Ff]irefox"] $ws2
|
||||
assign [app_id="[Ll]ibre[Ww]olf"] $ws2
|
||||
assign [app_id="[Cc]hromium"] $ws3
|
||||
assign [app_id="[Tt]hunderbird"] $ws4
|
||||
assign [class="[Ee]macs"] $ws5
|
||||
assign [app_id="[Ll]ibreoffice.*"] $ws6
|
||||
assign [app_id="[Vv]irt.*[Mm]anager"] $ws7
|
||||
assign [app_id="[Vv]irt.*[Vv]iewer"] $ws7
|
||||
assign [app_id="[Qq]emu"] $ws7
|
||||
assign [app_id="q[Bb]ittorrent"] $ws8
|
||||
assign [app_id="[Nn]icotine"] $ws9
|
||||
assign [class="[Ss]ea[Mm]onkey"] $ws10
|
||||
assign [app_id="[Tt]or.*[Bb]rowser"] $wsF9
|
||||
assign [app_id="[Kk]iwix"] $wsF10
|
||||
assign [app_id="[Kk]ee[Pp]ass"] $wsF11
|
||||
assign [app_id="[Mm]ullvad.*"] $wsF12
|
||||
assign [app_id="[Gg]alaxy.*[Bb]uds.*[Cc]lient"] $wsF12
|
||||
assign [app_id="qutebrowser"] $wsF12
|
||||
assign [app_id="[Tt]hunar"] $wsF12
|
||||
assign [app_id="[Ll]uakit"] $wsF12
|
||||
for_window [app_id="[Tt]or\s*[Bb]rowser"] floating enable, border normal
|
||||
for_window [app_id="[Ff]lame[Ss]hot"] floating enable, border normal
|
||||
for_window [class="[Pp]inentry"] floating enable, border normal
|
||||
|
||||
## layout ##
|
||||
|
||||
# set default workspace layout
|
||||
workspace_layout tabbed
|
||||
|
||||
# changing layout
|
||||
bindsym $mod+Control+h splith
|
||||
bindsym $mod+Control+v splitv
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# make the current focus fullscreen
|
||||
bindsym $mod+f fullscreen
|
||||
|
||||
# toggle the current focus between tiling and floating mode
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# swap focus between the tiling area and the floating area
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# move focus to the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
## scratchpad ##
|
||||
|
||||
# move the currently focused window to the scratchpad
|
||||
bindsym $mod+Shift+minus move scratchpad
|
||||
|
||||
# show the next scratchpad window or hide the focused scratchpad window.
|
||||
# if there are multiple scratchpad windows, this command cycles through them.
|
||||
bindsym $mod+minus scratchpad show
|
||||
|
||||
## resizing containers ##
|
||||
|
||||
mode "resize" {
|
||||
# left will shrink the containers width
|
||||
# right will grow the containers width
|
||||
# up will shrink the containers height
|
||||
# down will grow the containers height
|
||||
bindsym $left resize shrink width 10px
|
||||
bindsym $down resize grow height 10px
|
||||
bindsym $up resize shrink height 10px
|
||||
bindsym $right resize grow width 10px
|
||||
|
||||
# ditto, with arrow keys
|
||||
bindsym Left resize shrink width 10px
|
||||
bindsym Down resize grow height 10px
|
||||
bindsym Up resize shrink height 10px
|
||||
bindsym Right resize grow width 10px
|
||||
|
||||
# return to default mode
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
## hide title bar ##
|
||||
font pango:Iosevka,Font Awesome 7 Free,Font Awesome 7 Brands 11
|
||||
titlebar_border_thickness 0
|
||||
titlebar_padding 0
|
||||
hide_edge_borders --smart-titles both
|
||||
|
||||
## status bar ##
|
||||
bar {
|
||||
position top
|
||||
status_command i3blocks -c ~/.config/i3blocks/i3blocks.conf
|
||||
font pango:Iosevka,Font Awesome 7 Free,Font Awesome 7 Brands 13
|
||||
|
||||
colors {
|
||||
statusline #ffffff
|
||||
background #00000099
|
||||
separator #000000
|
||||
|
||||
focused_workspace #34003f #6e0284 #ffffff
|
||||
#active_workspace #333333 #5f676a #ffffff
|
||||
inactive_workspace #220028 #35013f #888888
|
||||
urgent_workspace #470801 #630000 #ffffff
|
||||
#binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
}
|
||||
|
||||
## color scheme for windows ##
|
||||
# border background text indicator (a line which shows where the next window will be placed)
|
||||
client.focused #0b4701 #044f00 #ffffff #0b4701
|
||||
client.unfocused #072d00 #023000 #969696 #072d00
|
||||
client.focused_inactive #072d00 #023000 #969696 #072d00
|
||||
client.urgent #630000 #630000 #ffffff #630000
|
||||
|
||||
## don't follow focus with mouse ##
|
||||
focus_follows_mouse no
|
||||
|
||||
## run pure wayland session ##
|
||||
# xwayland disable
|
||||
|
||||
## autostart ##
|
||||
exec chromium
|
||||
exec firefox
|
||||
exec thunderbird
|
||||
workspace number $ws1
|
||||
exec foot
|
||||
|
||||
include /etc/sway/config.d/*
|
||||
BIN
profiles/desktop/.config/sway/lockscreen.png
Normal file
BIN
profiles/desktop/.config/sway/lockscreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
BIN
profiles/desktop/.config/sway/wallpaper.png
Normal file
BIN
profiles/desktop/.config/sway/wallpaper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 877 KiB |
17
profiles/desktop/.config/tmuxinator/misc.yml
Normal file
17
profiles/desktop/.config/tmuxinator/misc.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: misc
|
||||
root: ~/
|
||||
windows:
|
||||
# - portage:
|
||||
# layout: 2b75,159x42,0,0{79x42,0,0[79x21,0,0,1,79x20,0,22,14],79x42,80,0[79x13,80,0,9,79x13,80,14,10,79x14,80,28,11]}
|
||||
# panes:
|
||||
# - sudo -i
|
||||
# - sudo -i
|
||||
# - sudo watch -c -n 5 genlop -c -i
|
||||
# - sudo tail -f /var/log/emerge-fetch.log
|
||||
# - cd ~/whiteman808_overlay
|
||||
# - poczta: neomutt
|
||||
# - irc: weechat
|
||||
# - kpop: ncmpcpp
|
||||
- irc: weechat
|
||||
- zsh:
|
||||
4
profiles/desktop/.config/tmuxinator/quake.yml
Normal file
4
profiles/desktop/.config/tmuxinator/quake.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
name: quake
|
||||
root: ~/
|
||||
windows:
|
||||
- jabber: profanity
|
||||
12
profiles/desktop/.emacs.d/early-init.el
Normal file
12
profiles/desktop/.emacs.d/early-init.el
Normal file
@@ -0,0 +1,12 @@
|
||||
;; set native compilation cache directory
|
||||
(startup-redirect-eln-cache
|
||||
(convert-standard-filename
|
||||
(expand-file-name "~/.cache/emacs/eln-cache/")))
|
||||
|
||||
;; performance tuning
|
||||
;; set as recommended at https://emacs-lsp.github.io/lsp-mode/page/performance/
|
||||
(setq gc-cons-threshold 100000000)
|
||||
(setq read-process-output-max (* 1024 1024)) ;; 1mb
|
||||
(setenv "LSP_USE_PLISTS" "true")
|
||||
(setq lsp-idle-delay 0.500)
|
||||
(setq lsp-log-io nil) ; if set to true can cause a performance hit
|
||||
20
profiles/desktop/.emacs.d/init.el
Normal file
20
profiles/desktop/.emacs.d/init.el
Normal file
@@ -0,0 +1,20 @@
|
||||
;;; init.el --- my emacs config -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; set load path
|
||||
(add-to-list 'load-path "~/.emacs.d/modules")
|
||||
|
||||
;; include modules containing various configs
|
||||
(dolist (module '(common
|
||||
package-manager
|
||||
user-interface
|
||||
editing
|
||||
programming
|
||||
org-mode
|
||||
sysadm
|
||||
erc
|
||||
misc))
|
||||
(require module))
|
||||
|
||||
(provide 'init)
|
||||
;;; init.el ends here
|
||||
80
profiles/desktop/.emacs.d/lisp/custom-settings.el
Normal file
80
profiles/desktop/.emacs.d/lisp/custom-settings.el
Normal file
@@ -0,0 +1,80 @@
|
||||
;;; custom-settings.el --- settings made by custom -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(ansi-color-black ((t (:foreground "#000000"))))
|
||||
'(ansi-color-blue ((t (:foreground "#004f9e"))))
|
||||
'(ansi-color-bright-black ((t (:foreground "#5d5d5d"))))
|
||||
'(ansi-color-bright-blue ((t (:foreground "#0071ff"))))
|
||||
'(ansi-color-bright-cyan ((t (:foreground "#4bb8fd"))))
|
||||
'(ansi-color-bright-green ((t (:foreground "#7bc91f"))))
|
||||
'(ansi-color-bright-magenta ((t (:foreground "#ff1d62"))))
|
||||
'(ansi-color-bright-red ((t (:foreground "#ff361e"))))
|
||||
'(ansi-color-bright-white ((t (:foreground "#ffffff"))))
|
||||
'(ansi-color-bright-yellow ((t (:foreground "#ffd00a"))))
|
||||
'(ansi-color-cyan ((t (:foreground "#2aa7e7"))))
|
||||
'(ansi-color-green ((t (:foreground "#6ab017"))))
|
||||
'(ansi-color-magenta ((t (:foreground "#ec0048"))))
|
||||
'(ansi-color-red ((t (:foreground "#e1321a"))))
|
||||
'(ansi-color-yellow ((t (:foreground "#ffc005"))))
|
||||
'(eat-term-color-0 ((t (:foreground "#000000"))))
|
||||
'(eat-term-color-1 ((t (:foreground "#e1321a"))))
|
||||
'(eat-term-color-10 ((t (:foreground "#7bc91f"))))
|
||||
'(eat-term-color-11 ((t (:foreground "#ffd00a"))))
|
||||
'(eat-term-color-12 ((t (:foreground "#0071ff"))))
|
||||
'(eat-term-color-13 ((t (:foreground "#ff1d62"))))
|
||||
'(eat-term-color-14 ((t (:foreground "#4bb8fd"))))
|
||||
'(eat-term-color-15 ((t (:foreground "#ffffff"))))
|
||||
'(eat-term-color-2 ((t (:foreground "#6ab017"))))
|
||||
'(eat-term-color-3 ((t (:foreground "#ffc005"))))
|
||||
'(eat-term-color-4 ((t (:foreground "#004f9e"))))
|
||||
'(eat-term-color-5 ((t (:foreground "#ec0048"))))
|
||||
'(eat-term-color-6 ((t (:foreground "#2aa7e7"))))
|
||||
'(eat-term-color-7 ((t (:foreground "#f2f2f2"))))
|
||||
'(eat-term-color-8 ((t (:foreground "#5d5d5d"))))
|
||||
'(eat-term-color-9 ((t (:foreground "#ff361e"))))
|
||||
'(term-color-black ((t (:background "#000000" :foreground "#000000"))))
|
||||
'(term-color-blue ((t (:background "#004f9e" :foreground "#004f9e"))))
|
||||
'(term-color-bright-black ((t (:background "#5d5d5d" :foreground "#5d5d5d"))))
|
||||
'(term-color-bright-blue ((t (:background "#0071ff" :foreground "#0071ff"))))
|
||||
'(term-color-bright-cyan ((t (:background "#4bb8fd" :foreground "#4bb8fd"))))
|
||||
'(term-color-bright-green ((t (:background "#7bc91f" :foreground "#7bc91f"))))
|
||||
'(term-color-bright-magenta ((t (:background "#ff1d62" :foreground "#ff1d62"))))
|
||||
'(term-color-bright-red ((t (:background "#ff361e" :foreground "#ff361e"))))
|
||||
'(term-color-bright-white ((t (:background "#ffffff" :foreground "#ffffff"))))
|
||||
'(term-color-bright-yellow ((t (:background "#ffd00a" :foreground "#ffd00a"))))
|
||||
'(term-color-cyan ((t (:background "#2aa7e7" :foreground "#2aa7e7"))))
|
||||
'(term-color-green ((t (:background "#6ab017" :foreground "#6ab017"))))
|
||||
'(term-color-magenta ((t (:background "#ec0048" :foreground "#ec0048"))))
|
||||
'(term-color-red ((t (:background "#e1321a" :foreground "#e1321a"))))
|
||||
'(term-color-white ((t (:background "#f2f2f2" :foreground "#f2f2f2"))))
|
||||
'(term-color-yellow ((t (:background "#ffc005" :foreground "#ffc005"))))
|
||||
'(vterm-color-black ((t (:background "#000000" :foreground "#000000"))))
|
||||
'(vterm-color-blue ((t (:background "#004f9e" :foreground "#004f9e"))))
|
||||
'(vterm-color-bright-black ((t (:background "#5d5d5d" :foreground "#5d5d5d"))))
|
||||
'(vterm-color-bright-blue ((t (:background "#0071ff" :foreground "#0071ff"))))
|
||||
'(vterm-color-bright-cyan ((t (:background "#4bb8fd" :foreground "#4bb8fd"))))
|
||||
'(vterm-color-bright-green ((t (:background "#7bc91f" :foreground "#7bc91f"))))
|
||||
'(vterm-color-bright-magenta ((t (:background "#ff1d62" :foreground "#ff1d62"))))
|
||||
'(vterm-color-bright-red ((t (:background "#ff361e" :foreground "#ff361e"))))
|
||||
'(vterm-color-bright-white ((t (:background "#ffffff" :foreground "#ffffff"))))
|
||||
'(vterm-color-bright-yellow ((t (:background "#ffd00a" :foreground "#ffd00a"))))
|
||||
'(vterm-color-cyan ((t (:background "#2aa7e7" :foreground "#2aa7e7"))))
|
||||
'(vterm-color-green ((t (:background "#6ab017" :foreground "#6ab017"))))
|
||||
'(vterm-color-magenta ((t (:background "#ec0048" :foreground "#ec0048"))))
|
||||
'(vterm-color-red ((t (:background "#e1321a" :foreground "#e1321a"))))
|
||||
'(vterm-color-white ((t (:background "#f2f2f2" :foreground "#f2f2f2"))))
|
||||
'(vterm-color-yellow ((t (:background "#ffc005" :foreground "#ffc005")))))
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
)
|
||||
|
||||
(provide 'custom-settings)
|
||||
;; custom-settings.el ends here
|
||||
493
profiles/desktop/.emacs.d/lisp/no-littering.el
Normal file
493
profiles/desktop/.emacs.d/lisp/no-littering.el
Normal file
@@ -0,0 +1,493 @@
|
||||
;;; no-littering.el --- Help keeping ~/.config/emacs clean -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2016-2026 Jonas Bernoulli
|
||||
|
||||
;; Author: Jonas Bernoulli <emacs.no-littering@jonas.bernoulli.dev>
|
||||
;; Homepage: https://github.com/emacscollective/no-littering
|
||||
;; Keywords: convenience
|
||||
|
||||
;; Package-Version: 1.8.3
|
||||
;; Package-Requires: (
|
||||
;; (emacs "26.1")
|
||||
;; (compat "30.1"))
|
||||
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
;; This file 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 file 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 file. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Help keeping ~/.config/emacs clean.
|
||||
|
||||
;; The default paths used to store configuration files and persistent
|
||||
;; data are not consistent across Emacs packages. This isn't just a
|
||||
;; problem with third-party packages but even with built-in packages.
|
||||
|
||||
;; Some packages put these files directly in `user-emacs-directory'
|
||||
;; or $HOME or in a subdirectory of either of the two or elsewhere.
|
||||
;; Furthermore sometimes file names are used that don't provide any
|
||||
;; insight into what package might have created them.
|
||||
|
||||
;; This package sets out to fix this by changing the values of path
|
||||
;; variables to put configuration files in `no-littering-etc-directory'
|
||||
;; (defaulting to "etc/" under `user-emacs-directory', thus usually
|
||||
;; "~/.config/emacs/etc/") and persistent data files in
|
||||
;; `no-littering-var-directory' (defaulting to "var/" under
|
||||
;; `user-emacs-directory', thus usually "~/.emacs.d/var/"), and
|
||||
;; by using descriptive file names and subdirectories when appropriate.
|
||||
;; This is similar to a color-theme; a "path-theme" if you will.
|
||||
|
||||
;; We still have a long way to go until most built-in and many third-
|
||||
;; party path variables are properly "themed". Like a color-theme,
|
||||
;; this package depends on user contributions to accomplish decent
|
||||
;; coverage. Pull requests are highly welcome (but please follow the
|
||||
;; conventions described below and in the pull request template).
|
||||
|
||||
;; This package does not automatically migrate existing files to their
|
||||
;; new locations, but unless you want to, you also do not have to do
|
||||
;; it completely by hand. The contributed "migrate.org" provides some
|
||||
;; guidance and tools to help with the migration.
|
||||
|
||||
;;;; Usage
|
||||
|
||||
;; Load the feature `no-littering' as early as possible in your init
|
||||
;; file. Make sure you load it at least before you change any path
|
||||
;; variables using some other method.
|
||||
;;
|
||||
;; (require 'no-littering)
|
||||
|
||||
;; If you would like to use base directories different from what
|
||||
;; `no-littering' uses by default, then you have to set the respective
|
||||
;; variables before loading the feature.
|
||||
;;
|
||||
;; (eval-and-compile ; Ensure values don't differ at compile time.
|
||||
;; (setq no-littering-etc-directory
|
||||
;; (expand-file-name "config/" user-emacs-directory))
|
||||
;; (setq no-littering-var-directory
|
||||
;; (expand-file-name "data/" user-emacs-directory))
|
||||
;; (require 'no-littering)
|
||||
|
||||
;; For additional optional settings see "README.org".
|
||||
|
||||
;;;; Conventions
|
||||
|
||||
;; Please see the "README.org" file in this repository or the exported
|
||||
;; version at https://emacsmirror.net/manual/no-littering.html.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'compat)
|
||||
|
||||
(defvar no-littering-etc-directory
|
||||
(expand-file-name (convert-standard-filename "etc/") user-emacs-directory)
|
||||
"The directory where packages place their configuration files.
|
||||
This variable has to be set before `no-littering' is loaded.")
|
||||
|
||||
(defvar no-littering-var-directory
|
||||
(expand-file-name (convert-standard-filename "var/") user-emacs-directory)
|
||||
"The directory where packages place their persistent data files.
|
||||
This variable has to be set before `no-littering' is loaded.")
|
||||
|
||||
;;;###autoload
|
||||
(defun no-littering-expand-etc-file-name (file)
|
||||
"Expand filename FILE relative to `no-littering-etc-directory'."
|
||||
(expand-file-name (convert-standard-filename file)
|
||||
no-littering-etc-directory))
|
||||
|
||||
;;;###autoload
|
||||
(defun no-littering-expand-var-file-name (file)
|
||||
"Expand filename FILE relative to `no-littering-var-directory'."
|
||||
(expand-file-name (convert-standard-filename file)
|
||||
no-littering-var-directory))
|
||||
|
||||
(cl-letf (((symbol-function 'etc)
|
||||
(symbol-function #'no-littering-expand-etc-file-name))
|
||||
((symbol-function 'var)
|
||||
(symbol-function #'no-littering-expand-var-file-name)))
|
||||
(make-directory no-littering-etc-directory t)
|
||||
(make-directory no-littering-var-directory t)
|
||||
(with-no-warnings ; many of these variables haven't been defined yet
|
||||
|
||||
;;; Built-in packages
|
||||
|
||||
(setq abbrev-file-name (etc "abbrev.el"))
|
||||
(setq auto-insert-directory (etc "auto-insert/"))
|
||||
(setq auto-save-list-file-prefix (var "auto-save/sessions/"))
|
||||
(setq bookmark-default-file (var "bookmark-default.el"))
|
||||
(setq calc-settings-file (etc "calc-settings.el"))
|
||||
(setq desktop-dirname (var "desktop/"))
|
||||
(setq desktop-path (list desktop-dirname))
|
||||
(setq diary-file (var "diary"))
|
||||
(setq ecomplete-database-file (var "ecomplete-database.el"))
|
||||
(setq ede-project-placeholder-cache-file (var "ede-projects.el"))
|
||||
(setq erc-dcc-get-default-directory (var "erc/dcc/"))
|
||||
(setq erc-log-channels-directory (var "erc/log-channels/"))
|
||||
(setq erc-startup-file-list (list (etc "erc/startup.el")
|
||||
(etc "erc/startup")
|
||||
".ercrc.el"
|
||||
".ercrc"))
|
||||
(setq eshell-aliases-file (etc "eshell/aliases"))
|
||||
;; This controls where `eshell-history-file-name' is places.
|
||||
;; Other files belong in "etc/" so theme their variables directly.
|
||||
(setq eshell-directory-name (var "eshell/"))
|
||||
(setq eshell-login-script (etc "eshell/login"))
|
||||
(setq eshell-rc-script (etc "eshell/rc"))
|
||||
(setq eudc-options-file (etc "eudc-options.el"))
|
||||
(setq eww-bookmarks-directory (var "eww/"))
|
||||
(setq filesets-menu-cache-file (var "filesets-menu-cache.el"))
|
||||
(setq gamegrid-user-score-file-directory (var "gamegrid-user-score/"))
|
||||
(setq gnus-dribble-directory (var "gnus/dribble/"))
|
||||
(setq gnus-init-file (etc "gnus/init.el"))
|
||||
;; Gnus hardcodes newsrc.eld to be based on gnus-startup-file.
|
||||
(setq gnus-startup-file (etc "gnus/newsrc"))
|
||||
(setq ido-save-directory-list-file (var "ido-save-directory-list.el"))
|
||||
(setq ielm-history-file-name (var "ielm-history.eld"))
|
||||
(setq image-dired-db-file (var "image-dired/db.el"))
|
||||
(setq image-dired-dir (var "image-dired/"))
|
||||
(setq image-dired-gallery-dir (var "image-dired/gallery/"))
|
||||
(setq image-dired-temp-image-file (var "image-dired/temp-image"))
|
||||
(setq image-dired-temp-rotate-image-file (var "image-dired/temp-rotate-image"))
|
||||
(setq Info-saved-history-file (var "info-saved-history.eld"))
|
||||
(setq kkc-init-file-name (var "kkc-init.el"))
|
||||
(setq multisession-directory (var "multisession/"))
|
||||
(setq newsticker-cache-filename (var "newsticker/cache.el"))
|
||||
(setq newsticker-dir (var "newsticker/data/"))
|
||||
(setq nsm-settings-file (var "nsm-settings.el"))
|
||||
(setq org-clock-persist-file (var "org/clock-persist.el"))
|
||||
(setq org-id-locations-file (var "org/id-locations.el"))
|
||||
(setq org-persist-directory (var "org/persist/"))
|
||||
(setq org-publish-timestamp-directory (var "org/timestamps/"))
|
||||
(setq persist--directory-location (var "persist/"))
|
||||
(setq project-list-file (var "project-list.el"))
|
||||
(setq quickurl-url-file (var "quickurl-url.el"))
|
||||
(setq rcirc-log-directory (var "rcirc-log/"))
|
||||
(setq recentf-save-file (var "recentf-save.el"))
|
||||
(setq remember-data-directory (var "remember/data.d/"))
|
||||
(setq remember-data-file (var "remember/data"))
|
||||
(setq save-place-file (var "save-place.el"))
|
||||
(setq savehist-file (var "savehist.el"))
|
||||
(setq semanticdb-default-save-directory (var "semantic/"))
|
||||
(setq server-auth-dir (var "server/auth/"))
|
||||
(setq shadow-info-file (var "shadow/info.el"))
|
||||
(setq shadow-todo-file (var "shadow/todo.el"))
|
||||
(setq shared-game-score-directory (var "shared-game-score/"))
|
||||
(setq srecode-map-save-file (var "srecode-map.el"))
|
||||
(setq timeclock-file (var "timeclock"))
|
||||
(setq tramp-auto-save-directory (var "tramp/auto-save/"))
|
||||
(setq tramp-persistency-file-name (var "tramp/persistency.el"))
|
||||
(setq type-break-file-name (var "type-break.el"))
|
||||
(setq url-cache-directory (var "url/cache/"))
|
||||
(setq url-configuration-directory (var "url/"))
|
||||
(setq url-cookie-file (var "url/cookies.el"))
|
||||
(setq url-history-file (var "url/history.el"))
|
||||
|
||||
(eval-after-load 'desktop '(make-directory desktop-dirname t))
|
||||
(eval-after-load 'erc '(make-directory erc-dcc-get-default-directory t))
|
||||
(eval-after-load 'eshell `(with-file-modes #o700
|
||||
(make-directory ,(etc "eshell/") t)))
|
||||
(eval-after-load 'eww '(make-directory eww-bookmarks-directory t))
|
||||
(eval-after-load 'gnus `(make-directory ,(etc "gnus/") t))
|
||||
(eval-after-load 'gnus '(make-directory gnus-dribble-directory t))
|
||||
(eval-after-load 'newsticker `(make-directory ,(var "newsticker/") t))
|
||||
(eval-after-load 'org `(make-directory ,(var "org/") t))
|
||||
(eval-after-load 'shadowfile `(make-directory ,(var "shadow/") t))
|
||||
(eval-after-load 'treesit `(push ,(var "treesit/") treesit-extra-load-path))
|
||||
|
||||
;;; Third-party packages
|
||||
|
||||
(setq abm-file (var "autobookmarks.el"))
|
||||
(setq ac-comphist-file (var "ac-comphist.el"))
|
||||
(setq amx-save-file (var "amx-save.el"))
|
||||
(setq anaconda-mode-installation-directory (var "anaconda-mode/"))
|
||||
(setq annotate-file (var "annotations.el"))
|
||||
(setq async-byte-compile-log-file (var "async-bytecomp.log"))
|
||||
(setq autocrypt-save-file (var "autocrypt-data.eld"))
|
||||
(setq auto-package-update-last-update-day-path (var "auto-package-update-last-update-day"))
|
||||
(setq bbdb-file (var "bbdb/bbdb.el"))
|
||||
(setq bbdb-vcard-directory (var "bbdb/vcard/"))
|
||||
(setq binky-cache-directory (var "binky/cache/"))
|
||||
(setq blamer-avatar-folder (var "blamer/avatars/"))
|
||||
(setq bm-repository-file (var "bm-repository.el"))
|
||||
(setq bmkp-bmenu-commands-file (var "bmkp/bmenu-commands.el"))
|
||||
(setq bmkp-current-bookmark-file (var "bmkp/current-bookmark.el"))
|
||||
(setq bmkp-last-bookmark-file (var "bmkp/last-bookmark.el"))
|
||||
(setq bookiez-file (var "bookiez"))
|
||||
(setq cider-repl-history-file (var "cider-repl-history.el"))
|
||||
(setq clm/logging-dir (var "command-log-mode/logging/"))
|
||||
(setq code-review-db-database-file (var "code-review/database.sqlite"))
|
||||
(setq code-review-download-dir (var "code-review/downloads/"))
|
||||
(setq code-review-log-file (var "code-review/log"))
|
||||
(setq company-statistics-file (var "company/statistics.el"))
|
||||
(setq company-tabnine-binaries-folder (var "company/tabnine-binaries"))
|
||||
(setq conventional-changelog-tmp-dir (var "conventional-changelog/"))
|
||||
(setq copilot-install-dir (var "copilot/"))
|
||||
(setq dap-breakpoints-file (var "dap/breakpoints.el"))
|
||||
(setq dap-java-test-runner (var "lsp-java/eclipse.jdt.ls/test-runner/junit-platform-console-standalone.jar"))
|
||||
(setq dap-utils-extension-path (var "dap/extensions/"))
|
||||
(setq dape-adapter-dir (var "dape/adapters/"))
|
||||
(setq dape-default-breakpoints-file (var "dape/breakpoints.eld"))
|
||||
(setq debbugs-gnu-persistency-file (var "debbugs.el"))
|
||||
(setq detached-db-directory (var "detached/db/"))
|
||||
(setq detached-session-directory (var "detached/sessions/"))
|
||||
(setq devdocs-browser-cache-directory (var "devdocs/browser-cache/"))
|
||||
(setq devdocs-data-dir (var "devdocs/data/"))
|
||||
(setq dired-recent-directories-file (var "dired-recent-directories.el"))
|
||||
(setq dirvish-cache-dir (var "dirvish/cache"))
|
||||
(setq efar-state-file-name (var "efar-state.eld"))
|
||||
(setq eglot-fsharp-server-install-dir (var "eglot/servers/fsharp/"))
|
||||
(setq elbank-data-file (var "elbank-data.el"))
|
||||
(setq elfeed-autotag-files (list (etc "elfeed/autotags.org")))
|
||||
(setq elfeed-db-directory (var "elfeed/db/"))
|
||||
(setq elfeed-enclosure-default-dir (var "elfeed/enclosures/"))
|
||||
(setq elfeed-score-rule-stats-file (var "elfeed/score/score-rule-stats.eld"))
|
||||
(setq elfeed-score-score-file (etc "elfeed/score/score.el"))
|
||||
(setq elgrep-data-file (var "elgrep-data.el"))
|
||||
(setq elisp-autofmt-cache-directory (var "elisp-autofmt/cache/"))
|
||||
(setq elmo-msgdb-directory (var "elmo/"))
|
||||
(setq elmo-split-log-file (var "elmo/split-log"))
|
||||
(setq elpher-bookmarks-file (var "elpher-bookmarks.el"))
|
||||
(setq emacs-gc-stats-file (var "emacs-gc-stats.eld"))
|
||||
(setq ement-sessions-file (var "ement-sessions.el"))
|
||||
(setq emms-directory (var "emms/"))
|
||||
(setq emojify-emojis-dir (var "emojify/"))
|
||||
(setq epkg-repository (var "epkgs/"))
|
||||
(setq equake-persistent-display-file (var "equake-persistent-display"))
|
||||
(setq fontaine-latest-state-file (var "fontaine-latest-state.eld"))
|
||||
(setq forge-database-file (var "forge/database.sqlite"))
|
||||
(setq forge-post-directory (var "forge/posts/"))
|
||||
(setq geben-temporary-file-directory (var "geben/"))
|
||||
(setq geiser-repl-history-filename (var "geiser/repl-history"))
|
||||
(setq gnus-notes-file (var "gnus-notes/articles.el"))
|
||||
(setq gnus-notes-top-dir (var "gnus-notes/"))
|
||||
(setq gptel-crowdsourced-prompts-file (var "gptel-crowdsourced-prompts.csv"))
|
||||
(setq gptel-gh-token-file (var "gptel/gh-token"))
|
||||
(setq gptel-gh-github-token-file (var "gptel/gh-github-token"))
|
||||
(setq grammalecte-settings-file (etc "grammalecte-settings.el"))
|
||||
(setq hackernews-visited-links-file (var "hackernews/visited-links.el"))
|
||||
(setq harpoon-cache-file (var "harpoon/"))
|
||||
(setq helm-adaptive-history-file (var "helm/adaptive-history.el"))
|
||||
(setq helm-backup-path (var "helm/backup/"))
|
||||
(setq helm-github-stars-cache-file (var "helm/github-stars-cache.el"))
|
||||
(setq helm-net-curl-log-file (var "helm/helm-curl.log"))
|
||||
(setq historian-save-file (var "historian-save.el"))
|
||||
(setq indium-workspace-file (var "indium/workspaces.el"))
|
||||
(setq irfc-directory (var "irfc/"))
|
||||
(setq irony-user-dir (var "irony/"))
|
||||
(setq jabber-avatar-cache-directory (var "jabber/avatar-cache"))
|
||||
(setq jabber-history-dir (var "jabber/history"))
|
||||
(setq keyfreq-file (var "keyfreq.el"))
|
||||
(setq keyfreq-file-lock (var "keyfreq.lock"))
|
||||
(setq libbcel-oauth-store-filename (var "libbcel-oauth-store.el.gpg"))
|
||||
(setq linkmarks-file (var "linkmarks.org"))
|
||||
(setq litable-list-file (var "litable-list.el"))
|
||||
(setq logview-cache-filename (var "logview-cache"))
|
||||
(setq logview-views-file (etc "logview-views"))
|
||||
(setq lookup-init-directory (etc "lookup/"))
|
||||
(setq lsp-clojure-workspace-dir (var "lsp-clojure/workspace/"))
|
||||
(setq lsp-eslint-library-choices-file (var "lsp/eslint-library-choices.el"))
|
||||
(setq lsp-java-server-install-dir (var "lsp-java/eclipse.jdt.ls/server/"))
|
||||
(setq lsp-java-workspace-dir (var "lsp-java/workspace/"))
|
||||
(setq lsp-ltex-user-rules-path (var "lsp-ltex/"))
|
||||
(setq lsp-python-ms-dir (var "lsp-python-ms/"))
|
||||
(setq lsp-server-install-dir (var "lsp/server/"))
|
||||
(setq lsp-session-file (var "lsp/session.el"))
|
||||
(setq magithub-cache-file (var "magithub/cache.el"))
|
||||
(setq magithub-dir (var "magithub/"))
|
||||
(setq mastodon-client--token-file (var "mastodon-client--token"))
|
||||
(setq mc/list-file (var "mc-list.el"))
|
||||
(setq meghanada-server-install-dir (var "meghanada/"))
|
||||
(setq multi-compile-history-file (var "multi-compile-history.el"))
|
||||
(setq nix-buffer-directory-name (var "nix-buffer/"))
|
||||
(setq nomad-tramp-script-directory (var "nomad-tramp/"))
|
||||
;; The value of this variable MUST NOT end with ".el" but the
|
||||
;; actual file name MUST end with ".el". Use "git blame" for
|
||||
;; more information.
|
||||
(setq notmuch-init-file (etc "notmuch-init"))
|
||||
(setq nov-save-place-file (var "nov-save-place.el"))
|
||||
(setq omnisharp-cache-directory (var "omnisharp/cache"))
|
||||
(setq org-caldav-backup-file (var "org/caldav/backup.org"))
|
||||
(setq org-caldav-save-directory (var "org/caldav/save"))
|
||||
(setq org-gcal-dir (var "org/gcal/"))
|
||||
(setq org-journal-cache-file (var "org/journal-cache.el"))
|
||||
(setq org-node-data-dir (var "org/node/"))
|
||||
(setq org-node-fakeroam-data-dir (var "org/node-fakeroam/"))
|
||||
(setq org-recent-headings-save-file (var "org/recent-headings.el"))
|
||||
(setq org-registry-file (var "org/registry.el"))
|
||||
(setq org-roam-db-location (var "org/org-roam.db"))
|
||||
(setq package-quickstart-file (var "package-quickstart.el"))
|
||||
(setq pandoc-data-dir (etc "pandoc-mode/"))
|
||||
(setq parinfer-rust-library-directory (var "parinfer-rust/"))
|
||||
(setq pcache-directory (var "pcache/"))
|
||||
(setq pdf-view-restore-filename (var "pdf-view-restore.el"))
|
||||
(setq persist--directory-location (var "persist/"))
|
||||
(setq persistent-scratch-save-file (var "persistent-scratch.el"))
|
||||
(setq persp-save-dir (var "persp-mode/"))
|
||||
(setq pomm-state-file-location (var "pomm/state"))
|
||||
(setq pomm-third-time-state-file-location (var "pomm/third-time-state"))
|
||||
(setq prescient-save-file (var "prescient-save.el"))
|
||||
(setq projectile-cache-file (var "projectile/cache.el"))
|
||||
(setq projectile-known-projects-file (var "projectile/known-projects.el"))
|
||||
(setq psession-elisp-objects-default-directory (var "psession/"))
|
||||
(setq purpose-default-layout-file (etc "window-purpose/default-layout.el"))
|
||||
(setq purpose-layout-dirs (list (etc "window-purpose/layouts/")))
|
||||
(setq pyim-dcache-directory (var "pyim/dcache/"))
|
||||
(setq quack-dir (var "quack/"))
|
||||
(setq racket-repl-command-file (etc "racket-mode/repl.rkt"))
|
||||
(setq racket-repl-history-directory (var "racket-mode/repl-history/"))
|
||||
(setq request-storage-directory (var "request/storage/"))
|
||||
(setq rfc-mode-directory (var "rfc-mode/"))
|
||||
(setq rime-user-data-dir (var "rime/"))
|
||||
(setq rmh-elfeed-org-files (list (etc "elfeed/rmh-elfeed.org")))
|
||||
(setq runner-init-file (var "runner-init.el"))
|
||||
(setq save-kill-file-name (var "save-kill.el"))
|
||||
(setq save-visited-files-location (var "save-visited-files-location"))
|
||||
(setq session-save-file (var "session.el"))
|
||||
(setq shell-maker-history-path (var "shell-maker/"))
|
||||
(setq sly-mrepl-history-file-name (var "sly/mrepl-history"))
|
||||
(setq smex-save-file (var "smex-save.el"))
|
||||
(setq speed-type-gb-dir (var "speed-type/"))
|
||||
(setq spell-fu-directory (var "spell-fu/"))
|
||||
(setq svg-lib-icons-dir (var "svg-lib/icons/"))
|
||||
(setq sx-cache-directory (var "sx/cache/"))
|
||||
(setq tabspaces-session-file (var "tabspaces-session.eld"))
|
||||
(setq tempel-path (etc "tempel/templates.eld"))
|
||||
(setq tldr-directory-path (var "tldr/"))
|
||||
(setq transient-history-file (var "transient/history.el"))
|
||||
(setq transient-levels-file (etc "transient/levels.el"))
|
||||
(setq transient-values-file (etc "transient/values.el"))
|
||||
(setq treemacs-last-error-persist-file (var "treemacs/persist-last-error.org"))
|
||||
(setq treemacs-persist-file (var "treemacs/persist.org"))
|
||||
(setq undo-fu-session-directory (var "undo-fu-session/"))
|
||||
(setq undohist-directory (var "undohist/"))
|
||||
(setq uptimes-database (var "uptimes.el"))
|
||||
(setq user-emacs-ensime-directory (var "ensime/"))
|
||||
(setq vimish-fold-dir (var "vimish-fold/"))
|
||||
(setq wl-address-file (etc "wanderlust/address"))
|
||||
(setq wl-alias-file (etc "wanderlust/alias"))
|
||||
(setq wl-folders-file (etc "wanderlust/folders"))
|
||||
(setq wl-init-file (etc "wanderlust/init.el"))
|
||||
(setq wl-temporary-file-directory (var "wanderlust-tmp"))
|
||||
(setq wl-x-face-file (etc "wanderlust/x-face"))
|
||||
(setq x86-lookup-cache-directory (var "x86-lookup/cache/"))
|
||||
(setq xkcd-cache-dir (var "xkcd/"))
|
||||
(setq yas-snippet-dirs (list (etc "yasnippet/snippets/")))
|
||||
|
||||
(eval-after-load 'bbdb `(make-directory ,(var "bbdb/") t))
|
||||
(eval-after-load 'bookmark+-1 `(make-directory ,(var "bmkp/") t))
|
||||
(eval-after-load 'command-log-mode '(make-directory clm/logging-dir t))
|
||||
(eval-after-load 'company `(make-directory ,(var "company/") t))
|
||||
(eval-after-load 'dape '(make-directory dape-adapter-dir t))
|
||||
(eval-after-load 'elfeed `(make-directory ,(var "elfeed/") t))
|
||||
(eval-after-load 'emojify '(make-directory emojify-emojis-dir t))
|
||||
(eval-after-load 'geiser `(make-directory ,(var "geiser/") t))
|
||||
(eval-after-load 'helm `(make-directory ,(var "helm/") t))
|
||||
(eval-after-load 'jabber '(make-directory jabber-avatar-cache-directory t))
|
||||
(eval-after-load 'jabber '(make-directory jabber-history-dir t))
|
||||
(eval-after-load 'lookup '(make-directory lookup-init-directory t))
|
||||
(eval-after-load 'lsp-mode `(make-directory ,(var "lsp/") t))
|
||||
(eval-after-load 'org-caldav '(make-directory org-caldav-save-directory t))
|
||||
(eval-after-load 'pomm `(make-directory ,(var "pomm/") t))
|
||||
(eval-after-load 'projectile `(make-directory ,(var "projectile/") t))
|
||||
(eval-after-load 'sly `(make-directory ,(var "sly/") t))
|
||||
(eval-after-load 'sx '(make-directory sx-cache-directory t))
|
||||
(eval-after-load 'wl `(make-directory ,(etc "wanderlust") t))
|
||||
(eval-after-load 'xkcd '(make-directory xkcd-cache-dir t))
|
||||
(eval-after-load 'yasnippet '(make-directory (car yas-snippet-dirs) t))
|
||||
))
|
||||
|
||||
;;; Advices
|
||||
|
||||
(define-advice emacs-session-filename (:override (session-id) no-littering)
|
||||
"Construct a filename to save the session in, based on SESSION-ID.
|
||||
Unconditionally return a filename in `no-littering-var-directory'."
|
||||
(let ((dir (no-littering-expand-var-file-name "emacs-session/")))
|
||||
(make-directory dir t)
|
||||
(expand-file-name session-id dir)))
|
||||
|
||||
;;; Backups
|
||||
|
||||
(defvar undo-tree-history-directory-alist)
|
||||
|
||||
;;;###autoload
|
||||
(defun no-littering-theme-backups ()
|
||||
"Theme locations where backups of various sorts are created.
|
||||
|
||||
The purpose of this package is to store data files of various
|
||||
sorts in a handful of central locations, instead of spreading
|
||||
them all over the place. When doing that for temporary files,
|
||||
which contain backups of some sort, that increases the odds that
|
||||
sensitive data is written to disk in clear text and/or that such
|
||||
clear text files persist longer, if they would be created anyway.
|
||||
|
||||
Because of that, simply loading `no-littering' does not theme
|
||||
certain, potentially unsafe variables. Instead, this function is
|
||||
provided, so that you can decide whether to take the risk or not.
|
||||
|
||||
Calling this function sets these variables:
|
||||
- `auto-save-file-name-transforms' (built-in)
|
||||
- `backup-directory-alist' (built-in)
|
||||
- `undo-tree-history-directory-alist' (from `undo-tree')
|
||||
|
||||
The default values of these variables cause additional files to
|
||||
be created in the same directories as the files that are being
|
||||
visited. Calling this function changes the values of these
|
||||
variables, so that this is only done for visited files located in
|
||||
certain directories. For all other visited files, the additional
|
||||
files are created in files inside `no-littering-var-directory'.
|
||||
|
||||
Additional files are created in the same directory as the visited
|
||||
file, for files located in:
|
||||
- \"/tmp/\"
|
||||
- \"/dev/shm\"
|
||||
- `temporary-file-directory'
|
||||
|
||||
With these settings it is still possible that sensitive data is
|
||||
written to additional files, but you are more likely to spot it,
|
||||
and because these directories usually use a `tmpfs' file-system,
|
||||
the leaked secrets should not persist after a reboot.
|
||||
|
||||
If you do *not* call this function, then these additional files
|
||||
are always created in the same directory as the visited files,
|
||||
regardless of the location of the visited files. In other words,
|
||||
even when using the default values, there is a significant risk
|
||||
of leaking sensitive data, and if you want to reduce that, then
|
||||
you must turn of these features completely."
|
||||
(setq auto-save-file-name-transforms
|
||||
`(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'"
|
||||
,(concat (file-name-as-directory temporary-file-directory) "\\2") t)
|
||||
("\\`/tmp\\([^/]*/\\)*\\(.*\\)\\'" "\\2")
|
||||
("\\`/dev/shm\\([^/]*/\\)*\\(.*\\)\\'" "\\2")
|
||||
(".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
|
||||
(setq backup-directory-alist
|
||||
(delete-dups
|
||||
`((,(concat "\\`" (file-name-as-directory temporary-file-directory)))
|
||||
("\\`/tmp/" . nil)
|
||||
("\\`/dev/shm/" . nil)
|
||||
("." . ,(no-littering-expand-var-file-name "backup/")))))
|
||||
(setq undo-tree-history-directory-alist
|
||||
(delete-dups
|
||||
`((,(concat "\\`" (file-name-as-directory temporary-file-directory)))
|
||||
("\\`/tmp/" . nil)
|
||||
("\\`/dev/shm/" . nil)
|
||||
("." . ,(no-littering-expand-var-file-name "undo-tree-hist/")))))
|
||||
)
|
||||
|
||||
;;; _
|
||||
(provide 'no-littering)
|
||||
;; Local Variables:
|
||||
;; indent-tabs-mode: nil
|
||||
;; lisp-indent-local-overrides: ((cond . 0) (interactive . 0))
|
||||
;; End:
|
||||
;;; no-littering.el ends here
|
||||
49
profiles/desktop/.emacs.d/modules/common.el
Normal file
49
profiles/desktop/.emacs.d/modules/common.el
Normal file
@@ -0,0 +1,49 @@
|
||||
;;; common.el --- common stuff -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; add directory containing own stuff and helper utilities to load path
|
||||
(add-to-list 'load-path "~/.emacs.d/lisp")
|
||||
|
||||
;; keep ~/.emacs.d clean
|
||||
(setq no-littering-etc-directory "~/.emacs.d/")
|
||||
(let ((var "~/.cache/emacs/")
|
||||
(etc "~/.emacs.d/"))
|
||||
(make-directory var t)
|
||||
(setq no-littering-var-directory var)
|
||||
(setq lock-file-name-transforms `((".*" ,(concat var "lock-files/") t)))
|
||||
(setq custom-file (concat etc "lisp/custom-settings.el")))
|
||||
(require 'no-littering)
|
||||
(no-littering-theme-backups)
|
||||
|
||||
;; load settings set by customize
|
||||
(require 'custom-settings)
|
||||
|
||||
;; enable integration with pass
|
||||
(auth-source-pass-enable)
|
||||
;; copied from https://systemcrafters.net/emacs-tips/using-encrypted-passwords/
|
||||
(defun pt/lookup-password (&rest keys)
|
||||
(let ((result (apply #'auth-source-search keys)))
|
||||
(if result
|
||||
(funcall (plist-get (car result) :secret))
|
||||
nil)))
|
||||
|
||||
;; useful stuff
|
||||
(defmacro fmt (str)
|
||||
"Elisp string interpolation.
|
||||
Example:
|
||||
(fmt \"My name is #{user-full-name}, I am running Emacs #{(if (display-graphic-p) \\\"with a GUI\\\" \\\"in a terminal\\\".)}\""
|
||||
(let ((exprs nil))
|
||||
(with-temp-buffer
|
||||
(insert str)
|
||||
(goto-char 1)
|
||||
(while (re-search-forward "#{" nil t 1)
|
||||
(let ((here (point))
|
||||
(emptyp (eql (char-after) ?})))
|
||||
(unless emptyp (push (read (buffer-substring (point) (progn (forward-sexp 1) (point)))) exprs))
|
||||
(delete-region (- here 2) (progn (search-forward "}") (point)))
|
||||
(unless emptyp (insert "%s"))
|
||||
(ignore-errors (forward-char 1))))
|
||||
(append (list 'format (buffer-string)) (reverse exprs)))))
|
||||
|
||||
(provide 'common)
|
||||
;;; common.el ends here
|
||||
58
profiles/desktop/.emacs.d/modules/editing.el
Normal file
58
profiles/desktop/.emacs.d/modules/editing.el
Normal file
@@ -0,0 +1,58 @@
|
||||
;;; editing.el --- core editor config -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; follow symlinks
|
||||
(setq vc-follow-symlinks t)
|
||||
|
||||
;; complete brackets automatically
|
||||
(electric-pair-mode 1)
|
||||
(setq electric-pair-preserve-balance nil)
|
||||
|
||||
;; make C-k kill entire line when I'm at the start of line
|
||||
(setq kill-whole-line t)
|
||||
|
||||
;; key binding for copying lines
|
||||
(defun copy-line (arg)
|
||||
"Copy lines (as many as prefix argument) in the kill ring.
|
||||
Ease of use features:
|
||||
- Move to start of next line.
|
||||
- Appends the copy on sequential calls.
|
||||
- Use newline as last char even on the last line of the buffer.
|
||||
- If region is active, copy its lines."
|
||||
(interactive "p")
|
||||
(let ((beg (line-beginning-position))
|
||||
(end (line-end-position arg)))
|
||||
(when mark-active
|
||||
(if (> (point) (mark))
|
||||
(setq beg (save-excursion (goto-char (mark)) (line-beginning-position)))
|
||||
(setq end (save-excursion (goto-char (mark)) (line-end-position)))))
|
||||
(if (eq last-command 'copy-line)
|
||||
(kill-append (buffer-substring beg end) (< end beg))
|
||||
(kill-ring-save beg end)))
|
||||
(kill-append "\n" nil)
|
||||
(beginning-of-line (or (and arg (1+ arg)) 2))
|
||||
(if (and arg (not (= 1 arg))) (message "%d lines copied" arg)))
|
||||
(global-set-key "\C-cc" #'copy-line)
|
||||
|
||||
;; key binding for duplicating lines
|
||||
(defun duplicate-current-line (&optional n)
|
||||
"Duplicate current line, make more than 1 copy given a numeric argument."
|
||||
(interactive "p")
|
||||
(save-excursion
|
||||
(let ((nb (or n 1))
|
||||
(current-line (thing-at-point 'point)))
|
||||
;; when on last line, insert a newline first
|
||||
(when (or (= 1 (forward-line 1)) (eq (point) (point-max)))
|
||||
(insert "\n"))
|
||||
;; now insert as many time as requested
|
||||
(while (> n 0)
|
||||
(insert current-line)
|
||||
(cl-decf n)))))
|
||||
(global-set-key (kbd "\C-cd") #'duplicate-current-line)
|
||||
|
||||
;; persistent undo history
|
||||
(use-package undo-tree
|
||||
:hook (after-init . global-undo-tree-mode))
|
||||
|
||||
(provide 'editing)
|
||||
;;; editing.el ends here
|
||||
46
profiles/desktop/.emacs.d/modules/erc.el
Normal file
46
profiles/desktop/.emacs.d/modules/erc.el
Normal file
@@ -0,0 +1,46 @@
|
||||
;;; erc.el --- erc config -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
(defun pt/erc-connect-network (network)
|
||||
"Connect to Libera IRC network."
|
||||
(erc-tls :server "paraboletancza.org"
|
||||
:port 6697
|
||||
:user (fmt "whiteman808/#{network}")
|
||||
:password (pt/lookup-password :host "znc.paraboletancza.org" :user "whiteman808")
|
||||
:full-name "whiteman808"))
|
||||
|
||||
(use-package erc
|
||||
:custom
|
||||
;; user data
|
||||
(erc-nick "whiteman808")
|
||||
(erc-user-full-name "whiteman808")
|
||||
;; protect me from accidentally sending excess lines
|
||||
(erc-inhibit-multiline-input t)
|
||||
(erc-send-whitespace-lines t)
|
||||
(erc-ask-about-multiline-input t)
|
||||
;; scroll all windows to prompt when submitting input
|
||||
(erc-scrolltobottom-all t)
|
||||
;; reconnect automatically using a fancy strategy
|
||||
(erc-server-reconnect-function #'erc-server-delayed-check-reconnect)
|
||||
(erc-server-reconnect-timeout 30)
|
||||
;; show new buffers in the current window instead of a split
|
||||
(erc-interactive-display 'buffer)
|
||||
;; highlight references to me
|
||||
(erc-keywords '("whiteman808" "whiteman809"))
|
||||
:hook
|
||||
;; automatically connect to irc
|
||||
;; (after-init . (lambda nil
|
||||
;; (pt/erc-connect-network "Libera")
|
||||
;; (pt/erc-connect-network "PIRC")))
|
||||
;; enable matching keywords
|
||||
(erc-mode . erc-match-mode)
|
||||
;; insert a newline when I hit <RET> at the prompt, and prefer
|
||||
;; something more deliberate for actually sending messages
|
||||
;; :bind (:map erc-mode-map
|
||||
;; ("RET" . nil)
|
||||
;; ("C-c C-c" . #'erc-send-current-line))
|
||||
;; emphasize buttonized text in notices
|
||||
:custom-face (erc-notice-face ((t (:slant italic :weight unspecified)))))
|
||||
|
||||
(provide 'erc)
|
||||
;;; erc.el ends here
|
||||
11
profiles/desktop/.emacs.d/modules/misc.el
Normal file
11
profiles/desktop/.emacs.d/modules/misc.el
Normal file
@@ -0,0 +1,11 @@
|
||||
;;; misc.el --- various useful stuff -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; stuff related to window manager
|
||||
(use-package i3wm-config-mode
|
||||
:config
|
||||
(add-to-list 'auto-mode-alist '("/sway/.*config.*/" . i3wm-config-mode))
|
||||
(add-to-list 'auto-mode-alist '("/sway/config\\'" . i3wm-config-mode)))
|
||||
|
||||
(provide 'misc)
|
||||
;;; misc.el ends here
|
||||
30
profiles/desktop/.emacs.d/modules/org-mode.el
Normal file
30
profiles/desktop/.emacs.d/modules/org-mode.el
Normal file
@@ -0,0 +1,30 @@
|
||||
;;; org-mode.el --- org mode config -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; essential stuff
|
||||
(use-package org
|
||||
:hook
|
||||
(org-mode . (lambda nil
|
||||
(when (display-graphic-p)
|
||||
(org-indent-mode 1))))
|
||||
;; (org-mode . (lambda nil
|
||||
;; (push '("[ ]" . "") prettify-symbols-alist)
|
||||
;; (push '("[X]" . "" ) prettify-symbols-alist)
|
||||
;; (push '("[-]" . "" ) prettify-symbols-alist)
|
||||
;; (prettify-symbols-mode)))
|
||||
:custom
|
||||
(org-hide-leading-stars t)
|
||||
(org-hide-emphasis-markers t))
|
||||
|
||||
;; org-modern
|
||||
(use-package org-modern
|
||||
:custom
|
||||
(org-modern-list
|
||||
'((?- . "•")
|
||||
(?+ . "‣")))
|
||||
:hook
|
||||
(org-mode . org-modern-mode)
|
||||
(org-agenda-finalize . org-modern-agenda))
|
||||
|
||||
(provide 'org-mode)
|
||||
;;; org-mode.el ends here
|
||||
26
profiles/desktop/.emacs.d/modules/package-manager.el
Normal file
26
profiles/desktop/.emacs.d/modules/package-manager.el
Normal file
@@ -0,0 +1,26 @@
|
||||
;;; package-manager.el --- bootstrap straight.el -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; bootstrap straight.el
|
||||
(defvar bootstrap-version)
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name
|
||||
"straight/repos/straight.el/bootstrap.el"
|
||||
(or (bound-and-true-p straight-base-dir)
|
||||
user-emacs-directory)))
|
||||
(bootstrap-version 7))
|
||||
(unless (file-exists-p bootstrap-file)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
||||
'silent 'inhibit-cookies)
|
||||
(goto-char (point-max))
|
||||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
|
||||
;; configure package manager
|
||||
(straight-use-package 'use-package)
|
||||
(setq straight-use-package-by-default t)
|
||||
|
||||
(provide 'package-manager)
|
||||
;;; package-manager.el ends here
|
||||
171
profiles/desktop/.emacs.d/modules/programming.el
Normal file
171
profiles/desktop/.emacs.d/modules/programming.el
Normal file
@@ -0,0 +1,171 @@
|
||||
;;; programming.el --- core programming settings -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; default indentation settings
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq-default tab-width 4)
|
||||
|
||||
;; code diagnostics
|
||||
(use-package flycheck
|
||||
:custom
|
||||
(flycheck-display-error-delay 1.0)
|
||||
:hook
|
||||
(prog-mode . (lambda nil
|
||||
(when (not (derived-mode-p 'emacs-lisp-mode))
|
||||
(flycheck-mode))))
|
||||
(yaml-mode . flycheck-mode))
|
||||
|
||||
;; lsp support
|
||||
(use-package lsp-mode
|
||||
:custom
|
||||
(lsp-keymap-prefix "C-c l")
|
||||
(lsp-auto-guess-root t)
|
||||
:hook
|
||||
(prog-mode . (lambda nil
|
||||
(when (not (derived-mode-p 'emacs-lisp-mode))
|
||||
(lsp-deferred))))
|
||||
(TeX-mode . lsp-deferred)
|
||||
(lsp-mode . lsp-enable-which-key-integration))
|
||||
|
||||
(use-package lsp-ui
|
||||
:custom
|
||||
(lsp-ui-sideline-show-diagnostics t)
|
||||
(lsp-ui-sideline-show-hover nil)
|
||||
(lsp-ui-sideline-show-code-actions nil)
|
||||
(lsp-ui-sideline-update-mode 'line)
|
||||
(lsp-ui-peek-enable t)
|
||||
(lsp-ui-peek-show-directory t)
|
||||
(lsp-ui-doc-enable t)
|
||||
(lsp-ui-doc-position 'top)
|
||||
(lsp-ui-doc-side 'right)
|
||||
(lsp-ui-doc-show-with-cursor nil)
|
||||
(lsp-ui-doc-show-with-mouse nil)
|
||||
:bind
|
||||
(:map lsp-ui-mode-map
|
||||
([remap xref-find-definitions] . #'lsp-ui-peek-find-definitions)
|
||||
([remap xref-find-references] . #'lsp-ui-peek-find-references)
|
||||
("C-c l d" . #'lsp-ui-doc-toggle)))
|
||||
|
||||
;; autocompletion
|
||||
(defun pt/company-complete-func nil
|
||||
"Insert the common part of all candidates, or insert <TAB>."
|
||||
(interactive)
|
||||
(when (company-manual-begin)
|
||||
(let ((tick (buffer-chars-modified-tick)))
|
||||
(call-interactively #'company-complete-common)
|
||||
(when (eq tick (buffer-chars-modified-tick))
|
||||
(call-interactively #'company-abort)
|
||||
(call-interactively (key-binding "\t"))))))
|
||||
(use-package company
|
||||
:config
|
||||
(define-key company-active-map (kbd "<tab>") #'pt/company-complete-func)
|
||||
(define-key company-active-map (kbd "<TAB>") #'pt/company-complete-func)
|
||||
(define-key company-active-map (kbd "<backtab>") nil)
|
||||
(define-key company-active-map (kbd "C-p") #'company-cycle-backward)
|
||||
(define-key company-active-map (kbd "C-n") (lambda (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((company-selection-wrap-around t))
|
||||
(call-interactively #'company-select-next))))
|
||||
:custom
|
||||
(company-minimum-prefix-length 1)
|
||||
(company-idle-delay (lambda () (if (company-in-string-or-comment) nil 0.3)))
|
||||
:hook
|
||||
(prog-mode . company-mode)
|
||||
(yaml-mode . company-mode)
|
||||
(TeX-mode . company-mode)
|
||||
(text-mode . company-mode)
|
||||
(conf-mode . company-mode))
|
||||
|
||||
;; project management
|
||||
(use-package projectile
|
||||
:commands projectile-mode
|
||||
:hook (after-init . projectile-mode)
|
||||
:bind
|
||||
(:map projectile-mode-map
|
||||
("C-c p" . #'projectile-command-map)))
|
||||
|
||||
;; web development
|
||||
(use-package web-mode
|
||||
:custom
|
||||
(web-mode-enable-auto-closing t)
|
||||
(web-mode-enable-auto-pairing t)
|
||||
(web-mode-enable-css-colorization t)
|
||||
(web-mode-markup-indent-offset 2)
|
||||
(web-mode-css-indent-offset 2)
|
||||
(web-mode-code-indent-offset 2)
|
||||
(web-mode-style-padding 0)
|
||||
(web-mode-script-padding 0)
|
||||
:mode
|
||||
(("\\.html?\\'" . web-mode)
|
||||
("\\.phtml\\'" . web-mode)
|
||||
("\\.php\\'" . web-mode)
|
||||
("\\.tpl\\'" . web-mode)
|
||||
("\\.[agj]sp\\'" . web-mode)
|
||||
("\\.as[cp]x\\'" . web-mode)
|
||||
("\\.erb\\'" . web-mode)
|
||||
("\\.mustache\\'" . web-mode)
|
||||
("\\.djhtml\\'" . web-mode)))
|
||||
|
||||
;; formatting code
|
||||
(use-package format-all
|
||||
:commands format-all-mode
|
||||
:hook (prog-mode . format-all-mode)
|
||||
:bind ("C-c f" . format-all-buffer)
|
||||
:config
|
||||
(define-format-all-formatter autopep8
|
||||
(:executable "autopep8")
|
||||
(:install "pip install autopep8")
|
||||
(:languages "Python")
|
||||
(:features)
|
||||
(:format (format-all--buffer-easy executable "-")))
|
||||
(define-format-all-formatter dockerfmt
|
||||
(:executable "dockerfmt")
|
||||
(:install "go install github.com/reteps/dockerfmt@latest")
|
||||
(:languages "Dockerfile")
|
||||
(:features)
|
||||
(:format (format-all--buffer-easy executable)))
|
||||
(setq-default format-all-formatters
|
||||
'(("C" (clang-format))
|
||||
("C++" (clang-format))
|
||||
("Shell" (beautysh))
|
||||
("HTML" (prettier))
|
||||
("XHTML" (prettier))
|
||||
("XML" (prettier))
|
||||
("CSS" (prettier))
|
||||
("Less" (prettier))
|
||||
("SCSS" (prettier))
|
||||
("JavaScript" (prettier))
|
||||
("JSON" (prettier))
|
||||
("JSX" (prettier))
|
||||
("TypeScript" (prettier))
|
||||
("TSX" (prettier))
|
||||
("YAML" (prettier))
|
||||
("TOML" (prettier))
|
||||
("LaTeX" (latexindent))
|
||||
("Lua" (stylua))
|
||||
("PHP" (prettier))
|
||||
("Python" (autopep8) (isort))
|
||||
("Perl" (perltidy))
|
||||
("Markdown" (prettier))
|
||||
("Dockerfile" (dockerfmt))
|
||||
("SQL" (pgformatter))
|
||||
("Nginx" (nginxfmt)))))
|
||||
|
||||
;; highlight words like todo
|
||||
(use-package hl-todo
|
||||
:custom
|
||||
(hl-todo-keyword-faces
|
||||
'(("FIXME" error bold)
|
||||
("TODO" org-todo)
|
||||
("DONE" org-done)
|
||||
("NOTE" bold)))
|
||||
:hook (prog-mode . hl-todo-mode))
|
||||
|
||||
;; various useful modes
|
||||
(use-package dockerfile-mode :commands dockerfile-mode)
|
||||
(use-package systemd :commands systemd-mode)
|
||||
(use-package nginx-mode :commands nginx-mode)
|
||||
(use-package yaml-mode :commands yaml-mode)
|
||||
|
||||
(provide 'programming)
|
||||
;;; programming.el ends here
|
||||
22
profiles/desktop/.emacs.d/modules/sysadm.el
Normal file
22
profiles/desktop/.emacs.d/modules/sysadm.el
Normal file
@@ -0,0 +1,22 @@
|
||||
;;; sysadm.el --- system administration stuff -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; terminal
|
||||
(use-package eat
|
||||
:straight (eat :type git
|
||||
:host codeberg
|
||||
:repo "akib/emacs-eat"
|
||||
:files ("*.el" ("term" "term/*.el") "*.texi"
|
||||
"*.ti" ("terminfo/e" "terminfo/e/*")
|
||||
("terminfo/65" "terminfo/65/*")
|
||||
("integration" "integration/*")
|
||||
(:exclude ".dir-locals.el" "*-tests.el"))))
|
||||
;; (use-package vterm)
|
||||
|
||||
;; developing pkgbuilds for arch linux
|
||||
(use-package pkgbuild-mode
|
||||
:commands pkgbuild-mode
|
||||
:mode "/PKGBUILD$")
|
||||
|
||||
(provide 'sysadm)
|
||||
;;; sysadm.el ends here
|
||||
89
profiles/desktop/.emacs.d/modules/user-interface.el
Normal file
89
profiles/desktop/.emacs.d/modules/user-interface.el
Normal file
@@ -0,0 +1,89 @@
|
||||
;;; user-interface.el --- user interface config -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
|
||||
;; don't show startup message
|
||||
(setq inhibit-startup-screen t)
|
||||
|
||||
;; improve user interface
|
||||
(menu-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(defalias 'yes-or-no-p 'y-or-n-p) ; for portability
|
||||
(setopt use-short-answers t)
|
||||
|
||||
;; enable copy-pasting outside of emacs
|
||||
(setq x-select-enable-clipboard t)
|
||||
|
||||
;; disable ring bell sound
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
;; prefer vertical splits
|
||||
(setq split-width-threshold nil)
|
||||
|
||||
;; automatically wrap lines
|
||||
(global-visual-line-mode 1)
|
||||
|
||||
;; set default font
|
||||
(set-face-attribute 'default nil
|
||||
:family "Hack"
|
||||
:height 140
|
||||
:weight 'normal
|
||||
:width 'normal)
|
||||
(set-fontset-font t 'unicode (font-spec :family "Hack Nerd Font Mono" :height 200) nil)
|
||||
(set-fontset-font t 'symbol (font-spec :family "Font Awesome 7 Free" :height 200) nil)
|
||||
|
||||
;; color scheme
|
||||
(use-package catppuccin-theme
|
||||
:custom (catppuccin-flavor 'mocha)
|
||||
:config
|
||||
(set-frame-parameter nil 'alpha-background 80)
|
||||
(add-to-list 'default-frame-alist '(alpha-background . 80))
|
||||
(if (daemonp)
|
||||
(add-hook 'after-make-frame-functions (lambda (frame)
|
||||
(select-frame frame)
|
||||
(catppuccin-set-color 'base "unspecified-bg" 'mocha)
|
||||
(load-theme 'catppuccin t)))
|
||||
(progn (catppuccin-set-color 'base "#000000" 'mocha)
|
||||
(load-theme 'catppuccin :no-confirm))))
|
||||
|
||||
;; set transparency when running emacs in terminal
|
||||
(defun on-after-init ()
|
||||
(unless (display-graphic-p (selected-frame))
|
||||
(set-face-background 'default "unspecified-bg" (selected-frame))))
|
||||
(add-hook 'window-setup-hook 'on-after-init)
|
||||
|
||||
;; mode line
|
||||
(use-package doom-modeline
|
||||
:hook (after-init . doom-modeline-mode))
|
||||
|
||||
;; set cursor type and disable cursor blinking
|
||||
(blink-cursor-mode -1)
|
||||
(setq-default cursor-type '(hbar . 1))
|
||||
|
||||
;; display line numbers
|
||||
(setq display-line-numbers-width-start t)
|
||||
(dolist (mode '(prog-mode-hook
|
||||
yaml-mode-hook
|
||||
TeX-mode-hook
|
||||
markdown-mode-hook
|
||||
org-mode-hook
|
||||
conf-mode-hook))
|
||||
(add-hook mode #'display-line-numbers-mode))
|
||||
|
||||
;; enable commands hinting when pressing keys
|
||||
(which-key-mode 1)
|
||||
|
||||
;; better help
|
||||
(use-package helpful
|
||||
:bind
|
||||
(("C-h f" . helpful-callable)
|
||||
("C-h v" . helpful-variable)
|
||||
("C-h k" . helpful-key)
|
||||
("C-h x" . helpful-command)))
|
||||
|
||||
;; better switching between windows
|
||||
(use-package ace-window
|
||||
:bind ("M-o" . ace-window))
|
||||
|
||||
(provide 'user-interface)
|
||||
;;; user-interface.el ends here
|
||||
15
profiles/desktop/.gitconfig
Normal file
15
profiles/desktop/.gitconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[user]
|
||||
name = whiteman808
|
||||
email = whiteman808@paraboletancza.org
|
||||
signingkey = 4A45503BBE575E3D4DAF28E27264AFFDC98D52BB
|
||||
[credential]
|
||||
helper = cache
|
||||
helper = !type pass-git-helper >/dev/null && pass-git-helper $@
|
||||
[core]
|
||||
editor = nvim
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[tag]
|
||||
gpgSign = true
|
||||
1
profiles/desktop/.gnupg/common.conf
Normal file
1
profiles/desktop/.gnupg/common.conf
Normal file
@@ -0,0 +1 @@
|
||||
use-keyboxd
|
||||
6
profiles/desktop/.gnupg/gpg-agent.conf
Normal file
6
profiles/desktop/.gnupg/gpg-agent.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
max-cache-ttl 60480000
|
||||
default-cache-ttl 60480000
|
||||
enable-ssh-support
|
||||
default-cache-ttl-ssh 60480000
|
||||
max-cache-ttl-ssh 60480000
|
||||
pinentry-program /usr/bin/pinentry-gtk
|
||||
2
profiles/desktop/.gnupg/gpg.conf
Normal file
2
profiles/desktop/.gnupg/gpg.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
use-agent
|
||||
keyserver hkps://keyserver.ubuntu.com:443
|
||||
3
profiles/desktop/.gnupg/scdaemon.conf
Normal file
3
profiles/desktop/.gnupg/scdaemon.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
pcsc-driver /usr/lib/libpcsclite.so
|
||||
card-timeout 5
|
||||
disable-ccid
|
||||
23
profiles/desktop/.gtkrc-2.0
Normal file
23
profiles/desktop/.gtkrc-2.0
Normal file
@@ -0,0 +1,23 @@
|
||||
gtk-enable-animations=1
|
||||
gtk-primary-button-warps-slider=1
|
||||
gtk-cursor-blink-time=1000
|
||||
gtk-cursor-blink=1
|
||||
gtk-sound-theme-name="ocean"
|
||||
# DO NOT EDIT! This file will be overwritten by LXAppearance.
|
||||
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
|
||||
|
||||
gtk-theme-name="Materia-dark-compact"
|
||||
gtk-icon-theme-name="Numix-Circle"
|
||||
gtk-font-name="Noto Sans, 10"
|
||||
gtk-cursor-theme-name="Vimix-cursors"
|
||||
gtk-cursor-theme-size=24
|
||||
gtk-toolbar-style=3
|
||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
gtk-button-images=1
|
||||
gtk-menu-images=1
|
||||
gtk-enable-event-sounds=1
|
||||
gtk-enable-input-feedback-sounds=1
|
||||
gtk-xft-antialias=1
|
||||
gtk-xft-hinting=1
|
||||
gtk-xft-hintstyle="hintfull"
|
||||
gtk-xft-rgba="rgb"
|
||||
108
profiles/desktop/.local/bin/distrobox
Executable file
108
profiles/desktop/.local/bin/distrobox
Executable file
@@ -0,0 +1,108 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# This file is part of the distrobox project:
|
||||
# https://github.com/89luca89/distrobox
|
||||
#
|
||||
# Copyright (C) 2021 distrobox contributors
|
||||
#
|
||||
# distrobox is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# distrobox 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 distrobox; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# POSIX
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
version="1.8.2.2"
|
||||
|
||||
# show_help will print usage to stdout.
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# version: distrobox version
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# print usage with examples.
|
||||
show_help()
|
||||
{
|
||||
cat << EOF
|
||||
distrobox version: ${version}
|
||||
|
||||
Choose one of the available commands:
|
||||
assemble
|
||||
create
|
||||
enter
|
||||
list | ls
|
||||
rm
|
||||
stop
|
||||
upgrade
|
||||
ephemeral
|
||||
generate-entry
|
||||
version
|
||||
help
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
show_help
|
||||
exit
|
||||
fi
|
||||
|
||||
distrobox_path="$(dirname "${0}")"
|
||||
distrobox_command="${1}"
|
||||
shift
|
||||
|
||||
# Simple wrapper to the distrobox utilities.
|
||||
# We just detect the 1st argument and launch the matching distrobox utility.
|
||||
case "${distrobox_command}" in
|
||||
assemble)
|
||||
"${distrobox_path}"/distrobox-assemble "$@"
|
||||
;;
|
||||
create)
|
||||
"${distrobox_path}"/distrobox-create "$@"
|
||||
;;
|
||||
enter)
|
||||
"${distrobox_path}"/distrobox-enter "$@"
|
||||
;;
|
||||
ls | list)
|
||||
"${distrobox_path}"/distrobox-list "$@"
|
||||
;;
|
||||
stop)
|
||||
"${distrobox_path}"/distrobox-stop "$@"
|
||||
;;
|
||||
rm)
|
||||
"${distrobox_path}"/distrobox-rm "$@"
|
||||
;;
|
||||
upgrade)
|
||||
"${distrobox_path}"/distrobox-upgrade "$@"
|
||||
;;
|
||||
generate-entry)
|
||||
"${distrobox_path}"/distrobox-generate-entry "$@"
|
||||
;;
|
||||
ephemeral)
|
||||
"${distrobox_path}"/distrobox-ephemeral "$@"
|
||||
;;
|
||||
-V | --version | version)
|
||||
printf "distrobox: %s\n" "${version}"
|
||||
exit 0
|
||||
;;
|
||||
help | --help | -h)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
printf >&2 "Error: invalid command\n"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
793
profiles/desktop/.local/bin/distrobox-assemble
Executable file
793
profiles/desktop/.local/bin/distrobox-assemble
Executable file
@@ -0,0 +1,793 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# This file is part of the distrobox project:
|
||||
# https://github.com/89luca89/distrobox
|
||||
#
|
||||
# Copyright (C) 2021 distrobox contributors
|
||||
#
|
||||
# distrobox is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# distrobox 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 distrobox; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Ensure we have our env variables correctly set
|
||||
[ -z "${USER}" ] && USER="$(id -run)"
|
||||
[ -z "${HOME}" ] && HOME="$(getent passwd "${USER}" | cut -d':' -f6)"
|
||||
[ -z "${SHELL}" ] && SHELL="$(getent passwd "${USER}" | cut -d':' -f7)"
|
||||
|
||||
# POSIX
|
||||
#
|
||||
default_input_file="./distrobox.ini"
|
||||
delete=-1
|
||||
distrobox_path="$(dirname "${0}")"
|
||||
dryrun=0
|
||||
boxname=""
|
||||
input_file=""
|
||||
replace=0
|
||||
root_flag=""
|
||||
# tmpfile will be used as a little buffer to pass variables without messing up
|
||||
# quoting and escaping
|
||||
tmpfile="$(mktemp -u)"
|
||||
tmp_download_file="$(mktemp -u)"
|
||||
verbose=0
|
||||
version="1.8.2.2"
|
||||
# initializing block of variables used in the manifest
|
||||
additional_flags=""
|
||||
additional_packages=""
|
||||
entry=""
|
||||
home=""
|
||||
hostname=""
|
||||
image=""
|
||||
clone=""
|
||||
init=""
|
||||
init_hooks=""
|
||||
nvidia=""
|
||||
pre_init_hooks=""
|
||||
pull=""
|
||||
root=""
|
||||
start_now=""
|
||||
unshare_groups=""
|
||||
unshare_ipc=""
|
||||
unshare_netns=""
|
||||
unshare_process=""
|
||||
unshare_devsys=""
|
||||
unshare_all=""
|
||||
volume=""
|
||||
exported_apps=""
|
||||
exported_bins=""
|
||||
exported_bins_path="${HOME}/.local/bin"
|
||||
|
||||
# Cleanup tmpfiles on exit
|
||||
trap 'rm -f ${tmpfile} ${tmp_download_file}' EXIT
|
||||
|
||||
# Despite of running this script via SUDO/DOAS being not supported (the
|
||||
# script itself will call the appropriate tool when necessary), we still want
|
||||
# to allow people to run it as root, logged in in a shell, and create rootful
|
||||
# containers.
|
||||
#
|
||||
# SUDO_USER is a variable set by SUDO and can be used to check whether the script was called by it. Same thing for DOAS_USER, set by DOAS.
|
||||
if [ -n "${SUDO_USER}" ] || [ -n "${DOAS_USER}" ]; then
|
||||
printf >&2 "Running %s via SUDO/DOAS is not supported." "$(basename "${0}")"
|
||||
printf >&2 "Instead, please try using root=true property in the distrobox.ini file.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source configuration files, this is done in an hierarchy so local files have
|
||||
# priority over system defaults
|
||||
# leave priority to environment variables.
|
||||
#
|
||||
# On NixOS, for the distrobox derivation to pick up a static config file shipped
|
||||
# by the package maintainer the path must be relative to the script itself.
|
||||
self_dir="$(dirname "$(realpath "$0")")"
|
||||
nix_config_file="${self_dir}/../share/distrobox/distrobox.conf"
|
||||
|
||||
config_files="
|
||||
${nix_config_file}
|
||||
/usr/share/distrobox/distrobox.conf
|
||||
/usr/share/defaults/distrobox/distrobox.conf
|
||||
/usr/etc/distrobox/distrobox.conf
|
||||
/usr/local/share/distrobox/distrobox.conf
|
||||
/etc/distrobox/distrobox.conf
|
||||
${XDG_CONFIG_HOME:-"${HOME}/.config"}/distrobox/distrobox.conf
|
||||
${HOME}/.distroboxrc
|
||||
"
|
||||
for config_file in ${config_files}; do
|
||||
# Shellcheck will give error for sourcing a variable file as it cannot follow
|
||||
# it. We don't care so let's disable this linting for now.
|
||||
# shellcheck disable=SC1090
|
||||
[ -e "${config_file}" ] && . "$(realpath "${config_file}")"
|
||||
done
|
||||
|
||||
[ -n "${DBX_VERBOSE}" ] && verbose="${DBX_VERBOSE}"
|
||||
|
||||
# Fixup variable=[true|false], in case we find it in the config file(s)
|
||||
[ "${verbose}" = "true" ] && verbose=1
|
||||
[ "${verbose}" = "false" ] && verbose=0
|
||||
|
||||
# show_help will print usage to stdout.
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# version: string distrobox version
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# print usage with examples.
|
||||
show_help()
|
||||
{
|
||||
cat << EOF
|
||||
distrobox version: ${version}
|
||||
|
||||
Usage:
|
||||
|
||||
distrobox assemble create
|
||||
distrobox assemble rm
|
||||
distrobox assemble create --file /path/to/file.ini
|
||||
distrobox assemble rm --file /path/to/file.ini
|
||||
distrobox assemble create --replace --file /path/to/file.ini
|
||||
|
||||
Options:
|
||||
|
||||
--file: path or URL to the distrobox manifest/ini file
|
||||
--name/-n: run against a single entry in the manifest/ini file
|
||||
--replace/-R: replace already existing distroboxes with matching names
|
||||
--dry-run/-d: only print the container manager command generated
|
||||
--verbose/-v: show more verbosity
|
||||
--version/-V: show version
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while :; do
|
||||
case $1 in
|
||||
create)
|
||||
delete=0
|
||||
shift
|
||||
;;
|
||||
rm)
|
||||
delete=1
|
||||
shift
|
||||
;;
|
||||
--file)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
if [ -n "$2" ]; then
|
||||
input_file="${2}"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-n | --name)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
if [ -n "$2" ]; then
|
||||
boxname="${2}"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-h | --help)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-d | --dry-run)
|
||||
shift
|
||||
dryrun=1
|
||||
;;
|
||||
-v | --verbose)
|
||||
verbose=1
|
||||
shift
|
||||
;;
|
||||
-R | --replace)
|
||||
replace=1
|
||||
shift
|
||||
;;
|
||||
-V | --version)
|
||||
printf "distrobox: %s\n" "${version}"
|
||||
exit 0
|
||||
;;
|
||||
--) # End of all options.
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # Invalid options.
|
||||
printf >&2 "ERROR: Invalid flag '%s'\n\n" "$1"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
# If we have a flagless option and container_name is not specified
|
||||
# then let's accept argument as container_name
|
||||
if [ -n "$1" ]; then
|
||||
input_file="$1"
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set verbosity
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
# check if we're getting the right inputs
|
||||
if [ "${delete}" -eq -1 ]; then
|
||||
printf >&2 "Please specify create or rm.\n"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fallback to distrobox.ini if no file is passed
|
||||
if [ -z "${input_file}" ]; then
|
||||
input_file="${default_input_file}"
|
||||
fi
|
||||
|
||||
# Check if file effectively exists
|
||||
if [ ! -e "${input_file}" ]; then
|
||||
|
||||
if command -v curl > /dev/null 2>&1; then
|
||||
download="curl --connect-timeout 3 --retry 1 -sLo"
|
||||
elif command -v wget > /dev/null 2>&1; then
|
||||
download="wget --timeout=3 --tries=1 -qO"
|
||||
fi
|
||||
|
||||
if ! ${download} - "${input_file}" > "${tmp_download_file}"; then
|
||||
printf >&2 "File %s does not exist.\n" "${input_file}"
|
||||
exit 1
|
||||
else
|
||||
input_file="${tmp_download_file}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# run_distrobox will create distrobox with parameters parsed from ini file.
|
||||
# Arguments:
|
||||
# name: name of the distrobox.
|
||||
# Expected global variables:
|
||||
# boxname: string name of the target container
|
||||
# tmpfile: string name of the tmpfile to read
|
||||
# delete: bool delete container
|
||||
# replace: bool replace container
|
||||
# dryrun: bool dryrun (only print, no execute)
|
||||
# verbose: bool verbose
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# execution of the proper distrobox-create command.
|
||||
run_distrobox()
|
||||
{
|
||||
name="${1}"
|
||||
additional_flags=""
|
||||
additional_packages=""
|
||||
entry=""
|
||||
home=""
|
||||
hostname=""
|
||||
image=""
|
||||
clone=""
|
||||
init=""
|
||||
init_hooks=""
|
||||
nvidia=""
|
||||
pre_init_hooks=""
|
||||
pull=""
|
||||
root=""
|
||||
start_now=""
|
||||
unshare_groups=""
|
||||
unshare_ipc=""
|
||||
unshare_netns=""
|
||||
unshare_process=""
|
||||
unshare_devsys=""
|
||||
unshare_all=""
|
||||
volume=""
|
||||
exported_apps=""
|
||||
exported_bins=""
|
||||
exported_bins_path="${HOME}/.local/bin"
|
||||
|
||||
# Skip item if --name used and no match is found
|
||||
if [ "${boxname}" != "" ] && [ "${boxname}" != "${name}" ]; then
|
||||
rm -f "${tmpfile}"
|
||||
return
|
||||
fi
|
||||
|
||||
# Source the current block variables
|
||||
if [ -e "${tmpfile}" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "${tmpfile}" && rm -f "${tmpfile}"
|
||||
fi
|
||||
|
||||
if [ -n "${root}" ] && [ "${root}" -eq 1 ]; then
|
||||
root_flag="--root"
|
||||
fi
|
||||
|
||||
# We're going to delete, not create!
|
||||
if [ "${delete}" -ne 0 ] || [ "${replace}" -ne 0 ]; then
|
||||
printf " - Deleting %s...\n" "${name}"
|
||||
|
||||
if [ "${dryrun}" -eq 0 ]; then
|
||||
# shellcheck disable=SC2086,2248
|
||||
"${distrobox_path}"/distrobox rm ${root_flag} -f "${name}" > /dev/null || :
|
||||
fi
|
||||
|
||||
if [ "${delete}" -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# We're going to create!
|
||||
printf " - Creating %s...\n" "${name}"
|
||||
|
||||
# If distrobox already exist, and we have replace enabled, destroy the container
|
||||
# we have to recreate it.
|
||||
# shellcheck disable=SC2086,2248
|
||||
if "${distrobox_path}"/distrobox-list ${root_flag} | grep -qw " ${name} " && [ "${dryrun}" -eq 0 ]; then
|
||||
printf >&2 "%s already exists\n" "${name}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Now we dynamically generate the distrobox-create command based on the
|
||||
# declared flags.
|
||||
result_command="${distrobox_path}/distrobox-create --yes"
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
result_command="${result_command} -v"
|
||||
fi
|
||||
if [ -n "${name}" ]; then
|
||||
result_command="${result_command} --name $(sanitize_variable "${name}")"
|
||||
fi
|
||||
if [ -n "${image}" ]; then
|
||||
result_command="${result_command} --image $(sanitize_variable "${image}")"
|
||||
fi
|
||||
if [ -n "${clone}" ]; then
|
||||
result_command="${result_command} --clone $(sanitize_variable "${clone}")"
|
||||
fi
|
||||
if [ -n "${init}" ] && [ "${init}" -eq 1 ]; then
|
||||
result_command="${result_command} --init"
|
||||
fi
|
||||
if [ -n "${root}" ] && [ "${root}" -eq 1 ]; then
|
||||
result_command="${result_command} --root"
|
||||
fi
|
||||
if [ -n "${pull}" ] && [ "${pull}" -eq 1 ]; then
|
||||
result_command="${result_command} --pull"
|
||||
fi
|
||||
if [ -n "${entry}" ] && [ "${entry}" -eq 0 ]; then
|
||||
result_command="${result_command} --no-entry"
|
||||
fi
|
||||
if [ -n "${nvidia}" ] && [ "${nvidia}" -eq 1 ]; then
|
||||
result_command="${result_command} --nvidia"
|
||||
fi
|
||||
if [ -n "${unshare_netns}" ] && [ "${unshare_netns}" -eq 1 ]; then
|
||||
result_command="${result_command} --unshare-netns"
|
||||
fi
|
||||
if [ -n "${unshare_groups}" ] && [ "${unshare_groups}" -eq 1 ]; then
|
||||
result_command="${result_command} --unshare-groups"
|
||||
fi
|
||||
if [ -n "${unshare_ipc}" ] && [ "${unshare_ipc}" -eq 1 ]; then
|
||||
result_command="${result_command} --unshare-ipc"
|
||||
fi
|
||||
if [ -n "${unshare_process}" ] && [ "${unshare_process}" -eq 1 ]; then
|
||||
result_command="${result_command} --unshare-process"
|
||||
fi
|
||||
if [ -n "${unshare_devsys}" ] && [ "${unshare_devsys}" -eq 1 ]; then
|
||||
result_command="${result_command} --unshare-devsys"
|
||||
fi
|
||||
if [ -n "${unshare_all}" ] && [ "${unshare_all}" -eq 1 ]; then
|
||||
result_command="${result_command} --unshare-all"
|
||||
fi
|
||||
if [ -n "${home}" ]; then
|
||||
result_command="${result_command} --home $(sanitize_variable "${home}")"
|
||||
fi
|
||||
if [ -n "${hostname}" ]; then
|
||||
result_command="${result_command} --hostname $(sanitize_variable "${hostname}")"
|
||||
fi
|
||||
if [ -n "${init_hooks}" ]; then
|
||||
IFS="¤"
|
||||
args=": ;"
|
||||
separator=""
|
||||
for arg in ${init_hooks}; do
|
||||
if [ -z "${arg}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Convert back from base64
|
||||
arg="$(echo "${arg}" | base64 -d)"
|
||||
args="${args} ${separator} ${arg}"
|
||||
|
||||
# Prepare for the next line, if we already have a ';' or '&&', do nothing
|
||||
# else prefer adding '&&'
|
||||
if ! echo "${arg}" | grep -qE ';[[:space:]]{0,1}$' &&
|
||||
! echo "${arg}" | grep -qE '&&[[:space:]]{0,1}$'; then
|
||||
separator="&&"
|
||||
else
|
||||
separator=""
|
||||
fi
|
||||
done
|
||||
result_command="${result_command} --init-hooks $(sanitize_variable "${args}")"
|
||||
fi
|
||||
# Replicable flags
|
||||
if [ -n "${pre_init_hooks}" ]; then
|
||||
IFS="¤"
|
||||
args=": ;"
|
||||
separator=""
|
||||
for arg in ${pre_init_hooks}; do
|
||||
if [ -z "${arg}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Convert back from base64
|
||||
arg="$(echo "${arg}" | base64 -d)"
|
||||
args="${args} ${separator} ${arg}"
|
||||
|
||||
# Prepare for the next line, if we already have a ';' or '&&', do nothing
|
||||
# else prefer adding '&&'
|
||||
if ! echo "${arg}" | grep -qE ';[[:space:]]{0,1}$' &&
|
||||
! echo "${arg}" | grep -qE '&&[[:space:]]{0,1}$'; then
|
||||
separator="&&"
|
||||
else
|
||||
separator=""
|
||||
fi
|
||||
done
|
||||
result_command="${result_command} --pre-init-hooks $(sanitize_variable "${args}")"
|
||||
fi
|
||||
if [ -n "${additional_packages}" ]; then
|
||||
IFS="¤"
|
||||
args=""
|
||||
for packages in ${additional_packages}; do
|
||||
if [ -z "${packages}" ]; then
|
||||
continue
|
||||
fi
|
||||
args="${args} ${packages}"
|
||||
done
|
||||
result_command="${result_command} --additional-packages $(sanitize_variable "${args}")"
|
||||
fi
|
||||
if [ -n "${volume}" ]; then
|
||||
IFS="¤"
|
||||
for vol in ${volume}; do
|
||||
if [ -z "${vol}" ]; then
|
||||
continue
|
||||
fi
|
||||
result_command="${result_command} --volume $(sanitize_variable "${vol}")"
|
||||
done
|
||||
fi
|
||||
if [ -n "${additional_flags}" ]; then
|
||||
IFS="¤"
|
||||
for flag in ${additional_flags}; do
|
||||
if [ -z "${flag}" ]; then
|
||||
continue
|
||||
fi
|
||||
result_command="${result_command} --additional-flags $(sanitize_variable "${flag}")"
|
||||
done
|
||||
fi
|
||||
|
||||
# Execute the distrobox-create command
|
||||
if [ "${dryrun}" -ne 0 ]; then
|
||||
echo "${result_command}"
|
||||
return
|
||||
fi
|
||||
eval "${result_command}"
|
||||
|
||||
# If we need to start immediately, do it, so that the container
|
||||
# is ready to be entered.
|
||||
if [ -n "${start_now}" ] && [ "${start_now}" -eq 1 ]; then
|
||||
# Here we execute the `distrobox enter` command with a `/dev/null` stdin.
|
||||
# This is due to the fact that this command is very likely to be executed inside
|
||||
# the read loop in the prse_file function. This way we avoid stdin to be swallowed by
|
||||
# this command execution. This is valid for all the `distrobox enter` calls from now on.
|
||||
#
|
||||
# shellcheck disable=SC2086,2248
|
||||
"${distrobox_path}"/distrobox enter ${root_flag} "${name}" -- touch /dev/null < /dev/null
|
||||
fi
|
||||
|
||||
# if there are exported bins and apps declared, let's export them
|
||||
if [ -n "${exported_apps}" ] || [ -n "${exported_bins}" ]; then
|
||||
# First we start the container
|
||||
# shellcheck disable=SC2086,2248
|
||||
"${distrobox_path}"/distrobox enter ${root_flag} "${name}" -- touch /dev/null < /dev/null
|
||||
|
||||
IFS="¤"
|
||||
for apps in ${exported_apps}; do
|
||||
# Split the string by spaces
|
||||
IFS=" "
|
||||
for app in ${apps}; do
|
||||
# Export the app
|
||||
# shellcheck disable=SC2086,2248
|
||||
"${distrobox_path}"/distrobox enter ${root_flag} "${name}" -- distrobox-export --app "${app}" < /dev/null
|
||||
done
|
||||
done
|
||||
|
||||
IFS="¤"
|
||||
for bins in ${exported_bins}; do
|
||||
# Split the string by spaces
|
||||
IFS=" "
|
||||
for bin in ${bins}; do
|
||||
# Export the bin
|
||||
# shellcheck disable=SC2086,2248
|
||||
"${distrobox_path}"/distrobox enter ${root_flag} "${name}" -- distrobox-export --bin "${bin}" \
|
||||
--export-path "${exported_bins_path}" < /dev/null
|
||||
done
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# encode_variable will encode an input in base64, removing surrounding single/double quotes.
|
||||
# Arguments:
|
||||
# variable: string
|
||||
# Expected global variables:
|
||||
# None
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# a value string encoded in base64
|
||||
encode_variable()
|
||||
{
|
||||
variable="${1}"
|
||||
# remove surrounding quotes possibly added by the user
|
||||
if echo "${variable}" | grep -qE '^"'; then
|
||||
variable="$(echo "${variable}" | sed -e 's/^"//' -e 's/"$//')"
|
||||
elif echo "${variable}" | grep -qE "^'"; then
|
||||
variable="$(echo "${variable}" | sed -e "s/^'//" -e "s/'$//")"
|
||||
fi
|
||||
|
||||
echo "${variable}" | base64 -w 0
|
||||
}
|
||||
|
||||
# sanitize_variable will sanitize an input, add single/double quotes and escapes
|
||||
# Arguments:
|
||||
# variable: string
|
||||
# Expected global variables:
|
||||
# None
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# a value string sanitized
|
||||
sanitize_variable()
|
||||
{
|
||||
variable="${1}"
|
||||
|
||||
# If there are spaces but no quotes, let's add them
|
||||
if echo "${variable}" | grep -q " " &&
|
||||
! echo "${variable}" | grep -Eq "^'|^\""; then
|
||||
|
||||
# if we have double quotes we should wrap the whole line in single quotes
|
||||
# in order to not "undo" them
|
||||
if echo "${variable}" | grep -q '"'; then
|
||||
variable="'${variable}'"
|
||||
else
|
||||
variable="\"${variable}\""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Return
|
||||
echo "${variable}"
|
||||
}
|
||||
|
||||
# parse_file will read and parse input file and call distrobox-create accordingly
|
||||
# Arguments:
|
||||
# file: string path of the manifest file to parse
|
||||
# Expected global variables:
|
||||
# tmpfile: string name of the tmpfile to read
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# None
|
||||
parse_file()
|
||||
{
|
||||
file="${1}"
|
||||
name=""
|
||||
|
||||
IFS='
|
||||
'
|
||||
while read -r line; do
|
||||
# Remove comments and trailing spaces
|
||||
line="$(echo "${line}" |
|
||||
sed 's/\t/ /g' |
|
||||
sed 's/^#.*//g' |
|
||||
sed 's/].*#.*//g' |
|
||||
sed 's/ #.*//g' |
|
||||
sed 's/\s*$//g')"
|
||||
|
||||
if [ -z "${line}" ]; then
|
||||
# blank line, skip
|
||||
continue
|
||||
fi
|
||||
|
||||
# Detect start of new section
|
||||
if [ "$(echo "${line}" | cut -c 1)" = '[' ]; then
|
||||
# We're starting a new section
|
||||
if [ -n "${name}" ]; then
|
||||
# We've finished the previous section, so this is the time to
|
||||
# perform the distrobox command, before going to the new section.
|
||||
run_distrobox "${name}"
|
||||
fi
|
||||
|
||||
# Remove brackets and spaces
|
||||
name="$(echo "${line}" | tr -d '][ ')"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Get key-values from the file
|
||||
key="$(echo "${line}" | cut -d'=' -f1 | tr -d ' ')"
|
||||
value="$(echo "${line}" | cut -d'=' -f2-)"
|
||||
|
||||
# Normalize true|false to 0|1
|
||||
[ "${value}" = "true" ] && value=1
|
||||
[ "${value}" = "false" ] && value=0
|
||||
|
||||
# Sanitize value, by whitespaces, quotes and escapes
|
||||
if [ "${key}" = "init_hooks" ] || [ "${key}" = "pre_init_hooks" ]; then
|
||||
# in case of shell commands (so the hooks) we prefer to pass the variable
|
||||
# around encoded, so that we don't accidentally execute stuff
|
||||
# and, we will execute sanitize_variable on the final string flag at the
|
||||
# end, instead of key/value base.
|
||||
value="$(encode_variable "${value}")"
|
||||
else
|
||||
value="$(sanitize_variable "${value}")"
|
||||
fi
|
||||
|
||||
# Save options to tempfile, to source it later
|
||||
touch "${tmpfile}"
|
||||
if [ -n "${key}" ] && [ -n "${value}" ]; then
|
||||
if grep -q "^${key}=" "${tmpfile}"; then
|
||||
# make keys cumulative
|
||||
value="\${${key}}¤${value}"
|
||||
fi
|
||||
echo "${key}=${value}" >> "${tmpfile}"
|
||||
fi
|
||||
done < "${file}"
|
||||
# Execute now one last time for the last block
|
||||
run_distrobox "${name}"
|
||||
}
|
||||
|
||||
# read_section reads the content of a section from a TOML file.
|
||||
# Arguments:
|
||||
# section: Name of the section to find (string).
|
||||
# file: Path to the file to search into (string).
|
||||
# Expected global variables:
|
||||
# None.
|
||||
# Expected env variables:
|
||||
# None.
|
||||
# Outputs:
|
||||
# Writes the found section body to stdout.
|
||||
# Exit behavior / errors:
|
||||
# Does not exit non‑zero on missing section; caller should treat empty output as needed.
|
||||
read_section()
|
||||
{
|
||||
section="$1"
|
||||
file="$2"
|
||||
awk -v sec="[${section}]" '
|
||||
$0 == sec {show=1; next}
|
||||
show && /^\[/ {exit}
|
||||
show && NF {print}
|
||||
' "${file}"
|
||||
}
|
||||
|
||||
# resolve_includes Resolve 'include' keys in a manifest by inlining referenced sections.
|
||||
# Arguments:
|
||||
# input_file: Path to the original manifest file that may contain 'include' keys.
|
||||
# output_file: Path to the file where the resolved manifest will be written (if empty, a temp file is used).
|
||||
# Expected global variables:
|
||||
# read_section (function) - used to extract referenced section bodies from input_file.
|
||||
# replace_line (function) - used to replace include lines with extracted content.
|
||||
# Expected env variables:
|
||||
# TMPDIR (optional) - may influence mktemp location.
|
||||
# Outputs:
|
||||
# Prints the path to the output file to stdout when completed.
|
||||
# Exit behavior / errors:
|
||||
# Exits with status 1 and writes to stderr on missing definitions, circular includes, or helper failures.
|
||||
resolve_includes()
|
||||
{
|
||||
input_file="$1"
|
||||
output_file="$2"
|
||||
include_stack=""
|
||||
|
||||
# At the starting point, the output file is equal to input_file
|
||||
# Later on, the output file will be edited as includes will be resolved
|
||||
cat "${input_file}" > "${output_file}"
|
||||
|
||||
n=0
|
||||
while true; do
|
||||
total_lines=$(wc -l < "${output_file}")
|
||||
[ "${n}" -gt "${total_lines}" ] && break
|
||||
|
||||
line=$(sed -n "$((n + 1))p" "${output_file}")
|
||||
|
||||
# Detected begin of a section: clear the include stack and go on
|
||||
if [ "$(echo "${line}" | cut -c 1)" = '[' ]; then
|
||||
include_stack=""
|
||||
n=$((n + 1))
|
||||
continue
|
||||
fi
|
||||
|
||||
# Match key=value from the current line
|
||||
key="$(echo "${line}" | cut -d'=' -f1 | tr -d ' ')"
|
||||
value="$(echo "${line}" | cut -d'=' -f2-)"
|
||||
|
||||
if [ "${key}" = "include" ]; then
|
||||
# Detect circular references while including other distrobox definitions
|
||||
# The reference stack is handled as a string of shape [name].[name].[name]
|
||||
if expr "${include_stack}" : ".*\[${value}\]" > /dev/null; then
|
||||
printf >&2 "ERROR circular reference detected: including [%s] again after %s\n" "${value}" "${include_stack}"
|
||||
exit 1
|
||||
else
|
||||
include_stack="[${value}]¤${include_stack}"
|
||||
fi
|
||||
|
||||
# Read the definition for the distrobox to include from the original file
|
||||
# and replace the current line with the found lines.
|
||||
# The line counter is not incremented to allow recursive include resolution
|
||||
inc=$(read_section "$(echo "${value}" | tr -d '"')" "${input_file}")
|
||||
if [ -z "${inc}" ]; then
|
||||
printf >&2 "ERROR cannot include '%s': definition not found\n" "${value}"
|
||||
exit 1
|
||||
fi
|
||||
l=$((n + 1))
|
||||
replace_line "${l}" "${inc}" "${output_file}" "${output_file}" > /dev/null
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
# Nothing to do, increment counter and go on
|
||||
n=$((n + 1))
|
||||
|
||||
done
|
||||
|
||||
echo "${output_file}"
|
||||
|
||||
}
|
||||
|
||||
# replace_line Replace a 1-based numbered line in a file with provided (possibly multiline) text.
|
||||
# Arguments:
|
||||
# line_number: 1-based index of the line to replace.
|
||||
# new_value: String to insert (may contain newlines).
|
||||
# input_file: Path to the original file to read from.
|
||||
# output_file: Path to write the resulting file (if empty, a temp file will be created).
|
||||
# Expected global variables:
|
||||
# None.
|
||||
# Expected env variables:
|
||||
# TMPDIR (optional) - may influence mktemp location.
|
||||
# Outputs:
|
||||
# Prints the path to the output file to stdout when complete.
|
||||
# Exit behavior / errors:
|
||||
# Exits with status 1 on fatal errors (e.g., mktemp failure).
|
||||
replace_line()
|
||||
{
|
||||
line_number="$1"
|
||||
new_value="$2"
|
||||
input_file="$3"
|
||||
output_file="$4"
|
||||
|
||||
# if no output file, use a temp file
|
||||
if [ -z "${output_file}" ]; then
|
||||
output_file=$(mktemp -u)
|
||||
fi
|
||||
|
||||
tmpfile=$(mktemp) || exit 1
|
||||
|
||||
# Split the file into two parts around the line to replace and combine with new_value
|
||||
# Print lines before line_number
|
||||
sed "$((line_number - 1))q" "${input_file}" > "${tmpfile}"
|
||||
|
||||
# Append the new_value
|
||||
printf "%s\n" "${new_value}" >> "${tmpfile}"
|
||||
|
||||
# Append lines after line_number
|
||||
sed -n "$((line_number + 1)),\$p" "${input_file}" >> "${tmpfile}"
|
||||
|
||||
# Replace original file with tmpfile
|
||||
mv "${tmpfile}" "${output_file}"
|
||||
|
||||
echo "${output_file}"
|
||||
}
|
||||
|
||||
# Exec
|
||||
expanded_file=$(mktemp -u)
|
||||
resolve_includes "${input_file}" "${expanded_file}"
|
||||
parse_file "${expanded_file}"
|
||||
1093
profiles/desktop/.local/bin/distrobox-create
Executable file
1093
profiles/desktop/.local/bin/distrobox-create
Executable file
File diff suppressed because it is too large
Load Diff
729
profiles/desktop/.local/bin/distrobox-enter
Executable file
729
profiles/desktop/.local/bin/distrobox-enter
Executable file
@@ -0,0 +1,729 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# This file is part of the distrobox project:
|
||||
# https://github.com/89luca89/distrobox
|
||||
#
|
||||
# Copyright (C) 2021 distrobox contributors
|
||||
#
|
||||
# distrobox is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# distrobox 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 distrobox; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# POSIX
|
||||
# Expected env variables:
|
||||
# HOME
|
||||
# USER
|
||||
# Optional env variables:
|
||||
# DBX_CONTAINER_ALWAYS_PULL
|
||||
# DBX_CONTAINER_CUSTOM_HOME
|
||||
# DBX_CONTAINER_GENERATE_ENTRY
|
||||
# DBX_CONTAINER_HOME_PREFIX
|
||||
# DBX_CONTAINER_HOSTNAME
|
||||
# DBX_CONTAINER_IMAGE
|
||||
# DBX_CONTAINER_MANAGER
|
||||
# DBX_CONTAINER_NAME
|
||||
# DBX_CONTAINER_CLEAN_PATH
|
||||
# DBX_NON_INTERACTIVE
|
||||
# DBX_VERBOSE
|
||||
# DBX_SKIP_WORKDIR
|
||||
# DBX_SUDO_PROGRAM
|
||||
|
||||
# Ensure we have our env variables correctly set
|
||||
[ -z "${USER}" ] && USER="$(id -run)"
|
||||
[ -z "${HOME}" ] && HOME="$(getent passwd "${USER}" | cut -d':' -f6)"
|
||||
[ -z "${SHELL}" ] && SHELL="$(getent passwd "${USER}" | cut -d':' -f7)"
|
||||
|
||||
app_cache_dir=${XDG_CACHE_HOME:-"${HOME}/.cache"}/distrobox
|
||||
|
||||
trap cleanup TERM INT HUP EXIT
|
||||
|
||||
# cleanup will remove fifo and temp files, and print to stdout
|
||||
# container's logs in case of error and verbose.
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# container_manager: string container manager to use
|
||||
# container_name: string container name
|
||||
# app_cache_dir: string cache dire to write file into
|
||||
# logs_pid: string pid of the podman/docker logs process
|
||||
# verbose: bool verbose
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# None
|
||||
cleanup()
|
||||
{
|
||||
rm -f "${app_cache_dir}/.${container_name}.fifo"
|
||||
if [ -n "${logs_pid:-}" ]; then
|
||||
kill "${logs_pid:-}" 2> /dev/null || :
|
||||
fi
|
||||
if [ "${verbose}" -eq 1 ]; then
|
||||
${container_manager} logs "${container_name}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Despite of running this script via SUDO/DOAS being not supported (the
|
||||
# script itself will call the appropriate tool when necessary), we still want
|
||||
# to allow people to run it as root, logged in in a shell, and create rootful
|
||||
# containers.
|
||||
#
|
||||
# SUDO_USER is a variable set by SUDO and can be used to check whether the script was called by it. Same thing for DOAS_USER, set by DOAS.
|
||||
if {
|
||||
[ -n "${SUDO_USER}" ] || [ -n "${DOAS_USER}" ]
|
||||
} && [ "$(id -ru)" -eq 0 ]; then
|
||||
printf >&2 "Running %s via SUDO/DOAS is not supported. Instead, please try running:\n" "$(basename "${0}")"
|
||||
printf >&2 " %s --root %s\n" "$(basename "${0}")" "$*"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Defaults
|
||||
# by default we use getent to get the login shell of the user and use that
|
||||
container_custom_command=0
|
||||
container_command_user="$(echo "${USER}" | sed 's|\\|\\\\|g')"
|
||||
container_image_default="registry.fedoraproject.org/fedora-toolbox:latest"
|
||||
container_manager="autodetect"
|
||||
container_manager_additional_flags=""
|
||||
container_name=""
|
||||
container_name_default="my-distrobox"
|
||||
non_interactive=0
|
||||
|
||||
# Use cd + dirname + pwd so that we do not have relative paths in mount points
|
||||
# We're not using "realpath" here so that symlinks are not resolved this way
|
||||
# "realpath" would break situations like Nix or similar symlink based package
|
||||
# management.
|
||||
distrobox_enter_path="$(cd "$(dirname "$0")" && pwd)/distrobox-enter"
|
||||
dryrun=0
|
||||
headless=0
|
||||
# If the user runs this script as root in a login shell, set rootful=1.
|
||||
# There's no need for them to pass the --root flag option in such cases.
|
||||
[ "$(id -ru)" -eq 0 ] && rootful=1 || rootful=0
|
||||
skip_workdir=0
|
||||
verbose=0
|
||||
clean_path=0
|
||||
version="1.8.2.2"
|
||||
|
||||
# Source configuration files, this is done in an hierarchy so local files have
|
||||
# priority over system defaults
|
||||
# leave priority to environment variables.
|
||||
#
|
||||
# On NixOS, for the distrobox derivation to pick up a static config file shipped
|
||||
# by the package maintainer the path must be relative to the script itself.
|
||||
self_dir="$(dirname "$(realpath "$0")")"
|
||||
nix_config_file="${self_dir}/../share/distrobox/distrobox.conf"
|
||||
|
||||
config_files="
|
||||
${nix_config_file}
|
||||
/usr/share/distrobox/distrobox.conf
|
||||
/usr/share/defaults/distrobox/distrobox.conf
|
||||
/usr/etc/distrobox/distrobox.conf
|
||||
/usr/local/share/distrobox/distrobox.conf
|
||||
/etc/distrobox/distrobox.conf
|
||||
${XDG_CONFIG_HOME:-"${HOME}/.config"}/distrobox/distrobox.conf
|
||||
${HOME}/.distroboxrc
|
||||
"
|
||||
for config_file in ${config_files}; do
|
||||
# Shellcheck will give error for sourcing a variable file as it cannot follow
|
||||
# it. We don't care so let's disable this linting for now.
|
||||
# shellcheck disable=SC1090
|
||||
[ -e "${config_file}" ] && . "$(realpath "${config_file}")"
|
||||
done
|
||||
# If we're running this script as root -- as in, logged in in the shell as root
|
||||
# user, and not via SUDO/DOAS --, we don't need to set distrobox_sudo_program
|
||||
# as it's meaningless for this use case.
|
||||
if [ "$(id -ru)" -ne 0 ]; then
|
||||
# If the DBX_SUDO_PROGRAM/distrobox_sudo_program variable was set by the
|
||||
# user, use its value instead of "sudo". But only if not running the script
|
||||
# as root (UID 0).
|
||||
distrobox_sudo_program=${DBX_SUDO_PROGRAM:-${distrobox_sudo_program:-"sudo"}}
|
||||
fi
|
||||
|
||||
[ -n "${DBX_CONTAINER_MANAGER}" ] && container_manager="${DBX_CONTAINER_MANAGER}"
|
||||
[ -n "${DBX_CONTAINER_NAME}" ] && container_name="${DBX_CONTAINER_NAME}"
|
||||
[ -n "${DBX_CONTAINER_CLEAN_PATH}" ] && clean_path=1
|
||||
[ -n "${DBX_SKIP_WORKDIR}" ] && skip_workdir="${DBX_SKIP_WORKDIR}"
|
||||
[ -n "${DBX_NON_INTERACTIVE}" ] && non_interactive="${DBX_NON_INTERACTIVE}"
|
||||
[ -n "${DBX_VERBOSE}" ] && verbose="${DBX_VERBOSE}"
|
||||
|
||||
# Fixup variable=[true|false], in case we find it in the config file(s)
|
||||
[ "${non_interactive}" = "true" ] && non_interactive=1
|
||||
[ "${non_interactive}" = "false" ] && non_interactive=0
|
||||
[ "${verbose}" = "true" ] && verbose=1
|
||||
[ "${verbose}" = "false" ] && verbose=0
|
||||
|
||||
# show_help will print usage to stdout.
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# version: distrobox version
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# print usage with examples.
|
||||
show_help()
|
||||
{
|
||||
cat << EOF
|
||||
distrobox version: ${version}
|
||||
|
||||
Usage:
|
||||
|
||||
distrobox-enter --name fedora-39 -- bash -l
|
||||
distrobox-enter my-alpine-container -- sh -l
|
||||
distrobox-enter --additional-flags "--preserve-fds" --name test -- bash -l
|
||||
distrobox-enter --additional-flags "--env MY_VAR=value" --name test -- bash -l
|
||||
MY_VAR=value distrobox-enter --additional-flags "--preserve-fds" --name test -- bash -l
|
||||
|
||||
Options:
|
||||
|
||||
--name/-n: name for the distrobox default: my-distrobox
|
||||
--/-e: end arguments execute the rest as command to execute at login default: default ${USER}'s shell
|
||||
--clean-path: reset PATH inside container to FHS standard
|
||||
--no-tty/-T: do not instantiate a tty
|
||||
--no-workdir/-nw: always start the container from container's home directory
|
||||
--additional-flags/-a: additional flags to pass to the container manager command
|
||||
--help/-h: show this message
|
||||
--root/-r: launch podman/docker/lilipod with root privileges. Note that if you need root this is the preferred
|
||||
way over "sudo distrobox" (note: if using a program other than 'sudo' for root privileges is necessary,
|
||||
specify it through the DBX_SUDO_PROGRAM env variable, or 'distrobox_sudo_program' config variable)
|
||||
--dry-run/-d: only print the container manager command generated
|
||||
--verbose/-v: show more verbosity
|
||||
--version/-V: show version
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while :; do
|
||||
case $1 in
|
||||
-h | --help)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-v | --verbose)
|
||||
shift
|
||||
verbose=1
|
||||
;;
|
||||
-T | -H | --no-tty)
|
||||
shift
|
||||
headless=1
|
||||
;;
|
||||
-r | --root)
|
||||
shift
|
||||
rootful=1
|
||||
;;
|
||||
-V | --version)
|
||||
printf "distrobox: %s\n" "${version}"
|
||||
exit 0
|
||||
;;
|
||||
-d | --dry-run)
|
||||
shift
|
||||
dryrun=1
|
||||
;;
|
||||
-nw | --no-workdir)
|
||||
shift
|
||||
skip_workdir=1
|
||||
;;
|
||||
-n | --name)
|
||||
if [ -n "$2" ]; then
|
||||
container_name="$2"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-a | --additional-flags)
|
||||
if [ -n "$2" ]; then
|
||||
if [ -z "${container_manager_additional_flags=}" ]; then
|
||||
container_manager_additional_flags="$(echo "${2}" | sed -E "s/(--[a-zA-Z]+) ([^ ]+)/\1=\2/g" | sed 's/ --/\n--/g')"
|
||||
else
|
||||
container_manager_additional_flags="${container_manager_additional_flags}
|
||||
$(echo "${2}" | sed -E "s/(--[a-zA-Z]+) ([^ ]+)/\1=\2/g" | sed 's/ --/\n--/g')"
|
||||
fi
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-Y | --yes)
|
||||
non_interactive=1
|
||||
shift
|
||||
;;
|
||||
-e | --exec | --)
|
||||
container_custom_command=1
|
||||
shift
|
||||
# We pass the rest of arguments as $@ at the end
|
||||
break
|
||||
;;
|
||||
--clean-path)
|
||||
shift
|
||||
clean_path=1
|
||||
;;
|
||||
-*) # Invalid options.
|
||||
printf >&2 "ERROR: Invalid flag '%s'\n\n" "$1"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
# If we have a flagless option and container_name is not specified
|
||||
# then let's accept argument as container_name
|
||||
if [ -n "$1" ]; then
|
||||
container_name="$1"
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set verbosity
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
if [ -z "${container_name}" ]; then
|
||||
container_name="${container_name_default}"
|
||||
fi
|
||||
|
||||
if [ ! -t 0 ] || [ ! -t 1 ]; then
|
||||
headless=1
|
||||
fi
|
||||
# We depend on a container manager let's be sure we have it
|
||||
# First we use podman, else docker, else lilipod
|
||||
case "${container_manager}" in
|
||||
autodetect)
|
||||
if command -v podman > /dev/null; then
|
||||
container_manager="podman"
|
||||
elif command -v podman-launcher > /dev/null; then
|
||||
container_manager="podman-launcher"
|
||||
elif command -v docker > /dev/null; then
|
||||
container_manager="docker"
|
||||
elif command -v lilipod > /dev/null; then
|
||||
container_manager="lilipod"
|
||||
fi
|
||||
;;
|
||||
podman)
|
||||
container_manager="podman"
|
||||
;;
|
||||
podman-launcher)
|
||||
container_manager="podman-launcher"
|
||||
;;
|
||||
lilipod)
|
||||
container_manager="lilipod"
|
||||
;;
|
||||
docker)
|
||||
container_manager="docker"
|
||||
;;
|
||||
*)
|
||||
printf >&2 "Invalid input %s.\n" "${container_manager}"
|
||||
printf >&2 "The available choices are: 'autodetect', 'podman', 'docker', 'lilipod'\n"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Be sure we have a container manager to work with.
|
||||
if ! command -v "${container_manager}" > /dev/null && [ "${dryrun}" -eq 0 ]; then
|
||||
# Error: we need at least one between docker, podman or lilipod.
|
||||
printf >&2 "Missing dependency: we need a container manager.\n"
|
||||
printf >&2 "Please install one of podman, docker or lilipod.\n"
|
||||
printf >&2 "You can follow the documentation on:\n"
|
||||
printf >&2 "\tman distrobox-compatibility\n"
|
||||
printf >&2 "or:\n"
|
||||
printf >&2 "\thttps://github.com/89luca89/distrobox/blob/main/docs/compatibility.md\n"
|
||||
exit 127
|
||||
fi
|
||||
|
||||
# add verbose if -v is specified
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
container_manager="${container_manager} --log-level debug"
|
||||
fi
|
||||
|
||||
# prepend sudo (or the specified sudo program) if we want our container manager to be rootful
|
||||
if [ "${rootful}" -ne 0 ]; then
|
||||
container_manager="${distrobox_sudo_program-} ${container_manager}"
|
||||
fi
|
||||
|
||||
# generate_enter_command will produce a Podman, Docker or Lilipod command to execute to enter the container.
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# container_manager: string container manager to use
|
||||
# container_name: string container name
|
||||
# container_manager_additional_flags: string container manager additional flags to use
|
||||
# container_home: string container's home path
|
||||
# container_path: string container's default PATH variable
|
||||
# headless: bool headless mode
|
||||
# skip_workdir: bool skip workdir
|
||||
# verbose: bool verbose
|
||||
# unshare_groups
|
||||
# distrobox_enter_path
|
||||
# Expected env variables:
|
||||
# PATH
|
||||
# USER
|
||||
# PWD
|
||||
# XDG_DATA_DIRS
|
||||
# XDG_CONFIG_DIRS
|
||||
# Outputs:
|
||||
# prints the podman, docker or lilipod command to enter the distrobox container
|
||||
generate_enter_command()
|
||||
{
|
||||
result_command="exec"
|
||||
result_command="${result_command}
|
||||
--interactive"
|
||||
result_command="${result_command}
|
||||
--detach-keys="
|
||||
|
||||
# In case of initful systems or unshared groups, we don't enter directly
|
||||
# as our user, but we instead enter as root, and then su $USER, in order
|
||||
# to trigger a proper login
|
||||
if [ "${unshare_groups:-0}" -eq 1 ]; then
|
||||
result_command="${result_command}
|
||||
--user=root"
|
||||
else
|
||||
result_command="${result_command}
|
||||
--user=${USER}"
|
||||
fi
|
||||
|
||||
# For some usage, like use in service, or launched by non-terminal
|
||||
# eg. from desktop files, TTY can fail to instantiate, and fail to enter
|
||||
# the container.
|
||||
# To work around this, --headless let's you skip the --tty flag and make it
|
||||
# work in tty-less situations.
|
||||
# Disable tty also if we're NOT in a tty (test -t 0, test -t 1).
|
||||
if [ "${headless}" -eq 0 ]; then
|
||||
result_command="${result_command}
|
||||
--tty"
|
||||
fi
|
||||
|
||||
# Entering container using our user and workdir.
|
||||
# Start container from working directory. Else default to home. Else do /.
|
||||
# Since we are entering from host, drop at workdir through '/run/host'
|
||||
# which represents host's root inside container. Any directory on host
|
||||
# even if not explicitly mounted is bound to exist under /run/host.
|
||||
# Since user $HOME is very likely present in container, enter there directly
|
||||
# to avoid confusing the user about shifted paths.
|
||||
# pass distrobox-enter path, it will be used in the distrobox-export tool.
|
||||
if [ "${skip_workdir}" -eq 0 ]; then
|
||||
workdir="${PWD:-${container_home:-"/"}}"
|
||||
if [ -n "${workdir##*"${container_home}"*}" ]; then
|
||||
workdir="/run/host${workdir}"
|
||||
fi
|
||||
else
|
||||
# Skipping workdir we just enter $HOME of the container.
|
||||
workdir="${container_home}"
|
||||
fi
|
||||
|
||||
result_command="${result_command}
|
||||
--workdir=${workdir}"
|
||||
result_command="${result_command}
|
||||
--env=CONTAINER_ID=${container_name}"
|
||||
result_command="${result_command}
|
||||
--env=DISTROBOX_ENTER_PATH=${distrobox_enter_path}"
|
||||
|
||||
# Loop through all the environment vars
|
||||
# and export them to the container.
|
||||
set +o xtrace
|
||||
# disable logging for this snippet, or it will be too talkative.
|
||||
# We filter the environment so that we do not have strange variables or
|
||||
# multiline.
|
||||
# We also NEED to ignore the HOME variable, as this is set at create time
|
||||
# and needs to stay that way to use custom home dirs. or it will be too talkative.
|
||||
result_command="${result_command}
|
||||
$(printenv | grep '=' | grep -Ev '"|`|\$' |
|
||||
grep -Ev '^(CONTAINER_ID|FPATH|HOST|HOSTNAME|HOME|PATH|PROFILEREAD|SHELL|XDG_SEAT|XDG_VTNR|XDG_.*_DIRS|^_)' |
|
||||
sed 's/ /\ /g' | sed 's/^\(.*\)$/--env=\1/g')"
|
||||
|
||||
# Start with the $PATH set in the container's config
|
||||
container_paths="${container_path:-""}"
|
||||
# Ensure the standard FHS program paths are in PATH environment
|
||||
standard_paths="/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin"
|
||||
|
||||
if [ "${clean_path}" -eq 1 ]; then
|
||||
# only add the standard paths
|
||||
for standard_path in ${standard_paths}; do
|
||||
if [ -z "${container_paths}" ]; then
|
||||
container_paths="${standard_path}"
|
||||
else
|
||||
container_paths="${container_paths}:${standard_path}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
# collect standard paths not existing from host PATH
|
||||
for standard_path in ${standard_paths}; do
|
||||
pattern="(:|^)${standard_path}(:|$)"
|
||||
if ! echo "${PATH}" | grep -Eq "${pattern}"; then
|
||||
if [ -z "${container_paths}" ]; then
|
||||
container_paths="${standard_path}"
|
||||
else
|
||||
container_paths="${container_paths}:${standard_path}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# append additional standard paths to host PATH to get final container_paths
|
||||
if [ -n "${container_paths}" ]; then
|
||||
container_paths="${PATH}:${container_paths}"
|
||||
else
|
||||
container_paths="${PATH}"
|
||||
fi
|
||||
fi
|
||||
|
||||
result_command="${result_command}
|
||||
--env=PATH=${container_paths}"
|
||||
|
||||
# Ensure the standard FHS program paths are in XDG_DATA_DIRS environment
|
||||
standard_paths="/usr/local/share /usr/share"
|
||||
container_paths="${XDG_DATA_DIRS:-}"
|
||||
# add to the XDG_DATA_DIRS only after the host's paths, and only if not already present.
|
||||
for standard_path in ${standard_paths}; do
|
||||
pattern="(:|^)${standard_path}(:|$)"
|
||||
if [ -z "${container_paths}" ]; then
|
||||
container_paths="${standard_path}"
|
||||
elif ! echo "${container_paths}" | grep -Eq "${pattern}"; then
|
||||
container_paths="${container_paths}:${standard_path}"
|
||||
fi
|
||||
done
|
||||
result_command="${result_command}
|
||||
--env=XDG_DATA_DIRS=${container_paths}"
|
||||
|
||||
# This correctly sets the XDG_* dirs to the container_home
|
||||
# it will be $HOME if using regular home dirs
|
||||
# if will be $container_home if using a custom home during create
|
||||
result_command="${result_command}
|
||||
--env=XDG_CACHE_HOME=${container_home}/.cache
|
||||
--env=XDG_CONFIG_HOME=${container_home}/.config
|
||||
--env=XDG_DATA_HOME=${container_home}/.local/share
|
||||
--env=XDG_STATE_HOME=${container_home}/.local/state"
|
||||
|
||||
# Ensure the standard FHS program paths are in XDG_CONFIG_DIRS environment
|
||||
standard_paths="/etc/xdg"
|
||||
container_paths="${XDG_CONFIG_DIRS:-}"
|
||||
# add to the XDG_CONFIG_DIRS only after the host's paths, and only if not already present.
|
||||
for standard_path in ${standard_paths}; do
|
||||
pattern="(:|^)${standard_path}(:|$)"
|
||||
if [ -z "${container_paths}" ]; then
|
||||
container_paths="${standard_path}"
|
||||
elif ! echo "${container_paths}" | grep -Eq "${pattern}"; then
|
||||
container_paths="${container_paths}:${standard_path}"
|
||||
fi
|
||||
done
|
||||
result_command="${result_command}
|
||||
--env=XDG_CONFIG_DIRS=${container_paths}"
|
||||
|
||||
# re-enable logging if it was enabled previously.
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
# Add additional flags
|
||||
if [ -n "${container_manager_additional_flags}" ]; then
|
||||
result_command="${result_command}
|
||||
${container_manager_additional_flags}"
|
||||
fi
|
||||
|
||||
# Run selected container with specified command.
|
||||
result_command="${result_command}
|
||||
${container_name}"
|
||||
|
||||
# Return generated command.
|
||||
# here we remove tabs as an artifact of using indentation in code to improve
|
||||
# readability
|
||||
printf "%s\n" "${result_command}" | tr -d '\t'
|
||||
}
|
||||
|
||||
container_home="${HOME}"
|
||||
container_path="${PATH}"
|
||||
unshare_groups=0
|
||||
# Now inspect the container we're working with.
|
||||
container_status="unknown"
|
||||
eval "$(${container_manager} inspect --type container --format \
|
||||
'container_status={{.State.Status}};
|
||||
unshare_groups={{ index .Config.Labels "distrobox.unshare_groups" }};
|
||||
{{range .Config.Env}}{{if and (ge (len .) 5) (eq (slice . 0 5) "HOME=")}}container_home={{slice . 5 | printf "%q"}}{{end}}{{end}};
|
||||
{{range .Config.Env}}{{if and (ge (len .) 5) (eq (slice . 0 5) "PATH=")}}container_path={{slice . 5 | printf "%q"}}{{end}}{{end}}' \
|
||||
"${container_name}")"
|
||||
|
||||
# dry run mode, just generate the command and print it. No execution.
|
||||
if [ "${dryrun}" -ne 0 ]; then
|
||||
cmd="$(generate_enter_command | sed 's/\t//g')"
|
||||
printf "%s %s\n" "${cmd}" "$*"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if the container is even there
|
||||
if [ "${container_status}" = "unknown" ]; then
|
||||
# If not, prompt to create it first
|
||||
# If we're not-interactive, just don't ask questions
|
||||
if [ "${non_interactive}" -eq 1 ]; then
|
||||
response="yes"
|
||||
else
|
||||
printf >&2 "Create it now, out of image %s? [Y/n]: " "${container_image_default}"
|
||||
read -r response
|
||||
response="${response:-"Y"}"
|
||||
fi
|
||||
|
||||
# Accept only y,Y,Yes,yes,n,N,No,no.
|
||||
case "${response}" in
|
||||
y | Y | Yes | yes | YES)
|
||||
# Ok, let's create the container with just 'distrobox create $container_name
|
||||
create_command="$(dirname "${0}")/distrobox-create"
|
||||
if [ "${rootful}" -ne 0 ]; then
|
||||
create_command="${create_command} --root"
|
||||
fi
|
||||
|
||||
create_command="${create_command} --yes -i ${container_image_default} -n ${container_name}"
|
||||
|
||||
printf >&2 "Creating the container %s\n" "${container_name}"
|
||||
|
||||
if [ "${dryrun}" -ne 1 ]; then
|
||||
${create_command}
|
||||
fi
|
||||
;;
|
||||
n | N | No | no | NO)
|
||||
printf >&2 "Ok. For creating it, run this command:\n"
|
||||
printf >&2 "\tdistrobox create <name-of-container> --image <remote>/<docker>:<tag>\n"
|
||||
exit 0
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
printf >&2 "Invalid input.\n"
|
||||
printf >&2 "The available choices are: y,Y,Yes,yes,YES or n,N,No,no,NO.\nExiting.\n"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# If the container is not already running, we need to start if first
|
||||
if [ "${container_status}" != "running" ]; then
|
||||
# If container is not running, start it first
|
||||
#
|
||||
# Here, we save the timestamp before launching the start command, so we can
|
||||
# be sure we're working with this very same session of logs later.
|
||||
log_timestamp="$(date -u +%FT%T).000000000+00:00"
|
||||
${container_manager} start "${container_name}" > /dev/null
|
||||
#
|
||||
# Check if the container is going in error status earlier than the
|
||||
# entrypoint
|
||||
if [ "$(${container_manager} inspect \
|
||||
--type container \
|
||||
--format "{{.State.Status}}" "${container_name}")" != "running" ]; then
|
||||
|
||||
printf >&2 "\033[31m Error: could not start entrypoint.\n\033[0m"
|
||||
container_manager_log="$(${container_manager} logs "${container_name}")"
|
||||
printf >&2 "%s\n" "${container_manager_log}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf >&2 "%-40s\t" "Starting container..."
|
||||
mkdir -p "${app_cache_dir}"
|
||||
rm -f "${app_cache_dir}/.${container_name}.fifo"
|
||||
mkfifo "${app_cache_dir}/.${container_name}.fifo"
|
||||
while true; do
|
||||
# Exit early in case of crashed/stopped container during setup
|
||||
if [ "$(${container_manager} inspect --type container --format '{{.State.Status}}' "${container_name}")" != "running" ]; then
|
||||
printf >&2 "\nContainer Setup Failure!\n"
|
||||
exit 1
|
||||
fi
|
||||
# save starting loop timestamp in temp variable, we'll use it
|
||||
# after to let logs command minimize possible holes
|
||||
${container_manager} logs --since "${log_timestamp}" -f "${container_name}" \
|
||||
> "${app_cache_dir}/.${container_name}.fifo" 2>&1 &
|
||||
logs_pid="$!"
|
||||
|
||||
# read logs from log_timestamp to now, line by line
|
||||
while IFS= read -r line; do
|
||||
case "${line}" in
|
||||
"+"*)
|
||||
# Ignoring logging commands
|
||||
;;
|
||||
"Error:"*)
|
||||
printf >&2 "\033[31m %s\n\033[0m" "${line}"
|
||||
exit 1
|
||||
;;
|
||||
"Warning:"*)
|
||||
printf >&2 "\n\033[33m %s\033[0m" "${line}"
|
||||
;;
|
||||
"distrobox:"*)
|
||||
current_line="$(echo "${line}" | cut -d' ' -f2-)"
|
||||
# Save current line in the status, to avoid printing the same line multiple times
|
||||
printf >&2 "\033[32m [ OK ]\n\033[0m%-40s\t" "${current_line}"
|
||||
;;
|
||||
"container_setup_done"*)
|
||||
printf >&2 "\033[32m [ OK ]\n\033[0m"
|
||||
kill "${logs_pid}" > /dev/null 2>&1
|
||||
break 2
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
done < "${app_cache_dir}/.${container_name}.fifo"
|
||||
done
|
||||
# cleanup fifo
|
||||
rm -f "${app_cache_dir}/.${container_name}.fifo"
|
||||
printf >&2 "\nContainer Setup Complete!\n"
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# Execution section, in this section we will manipulate the positional parameters
|
||||
# in order to generate our long docker/podman/lilipod command to execute.
|
||||
#
|
||||
# We use positional parameters in order to have the shell manage escaping and spaces
|
||||
# so we remove the problem of we having to handle them.
|
||||
#
|
||||
# 1 - handle absence of custom command, we will need to add a getent command to
|
||||
# execute the right container's user's shell
|
||||
# 2 - in case of unshared groups (or initful) we need to trigger a proper login
|
||||
# using `su`, so we will need to manipulate these arguments accorodingly
|
||||
# 3 - prepend our generated command
|
||||
# to do this, we use `tac` so we reverse loop it and prepend each argument.
|
||||
# 4 - now that we're done, we can prepend our container_command
|
||||
# we will need to use `rev` to reverse it as we reverse loop and prepend each
|
||||
# argument
|
||||
################################################################################
|
||||
#
|
||||
# Setup default commands if none are specified
|
||||
# execute a getent command using the /bin/sh shell
|
||||
# to find out the default shell of the user, and
|
||||
# do a login shell with it (eg: /bin/bash -l)
|
||||
if [ "${container_custom_command}" -eq 0 ]; then
|
||||
set - "$@" "/bin/sh" "-c" "\$(getent passwd '${container_command_user}' | cut -f 7 -d :) -l"
|
||||
fi
|
||||
|
||||
# If we have a command and we're unsharing groups, we need to execute those
|
||||
# command using su $container_command_user
|
||||
# if we're in a tty, also allocate one
|
||||
if [ "${unshare_groups:-0}" -eq 1 ]; then
|
||||
# shellcheck disable=SC2089,SC2016
|
||||
set -- "-c" '"$0" "$@"' -- "$@"
|
||||
set -- "-s" "/bin/sh" "$@"
|
||||
if [ "${headless}" -eq 0 ]; then
|
||||
set -- "--pty" "$@"
|
||||
fi
|
||||
set -- "-m" "$@"
|
||||
set -- "${container_command_user}" "$@"
|
||||
set -- "su" "$@"
|
||||
fi
|
||||
|
||||
# Generate the exec command and run it
|
||||
cmd="$(generate_enter_command | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--]}')"
|
||||
# Reverse it so we can reverse loop and prepend the command's arguments
|
||||
# to our positional parameters
|
||||
IFS='
|
||||
'
|
||||
for arg in ${cmd}; do
|
||||
set - "${arg}" "$@"
|
||||
done
|
||||
|
||||
# Prepend the container manager command
|
||||
# reverse it first, so we can loop backward as we're prepending not appending
|
||||
IFS=' '
|
||||
for arg in $(echo "${container_manager}" | rev); do
|
||||
arg="$(echo "${arg}" | rev)"
|
||||
set - "${arg}" "$@"
|
||||
done
|
||||
|
||||
exec "$@"
|
||||
282
profiles/desktop/.local/bin/distrobox-ephemeral
Executable file
282
profiles/desktop/.local/bin/distrobox-ephemeral
Executable file
@@ -0,0 +1,282 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# This file is part of the distrobox project:
|
||||
# https://github.com/89luca89/distrobox
|
||||
#
|
||||
# Copyright (C) 2021 distrobox contributors
|
||||
#
|
||||
# distrobox is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# distrobox 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 distrobox; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# POSIX
|
||||
# Optional env variables:
|
||||
# DBX_CONTAINER_MANAGER
|
||||
# DBX_CONTAINER_NAME
|
||||
# DBX_VERBOSE
|
||||
# DBX_SUDO_PROGRAM
|
||||
|
||||
# Despite of running this script via SUDO/DOAS being not supported (the
|
||||
# script itself will call the appropriate tool when necessary), we still want
|
||||
# to allow people to run it as root, logged in in a shell, and create rootful
|
||||
# containers.
|
||||
#
|
||||
# SUDO_USER is a variable set by SUDO and can be used to check whether the script was called by it. Same thing for DOAS_USER, set by DOAS.
|
||||
if {
|
||||
[ -n "${SUDO_USER}" ] || [ -n "${DOAS_USER}" ]
|
||||
} && [ "$(id -ru)" -eq 0 ]; then
|
||||
printf >&2 "Running %s via SUDO/DOAS is not supported. Instead, please try running:\n" "$(basename "${0}")"
|
||||
printf >&2 " %s --root %s\n" "$(basename "${0}")" "$*"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure we have our env variables correctly set
|
||||
[ -z "${USER}" ] && USER="$(id -run)"
|
||||
[ -z "${HOME}" ] && HOME="$(getent passwd "${USER}" | cut -d':' -f6)"
|
||||
[ -z "${SHELL}" ] && SHELL="$(getent passwd "${USER}" | cut -d':' -f7)"
|
||||
|
||||
trap cleanup TERM INT HUP
|
||||
|
||||
name=$(mktemp -u distrobox-XXXXXXXXXX)
|
||||
container_command=""
|
||||
create_flags=""
|
||||
distrobox_path="$(dirname "${0}")"
|
||||
extra_flags=""
|
||||
# If the user runs this script as root in a login shell, set rootful=1.
|
||||
# There's no need for them to pass the --root flag option in such cases.
|
||||
[ "$(id -ru)" -eq 0 ] && rootful=1 || rootful=0
|
||||
verbose=0
|
||||
version="1.8.2.2"
|
||||
container_additional_packages=""
|
||||
container_init_hook=" "
|
||||
container_manager_additional_flags=""
|
||||
container_pre_init_hook=" "
|
||||
|
||||
# Source configuration files, this is done in an hierarchy so local files have
|
||||
# priority over system defaults
|
||||
# leave priority to environment variables.
|
||||
#
|
||||
# On NixOS, for the distrobox derivation to pick up a static config file shipped
|
||||
# by the package maintainer the path must be relative to the script itself.
|
||||
self_dir="$(dirname "$(realpath "$0")")"
|
||||
nix_config_file="${self_dir}/../share/distrobox/distrobox.conf"
|
||||
|
||||
config_files="
|
||||
${nix_config_file}
|
||||
/usr/share/distrobox/distrobox.conf
|
||||
/usr/share/defaults/distrobox/distrobox.conf
|
||||
/usr/etc/distrobox/distrobox.conf
|
||||
/usr/local/share/distrobox/distrobox.conf
|
||||
/etc/distrobox/distrobox.conf
|
||||
${XDG_CONFIG_HOME:-"${HOME}/.config"}/distrobox/distrobox.conf
|
||||
${HOME}/.distroboxrc
|
||||
"
|
||||
for config_file in ${config_files}; do
|
||||
# Shellcheck will give error for sourcing a variable file as it cannot follow
|
||||
# it. We don't care so let's disable this linting for now.
|
||||
# shellcheck disable=SC1090
|
||||
[ -e "${config_file}" ] && . "$(realpath "${config_file}")"
|
||||
done
|
||||
|
||||
[ -n "${DBX_VERBOSE}" ] && verbose="${DBX_VERBOSE}"
|
||||
|
||||
# Fixup variable=[true|false], in case we find it in the config file(s)
|
||||
[ "${verbose}" = "true" ] && verbose=1
|
||||
[ "${verbose}" = "false" ] && verbose=0
|
||||
|
||||
# show_help will print usage to stdout.
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# version: distrobox version
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# print usage with examples.
|
||||
show_help()
|
||||
{
|
||||
cat << EOF
|
||||
distrobox version: ${version}
|
||||
|
||||
Usage:
|
||||
|
||||
distrobox-ephemeral [--root/-r]
|
||||
|
||||
Options:
|
||||
|
||||
--root/-r: launch podman/docker/lilipod with root privileges. Note that if you need root this is the preferred
|
||||
way over "sudo distrobox" (note: if using a program other than 'sudo' for root privileges is necessary,
|
||||
specify it through the DBX_SUDO_PROGRAM env variable, or 'distrobox_sudo_program' config variable)
|
||||
--verbose/-v: show more verbosity
|
||||
--help/-h: show this message
|
||||
--/-e: end arguments execute the rest as command to execute at login default: default ${USER}'s shell
|
||||
--version/-V: show version
|
||||
|
||||
See also:
|
||||
|
||||
distrobox-ephemeral also inherits all the flags from distrobox-create:
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while :; do
|
||||
case $1 in
|
||||
-h | --help)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
show_help
|
||||
"${distrobox_path}"/distrobox-create --help | tail -n +2
|
||||
exit 0
|
||||
;;
|
||||
-r | --root)
|
||||
shift
|
||||
rootful=1
|
||||
;;
|
||||
-v | --verbose)
|
||||
verbose=1
|
||||
shift
|
||||
;;
|
||||
-V | --version)
|
||||
printf "distrobox: %s\n" "${version}"
|
||||
exit 0
|
||||
;;
|
||||
-e | --exec | --)
|
||||
shift
|
||||
container_command="-- $*"
|
||||
break
|
||||
;;
|
||||
-n | --name)
|
||||
# Ignore --name on ephemeral
|
||||
if [ -n "$2" ]; then
|
||||
name="${2}"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-a | --additional-flags)
|
||||
if [ -n "$2" ]; then
|
||||
container_manager_additional_flags="${container_manager_additional_flags} ${2}"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-ap | --additional-packages)
|
||||
if [ -n "$2" ]; then
|
||||
container_additional_packages="${container_additional_packages} ${2}"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--init-hooks)
|
||||
if [ -n "$2" ]; then
|
||||
container_init_hook="$2"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--pre-init-hooks)
|
||||
if [ -n "$2" ]; then
|
||||
container_pre_init_hook="${2}"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
# If we have a flagless option and container_name is not specified
|
||||
# then let's accept argument as container_name
|
||||
if [ -n "$1" ]; then
|
||||
create_flags="${create_flags} $1"
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -o nounset
|
||||
# set verbosity
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
set -o xtrace
|
||||
extra_flags="${extra_flags} --verbose"
|
||||
fi
|
||||
|
||||
# prepend sudo (or the specified sudo program) if we want our container manager to be rootful
|
||||
if [ "${rootful}" -ne 0 ]; then
|
||||
extra_flags="${extra_flags} --root"
|
||||
fi
|
||||
|
||||
# generate_ephemeral_create_command will produce a distrobox-create command to execute.
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# distrobox_path = string distrobox path
|
||||
# name = string container name
|
||||
# extra_flags = string extra flags to inject
|
||||
# create_flags = string create extra flags to inject
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# prints the distrobox-create command handling special flags
|
||||
generate_ephemeral_create_command()
|
||||
{
|
||||
result_command="${distrobox_path}/distrobox-create"
|
||||
if [ -n "${container_manager_additional_flags}" ]; then
|
||||
result_command="${result_command} \
|
||||
--additional-flags \"${container_manager_additional_flags}\""
|
||||
fi
|
||||
if [ -n "${container_additional_packages}" ]; then
|
||||
result_command="${result_command} \
|
||||
--additional-packages \"${container_additional_packages}\""
|
||||
fi
|
||||
if [ -n "${container_init_hook}" ]; then
|
||||
result_command="${result_command} \
|
||||
--init-hooks \"${container_init_hook}\""
|
||||
fi
|
||||
if [ -n "${container_pre_init_hook}" ]; then
|
||||
result_command="${result_command} \
|
||||
--pre-init-hooks \"${container_pre_init_hook}\""
|
||||
fi
|
||||
result_command="${result_command} \
|
||||
${extra_flags} ${create_flags} --yes --name ${name}"
|
||||
|
||||
# Return generated command.
|
||||
printf "%s" "${result_command}"
|
||||
}
|
||||
|
||||
# cleanup will ensure we remove the ephemeral container
|
||||
# Arguments:
|
||||
# None
|
||||
# Expected global variables:
|
||||
# name: string the name of the container
|
||||
# extra_flags: string extra flags to append to the distrobox command
|
||||
# distrobox_path: string path to the distrobox script
|
||||
# Expected env variables:
|
||||
# None
|
||||
# Outputs:
|
||||
# None
|
||||
cleanup()
|
||||
{
|
||||
trap - TERM INT HUP
|
||||
# shellcheck disable=SC2086
|
||||
"${distrobox_path}"/distrobox-rm ${extra_flags} --force "${name}" --yes
|
||||
}
|
||||
|
||||
cmd="$(generate_ephemeral_create_command)"
|
||||
# shellcheck disable=SC2086
|
||||
eval ${cmd}
|
||||
# shellcheck disable=SC2086
|
||||
"${distrobox_path}"/distrobox-enter ${extra_flags} "${name}" ${container_command}
|
||||
exit_code="$?"
|
||||
|
||||
cleanup
|
||||
|
||||
exit "${exit_code}"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user