mirror of https://gitlab.com/dabruh/dotfiles.git
Initial commit.
This commit is contained in:
commit
dd6b763370
|
@ -0,0 +1,51 @@
|
||||||
|
# Configuration for Alacritty, the GPU enhanced terminal emulator.
|
||||||
|
#
|
||||||
|
# Reference: https://raw.githubusercontent.com/alacritty/alacritty/master/alacritty.yml
|
||||||
|
|
||||||
|
env:
|
||||||
|
TERM: xterm-256color
|
||||||
|
|
||||||
|
window:
|
||||||
|
dynamic_padding: true
|
||||||
|
decorations: none
|
||||||
|
opacity: 0.75
|
||||||
|
padding:
|
||||||
|
x: 5
|
||||||
|
y: 5
|
||||||
|
|
||||||
|
scrolling:
|
||||||
|
history: 100000
|
||||||
|
|
||||||
|
font:
|
||||||
|
size: 10.0
|
||||||
|
normal:
|
||||||
|
family: Hack
|
||||||
|
|
||||||
|
# Colors (One Half Dark)
|
||||||
|
colors:
|
||||||
|
primary:
|
||||||
|
background: "#000000"
|
||||||
|
foreground: "0xdcdfe4"
|
||||||
|
|
||||||
|
normal:
|
||||||
|
black: "0x282c34"
|
||||||
|
red: "0xe06c75"
|
||||||
|
green: "0x98c379"
|
||||||
|
yellow: "0xe5c07b"
|
||||||
|
blue: "0x61afef"
|
||||||
|
magenta: "0xc678dd"
|
||||||
|
cyan: "0x56b6c2"
|
||||||
|
white: "0xdcdfe4"
|
||||||
|
|
||||||
|
bright:
|
||||||
|
black: "#636e72"
|
||||||
|
red: "0xe06c75"
|
||||||
|
green: "0x98c379"
|
||||||
|
yellow: "0xe5c07b"
|
||||||
|
blue: "0x61afef"
|
||||||
|
magenta: "0xc678dd"
|
||||||
|
cyan: "0x56b6c2"
|
||||||
|
white: "0xdcdfe4"
|
||||||
|
|
||||||
|
bell:
|
||||||
|
duration: 500
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Opacity of window during flash.
|
||||||
|
flash-opacity: 0.25
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- window-class: firefox
|
||||||
|
flash-on-focus: False
|
||||||
|
- window-class: code-oss
|
||||||
|
flash-on-focus: False
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||||
|
<fontconfig>
|
||||||
|
<alias>
|
||||||
|
<family>serif</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Linux Libertine</family>
|
||||||
|
<family>Joy Pixels</family>
|
||||||
|
<family>Noto Color Emoji</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
<alias>
|
||||||
|
<family>sans-serif</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Linux Biolinum</family>
|
||||||
|
<family>Joy Pixels</family>
|
||||||
|
<family>Noto Color Emoji</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
<alias>
|
||||||
|
<family>sans</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Linux Biolinum</family>
|
||||||
|
<family>Joy Pixels</family>
|
||||||
|
<family>Noto Color Emoji</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
<alias>
|
||||||
|
<family>monospace</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Noto Sans Mono</family>
|
||||||
|
<family>Liberation Mono</family>
|
||||||
|
<family>Braille</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
</fontconfig>
|
|
@ -0,0 +1,16 @@
|
||||||
|
[Settings]
|
||||||
|
gtk-button-images=0
|
||||||
|
gtk-cursor-theme-name=xcursor-breeze
|
||||||
|
gtk-cursor-theme-size=0
|
||||||
|
gtk-enable-event-sounds=1
|
||||||
|
gtk-enable-input-feedback-sounds=1
|
||||||
|
gtk-font-name=Noto Sans 11
|
||||||
|
gtk-icon-theme-name=Papirus-Dark-Maia
|
||||||
|
gtk-menu-images=1
|
||||||
|
gtk-theme-name=Adapta-Nokto-Eta-Maia
|
||||||
|
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||||
|
gtk-toolbar-style=GTK_TOOLBAR_TEXT
|
||||||
|
gtk-xft-antialias=1
|
||||||
|
gtk-xft-hinting=1
|
||||||
|
gtk-xft-hintstyle=hintfull
|
||||||
|
gtk-xft-rgba=rgb
|
|
@ -0,0 +1,231 @@
|
||||||
|
# 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:$font $font_size
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
# class border backgr. text indicator child_border
|
||||||
|
client.focused #1297e0 #0057a0 #ffffff #ff6ca8 #0057a0
|
||||||
|
client.focused_inactive #0067b0 #102770 #ffffff #102770 #102770
|
||||||
|
client.unfocused #4c5a69 #1c2a39 #9caab9 #1c2a39 #1c2a39
|
||||||
|
client.urgent #FF8C7C #E74C3C #ffffff #E74C3C #E74C3C
|
||||||
|
client.background #ab69c6
|
||||||
|
|
||||||
|
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||||
|
floating_modifier $mod
|
||||||
|
|
||||||
|
# start a browser
|
||||||
|
bindsym $mod+b exec $browser
|
||||||
|
|
||||||
|
# start a terminal
|
||||||
|
bindsym $mod+Return exec $terminal
|
||||||
|
|
||||||
|
# kill focused window
|
||||||
|
bindsym $mod+q kill
|
||||||
|
|
||||||
|
# start dmenu (a program launcher)
|
||||||
|
bindsym $mod+Control+x exec dmenu_run -i -fn '$font-$dmenu_font_size'
|
||||||
|
# There also is the (new) i3-dmenu-desktop which only displays applications
|
||||||
|
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
|
||||||
|
# installed.
|
||||||
|
bindsym $mod+x exec --no-startup-id i3-dmenu-desktop --dmenu="dmenu -i -fn '$font-$dmenu_font_size'"
|
||||||
|
|
||||||
|
# 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, vim keys
|
||||||
|
bindsym $mod+Shift+h move left
|
||||||
|
bindsym $mod+Shift+j move down
|
||||||
|
bindsym $mod+Shift+k move up
|
||||||
|
bindsym $mod+Shift+l move right
|
||||||
|
|
||||||
|
# move focused window, 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
|
||||||
|
|
||||||
|
# toggle split orientation
|
||||||
|
bindsym $mod+z split toggle
|
||||||
|
bindsym $mod+Shift+w split toggle
|
||||||
|
bindsym $mod+v split toggle
|
||||||
|
|
||||||
|
# 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+space floating toggle
|
||||||
|
|
||||||
|
# change focus between tiling / floating windows
|
||||||
|
bindsym $mod+Tab focus mode_toggle
|
||||||
|
|
||||||
|
# focus the parent container
|
||||||
|
bindsym $mod+Control+a focus parent
|
||||||
|
|
||||||
|
# Make the currently focused window a scratchpad
|
||||||
|
bindsym $mod+n move scratchpad
|
||||||
|
|
||||||
|
# Show the first scratchpad window
|
||||||
|
bindsym $mod+Control+n scratchpad show
|
||||||
|
|
||||||
|
# Restore the first scratchpad window
|
||||||
|
bindsym $mod+m scratchpad show, floating toggle
|
||||||
|
|
||||||
|
# switch previous/next workspace
|
||||||
|
bindsym $mod+a workspace prev
|
||||||
|
bindsym $mod+d workspace next
|
||||||
|
bindsym $mod+Control+Left workspace prev
|
||||||
|
bindsym $mod+Control+Right workspace next
|
||||||
|
bindsym $mod+Control+h workspace prev
|
||||||
|
bindsym $mod+Control+l workspace next
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
set $ws6 "6"
|
||||||
|
set $ws7 "7"
|
||||||
|
set $ws8 "8"
|
||||||
|
set $ws9 "9"
|
||||||
|
set $ws10 "10"
|
||||||
|
set $ws11 "11"
|
||||||
|
set $ws12 "12"
|
||||||
|
set $ws13 "13"
|
||||||
|
set $ws14 "14"
|
||||||
|
set $ws15 "15"
|
||||||
|
set $ws16 "16"
|
||||||
|
set $ws17 "17"
|
||||||
|
set $ws18 "18"
|
||||||
|
set $ws19 "19"
|
||||||
|
set $ws20 "20"
|
||||||
|
set $ws21 "21"
|
||||||
|
set $ws22 "22"
|
||||||
|
|
||||||
|
# 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 $ws11
|
||||||
|
bindsym $mod+F2 workspace number $ws12
|
||||||
|
bindsym $mod+F3 workspace number $ws13
|
||||||
|
bindsym $mod+F4 workspace number $ws14
|
||||||
|
bindsym $mod+F5 workspace number $ws15
|
||||||
|
bindsym $mod+F6 workspace number $ws16
|
||||||
|
bindsym $mod+F7 workspace number $ws17
|
||||||
|
bindsym $mod+F8 workspace number $ws18
|
||||||
|
bindsym $mod+F9 workspace number $ws19
|
||||||
|
bindsym $mod+F10 workspace number $ws20
|
||||||
|
bindsym $mod+F11 workspace number $ws21
|
||||||
|
bindsym $mod+F12 workspace number $ws22
|
||||||
|
|
||||||
|
# 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 $ws11
|
||||||
|
bindsym $mod+Shift+F2 move container to workspace number $ws12
|
||||||
|
bindsym $mod+Shift+F3 move container to workspace number $ws13
|
||||||
|
bindsym $mod+Shift+F4 move container to workspace number $ws14
|
||||||
|
bindsym $mod+Shift+F5 move container to workspace number $ws15
|
||||||
|
bindsym $mod+Shift+F6 move container to workspace number $ws16
|
||||||
|
bindsym $mod+Shift+F7 move container to workspace number $ws17
|
||||||
|
bindsym $mod+Shift+F8 move container to workspace number $ws18
|
||||||
|
bindsym $mod+Shift+F9 move container to workspace number $ws19
|
||||||
|
bindsym $mod+Shift+F10 move container to workspace number $ws20
|
||||||
|
bindsym $mod+Shift+F11 move container to workspace number $ws21
|
||||||
|
bindsym $mod+Shift+F12 move container to workspace number $ws22
|
||||||
|
|
||||||
|
# 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'"
|
||||||
|
|
||||||
|
bindsym $mod+y resize shrink width 5 px or 5 ppt
|
||||||
|
bindsym $mod+u resize grow height 5 px or 5 ppt
|
||||||
|
bindsym $mod+i resize shrink height 5 px or 5 ppt
|
||||||
|
bindsym $mod+o resize grow width 5 px or 5 ppt
|
||||||
|
|
||||||
|
# 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 5 px or 5 ppt
|
||||||
|
bindsym j resize grow height 5 px or 5 ppt
|
||||||
|
bindsym k resize shrink height 5 px or 5 ppt
|
||||||
|
bindsym l resize grow width 5 px or 5 ppt
|
||||||
|
|
||||||
|
# same bindings, but for the arrow keys
|
||||||
|
bindsym Left resize shrink width 5 px or 5 ppt
|
||||||
|
bindsym Down resize grow height 5 px or 5 ppt
|
||||||
|
bindsym Up resize shrink height 5 px or 5 ppt
|
||||||
|
bindsym Right resize grow width 5 px or 5 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"
|
||||||
|
|
||||||
|
mode "system" {
|
||||||
|
bindsym l exec --no-startup-id i3exit lock, mode "default"
|
||||||
|
bindsym s exec --no-startup-id i3exit suspend, mode "default"
|
||||||
|
bindsym h exec --no-startup-id i3exit hibernate, mode "default"
|
||||||
|
bindsym u exec --no-startup-id i3exit switch_user, mode "default"
|
||||||
|
bindsym Shift+l exec "i3-nagbar -t warning -m 'Are you sure you want to log out?' -B 'Yes' 'i3exit logout'"
|
||||||
|
bindsym p exec "i3-nagbar -t warning -m 'Are you sure you want to power off?' -B 'Yes' 'poweroff'"
|
||||||
|
bindsym r exec "i3-nagbar -t warning -m 'Are you sure you want to reboot?' -B 'Yes' 'reboot'"
|
||||||
|
|
||||||
|
# back to normal: Enter or Escape or $mod+r
|
||||||
|
bindsym Return mode "default"
|
||||||
|
bindsym Escape mode "default"
|
||||||
|
bindsym $mod+Shift+s mode "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
bindsym $mod+Shift+s mode "system"
|
||||||
|
|
||||||
|
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||||
|
# finds out, if available)
|
||||||
|
bar {
|
||||||
|
status_command i3status
|
||||||
|
tray_output primary
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
# xss-lock grabs a logind suspend inhibit lock and will use i3exit to lock the screen before suspend.
|
||||||
|
exec_always --no-startup-id xss-lock --transfer-sleep-lock -- i3exit lock
|
||||||
|
|
||||||
|
# lock screen after inactivity
|
||||||
|
exec --no-startup-id xautolock -time $lock_after_min -locker 'i3exit lock' -notify $lock_notify_sec -notifier 'notify-send --icon=gtk-info xautolock "The screen will lock soon"'
|
||||||
|
|
||||||
|
# Start various applets
|
||||||
|
exec_always --no-startup-id for app in nm-applet kopia-ui pasystray; do which "$app" && (pgrep $app || $app); done
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Run picom compositor
|
||||||
|
exec_always --no-startup-id pidof -s picom || picom
|
||||||
|
|
||||||
|
# Run flashfocus
|
||||||
|
exec_always --no-startup-id pidof -s flashfocus || flashfocus --config ~/.config/flashfocus
|
||||||
|
bindsym Alt+section exec --no-startup-id flash_window
|
||||||
|
|
||||||
|
# Set wallpaper
|
||||||
|
exec_always --no-startup-id feh --auto-zoom --bg-fill "$HOME/.local/share/bg" --no-fehbg
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Try starting various applets etc.
|
||||||
|
exec_always --no-startup-id for app in nm-applet kopia-ui pasystray; do which "$app" && (pgrep $app || $app); done
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Use pactl to adjust volume in PulseAudio.
|
||||||
|
bindsym XF86AudioRaiseVolume exec --no-startup-id pavolctl +10%
|
||||||
|
bindsym XF86AudioLowerVolume exec --no-startup-id pavolctl -10%
|
||||||
|
bindsym XF86AudioMute exec --no-startup-id pavolctl set-sink-mute
|
||||||
|
bindsym XF86AudioMicMute exec --no-startup-id pavolctl set-source-mute
|
||||||
|
|
||||||
|
# Set cmus controls
|
||||||
|
bindsym XF86AudioStop exec --no-startup-id "cmusctl -c stop"
|
||||||
|
bindsym XF86AudioPlay exec --no-startup-id "cmusctl -c pause"
|
||||||
|
bindsym XF86AudioPrev exec --no-startup-id "cmusctl -c prev"
|
||||||
|
bindsym XF86AudioNext exec --no-startup-id "cmusctl -c next"
|
||||||
|
|
||||||
|
# Write cmus file for i3status
|
||||||
|
exec_always --no-startup-id cmusctl -l -e 2
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Float the following windows
|
||||||
|
for_window [class="Tor Browser"] floating enable
|
||||||
|
for_window [class="Alacritty"][instance="calculator"] floating enable
|
||||||
|
|
||||||
|
# Start screenshot capture
|
||||||
|
bindsym $mod+Ctrl+s exec "$screenshot_cmd"
|
||||||
|
|
||||||
|
# Start bc
|
||||||
|
bindsym $mod+Shift+Return exec "$calc_cmd"
|
||||||
|
|
||||||
|
# Start file manager
|
||||||
|
bindsym $mod+Ctrl+Return exec "$file_cmd"
|
|
@ -0,0 +1,15 @@
|
||||||
|
set $mod Mod4
|
||||||
|
set $font DejaVu Sans Mono
|
||||||
|
set $font_size 8
|
||||||
|
set $dmenu_font_size 8
|
||||||
|
set $browser $BROWSER
|
||||||
|
set $terminal $TERMINAL
|
||||||
|
set $file $FILE
|
||||||
|
set $lock_after_min 1
|
||||||
|
set $lock_notify_sec 10
|
||||||
|
set $screenshot_cmd flameshot gui
|
||||||
|
set $file_cmd alacritty -e ranger
|
||||||
|
set $calc_cmd alacritty --class calculator -e bc -l
|
||||||
|
|
||||||
|
set $browser firefox
|
||||||
|
set $terminal alacritty
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Configures i3-gaps
|
||||||
|
gaps inner 10
|
||||||
|
gaps outer 0
|
||||||
|
smart_gaps on
|
||||||
|
smart_borders on
|
||||||
|
|
||||||
|
for_window [class="^.*"] border pixel 0
|
||||||
|
|
||||||
|
mode "resize" {
|
||||||
|
# Adjust inner gap size
|
||||||
|
bindsym plus gaps inner current plus 1
|
||||||
|
bindsym minus gaps inner current minus 1
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
mode "system" {
|
||||||
|
# brightness control
|
||||||
|
bindsym j exec --no-startup-id sudo brightnessctl set -q 5%-
|
||||||
|
bindsym k exec --no-startup-id sudo brightnessctl set -q +5%
|
||||||
|
}
|
||||||
|
|
||||||
|
# Battery manager
|
||||||
|
exec_always --no-startup-id killall battmon.sh; ~/.config/i3/scripts/battmon.sh
|
|
@ -0,0 +1 @@
|
||||||
|
set $lock_after_min 15
|
|
@ -0,0 +1,96 @@
|
||||||
|
# i3status configuration file.
|
||||||
|
# see "man i3status" for documentation.
|
||||||
|
|
||||||
|
general {
|
||||||
|
interval = 2
|
||||||
|
colors = true
|
||||||
|
color_good = "#2ecc71"
|
||||||
|
color_degraded = "#f39c12"
|
||||||
|
color_bad = "#e74c3c"
|
||||||
|
}
|
||||||
|
|
||||||
|
order += "read_file cmusctl.status"
|
||||||
|
order += "run_watch Docker"
|
||||||
|
order += "wireless _first_"
|
||||||
|
order += "ethernet _first_"
|
||||||
|
order += "load"
|
||||||
|
order += "memory"
|
||||||
|
order += "disk /"
|
||||||
|
order += "disk /home"
|
||||||
|
order += "disk /mnt/das/hdd2tb-1-main"
|
||||||
|
order += "disk /mnt/das/hdd4tb-1-main"
|
||||||
|
order += "read_file borg_backup"
|
||||||
|
order += "volume master"
|
||||||
|
order += "tztime local"
|
||||||
|
|
||||||
|
read_file cmusctl.status {
|
||||||
|
format = "%content"
|
||||||
|
path = "/tmp/cmusctl.status"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_watch Docker {
|
||||||
|
pidfile = "/run/docker.pid"
|
||||||
|
format = "D: %status"
|
||||||
|
}
|
||||||
|
|
||||||
|
wireless _first_ {
|
||||||
|
format_up = "W: (%quality at %essid, %bitrate) %ip"
|
||||||
|
format_down = "W: down"
|
||||||
|
}
|
||||||
|
|
||||||
|
ethernet _first_ {
|
||||||
|
# if you use %speed, i3status requires root privileges
|
||||||
|
format_up = "E: %ip (%speed)"
|
||||||
|
format_down = "E: down"
|
||||||
|
}
|
||||||
|
|
||||||
|
load {
|
||||||
|
format = "cpu: %1min, %5min, %15min"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory {
|
||||||
|
format = "mem: %percentage_free / %total"
|
||||||
|
threshold_degraded = "10%"
|
||||||
|
format_degraded = "MEMORY: %free"
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/" {
|
||||||
|
format = "R: %percentage_used"
|
||||||
|
low_threshold = 70
|
||||||
|
threshold_type = "percentage_used"
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/home" {
|
||||||
|
format = "H: %percentage_used"
|
||||||
|
low_threshold = 70
|
||||||
|
threshold_type = "percentage_used"
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/mnt/das/hdd2tb-1-main" {
|
||||||
|
format = "2TB: %percentage_used"
|
||||||
|
low_threshold = 70
|
||||||
|
threshold_type = "percentage_used"
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/mnt/das/hdd4tb-1-main" {
|
||||||
|
format = "4TB: %percentage_used"
|
||||||
|
low_threshold = 70
|
||||||
|
threshold_type = "percentage_used"
|
||||||
|
}
|
||||||
|
|
||||||
|
read_file borg_backup {
|
||||||
|
format = "B: %content"
|
||||||
|
path = "/var/tmp/last_borg_backup"
|
||||||
|
}
|
||||||
|
|
||||||
|
volume master {
|
||||||
|
format = "🎵: %volume"
|
||||||
|
format_muted = "🔇: %volume"
|
||||||
|
device = "default"
|
||||||
|
mixer = "Master"
|
||||||
|
mixer_idx = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
tztime local {
|
||||||
|
format = "%Y-%m-%d %H:%M:%S"
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
[Default Applications]
|
||||||
|
|
||||||
|
# xdg-open will use these settings to determine how to open filetypes.
|
||||||
|
# These .desktop entries can also be seen and changed in ~/.local/share/applications/
|
||||||
|
|
||||||
|
text/x-shellscript=text.desktop;
|
||||||
|
x-scheme-handler/magnet=torrent.desktop;
|
||||||
|
application/x-bittorrent=torrent.desktop;
|
||||||
|
x-scheme-handler/mailto=mail.desktop;
|
||||||
|
text/plain=text.desktop;
|
||||||
|
application/postscript=pdf.desktop;
|
||||||
|
application/pdf=pdf.desktop;
|
||||||
|
image/png=img.desktop;
|
||||||
|
image/jpeg=img.desktop;
|
||||||
|
image/gif=img.desktop;
|
||||||
|
application/rss+xml=rss.desktop
|
||||||
|
video/x-matroska=video.desktop
|
||||||
|
x-scheme-handler/lbry=lbry.desktop
|
||||||
|
inode/directory=file.desktop
|
|
@ -0,0 +1,184 @@
|
||||||
|
# From https://gist.github.com/gaurav712/42549678b778db12fda5764f7c0757ad
|
||||||
|
|
||||||
|
#################################
|
||||||
|
#
|
||||||
|
# Backend
|
||||||
|
#
|
||||||
|
#################################
|
||||||
|
|
||||||
|
# Backend to use: "xrender" or "glx".
|
||||||
|
# GLX backend is typically much faster but depends on a sane driver.
|
||||||
|
backend = "xrender"
|
||||||
|
|
||||||
|
#################################
|
||||||
|
#
|
||||||
|
# GLX backend
|
||||||
|
#
|
||||||
|
#################################
|
||||||
|
|
||||||
|
glx-no-stencil = true
|
||||||
|
|
||||||
|
# GLX backend: Copy unmodified regions from front buffer instead of redrawing them all.
|
||||||
|
# My tests with nvidia-drivers show a 10% decrease in performance when the whole screen is modified,
|
||||||
|
# but a 20% increase when only 1/4 is.
|
||||||
|
# My tests on nouveau show terrible slowdown.
|
||||||
|
glx-copy-from-front = false
|
||||||
|
|
||||||
|
# GLX backend: Use MESA_copy_sub_buffer to do partial screen update.
|
||||||
|
# My tests on nouveau shows a 200% performance boost when only 1/4 of the screen is updated.
|
||||||
|
# May break VSync and is not available on some drivers.
|
||||||
|
# Overrides --glx-copy-from-front.
|
||||||
|
# glx-use-copysubbuffermesa = true;
|
||||||
|
|
||||||
|
# GLX backend: Avoid rebinding pixmap on window damage.
|
||||||
|
# Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe).
|
||||||
|
# Recommended if it works.
|
||||||
|
# glx-no-rebind-pixmap = true;
|
||||||
|
|
||||||
|
# GLX backend: GLX buffer swap method we assume.
|
||||||
|
# Could be undefined (0), copy (1), exchange (2), 3-6, or buffer-age (-1).
|
||||||
|
# undefined is the slowest and the safest, and the default value.
|
||||||
|
# copy is fastest, but may fail on some drivers,
|
||||||
|
# 2-6 are gradually slower but safer (6 is still faster than 0).
|
||||||
|
# Usually, double buffer means 2, triple buffer means 3.
|
||||||
|
# buffer-age means auto-detect using GLX_EXT_buffer_age, supported by some drivers.
|
||||||
|
# Useless with --glx-use-copysubbuffermesa.
|
||||||
|
# Partially breaks --resize-damage.
|
||||||
|
# Defaults to undefined.
|
||||||
|
#glx-swap-method = "undefined";
|
||||||
|
|
||||||
|
#################################
|
||||||
|
#
|
||||||
|
# Opacity
|
||||||
|
#
|
||||||
|
#################################
|
||||||
|
|
||||||
|
inactive-opacity = 1
|
||||||
|
active-opacity = 1
|
||||||
|
frame-opacity = 1
|
||||||
|
inactive-opacity-override = false
|
||||||
|
|
||||||
|
opacity-rule = [
|
||||||
|
# terminal (Alacritty)
|
||||||
|
"100:class_g = 'Alacritty' && focused",
|
||||||
|
"85:class_g = 'Alacritty' && !focused",
|
||||||
|
|
||||||
|
# Flashfocus
|
||||||
|
"0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
|
||||||
|
]
|
||||||
|
|
||||||
|
#################################
|
||||||
|
#
|
||||||
|
# Rounded corners
|
||||||
|
#
|
||||||
|
#################################
|
||||||
|
|
||||||
|
corner-radius = 10
|
||||||
|
round-borders = 1
|
||||||
|
rounded-corners-exclude = [
|
||||||
|
"class_g = 'i3bar'",
|
||||||
|
"class_g = 'i3-frame'",
|
||||||
|
"class_g = 'code-oss'",
|
||||||
|
]
|
||||||
|
|
||||||
|
#################################
|
||||||
|
#
|
||||||
|
# Fading
|
||||||
|
#
|
||||||
|
#################################
|
||||||
|
|
||||||
|
# Fade windows during opacity changes.
|
||||||
|
fading = true
|
||||||
|
# The time between steps in a fade in milliseconds. (default 10).
|
||||||
|
fade-delta = 7
|
||||||
|
# Opacity change between steps while fading in. (default 0.028).
|
||||||
|
fade-in-step = 0.03
|
||||||
|
# Opacity change between steps while fading out. (default 0.03).
|
||||||
|
fade-out-step = 0.03
|
||||||
|
# Fade windows in/out when opening/closing
|
||||||
|
# no-fading-openclose = true;
|
||||||
|
|
||||||
|
# Specify a list of conditions of windows that should not be faded.
|
||||||
|
fade-exclude = [
|
||||||
|
# "class_g = 'Alacritty'",
|
||||||
|
]
|
||||||
|
|
||||||
|
#################################
|
||||||
|
#
|
||||||
|
# Other
|
||||||
|
#
|
||||||
|
#################################
|
||||||
|
|
||||||
|
# Try to detect WM windows and mark them as active.
|
||||||
|
mark-wmwin-focused = true
|
||||||
|
# Mark all non-WM but override-redirect windows active (e.g. menus).
|
||||||
|
mark-ovredir-focused = true
|
||||||
|
# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of using FocusIn/Out events.
|
||||||
|
# Usually more reliable but depends on a EWMH-compliant WM.
|
||||||
|
use-ewmh-active-win = true
|
||||||
|
# Detect rounded corners and treat them as rectangular when --shadow-ignore-shaped is on.
|
||||||
|
detect-rounded-corners = true
|
||||||
|
|
||||||
|
# Detect _NET_WM_OPACITY on client windows, useful for window managers not passing _NET_WM_OPACITY of client windows to frame windows.
|
||||||
|
# This prevents opacity being ignored for some apps.
|
||||||
|
# For example without this enabled my xfce4-notifyd is 100% opacity no matter what.
|
||||||
|
detect-client-opacity = true
|
||||||
|
|
||||||
|
# Vertical synchronization: match the refresh rate of the monitor
|
||||||
|
vsync = true
|
||||||
|
|
||||||
|
# Enable DBE painting mode, intended to use with VSync to (hopefully) eliminate tearing.
|
||||||
|
# Reported to have no effect, though.
|
||||||
|
dbe = true
|
||||||
|
|
||||||
|
# Limit picom to repaint at most once every 1 / refresh_rate second to boost performance.
|
||||||
|
# This should not be used with --vsync drm/opengl/opengl-oml as they essentially does --sw-opti's job already,
|
||||||
|
# unless you wish to specify a lower refresh rate than the actual value.
|
||||||
|
#sw-opti = true;
|
||||||
|
|
||||||
|
# Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows, like games.
|
||||||
|
# Known to cause flickering when redirecting/unredirecting windows.
|
||||||
|
unredir-if-possible = true
|
||||||
|
|
||||||
|
# Specify a list of conditions of windows that should always be considered focused.
|
||||||
|
focus-exclude = [
|
||||||
|
"class_g = 'i3'",
|
||||||
|
"override_redirect",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Use WM_TRANSIENT_FOR to group windows, and consider windows in the same group focused at the same time.
|
||||||
|
detect-transient = true
|
||||||
|
# Use WM_CLIENT_LEADER to group windows, and consider windows in the same group focused at the same time.
|
||||||
|
# WM_TRANSIENT_FOR has higher priority if --detect-transient is enabled, too.
|
||||||
|
detect-client-leader = true
|
||||||
|
|
||||||
|
#################################
|
||||||
|
#
|
||||||
|
# Window type settings
|
||||||
|
#
|
||||||
|
#################################
|
||||||
|
|
||||||
|
wintypes:
|
||||||
|
{
|
||||||
|
tooltip =
|
||||||
|
{
|
||||||
|
# fade: Fade the particular type of windows.
|
||||||
|
fade = true
|
||||||
|
# shadow: Give those windows shadow
|
||||||
|
shadow = true
|
||||||
|
# opacity: Default opacity for the type of windows.
|
||||||
|
opacity = 0.85
|
||||||
|
# focus: Whether to always consider windows of this type focused.
|
||||||
|
focus = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
######################
|
||||||
|
#
|
||||||
|
# XSync
|
||||||
|
# See: https://github.com/yshui/picom/commit/b18d46bcbdc35a3b5620d817dd46fbc76485c20d
|
||||||
|
#
|
||||||
|
######################
|
||||||
|
|
||||||
|
# Use X Sync fence to sync clients' draw calls. Needed on nvidia-drivers with GLX backend for some users.
|
||||||
|
xrender-sync-fence = true
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Verbosity and settings that you pretty much just always are going to want.
|
||||||
|
alias \
|
||||||
|
cp="cp -iv" \
|
||||||
|
mv="mv -iv" \
|
||||||
|
rm="rm -vI" \
|
||||||
|
bc="bc -ql" \
|
||||||
|
mkd="mkdir -pv" \
|
||||||
|
yt="yt-dlp --embed-metadata -i" \
|
||||||
|
yta="yt -x -f bestaudio/best" \
|
||||||
|
ffmpeg="ffmpeg -hide_banner"
|
||||||
|
|
||||||
|
# Kubernetes things
|
||||||
|
alias \
|
||||||
|
ctx="kubectl ctx" \
|
||||||
|
f='flux' \
|
||||||
|
h='helm' \
|
||||||
|
k='kubectl' \
|
||||||
|
v='velero'
|
||||||
|
|
||||||
|
# These common commands are just too long! Abbreviate them.
|
||||||
|
alias \
|
||||||
|
ka="killall" \
|
||||||
|
g="git" \
|
||||||
|
e="$EDITOR" \
|
||||||
|
p="pacman" \
|
||||||
|
z="zathura"
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
alias \
|
||||||
|
tmux='tmux -f ~/.config/tmux/tmux.conf' \
|
||||||
|
df='df -h' \
|
||||||
|
free='free -m' \
|
||||||
|
r='ranger' \
|
||||||
|
w='curl https://wttr.in/'
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Default programs:
|
||||||
|
export BROWSER=firefox
|
||||||
|
export EDITOR=vim
|
||||||
|
export FILE=ranger
|
||||||
|
export IMAGES=feh
|
||||||
|
export PAGER=less
|
||||||
|
export TERMINAL=alacritty
|
||||||
|
export VISUAL=code
|
||||||
|
|
||||||
|
# Clean home:
|
||||||
|
export XDG_CACHE_HOME="$HOME/.cache"
|
||||||
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
|
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
|
||||||
|
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
||||||
|
export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history"
|
||||||
|
export XINITRC="${XDG_CONFIG_HOME:-$HOME/.config}/x11/xinitrc"
|
||||||
|
export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
|
||||||
|
export NUGET_PACKAGES="${XDG_DATA_HOME:-$HOME/.local/share}/nuget"
|
||||||
|
|
||||||
|
# Color man pages:
|
||||||
|
export LESS=-r
|
||||||
|
export LESS_TERMCAP_mb=$'\E[01;32m'
|
||||||
|
export LESS_TERMCAP_md=$'\E[01;32m'
|
||||||
|
export LESS_TERMCAP_me=$'\E[0m'
|
||||||
|
export LESS_TERMCAP_se=$'\E[0m'
|
||||||
|
export LESS_TERMCAP_so=$'\E[01;47;34m'
|
||||||
|
export LESS_TERMCAP_ue=$'\E[0m'
|
||||||
|
export LESS_TERMCAP_us=$'\E[01;36m'
|
||||||
|
|
||||||
|
# Other program settings:
|
||||||
|
export DISPLAY_DPI=96
|
||||||
|
|
||||||
|
PATHS=(
|
||||||
|
"$HOME/bin"
|
||||||
|
"$HOME/.local/bin"
|
||||||
|
"$HOME/.cargo/bin"
|
||||||
|
"${KREW_ROOT:-$HOME/.krew}/bin"
|
||||||
|
)
|
||||||
|
|
||||||
|
for DIR in "${PATHS[@]}"; do
|
||||||
|
! [ -d "$DIR" ] && continue
|
||||||
|
export PATH="$DIR:$PATH"
|
||||||
|
done
|
|
@ -0,0 +1,92 @@
|
||||||
|
# If running inside tmux ($TMUX is set), then change the status line to red
|
||||||
|
%if #{TMUX}
|
||||||
|
set -g status-bg red
|
||||||
|
%endif
|
||||||
|
|
||||||
|
# Change the prefix key to C-a
|
||||||
|
set -g prefix C-a
|
||||||
|
unbind C-b
|
||||||
|
bind C-a send-prefix
|
||||||
|
|
||||||
|
# 0 is too far from ` ;)
|
||||||
|
set -g base-index 1
|
||||||
|
|
||||||
|
# Automatically set window title
|
||||||
|
set-window-option -g automatic-rename on
|
||||||
|
set-option -g set-titles on
|
||||||
|
|
||||||
|
# True Colors
|
||||||
|
set -g default-terminal "xterm-256color"
|
||||||
|
set -ga terminal-overrides ",*256col*:Tc"
|
||||||
|
|
||||||
|
set -g status-keys vi
|
||||||
|
set -g history-limit 10000
|
||||||
|
|
||||||
|
setw -g mode-keys vi
|
||||||
|
setw -g mouse on
|
||||||
|
setw -g monitor-activity on
|
||||||
|
|
||||||
|
bind-key v split-window -h
|
||||||
|
bind-key s split-window -v
|
||||||
|
|
||||||
|
bind-key J resize-pane -D 5
|
||||||
|
bind-key K resize-pane -U 5
|
||||||
|
bind-key H resize-pane -L 5
|
||||||
|
bind-key L resize-pane -R 5
|
||||||
|
|
||||||
|
# User prefix + Alt-vim keys to resize panes
|
||||||
|
#bind-key M-j resize-pane -D
|
||||||
|
#bind-key M-k resize-pane -U
|
||||||
|
#bind-key M-h resize-pane -L
|
||||||
|
#bind-key M-l resize-pane -R
|
||||||
|
|
||||||
|
# Vim style pane selection
|
||||||
|
bind h select-pane -L
|
||||||
|
bind j select-pane -D
|
||||||
|
bind k select-pane -U
|
||||||
|
bind l select-pane -R
|
||||||
|
|
||||||
|
# Use Alt-vim keys without prefix key to switch panes
|
||||||
|
bind -n M-h select-pane -L
|
||||||
|
bind -n M-j select-pane -D
|
||||||
|
bind -n M-k select-pane -U
|
||||||
|
bind -n M-l select-pane -R
|
||||||
|
|
||||||
|
# Use Alt-arrow keys without prefix key to switch panes
|
||||||
|
bind -n M-Left select-pane -L
|
||||||
|
bind -n M-Right select-pane -R
|
||||||
|
bind -n M-Up select-pane -U
|
||||||
|
bind -n M-Down select-pane -D
|
||||||
|
|
||||||
|
# Shift arrow to switch windows
|
||||||
|
bind -n S-Left previous-window
|
||||||
|
bind -n S-Right next-window
|
||||||
|
|
||||||
|
# No delay for escape key press
|
||||||
|
set -sg escape-time 0
|
||||||
|
|
||||||
|
# Reload tmux config
|
||||||
|
bind r source-file ~/.tmux.conf
|
||||||
|
|
||||||
|
# THEME
|
||||||
|
#set -g status-bg black
|
||||||
|
#set -g status-fg white
|
||||||
|
#set -g window-status-current-style fg=yellow,bold
|
||||||
|
#set -g status-interval 60
|
||||||
|
#set -g status-left-length 30
|
||||||
|
#set -g status-left '#[fg=green](#S) #(whoami) '
|
||||||
|
#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
|
||||||
|
|
||||||
|
set-option -g status-interval 2
|
||||||
|
|
||||||
|
set -g status-bg 'black'
|
||||||
|
set -g status-justify 'centre'
|
||||||
|
set -g status 'on'
|
||||||
|
set -g status-left-length '100'
|
||||||
|
set -g status-right-length '100'
|
||||||
|
set -g window-status-style fg=white,bg=black,none
|
||||||
|
set -g window-status-activity-style fg=colour221,bold
|
||||||
|
set -g status-left '#[fg=black,bg=colour221,nobold,nounderscore,noitalics] #S #[fg=colour221,bg=blue]#[fg=black,bg=blue] #{=15:window_name} #[fg=blue,bg=colour250]#[fg=black,bg=colour250] #(kubectl config current-context 2>/dev/null) #[fg=colour250,bg=black]'
|
||||||
|
set -g status-right '#[fg=blue,bg=black,nobold,nounderscore,noitalics]#[fg=black,bg=blue] %Y-%m-%d %H:%M #[fg=colour221,bg=blue]#[fg=black,bg=colour221] #(whoami)@#h '
|
||||||
|
setw -g window-status-format ' #I #{=5:window_name} '
|
||||||
|
setw -g window-status-current-format '#[fg=colour221,bg=black,nobold,nounderscore,noitalics]#[fg=black,bold,bg=colour221]#I#F#{=5:window_name}#[fg=colour221,bg=black,nobold,nounderscore,noitalics]'
|
|
@ -0,0 +1 @@
|
||||||
|
XDG_DESKTOP_DIR="$HOME/"
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# xinitrc runs automatically when you run startx.
|
||||||
|
|
||||||
|
userresources=$HOME/.Xresources
|
||||||
|
usermodmap=$HOME/.Xmodmap
|
||||||
|
sysresources=/etc/X11/xinit/.Xresources
|
||||||
|
sysmodmap=/etc/X11/xinit/.Xmodmap
|
||||||
|
|
||||||
|
# merge in defaults and keymaps
|
||||||
|
|
||||||
|
if [ -f $sysresources ]; then
|
||||||
|
xrdb -merge $sysresources
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $sysmodmap ]; then
|
||||||
|
xmodmap $sysmodmap
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$userresources" ]; then
|
||||||
|
xrdb -merge "$userresources"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$usermodmap" ]; then
|
||||||
|
xmodmap "$usermodmap"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# start some nice programs
|
||||||
|
|
||||||
|
if [ -d /etc/X11/xinit/xinitrc.d ]; then
|
||||||
|
for f in /etc/X11/xinit/xinitrc.d/?*.sh; do
|
||||||
|
[ -x "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
unset f
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then
|
||||||
|
. "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile"
|
||||||
|
else
|
||||||
|
. "$HOME/.xprofile"
|
||||||
|
fi
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This file runs when a DM logs you into a graphical session.
|
||||||
|
# If you use startx/xinit like a Chad, this file will also be sourced.
|
||||||
|
|
||||||
|
xrandr --dpi "${DISPLAY_DPI:-96}"
|
||||||
|
xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources" &
|
||||||
|
xrdbpid=$!
|
||||||
|
|
||||||
|
DISPLAY_SCRIPT=~/.local/share/xrandr/$(hostname)
|
||||||
|
([ -e "$DISPLAY_SCRIPT" ] && $DISPLAY_SCRIPT) || xrandr --auto
|
||||||
|
|
||||||
|
AUTOSTART="picom"
|
||||||
|
|
||||||
|
for PROGRAM in $AUTOSTART; do
|
||||||
|
which "$PROGRAM" || continue
|
||||||
|
pidof -s "$PROGRAM" || "$PROGRAM" &
|
||||||
|
done >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Ensure that xrdb has finished running before moving on to start the WM/DE.
|
||||||
|
[ -n "$xrdbpid" ] && wait "$xrdbpid"
|
|
@ -0,0 +1,7 @@
|
||||||
|
!! Transparency (0-1):
|
||||||
|
*.alpha: 0.8
|
||||||
|
|
||||||
|
!! Set a default font and font size as below:
|
||||||
|
*.font: monospace:size=10
|
||||||
|
|
||||||
|
Xcursor.size: 16
|
|
@ -0,0 +1 @@
|
||||||
|
set selection-clipboard clipboard
|
|
@ -0,0 +1 @@
|
||||||
|
[ -f ~/.zprofile ] && . ~/.zprofile
|
|
@ -0,0 +1,144 @@
|
||||||
|
## Options section
|
||||||
|
setopt correct # Auto correct mistakes
|
||||||
|
setopt extendedglob # Extended globbing. Allows using regular expressions with *
|
||||||
|
setopt nocaseglob # Case insensitive globbing
|
||||||
|
setopt rcexpandparam # Array expension with parameters
|
||||||
|
setopt nocheckjobs # Don't warn about running processes when exiting
|
||||||
|
setopt numericglobsort # Sort filenames numerically when it makes sense
|
||||||
|
setopt nobeep # No beep
|
||||||
|
setopt autocd # if only directory path is entered, cd there.
|
||||||
|
setopt appendhistory # Immediately append history instead of overwriting
|
||||||
|
setopt histignorealldups # If a new command is a duplicate, remove the older one
|
||||||
|
setopt HIST_IGNORE_SPACE
|
||||||
|
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
|
||||||
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
|
||||||
|
zstyle ':completion:*' rehash true # automatically find new executables in path
|
||||||
|
# Speed up completions
|
||||||
|
zstyle ':completion:*' accept-exact '*(N)'
|
||||||
|
zstyle ':completion:*' use-cache on
|
||||||
|
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||||
|
HISTFILE=~/.zhistory
|
||||||
|
HISTSIZE=1000
|
||||||
|
SAVEHIST=500
|
||||||
|
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word
|
||||||
|
|
||||||
|
|
||||||
|
## Keybindings section
|
||||||
|
bindkey -e
|
||||||
|
bindkey '^[[7~' beginning-of-line # Home key
|
||||||
|
bindkey '^[[H' beginning-of-line # Home key
|
||||||
|
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||||
|
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||||
|
fi
|
||||||
|
bindkey '^[[8~' end-of-line # End key
|
||||||
|
bindkey '^[[F' end-of-line # End key
|
||||||
|
if [[ "${terminfo[kend]}" != "" ]]; then
|
||||||
|
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
||||||
|
fi
|
||||||
|
bindkey '^[[2~' overwrite-mode # Insert key
|
||||||
|
bindkey '^[[3~' delete-char # Delete key
|
||||||
|
bindkey '^[[C' forward-char # Right key
|
||||||
|
bindkey '^[[D' backward-char # Left key
|
||||||
|
bindkey '^[[5~' history-beginning-search-backward # Page up key
|
||||||
|
bindkey '^[[6~' history-beginning-search-forward # Page down key
|
||||||
|
|
||||||
|
# Navigate words with ctrl+arrow keys
|
||||||
|
bindkey '^[Oc' forward-word #
|
||||||
|
bindkey '^[Od' backward-word #
|
||||||
|
bindkey '^[[1;5D' backward-word #
|
||||||
|
bindkey '^[[1;5C' forward-word #
|
||||||
|
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
|
||||||
|
bindkey '^[[Z' undo # Shift+tab undo last action
|
||||||
|
|
||||||
|
# Theming section
|
||||||
|
autoload -U compinit colors zcalc
|
||||||
|
compinit -d
|
||||||
|
colors
|
||||||
|
|
||||||
|
# enable substitution for prompt
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
|
# Prompt (on left side) similar to default bash prompt, or redhat zsh prompt with colors
|
||||||
|
#PROMPT="%(!.%{$fg[red]%}[%n@%m %1~]%{$reset_color%}# .%{$fg[green]%}[%n@%m %1~]%{$reset_color%}$ "
|
||||||
|
# Maia prompt
|
||||||
|
PROMPT="%B%{$fg[cyan]%}%(4~|%-1~/.../%2~|%~)%u%b >%{$fg[cyan]%}>%B%(?.%{$fg[cyan]%}.%{$fg[red]%})>%{$reset_color%}%b " # Print some system information when the shell is first started
|
||||||
|
# Print a greeting message when shell is started
|
||||||
|
echo $USER@$HOST $(uname -srm) $(lsb_release -rcs)
|
||||||
|
## Prompt on right side:
|
||||||
|
# - shows status of git when in git repository (code adapted from https://techanic.net/2012/12/30/my_git_prompt_for_zsh.html)
|
||||||
|
# - shows exit status of previous command (if previous command finished with an error)
|
||||||
|
# - is invisible, if neither is the case
|
||||||
|
|
||||||
|
# Modify the colors and symbols in these variables as desired.
|
||||||
|
GIT_PROMPT_SYMBOL="%{$fg[blue]%}±" # plus/minus - clean repo
|
||||||
|
GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$reset_color%}"
|
||||||
|
GIT_PROMPT_SUFFIX="%{$fg[green]%}]%{$reset_color%}"
|
||||||
|
GIT_PROMPT_AHEAD="%{$fg[red]%}ANUM%{$reset_color%}" # A"NUM" - ahead by "NUM" commits
|
||||||
|
GIT_PROMPT_BEHIND="%{$fg[cyan]%}BNUM%{$reset_color%}" # B"NUM" - behind by "NUM" commits
|
||||||
|
GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}⚡︎%{$reset_color%}" # lightning bolt - merge conflict
|
||||||
|
GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" # red circle - untracked files
|
||||||
|
GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}●%{$reset_color%}" # yellow circle - tracked files modified
|
||||||
|
GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" # green circle - staged changes present = ready for "git push"
|
||||||
|
|
||||||
|
parse_git_branch() {
|
||||||
|
# Show Git branch/tag, or name-rev if on detached head
|
||||||
|
( git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD ) 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_git_state() {
|
||||||
|
# Show different symbols as appropriate for various Git repository states
|
||||||
|
# Compose this value via multiple conditional appends.
|
||||||
|
local GIT_STATE=""
|
||||||
|
local NUM_AHEAD="$(git log --oneline @{u}.. 2> /dev/null | wc -l | tr -d ' ')"
|
||||||
|
if [ "$NUM_AHEAD" -gt 0 ]; then
|
||||||
|
GIT_STATE=$GIT_STATE${GIT_PROMPT_AHEAD//NUM/$NUM_AHEAD}
|
||||||
|
fi
|
||||||
|
local NUM_BEHIND="$(git log --oneline ..@{u} 2> /dev/null | wc -l | tr -d ' ')"
|
||||||
|
if [ "$NUM_BEHIND" -gt 0 ]; then
|
||||||
|
GIT_STATE=$GIT_STATE${GIT_PROMPT_BEHIND//NUM/$NUM_BEHIND}
|
||||||
|
fi
|
||||||
|
local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)"
|
||||||
|
if [ -n $GIT_DIR ] && test -r $GIT_DIR/MERGE_HEAD; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_MERGING
|
||||||
|
fi
|
||||||
|
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_UNTRACKED
|
||||||
|
fi
|
||||||
|
if ! git diff --quiet 2> /dev/null; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_MODIFIED
|
||||||
|
fi
|
||||||
|
if ! git diff --cached --quiet 2> /dev/null; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_STAGED
|
||||||
|
fi
|
||||||
|
if [[ -n $GIT_STATE ]]; then
|
||||||
|
echo "$GIT_PROMPT_PREFIX$GIT_STATE$GIT_PROMPT_SUFFIX"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
git_prompt_string() {
|
||||||
|
local git_where="$(parse_git_branch)"
|
||||||
|
|
||||||
|
# If inside a Git repository, print its branch and state
|
||||||
|
[ -n "$git_where" ] && echo "$GIT_PROMPT_SYMBOL$(parse_git_state)$GIT_PROMPT_PREFIX%{$fg[yellow]%}${git_where#(refs/heads/|tags/)}$GIT_PROMPT_SUFFIX"
|
||||||
|
|
||||||
|
# If not inside the Git repo, print exit codes of last command (only if it failed)
|
||||||
|
[ ! -n "$git_where" ] && echo "%{$fg[red]%} %(?..[%?])"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Plugins section: Enable fish style features
|
||||||
|
# Use syntax highlighting
|
||||||
|
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
|
||||||
|
# Use history substring search
|
||||||
|
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||||
|
|
||||||
|
# bind UP and DOWN arrow keys to history substring search
|
||||||
|
zmodload zsh/terminfo
|
||||||
|
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||||
|
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||||
|
bindkey '^[[A' history-substring-search-up
|
||||||
|
bindkey '^[[B' history-substring-search-down
|
||||||
|
|
||||||
|
[ -f "$ZDOTDIR/completion" ] && . "$ZDOTDIR/completion" # Additional ZSH completion
|
||||||
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/zsh
|
||||||
|
|
||||||
|
# Auto-complete section
|
||||||
|
command -v flux >/dev/null && . <(flux completion zsh) && complete -F _flux f
|
||||||
|
command -v helm >/dev/null && . <(helm completion zsh) && complete -F _helm h
|
||||||
|
command -v kubectl >/dev/null && . <(kubectl completion zsh) && complete -F __start_kubectl k
|
||||||
|
command -v velero >/dev/null && . <(velero completion zsh) && complete -F __start_velero v
|
|
@ -0,0 +1,17 @@
|
||||||
|
[alias]
|
||||||
|
br = branch
|
||||||
|
cot = checkout
|
||||||
|
d = !git --no-pager diff
|
||||||
|
fo = fetch origin
|
||||||
|
lo = log --name-status
|
||||||
|
st = status -sb
|
||||||
|
stat = !git --no-pager diff --stat
|
||||||
|
|
||||||
|
[pull]
|
||||||
|
rebase = false
|
||||||
|
|
||||||
|
[help]
|
||||||
|
autocorrect = 40
|
||||||
|
|
||||||
|
[core]
|
||||||
|
editor = vim
|
|
@ -0,0 +1,2 @@
|
||||||
|
^\.local\/bin
|
||||||
|
^\.local\/share\/xrandr
|
|
@ -0,0 +1,5 @@
|
||||||
|
^\README\.md
|
||||||
|
^\.install
|
||||||
|
^install\.sh$
|
||||||
|
^setup_system\.sh$
|
||||||
|
^\.config\/i3\/overrides
|
|
@ -0,0 +1,3 @@
|
||||||
|
pacman-any:code,feh,i3exit,i3status,network-manager-applet,pasystray,vim,xautolock,xss-lock,yay
|
||||||
|
pacman-laptop:brightnessctl
|
||||||
|
aur-any:flashfocus-git,sddm-theme-aerial-git
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# battmon, the battery monitor 🦇
|
||||||
|
|
||||||
|
BAT_LEVEL_WARN=${BAT_LEVEL_WARN:=20}
|
||||||
|
BAT_LEVEL_CRITICAL=${BAT_LEVEL_CRITICAL:=10}
|
||||||
|
|
||||||
|
function _acpib() {
|
||||||
|
acpi -b | grep -Fv ' 0%'
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDischarging() {
|
||||||
|
[[ "$(_acpib)" == *"Discharging"* ]] && echo true || echo false
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLevel() {
|
||||||
|
_acpib | sed -ne 's/.* [0-9].* \([0-9]*\)%.*/\1/p'
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLevelMessage() {
|
||||||
|
echo "The battery level is $(getLevel)%"
|
||||||
|
}
|
||||||
|
|
||||||
|
function levelIsWarn() {
|
||||||
|
[[ $(getLevel) -le $BAT_LEVEL_WARN ]] && echo true || echo false
|
||||||
|
}
|
||||||
|
|
||||||
|
function levelIsCritical() {
|
||||||
|
[[ $(getLevel) -le $BAT_LEVEL_CRITICAL ]] && echo true || echo false
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $(_acpib | wc -l) -gt 0 ]]; then
|
||||||
|
echo "No batteries installed."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
if eval "$(isDischarging)"; then
|
||||||
|
if eval "$(levelIsCritical)"; then
|
||||||
|
i3-nagbar -t warning -m "$(getLevelMessage) which is below the critical level of $BAT_LEVEL_CRITICAL%. The computer will be suspended in 30 seconds unless charged."
|
||||||
|
sleep 30
|
||||||
|
eval "$(levelIsCritical)" && systemctl suspend
|
||||||
|
elif eval "$(levelIsWarn)"; then
|
||||||
|
notify-send "$(getLevelMessage)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
sleep 3
|
||||||
|
done
|
|
@ -0,0 +1,153 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_NAME="$(basename -- "$0")"
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
echo "Usage: $SCRIPT_NAME [OPTIONS]"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h Display help."
|
||||||
|
echo " -e [COUNT] Run forever, every [COUNT] seconds. Disabled (0) by default."
|
||||||
|
echo " -l Kill other $SCRIPT_NAME processes. Only allowed if running forever."
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts ":e:c:lh" arg; do
|
||||||
|
case $arg in
|
||||||
|
e) EVERY=$OPTARG ;;
|
||||||
|
c) COMMAND=$OPTARG ;;
|
||||||
|
l) AQUIRE_LEADER=true ;;
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "$SCRIPT_NAME: Must supply an argument to -$OPTARG." >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "Invalid option: -${OPTARG}."
|
||||||
|
echo
|
||||||
|
usage
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
LOOP=false
|
||||||
|
EVERY="${EVERY:-0}"
|
||||||
|
[[ $EVERY -gt 0 ]] && LOOP=true
|
||||||
|
AQUIRE_LEADER="${AQUIRE_LEADER:-false}"
|
||||||
|
OUTPUT_FILE="/tmp/$SCRIPT_NAME.status"
|
||||||
|
PREV_STATUS=""
|
||||||
|
|
||||||
|
function multiple_instances_running() {
|
||||||
|
[[ "$(pgrep -f "$SCRIPT_NAME" | grep -cv "^$$$")" -gt 1 ]] || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function aquire_leader() {
|
||||||
|
echo "Aquiring leadership"
|
||||||
|
|
||||||
|
if ! [[ "$EVERY" -gt 0 ]]; then
|
||||||
|
echo "ERROR: -e [COUNT] must be a positive integer for leader aquisition." 1>&2
|
||||||
|
exit 11
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r pid; do
|
||||||
|
[[ "$pid" == "$$" ]] && continue
|
||||||
|
|
||||||
|
if ! kill "$pid"; then
|
||||||
|
echo "ERROR: Unable to kill $pid." 1>&2
|
||||||
|
exit 12
|
||||||
|
fi
|
||||||
|
done <<<"$(pgrep -f "$SCRIPT_NAME")"
|
||||||
|
|
||||||
|
echo "Leadership aquired."
|
||||||
|
}
|
||||||
|
|
||||||
|
function write_status() {
|
||||||
|
local status="$1"
|
||||||
|
|
||||||
|
# Don't write if there's no update
|
||||||
|
if [[ "$status" != "$PREV_STATUS" ]]; then
|
||||||
|
echo "$status" | tee "$OUTPUT_FILE"
|
||||||
|
killall -SIGUSR1 i3status
|
||||||
|
export PREV_STATUS="$status"
|
||||||
|
else
|
||||||
|
echo "NOCHG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
! $LOOP && exit 0
|
||||||
|
sleep "$EVERY"
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_field() {
|
||||||
|
local row
|
||||||
|
row="$(grep "^$1 " <<<"$QUERY_RESULT")"
|
||||||
|
echo "${row#"$1 "}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_status() {
|
||||||
|
local tmp status
|
||||||
|
tmp="$(get_field status)"
|
||||||
|
status="$tmp"
|
||||||
|
[ "$tmp" == "playing" ] && status="▶"
|
||||||
|
[ "$tmp" == "paused" ] && status="⏸️"
|
||||||
|
[ "$tmp" == "stopped" ] && status="⏹️"
|
||||||
|
echo $status
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_progress() {
|
||||||
|
local duration position
|
||||||
|
duration="$(get_field duration)"
|
||||||
|
position="$(get_field position)"
|
||||||
|
|
||||||
|
if [ -n "$duration" ] && [ -n "$position" ]; then
|
||||||
|
echo "$(((position * 100 / duration * 100) / 100))%"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_artist_title() {
|
||||||
|
local tag_artist tag_title
|
||||||
|
tag_artist="$(get_field "tag artist")"
|
||||||
|
tag_title="$(get_field "tag title")"
|
||||||
|
if [ -n "$tag_artist" ] && [ -n "$tag_title" ]; then
|
||||||
|
echo "$tag_artist - $tag_title"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_file_name() {
|
||||||
|
local fn
|
||||||
|
fn="$(get_field file)"
|
||||||
|
fn="${fn##*/}"
|
||||||
|
fn="${fn%%.*}"
|
||||||
|
echo "$fn"
|
||||||
|
}
|
||||||
|
|
||||||
|
if $LOOP && multiple_instances_running; then
|
||||||
|
if $AQUIRE_LEADER; then
|
||||||
|
echo "Other instances have been detected."
|
||||||
|
aquire_leader
|
||||||
|
else
|
||||||
|
echo "ERROR: Other instances are running and leader aquisition not set." 1>&2
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$COMMAND" ] && cmus-remote "--$COMMAND"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
QUERY_RESULT="$(cmus-remote --query 2>/dev/null)"
|
||||||
|
[ -z "$QUERY_RESULT" ] && write_status "❌" && continue
|
||||||
|
|
||||||
|
PROGRESS="$(get_progress)"
|
||||||
|
STATUS="$(get_status)"
|
||||||
|
NAME="$(get_artist_title)"
|
||||||
|
[ -z "$NAME" ] && NAME="$(get_file_name)"
|
||||||
|
|
||||||
|
OUT="${STATUS^}"
|
||||||
|
[ -n "$NAME" ] && OUT+=" $NAME"
|
||||||
|
[ -n "$PROGRESS" ] && [ "$STATUS" != "⏹️" ] && OUT+=" ($PROGRESS)"
|
||||||
|
|
||||||
|
write_status "$OUT"
|
||||||
|
done
|
|
@ -0,0 +1,72 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Gives a dmenu prompt to mount unmounted drives and Android phones. If
|
||||||
|
# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll
|
||||||
|
# be prompted to give a mountpoint from already existsing directories. If you
|
||||||
|
# input a novel directory, it will prompt you to create that directory.
|
||||||
|
|
||||||
|
getmount() {
|
||||||
|
[ -z "$chosen" ] && exit 1
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||||
|
test -z "$mp" && exit 1
|
||||||
|
if [ ! -d "$mp" ]; then
|
||||||
|
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
|
||||||
|
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
mountusb() {
|
||||||
|
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
||||||
|
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||||
|
sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
|
||||||
|
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
|
||||||
|
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
|
||||||
|
partitiontype="$(lsblk -no "fstype" "$chosen")"
|
||||||
|
case "$partitiontype" in
|
||||||
|
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
|
||||||
|
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
|
||||||
|
*)
|
||||||
|
sudo -A mount "$chosen" "$mp"
|
||||||
|
user="$(whoami)"
|
||||||
|
ug="$(groups | awk '{print $1}')"
|
||||||
|
sudo -A chown "$user":"$ug" "$mp"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
notify-send "💻 USB mounting" "$chosen mounted to $mp."
|
||||||
|
}
|
||||||
|
|
||||||
|
mountandroid() {
|
||||||
|
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||||
|
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
||||||
|
getmount "$HOME -maxdepth 3 -type d"
|
||||||
|
simple-mtpfs --device "$chosen" "$mp"
|
||||||
|
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
|
||||||
|
simple-mtpfs --device "$chosen" "$mp"
|
||||||
|
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
|
||||||
|
}
|
||||||
|
|
||||||
|
asktype() {
|
||||||
|
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||||
|
case $choice in
|
||||||
|
USB) mountusb ;;
|
||||||
|
Android) mountandroid ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
anddrives=$(simple-mtpfs -l 2>/dev/null)
|
||||||
|
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
|
||||||
|
|
||||||
|
if [ -z "$usbdrives" ]; then
|
||||||
|
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
|
||||||
|
echo "Android device(s) detected."
|
||||||
|
mountandroid
|
||||||
|
else
|
||||||
|
if [ -z "$anddrives" ]; then
|
||||||
|
echo "USB drive(s) detected."
|
||||||
|
mountusb
|
||||||
|
else
|
||||||
|
echo "Mountable USB drive(s) and Android device(s) detected."
|
||||||
|
asktype
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# A dmenu prompt to unmount drives.
|
||||||
|
# Provides you with mounted partitions, select one to unmount.
|
||||||
|
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||||
|
|
||||||
|
unmountusb() {
|
||||||
|
[ -z "$drives" ] && exit
|
||||||
|
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||||
|
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||||
|
[ -z "$chosen" ] && exit
|
||||||
|
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
|
||||||
|
}
|
||||||
|
|
||||||
|
unmountandroid() {
|
||||||
|
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
|
||||||
|
[ -z "$chosen" ] && exit
|
||||||
|
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
|
||||||
|
}
|
||||||
|
|
||||||
|
asktype() {
|
||||||
|
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1
|
||||||
|
case "$choice" in
|
||||||
|
USB) unmountusb ;;
|
||||||
|
Android) unmountandroid ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
|
||||||
|
|
||||||
|
if ! grep simple-mtpfs /etc/mtab; then
|
||||||
|
[ -z "$drives" ] && echo "No drives to unmount." && exit
|
||||||
|
echo "Unmountable USB drive detected."
|
||||||
|
unmountusb
|
||||||
|
else
|
||||||
|
if [ -z "$drives" ]; then
|
||||||
|
echo "Unmountable Android device detected."
|
||||||
|
unmountandroid
|
||||||
|
else<
|
||||||
|
echo "Unmountable USB drive(s) and Android device(s) detected."
|
||||||
|
asktype
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# The famous "get a menu of emojis to copy" script.
|
||||||
|
|
||||||
|
# Get user selection via dmenu from emoji file.
|
||||||
|
chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 30 | sed "s/ .*//")
|
||||||
|
|
||||||
|
# Exit if none chosen.
|
||||||
|
[ -z "$chosen" ] && exit
|
||||||
|
|
||||||
|
# If you run this command with an argument, it will automatically insert the
|
||||||
|
# character. Otherwise, show a message that the emoji has been copied.
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
xdotool type "$chosen"
|
||||||
|
else
|
||||||
|
printf "$chosen" | xclip -selection clipboard
|
||||||
|
notify-send "'$chosen' copied to clipboard." &
|
||||||
|
fi
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function i3setup() {
|
||||||
|
local file dir cfg path patterns=(
|
||||||
|
"config.vars"
|
||||||
|
"config.pre-main"
|
||||||
|
"config.main"
|
||||||
|
"config.post-main"
|
||||||
|
)
|
||||||
|
dir="$HOME/.config/i3"
|
||||||
|
cfg="$dir/config"
|
||||||
|
|
||||||
|
echo "Building i3 config... 🔨"
|
||||||
|
rm "$cfg" 2>/dev/null
|
||||||
|
|
||||||
|
for pattern in "${patterns[@]}"; do
|
||||||
|
while IFS= read -r path; do
|
||||||
|
[ -z "$path" ] && continue
|
||||||
|
file="${path##*/}"
|
||||||
|
|
||||||
|
echo "WRITE : '$file'."
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "# >>>$file"
|
||||||
|
cat "$path" >>"$cfg"
|
||||||
|
echo "# <<<$file"
|
||||||
|
echo
|
||||||
|
} >>"$cfg"
|
||||||
|
|
||||||
|
done <<<"$(find "$dir" -maxdepth 1 -type f -name "$pattern*" | sort -n)"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Restarting i3... 🔄"
|
||||||
|
i3 restart
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
i3setup
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# i3-get-window-criteria - Get criteria for use with i3 config commands
|
||||||
|
|
||||||
|
# To use, run this script, then click on a window.
|
||||||
|
# Output is in the format: [<name>=<value> <name>=<value> ...]
|
||||||
|
|
||||||
|
# Known problem: when WM_NAME is used as fallback for the 'title="<string>"' criterion,
|
||||||
|
# quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`,
|
||||||
|
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807
|
||||||
|
|
||||||
|
PROGNAME=$(basename "$0")
|
||||||
|
|
||||||
|
# Check for xwininfo and xprop
|
||||||
|
for cmd in xwininfo xprop; do
|
||||||
|
if ! which $cmd >/dev/null 2>&1; then
|
||||||
|
echo "$PROGNAME: $cmd: command not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
match_int='[0-9][0-9]*'
|
||||||
|
match_string='".*"'
|
||||||
|
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference
|
||||||
|
|
||||||
|
{
|
||||||
|
# Run xwininfo, get window id
|
||||||
|
window_id=$(xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p")
|
||||||
|
echo "id=$window_id"
|
||||||
|
|
||||||
|
# Run xprop, transform its output into i3 criteria. Handle fallback to
|
||||||
|
# WM_NAME when _NET_WM_NAME isn't set
|
||||||
|
xprop -id "$window_id" |
|
||||||
|
sed -nr \
|
||||||
|
-e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
|
||||||
|
-e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
|
||||||
|
-e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
|
||||||
|
-e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
|
||||||
|
-e '${g; p}'
|
||||||
|
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pactl set-card-profile alsa_card.usb-Focusrite_Scarlett_2i2_USB_Y8EZ0N3940A777-00 input:analog-stereo
|
||||||
|
pactl set-card-profile alsa_card.usb-Focusrite_Scarlett_2i2_USB_Y8EZ0N3940A777-00 output:analog-stereo+input:analog-stereo
|
||||||
|
|
||||||
|
pactl set-card-profile alsa_card.usb-MACROSILICON_USB3._0_capture-02 off
|
||||||
|
pactl set-card-profile alsa_card.pci-0000_09_00.1 off
|
||||||
|
pactl set-card-profile alsa_card.pci-0000_0b_00.4 off
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SINK="@DEFAULT_SINK@"
|
||||||
|
LIMIT=150
|
||||||
|
ADJUSTMENT=$1
|
||||||
|
|
||||||
|
function limit_level() {
|
||||||
|
level="$(pactl get-sink-volume "$SINK" | grep '^Volume' | cut -d' ' -f5 | grep -o "[[:digit:]]*")"
|
||||||
|
|
||||||
|
if [[ "$level" -gt "$LIMIT" ]]; then
|
||||||
|
echo "Limiting volume to: $1"
|
||||||
|
set_level $LIMIT%
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_level() {
|
||||||
|
echo "Desired volume adjustment: $1"
|
||||||
|
pactl set-sink-volume "$SINK" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$ADJUSTMENT" == set-*-mute ]]; then
|
||||||
|
echo "Desired volume adjustment: $1"
|
||||||
|
pactl "$ADJUSTMENT" "$SINK" toggle
|
||||||
|
else
|
||||||
|
set_level "$ADJUSTMENT"
|
||||||
|
limit_level $LIMIT
|
||||||
|
fi
|
||||||
|
|
||||||
|
killall -SIGUSR1 i3status
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Stabilizes a video
|
||||||
|
|
||||||
|
input=${1:?}
|
||||||
|
path="$(realpath "$input")"
|
||||||
|
file="$(basename "$path")"
|
||||||
|
dir="$(dirname "$path")"
|
||||||
|
ext="${file#*.}"
|
||||||
|
out="$dir/${file/.$ext/-stabilized.$ext}"
|
||||||
|
trf="$dir/$file.trf"
|
||||||
|
|
||||||
|
echo "path: $path"
|
||||||
|
echo "file: $file"
|
||||||
|
echo "dir : $dir"
|
||||||
|
echo "ext : $ext"
|
||||||
|
echo "out : $out"
|
||||||
|
echo "trf : $trf"
|
||||||
|
|
||||||
|
ffmpeg -i "$path" -vf vidstabdetect=result="$trf" -f null - || exit 1
|
||||||
|
ffmpeg -i "$path" -vf vidstabtransform=smoothing=5:input="$trf" "$out" || exit 2
|
||||||
|
echo "Finished processing '$file'."
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=File Manager
|
||||||
|
Exec=/usr/bin/alacritty -e ranger %u
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Image viewer
|
||||||
|
Exec=/usr/bin/feh --scale-down %f
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Mail
|
||||||
|
Exec=/usr/bin/alacritty -e neomutt %u
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=PDF reader
|
||||||
|
Exec=/usr/bin/zathura %u
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=RSS feed addition
|
||||||
|
Exec=/usr/bin/env rssadd %U
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Text editor
|
||||||
|
Exec=/usr/bin/alacritty -e vim %u
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Torrent
|
||||||
|
Exec=/usr/bin/deluge %U
|
|
@ -0,0 +1 @@
|
||||||
|
wallpapersden.com_clean-night-sky-and-mountains-peak_3840x2160.jpg
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 4.7 MiB |
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
xrandr --auto
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
xrandr --output DVI-D-0 --off --output HDMI-0 --mode 1920x1200 --pos 0x0 --rotate left --output HDMI-1 --mode 1920x1080 --pos 1520x1565 --rotate normal --output DP-0 --off --output DP-1 --mode 1920x1200 --pos 3760x0 --rotate right --output DP-2 --mode 2560x1440 --pos 1200x125 --rotate normal --output DP-3 --off
|
|
@ -0,0 +1,20 @@
|
||||||
|
# dabruh's dotfiles
|
||||||
|
|
||||||
|
|
||||||
|
## Giving credit where credit is due
|
||||||
|
|
||||||
|
The following list of scripts are either full copies, or modifications of the below sources. You may find a few scripts in this repo that are not mentioned below. They are not mentioned for one of the following 3 reasons:
|
||||||
|
|
||||||
|
- They're developed by me.
|
||||||
|
- They're too small/generic.
|
||||||
|
- They've been too heavily modified to resemble to original.
|
||||||
|
|
||||||
|
| path | source |
|
||||||
|
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `.config/fontconfig/fonts.conf` | [LukeSmithxyz/voidrice](https://github.com/LukeSmithxyz/voidrice/blob/d283f12ef9c524a88550097bceda029b3eb9a71c/.config/fontconfig/fonts.conf) |
|
||||||
|
| `.config/picom/picom.conf` | [gaurav712/picom.conf](https://gist.github.com/gaurav712/42549678b778db12fda5764f7c0757ad) |
|
||||||
|
| `.local/bin/dmenumount` | [LukeSmithxyz/voidrice](https://github.com/LukeSmithxyz/voidrice/blob/d283f12ef9c524a88550097bceda029b3eb9a71c/.local/bin/dmenumount) |
|
||||||
|
| `.local/bin/dmenuumount` | [LukeSmithxyz/voidrice](https://github.com/LukeSmithxyz/voidrice/blob/d283f12ef9c524a88550097bceda029b3eb9a71c/.local/bin/dmenuumount) |
|
||||||
|
| `.local/bin/dmenuunicode` | [LukeSmithxyz/voidrice](https://github.com/LukeSmithxyz/voidrice/blob/d283f12ef9c524a88550097bceda029b3eb9a71c/.local/bin/dmenuunicode) |
|
||||||
|
| `.local/bin/i3-get-window-criteria` | [faq.i3wm.org/question/2172](https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode.1.html) |
|
||||||
|
| `.local/share/larbs/emoji` | [LukeSmithxyz/voidrice](https://github.com/LukeSmithxyz/voidrice/blob/d283f12ef9c524a88550097bceda029b3eb9a71c/.local/share/larbs/emoji) |
|
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(
|
||||||
|
cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1
|
||||||
|
pwd -P
|
||||||
|
)"
|
||||||
|
IGNORED_FILES="$(cat "$SCRIPT_DIR/.installer/ignored")"
|
||||||
|
EXECUTABLE_FILES="$(cat "$SCRIPT_DIR/.installer/executables")"
|
||||||
|
|
||||||
|
function is_ignored() {
|
||||||
|
while IFS= read -r line; do
|
||||||
|
grep -Eq "$line" <<<"${1:?}" && return 0
|
||||||
|
done <<<"$IGNORED_FILES"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_executable() {
|
||||||
|
while IFS= read -r line; do
|
||||||
|
grep -Eq "$line" <<<"${1:?}" && return 0
|
||||||
|
done <<<"$EXECUTABLE_FILES"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_identical() {
|
||||||
|
local src dst src_sum dst_sum
|
||||||
|
src="$SCRIPT_DIR/$1"
|
||||||
|
dst="$HOME/$1"
|
||||||
|
|
||||||
|
! [ -e "$dst" ] && return 1
|
||||||
|
|
||||||
|
src_sum="$(sha256sum "$src" | cut -d' ' -f1)"
|
||||||
|
dst_sum="$(sha256sum "$dst" | cut -d' ' -f1)"
|
||||||
|
|
||||||
|
[[ "$src_sum" == "$dst_sum" ]] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function install() {
|
||||||
|
local file dir src dst perform_copy
|
||||||
|
|
||||||
|
echo "Copying files... 💾"
|
||||||
|
|
||||||
|
while IFS= read -r file; do
|
||||||
|
perform_copy=true
|
||||||
|
file="${file#"$SCRIPT_DIR/"}"
|
||||||
|
dir="$(dirname "$HOME/$file")"
|
||||||
|
src="$SCRIPT_DIR/$file"
|
||||||
|
dst="$HOME/$file"
|
||||||
|
|
||||||
|
grep -Eq "^\.git(ignore|/)" <<<"$file" && continue
|
||||||
|
|
||||||
|
if is_ignored "$file"; then
|
||||||
|
echo "IGNORE: '$file'"
|
||||||
|
continue
|
||||||
|
elif ! [ -d "$dir" ]; then
|
||||||
|
echo "MKDIR : '$dir'"
|
||||||
|
mkdir -p "$dir" || exit 10
|
||||||
|
elif is_identical "$file"; then
|
||||||
|
echo "NODIFF: '$file'"
|
||||||
|
perform_copy=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $perform_copy; then
|
||||||
|
if [ -e "$dst" ]; then
|
||||||
|
echo "DIFF : '$file'"
|
||||||
|
else
|
||||||
|
echo "NEW : '$file'"
|
||||||
|
fi
|
||||||
|
cp --no-dereference "$src" "$dst" || exit 20
|
||||||
|
fi
|
||||||
|
|
||||||
|
if is_executable "$file" && ! [ -x "$dst" ]; then
|
||||||
|
echo "+EXEC : '$file'"
|
||||||
|
chmod +x "$dst"
|
||||||
|
fi
|
||||||
|
done <<<"$(find "$SCRIPT_DIR" -type f && find "$SCRIPT_DIR" -type l)"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
install
|
||||||
|
i3-config-builder
|
||||||
|
echo "Done! 👌"
|
|
@ -0,0 +1,130 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Default variables
|
||||||
|
#
|
||||||
|
UPGRADE_PACKAGES=false
|
||||||
|
SCRIPT_NAME="$(basename -- "$0")"
|
||||||
|
SCRIPT_DIR="$(
|
||||||
|
cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1
|
||||||
|
pwd -P
|
||||||
|
)"
|
||||||
|
|
||||||
|
function _acpib() {
|
||||||
|
acpi -b | grep -Fv ' 0%'
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_laptop() {
|
||||||
|
[[ $(_acpib | wc -l) -gt 0 ]] && return 0 || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
echo "Usage: $SCRIPT_NAME [OPTIONS]"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h Display help."
|
||||||
|
echo " -u Upgrade existing packages."
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts ":uh" arg; do
|
||||||
|
case $arg in
|
||||||
|
h) usage ;;
|
||||||
|
u) UPGRADE_PACKAGES=true ;;
|
||||||
|
:)
|
||||||
|
echo "$0: Must supply an argument to -$OPTARG." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "Invalid option: -${OPTARG}."
|
||||||
|
echo
|
||||||
|
usage
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
YAY_ARGS="--aur --answerdiff NotInstalled --answeredit None --answerclean All --answerupgrade None"
|
||||||
|
ID_LIKE="$(grep ID_LIKE= </etc/os-release | cut -d= -f2)"
|
||||||
|
|
||||||
|
# Returns a comma-separated list of packages for one or more targets.
|
||||||
|
# The packages file may contain multiple rows with the same target name.
|
||||||
|
function get_packages() {
|
||||||
|
local packages pkg_file="$SCRIPT_DIR/.installer/packages"
|
||||||
|
|
||||||
|
for target in "$@"; do
|
||||||
|
while read -r row; do
|
||||||
|
for package in ${row//,/ }; do
|
||||||
|
echo "$package"
|
||||||
|
done
|
||||||
|
done <<<"$(grep "^${target:?}:" "$pkg_file" | cut -d':' -f2)"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function configure_sddm() {
|
||||||
|
local sddm_config_dir="/etc/sddm.conf.d"
|
||||||
|
|
||||||
|
echo "Setting up '$sddm_config_dir'."
|
||||||
|
|
||||||
|
if ! [ -d "$sddm_config_dir" ]; then
|
||||||
|
sudo mkdir "$sddm_config_dir"
|
||||||
|
sudo chown root:root -R "$sddm_config_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "[Theme]"
|
||||||
|
echo "Current=aerial"
|
||||||
|
} | sudo tee "$sddm_config_dir/theme" >/dev/null
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "[X11]"
|
||||||
|
echo "DisplayCommand=/usr/share/sddm/scripts/Xsetup"
|
||||||
|
} | sudo tee "$sddm_config_dir/xsetup" >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_arch_with_pamac() {
|
||||||
|
local targets=("pacman-any") packages
|
||||||
|
is_laptop && targets+=("pacman-laptop")
|
||||||
|
|
||||||
|
packages="$(get_packages "${targets[@]}")"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
sudo pamac install --no-confirm $packages || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_arch_with_yay() {
|
||||||
|
local targets=("aur-any") packages
|
||||||
|
is_laptop && targets+=("aur-laptop")
|
||||||
|
|
||||||
|
while read -r package; do
|
||||||
|
if pacman -Qs "^$package$" >/dev/null; then
|
||||||
|
if $UPGRADE_PACKAGES; then
|
||||||
|
echo "Package '$package' will be upgraded."
|
||||||
|
else
|
||||||
|
echo "Package '$package' already exists."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Package '$package' will be installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
yay -S "$package" $YAY_ARGS || return 1
|
||||||
|
done <<<"$(get_packages "${targets[@]}")"
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_arch() {
|
||||||
|
setup_arch_with_pamac || return 1
|
||||||
|
setup_arch_with_yay || return 2
|
||||||
|
configure_sddm || return 3
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Setting up ${ID_LIKE^}-like OS."
|
||||||
|
|
||||||
|
if [[ "$ID_LIKE" == "arch" ]]; then
|
||||||
|
setup_arch
|
||||||
|
else
|
||||||
|
echo "ERROR: Unsupported system: ID_LIKE=$ID_LIKE"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Setup finished."
|
Loading…
Reference in New Issue