i3 init
This commit is contained in:
8
.config/greenclip.cfg
Normal file
8
.config/greenclip.cfg
Normal file
@@ -0,0 +1,8 @@
|
||||
Config {
|
||||
maxHistoryLength = 10000,
|
||||
historyPath = "~/.cache/greenclip.history",
|
||||
staticHistoryPath = "~/.cache/greenclip.staticHistory",
|
||||
imageCachePath = "/tmp/",
|
||||
usePrimarySelectionAsInput = False,
|
||||
blacklistedApps = []
|
||||
}
|
||||
5
.config/gtk-3.0/bookmarks
Normal file
5
.config/gtk-3.0/bookmarks
Normal file
@@ -0,0 +1,5 @@
|
||||
file:///home/felix/Documents
|
||||
file:///home/felix/Music
|
||||
file:///home/felix/Pictures
|
||||
file:///home/felix/Videos
|
||||
file:///home/felix/Downloads
|
||||
15
.config/gtk-3.0/settings.ini
Normal file
15
.config/gtk-3.0/settings.ini
Normal file
@@ -0,0 +1,15 @@
|
||||
[Settings]
|
||||
gtk-theme-name=Arc
|
||||
gtk-font-name=Liberation Sans 11
|
||||
gtk-icon-theme-name=Arc
|
||||
gtk-cursor-theme-name=Adwaita
|
||||
gtk-cursor-theme-size=0
|
||||
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
||||
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
|
||||
275
.config/i3/config
Normal file
275
.config/i3/config
Normal file
@@ -0,0 +1,275 @@
|
||||
# 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
|
||||
|
||||
# colors
|
||||
set $bg-color #2f343f
|
||||
set $inactive-bg-color #3d4351
|
||||
set $text-color #f3f4f5
|
||||
set $inactive-text-color #676E7D
|
||||
set $urgent-bg-color #E53935
|
||||
|
||||
# window colors
|
||||
# border background text indicator
|
||||
client.focused $bg-color $bg-color $text-color #00ff00
|
||||
client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00
|
||||
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00
|
||||
client.urgent $urgent-bg-color $urgent-bg-color $text-color #00ff00
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
#font pango:monospace 8
|
||||
#font pango:Liberation Sans 10
|
||||
font pango:System San Francisco Display 8
|
||||
|
||||
# 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 8
|
||||
|
||||
# Before i3 v4.8, we used to recommend this one as the default:
|
||||
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||
# The font above is very space-efficient, that is, it looks good, sharp and
|
||||
# clear in small sizes. However, its unicode glyph coverage is limited, the old
|
||||
# X core fonts rendering does not support right-to-left and this being a bitmap
|
||||
# font, it doesn’t scale on retina/hidpi displays.
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec i3-sensible-terminal
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# start dmenu (a program launcher)
|
||||
bindsym $mod+d exec rofi -show run
|
||||
|
||||
# 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+d exec --no-startup-id i3-dmenu-desktop
|
||||
|
||||
# change focus
|
||||
#bindsym $mod+j focus left
|
||||
#bindsym $mod+k focus down
|
||||
#bindsym $mod+l focus up
|
||||
#bindsym $mod+odiaeresis 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+j move left
|
||||
#bindsym $mod+Shift+k move down
|
||||
#bindsym $mod+Shift+l move up
|
||||
#bindsym $mod+Shift+odiaeresis 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+h split h
|
||||
|
||||
# split in vertical orientation
|
||||
bindsym $mod+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"
|
||||
set $ws6 "6"
|
||||
set $ws7 "7"
|
||||
set $ws8 "8"
|
||||
set $ws9 "9"
|
||||
set $ws10 "10"
|
||||
|
||||
# Define monitor outputs
|
||||
set $internal eDP1
|
||||
set $external_1 DP2-1
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace $ws1
|
||||
bindsym $mod+2 workspace $ws2
|
||||
bindsym $mod+3 workspace $ws3
|
||||
bindsym $mod+4 workspace $ws4
|
||||
bindsym $mod+5 workspace $ws5
|
||||
bindsym $mod+6 workspace $ws6
|
||||
bindsym $mod+7 workspace $ws7
|
||||
bindsym $mod+8 workspace $ws8
|
||||
bindsym $mod+9 workspace $ws9
|
||||
bindsym $mod+0 workspace $ws10
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace $ws10
|
||||
|
||||
# asssign workspace to apps
|
||||
assign [class="Google-chrome-unstable"] $ws1
|
||||
assign [class="Rambox"] $ws2
|
||||
|
||||
workspace $ws1 output $external_1
|
||||
workspace $ws2 output $internal
|
||||
|
||||
# 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'"
|
||||
|
||||
# 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 j resize shrink width 10 px or 10 ppt
|
||||
bindsym k resize grow height 10 px or 10 ppt
|
||||
bindsym l resize shrink height 10 px or 10 ppt
|
||||
bindsym odiaeresis 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 i3status
|
||||
#}
|
||||
|
||||
## Felix custom
|
||||
|
||||
## Manual management of external displays
|
||||
# Set the shortcuts and what they do
|
||||
|
||||
|
||||
set $mode_display ext1->int (2), External (x), Internal (i)
|
||||
mode "$mode_display" {
|
||||
bindsym 2 exec --no-startup-id xrandr --output $external_1 --primary --auto --left-of $internal, mode "default"
|
||||
bindsym x exec --no-startup-id xrandr --output $external_1 --primary --auto, mode "default"
|
||||
bindsym i exec --no-startup-id xrandr --output $internal --primary --auto, mode "default"
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
# Declare here the shortcut to bring the display selection menu
|
||||
bindsym $mod+x mode "$mode_display"
|
||||
|
||||
# Move windows to different monitor
|
||||
bindsym $mod+Control+Left move window to output left
|
||||
bindsym $mod+Control+Down move window to output down
|
||||
bindsym $mod+Control+Up move window to output up
|
||||
bindsym $mod+Control+Right move window to output right
|
||||
|
||||
# Move workspace to different monitor
|
||||
bindsym $mod+Control+Shift+Left move workspace to output left
|
||||
bindsym $mod+Control+Shift+Down move workspace to output down
|
||||
bindsym $mod+Control+Shift+Up move workspace to output up
|
||||
bindsym $mod+Control+Shift+Right move workspace to output right
|
||||
|
||||
# Pulse Audio controls
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) +5%
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) -5%
|
||||
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute $(pactl list short sinks | grep RUNNING | cut -f1) toggle # mute sound
|
||||
|
||||
# Screen brightness controls
|
||||
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
|
||||
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness
|
||||
|
||||
# Touchpad controls
|
||||
bindsym XF86Tools exec /home/felix/scripts/toggleTouchpad.sh # toggle touchpad
|
||||
|
||||
# Media player controls
|
||||
bindsym XF86AudioPlay exec playerctl play
|
||||
bindsym XF86AudioPause exec playerctl pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
bindsym XF86AudioStop exec playerctl stop
|
||||
|
||||
# Lock screen
|
||||
bindsym $mod+l exec i3lock-fancy --blur=5x4
|
||||
|
||||
# Screenshots
|
||||
bindsym --release Print exec "scrot -m -z '%Y.%m.%d-%H:%S.png' -e 'mv $f ~/Pictures/Screenshots'"
|
||||
bindsym --release Shift+Print exec "scrot -s -z '%Y.%m.%d-%H:%S.png' -e 'mv $f ~/Pictures/Screenshots'"
|
||||
bindsym --release Control+Shift+Print exec "scrot -u -z '%Y.%m.%d-%H:%S.png' -e 'mv $f ~/Pictures/Screenshots'"
|
||||
|
||||
# clipboard manager
|
||||
bindsym Control+Mod1+h exec rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
|
||||
|
||||
workspace_layout tabbed
|
||||
exec i3-msg workspace $ws1
|
||||
|
||||
# Start default applications
|
||||
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
|
||||
exec greenclip daemon
|
||||
exec blueman-applet
|
||||
exec libinput-gestures-setup start
|
||||
exec clipit
|
||||
exec insync start
|
||||
# auto started by browser
|
||||
#exec keepassxc
|
||||
exec rambox
|
||||
exec google-chrome-unstable
|
||||
exec synclient TouchpadOff=1
|
||||
84
.config/polybar/battery-combined-udev.sh
Executable file
84
.config/polybar/battery-combined-udev.sh
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
|
||||
battery_print() {
|
||||
path_ac="/sys/class/power_supply/AC"
|
||||
path_battery_0="/sys/class/power_supply/BAT0"
|
||||
path_battery_1="/sys/class/power_supply/BAT1"
|
||||
|
||||
ac=0
|
||||
battery_level_0=0
|
||||
battery_level_1=0
|
||||
battery_max_0=0
|
||||
battery_max_1=0
|
||||
|
||||
if [ -f "$path_ac/online" ]; then
|
||||
ac=$(cat "$path_ac/online")
|
||||
fi
|
||||
|
||||
if [ -f "$path_battery_0/energy_now" ]; then
|
||||
battery_level_0=$(cat "$path_battery_0/energy_now")
|
||||
fi
|
||||
|
||||
if [ -f "$path_battery_0/energy_full" ]; then
|
||||
battery_max_0=$(cat "$path_battery_0/energy_full")
|
||||
fi
|
||||
|
||||
if [ -f "$path_battery_1/energy_now" ]; then
|
||||
battery_level_1=$(cat "$path_battery_1/energy_now")
|
||||
fi
|
||||
|
||||
if [ -f "$path_battery_1/energy_full" ]; then
|
||||
battery_max_1=$(cat "$path_battery_1/energy_full")
|
||||
fi
|
||||
|
||||
battery_level=$(("$battery_level_0 + $battery_level_1"))
|
||||
battery_max=$(("$battery_max_0 + $battery_max_1"))
|
||||
|
||||
battery_percent=$(("$battery_level * 100"))
|
||||
battery_percent=$(("$battery_percent / $battery_max"))
|
||||
|
||||
if [ "$ac" -eq 1 ]; then
|
||||
icon="#1"
|
||||
|
||||
if [ "$battery_percent" -gt 97 ]; then
|
||||
echo "$icon"
|
||||
else
|
||||
echo "$icon $battery_percent %"
|
||||
fi
|
||||
else
|
||||
if [ "$battery_percent" -gt 85 ]; then
|
||||
icon="#21"
|
||||
elif [ "$battery_percent" -gt 60 ]; then
|
||||
icon="#22"
|
||||
elif [ "$battery_percent" -gt 35 ]; then
|
||||
icon="#23"
|
||||
elif [ "$battery_percent" -gt 10 ]; then
|
||||
icon="#24"
|
||||
else
|
||||
icon="#25"
|
||||
fi
|
||||
|
||||
echo "$icon $battery_percent %"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--update)
|
||||
pid=$(pgrep -xf "/bin/sh /home/felix/.config/polybar/battery-combined-udev.sh")
|
||||
|
||||
if [ "$pid" != "" ]; then
|
||||
kill -10 "$pid"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
trap exit INT
|
||||
trap "echo" USR1
|
||||
|
||||
while true; do
|
||||
battery_print
|
||||
|
||||
sleep 30 &
|
||||
wait
|
||||
done
|
||||
;;
|
||||
esac
|
||||
329
.config/polybar/config
Normal file
329
.config/polybar/config
Normal file
@@ -0,0 +1,329 @@
|
||||
[bar/top]
|
||||
monitor = DP2-1
|
||||
width = 100%
|
||||
height = 27
|
||||
|
||||
background = #00000000
|
||||
foreground = #ccffffff
|
||||
|
||||
line-color = ${bar/bottom.background}
|
||||
line-size = 16
|
||||
|
||||
spacing = 2
|
||||
padding-right = 5
|
||||
module-margin = 4
|
||||
|
||||
font-0 = "Noto Sans:size=8"
|
||||
font-1 = "RobotoMono Nerd Font:pixelsize=10;1"
|
||||
font-2 = "Symbola:style=Regular"
|
||||
|
||||
# todo mpd? or spotify?
|
||||
modules-left = powermenu player-mpris
|
||||
modules-center = date
|
||||
modules-right = pulseaudio backlight touchpad-indicator openvpn-indicator wireless-network wired-network battery
|
||||
|
||||
[bar/bottom]
|
||||
monitor = DP2-1
|
||||
bottom = true
|
||||
width = 100%
|
||||
height = 27
|
||||
|
||||
background = ${bar/top.background}
|
||||
foreground = ${bar/top.foreground}
|
||||
|
||||
line-color = ${bar/top.background}
|
||||
line-size = 2
|
||||
|
||||
spacing = 3
|
||||
padding-right = 4
|
||||
module-margin-left = 0
|
||||
module-margin-right = 6
|
||||
|
||||
font-0 = "Noto Sans:size=8"
|
||||
font-1 = "RobotoMono Nerd Font:pixelsize=10;1"
|
||||
font-2 = "Symbola:style=Regular"
|
||||
|
||||
modules-left =
|
||||
modules-center = i3
|
||||
modules-right = cpu memory
|
||||
|
||||
tray-position = left
|
||||
tray-padding = 2
|
||||
tray-transparent = true
|
||||
tray-background = #0063ff
|
||||
;tray-detached = false
|
||||
|
||||
|
||||
[module/pulseaudio]
|
||||
type = internal/pulseaudio
|
||||
|
||||
; Sink to be used, if it exists (find using `pacmd list-sinks`, name field)
|
||||
; If not, uses default sink
|
||||
sink = alsa_output.pci-0000_00_1f.3.analog-stereo
|
||||
|
||||
; Use PA_VOLUME_UI_MAX (~153%) if true, or PA_VOLUME_NORM (100%) if false
|
||||
; Default: true
|
||||
use-ui-max = true
|
||||
|
||||
format-volume = %{A3:pavucontrol:}<ramp-volume> <label-volume> %{A}
|
||||
|
||||
; Available tokens:
|
||||
; %percentage% (default)
|
||||
label-muted = 婢 muted
|
||||
label-muted-foreground = #666
|
||||
|
||||
; Only applies if <ramp-volume> is used
|
||||
ramp-volume-0 = 奄
|
||||
ramp-volume-1 = 奔
|
||||
ramp-volume-2 = 墳
|
||||
|
||||
[module/backlight]
|
||||
type = internal/xbacklight
|
||||
format = <ramp> <bar>
|
||||
|
||||
output = eDP1
|
||||
|
||||
ramp-0 =
|
||||
ramp-1 =
|
||||
ramp-2 =
|
||||
|
||||
bar-width = 5
|
||||
bar-indicator = |
|
||||
#bar-indicator-font = 3
|
||||
bar-indicator-foreground = #ff
|
||||
bar-fill = ─
|
||||
#bar-fill-font = 3
|
||||
bar-fill-foreground = #c9665e
|
||||
bar-empty = ─
|
||||
#bar-empty-font = 3
|
||||
bar-empty-foreground = #44
|
||||
|
||||
[module/openvpn-indicator]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/openvpn-indicator.sh
|
||||
interval = 5
|
||||
|
||||
[module/battery-combined-udev]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/battery-combined-udev.sh
|
||||
tail = true
|
||||
|
||||
[module/player-mpris]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/player-mpris-simple.sh
|
||||
interval = 3
|
||||
label = "%output%"
|
||||
|
||||
[module/touchpad-indicator]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/touchpad-indicator.sh
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
full-at = 96
|
||||
|
||||
format-charging = <animation-charging> <label-charging>
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
format-full = <ramp-capacity> <label-full>
|
||||
|
||||
ramp-capacity-0 =
|
||||
ramp-capacity-0-foreground = #f53c3c
|
||||
ramp-capacity-1 =
|
||||
ramp-capacity-1-foreground = #ffa900
|
||||
ramp-capacity-2 =
|
||||
ramp-capacity-3 =
|
||||
ramp-capacity-4 =
|
||||
|
||||
bar-capacity-width = 10
|
||||
bar-capacity-format = %{+u}%{+o}%fill%%empty%%{-u}%{-o}
|
||||
bar-capacity-fill = █
|
||||
bar-capacity-fill-foreground = #ddffffff
|
||||
#bar-capacity-fill-font = 3
|
||||
bar-capacity-empty = █
|
||||
#bar-capacity-empty-font = 3
|
||||
bar-capacity-empty-foreground = #44ffffff
|
||||
|
||||
animation-charging-0 =
|
||||
animation-charging-1 =
|
||||
animation-charging-2 =
|
||||
animation-charging-3 =
|
||||
animation-charging-4 =
|
||||
animation-charging-framerate = 750
|
||||
|
||||
[module/i3]
|
||||
type = internal/i3
|
||||
|
||||
; Only show workspaces defined on the same output as the bar
|
||||
;
|
||||
; Useful if you want to show monitor specific workspaces
|
||||
; on different bars
|
||||
;
|
||||
; Default: false
|
||||
pin-workspaces = false
|
||||
|
||||
; This will split the workspace name on ':'
|
||||
; Default: false
|
||||
strip-wsnumbers = true
|
||||
|
||||
; Sort the workspaces by index instead of the default
|
||||
; sorting that groups the workspaces by output
|
||||
; Default: false
|
||||
index-sort = false
|
||||
|
||||
; Create click handler used to focus workspace
|
||||
; Default: true
|
||||
enable-click = true
|
||||
|
||||
; Create scroll handlers used to cycle workspaces
|
||||
; Default: true
|
||||
enable-scroll = false
|
||||
|
||||
; Wrap around when reaching the first/last workspace
|
||||
; Default: true
|
||||
wrapping-scroll = false
|
||||
|
||||
; Set the scroll cycle direction
|
||||
; Default: true
|
||||
reverse-scroll = false
|
||||
|
||||
; Use fuzzy (partial) matching on labels when assigning
|
||||
; icons to workspaces
|
||||
; Example: code;♚ will apply the icon to all workspaces
|
||||
; containing 'code' in the label
|
||||
; Default: false
|
||||
fuzzy-match = true
|
||||
|
||||
[module/wireless-network]
|
||||
type = internal/network
|
||||
interface = wlp3s0
|
||||
interval = 3.0
|
||||
ping-interval = 10
|
||||
|
||||
format-connected = <label-connected> <ramp-signal>
|
||||
label-connected = 直 %essid%
|
||||
label-disconnected = 睊 not connected
|
||||
label-disconnected-foreground = #66
|
||||
format-packetloss = <animation-packetloss> <label-connected>
|
||||
|
||||
ramp-signal-0 = 😱
|
||||
ramp-signal-1 = 😠
|
||||
ramp-signal-2 = 😒
|
||||
ramp-signal-3 = 😊
|
||||
ramp-signal-4 = 😃
|
||||
ramp-signal-5 = 😈
|
||||
|
||||
animation-packetloss-0 =
|
||||
animation-packetloss-0-foreground = #ffa64c
|
||||
animation-packetloss-1 =
|
||||
animation-packetloss-1-foreground = ${bar/top.foreground}
|
||||
animation-packetloss-framerate = 500
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 0.5
|
||||
format = <label> <ramp-coreload>
|
||||
label = CPU
|
||||
|
||||
ramp-coreload-0 = ▁
|
||||
#ramp-coreload-0-font = 2
|
||||
ramp-coreload-0-foreground = #aaff77
|
||||
ramp-coreload-1 = ▂
|
||||
#ramp-coreload-1-font = 2
|
||||
ramp-coreload-1-foreground = #aaff77
|
||||
ramp-coreload-2 = ▃
|
||||
#ramp-coreload-2-font = 2
|
||||
ramp-coreload-2-foreground = #aaff77
|
||||
ramp-coreload-3 = ▄
|
||||
#ramp-coreload-3-font = 2
|
||||
ramp-coreload-3-foreground = #aaff77
|
||||
ramp-coreload-4 = ▅
|
||||
#ramp-coreload-4-font = 2
|
||||
ramp-coreload-4-foreground = #fba922
|
||||
ramp-coreload-5 = ▆
|
||||
#ramp-coreload-5-font = 2
|
||||
ramp-coreload-5-foreground = #fba922
|
||||
ramp-coreload-6 = ▇
|
||||
#ramp-coreload-6-font = 2
|
||||
ramp-coreload-6-foreground = #ff5555
|
||||
ramp-coreload-7 = █
|
||||
#ramp-coreload-7-font = 2
|
||||
ramp-coreload-7-foreground = #ff5555
|
||||
|
||||
[module/wired-network]
|
||||
type = internal/network
|
||||
interface = enp0s31f6
|
||||
interval = 3.0
|
||||
|
||||
label-connected = %{T3}%local_ip%%{T-}
|
||||
label-disconnected-foreground = #66
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
date = %%{F#99}%d.%m.%Y%%{F-} %%{F#fff}%H:%M%%{F-}
|
||||
date-alt = %%{F#fff}%A, %d %B %Y %%{F#fff}%H:%M%%{F#666}:%%{F#fba922}%S%%{F-}
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
format = <label> <bar-used>
|
||||
label = RAM
|
||||
|
||||
bar-used-width = 30
|
||||
bar-used-foreground-0 = #aaff77
|
||||
bar-used-foreground-1 = #aaff77
|
||||
bar-used-foreground-2 = #fba922
|
||||
bar-used-foreground-3 = #ff5555
|
||||
bar-used-indicator = |
|
||||
#bar-used-indicator-font = 6
|
||||
bar-used-indicator-foreground = #ff
|
||||
bar-used-fill = ─
|
||||
#bar-used-fill-font = 6
|
||||
bar-used-empty = ─
|
||||
#bar-used-empty-font = 6
|
||||
bar-used-empty-foreground = #444444
|
||||
|
||||
[module/mpd]
|
||||
type = internal/mpd
|
||||
format-online = <icon-prev> <icon-stop> <toggle> <icon-next> <icon-repeat> <icon-random> <bar-progress> <label-time> <label-song>
|
||||
|
||||
icon-play =
|
||||
icon-pause =
|
||||
icon-stop =
|
||||
icon-prev =
|
||||
icon-next =
|
||||
icon-random =
|
||||
icon-repeat =
|
||||
|
||||
toggle-on-foreground =
|
||||
toggle-off-foreground = #55
|
||||
|
||||
bar-progress-width = 45
|
||||
bar-progress-format = %{A4:mpdseek+2: A5:mpdseek-2:}%fill%%indicator%%empty%%{A A}
|
||||
bar-progress-indicator = |
|
||||
bar-progress-indicator-foreground = #ff
|
||||
#bar-progress-indicator-font = 3
|
||||
bar-progress-fill = ─
|
||||
bar-progress-fill-foreground = #bb
|
||||
#bar-progress-fill-font = 3
|
||||
bar-progress-empty = ─
|
||||
#bar-progress-empty-font = 3
|
||||
bar-progress-empty-foreground = #44
|
||||
|
||||
[module/powermenu]
|
||||
type = custom/menu
|
||||
|
||||
format-padding = 5
|
||||
|
||||
label-open =
|
||||
#label-close = x
|
||||
label-separator = " | "
|
||||
|
||||
menu-0-0 = Terminate i3
|
||||
menu-0-0-foreground = #fba922
|
||||
menu-0-0-exec = i3-msg exit
|
||||
menu-0-1 = Reboot
|
||||
menu-0-1-foreground = #fba922
|
||||
menu-0-1-exec = reboot
|
||||
menu-0-2 = Power off
|
||||
menu-0-2-foreground = #fba922
|
||||
menu-0-2-exec = poweroff
|
||||
; vim:ft=dosini
|
||||
374
.config/polybar/config.example
Normal file
374
.config/polybar/config.example
Normal file
@@ -0,0 +1,374 @@
|
||||
;=====================================================
|
||||
;
|
||||
; To learn more about how to configure Polybar
|
||||
; go to https://github.com/jaagr/polybar
|
||||
;
|
||||
; The README contains alot of information
|
||||
;
|
||||
;=====================================================
|
||||
|
||||
[colors]
|
||||
;background = ${xrdb:color0:#222}
|
||||
background = #222
|
||||
background-alt = #444
|
||||
;foreground = ${xrdb:color7:#222}
|
||||
foreground = #dfdfdf
|
||||
foreground-alt = #555
|
||||
primary = #ffb52a
|
||||
secondary = #e60053
|
||||
alert = #bd2c40
|
||||
|
||||
[bar/example]
|
||||
;monitor = ${env:MONITOR:HDMI-1}
|
||||
width = 100%
|
||||
height = 27
|
||||
;offset-x = 1%
|
||||
;offset-y = 1%
|
||||
radius = 6.0
|
||||
fixed-center = false
|
||||
|
||||
background = ${colors.background}
|
||||
foreground = ${colors.foreground}
|
||||
|
||||
line-size = 3
|
||||
line-color = #f00
|
||||
|
||||
border-size = 4
|
||||
border-color = #00000000
|
||||
|
||||
padding-left = 0
|
||||
padding-right = 2
|
||||
|
||||
module-margin-left = 1
|
||||
module-margin-right = 2
|
||||
|
||||
font-0 = fixed:pixelsize=10;1
|
||||
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
|
||||
font-2 = siji:pixelsize=10;1
|
||||
|
||||
modules-left = bspwm i3
|
||||
modules-center =
|
||||
modules-right = filesystem xbacklight volume xkeyboard memory cpu wlan eth battery temperature date powermenu
|
||||
|
||||
tray-position = right
|
||||
tray-padding = 2
|
||||
;tray-transparent = true
|
||||
;tray-background = #0063ff
|
||||
|
||||
;wm-restack = bspwm
|
||||
;wm-restack = i3
|
||||
|
||||
;override-redirect = true
|
||||
|
||||
;scroll-up = bspwm-desknext
|
||||
;scroll-down = bspwm-deskprev
|
||||
|
||||
;scroll-up = i3wm-wsnext
|
||||
;scroll-down = i3wm-wsprev
|
||||
|
||||
cursor-click = pointer
|
||||
cursor-scroll = ns-resize
|
||||
|
||||
[module/xwindow]
|
||||
type = internal/xwindow
|
||||
label = %title:0:30:...%
|
||||
|
||||
[module/xkeyboard]
|
||||
type = internal/xkeyboard
|
||||
blacklist-0 = num lock
|
||||
|
||||
format-prefix = " "
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-prefix-underline = ${colors.secondary}
|
||||
|
||||
label-layout = %layout%
|
||||
label-layout-underline = ${colors.secondary}
|
||||
|
||||
label-indicator-padding = 2
|
||||
label-indicator-margin = 1
|
||||
label-indicator-background = ${colors.secondary}
|
||||
label-indicator-underline = ${colors.secondary}
|
||||
|
||||
[module/filesystem]
|
||||
type = internal/fs
|
||||
interval = 25
|
||||
|
||||
mount-0 = /
|
||||
|
||||
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
|
||||
label-unmounted = %mountpoint% not mounted
|
||||
label-unmounted-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/bspwm]
|
||||
type = internal/bspwm
|
||||
|
||||
label-focused = %index%
|
||||
label-focused-background = ${colors.background-alt}
|
||||
label-focused-underline= ${colors.primary}
|
||||
label-focused-padding = 2
|
||||
|
||||
label-occupied = %index%
|
||||
label-occupied-padding = 2
|
||||
|
||||
label-urgent = %index%!
|
||||
label-urgent-background = ${colors.alert}
|
||||
label-urgent-padding = 2
|
||||
|
||||
label-empty = %index%
|
||||
label-empty-foreground = ${colors.foreground-alt}
|
||||
label-empty-padding = 2
|
||||
|
||||
[module/i3]
|
||||
type = internal/i3
|
||||
format = <label-state> <label-mode>
|
||||
index-sort = true
|
||||
wrapping-scroll = false
|
||||
|
||||
; Only show workspaces on the same output as the bar
|
||||
;pin-workspaces = true
|
||||
|
||||
label-mode-padding = 2
|
||||
label-mode-foreground = #000
|
||||
label-mode-background = ${colors.primary}
|
||||
|
||||
; focused = Active workspace on focused monitor
|
||||
label-focused = %index%
|
||||
label-focused-background = ${module/bspwm.label-focused-background}
|
||||
label-focused-underline = ${module/bspwm.label-focused-underline}
|
||||
label-focused-padding = ${module/bspwm.label-focused-padding}
|
||||
|
||||
; unfocused = Inactive workspace on any monitor
|
||||
label-unfocused = %index%
|
||||
label-unfocused-padding = ${module/bspwm.label-occupied-padding}
|
||||
|
||||
; visible = Active workspace on unfocused monitor
|
||||
label-visible = %index%
|
||||
label-visible-background = ${self.label-focused-background}
|
||||
label-visible-underline = ${self.label-focused-underline}
|
||||
label-visible-padding = ${self.label-focused-padding}
|
||||
|
||||
; urgent = Workspace with urgency hint set
|
||||
label-urgent = %index%
|
||||
label-urgent-background = ${module/bspwm.label-urgent-background}
|
||||
label-urgent-padding = ${module/bspwm.label-urgent-padding}
|
||||
|
||||
[module/mpd]
|
||||
type = internal/mpd
|
||||
format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
|
||||
|
||||
icon-prev =
|
||||
icon-stop =
|
||||
icon-play =
|
||||
icon-pause =
|
||||
icon-next =
|
||||
|
||||
label-song-maxlen = 25
|
||||
label-song-ellipsis = true
|
||||
|
||||
[module/xbacklight]
|
||||
type = internal/xbacklight
|
||||
|
||||
format = <label> <bar>
|
||||
label = BL
|
||||
|
||||
bar-width = 10
|
||||
bar-indicator = |
|
||||
bar-indicator-foreground = #ff
|
||||
bar-indicator-font = 2
|
||||
bar-fill = ─
|
||||
bar-fill-font = 2
|
||||
bar-fill-foreground = #9f78e1
|
||||
bar-empty = ─
|
||||
bar-empty-font = 2
|
||||
bar-empty-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/backlight-acpi]
|
||||
inherit = module/xbacklight
|
||||
type = internal/backlight
|
||||
card = intel_backlight
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 2
|
||||
format-prefix = " "
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-underline = #f90000
|
||||
label = %percentage:2%%
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
interval = 2
|
||||
format-prefix = " "
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-underline = #4bffdc
|
||||
label = %percentage_used%%
|
||||
|
||||
[module/wlan]
|
||||
type = internal/network
|
||||
interface = wlp3s0
|
||||
interval = 3.0
|
||||
|
||||
format-connected = <ramp-signal> <label-connected>
|
||||
format-connected-underline = #9f78e1
|
||||
label-connected = %essid%
|
||||
|
||||
format-disconnected =
|
||||
;format-disconnected = <label-disconnected>
|
||||
;format-disconnected-underline = ${self.format-connected-underline}
|
||||
;label-disconnected = %ifname% disconnected
|
||||
;label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
ramp-signal-0 =
|
||||
ramp-signal-1 =
|
||||
ramp-signal-2 =
|
||||
ramp-signal-3 =
|
||||
ramp-signal-4 =
|
||||
ramp-signal-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/eth]
|
||||
type = internal/network
|
||||
interface = enp0s31f6
|
||||
interval = 3.0
|
||||
|
||||
format-connected-underline = #55aa55
|
||||
format-connected-prefix = " "
|
||||
format-connected-prefix-foreground = ${colors.foreground-alt}
|
||||
label-connected = %local_ip%
|
||||
|
||||
format-disconnected =
|
||||
;format-disconnected = <label-disconnected>
|
||||
;format-disconnected-underline = ${self.format-connected-underline}
|
||||
;label-disconnected = %ifname% disconnected
|
||||
;label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 5
|
||||
|
||||
date =
|
||||
date-alt = " %Y-%m-%d"
|
||||
|
||||
time = %H:%M
|
||||
time-alt = %H:%M:%S
|
||||
|
||||
format-prefix =
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-underline = #0a6cf5
|
||||
|
||||
label = %date% %time%
|
||||
|
||||
[module/volume]
|
||||
type = internal/volume
|
||||
|
||||
format-volume = <label-volume> <bar-volume>
|
||||
label-volume = VOL
|
||||
label-volume-foreground = ${root.foreground}
|
||||
|
||||
format-muted-prefix = " "
|
||||
format-muted-foreground = ${colors.foreground-alt}
|
||||
label-muted = sound muted
|
||||
|
||||
bar-volume-width = 10
|
||||
bar-volume-foreground-0 = #55aa55
|
||||
bar-volume-foreground-1 = #55aa55
|
||||
bar-volume-foreground-2 = #55aa55
|
||||
bar-volume-foreground-3 = #55aa55
|
||||
bar-volume-foreground-4 = #55aa55
|
||||
bar-volume-foreground-5 = #f5a70a
|
||||
bar-volume-foreground-6 = #ff5555
|
||||
bar-volume-gradient = false
|
||||
bar-volume-indicator = |
|
||||
bar-volume-indicator-font = 2
|
||||
bar-volume-fill = ─
|
||||
bar-volume-fill-font = 2
|
||||
bar-volume-empty = ─
|
||||
bar-volume-empty-font = 2
|
||||
bar-volume-empty-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = AC
|
||||
full-at = 98
|
||||
|
||||
format-charging = <animation-charging> <label-charging>
|
||||
format-charging-underline = #ffb52a
|
||||
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
format-discharging-underline = ${self.format-charging-underline}
|
||||
|
||||
format-full-prefix = " "
|
||||
format-full-prefix-foreground = ${colors.foreground-alt}
|
||||
format-full-underline = ${self.format-charging-underline}
|
||||
|
||||
ramp-capacity-0 =
|
||||
ramp-capacity-1 =
|
||||
ramp-capacity-2 =
|
||||
ramp-capacity-foreground = ${colors.foreground-alt}
|
||||
|
||||
animation-charging-0 =
|
||||
animation-charging-1 =
|
||||
animation-charging-2 =
|
||||
animation-charging-foreground = ${colors.foreground-alt}
|
||||
animation-charging-framerate = 750
|
||||
|
||||
[module/temperature]
|
||||
type = internal/temperature
|
||||
thermal-zone = 0
|
||||
warn-temperature = 60
|
||||
|
||||
format = <ramp> <label>
|
||||
format-underline = #f50a4d
|
||||
format-warn = <ramp> <label-warn>
|
||||
format-warn-underline = ${self.format-underline}
|
||||
|
||||
label = %temperature%
|
||||
label-warn = %temperature%
|
||||
label-warn-foreground = ${colors.secondary}
|
||||
|
||||
ramp-0 =
|
||||
ramp-1 =
|
||||
ramp-2 =
|
||||
ramp-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/powermenu]
|
||||
type = custom/menu
|
||||
|
||||
expand-right = true
|
||||
|
||||
format-spacing = 1
|
||||
|
||||
label-open =
|
||||
label-open-foreground = ${colors.secondary}
|
||||
label-close = cancel
|
||||
label-close-foreground = ${colors.secondary}
|
||||
label-separator = |
|
||||
label-separator-foreground = ${colors.foreground-alt}
|
||||
|
||||
menu-0-0 = reboot
|
||||
menu-0-0-exec = menu-open-1
|
||||
menu-0-1 = power off
|
||||
menu-0-1-exec = menu-open-2
|
||||
|
||||
menu-1-0 = cancel
|
||||
menu-1-0-exec = menu-open-0
|
||||
menu-1-1 = reboot
|
||||
menu-1-1-exec = sudo reboot
|
||||
|
||||
menu-2-0 = power off
|
||||
menu-2-0-exec = sudo poweroff
|
||||
menu-2-1 = cancel
|
||||
menu-2-1-exec = menu-open-0
|
||||
|
||||
[settings]
|
||||
screenchange-reload = true
|
||||
;compositing-background = xor
|
||||
;compositing-background = screen
|
||||
;compositing-foreground = source
|
||||
;compositing-border = over
|
||||
|
||||
[global/wm]
|
||||
margin-top = 5
|
||||
margin-bottom = 5
|
||||
|
||||
; vim:ft=dosini
|
||||
13
.config/polybar/launch.sh
Executable file
13
.config/polybar/launch.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Terminate already running bar instances
|
||||
killall -q polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
# Launch bar1 and bar2
|
||||
polybar bottom &
|
||||
polybar top &
|
||||
|
||||
echo "Bars launched..."
|
||||
7
.config/polybar/openvpn-indicator.sh
Executable file
7
.config/polybar/openvpn-indicator.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$(nmcli | grep 'Dahoam VPN connection')" ]; then
|
||||
echo "%{A1:nmcli con down Dahoam:}旅%{A}"
|
||||
else
|
||||
echo "%{A1:nmcli con up Dahoam:}%{F#404040}旅%{F-} %{A}"
|
||||
fi
|
||||
11
.config/polybar/player-mpris-simple.sh
Executable file
11
.config/polybar/player-mpris-simple.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
player_status=$(playerctl status 2> /dev/null)
|
||||
|
||||
if [ "$player_status" = "Playing" ]; then
|
||||
echo "ﱘ $(playerctl metadata artist) - $(playerctl metadata title) %{A1:playerctl previous:}玲%{A} %{A1:playerctl play-pause:} %{A} %{A1:playerctl next:}怜%{A}"
|
||||
elif [ "$player_status" = "Paused" ]; then
|
||||
echo "ﱘ $(playerctl metadata artist) - $(playerctl metadata title) %{A1:playerctl previous:}玲%{A} %{A1:playerctl play-pause:} 契%{A} %{A1:playerctl next:}怜%{A}"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
58
.config/polybar/pulseaudio-tail.sh
Executable file
58
.config/polybar/pulseaudio-tail.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
|
||||
sink=0
|
||||
|
||||
volume_up() {
|
||||
pactl set-sink-volume $sink +1%
|
||||
}
|
||||
|
||||
volume_down() {
|
||||
pactl set-sink-volume $sink -1%
|
||||
}
|
||||
|
||||
volume_mute() {
|
||||
pactl set-sink-mute $sink toggle
|
||||
}
|
||||
|
||||
volume_print() {
|
||||
if pacmd list-sinks | grep active | head -n 1 | grep -q speaker; then
|
||||
icon="#1"
|
||||
elif pacmd list-sinks | grep active | head -n 1 | grep headphones; then
|
||||
icon="#2"
|
||||
else
|
||||
icon="#3"
|
||||
fi
|
||||
|
||||
muted=$(pamixer --sink $sink --get-mute)
|
||||
|
||||
if [ "$muted" = true ]; then
|
||||
echo "$icon --"
|
||||
else
|
||||
echo "$icon $(pamixer --sink $sink --get-volume)"
|
||||
fi
|
||||
}
|
||||
|
||||
listen() {
|
||||
volume_print
|
||||
|
||||
pactl subscribe | while read -r event; do
|
||||
if echo "$event" | grep -q "#$sink"; then
|
||||
volume_print
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--up)
|
||||
volume_up
|
||||
;;
|
||||
--down)
|
||||
volume_down
|
||||
;;
|
||||
--mute)
|
||||
volume_mute
|
||||
;;
|
||||
*)
|
||||
listen
|
||||
;;
|
||||
esac
|
||||
11
.config/polybar/touchpad-indicator.sh
Executable file
11
.config/polybar/touchpad-indicator.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
touchpad_status=$(synclient | grep Touchpad | tail -c 2 | head -c 1 2> /dev/null)
|
||||
|
||||
if [ "$touchpad_status" = "1" ]; then
|
||||
echo "%{A1:synclient TouchpadOff=0:}%{F#404040}ﳶ%{F-} %{A}"
|
||||
elif [ "$touchpad_status" = "0" ]; then
|
||||
echo "%{A1:synclient TouchpadOff=1:}ﳶ %{A}"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
2
.config/rofi/config
Normal file
2
.config/rofi/config
Normal file
@@ -0,0 +1,2 @@
|
||||
rofi.theme: /usr/share/rofi/themes/lb.rasi
|
||||
rofi.ssh-command: {terminal} -e "{ssh-client} {host}"
|
||||
22
.gitconfig
Normal file
22
.gitconfig
Normal file
@@ -0,0 +1,22 @@
|
||||
[user]
|
||||
name = Felix Steghofer
|
||||
email = felix.steghofer@gmail.com
|
||||
[push]
|
||||
default = simple
|
||||
[merge]
|
||||
tool = intellij
|
||||
[core]
|
||||
autocrlf = input
|
||||
|
||||
[mergetool "intellij"]
|
||||
cmd = /usr/bin/intellij-idea-ultimate-edition merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
|
||||
trustExitCode = true
|
||||
[diff]
|
||||
tool = code
|
||||
[difftool "intellij"]
|
||||
cmd = /usr/bin/intellij-idea-ultimate-edition diff $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE")
|
||||
[difftool "code"]
|
||||
cmd = code --wait --diff $LOCAL $REMOTE
|
||||
|
||||
[alias]
|
||||
quick-stats = ! /usr/local/bin/git-quick-stats
|
||||
70
.tmux.conf
Normal file
70
.tmux.conf
Normal file
@@ -0,0 +1,70 @@
|
||||
# 0 is too far from ` ;)
|
||||
set -g base-index 1
|
||||
|
||||
# Automatically set window title
|
||||
set-window-option -g automatic-rename on
|
||||
set-window-option -g xterm-keys on
|
||||
set-option -g set-titles on
|
||||
|
||||
#set -g default-terminal screen-256color
|
||||
set -g status-keys vi
|
||||
set -g history-limit 10000
|
||||
|
||||
setw -g mode-keys vi
|
||||
setw -g monitor-activity on
|
||||
# old..
|
||||
#setw -g mode-mouse on
|
||||
#setw -g mouse-resize-pane on
|
||||
#setw -g mouse-select-pane on
|
||||
#setw -g mouse-select-window on
|
||||
set -g mouse on
|
||||
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
|
||||
|
||||
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
|
||||
|
||||
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-bg white
|
||||
set -g window-status-current-fg black
|
||||
set -g window-status-current-attr bold
|
||||
set -g status on
|
||||
214
.zsh/.zsh/.zsh/S60_prompt
Normal file
214
.zsh/.zsh/.zsh/S60_prompt
Normal file
@@ -0,0 +1,214 @@
|
||||
#!/bin/zsh
|
||||
#
|
||||
# This file was written by Bart Trojanowski <bart@jukie.net>
|
||||
#
|
||||
# documented on my blog:
|
||||
# http://www.jukie.net/~bart/blog/tag/zsh
|
||||
#
|
||||
# references
|
||||
# http://www.zsh.org/mla/users/2006/msg01196.html
|
||||
# http://dotfiles.org/~frogb/.zshrc
|
||||
# http://kriener.org/articles/2009/06/04/zsh-prompt-magic
|
||||
|
||||
setopt prompt_subst
|
||||
autoload colors
|
||||
colors
|
||||
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# -------------------------------
|
||||
# define core prompt functions
|
||||
|
||||
# set some colors
|
||||
for COLOR in RED GREEN BLUE YELLOW WHITE BLACK CYAN; do
|
||||
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
|
||||
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
|
||||
done
|
||||
PR_RST="%{${reset_color}%}"
|
||||
PR_RESET="%{%b%s%u$reset_color%}"
|
||||
PR_BG="%{%(?.$PR_RESET.%S)%}"
|
||||
|
||||
# set formats
|
||||
# %b - branchname
|
||||
# %u - unstagedstr (see below)
|
||||
# %c - stangedstr (see below)
|
||||
# %a - action (e.g. rebase-i)
|
||||
# %R - repository path
|
||||
# %S - path in the repository
|
||||
FMT_BRANCH="${PR_GREEN}%b%u%c${PR_RST}" # e.g. master¹²
|
||||
FMT_ACTION="(${PR_CYAN}%a${PR_RST}%)" # e.g. (rebase-i)
|
||||
FMT_PATH="%R${PR_YELLOW}/%S" # e.g. ~/repo/subdir
|
||||
|
||||
# check-for-changes can be really slow.
|
||||
# you should disable it, if you work with large repositories
|
||||
zstyle ':vcs_info:*:prompt:*' check-for-changes true
|
||||
zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
|
||||
zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
|
||||
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}//" "${FMT_PATH}"
|
||||
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}//" "${FMT_PATH}"
|
||||
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
|
||||
|
||||
function lprompt {
|
||||
local brackets=$1
|
||||
local color1=$2
|
||||
local color2=$3
|
||||
|
||||
local bracket_open="${color1}${brackets[1]}${PR_BG}"
|
||||
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
|
||||
|
||||
local git='$vcs_info_msg_0_'
|
||||
local cwd="${color2}%B%1~%b"
|
||||
|
||||
local vimode='${PR_VIMODE}'
|
||||
local vicol='${PR_VICOLOR}'
|
||||
|
||||
#PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
|
||||
PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
|
||||
}
|
||||
|
||||
function rprompt {
|
||||
local brackets=$1
|
||||
local color1=$2
|
||||
local color2=$3
|
||||
|
||||
local bracket_open="${color1}${brackets[1]}${PR_RESET}"
|
||||
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
|
||||
local colon="${color1}:"
|
||||
local at="${color1}@${PR_RESET}"
|
||||
|
||||
local user_host="${color2}%n${at}${color2}%m"
|
||||
local vcs_cwd='${${vcs_info_msg_1_%%.}/$HOME/~}'
|
||||
local cwd="${color2}%B%20<..<${vcs_cwd}%<<%b"
|
||||
local inner="${user_host}${colon}${cwd}"
|
||||
|
||||
RPROMPT="${PR_RESET}${bracket_open}${inner}${bracket_close}${PR_RESET}"
|
||||
}
|
||||
|
||||
# -------------------------------
|
||||
# host dependent colouring
|
||||
|
||||
#lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
#rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
|
||||
if [ $UID -eq 0 ]; then
|
||||
lprompt '<>' $PR_RED $PR_RED
|
||||
rprompt '<>' $PR_RED $PR_RED
|
||||
else
|
||||
case $HOST in
|
||||
xenon)
|
||||
lprompt '[]' $PR_BRIGHT_BLACK $PR_GREEN
|
||||
rprompt '()' $PR_YELLOW $PR_WHITE
|
||||
;;
|
||||
oxygen*)
|
||||
lprompt '[]' $PR_WHITE $PR_GREEN
|
||||
rprompt '()' $PR_YELLOW $PR_WHITE
|
||||
;;
|
||||
|
||||
meson*)
|
||||
lprompt '<>' $PR_RED $PR_YELLOW
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
muon*)
|
||||
lprompt '<>' $PR_RED $PR_BLUE
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
quark*)
|
||||
lprompt '<>' $PR_RED $PR_GREEN
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
|
||||
*)
|
||||
if [ "${$(hostname -f)#*.}" = "jukie.net" ]; then
|
||||
lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
else
|
||||
lprompt '{}' $PR_WHITE $PR_WHITE
|
||||
rprompt '()' $PR_WHITE $PR_WHITE
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "$debian_chroot" ]; then
|
||||
PROMPT="$bgc%{$fg[yellow]%}%B${debian_chroot}%b ${PROMPT}"
|
||||
fi
|
||||
|
||||
# ------------------------------
|
||||
# update the vcs_info_msg_ magic variables, but only as little as possible
|
||||
|
||||
# This variable dictates weather we are going to do the git prompt update
|
||||
# before printing the next prompt. On some setups this saves 10s of work.
|
||||
PR_GIT_UPDATE=1
|
||||
|
||||
# called before command excution
|
||||
# here we decide if we should update the prompt next time
|
||||
function zsh_git_prompt_preexec {
|
||||
case "$(history $HISTCMD)" in
|
||||
*git*)
|
||||
PR_GIT_UPDATE=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
preexec_functions+='zsh_git_prompt_preexec'
|
||||
|
||||
# called after directory change
|
||||
# we just assume that we have to update git prompt
|
||||
function zsh_git_prompt_chpwd {
|
||||
PR_GIT_UPDATE=1
|
||||
}
|
||||
chpwd_functions+='zsh_git_prompt_chpwd'
|
||||
|
||||
# called before prompt generation
|
||||
# if needed, we will update the prompt info
|
||||
function zsh_git_prompt_precmd {
|
||||
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
||||
vcs_info 'prompt'
|
||||
PR_GIT_UPDATE=
|
||||
fi
|
||||
}
|
||||
precmd_functions+='zsh_git_prompt_precmd'
|
||||
|
||||
# ------------------------------
|
||||
# handle vi NORMAL/INSERT mode change
|
||||
PR_VIMODE="#"
|
||||
PR_VICOLOR=${PR_BLUE}
|
||||
function zle-line-init zle-keymap-select {
|
||||
PR_VIMODE="${${KEYMAP/vicmd/¢}/(main|viins)/$}"
|
||||
PR_VICOLOR="${${KEYMAP/vicmd/${PR_RED}}/(main|viins)/${PR_GREEN}}"
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
|
||||
# ------------------------------
|
||||
# this stuff updates screen and xterm titles as the command runs
|
||||
|
||||
case $TERM in
|
||||
xterm* | rxvt* | urxvt*)
|
||||
function zsh_term_prompt_precmd {
|
||||
print -Pn "\e]0;%n@%m: %~\a"
|
||||
}
|
||||
function zsh_term_prompt_preexec {
|
||||
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
|
||||
print -Pn "\e]0;%n@%m: %~ $x\a"
|
||||
}
|
||||
preexec_functions+='zsh_term_prompt_preexec'
|
||||
precmd_functions+='zsh_term_prompt_precmd'
|
||||
;;
|
||||
screen*)
|
||||
function zsh_term_prompt_precmd {
|
||||
print -nR $'\033k'"zsh"$'\033'\\\
|
||||
|
||||
print -nR $'\033]0;'"zsh"$'\a'
|
||||
}
|
||||
function zsh_term_prompt_preexec {
|
||||
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
|
||||
print -nR $'\033k'"$x"$'\033'\\\
|
||||
|
||||
print -nR $'\033]0;'"$x"$'\a'
|
||||
}
|
||||
preexec_functions+='zsh_term_prompt_preexec'
|
||||
precmd_functions+='zsh_term_prompt_precmd'
|
||||
;;
|
||||
esac
|
||||
|
||||
59
.zsh/.zsh/.zsh/aliases.zsh
Normal file
59
.zsh/.zsh/.zsh/aliases.zsh
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
# Super user
|
||||
alias fuck='sudo $(fc -ln -1)'
|
||||
|
||||
#alias g='grep -in'
|
||||
|
||||
# List direcory contents
|
||||
alias lsa='ls -lah'
|
||||
alias ll='ls -l'
|
||||
alias sl=ls
|
||||
alias lk='ls -lSr'
|
||||
alias ls='ls -c --color=auto --group-directories-first --quoting-style=shell'
|
||||
alias l='ls -lcnhF --color=auto --group-directories-first --quoting-style=shell'
|
||||
alias lc='ls -lcr'
|
||||
alias lg='ls | grep '
|
||||
alias lss='du -kh --max-depth=1 | sort -nr | more '
|
||||
# alias to avoid making mistakes:
|
||||
alias rm='rm -iv'
|
||||
alias cp='cp -iv'
|
||||
alias mv='mv -iv'
|
||||
|
||||
# ARCH
|
||||
# pacman shortcuts:
|
||||
# This one is dangerous!!
|
||||
alias pacman='pacaur'
|
||||
# list orphans
|
||||
alias lsorphans='sudo pacman -Qqdt'
|
||||
# remove orphans
|
||||
alias rmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
# Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
# list local packages with size
|
||||
alias paclist="LC_ALL=C pacman -Qi | sed -n '/^Name[^:]*: \(.*\)/{s//\1 /;x};/^Installed[^:]*: \(.*\)/{s//\1/;H;x;s/\n//;p}' | sort -nk2"
|
||||
|
||||
alias ..="cd .."
|
||||
|
||||
# Dateiendungen automatisch mit dem jeweiligen Programm öffnen
|
||||
alias -s html=$BROWSER
|
||||
alias -s png=eog
|
||||
alias -s jpg=eog
|
||||
alias -s org=$BROWSER
|
||||
alias -s php=$EDITOR
|
||||
alias -s com=$BROWSER
|
||||
alias -s net=$BROWSER
|
||||
alias -s gz=tar -xzvf
|
||||
alias -s bz2=tar -xjvf
|
||||
alias -s java=$EDITOR
|
||||
alias -s txt=$EDITOR
|
||||
alias -s PKGBUILD=$EDITOR
|
||||
alias -s kdbx=keepassxc
|
||||
|
||||
alias open="xdg-open"
|
||||
alias dd='dcfldd'
|
||||
|
||||
alias cb='xclip -selection clipboard'
|
||||
|
||||
function cpstat() {
|
||||
rsync -ah --progress "$1" "$2"
|
||||
}
|
||||
0
.zsh/.zsh/.zsh/cache
Normal file
0
.zsh/.zsh/.zsh/cache
Normal file
13
.zsh/.zsh/.zsh/dev-machine.zsh
Normal file
13
.zsh/.zsh/.zsh/dev-machine.zsh
Normal file
@@ -0,0 +1,13 @@
|
||||
# fix VTE
|
||||
. /etc/profile.d/vte.sh
|
||||
|
||||
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
|
||||
source /etc/profile.d/vte.sh
|
||||
fi
|
||||
|
||||
# fix node.js
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
source /usr/share/nvm/nvm.sh
|
||||
source /usr/share/nvm/bash_completion
|
||||
source /usr/share/nvm/install-nvm-exec
|
||||
|
||||
59
.zsh/.zsh/.zsh/functions/06_git
Normal file
59
.zsh/.zsh/.zsh/functions/06_git
Normal file
@@ -0,0 +1,59 @@
|
||||
if [[ -x `which git` ]]; then
|
||||
alias g=git
|
||||
function git-branch-name () {
|
||||
git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //'
|
||||
}
|
||||
function git-dirty () {
|
||||
git status 2> /dev/null | grep "nothing to commit (working directory clean)"
|
||||
echo $?
|
||||
}
|
||||
function gsrb () {
|
||||
branch=$(git-branch-name)
|
||||
git checkout master
|
||||
git svn rebase
|
||||
git checkout "${branch}"
|
||||
git rebase master
|
||||
}
|
||||
function git-need-to-push() {
|
||||
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
|
||||
echo "â "
|
||||
fi
|
||||
}
|
||||
function git-prompt() {
|
||||
gstatus=$(git status 2> /dev/null)
|
||||
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
|
||||
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
|
||||
if [[ x$branch != x ]]; then
|
||||
dirty_color=$fg[green]
|
||||
push_status=$(git-need-to-push)
|
||||
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
|
||||
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
|
||||
fi
|
||||
}
|
||||
function git-scoreboard () {
|
||||
git log | grep '^Author' | sort | uniq -ci | sort -r
|
||||
}
|
||||
function git-track () {
|
||||
branch=$(git-branch-name)
|
||||
git config branch.$branch.remote origin
|
||||
git config branch.$branch.merge refs/heads/$branch
|
||||
echo "tracking origin/$tracking"
|
||||
}
|
||||
function github-init () {
|
||||
git config branch.$(git-branch-name).remote origin
|
||||
git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name)
|
||||
}
|
||||
|
||||
function github-url () {
|
||||
git config remote.origin.url | sed -En 's/git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'
|
||||
}
|
||||
|
||||
# Seems to be the best OS X jump-to-github alias from http://tinyurl.com/2mtncf
|
||||
function github-go () {
|
||||
open $(github-url)
|
||||
}
|
||||
|
||||
function nhgk () {
|
||||
nohup gitk --all &
|
||||
}
|
||||
fi
|
||||
3
.zsh/.zsh/.zsh/functions/07_felix
Normal file
3
.zsh/.zsh/.zsh/functions/07_felix
Normal file
@@ -0,0 +1,3 @@
|
||||
function cpstat() {
|
||||
rsync -ah --progress "$1" "$2"
|
||||
}
|
||||
64
.zsh/.zsh/.zsh/git-prompt/gitstatus.py
Normal file
64
.zsh/.zsh/.zsh/git-prompt/gitstatus.py
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
# change this symbol to whatever you prefer
|
||||
prehash = ':'
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
import sys
|
||||
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
|
||||
branch, error = gitsym.communicate()
|
||||
|
||||
error_string = error.decode('utf-8')
|
||||
|
||||
if 'fatal: Not a git repository' in error_string:
|
||||
sys.exit(0)
|
||||
|
||||
branch = branch.decode("utf-8").strip()[11:]
|
||||
|
||||
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
|
||||
err_string = err.decode('utf-8')
|
||||
if 'fatal' in err_string:
|
||||
sys.exit(0)
|
||||
changed_files = [namestat[0] for namestat in res.decode("utf-8").splitlines()]
|
||||
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
|
||||
nb_changed = len(changed_files) - changed_files.count('U')
|
||||
nb_U = staged_files.count('U')
|
||||
nb_staged = len(staged_files) - nb_U
|
||||
staged = str(nb_staged)
|
||||
conflicts = str(nb_U)
|
||||
changed = str(nb_changed)
|
||||
nb_untracked = len([0 for status in Popen(['git','status','--porcelain',],stdout=PIPE).communicate()[0].decode("utf-8").splitlines() if status.startswith('??')])
|
||||
untracked = str(nb_untracked)
|
||||
|
||||
ahead, behind = 0,0
|
||||
|
||||
if not branch: # not on any branch
|
||||
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
|
||||
else:
|
||||
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
|
||||
if remote_name:
|
||||
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
|
||||
if remote_name == '.': # local
|
||||
remote_ref = merge_name
|
||||
else:
|
||||
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
|
||||
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
|
||||
revlist = revgit.communicate()[0]
|
||||
if revgit.poll(): # fallback to local
|
||||
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
behead = revlist.decode("utf-8").splitlines()
|
||||
ahead = len([x for x in behead if x[0]=='>'])
|
||||
behind = len(behead) - ahead
|
||||
|
||||
out = ' '.join([
|
||||
branch,
|
||||
str(ahead),
|
||||
str(behind),
|
||||
staged,
|
||||
conflicts,
|
||||
changed,
|
||||
untracked,
|
||||
])
|
||||
print(out, end='')
|
||||
95
.zsh/.zsh/.zsh/git-prompt/loader.sh
Normal file
95
.zsh/.zsh/.zsh/git-prompt/loader.sh
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
# To install source this file from your .zshrc file
|
||||
|
||||
# Change this to reflect your installation directory
|
||||
export __GIT_PROMPT_DIR=~/.zsh/git-prompt
|
||||
# Initialize colors.
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
add-zsh-hook chpwd chpwd_update_git_vars
|
||||
add-zsh-hook preexec preexec_update_git_vars
|
||||
add-zsh-hook precmd precmd_update_git_vars
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ -n "$ZSH_THEME_GIT_PROMPT_NOCACHE" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(@f)_GIT_STATUS}")
|
||||
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
|
||||
GIT_REMOTE=$__CURRENT_GIT_STATUS[2]
|
||||
GIT_STAGED=$__CURRENT_GIT_STATUS[3]
|
||||
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[4]
|
||||
GIT_CHANGED=$__CURRENT_GIT_STATUS[5]
|
||||
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[6]
|
||||
GIT_CLEAN=$__CURRENT_GIT_STATUS[7]
|
||||
}
|
||||
|
||||
|
||||
git_super_status() {
|
||||
precmd_update_git_vars
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
STATUS="($GIT_BRANCH"
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
|
||||
if [ -n "$GIT_REMOTE" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_REMOTE$GIT_REMOTE%{${reset_color}%}"
|
||||
fi
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
|
||||
if [ "$GIT_STAGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CONFLICTS" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_UNTRACKED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CLEAN" -eq "1" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$STATUS"
|
||||
fi
|
||||
}
|
||||
|
||||
# Default values for the appearance of the prompt. Configure at will.
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
||||
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}✖"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}✚"
|
||||
ZSH_THEME_GIT_PROMPT_REMOTE=""
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
|
||||
|
||||
39
.zsh/.zsh/.zsh/key-bindings.zsh
Normal file
39
.zsh/.zsh/.zsh/key-bindings.zsh
Normal file
@@ -0,0 +1,39 @@
|
||||
# TODO: Explain what some of this does..
|
||||
|
||||
bindkey -e
|
||||
bindkey -s '^g' '|grep ""^[OD' # c g pipe to grep
|
||||
bindkey '\ew' kill-region
|
||||
bindkey -s '\el' "ls\n"
|
||||
bindkey -s '\ek' "..\n"
|
||||
bindkey -s '\ej' "cd -\n"
|
||||
bindkey -s '\eh' "cd $OLDPWD\n"
|
||||
bindkey -s '\e;' "pushd -1\n"
|
||||
bindkey -s '\ei' "dirs\n"
|
||||
bindkey -s '\eo' "popd\n"
|
||||
# Meta-u to chdir to the parent directory
|
||||
bindkey -s '\eu' '^Ucd ..\n'
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
bindkey "^[[5~" up-line-or-history
|
||||
bindkey "^[[6~" down-line-or-history
|
||||
|
||||
# make search up and down work, so partially type and hit up/down to find relevant stuff
|
||||
bindkey '^[[A' up-line-or-search
|
||||
bindkey '^[[B' down-line-or-search
|
||||
|
||||
bindkey "^[[H" beginning-of-line
|
||||
bindkey "^[[1~" beginning-of-line
|
||||
bindkey "^[[F" end-of-line
|
||||
bindkey "^[[4~" end-of-line
|
||||
bindkey ' ' magic-space # also do history expansion on space
|
||||
|
||||
bindkey '^[[Z' reverse-menu-complete
|
||||
|
||||
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
# alt+s inserts sudo at the beginning of the line
|
||||
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
|
||||
zle -N insert-sudo insert_sudo
|
||||
bindkey "^[s" insert-sudo
|
||||
|
||||
27
.zsh/.zsh/.zsh/sunaku.zsh-theme
Normal file
27
.zsh/.zsh/.zsh/sunaku.zsh-theme
Normal file
@@ -0,0 +1,27 @@
|
||||
# Git-centric variation of the "fishy" theme.
|
||||
# See screenshot at http://ompldr.org/vOHcwZg
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
local user_color='green'
|
||||
test $UID -eq 0 && user_color='red'
|
||||
|
||||
PROMPT='
|
||||
%(?..%{$fg_bold[red]%}exit %?
|
||||
%{$reset_color%})'\
|
||||
'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
|
||||
'$(git_prompt_info)'\
|
||||
'%{$fg[$user_color]%}%~%{$reset_color%}'\
|
||||
'%(!.#.>) '
|
||||
|
||||
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||
214
.zsh/.zsh/S60_prompt
Normal file
214
.zsh/.zsh/S60_prompt
Normal file
@@ -0,0 +1,214 @@
|
||||
#!/bin/zsh
|
||||
#
|
||||
# This file was written by Bart Trojanowski <bart@jukie.net>
|
||||
#
|
||||
# documented on my blog:
|
||||
# http://www.jukie.net/~bart/blog/tag/zsh
|
||||
#
|
||||
# references
|
||||
# http://www.zsh.org/mla/users/2006/msg01196.html
|
||||
# http://dotfiles.org/~frogb/.zshrc
|
||||
# http://kriener.org/articles/2009/06/04/zsh-prompt-magic
|
||||
|
||||
setopt prompt_subst
|
||||
autoload colors
|
||||
colors
|
||||
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# -------------------------------
|
||||
# define core prompt functions
|
||||
|
||||
# set some colors
|
||||
for COLOR in RED GREEN BLUE YELLOW WHITE BLACK CYAN; do
|
||||
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
|
||||
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
|
||||
done
|
||||
PR_RST="%{${reset_color}%}"
|
||||
PR_RESET="%{%b%s%u$reset_color%}"
|
||||
PR_BG="%{%(?.$PR_RESET.%S)%}"
|
||||
|
||||
# set formats
|
||||
# %b - branchname
|
||||
# %u - unstagedstr (see below)
|
||||
# %c - stangedstr (see below)
|
||||
# %a - action (e.g. rebase-i)
|
||||
# %R - repository path
|
||||
# %S - path in the repository
|
||||
FMT_BRANCH="${PR_GREEN}%b%u%c${PR_RST}" # e.g. master¹²
|
||||
FMT_ACTION="(${PR_CYAN}%a${PR_RST}%)" # e.g. (rebase-i)
|
||||
FMT_PATH="%R${PR_YELLOW}/%S" # e.g. ~/repo/subdir
|
||||
|
||||
# check-for-changes can be really slow.
|
||||
# you should disable it, if you work with large repositories
|
||||
zstyle ':vcs_info:*:prompt:*' check-for-changes true
|
||||
zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
|
||||
zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
|
||||
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}//" "${FMT_PATH}"
|
||||
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}//" "${FMT_PATH}"
|
||||
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
|
||||
|
||||
function lprompt {
|
||||
local brackets=$1
|
||||
local color1=$2
|
||||
local color2=$3
|
||||
|
||||
local bracket_open="${color1}${brackets[1]}${PR_BG}"
|
||||
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
|
||||
|
||||
local git='$vcs_info_msg_0_'
|
||||
local cwd="${color2}%B%1~%b"
|
||||
|
||||
local vimode='${PR_VIMODE}'
|
||||
local vicol='${PR_VICOLOR}'
|
||||
|
||||
#PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
|
||||
PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
|
||||
}
|
||||
|
||||
function rprompt {
|
||||
local brackets=$1
|
||||
local color1=$2
|
||||
local color2=$3
|
||||
|
||||
local bracket_open="${color1}${brackets[1]}${PR_RESET}"
|
||||
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
|
||||
local colon="${color1}:"
|
||||
local at="${color1}@${PR_RESET}"
|
||||
|
||||
local user_host="${color2}%n${at}${color2}%m"
|
||||
local vcs_cwd='${${vcs_info_msg_1_%%.}/$HOME/~}'
|
||||
local cwd="${color2}%B%20<..<${vcs_cwd}%<<%b"
|
||||
local inner="${user_host}${colon}${cwd}"
|
||||
|
||||
RPROMPT="${PR_RESET}${bracket_open}${inner}${bracket_close}${PR_RESET}"
|
||||
}
|
||||
|
||||
# -------------------------------
|
||||
# host dependent colouring
|
||||
|
||||
#lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
#rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
|
||||
if [ $UID -eq 0 ]; then
|
||||
lprompt '<>' $PR_RED $PR_RED
|
||||
rprompt '<>' $PR_RED $PR_RED
|
||||
else
|
||||
case $HOST in
|
||||
xenon)
|
||||
lprompt '[]' $PR_BRIGHT_BLACK $PR_GREEN
|
||||
rprompt '()' $PR_YELLOW $PR_WHITE
|
||||
;;
|
||||
oxygen*)
|
||||
lprompt '[]' $PR_WHITE $PR_GREEN
|
||||
rprompt '()' $PR_YELLOW $PR_WHITE
|
||||
;;
|
||||
|
||||
meson*)
|
||||
lprompt '<>' $PR_RED $PR_YELLOW
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
muon*)
|
||||
lprompt '<>' $PR_RED $PR_BLUE
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
quark*)
|
||||
lprompt '<>' $PR_RED $PR_GREEN
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
|
||||
*)
|
||||
if [ "${$(hostname -f)#*.}" = "jukie.net" ]; then
|
||||
lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
else
|
||||
lprompt '{}' $PR_WHITE $PR_WHITE
|
||||
rprompt '()' $PR_WHITE $PR_WHITE
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "$debian_chroot" ]; then
|
||||
PROMPT="$bgc%{$fg[yellow]%}%B${debian_chroot}%b ${PROMPT}"
|
||||
fi
|
||||
|
||||
# ------------------------------
|
||||
# update the vcs_info_msg_ magic variables, but only as little as possible
|
||||
|
||||
# This variable dictates weather we are going to do the git prompt update
|
||||
# before printing the next prompt. On some setups this saves 10s of work.
|
||||
PR_GIT_UPDATE=1
|
||||
|
||||
# called before command excution
|
||||
# here we decide if we should update the prompt next time
|
||||
function zsh_git_prompt_preexec {
|
||||
case "$(history $HISTCMD)" in
|
||||
*git*)
|
||||
PR_GIT_UPDATE=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
preexec_functions+='zsh_git_prompt_preexec'
|
||||
|
||||
# called after directory change
|
||||
# we just assume that we have to update git prompt
|
||||
function zsh_git_prompt_chpwd {
|
||||
PR_GIT_UPDATE=1
|
||||
}
|
||||
chpwd_functions+='zsh_git_prompt_chpwd'
|
||||
|
||||
# called before prompt generation
|
||||
# if needed, we will update the prompt info
|
||||
function zsh_git_prompt_precmd {
|
||||
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
||||
vcs_info 'prompt'
|
||||
PR_GIT_UPDATE=
|
||||
fi
|
||||
}
|
||||
precmd_functions+='zsh_git_prompt_precmd'
|
||||
|
||||
# ------------------------------
|
||||
# handle vi NORMAL/INSERT mode change
|
||||
PR_VIMODE="#"
|
||||
PR_VICOLOR=${PR_BLUE}
|
||||
function zle-line-init zle-keymap-select {
|
||||
PR_VIMODE="${${KEYMAP/vicmd/¢}/(main|viins)/$}"
|
||||
PR_VICOLOR="${${KEYMAP/vicmd/${PR_RED}}/(main|viins)/${PR_GREEN}}"
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
|
||||
# ------------------------------
|
||||
# this stuff updates screen and xterm titles as the command runs
|
||||
|
||||
case $TERM in
|
||||
xterm* | rxvt* | urxvt*)
|
||||
function zsh_term_prompt_precmd {
|
||||
print -Pn "\e]0;%n@%m: %~\a"
|
||||
}
|
||||
function zsh_term_prompt_preexec {
|
||||
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
|
||||
print -Pn "\e]0;%n@%m: %~ $x\a"
|
||||
}
|
||||
preexec_functions+='zsh_term_prompt_preexec'
|
||||
precmd_functions+='zsh_term_prompt_precmd'
|
||||
;;
|
||||
screen*)
|
||||
function zsh_term_prompt_precmd {
|
||||
print -nR $'\033k'"zsh"$'\033'\\\
|
||||
|
||||
print -nR $'\033]0;'"zsh"$'\a'
|
||||
}
|
||||
function zsh_term_prompt_preexec {
|
||||
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
|
||||
print -nR $'\033k'"$x"$'\033'\\\
|
||||
|
||||
print -nR $'\033]0;'"$x"$'\a'
|
||||
}
|
||||
preexec_functions+='zsh_term_prompt_preexec'
|
||||
precmd_functions+='zsh_term_prompt_precmd'
|
||||
;;
|
||||
esac
|
||||
|
||||
160
.zsh/.zsh/aliases.zsh
Normal file
160
.zsh/.zsh/aliases.zsh
Normal file
@@ -0,0 +1,160 @@
|
||||
alias aliases='vim ~/.zsh/aliases.zsh'
|
||||
|
||||
# Push and pop directories on directory stack
|
||||
alias pu='pushd'
|
||||
alias po='popd'
|
||||
|
||||
# Super user
|
||||
alias _='sudo'
|
||||
alias sudo='sudo '
|
||||
alias fuck='sudo $(fc -ln -1)'
|
||||
|
||||
#alias g='grep -in'
|
||||
|
||||
# List direcory contents
|
||||
alias lsa='ls -lah'
|
||||
alias ll='ls -l'
|
||||
alias sl=ls
|
||||
alias lk='ls -lSr'
|
||||
alias ls='ls -c --color=auto --group-directories-first --quoting-style=shell'
|
||||
alias l='ls -lcnhF --color=auto --group-directories-first --quoting-style=shell'
|
||||
alias lc='ls -lcr'
|
||||
alias lg='ls | grep '
|
||||
alias lss='du -kh --max-depth=1 | sort -nr | more '
|
||||
# alias to avoid making mistakes:
|
||||
alias rm='rm -iv'
|
||||
alias cp='cp -iv'
|
||||
alias mv='mv -iv'
|
||||
|
||||
# ARCH
|
||||
# pacman shortcuts:
|
||||
# This one is dangerous!!
|
||||
alias pacman='pacaur'
|
||||
alias P="sudo pacman"
|
||||
alias S="P -S"
|
||||
alias Syu="P -Syu"
|
||||
alias Sd="P -Ss" #search in database
|
||||
alias Si="P -Qs" #search installed
|
||||
# display info about pkg
|
||||
#alias Si="P -Si"
|
||||
# list orphans
|
||||
alias lsorhpans='sudo pacman -Qqdt'
|
||||
# remove orphans
|
||||
alias rmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
# Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
# list local packages with size
|
||||
alias paclist="LC_ALL=C pacman -Qi | sed -n '/^Name[^:]*: \(.*\)/{s//\1 /;x};/^Installed[^:]*: \(.*\)/{s//\1/;H;x;s/\n//;p}' | sort -nk2"
|
||||
|
||||
# DEBIAN
|
||||
# apt-get Shortcuts
|
||||
alias acs='apt-cache search'
|
||||
alias agi='sudo apt-get install'
|
||||
alias agr='sudo apt-get remove'
|
||||
alias agu='sudo apt-get update'
|
||||
alias agg='sudo apt-get upgrade'
|
||||
alias sources='gksudo vim /etc/apt/sources.list'
|
||||
alias update='sudo apt-get update && sudo apt-get upgrade'
|
||||
|
||||
|
||||
alias ..="cd .."
|
||||
|
||||
alias reboot="sudo reboot"
|
||||
alias sdn="sudo shutdown -h now"
|
||||
alias hibernate="sudo pm-hibernate"
|
||||
|
||||
# brightness workaround
|
||||
alias br70='sudo setpci -s 00:02.0 F4.B=70'
|
||||
alias br40='sudo setpci -s 00:02.0 F4.B=40'
|
||||
alias br30='sudo setpci -s 00:02.0 F4.B=30'
|
||||
alias br20='sudo setpci -s 00:02.0 F4.B=20'
|
||||
alias br10='sudo setpci -s 00:02.0 F4.B=10'
|
||||
|
||||
|
||||
alias x="exit"
|
||||
|
||||
# Dateiendungen automatisch mit dem jeweiligen Programm öffnen
|
||||
alias -s html=$BROWSER
|
||||
alias -s png=eog
|
||||
alias -s jpg=eog
|
||||
alias -s org=$BROWSER
|
||||
alias -s php=$EDITOR
|
||||
alias -s com=$BROWSER
|
||||
alias -s net=$BROWSER
|
||||
alias -s gz=tar -xzvf
|
||||
alias -s bz2=tar -xjvf
|
||||
alias -s java=$EDITOR
|
||||
alias -s txt=$EDITOR
|
||||
alias -s PKGBUILD=$EDITOR
|
||||
|
||||
alias f='find |grep'
|
||||
alias c="clear"
|
||||
|
||||
# Krams
|
||||
|
||||
alias open="xdg-open"
|
||||
alias pg='ps aux|grep' # Prozess greppen -> pg name
|
||||
alias h='history'
|
||||
#alias du='du -kh' # lesbarer Output
|
||||
alias ps='ps auxf'
|
||||
alias x='exit'
|
||||
alias dd='dcfldd'
|
||||
alias subl='subl3'
|
||||
|
||||
alias reload='source ~/.zshrc'
|
||||
|
||||
alias xclip='xclip -selection clipboard'
|
||||
|
||||
# DJANGO
|
||||
alias ds="django-admin runserver"
|
||||
alias dp='export DJANGO_SETTINGS_MODULE=settings; export PYTHONPATH=$PWD;'
|
||||
|
||||
# GIT
|
||||
alias ga='git add'
|
||||
alias gaa='git add --all'
|
||||
alias gb='git branch'
|
||||
alias go='git checkout'
|
||||
alias gob='git checkout -b'
|
||||
alias gcl='git clone'
|
||||
alias gd='git diff --ignore-space-change '
|
||||
alias gdc='git diff --cached'
|
||||
alias gf='git fetch '
|
||||
alias gi='git init'
|
||||
alias gl='git log'
|
||||
alias gcm='git commit -m'
|
||||
alias gc='git commit -a'
|
||||
alias gme='git merge'
|
||||
alias gmt="git mergetool"
|
||||
alias gp='git push'
|
||||
alias gpu='git pull'
|
||||
alias gs='git status'
|
||||
alias shit='git'
|
||||
|
||||
# RAILS
|
||||
#bundler
|
||||
alias be='bundle exec '
|
||||
alias bi='bundle install '
|
||||
alias bu='bundle update '
|
||||
|
||||
#rails 3
|
||||
alias rc='rails console'
|
||||
alias rs='rails server'
|
||||
alias rdb='rails db'
|
||||
alias rdbm='rake db:migrate'
|
||||
alias rdbp='rails db:test:prepare'
|
||||
alias rg='rails generate '
|
||||
alias rgmi='rails generate migration '
|
||||
alias rgmo='rails generate model '
|
||||
alias gua='rake db:test:prepare; bundle exec guard'
|
||||
alias rr='rake routes | grep'
|
||||
|
||||
#fuck timestamps, open last migation by vim `lastmig`
|
||||
alias lastmig='echo db/migrate/`ls db/migrate -lt | head -n 2 | tail -n 1 | rev | cut -d " " -f 1 | rev`'
|
||||
|
||||
# APACHE
|
||||
alias arc="sudo /etc/init.d/apache2 reload"
|
||||
alias ars="sudo /etc/init.d/apache2 restart"
|
||||
|
||||
function cpstat() {
|
||||
rsync -ah --progress "$1" "$2"
|
||||
}
|
||||
0
.zsh/.zsh/cache
Normal file
0
.zsh/.zsh/cache
Normal file
13
.zsh/.zsh/dev-machine.zsh
Normal file
13
.zsh/.zsh/dev-machine.zsh
Normal file
@@ -0,0 +1,13 @@
|
||||
# fix VTE
|
||||
. /etc/profile.d/vte.sh
|
||||
|
||||
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
|
||||
source /etc/profile.d/vte.sh
|
||||
fi
|
||||
|
||||
# fix node.js
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
source /usr/share/nvm/nvm.sh
|
||||
source /usr/share/nvm/bash_completion
|
||||
source /usr/share/nvm/install-nvm-exec
|
||||
|
||||
59
.zsh/.zsh/functions/06_git
Normal file
59
.zsh/.zsh/functions/06_git
Normal file
@@ -0,0 +1,59 @@
|
||||
if [[ -x `which git` ]]; then
|
||||
alias g=git
|
||||
function git-branch-name () {
|
||||
git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //'
|
||||
}
|
||||
function git-dirty () {
|
||||
git status 2> /dev/null | grep "nothing to commit (working directory clean)"
|
||||
echo $?
|
||||
}
|
||||
function gsrb () {
|
||||
branch=$(git-branch-name)
|
||||
git checkout master
|
||||
git svn rebase
|
||||
git checkout "${branch}"
|
||||
git rebase master
|
||||
}
|
||||
function git-need-to-push() {
|
||||
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
|
||||
echo "â "
|
||||
fi
|
||||
}
|
||||
function git-prompt() {
|
||||
gstatus=$(git status 2> /dev/null)
|
||||
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
|
||||
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
|
||||
if [[ x$branch != x ]]; then
|
||||
dirty_color=$fg[green]
|
||||
push_status=$(git-need-to-push)
|
||||
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
|
||||
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
|
||||
fi
|
||||
}
|
||||
function git-scoreboard () {
|
||||
git log | grep '^Author' | sort | uniq -ci | sort -r
|
||||
}
|
||||
function git-track () {
|
||||
branch=$(git-branch-name)
|
||||
git config branch.$branch.remote origin
|
||||
git config branch.$branch.merge refs/heads/$branch
|
||||
echo "tracking origin/$tracking"
|
||||
}
|
||||
function github-init () {
|
||||
git config branch.$(git-branch-name).remote origin
|
||||
git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name)
|
||||
}
|
||||
|
||||
function github-url () {
|
||||
git config remote.origin.url | sed -En 's/git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'
|
||||
}
|
||||
|
||||
# Seems to be the best OS X jump-to-github alias from http://tinyurl.com/2mtncf
|
||||
function github-go () {
|
||||
open $(github-url)
|
||||
}
|
||||
|
||||
function nhgk () {
|
||||
nohup gitk --all &
|
||||
}
|
||||
fi
|
||||
3
.zsh/.zsh/functions/07_felix
Normal file
3
.zsh/.zsh/functions/07_felix
Normal file
@@ -0,0 +1,3 @@
|
||||
function cpstat() {
|
||||
rsync -ah --progress "$1" "$2"
|
||||
}
|
||||
64
.zsh/.zsh/git-prompt/gitstatus.py
Normal file
64
.zsh/.zsh/git-prompt/gitstatus.py
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
# change this symbol to whatever you prefer
|
||||
prehash = ':'
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
import sys
|
||||
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
|
||||
branch, error = gitsym.communicate()
|
||||
|
||||
error_string = error.decode('utf-8')
|
||||
|
||||
if 'fatal: Not a git repository' in error_string:
|
||||
sys.exit(0)
|
||||
|
||||
branch = branch.decode("utf-8").strip()[11:]
|
||||
|
||||
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
|
||||
err_string = err.decode('utf-8')
|
||||
if 'fatal' in err_string:
|
||||
sys.exit(0)
|
||||
changed_files = [namestat[0] for namestat in res.decode("utf-8").splitlines()]
|
||||
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
|
||||
nb_changed = len(changed_files) - changed_files.count('U')
|
||||
nb_U = staged_files.count('U')
|
||||
nb_staged = len(staged_files) - nb_U
|
||||
staged = str(nb_staged)
|
||||
conflicts = str(nb_U)
|
||||
changed = str(nb_changed)
|
||||
nb_untracked = len([0 for status in Popen(['git','status','--porcelain',],stdout=PIPE).communicate()[0].decode("utf-8").splitlines() if status.startswith('??')])
|
||||
untracked = str(nb_untracked)
|
||||
|
||||
ahead, behind = 0,0
|
||||
|
||||
if not branch: # not on any branch
|
||||
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
|
||||
else:
|
||||
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
|
||||
if remote_name:
|
||||
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
|
||||
if remote_name == '.': # local
|
||||
remote_ref = merge_name
|
||||
else:
|
||||
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
|
||||
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
|
||||
revlist = revgit.communicate()[0]
|
||||
if revgit.poll(): # fallback to local
|
||||
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
behead = revlist.decode("utf-8").splitlines()
|
||||
ahead = len([x for x in behead if x[0]=='>'])
|
||||
behind = len(behead) - ahead
|
||||
|
||||
out = ' '.join([
|
||||
branch,
|
||||
str(ahead),
|
||||
str(behind),
|
||||
staged,
|
||||
conflicts,
|
||||
changed,
|
||||
untracked,
|
||||
])
|
||||
print(out, end='')
|
||||
95
.zsh/.zsh/git-prompt/loader.sh
Normal file
95
.zsh/.zsh/git-prompt/loader.sh
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
# To install source this file from your .zshrc file
|
||||
|
||||
# Change this to reflect your installation directory
|
||||
export __GIT_PROMPT_DIR=~/.zsh/git-prompt
|
||||
# Initialize colors.
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
add-zsh-hook chpwd chpwd_update_git_vars
|
||||
add-zsh-hook preexec preexec_update_git_vars
|
||||
add-zsh-hook precmd precmd_update_git_vars
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ -n "$ZSH_THEME_GIT_PROMPT_NOCACHE" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(@f)_GIT_STATUS}")
|
||||
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
|
||||
GIT_REMOTE=$__CURRENT_GIT_STATUS[2]
|
||||
GIT_STAGED=$__CURRENT_GIT_STATUS[3]
|
||||
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[4]
|
||||
GIT_CHANGED=$__CURRENT_GIT_STATUS[5]
|
||||
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[6]
|
||||
GIT_CLEAN=$__CURRENT_GIT_STATUS[7]
|
||||
}
|
||||
|
||||
|
||||
git_super_status() {
|
||||
precmd_update_git_vars
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
STATUS="($GIT_BRANCH"
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
|
||||
if [ -n "$GIT_REMOTE" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_REMOTE$GIT_REMOTE%{${reset_color}%}"
|
||||
fi
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
|
||||
if [ "$GIT_STAGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CONFLICTS" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_UNTRACKED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CLEAN" -eq "1" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$STATUS"
|
||||
fi
|
||||
}
|
||||
|
||||
# Default values for the appearance of the prompt. Configure at will.
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
||||
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}✖"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}✚"
|
||||
ZSH_THEME_GIT_PROMPT_REMOTE=""
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
|
||||
|
||||
57
.zsh/.zsh/key-bindings.zsh
Normal file
57
.zsh/.zsh/key-bindings.zsh
Normal file
@@ -0,0 +1,57 @@
|
||||
# TODO: Explain what some of this does..
|
||||
|
||||
bindkey -e
|
||||
bindkey -s '^l' "|most\n" # c l pipe to most
|
||||
bindkey -s '^g' '|grep ""^[OD' # c g pipe to grep
|
||||
bindkey '\ew' kill-region
|
||||
bindkey -s '\el' "ls\n"
|
||||
bindkey -s '\ek' "..\n"
|
||||
bindkey -s '\ej' "cd -\n"
|
||||
bindkey -s '\eh' "cd $OLDPWD\n"
|
||||
bindkey -s '\e;' "pushd -1\n"
|
||||
bindkey -s '\ei' "dirs\n"
|
||||
bindkey -s '\eo' "popd\n"
|
||||
# Meta-u to chdir to the parent directory
|
||||
bindkey -s '\eu' '^Ucd ..\n'
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
bindkey "^[[5~" up-line-or-history
|
||||
bindkey "^[[6~" down-line-or-history
|
||||
|
||||
# make search up and down work, so partially type and hit up/down to find relevant stuff
|
||||
bindkey '^[[A' up-line-or-search
|
||||
bindkey '^[[B' down-line-or-search
|
||||
|
||||
bindkey "^[[H" beginning-of-line
|
||||
bindkey "^[[1~" beginning-of-line
|
||||
bindkey "^[[F" end-of-line
|
||||
bindkey "^[[4~" end-of-line
|
||||
bindkey ' ' magic-space # also do history expansion on space
|
||||
|
||||
bindkey '^[[Z' reverse-menu-complete
|
||||
|
||||
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
# alt+s inserts sudo at the beginning of the line
|
||||
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
|
||||
zle -N insert-sudo insert_sudo
|
||||
bindkey "^[s" insert-sudo
|
||||
# consider emacs keybindings:
|
||||
|
||||
#bindkey -e ## emacs key bindings
|
||||
#
|
||||
#bindkey '^[[A' up-line-or-search
|
||||
#bindkey '^[[B' down-line-or-search
|
||||
#bindkey '^[^[[C' emacs-forward-word
|
||||
#bindkey '^[^[[D' emacs-backward-word
|
||||
#
|
||||
#bindkey -s '^X^Z' '%-^M'
|
||||
#bindkey '^[e' expand-cmd-path
|
||||
#bindkey '^[^I' reverse-menu-complete
|
||||
#bindkey '^X^N' accept-and-infer-next-history
|
||||
#bindkey '^W' kill-region
|
||||
#bindkey '^I' complete-word
|
||||
## Fix weird sequence that rxvt produces
|
||||
#bindkey -s '^[[Z' '\t'
|
||||
#
|
||||
27
.zsh/.zsh/sunaku.zsh-theme
Normal file
27
.zsh/.zsh/sunaku.zsh-theme
Normal file
@@ -0,0 +1,27 @@
|
||||
# Git-centric variation of the "fishy" theme.
|
||||
# See screenshot at http://ompldr.org/vOHcwZg
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
local user_color='green'
|
||||
test $UID -eq 0 && user_color='red'
|
||||
|
||||
PROMPT='
|
||||
%(?..%{$fg_bold[red]%}exit %?
|
||||
%{$reset_color%})'\
|
||||
'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
|
||||
'$(git_prompt_info)'\
|
||||
'%{$fg[$user_color]%}%~%{$reset_color%}'\
|
||||
'%(!.#.>) '
|
||||
|
||||
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||
214
.zsh/S60_prompt
Normal file
214
.zsh/S60_prompt
Normal file
@@ -0,0 +1,214 @@
|
||||
#!/bin/zsh
|
||||
#
|
||||
# This file was written by Bart Trojanowski <bart@jukie.net>
|
||||
#
|
||||
# documented on my blog:
|
||||
# http://www.jukie.net/~bart/blog/tag/zsh
|
||||
#
|
||||
# references
|
||||
# http://www.zsh.org/mla/users/2006/msg01196.html
|
||||
# http://dotfiles.org/~frogb/.zshrc
|
||||
# http://kriener.org/articles/2009/06/04/zsh-prompt-magic
|
||||
|
||||
setopt prompt_subst
|
||||
autoload colors
|
||||
colors
|
||||
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# -------------------------------
|
||||
# define core prompt functions
|
||||
|
||||
# set some colors
|
||||
for COLOR in RED GREEN BLUE YELLOW WHITE BLACK CYAN; do
|
||||
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
|
||||
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
|
||||
done
|
||||
PR_RST="%{${reset_color}%}"
|
||||
PR_RESET="%{%b%s%u$reset_color%}"
|
||||
PR_BG="%{%(?.$PR_RESET.%S)%}"
|
||||
|
||||
# set formats
|
||||
# %b - branchname
|
||||
# %u - unstagedstr (see below)
|
||||
# %c - stangedstr (see below)
|
||||
# %a - action (e.g. rebase-i)
|
||||
# %R - repository path
|
||||
# %S - path in the repository
|
||||
FMT_BRANCH="${PR_GREEN}%b%u%c${PR_RST}" # e.g. master¹²
|
||||
FMT_ACTION="(${PR_CYAN}%a${PR_RST}%)" # e.g. (rebase-i)
|
||||
FMT_PATH="%R${PR_YELLOW}/%S" # e.g. ~/repo/subdir
|
||||
|
||||
# check-for-changes can be really slow.
|
||||
# you should disable it, if you work with large repositories
|
||||
zstyle ':vcs_info:*:prompt:*' check-for-changes true
|
||||
zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
|
||||
zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
|
||||
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}//" "${FMT_PATH}"
|
||||
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}//" "${FMT_PATH}"
|
||||
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
|
||||
|
||||
function lprompt {
|
||||
local brackets=$1
|
||||
local color1=$2
|
||||
local color2=$3
|
||||
|
||||
local bracket_open="${color1}${brackets[1]}${PR_BG}"
|
||||
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
|
||||
|
||||
local git='$vcs_info_msg_0_'
|
||||
local cwd="${color2}%B%1~%b"
|
||||
|
||||
local vimode='${PR_VIMODE}'
|
||||
local vicol='${PR_VICOLOR}'
|
||||
|
||||
#PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
|
||||
PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
|
||||
}
|
||||
|
||||
function rprompt {
|
||||
local brackets=$1
|
||||
local color1=$2
|
||||
local color2=$3
|
||||
|
||||
local bracket_open="${color1}${brackets[1]}${PR_RESET}"
|
||||
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
|
||||
local colon="${color1}:"
|
||||
local at="${color1}@${PR_RESET}"
|
||||
|
||||
local user_host="${color2}%n${at}${color2}%m"
|
||||
local vcs_cwd='${${vcs_info_msg_1_%%.}/$HOME/~}'
|
||||
local cwd="${color2}%B%20<..<${vcs_cwd}%<<%b"
|
||||
local inner="${user_host}${colon}${cwd}"
|
||||
|
||||
RPROMPT="${PR_RESET}${bracket_open}${inner}${bracket_close}${PR_RESET}"
|
||||
}
|
||||
|
||||
# -------------------------------
|
||||
# host dependent colouring
|
||||
|
||||
#lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
#rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
|
||||
if [ $UID -eq 0 ]; then
|
||||
lprompt '<>' $PR_RED $PR_RED
|
||||
rprompt '<>' $PR_RED $PR_RED
|
||||
else
|
||||
case $HOST in
|
||||
xenon)
|
||||
lprompt '[]' $PR_BRIGHT_BLACK $PR_GREEN
|
||||
rprompt '()' $PR_YELLOW $PR_WHITE
|
||||
;;
|
||||
oxygen*)
|
||||
lprompt '[]' $PR_WHITE $PR_GREEN
|
||||
rprompt '()' $PR_YELLOW $PR_WHITE
|
||||
;;
|
||||
|
||||
meson*)
|
||||
lprompt '<>' $PR_RED $PR_YELLOW
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
muon*)
|
||||
lprompt '<>' $PR_RED $PR_BLUE
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
quark*)
|
||||
lprompt '<>' $PR_RED $PR_GREEN
|
||||
rprompt '<>' $PR_RED $PR_WHITE
|
||||
;;
|
||||
|
||||
*)
|
||||
if [ "${$(hostname -f)#*.}" = "jukie.net" ]; then
|
||||
lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
|
||||
else
|
||||
lprompt '{}' $PR_WHITE $PR_WHITE
|
||||
rprompt '()' $PR_WHITE $PR_WHITE
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "$debian_chroot" ]; then
|
||||
PROMPT="$bgc%{$fg[yellow]%}%B${debian_chroot}%b ${PROMPT}"
|
||||
fi
|
||||
|
||||
# ------------------------------
|
||||
# update the vcs_info_msg_ magic variables, but only as little as possible
|
||||
|
||||
# This variable dictates weather we are going to do the git prompt update
|
||||
# before printing the next prompt. On some setups this saves 10s of work.
|
||||
PR_GIT_UPDATE=1
|
||||
|
||||
# called before command excution
|
||||
# here we decide if we should update the prompt next time
|
||||
function zsh_git_prompt_preexec {
|
||||
case "$(history $HISTCMD)" in
|
||||
*git*)
|
||||
PR_GIT_UPDATE=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
preexec_functions+='zsh_git_prompt_preexec'
|
||||
|
||||
# called after directory change
|
||||
# we just assume that we have to update git prompt
|
||||
function zsh_git_prompt_chpwd {
|
||||
PR_GIT_UPDATE=1
|
||||
}
|
||||
chpwd_functions+='zsh_git_prompt_chpwd'
|
||||
|
||||
# called before prompt generation
|
||||
# if needed, we will update the prompt info
|
||||
function zsh_git_prompt_precmd {
|
||||
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
||||
vcs_info 'prompt'
|
||||
PR_GIT_UPDATE=
|
||||
fi
|
||||
}
|
||||
precmd_functions+='zsh_git_prompt_precmd'
|
||||
|
||||
# ------------------------------
|
||||
# handle vi NORMAL/INSERT mode change
|
||||
PR_VIMODE="#"
|
||||
PR_VICOLOR=${PR_BLUE}
|
||||
function zle-line-init zle-keymap-select {
|
||||
PR_VIMODE="${${KEYMAP/vicmd/¢}/(main|viins)/$}"
|
||||
PR_VICOLOR="${${KEYMAP/vicmd/${PR_RED}}/(main|viins)/${PR_GREEN}}"
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
|
||||
# ------------------------------
|
||||
# this stuff updates screen and xterm titles as the command runs
|
||||
|
||||
case $TERM in
|
||||
xterm* | rxvt* | urxvt*)
|
||||
function zsh_term_prompt_precmd {
|
||||
print -Pn "\e]0;%n@%m: %~\a"
|
||||
}
|
||||
function zsh_term_prompt_preexec {
|
||||
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
|
||||
print -Pn "\e]0;%n@%m: %~ $x\a"
|
||||
}
|
||||
preexec_functions+='zsh_term_prompt_preexec'
|
||||
precmd_functions+='zsh_term_prompt_precmd'
|
||||
;;
|
||||
screen*)
|
||||
function zsh_term_prompt_precmd {
|
||||
print -nR $'\033k'"zsh"$'\033'\\\
|
||||
|
||||
print -nR $'\033]0;'"zsh"$'\a'
|
||||
}
|
||||
function zsh_term_prompt_preexec {
|
||||
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
|
||||
print -nR $'\033k'"$x"$'\033'\\\
|
||||
|
||||
print -nR $'\033]0;'"$x"$'\a'
|
||||
}
|
||||
preexec_functions+='zsh_term_prompt_preexec'
|
||||
precmd_functions+='zsh_term_prompt_precmd'
|
||||
;;
|
||||
esac
|
||||
|
||||
159
.zsh/aliases.zsh
Normal file
159
.zsh/aliases.zsh
Normal file
@@ -0,0 +1,159 @@
|
||||
alias aliases='vim ~/.zsh/aliases.zsh'
|
||||
|
||||
# Push and pop directories on directory stack
|
||||
alias pu='pushd'
|
||||
alias po='popd'
|
||||
|
||||
# Super user
|
||||
alias _='sudo'
|
||||
alias sudo='sudo '
|
||||
alias fuck='sudo $(fc -ln -1)'
|
||||
|
||||
#alias g='grep -in'
|
||||
|
||||
# List direcory contents
|
||||
alias lsa='ls -lah'
|
||||
alias ll='ls -l'
|
||||
alias sl=ls
|
||||
alias lk='ls -lSr'
|
||||
alias ls='ls -c --color=auto --group-directories-first --quoting-style=shell'
|
||||
alias l='ls -lcnhF --color=auto --group-directories-first --quoting-style=shell'
|
||||
alias lc='ls -lcr'
|
||||
alias lg='ls | grep '
|
||||
alias lss='du -kh --max-depth=1 | sort -nr | more '
|
||||
# alias to avoid making mistakes:
|
||||
alias rm='rm -iv'
|
||||
alias cp='cp -iv'
|
||||
alias mv='mv -iv'
|
||||
|
||||
# ARCH
|
||||
# pacman shortcuts:
|
||||
# This one is dangerous!!
|
||||
alias pacman='pacaur'
|
||||
alias P="sudo pacman"
|
||||
alias S="P -S"
|
||||
alias Syu="P -Syu"
|
||||
alias Sd="P -Ss" #search in database
|
||||
alias Si="P -Qs" #search installed
|
||||
# display info about pkg
|
||||
#alias Si="P -Si"
|
||||
# list orphans
|
||||
alias lsorhpans='sudo pacman -Qqdt'
|
||||
# remove orphans
|
||||
alias rmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
# Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
# list local packages with size
|
||||
alias paclist="LC_ALL=C pacman -Qi | sed -n '/^Name[^:]*: \(.*\)/{s//\1 /;x};/^Installed[^:]*: \(.*\)/{s//\1/;H;x;s/\n//;p}' | sort -nk2"
|
||||
|
||||
# DEBIAN
|
||||
# apt-get Shortcuts
|
||||
alias acs='apt-cache search'
|
||||
alias agi='sudo apt-get install'
|
||||
alias agr='sudo apt-get remove'
|
||||
alias agu='sudo apt-get update'
|
||||
alias agg='sudo apt-get upgrade'
|
||||
alias sources='gksudo vim /etc/apt/sources.list'
|
||||
alias update='sudo apt-get update && sudo apt-get upgrade'
|
||||
|
||||
|
||||
alias ..="cd .."
|
||||
|
||||
alias reboot="sudo reboot"
|
||||
alias sdn="sudo shutdown -h now"
|
||||
alias hibernate="sudo pm-hibernate"
|
||||
|
||||
# brightness workaround
|
||||
alias br70='sudo setpci -s 00:02.0 F4.B=70'
|
||||
alias br40='sudo setpci -s 00:02.0 F4.B=40'
|
||||
alias br30='sudo setpci -s 00:02.0 F4.B=30'
|
||||
alias br20='sudo setpci -s 00:02.0 F4.B=20'
|
||||
alias br10='sudo setpci -s 00:02.0 F4.B=10'
|
||||
|
||||
|
||||
alias x="exit"
|
||||
|
||||
# Dateiendungen automatisch mit dem jeweiligen Programm öffnen
|
||||
alias -s html=$BROWSER
|
||||
alias -s png=eog
|
||||
alias -s jpg=eog
|
||||
alias -s org=$BROWSER
|
||||
alias -s php=$EDITOR
|
||||
alias -s com=$BROWSER
|
||||
alias -s net=$BROWSER
|
||||
alias -s gz=tar -xzvf
|
||||
alias -s bz2=tar -xjvf
|
||||
alias -s java=$EDITOR
|
||||
alias -s txt=$EDITOR
|
||||
alias -s PKGBUILD=$EDITOR
|
||||
|
||||
alias f='find |grep'
|
||||
alias c="clear"
|
||||
|
||||
# Krams
|
||||
|
||||
alias open="xdg-open"
|
||||
alias pg='ps aux|grep' # Prozess greppen -> pg name
|
||||
alias h='history'
|
||||
#alias du='du -kh' # lesbarer Output
|
||||
alias ps='ps auxf'
|
||||
alias x='exit'
|
||||
alias dd='dcfldd'
|
||||
alias subl='subl3'
|
||||
|
||||
alias reload='source ~/.zshrc'
|
||||
|
||||
alias xclip='xclip -selection clipboard'
|
||||
|
||||
|
||||
# GIT
|
||||
alias ga='git add'
|
||||
alias gaa='git add --all'
|
||||
alias gb='git branch'
|
||||
alias go='git checkout'
|
||||
alias gob='git checkout -b'
|
||||
alias gcl='git clone'
|
||||
alias gd='git diff --ignore-space-change '
|
||||
alias gdc='git diff --cached'
|
||||
alias gf='git fetch '
|
||||
alias gi='git init'
|
||||
alias gl='git log'
|
||||
alias gcm='git commit -m'
|
||||
alias gc='git commit -a'
|
||||
alias gme='git merge'
|
||||
alias gmt="git mergetool"
|
||||
alias gp='git push'
|
||||
alias gpu='git pull'
|
||||
alias shit='git'
|
||||
|
||||
alias dots='git --git-dir=$HOME/sources/dots/ --work-tree=$HOME'
|
||||
|
||||
|
||||
# RAILS
|
||||
#bundler
|
||||
alias be='bundle exec '
|
||||
alias bi='bundle install '
|
||||
alias bu='bundle update '
|
||||
|
||||
#rails 3
|
||||
alias rc='rails console'
|
||||
alias rs='rails server'
|
||||
alias rdb='rails db'
|
||||
alias rdbm='rake db:migrate'
|
||||
alias rdbp='rails db:test:prepare'
|
||||
alias rg='rails generate '
|
||||
alias rgmi='rails generate migration '
|
||||
alias rgmo='rails generate model '
|
||||
alias gua='rake db:test:prepare; bundle exec guard'
|
||||
alias rr='rake routes | grep'
|
||||
|
||||
#fuck timestamps, open last migation by vim `lastmig`
|
||||
alias lastmig='echo db/migrate/`ls db/migrate -lt | head -n 2 | tail -n 1 | rev | cut -d " " -f 1 | rev`'
|
||||
|
||||
# APACHE
|
||||
alias arc="sudo /etc/init.d/apache2 reload"
|
||||
alias ars="sudo /etc/init.d/apache2 restart"
|
||||
|
||||
function cpstat() {
|
||||
rsync -ah --progress "$1" "$2"
|
||||
}
|
||||
0
.zsh/cache
Normal file
0
.zsh/cache
Normal file
59
.zsh/functions/06_git
Normal file
59
.zsh/functions/06_git
Normal file
@@ -0,0 +1,59 @@
|
||||
if [[ -x `which git` ]]; then
|
||||
alias g=git
|
||||
function git-branch-name () {
|
||||
git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //'
|
||||
}
|
||||
function git-dirty () {
|
||||
git status 2> /dev/null | grep "nothing to commit (working directory clean)"
|
||||
echo $?
|
||||
}
|
||||
function gsrb () {
|
||||
branch=$(git-branch-name)
|
||||
git checkout master
|
||||
git svn rebase
|
||||
git checkout "${branch}"
|
||||
git rebase master
|
||||
}
|
||||
function git-need-to-push() {
|
||||
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
|
||||
echo "â "
|
||||
fi
|
||||
}
|
||||
function git-prompt() {
|
||||
gstatus=$(git status 2> /dev/null)
|
||||
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
|
||||
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
|
||||
if [[ x$branch != x ]]; then
|
||||
dirty_color=$fg[green]
|
||||
push_status=$(git-need-to-push)
|
||||
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
|
||||
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
|
||||
fi
|
||||
}
|
||||
function git-scoreboard () {
|
||||
git log | grep '^Author' | sort | uniq -ci | sort -r
|
||||
}
|
||||
function git-track () {
|
||||
branch=$(git-branch-name)
|
||||
git config branch.$branch.remote origin
|
||||
git config branch.$branch.merge refs/heads/$branch
|
||||
echo "tracking origin/$tracking"
|
||||
}
|
||||
function github-init () {
|
||||
git config branch.$(git-branch-name).remote origin
|
||||
git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name)
|
||||
}
|
||||
|
||||
function github-url () {
|
||||
git config remote.origin.url | sed -En 's/git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'
|
||||
}
|
||||
|
||||
# Seems to be the best OS X jump-to-github alias from http://tinyurl.com/2mtncf
|
||||
function github-go () {
|
||||
open $(github-url)
|
||||
}
|
||||
|
||||
function nhgk () {
|
||||
nohup gitk --all &
|
||||
}
|
||||
fi
|
||||
3
.zsh/functions/07_felix
Normal file
3
.zsh/functions/07_felix
Normal file
@@ -0,0 +1,3 @@
|
||||
function cpstat() {
|
||||
rsync -ah --progress "$1" "$2"
|
||||
}
|
||||
63
.zsh/git-prompt/gitstatus.py
Normal file
63
.zsh/git-prompt/gitstatus.py
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
# change this symbol to whatever you prefer
|
||||
prehash = ':'
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
import sys
|
||||
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
|
||||
branch, error = gitsym.communicate()
|
||||
|
||||
error_string = error.decode('utf-8')
|
||||
if 'fatal: not a git repository' in error_string:
|
||||
sys.exit(0)
|
||||
|
||||
branch = branch.decode("utf-8").strip()[11:]
|
||||
|
||||
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
|
||||
err_string = err.decode('utf-8')
|
||||
if 'fatal' in err_string:
|
||||
sys.exit(0)
|
||||
changed_files = [namestat[0] for namestat in res.decode("utf-8").splitlines()]
|
||||
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
|
||||
nb_changed = len(changed_files) - changed_files.count('U')
|
||||
nb_U = staged_files.count('U')
|
||||
nb_staged = len(staged_files) - nb_U
|
||||
staged = str(nb_staged)
|
||||
conflicts = str(nb_U)
|
||||
changed = str(nb_changed)
|
||||
nb_untracked = len([0 for status in Popen(['git','status','--porcelain',],stdout=PIPE).communicate()[0].decode("utf-8").splitlines() if status.startswith('??')])
|
||||
untracked = str(nb_untracked)
|
||||
|
||||
ahead, behind = 0,0
|
||||
|
||||
if not branch: # not on any branch
|
||||
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
|
||||
else:
|
||||
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
|
||||
if remote_name:
|
||||
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
|
||||
if remote_name == '.': # local
|
||||
remote_ref = merge_name
|
||||
else:
|
||||
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
|
||||
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
|
||||
revlist = revgit.communicate()[0]
|
||||
if revgit.poll(): # fallback to local
|
||||
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
behead = revlist.decode("utf-8").splitlines()
|
||||
ahead = len([x for x in behead if x[0]=='>'])
|
||||
behind = len(behead) - ahead
|
||||
|
||||
out = ' '.join([
|
||||
branch,
|
||||
str(ahead),
|
||||
str(behind),
|
||||
staged,
|
||||
conflicts,
|
||||
changed,
|
||||
untracked,
|
||||
])
|
||||
print(out, end='')
|
||||
95
.zsh/git-prompt/loader.sh
Normal file
95
.zsh/git-prompt/loader.sh
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
# To install source this file from your .zshrc file
|
||||
|
||||
# Change this to reflect your installation directory
|
||||
export __GIT_PROMPT_DIR=~/.zsh/git-prompt
|
||||
# Initialize colors.
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
add-zsh-hook chpwd chpwd_update_git_vars
|
||||
add-zsh-hook preexec preexec_update_git_vars
|
||||
add-zsh-hook precmd precmd_update_git_vars
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ -n "$ZSH_THEME_GIT_PROMPT_NOCACHE" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(@f)_GIT_STATUS}")
|
||||
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
|
||||
GIT_REMOTE=$__CURRENT_GIT_STATUS[2]
|
||||
GIT_STAGED=$__CURRENT_GIT_STATUS[3]
|
||||
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[4]
|
||||
GIT_CHANGED=$__CURRENT_GIT_STATUS[5]
|
||||
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[6]
|
||||
GIT_CLEAN=$__CURRENT_GIT_STATUS[7]
|
||||
}
|
||||
|
||||
|
||||
git_super_status() {
|
||||
precmd_update_git_vars
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
STATUS="($GIT_BRANCH"
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
|
||||
if [ -n "$GIT_REMOTE" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_REMOTE$GIT_REMOTE%{${reset_color}%}"
|
||||
fi
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
|
||||
if [ "$GIT_STAGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CONFLICTS" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_UNTRACKED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CLEAN" -eq "1" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$STATUS"
|
||||
fi
|
||||
}
|
||||
|
||||
# Default values for the appearance of the prompt. Configure at will.
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
||||
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}✖"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}✚"
|
||||
ZSH_THEME_GIT_PROMPT_REMOTE=""
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
|
||||
|
||||
56
.zsh/key-bindings.zsh
Normal file
56
.zsh/key-bindings.zsh
Normal file
@@ -0,0 +1,56 @@
|
||||
# TODO: Explain what some of this does..
|
||||
|
||||
bindkey -e
|
||||
bindkey -s '^g' '|grep ""^[OD' # c g pipe to grep
|
||||
bindkey '\ew' kill-region
|
||||
bindkey -s '\el' "ls\n"
|
||||
bindkey -s '\ek' "..\n"
|
||||
bindkey -s '\ej' "cd -\n"
|
||||
bindkey -s '\eh' "cd $OLDPWD\n"
|
||||
bindkey -s '\e;' "pushd -1\n"
|
||||
bindkey -s '\ei' "dirs\n"
|
||||
bindkey -s '\eo' "popd\n"
|
||||
# Meta-u to chdir to the parent directory
|
||||
bindkey -s '\eu' '^Ucd ..\n'
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
bindkey "^[[5~" up-line-or-history
|
||||
bindkey "^[[6~" down-line-or-history
|
||||
|
||||
# make search up and down work, so partially type and hit up/down to find relevant stuff
|
||||
bindkey '^[[A' up-line-or-search
|
||||
bindkey '^[[B' down-line-or-search
|
||||
|
||||
bindkey "^[[H" beginning-of-line
|
||||
bindkey "^[[1~" beginning-of-line
|
||||
bindkey "^[[F" end-of-line
|
||||
bindkey "^[[4~" end-of-line
|
||||
bindkey ' ' magic-space # also do history expansion on space
|
||||
|
||||
bindkey '^[[Z' reverse-menu-complete
|
||||
|
||||
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
# alt+s inserts sudo at the beginning of the line
|
||||
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
|
||||
zle -N insert-sudo insert_sudo
|
||||
bindkey "^[s" insert-sudo
|
||||
# consider emacs keybindings:
|
||||
|
||||
#bindkey -e ## emacs key bindings
|
||||
#
|
||||
#bindkey '^[[A' up-line-or-search
|
||||
#bindkey '^[[B' down-line-or-search
|
||||
#bindkey '^[^[[C' emacs-forward-word
|
||||
#bindkey '^[^[[D' emacs-backward-word
|
||||
#
|
||||
#bindkey -s '^X^Z' '%-^M'
|
||||
#bindkey '^[e' expand-cmd-path
|
||||
#bindkey '^[^I' reverse-menu-complete
|
||||
#bindkey '^X^N' accept-and-infer-next-history
|
||||
#bindkey '^W' kill-region
|
||||
#bindkey '^I' complete-word
|
||||
## Fix weird sequence that rxvt produces
|
||||
#bindkey -s '^[[Z' '\t'
|
||||
#
|
||||
27
.zsh/sunaku.zsh-theme
Normal file
27
.zsh/sunaku.zsh-theme
Normal file
@@ -0,0 +1,27 @@
|
||||
# Git-centric variation of the "fishy" theme.
|
||||
# See screenshot at http://ompldr.org/vOHcwZg
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
local user_color='green'
|
||||
test $UID -eq 0 && user_color='red'
|
||||
|
||||
PROMPT='
|
||||
%(?..%{$fg_bold[red]%}exit %?
|
||||
%{$reset_color%})'\
|
||||
'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
|
||||
'$(git_prompt_info)'\
|
||||
'%{$fg[$user_color]%}%~%{$reset_color%}'\
|
||||
'%(!.#.>) '
|
||||
|
||||
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||
224
.zshrc
Normal file
224
.zshrc
Normal file
@@ -0,0 +1,224 @@
|
||||
##### ENVIRONMENT
|
||||
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/felix/bin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/home/felix/.gem/ruby/2.3.0/bin:/usr/bin/core_perl/:/home/felix/.mos/bin/:/home/felix/.gem/ruby/2.5.0/bin
|
||||
|
||||
export LANG=en_US.UTF-8
|
||||
export EDITOR='code'
|
||||
export GIT_EDITOR='code'
|
||||
export PAGER='most'
|
||||
export SHELL="/bin/zsh"
|
||||
export BROWSER='google-chrome-unstable'
|
||||
|
||||
# colors for less without compiled termcap files (curses feature)
|
||||
export LESS_TERMCAP_mb=$'\e[01;31m'
|
||||
export LESS_TERMCAP_md=$'\e[01;31m'
|
||||
export LESS_TERMCAP_me=$'\e[0m'
|
||||
export LESS_TERMCAP_se=$'\e[0m'
|
||||
export LESS_TERMCAP_so=$'\e[01;44;33m'
|
||||
export LESS_TERMCAP_ue=$'\e[0m'
|
||||
export LESS_TERMCAP_us=$'\e[01;32m'
|
||||
|
||||
export LESS=XFRaeiM # the XFR is important here: don't mess with the terminal!export LESS=-cex3M
|
||||
export HELPDIR=/usr/local/lib/zsh/help
|
||||
|
||||
# jetzt ist / Wortseperator, also path/file strg w loescht nur noch bis zum /, nicht mehr den gesamten pfad.
|
||||
WORDCHARS=${WORDCHARS//[&=\/;!#%]_/}
|
||||
|
||||
bindkey -e #emacs navi
|
||||
|
||||
bindkey '5D' emacs-backward-word
|
||||
bindkey '5C' emacs-forward-word
|
||||
|
||||
setopt correctall
|
||||
setopt autopushd pushdminus pushd_ignore_dups
|
||||
setopt ignoreeof
|
||||
setopt interactivecomments
|
||||
setopt noclobber
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
setopt HIST_IGNORE_SPACE
|
||||
setopt SH_WORD_SPLIT
|
||||
setopt nohup
|
||||
setopt NO_CASE_GLOB # Globbing ist nicht mehr casesensitive
|
||||
setopt ZLE
|
||||
setopt kshglob
|
||||
|
||||
setopt AUTO_CD # cd if no matching command
|
||||
setopt AUTO_PARAM_SLASH # adds slash at end of tabbed dirs
|
||||
setopt CHECK_JOBS # check bg jobs on exit
|
||||
#setopt CORRECT # corrects spelling
|
||||
setopt EXTENDED_GLOB # globs #, ~ and ^
|
||||
#setopt EXTENDED_HISTORY # saves timestamps on history
|
||||
#setopt GLOB_DOTS # find dotfiles easier
|
||||
setopt HASH_CMDS # save cmd location to skip PATH lookup
|
||||
#setopt HIST_EXPIRE_DUPS_FIRST # expire duped history first
|
||||
#setopt HIST_NO_STORE # don't save 'history' cmd in history
|
||||
#setopt INC_APPEND_HISTORY # append history as command are entered
|
||||
#setopt LIST_ROWS_FIRST # completion options left-to-right, top-to-bottom
|
||||
setopt LIST_TYPES # show file types in list
|
||||
setopt MARK_DIRS # adds slash to end of completed dirs
|
||||
setopt NUMERIC_GLOB_SORT # sort numerically first, before alpha
|
||||
setopt PROMPT_SUBST # sub values in prompt (though it seems to work anyway haha)
|
||||
#setopt SHARE_HISTORY # share history between open shells
|
||||
# Don't overwrite, append!
|
||||
setopt APPEND_HISTORY
|
||||
|
||||
# Write after each command
|
||||
# setopt INC_APPEND_HISTORY
|
||||
|
||||
# Killer: share history between multiple shells
|
||||
setopt SHARE_HISTORY
|
||||
|
||||
# If I type cd and then cd again, only save the last one
|
||||
setopt HIST_IGNORE_DUPS
|
||||
|
||||
# Even if there are commands inbetween commands that are the same, still only save the last one
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
|
||||
# Pretty Obvious. Right?
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
|
||||
# If a line starts with a space, don't save it.
|
||||
setopt HIST_IGNORE_SPACE
|
||||
setopt HIST_NO_STORE
|
||||
|
||||
# When using a hist thing, make a newline show the change before executing it.
|
||||
setopt HIST_VERIFY
|
||||
|
||||
# Save the time and how long a command ran
|
||||
setopt EXTENDED_HISTORY
|
||||
|
||||
setopt HIST_SAVE_NO_DUPS
|
||||
setopt HIST_EXPIRE_DUPS_FIRST
|
||||
setopt HIST_FIND_NO_DUPS
|
||||
|
||||
##### COMPLETION
|
||||
|
||||
# die Completion aktivieren
|
||||
zmodload zsh/complist
|
||||
autoload -U compinit
|
||||
compinit
|
||||
|
||||
|
||||
#{{{ Completion Stuff
|
||||
|
||||
bindkey -M viins '\C-i' complete-word
|
||||
|
||||
# Faster! (?)
|
||||
zstyle ':completion::complete:*' use-cache 1
|
||||
|
||||
# case insensitive completion
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||
|
||||
zstyle ':completion:*' verbose yes
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
zstyle ':completion:*:messages' format '%d'
|
||||
zstyle ':completion:*:warnings' format 'No matches for: %d'
|
||||
zstyle ':completion:*' group-name ''
|
||||
|
||||
# generate descriptions with magic.
|
||||
zstyle ':completion:*' auto-description 'specify: %d'
|
||||
|
||||
# Don't prompt for a huge list, page it!
|
||||
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
|
||||
|
||||
# Have the newer files last so I see them first
|
||||
zstyle ':completion:*' file-sort modification reverse
|
||||
|
||||
# color code completion!!!! Wohoo!
|
||||
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
|
||||
|
||||
unsetopt LIST_AMBIGUOUS
|
||||
setopt COMPLETE_IN_WORD
|
||||
|
||||
# Separate man page sections. Neat.
|
||||
zstyle ':completion:*:manuals' separate-sections true
|
||||
|
||||
# Egomaniac!
|
||||
zstyle ':completion:*' list-separator 'fREW'
|
||||
|
||||
# complete with a menu for xwindow ids
|
||||
zstyle ':completion:*:windows' menu on=0
|
||||
zstyle ':completion:*:expand:*' tag-order all-expansions
|
||||
|
||||
# more errors allowed for large words and fewer for small words
|
||||
zstyle ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) )'
|
||||
|
||||
# Errors format
|
||||
zstyle ':completion:*:corrections' format '%B%d (errors %e)%b'
|
||||
|
||||
# Don't complete stuff already on the line
|
||||
zstyle ':completion::*:(rm|vi):*' ignore-line true
|
||||
|
||||
# Don't complete directory we are already in (../here)
|
||||
zstyle ':completion:*' ignore-parents parent pwd
|
||||
|
||||
#zstyle ':completion::approximate*:*' prefix-needed false
|
||||
|
||||
##### History
|
||||
|
||||
HISTFILE=$HOME/.zsh_history
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
HOSTNAME="`hostname`"
|
||||
REPORTTIME=120 # print elapsed time when more than 10 seconds
|
||||
|
||||
##### PROMPT
|
||||
|
||||
# %T System time (HH:MM)
|
||||
# %* System time (HH:MM:SS)
|
||||
# %D System date (YY-MM-DD)
|
||||
# %n Your username
|
||||
# %B - %b Begin - end bold print
|
||||
# %U - %u Begin - end underlining
|
||||
# %d Your current working directory
|
||||
# %~ Your current working directory, relative to ~
|
||||
# %M The computer's hostname
|
||||
# %m The computer's hostname (truncated before the first period)
|
||||
# %l Your current tty
|
||||
|
||||
|
||||
# configure the following, or leave it commented out:
|
||||
#PROMPT=$' %B%{$fg[white]%}%~%b $(__git_prompt) %# '
|
||||
#setopt prompt_subst
|
||||
|
||||
#export RPS1='%{$fg[white]%}%n%{$fg[cyan]%}%m%{$reset_color%}'
|
||||
|
||||
|
||||
##### WINDOW TITLE
|
||||
|
||||
case $TERM in
|
||||
*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term)
|
||||
precmd () { print -Pn "\e]0;zsh %~\a" }
|
||||
#preexec () { print -Pn "\e]0;zsh %~ ($1)\a" }
|
||||
;;
|
||||
screen)
|
||||
precmd () {
|
||||
print -Pn "\e]83;title \"$1\"\a"
|
||||
print -Pn "\e]0;$TERM - (%L) zsh %~\a"
|
||||
}
|
||||
#preexec () {
|
||||
#print -Pn "\e]83;title \"$1\"\a"
|
||||
#print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a"
|
||||
#}
|
||||
;;
|
||||
esac
|
||||
|
||||
source ~/.zsh/aliases.zsh
|
||||
source ~/.zsh/key-bindings.zsh
|
||||
alias :q='exit'
|
||||
|
||||
source ~/.zsh/git-prompt/loader.sh
|
||||
#PROMPT='%* %B%{[0;36m%}%n%{[0;34m%}@%m %{[0;33m%}%~%b $(git_super_status) %# '
|
||||
# underline hostname
|
||||
PROMPT='%* %B%{[0;36m%}%n%{[0;34m%}@%U%m%u %{[0;33m%}%~%b $(git_super_status) %# '
|
||||
|
||||
# stuff for development (e.g. nvm)
|
||||
if [ "$(hostname)" = "x230" ]; then
|
||||
source ~/.zsh/dev-machine.zsh
|
||||
fi
|
||||
|
||||
numlockx on
|
||||
|
||||
if [ -z "$DISPLAY" -a $XDG_VTNR -eq 1 ]; then
|
||||
startx
|
||||
fi
|
||||
|
||||
44
bin/apptosink
Executable file
44
bin/apptosink
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Program list
|
||||
programs_name=$(pactl list sink-inputs | grep -Po 'binary = "\K[^"]*')
|
||||
|
||||
programs_index=$(pactl list sink-inputs | grep -Po '(?<=Sink Input #).*')
|
||||
|
||||
# Sink list
|
||||
sinks_name=$(pactl list sinks | grep -Po 'Description: \K.*')
|
||||
|
||||
sinks_index=$(pactl list sinks | grep -Po '(?<=Sink #).*')
|
||||
|
||||
# Format values n' what not
|
||||
IFS=$'\n' p_n_db=($programs_name)
|
||||
p_n_size=${#p_n_db[@]}+1
|
||||
|
||||
IFS=$'\n' p_i_db=($programs_index)
|
||||
p_i_count=${#p_i_db[@]}
|
||||
|
||||
IFS=$'\n' s_n_db=($sinks_name)
|
||||
s_n_size=${#s_n_db[@]}+1
|
||||
|
||||
IFS=$'\n' s_i_db=($sinks_index)
|
||||
s_i_count=${#s_i_db[@]}
|
||||
|
||||
ret_prog=$(printf '%s' "$programs_name" | rofi -dmenu -l $p_n_size)
|
||||
|
||||
ret_sink=$(printf '%s' "$sinks_name" | rofi -dmenu -l $s_n_size)
|
||||
|
||||
# Get indexes of ret_prog and ret_sink in *_name_db
|
||||
for (( i = 0; i < ${#p_n_db[@]}; i++ )); do
|
||||
if [ "${p_n_db[$i]}" = "${ret_prog}" ]; then
|
||||
index_prog=$i;
|
||||
fi
|
||||
done
|
||||
|
||||
for (( i = 0; i < ${#s_n_db[@]}; i++ )); do
|
||||
if [ "${s_n_db[$i]}" = "${ret_sink}" ]; then
|
||||
index_sink=$i;
|
||||
fi
|
||||
done
|
||||
|
||||
# Execute command
|
||||
ret=$(pactl move-sink-input ${p_i_db[$index_prog]} ${s_i_db[$index_sink]})
|
||||
3
bin/connectssh
Executable file
3
bin/connectssh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
rofi -show ssh
|
||||
17
bin/i3-shutdown.py
Executable file
17
bin/i3-shutdown.py
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import i3ipc
|
||||
import subprocess
|
||||
|
||||
def on_shutdown(conn=None):
|
||||
for ws in range(1, 4):
|
||||
file = open('/home/felix/.config/i3/workspace_' + str(ws) + '.json', 'w')
|
||||
bashCommand = 'i3-save-tree --workspace ' + str(ws)
|
||||
subprocess.Popen(bashCommand.split(), stdout=file)
|
||||
|
||||
on_shutdown()
|
||||
conn = i3ipc.Connection()
|
||||
|
||||
conn.on('ipc_shutdown', on_shutdown)
|
||||
|
||||
conn.main()
|
||||
14
bin/selectsink
Executable file
14
bin/selectsink
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# choose pulseaudio sink via rofi or dmenu
|
||||
# changes default sink and moves all streams to that sink
|
||||
|
||||
sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100|grep -Po '[0-9]+(?=:)') &&
|
||||
# alternate version using dmenu:
|
||||
# sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|dmenu -p 'pulseaudio sink:'|grep -Po '[0-9]+(?=:)') &&
|
||||
|
||||
ponymix set-default -d $sink &&
|
||||
for input in $(ponymix list -t sink-input|grep -Po '[0-9]+(?=:)');do
|
||||
echo "$input -> $sink"
|
||||
ponymix -t sink-input -d $input move $sink
|
||||
done
|
||||
4
bin/vpndown
Executable file
4
bin/vpndown
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
con=$(nmcli con | grep vpn | awk -F " " '{$0=$1}1' | rofi -dmenu -p 'connect vpn')
|
||||
nmcli con down $con
|
||||
Reference in New Issue
Block a user