├── Preferences.sublime-settings ├── home ├── .Xresources ├── .abcde.conf ├── .config │ ├── alacritty │ │ └── alacritty.toml │ ├── fontconfig │ │ └── fonts.conf │ ├── gtk-3.0 │ │ └── settings.ini │ ├── gtk-4.0 │ │ └── settings.ini │ ├── i3status │ │ └── config │ ├── mako │ │ └── config │ ├── mpv │ │ └── mpv.conf │ ├── sway │ │ └── config │ ├── systemd │ │ └── user │ │ │ └── ipfs.service │ └── waybar │ │ ├── config │ │ └── style.css ├── .gitconfig ├── .gtkrc-2.0 ├── .zshrc └── bin │ ├── brave-wayland │ ├── code-wayland │ ├── death-clock.sh │ ├── gclone │ ├── gif.sh │ ├── mvln │ ├── my-i3status.sh │ ├── note │ ├── power.sh │ ├── ripcord-wayland │ ├── sway-run │ ├── virtualenvwrapper.sh │ ├── webcam.sh │ └── z.sh ├── lights.sh ├── lock-screen ├── org.freedesktop.Notifications.service ├── rc-local.service └── rules.d ├── 70-persistent-net.rules └── backlight.rules /Preferences.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "always_show_minimap_viewport": true, 3 | "auto_complete": true, 4 | "caret_style": "wide", 5 | "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", 6 | "dpi_scale": 1.0, 7 | "draw_white_space": "selection", 8 | "file_exclude_patterns": 9 | [ 10 | "frontend/stats.json", 11 | "*.pyc", 12 | "*.pyo", 13 | "*.o" 14 | ], 15 | "folder_exclude_patterns": 16 | [ 17 | ".build", 18 | ".cache-loader", 19 | ".git", 20 | ".hg", 21 | ".svn", 22 | ".vagrant", 23 | "_site", 24 | "assets/frontend", 25 | "CVS", 26 | "node_modules", 27 | "public/dist", 28 | "static/CACHE", 29 | "static/js/build", 30 | "static/js/extern", 31 | "vendor", 32 | "frontend/dist", 33 | "frontend/fontawesome", 34 | "build" 35 | ], 36 | "font_face": "Source Code Pro", 37 | "font_face-z": "ProggyTinyTTSZ", 38 | "font_options-z": 39 | [ 40 | "no_clig", 41 | "no_liga", 42 | "no_calt", 43 | "no_antialias" 44 | ], 45 | "font_size": 8, 46 | "font_size-z": 12, 47 | "highlight_line": true, 48 | "ignored_packages": 49 | [ 50 | "Vintage" 51 | ], 52 | "preview_on_click": false, 53 | "scroll_speed": 0.0, 54 | "show_full_path": false, 55 | "show_line_endings": true, 56 | "show_tab_close_buttons": false, 57 | "soda_classic_tabs": false, 58 | "tab_size": 2, 59 | "theme": "Soda Dark 3.sublime-theme", 60 | "translate_tabs_to_spaces": true, 61 | "tree_animation_enabled": false, 62 | "trim_automatic_white_space": true, 63 | "trim_trailing_white_space_on_save": false, 64 | "word_wrap": true 65 | } 66 | -------------------------------------------------------------------------------- /home/.Xresources: -------------------------------------------------------------------------------- 1 | ! do not scroll with output 2 | URxvt*scrollTtyOutput: false 3 | 4 | ! scroll in relation to buffer (with mouse scroll or Shift+Page Up) 5 | URxvt*scrollWithBuffer: true 6 | 7 | ! scroll back to the bottom on keypress 8 | URxvt*scrollTtyKeypress: true 9 | 10 | URxvt.saveLines: 20000 11 | 12 | URxvt.secondaryScreen: 1 13 | URxvt.secondaryScroll: 0 14 | 15 | URxvt.scrollBar: false 16 | URxvt.loginShell: true 17 | URxvt.font: xft:ProggyTinyTTSZ:pixelsize=16 18 | !URxvt.boldFont: 19 | ! URxvt.boldFont: xft:ProggyTinyTTSZ:bold:pixelsize=16 20 | 21 | URxvt.perl-ext-common: default,matcher,tabbed,fullscreen 22 | URxvt.url-launcher: /usr/bin/xdg-open 23 | URxvt.matcher.button: 1 24 | URxvt.keysym.F11: perl:fullscreen:switch 25 | 26 | ! Disable tabbed keys so that ctrl+arrows works 27 | ! URxvt.tabbed.no-tabbedex-keys: true 28 | 29 | ! Use ctrl to jump between words 30 | ! URxvt.keysym.Control-Up: \033[1;5A 31 | ! URxvt.keysym.Control-Down: \033[1;5B 32 | ! URxvt.keysym.Control-Left: \033[1;5D 33 | ! URxvt.keysym.Control-Right: \033[1;5C 34 | 35 | URxvt.keysym.Shift-Control-V: eval:paste_clipboard 36 | URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard 37 | ! Needed for above keyboard shortcuts to work 38 | URxvt.iso14755: false 39 | 40 | *background: #000000 41 | *foreground: #ffffff 42 | 43 | Xcursor.theme: DMZ-Black 44 | Xcursor.size: 16 45 | 46 | Xft.hinting: 1 47 | Xft.hintstyle: hintmedium 48 | Xft.antialias: 1 49 | Xft.rgba: rgb 50 | -------------------------------------------------------------------------------- /home/.abcde.conf: -------------------------------------------------------------------------------- 1 | # -----------------$HOME/.abcde.conf----------------- # 2 | # 3 | # A sample configuration file to convert music cds to 4 | # MP3 format using lame, eyeD3 and abcde version 2.7.2 5 | # 6 | # http://andrews-corner.org/linux/abcde/index.html 7 | # -------------------------------------------------- # 8 | 9 | # Encode tracks immediately after reading. Saves disk space, gives 10 | # better reading of 'scratchy' disks and better troubleshooting of 11 | # encoding process but slows the operation of abcde quite a bit: 12 | LOWDISK=n 13 | 14 | # Specify the method to use to retrieve the track information, 15 | # the alternative is to specify 'musicbrainz': 16 | CDDBMETHOD=cddb 17 | 18 | # Make a local cache of cddb entries and then volunteer to use 19 | # these entries when and if they match the cd: 20 | CDDBCOPYLOCAL="y" 21 | CDDBLOCALDIR="$HOME/.cddb" 22 | CDDBLOCALRECURSIVE="y" 23 | CDDBUSELOCAL="y" 24 | 25 | # Specify the encoder to use for MP3. In this case 'lame': 26 | MP3ENCODERSYNTAX=lame 27 | 28 | # Specify the path to the selected encoder. In most cases the encoder 29 | # should be in your $PATH as I illustrate below, otherwise you will 30 | # need to specify the full path. For example: /usr/bin/lame 31 | LAME=lame 32 | 33 | # Specify your required encoding options here. Multiple options can 34 | # be selected as '--preset standard --another-option' etc. 35 | LAMEOPTS='-V 1' 36 | 37 | # Output type for MP3. 38 | OUTPUTTYPE="mp3" 39 | 40 | # The cd ripping program to use. There are a few choices here: cdda2wav, 41 | # dagrab, cddafs (Mac OS X only) and flac. New to abcde 2.7 is 'libcdio'. 42 | CDROMREADERSYNTAX=cdparanoia 43 | 44 | # Give the location of the ripping program and pass any extra options, 45 | # if using libcdio set 'CD_PARANOIA=cd-paranoia'. 46 | CDPARANOIA=cdparanoia 47 | CDPARANOIAOPTS="--never-skip=40" 48 | 49 | # Give the location of the CD identification program: 50 | CDDISCID=cd-discid 51 | 52 | # Give the base location here for the encoded music files. 53 | OUTPUTDIR="$HOME/Downloads" 54 | 55 | # The default actions that abcde will take. 56 | ACTIONS=cddb,playlist,read,encode,tag,move,clean 57 | 58 | # Decide here how you want the tracks labelled for a standard 'single-artist', 59 | # multi-track encode and also for a multi-track, 'various-artist' encode: 60 | OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}' 61 | VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}' 62 | 63 | # Decide here how you want the tracks labelled for a standard 'single-artist', 64 | # single-track encode and also for a single-track 'various-artist' encode. 65 | # (Create a single-track encode with 'abcde -1' from the commandline.) 66 | ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}' 67 | VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}' 68 | 69 | # Create playlists for single and various-artist encodes. I would suggest 70 | # commenting these out for single-track encoding. 71 | PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}.m3u' 72 | VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u' 73 | 74 | # This function takes out dots preceding the album name, and removes a grab 75 | # bag of illegal characters. It allows spaces, if you do not wish spaces add 76 | # in -e 's/ /_/g' after the first sed command. 77 | mungefilename () 78 | { 79 | echo "$@" | sed -e 's/^\.*//' | tr -d ":><|*/\"'?[:cntrl:]" 80 | } 81 | 82 | # What extra options? 83 | # Run a few encoders simultaneously 84 | MAXPROCS=4 85 | # Makes tracks 01 02 not 1 2 86 | PADTRACKS=y 87 | # Useful for debugging 88 | EXTRAVERBOSE=2 89 | # Place a comment... 90 | COMMENT='abcde version 2.8.1' 91 | # Please eject cd when finished :-) 92 | EJECTCD=y 93 | -------------------------------------------------------------------------------- /home/.config/alacritty/alacritty.toml: -------------------------------------------------------------------------------- 1 | [colors.primary] 2 | background = "#000000" 3 | foreground = "#ffffff" 4 | 5 | [font] 6 | size = 8.0 7 | 8 | [font.bold] 9 | family = "Source Code Pro" 10 | style = "Bold" 11 | 12 | [font.bold_italic] 13 | family = "Source Code Pro" 14 | style = "Bold Italic" 15 | 16 | [font.italic] 17 | family = "Source Code Pro" 18 | style = "Italic" 19 | 20 | [font.normal] 21 | family = "Source Code Pro" 22 | style = "Regular" 23 | 24 | [scrolling] 25 | history = 50000 26 | -------------------------------------------------------------------------------- /home/.config/fontconfig/fonts.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ProggyTinyTTSZ 7 | 8 | 9 | false 10 | 11 | 12 | false 13 | 14 | 15 | monospace 16 | 17 | 18 | 29 | 30 | 31 | 32 | 41 | 47 | 48 | -------------------------------------------------------------------------------- /home/.config/gtk-3.0/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-application-prefer-dark-theme = 1 3 | 4 | gtk-theme-name = Numix 5 | gtk-icon-theme-name = Adwaita 6 | gtk-cursor-theme-name = DMZ-Black 7 | gtk-can-change-accels = 1 8 | 9 | gtk-xft-antialias = 1 10 | gtk-xft-hinting = 1 11 | gtk-xft-hintstyle = hintmedium 12 | gtk-xft-rgba = rgb 13 | -------------------------------------------------------------------------------- /home/.config/gtk-4.0/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-application-prefer-dark-theme = 1 3 | 4 | gtk-theme-name = Numix 5 | gtk-icon-theme-name = Adwaita 6 | gtk-cursor-theme-name = DMZ-Black 7 | gtk-can-change-accels = 1 8 | 9 | gtk-xft-antialias = 1 10 | gtk-xft-hinting = 1 11 | gtk-xft-hintstyle = hintmedium 12 | gtk-xft-rgba = rgb 13 | -------------------------------------------------------------------------------- /home/.config/i3status/config: -------------------------------------------------------------------------------- 1 | general { 2 | colors = true 3 | interval = 10 4 | output_format = i3bar 5 | } 6 | 7 | # order += "ipv6" 8 | order += "wireless _first_" 9 | order += "ethernet bnep0" 10 | order += "ethernet _first_" 11 | order += "path_exists VPN" 12 | order += "cpu_temperature 0" 13 | order += "cpu_usage" 14 | order += "memory" 15 | # order += "load" 16 | order += "disk /" 17 | order += "battery all" 18 | order += "tztime local" 19 | order += "tztime utc" 20 | order += "volume master" 21 | 22 | path_exists VPN { 23 | path = "/proc/sys/net/ipv4/conf/tun0" 24 | format = "VPN" 25 | format_down = "" 26 | color_good = "#ff0000" 27 | separator_block_width = 20 28 | } 29 | 30 | wireless _first_ { 31 | format_up = "%essid%quality %bitrate %frequency" 32 | format_down = "W -" 33 | color_bad = "#aaaaaa" 34 | color_good = "#ffffff" 35 | min_width = 500 36 | align = "right" 37 | separator_block_width = 20 38 | } 39 | 40 | ethernet bnep0 { 41 | format_up = "ᛒ %ip" 42 | format_down = "ᛒ -" 43 | color_bad = "#aaaaaa" 44 | color_good = "#ffffff" 45 | separator_block_width = 20 46 | } 47 | 48 | ethernet _first_ { 49 | format_up = "E %speed" 50 | format_down = "E -" 51 | color_bad = "#aaaaaa" 52 | color_good = "#ffffff" 53 | # trying to make connected eth not be yellow 54 | color_degraded = "#cccccc" 55 | separator_block_width = 20 56 | } 57 | 58 | cpu_temperature 0 { 59 | format = "%degrees°C" 60 | path = "/sys/devices/platform/coretemp.0/hwmon/hwmon?/temp1_input" 61 | max_threshold = 85 62 | separator_block_width = 20 63 | } 64 | cpu_usage { 65 | format = "%usage" 66 | separator_block_width = 20 67 | } 68 | load { 69 | format = "%1min" 70 | } 71 | 72 | memory { 73 | format = "🐏 %available" 74 | threshold_degraded = "1G" 75 | separator_block_width = 20 76 | min_width = 50 77 | } 78 | 79 | disk "/" { 80 | format = "🖴 %avail" 81 | prefix_type = "decimal" 82 | low_threshold = 5 83 | separator_block_width = 20 84 | } 85 | 86 | battery all { 87 | # format = "%status %percentage %remaining %consumption" 88 | format = "%status %percentage" 89 | hide_seconds = true 90 | integer_battery_capacity = true 91 | last_full_capacity = true 92 | status_chr = "⚡️" 93 | status_bat = "🔋" 94 | status_unk = "❔" 95 | status_full = "🔌" 96 | low_threshold = 15 97 | threshold_type = "percentage" 98 | separator_block_width = 20 99 | } 100 | 101 | tztime local { 102 | format = "%Y-%m-%d %H:%M" 103 | separator_block_width = 20 104 | } 105 | tztime utc { 106 | format = "%H:%MZ" 107 | timezone = "UTC" 108 | separator_block_width = 20 109 | } 110 | 111 | volume master { 112 | format = "🔉 %volume" 113 | format_muted = "🔇 %volume" 114 | device = "default" 115 | mixer = "Master" 116 | mixer_idx = 0 117 | # make muted gray, not yellow 118 | color_degraded = "#aaaaaa" 119 | align = "left" 120 | min_width = 100 121 | separator_block_width = 20 122 | } 123 | -------------------------------------------------------------------------------- /home/.config/mako/config: -------------------------------------------------------------------------------- 1 | max-history=10 2 | default-timeout=10000 3 | -------------------------------------------------------------------------------- /home/.config/mpv/mpv.conf: -------------------------------------------------------------------------------- 1 | [default] 2 | #audio-channels=5.1 3 | #osc=no 4 | #no-audio-display 5 | #mute=no 6 | gpu-context=wayland 7 | #alang=jp,jpn,Japanese,japanese,en,eng 8 | #slang=en,eng 9 | #input-file=~/.config/mpv/control 10 | hwdec=vaapi 11 | -------------------------------------------------------------------------------- /home/.config/sway/config: -------------------------------------------------------------------------------- 1 | # Default config for sway 2 | # 3 | # Copy this to ~/.config/sway/config and edit it to your liking. 4 | # 5 | # Read `man 5 sway` for a complete reference. 6 | 7 | ### Variables 8 | # 9 | # Logo key. Use Mod1 for Alt. 10 | set $mod Mod4 11 | # Home row direction keys, like vim 12 | #set $left d 13 | #set $down h 14 | #set $up t 15 | #set $right n 16 | # Your preferred terminal emulator 17 | #set $term gnome-terminal 18 | set $term alacritty 19 | #set $term urxvt 20 | # Your preferred application launcher 21 | #set $menu dmenu_run -i -l 8 -m 0 -fn SourceCodePro-Regular -nb \#222 -nf \#aaa -sb \#000 -sf \#fff 22 | #set $menu bemenu-run -i -l 8 -n -P '>' --fn 'Source Code Pro Regular 14' --nb \#222222 --nf \#aaaaaa --sb \#000000 --sf \#ffffff --hb \#000000 --hf \#ffffff 23 | set $menu bemenu-run -m all -i -l 8 -n -P '>' --fn 'Source Code Pro Regular 14' 24 | 25 | # -b == bottom of screen 26 | # -i == case insensitive 27 | # -fn == font 28 | 29 | # debuglog on 30 | 31 | hide_edge_borders both 32 | 33 | default_border normal 1 34 | focus_follows_mouse no 35 | 36 | ### Output configuration 37 | # 38 | # Default wallpaper (more resolutions are available in /usr/local/share/backgrounds/sway/) 39 | #output * bg ~/Pictures/Backgrounds/Starship\ and\ Super\ Heavy\ Stack.jpg fill 40 | #output * bg /usr/local/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill 41 | # red triangles 42 | #output * bg ~/Pictures/wallhaven/wallhaven-168635.png fill 43 | # 80's neon computer sunset 44 | #output * bg ~/Pictures/Backgrounds/wallhaven-562941.png fill 45 | # galaxy cube thing 46 | #output * bg ~/Pictures/Backgrounds/wallhaven-721309.png fill 47 | # black with neon swirls 48 | #output * bg ~/Pictures/Backgrounds/wallhaven-zm9zwo.png fill 49 | output * bg #000000 solid_color 50 | 51 | # 52 | # Example configuration: 53 | # 54 | # output HDMI-A-1 resolution 1920x1080 position 1920,0 55 | # 56 | # You can get the names of your outputs by running: swaymsg -t get_outputs 57 | 58 | # x62 screen 59 | #output eDP-1 position 0,0 scale 1 subpixel rgb 60 | # miniHDMI on x62 61 | #output HDMI-A-2 scale 1 62 | # For 4k monitor ('Goldstar Company Ltd LG Ultra HD 0x0000577B') on x62 63 | #output DP-1 scale 1.5 subpixel rgb 64 | 65 | # x210 screen 66 | output eDP-1 position 0,0 scale 2 subpixel rgb 67 | #output eDP-1 position 0,1440 scale 2 subpixel rgb 68 | # For 4k monitor ('Goldstar Company Ltd LG Ultra HD 0x0000577B') on x210 69 | output DP-2 scale 1.5 subpixel rgb 70 | #pos 0,-1440 71 | 72 | # x1 carbon hdmi 73 | output HDMI-A-1 scale 1.5 subpixel rgb 74 | output DP-1 scale 1.5 subpixel rgb 75 | 76 | 77 | ### Input configuration 78 | # 79 | # Example configuration: 80 | # 81 | # input "2:14:SynPS/2_Synaptics_TouchPad" { 82 | # dwt enabled 83 | # tap enabled 84 | # natural_scroll enabled 85 | # middle_emulation enabled 86 | # } 87 | # 88 | # You can get the names of your inputs by running: swaymsg -t get_inputs 89 | # Read `man 5 sway-input` for more information about this section. 90 | 91 | # Causes a crash if I plug in my mouse. No clue why. TODO: create a minimal config to reproduce 92 | #input * { 93 | # natural_scroll enabled 94 | #} 95 | input type:pointer { 96 | accel_profile flat 97 | natural_scroll enabled 98 | } 99 | 100 | input type:touchpad { 101 | tap enabled 102 | natural_scroll enabled 103 | } 104 | input type:mouse { 105 | natural_scroll enabled 106 | } 107 | 108 | input "2:10:TPPS/2_IBM_TrackPoint" { 109 | accel_profile flat 110 | pointer_accel 0.8 # Default = 0.4 111 | dwt enabled 112 | } 113 | 114 | # X1 carbon touchpad 115 | input "1739:52619:SYNA8004:00_06CB:CD8B_Touchpad" { 116 | tap enabled 117 | } 118 | # X1 carbon trackpoint 119 | input "2:10:TPPS/2_Elan_TrackPoint" { 120 | accel_profile flat 121 | pointer_accel 0.8 # Default = 0.4 122 | dwt enabled 123 | } 124 | 125 | input "2362:9522:PixArt_Gaming_Mouse" { 126 | accel_profile flat 127 | natural_scroll enabled 128 | } 129 | 130 | input "1133:49257:Logitech_USB_Laser_Mouse" { 131 | accel_profile flat 132 | pointer_accel 1 133 | natural_scroll enabled 134 | } 135 | 136 | input type:keyboard { 137 | xkb_layout us,us 138 | xkb_variant dvorak, 139 | xkb_options grp:shifts_toggle,caps:escape 140 | } 141 | 142 | seat * hide_cursor 10000 143 | seat * hide_cursor when-typing enable 144 | 145 | # Auto warp mouse to focus 146 | #mouse_warping container 147 | 148 | ### Key bindings 149 | # 150 | # Basics: 151 | # 152 | # start a terminal 153 | bindsym $mod+Return exec $term 154 | # byndsym XF86Launch1 exec $term 155 | # byndsym XF86LaunchA exec $term 156 | 157 | # kill focused window 158 | bindsym $mod+q kill 159 | 160 | # start your launcher 161 | bindsym $mod+e exec $menu | xargs swaymsg exec -- 162 | 163 | # Drag floating windows by holding down $mod and left mouse button. 164 | # Resize them with right mouse button + $mod. 165 | # Despite the name, also works for non-floating windows. 166 | # Change normal to inverse to use left mouse button for resizing and right 167 | # mouse button for dragging/resizing 168 | floating_modifier $mod normal 169 | 170 | # reload the configuration file 171 | bindsym $mod+Shift+j reload 172 | 173 | # exit sway (logs you out of your wayland session) 174 | bindsym $mod+Shift+q exit 175 | 176 | # emoji picker 177 | bindsym $mod+Ctrl+space exec emote 178 | bindsym $mod+n exec ~/bin/lock-screen 179 | bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% 180 | bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% 181 | bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle 182 | # Get pause buttons working for mpv 183 | bindsym XF86AudioPause exec --no-startup-id echo "cycle pause" > ~/.config/mpv/control 184 | bindsym XF86AudioNext exec --no-startup-id echo "playlist-next" > ~/.config/mpv/control 185 | bindsym XF86AudioPrev exec --no-startup-id echo "playlist-prev" > ~/.config/mpv/control 186 | 187 | bindsym XF86MonBrightnessDown exec light -U 4 188 | bindsym XF86MonBrightnessUp exec light -A 4 189 | # bindsym XF86MonBrightnessDown exec light -U 3 && notify-send -t 1000 "Brightness set to $(printf "%.0f\n" $(light -G))%" 190 | # bindsym XF86MonBrightnessUp exec light -A 3 && notify-send -t 1000 "Brightness set to $(printf "%.0f\n" $(light -G))%" 191 | 192 | # Screenshot 193 | #bindsym Print exec grim ~/Pictures/Screenshots/"Screenshot from $(date '+%F %H-%M-%S')".png 194 | bindsym $mod+Print exec grim ~/Pictures/Screenshots/"Screenshot from $(date '+%F %H-%M-%S')".png 195 | # Screenshot selection 196 | bindsym $mod+Shift+Print exec grim -g \"$(slurp)" ~/Pictures/Screenshots/"Screenshot from $(date '+%F %H-%M-%S')".png 197 | bindsym $mod+XF86Back workspace prev_on_output 198 | bindsym $mod+XF86Forward workspace next_on_output 199 | bindsym $mod+Mod1+Left workspace prev_on_output 200 | bindsym $mod+Mod1+Right workspace next_on_output 201 | 202 | bindsym $mod+Shift+XF86Back move container to workspace prev_on_output 203 | bindsym $mod+Shift+XF86Forward move container to workspace next_on_output 204 | bindsym $mod+Ctrl+XF86Back move workspace to output left 205 | bindsym $mod+Ctrl+XF86Forward move workspace to output right 206 | bindsym $mod+Ctrl+Left move workspace to output left 207 | bindsym $mod+Ctrl+Right move workspace to output right 208 | bindsym $mod+Ctrl+Up move workspace to output up 209 | bindsym $mod+Ctrl+Down move workspace to output down 210 | bindsym $mod+Escape exec swaymsg output eDP-1 toggle 211 | # 212 | # Moving around: 213 | # 214 | # Move your focus around 215 | # bindsym $mod+$left focus left 216 | # bindsym $mod+$down focus down 217 | # bindsym $mod+$up focus up 218 | # bindsym $mod+$right focus right 219 | # or use $mod+[up|down|left|right] 220 | bindsym $mod+Left focus left 221 | bindsym $mod+Down focus down 222 | bindsym $mod+Up focus up 223 | bindsym $mod+Right focus right 224 | 225 | # _move_ the focused window with the same, but add Shift 226 | # bindsym $mod+Shift+$left move left 227 | # bindsym $mod+Shift+$down move down 228 | # bindsym $mod+Shift+$up move up 229 | # bindsym $mod+Shift+$right move right 230 | # ditto, with arrow keys 231 | bindsym $mod+Shift+Left move left 232 | bindsym $mod+Shift+Down move down 233 | bindsym $mod+Shift+Up move up 234 | bindsym $mod+Shift+Right move right 235 | # 236 | # Workspaces: 237 | # 238 | # switch to workspace 239 | bindsym $mod+1 workspace 1 240 | bindsym $mod+2 workspace 2 241 | bindsym $mod+3 workspace 3 242 | bindsym $mod+4 workspace 4 243 | bindsym $mod+5 workspace 5 244 | bindsym $mod+6 workspace 6 245 | bindsym $mod+7 workspace 7 246 | bindsym $mod+8 workspace 8 247 | bindsym $mod+9 workspace 9 248 | bindsym $mod+0 workspace 10 249 | # move focused container to workspace 250 | bindsym $mod+Shift+1 move container to workspace 1 251 | bindsym $mod+Shift+2 move container to workspace 2 252 | bindsym $mod+Shift+3 move container to workspace 3 253 | bindsym $mod+Shift+4 move container to workspace 4 254 | bindsym $mod+Shift+5 move container to workspace 5 255 | bindsym $mod+Shift+6 move container to workspace 6 256 | bindsym $mod+Shift+7 move container to workspace 7 257 | bindsym $mod+Shift+8 move container to workspace 8 258 | bindsym $mod+Shift+9 move container to workspace 9 259 | bindsym $mod+Shift+0 move container to workspace 10 260 | # Note: workspaces can have any name you want, not just numbers. 261 | # We just use 1-10 as the default. 262 | # 263 | # Layout stuff: 264 | # 265 | # You can "split" the current object of your focus with 266 | # $mod+b or $mod+v, for horizontal and vertical splits 267 | # respectively. 268 | bindsym $mod+x splith 269 | bindsym $mod+k splitv 270 | 271 | # Switch the current container between different layout styles 272 | bindsym $mod+z layout stacking 273 | bindsym $mod+w layout tabbed 274 | bindsym $mod+v layout toggle split 275 | 276 | # Make the current focus fullscreen 277 | bindsym $mod+u fullscreen 278 | 279 | # Toggle the current focus between tiling and floating mode 280 | bindsym $mod+Shift+space floating toggle 281 | 282 | # Swap focus between the tiling area and the floating area 283 | bindsym $mod+space focus mode_toggle 284 | 285 | # move focus to the parent container 286 | bindsym $mod+a focus parent 287 | # 288 | # Scratchpad: 289 | # 290 | # Sway has a "scratchpad", which is a bag of holding for windows. 291 | # You can send windows there and get them back later. 292 | 293 | # Move the currently focused window to the scratchpad 294 | bindsym $mod+Shift+minus move scratchpad 295 | 296 | # Show the next scratchpad window or hide the focused scratchpad window. 297 | # If there are multiple scratchpad windows, this command cycles through them. 298 | bindsym $mod+minus scratchpad show 299 | # 300 | # Resizing containers: 301 | # 302 | mode "resize" { 303 | # left will shrink the containers width 304 | # right will grow the containers width 305 | # up will shrink the containers height 306 | # down will grow the containers height 307 | # bindsym $left resize shrink width 10 px or 10 ppt 308 | # bindsym $down resize grow height 10 px or 10 ppt 309 | # bindsym $up resize shrink height 10 px or 10 ppt 310 | # bindsym $right resize grow width 10 px or 10 ppt 311 | 312 | # ditto, with arrow keys 313 | bindsym Left resize shrink width 20 px 314 | bindsym Down resize grow height 20 px 315 | bindsym Up resize shrink height 20 px 316 | bindsym Right resize grow width 20 px 317 | 318 | # return to default mode 319 | bindsym Return mode "default" 320 | bindsym Escape mode "default" 321 | } 322 | bindsym $mod+p mode "resize" 323 | 324 | # font ProggyTinyTTSZ 325 | font "Source Code Pro Regular 9" 326 | 327 | workspace_auto_back_and_forth yes 328 | # Enable floating for pinentry 329 | for_window [title="pinentry-gnome3"] floating enable, move position center 330 | for_window [class="Pavucontrol"] floating enable 331 | 332 | # Float zoom windows 333 | #for_window [app_id="zoom"] floating enable 334 | 335 | # No titles on things I tend to keep on their own workspaces (browsers, slack) 336 | for_window [class="chromium-browser"] border pixel 337 | for_window [app_id="firefox"] border pixel 338 | for_window [app_id="brave-browser"] border pixel 339 | for_window [app_id="brave-browser-dev"] border pixel 340 | for_window [class="Slack"] border pixel 341 | for_window [app_id="firefox-trunk"] border pixel 342 | for_window [app_id="gnome-terminal-server"] border pixel 343 | 344 | # Inhibit idle for fullscreen browser stuff (mostly to prevent locking when watching youtube videos) 345 | for_window [app_id="brave-browser"] inhibit_idle fullscreen 346 | for_window [app_id="brave-browser-dev"] inhibit_idle fullscreen 347 | for_window [app_id="firefox-trunk"] inhibit_idle fullscreen 348 | for_window [app_id="firefox"] inhibit_idle fullscreen 349 | 350 | # floating_minimum_size 400 x 300 351 | 352 | # 353 | # Status Bar: 354 | # 355 | # Read `man 5 sway-bar` for more information about this section. 356 | bar { 357 | swaybar_command waybar 358 | hidden_state hide 359 | mode hide 360 | modifier Mod4 361 | } 362 | #bar { 363 | # id main_bar 364 | # font "Source Code Pro Regular 9" 365 | ## font ProggyTinyTTSZ 366 | # position bottom 367 | # status_command ~/bin/my-i3status.sh 368 | # mode hide 369 | # hidden_state hide 370 | # modifier $mod 371 | # colors { 372 | # statusline #ffffff 373 | # background #323232 374 | # inactive_workspace #323232 #323232 #5c5c5c 375 | # } 376 | #} 377 | 378 | # class border backgr. text indicator child_border 379 | client.focused #cccccc #aaaaaa #000000 #2e9ef4 #cccccc 380 | # (defaults) 381 | # client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 382 | # client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a 383 | # client.unfocused #333333 #222222 #888888 #292d2e #222222 384 | # client.urgent #2f343a #900000 #ffffff #900000 #900000 385 | # client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c 386 | # client.background #ffffff 387 | 388 | #include /etc/sway/config.d/* 389 | #include /etc/sway/security.d/* 390 | 391 | # Make sure systemd has the right env vars for xdg-desktop-portal & xdg-desktop-portal 392 | exec "systemctl --user import-environment" 393 | 394 | # Start notification daemon 395 | exec mako 396 | 397 | # Start network manager applet 398 | exec nm-applet --indicator 399 | 400 | # Start bluetooth applet 401 | exec blueman-applet 402 | 403 | exec emote 404 | 405 | exec swayidle -w \ 406 | timeout 295 'swaymsg "output * dpms off"' \ 407 | resume 'swaymsg "output * dpms on"' \ 408 | timeout 300 'lock-screen' \ 409 | resume 'swaymsg "output * dpms on"' \ 410 | before-sleep 'lock-screen' 411 | -------------------------------------------------------------------------------- /home/.config/systemd/user/ipfs.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=IPFS daemon 3 | After=network.target 4 | 5 | [Service] 6 | ExecStart=/usr/bin/ipfs daemon --migrate 7 | Restart=on-failure 8 | 9 | [Install] 10 | WantedBy=default.target 11 | -------------------------------------------------------------------------------- /home/.config/waybar/config: -------------------------------------------------------------------------------- 1 | { 2 | //"bar_id": "bar-0", 3 | "ipc": true, 4 | // "layer": "top", // Waybar at top layer 5 | "position": "bottom", // Waybar position (top|bottom|left|right) 6 | "height": 24, // Waybar height (to be removed for auto height) 7 | // "width": 1280, // Waybar width 8 | // Choose the order of the modules 9 | "modules-left": [ 10 | "sway/workspaces", 11 | "wlr/taskbar", 12 | "sway/mode", 13 | "sway/window" 14 | ], 15 | "modules-center": [], 16 | "modules-right": [ 17 | "custom/i3status", 18 | // "network", 19 | "idle_inhibitor", 20 | "temperature", 21 | "cpu", 22 | "memory", 23 | "disk", 24 | "backlight", 25 | "pulseaudio", 26 | "battery", 27 | // "battery#bat2", 28 | "sway/language", 29 | "clock", 30 | "clock#utc", 31 | "tray" 32 | ], 33 | // Modules configuration 34 | // "sway/workspaces": { 35 | // "disable-scroll": true, 36 | // "all-outputs": true, 37 | // "format": "{name}: {icon}", 38 | // "format-icons": { 39 | // "1": "", 40 | // "2": "", 41 | // "3": "", 42 | // "4": "", 43 | // "5": "", 44 | // "urgent": "", 45 | // "focused": "", 46 | // "default": "" 47 | // } 48 | // }, 49 | "wlr/taskbar": { 50 | "on-click": "activate" 51 | }, 52 | "sway/mode": { 53 | "format": "{}" 54 | }, 55 | "sway/language": { 56 | "format": "{}", 57 | "max-length": 50 58 | }, 59 | "custom/i3status": { 60 | "exec": "~/bin/death-clock.sh", 61 | "interval": 3600 62 | }, 63 | "mpd": { 64 | "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ ", 65 | "format-disconnected": "Disconnected ", 66 | "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", 67 | "unknown-tag": "N/A", 68 | "interval": 2, 69 | "consume-icons": { 70 | "on": " " 71 | }, 72 | "random-icons": { 73 | "off": " ", 74 | "on": " " 75 | }, 76 | "repeat-icons": { 77 | "on": " " 78 | }, 79 | "single-icons": { 80 | "on": "1 " 81 | }, 82 | "state-icons": { 83 | "paused": "", 84 | "playing": "" 85 | }, 86 | "tooltip-format": "MPD (connected)", 87 | "tooltip-format-disconnected": "MPD (disconnected)" 88 | }, 89 | "idle_inhibitor": { 90 | "format": "{icon}", 91 | "format-icons": { 92 | "activated": "", 93 | "deactivated": "" 94 | } 95 | }, 96 | "tray": { 97 | // "icon-size": 21, 98 | "spacing": 10 99 | }, 100 | "clock": { 101 | // "timezone": "America/New_York", 102 | "tooltip-format": "{:%Y %B}\n{calendar}", 103 | "format": "{:%Y-%m-%d %H:%M}" 104 | }, 105 | "clock#utc": { 106 | "timezone": "Etc/UTC", 107 | "tooltip-format": "{:%Y %B}\n{calendar}", 108 | "format": "{:%H:%M}Z" 109 | }, 110 | "cpu": { 111 | "format": "{usage}% {avg_frequency}GHz ", 112 | "tooltip": true 113 | }, 114 | "memory": { 115 | "format": "{}% 🐏" 116 | }, 117 | "disk": { 118 | "interval": 60, 119 | "format": "{free} 🖴" 120 | }, 121 | "temperature": { 122 | // "thermal-zone": 2, 123 | // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", 124 | "critical-threshold": 80, 125 | // "format-critical": "{temperatureC}°C {icon}", 126 | "format": "{temperatureC}°C {icon}", 127 | "format-icons": ["", "", ""] 128 | }, 129 | "backlight": { 130 | // "device": "acpi_video1", 131 | "format": "{percent}% {icon}", 132 | "format-icons": [ 133 | "🌑", 134 | "🌒", 135 | "🌓", 136 | "🌔", 137 | "🌕", 138 | ], 139 | }, 140 | "battery": { 141 | "states": { 142 | // "good": 95, 143 | "warning": 20, 144 | "critical": 10 145 | }, 146 | "format": "{capacity}% {icon}", 147 | "format-charging": "{capacity}% ", 148 | "format-plugged": "{capacity}% ", 149 | "format-alt": "{time} {icon}", 150 | // "format-good": "", // An empty format will hide the module 151 | // "format-full": "", 152 | "format-icons": ["", "", "", "", ""] 153 | }, 154 | "network": { 155 | // "interface": "wlp2*", // (Optional) To force the use of this interface 156 | "format-wifi": "{essid} ({signalStrength}%) {frequency}MHz {icon} ", 157 | "format-ethernet": "{ifname}: {ipaddr}/{cidr} ", 158 | "format-linked": "{ifname} (No IP) ", 159 | "format-disconnected": "Disconnected ⚠", 160 | "format-alt": "{ifname}: {ipaddr}/{cidr}", 161 | }, 162 | "pulseaudio": { 163 | // "scroll-step": 1, // %, can be a float 164 | "format": "{volume}% {icon} {format_source}", 165 | "format-bluetooth": "{volume}% {icon} {format_source}", 166 | "format-bluetooth-muted": " {icon} {format_source}", 167 | "format-muted": " {format_source}", 168 | "format-source": "{volume}% ", 169 | "format-source-muted": "", 170 | "format-icons": { 171 | "headphone": "", 172 | "hands-free": "", 173 | "headset": "", 174 | "phone": "", 175 | "portable": "", 176 | "car": "", 177 | "default": ["", "", ""] 178 | }, 179 | "on-click": "pavucontrol" 180 | }, 181 | "custom/media": { 182 | "format": "{icon} {}", 183 | "return-type": "json", 184 | "max-length": 40, 185 | "format-icons": { 186 | "spotify": "", 187 | "default": "🎜" 188 | }, 189 | "escape": true, 190 | "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder 191 | // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name 192 | } 193 | } -------------------------------------------------------------------------------- /home/.config/waybar/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | border: none; 3 | border-radius: 0; 4 | /* `otf-font-awesome` is required to be installed for icons */ 5 | font-family: "Source Code Pro"; 6 | font-size: 13px; 7 | min-height: 0; 8 | } 9 | 10 | window#waybar { 11 | background-color: rgba(43, 48, 59, 0.5); 12 | border-bottom: 3px solid rgba(100, 114, 125, 0.5); 13 | color: #ffffff; 14 | transition-property: background-color; 15 | transition-duration: .5s; 16 | } 17 | 18 | window#waybar.hidden { 19 | opacity: 0.2; 20 | } 21 | 22 | /* 23 | window#waybar.empty { 24 | background-color: transparent; 25 | } 26 | window#waybar.solo { 27 | background-color: #FFFFFF; 28 | } 29 | */ 30 | 31 | window#waybar.termite { 32 | background-color: #3F3F3F; 33 | } 34 | 35 | window#waybar.chromium { 36 | background-color: #000000; 37 | border: none; 38 | } 39 | 40 | #workspaces button { 41 | padding: 0 5px; 42 | background-color: transparent; 43 | color: #ffffff; 44 | /* Use box-shadow instead of border so the text isn't offset */ 45 | box-shadow: inset 0 -3px transparent; 46 | } 47 | 48 | /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ 49 | #workspaces button:hover { 50 | background: rgba(0, 0, 0, 0.2); 51 | box-shadow: inset 0 -3px #ffffff; 52 | } 53 | 54 | #workspaces button.focused { 55 | background-color: #64727D; 56 | box-shadow: inset 0 -3px #ffffff; 57 | } 58 | 59 | #workspaces button.urgent { 60 | background-color: #eb4d4b; 61 | } 62 | 63 | #mode { 64 | background-color: #64727D; 65 | border-bottom: 3px solid #ffffff; 66 | } 67 | 68 | #clock, 69 | #battery, 70 | #cpu, 71 | #memory, 72 | #disk, 73 | #temperature, 74 | #backlight, 75 | #network, 76 | #pulseaudio, 77 | #custom-media, 78 | #tray, 79 | #mode, 80 | #idle_inhibitor, 81 | #mpd { 82 | padding: 0 8px; 83 | /*margin: 0 4px;*/ 84 | color: #ffffff; 85 | } 86 | 87 | #window, 88 | #workspaces { 89 | /*margin: 0 4px;*/ 90 | } 91 | 92 | /* If workspaces is the leftmost module, omit left margin */ 93 | .modules-left > widget:first-child > #workspaces { 94 | margin-left: 0; 95 | } 96 | 97 | /* If workspaces is the rightmost module, omit right margin */ 98 | .modules-right > widget:last-child > #workspaces { 99 | margin-right: 0; 100 | } 101 | 102 | #clock { 103 | background-color: #64727D; 104 | } 105 | 106 | #battery { 107 | background-color: #ffffff; 108 | color: #000000; 109 | } 110 | 111 | #battery.charging, #battery.plugged { 112 | color: #ffffff; 113 | background-color: #26A65B; 114 | } 115 | 116 | @keyframes blink { 117 | to { 118 | background-color: #ffffff; 119 | color: #000000; 120 | } 121 | } 122 | 123 | #battery.critical:not(.charging) { 124 | background-color: #f53c3c; 125 | color: #ffffff; 126 | animation-name: blink; 127 | animation-duration: 0.5s; 128 | animation-timing-function: linear; 129 | animation-iteration-count: infinite; 130 | animation-direction: alternate; 131 | } 132 | 133 | label:focus { 134 | background-color: #000000; 135 | } 136 | 137 | #cpu { 138 | background-color: #2ecc71; 139 | color: #000000; 140 | } 141 | 142 | #memory { 143 | background-color: #9b59b6; 144 | } 145 | 146 | #disk { 147 | background-color: #964B00; 148 | } 149 | 150 | #backlight { 151 | background-color: #90b1b1; 152 | } 153 | 154 | #network { 155 | background-color: #2980b9; 156 | } 157 | 158 | #network.disconnected { 159 | background-color: #f53c3c; 160 | } 161 | 162 | #pulseaudio { 163 | background-color: #f1c40f; 164 | color: #000000; 165 | } 166 | 167 | #pulseaudio.muted { 168 | background-color: #90b1b1; 169 | color: #2a5c45; 170 | } 171 | 172 | #custom-media { 173 | background-color: #66cc99; 174 | color: #2a5c45; 175 | min-width: 100px; 176 | } 177 | 178 | #custom-media.custom-spotify { 179 | background-color: #66cc99; 180 | } 181 | 182 | #custom-media.custom-vlc { 183 | background-color: #ffa000; 184 | } 185 | 186 | #temperature { 187 | background-color: #f0932b; 188 | } 189 | 190 | #temperature.critical { 191 | background-color: #eb4d4b; 192 | } 193 | 194 | #tray { 195 | background-color: #2980b9; 196 | } 197 | 198 | #idle_inhibitor { 199 | background-color: #2d3436; 200 | } 201 | 202 | #idle_inhibitor.activated { 203 | background-color: #ecf0f1; 204 | color: #2d3436; 205 | } 206 | 207 | #mpd { 208 | background-color: #66cc99; 209 | color: #2a5c45; 210 | } 211 | 212 | #mpd.disconnected { 213 | background-color: #f53c3c; 214 | } 215 | 216 | #mpd.stopped { 217 | background-color: #90b1b1; 218 | } 219 | 220 | #mpd.paused { 221 | background-color: #51a37a; 222 | } 223 | 224 | #language { 225 | background: #00b093; 226 | color: #740864; 227 | padding: 0 5px; 228 | /*margin: 0 5px;*/ 229 | min-width: 16px; 230 | } 231 | 232 | #custom-i3status { 233 | margin-left: 4px; 234 | margin-right: 4px; 235 | } 236 | -------------------------------------------------------------------------------- /home/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Geoff Greer 3 | email = geoff@greer.fm 4 | [color] 5 | diff = auto 6 | status = auto 7 | branch = auto 8 | [core] 9 | deltaBaseCacheLimit = 1G 10 | [branch] 11 | autosetupmerge = true 12 | [push] 13 | default = matching 14 | [alias] 15 | st = status 16 | ci = commit 17 | br = branch 18 | co = checkout 19 | df = diff 20 | lg = log -p 21 | lol = log --graph --decorate --pretty=oneline --abbrev-commit 22 | lola = log --graph --decorate --pretty=oneline --abbrev-commit --all 23 | ls = ls-files 24 | -------------------------------------------------------------------------------- /home/.gtkrc-2.0: -------------------------------------------------------------------------------- 1 | gtk-icon-theme-name = "Adwaita" 2 | gtk-cursor-theme-name = "DMZ-Black" 3 | gtk-theme-name = "Numix" 4 | 5 | gtk-application-prefer-dark-theme = 1 6 | 7 | gtk-xft-antialias = 1 8 | gtk-xft-hinting = 1 9 | gtk-xft-hintstyle = hintmedium 10 | gtk-xft-rgba = rgb 11 | gtk-can-change-accels = 1 12 | -------------------------------------------------------------------------------- /home/.zshrc: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | # function ls() {[ $(($RANDOM % 20)) -eq 0 ] && sl || /bin/ls} 4 | 5 | # Path to your oh-my-zsh installation. 6 | export ZSH=$HOME/.oh-my-zsh 7 | 8 | # Set name of the theme to load. Optionally, if you set this to "random" 9 | # it'll load a random theme each time that oh-my-zsh is loaded. 10 | # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 11 | ZSH_THEME="gallois" 12 | 13 | # Uncomment the following line to use case-sensitive completion. 14 | # CASE_SENSITIVE="true" 15 | 16 | # Uncomment the following line to use hyphen-insensitive completion. Case 17 | # sensitive completion must be off. _ and - will be interchangeable. 18 | # HYPHEN_INSENSITIVE="true" 19 | 20 | # Uncomment the following line to disable bi-weekly auto-update checks. 21 | # DISABLE_AUTO_UPDATE="true" 22 | 23 | # Uncomment the following line to change how often to auto-update (in days). 24 | # export UPDATE_ZSH_DAYS=13 25 | 26 | # Uncomment the following line to disable colors in ls. 27 | # DISABLE_LS_COLORS="true" 28 | 29 | # Uncomment the following line to disable auto-setting terminal title. 30 | # DISABLE_AUTO_TITLE="true" 31 | 32 | # Uncomment the following line to enable command auto-correction. 33 | # ENABLE_CORRECTION="true" 34 | 35 | # Uncomment the following line to display red dots whilst waiting for completion. 36 | # COMPLETION_WAITING_DOTS="true" 37 | 38 | # Uncomment the following line if you want to disable marking untracked files 39 | # under VCS as dirty. This makes repository status check for large repositories 40 | # much, much faster. 41 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 42 | 43 | # Uncomment the following line if you want to change the command execution time 44 | # stamp shown in the history command output. 45 | # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 46 | # HIST_STAMPS="mm/dd/yyyy" 47 | 48 | # Would you like to use another custom folder than $ZSH/custom? 49 | # ZSH_CUSTOM=/path/to/new-custom-folder 50 | 51 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 52 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 53 | # Example format: plugins=(rails git textmate ruby lighthouse) 54 | # Add wisely, as too many plugins slow down shell startup. 55 | plugins=(git) 56 | 57 | source $ZSH/oh-my-zsh.sh 58 | 59 | # User configuration 60 | 61 | # export MANPATH="/usr/local/man:$MANPATH" 62 | 63 | # You may need to manually set your language environment 64 | # export LANG=en_US.UTF-8 65 | 66 | # Preferred editor for local and remote sessions 67 | # if [[ -n $SSH_CONNECTION ]]; then 68 | # export EDITOR='vim' 69 | # else 70 | # export EDITOR='mvim' 71 | # fi 72 | 73 | # Compilation flags 74 | # export ARCHFLAGS="-arch x86_64" 75 | 76 | # ssh 77 | # export SSH_KEY_PATH="~/.ssh/rsa_id" 78 | 79 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 80 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 81 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 82 | # For a full list of active aliases, run `alias`. 83 | # 84 | 85 | export GOPATH=$HOME/go 86 | 87 | PATH=~/bin:/usr/local/sbin:/usr/local/bin:/usr/local/go/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/games:/snap/bin:$GOPATH/bin 88 | #PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting 89 | 90 | CDPATH=.:~ 91 | 92 | export WORKON_HOME=~/virtualenvs 93 | export PIP_VIRTUALENV_BASE=$WORKON_HOME 94 | # sourcing virtualenvwrapper takes a second. that's too long when starting a new shell 95 | alias venv='source $HOME/bin/virtualenvwrapper.sh' 96 | alias renv='source $HOME/.rvm/scripts/rvm' # Load RVM into a shell session *as a function* 97 | alias ftc='venv && workon ftc' 98 | # nvm takes a second. too long! 99 | export NVM_DIR="$HOME/.nvm" 100 | alias nenv=". $NVM_DIR/nvm.sh" 101 | 102 | source $HOME/.z_passwords 103 | 104 | # Enable command not found support on Ubuntu 105 | [[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found 106 | 107 | # Editor is VSCode in Wayland mode 108 | # export EDITOR="code --enable-features=UseOzonePlatform --ozone-platform=wayland -w" 109 | # Editor is Sublime Text 110 | export EDITOR="subl -w" 111 | export GIT_EDITOR=$EDITOR 112 | export SVN_EDITOR=$EDITOR 113 | 114 | # Parallelize builds by default 115 | export MAKEFLAGS="-j8" 116 | export PYTHONDONTWRITEBYTECODE=1 117 | 118 | export JAVA_HOME=/usr 119 | 120 | export NODE_REPL_HISTORY_FILE=~/.node_history 121 | 122 | # Only page if more than a page 123 | export LESS="-F -X $LESS" 124 | 125 | export CLICOLOR=1 126 | export GREP_COLOR=auto 127 | export LSCOLORS=Exgxcxdxbxegedabagacad 128 | export WORDCHARS='*?[]~&;!$%^<>' 129 | export SFT_DEPLOY_AUTHOR=ggreer 130 | export SFT_DEPLOY_AUTHOR_EMAIL='geoff@greer.fm' 131 | # Run Qt apps in wayland mode 132 | export XDG_SESSION_TYPE=wayland 133 | export XDG_CURRENT_DESKTOP=sway 134 | # Disabled because QT is garbage 135 | #export QT_QPA_PLATFORM='wayland;xcb' # Fall back to X if wayland plugin not available 136 | export QT_QPA_PLATFORM='xcb' # Fall back to X if wayland plugin not available 137 | export QT_QPA_PLATFORM='wayland' # Use wayland for QT apps 138 | export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 139 | export QT_QPA_PLATFORM_PLUGIN_PATH="/usr/lib/qt/plugins" 140 | # Needed to fix ripcord on wayland 141 | export RIPCORD_STYLE_ENGINE=Fusion 142 | # Fix blank windows & incorrect offsets in some java apps in wayland 143 | export _JAVA_AWT_WM_NONREPARENTING=1 144 | # Run firefox in wayland mode 145 | export MOZ_ENABLE_WAYLAND=1 146 | # Fix "Firefox is already running" when opening firefox from x11. 147 | export MOZ_DBUS_REMOTE=1 148 | # Force gstreamer to use vaapi 149 | export GST_VAAPI_ALL_DRIVERS=1 150 | # Run OBS in wayland 151 | export OBS_USE_EGL=1 152 | # Work around https://github.com/swaywm/wlroots/issues/1877 153 | #export WLR_DRM_NO_MODIFIERS=1 154 | # Run all gtk apps in wayland mode 155 | # export GDK_BACKEND=wayland # (commented out because it breaks thunderbird & chromium) 156 | 157 | export GTK_IM_MODULE=ibus 158 | export XMODIFIERS=@im=ibus 159 | export QT_IM_MODULE=ibus 160 | 161 | export HOMEBREW_NO_ANALYTICS=1 162 | 163 | HISTFILE=~/.zsh_history 164 | HISTSIZE=50000 165 | SAVEHIST=50000 166 | setopt INC_APPEND_HISTORY EXTENDED_HISTORY HIST_IGNORE_DUPS 167 | # Use up/down for next/prev when searching history 168 | # bindkey "^[[A" history-beginning-search-backward 169 | # bindkey "^[[B" history-beginning-search-forward 170 | 171 | DIRSTACKSIZE=8 172 | setopt autopushd pushdminus pushdsilent pushdtohome 173 | unsetopt share_history 174 | alias dh='dirs -v' 175 | 176 | # Enable Rupa's Z 177 | . ~/bin/z.sh 178 | 179 | PROMPT='%{$fg[green]%}%n%{$fg[white]%}@%{$fg[yellow]%}%m%{$fg[white]%}:%{$fg[cyan]%}%~% %(?.%{$fg[green]%}.%{$fg[red]%})%B%#%b ' 180 | 181 | alias mv='nocorrect mv' 182 | alias cp='nocorrect cp' 183 | alias mkdir='nocorrect mkdir' 184 | 185 | if ls --color=auto &> /dev/null 186 | then 187 | # GNU ls 188 | alias ls='ls -F --color=auto' 189 | else 190 | # BSD ls 191 | alias ls='ls -GF' 192 | fi 193 | 194 | alias te='ls -a -F' 195 | alias tu='ls -la' 196 | alias ll='ls -la' 197 | alias tet='ls -halt' 198 | alias cd..='cd ..' 199 | alias ..='cd ..' 200 | 201 | # Alacritty's terminfo isn't usually installed on remote machines. Pretend to be xterm-256color 202 | alias ssh='TERM=xterm-256color ssh' 203 | alias assh='ssh -A home.abughrai.be -p 2022 -D3000' 204 | #alias abumount='mkdir -p /Volumes/home.abughrai.be && sshfs -f -p 2022 home.abughrai.be:/x1 /Volumes/home.abughrai.be' 205 | #alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend' 206 | #alias lock='gnome-screensaver-command -l' 207 | alias lock='lock-screen' 208 | alias op='xdg-open' 209 | #alias op='open' 210 | 211 | # TODO: check if the editor already has the directory open or not 212 | alias notes="$EDITOR ~/Documents/notes/" 213 | 214 | alias oktagit="GIT_SSH_COMMAND='ssh -o \"IdentitiesOnly=yes\" -i ~/.ssh/id_rsa_okta' git" 215 | # bindkey -e #Use emacs mode, it's more sane for beginners 216 | # bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word 217 | # bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word 218 | 219 | # Use alt + arrows to move between words 220 | bindkey "\e$terminfo[kcub1]" backward-word 221 | bindkey "\e$terminfo[kcuf1]" forward-word 222 | 223 | # Get fn+delete working in zsh 224 | # bindkey "^[[3~" delete-char 225 | 226 | # autoload edit-command-line 227 | # zle -N edit-command-line 228 | # bindkey '^X^e' edit-command-line 229 | 230 | # Ubuntu 231 | #source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 232 | # Arch 233 | source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 234 | 235 | 236 | ### Utility functions ### 237 | 238 | rot13 () { tr "[a-m][n-z][A-M][N-Z]" "[n-z][a-m][N-Z][A-M]" } 239 | 240 | function git-rm-untracked { 241 | git st -s -u | awk "{ print \$2 }" | xargs rm 242 | } 243 | 244 | function ascp { 245 | scp -P2022 "$@" home.abughrai.be: ; 246 | } 247 | 248 | function upscreen { 249 | URL=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$1'''))") 250 | echo http://abughrai.be/pics/screenshots/$URL 251 | scp "$@" abughrai.be:/usr/local/www/apache24/data/pics/screenshots/ ; 252 | } 253 | 254 | function svtail { 255 | tail -F /service/$@/log/main/current 256 | } 257 | 258 | function svtailall { 259 | tail -F /service/*/log/main/current 260 | } 261 | 262 | function git_current_branch() { 263 | git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///' 264 | } 265 | 266 | function git_current_origin() { 267 | git ls-remote --get-url | sed -e 's/^.*\://' | sed -e 's/\.git.*//' 268 | # git config --get remote.origin.url | sed -e 's/^.*\://' | sed -e 's/\.git.*//' 269 | } 270 | 271 | # create a github pull request from the current branch 272 | alias gpr='op "https://github.com/$(git_current_origin)/pull/new/$(git_current_branch)"' 273 | 274 | # Show manpage in textmate 275 | function tman { 276 | MANWIDTH=100 MANPAGER='col -bx' man $@ | mate 277 | } 278 | 279 | # Function for making PDF versions of man pages 280 | function pman() { 281 | man $@ -t | open -f -a Preview 282 | } 283 | 284 | # usage: "multi 3 echo blah" will print blah 3 times 285 | function multi { 286 | n=$1; shift; for ((i=0;i> "$NOTE_FILE" 26 | 27 | $EDITOR "$NOTE_FILE" 28 | -------------------------------------------------------------------------------- /home/bin/power.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -x 3 | #set -e 4 | 5 | # Disable the NMI watchdog 6 | echo '0' > '/proc/sys/kernel/nmi_watchdog'; 7 | 8 | # Runtime power management for I2C devices 9 | for i in /sys/bus/i2c/devices/*/device/power/control ; do 10 | echo auto > ${i} 11 | done 12 | 13 | # Runtime power-management for PCI devices 14 | for i in /sys/bus/pci/devices/*/power/control ; do 15 | echo auto > ${i} 16 | done 17 | 18 | # Runtime power-management for USB devices 19 | for i in /sys/bus/usb/devices/*/power/control ; do 20 | echo auto > ${i} 21 | done 22 | 23 | # Low power SATA 24 | for i in /sys/class/scsi_host/*/link_power_management_policy ; do 25 | echo min_power > ${i} 26 | done 27 | 28 | # Disable Wake-on-LAN on ethernet port 29 | ethtool -s wlan0 wol d; 30 | ethtool -s eth0 wol d 31 | 32 | #Enable Audio codec power management 33 | echo '1' > '/sys/module/snd_hda_intel/parameters/power_save'; 34 | 35 | # Higher writeback timeout 36 | #echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs' 37 | 38 | # Low power wireless 39 | iw dev wlan0 set power_save on 40 | -------------------------------------------------------------------------------- /home/bin/ripcord-wayland: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QT_QPA_PLATFORM=wayland ripcord 4 | -------------------------------------------------------------------------------- /home/bin/sway-run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export SWAY_CURSOR_THEME=DMZ-Black 4 | export XKB_DEFAULT_LAYOUT=dvorak 5 | eval $(ssh-agent) 6 | 7 | #sway -V -d $@ &> sway.log 8 | sway -V $@ &> sway.log 9 | -------------------------------------------------------------------------------- /home/bin/virtualenvwrapper.sh: -------------------------------------------------------------------------------- 1 | # -*- mode: shell-script -*- 2 | # 3 | # Shell functions to act as wrapper for Ian Bicking's virtualenv 4 | # (http://pypi.python.org/pypi/virtualenv) 5 | # 6 | # 7 | # Copyright Doug Hellmann, All Rights Reserved 8 | # 9 | # Permission to use, copy, modify, and distribute this software and its 10 | # documentation for any purpose and without fee is hereby granted, 11 | # provided that the above copyright notice appear in all copies and that 12 | # both that copyright notice and this permission notice appear in 13 | # supporting documentation, and that the name of Doug Hellmann not be used 14 | # in advertising or publicity pertaining to distribution of the software 15 | # without specific, written prior permission. 16 | # 17 | # DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 18 | # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 19 | # EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR 20 | # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 21 | # USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 22 | # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 23 | # PERFORMANCE OF THIS SOFTWARE. 24 | # 25 | # 26 | # Project home page: http://www.doughellmann.com/projects/virtualenvwrapper/ 27 | # 28 | # 29 | # Setup: 30 | # 31 | # 1. Create a directory to hold the virtual environments. 32 | # (mkdir $HOME/.virtualenvs). 33 | # 2. Add a line like "export WORKON_HOME=$HOME/.virtualenvs" 34 | # to your .bashrc. 35 | # 3. Add a line like "source /path/to/this/file/virtualenvwrapper.sh" 36 | # to your .bashrc. 37 | # 4. Run: source ~/.bashrc 38 | # 5. Run: workon 39 | # 6. A list of environments, empty, is printed. 40 | # 7. Run: mkvirtualenv temp 41 | # 8. Run: workon 42 | # 9. This time, the "temp" environment is included. 43 | # 10. Run: workon temp 44 | # 11. The virtual environment is activated. 45 | # 46 | 47 | # Locate the global Python where virtualenvwrapper is installed. 48 | if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ] 49 | then 50 | VIRTUALENVWRAPPER_PYTHON="$(command \which python)" 51 | fi 52 | 53 | # Set the name of the virtualenv app to use. 54 | if [ "$VIRTUALENVWRAPPER_VIRTUALENV" = "" ] 55 | then 56 | VIRTUALENVWRAPPER_VIRTUALENV="virtualenv" 57 | fi 58 | 59 | # Set the name of the virtualenv-clone app to use. 60 | if [ "$VIRTUALENVWRAPPER_VIRTUALENV_CLONE" = "" ] 61 | then 62 | VIRTUALENVWRAPPER_VIRTUALENV_CLONE="virtualenv-clone" 63 | fi 64 | 65 | # Define script folder depending on the platorm (Win32/Unix) 66 | VIRTUALENVWRAPPER_ENV_BIN_DIR="bin" 67 | if [ "$OS" = "Windows_NT" ] && ([ "$MSYSTEM" = "MINGW32" ] || [ "$MSYSTEM" = "MINGW64" ]) 68 | then 69 | # Only assign this for msys, cygwin use standard Unix paths 70 | # and its own python installation 71 | VIRTUALENVWRAPPER_ENV_BIN_DIR="Scripts" 72 | fi 73 | 74 | # Let the user override the name of the file that holds the project 75 | # directory name. 76 | if [ "$VIRTUALENVWRAPPER_PROJECT_FILENAME" = "" ] 77 | then 78 | export VIRTUALENVWRAPPER_PROJECT_FILENAME=".project" 79 | fi 80 | 81 | # Let the user tell us they never want to cd to projects 82 | # automatically. 83 | export VIRTUALENVWRAPPER_WORKON_CD=${VIRTUALENVWRAPPER_WORKON_CD:-1} 84 | 85 | # Remember where we are running from. 86 | if [ -z "$VIRTUALENVWRAPPER_SCRIPT" ] 87 | then 88 | if [ -n "$BASH" ] 89 | then 90 | export VIRTUALENVWRAPPER_SCRIPT="$BASH_SOURCE" 91 | elif [ -n "$ZSH_VERSION" ] 92 | then 93 | export VIRTUALENVWRAPPER_SCRIPT="$0" 94 | else 95 | export VIRTUALENVWRAPPER_SCRIPT="${.sh.file}" 96 | fi 97 | fi 98 | 99 | # Portable shell scripting is hard, let's go shopping. 100 | # 101 | # People insist on aliasing commands like 'cd', either with a real 102 | # alias or even a shell function. Under bash and zsh, "builtin" forces 103 | # the use of a command that is part of the shell itself instead of an 104 | # alias, function, or external command, while "command" does something 105 | # similar but allows external commands. Under ksh "builtin" registers 106 | # a new command from a shared library, but "command" will pick up 107 | # existing builtin commands. We need to use a builtin for cd because 108 | # we are trying to change the state of the current shell, so we use 109 | # "builtin" for bash and zsh but "command" under ksh. 110 | function virtualenvwrapper_cd { 111 | if [ -n "$BASH" ] 112 | then 113 | builtin \cd "$@" 114 | elif [ -n "$ZSH_VERSION" ] 115 | then 116 | builtin \cd -q "$@" 117 | else 118 | command \cd "$@" 119 | fi 120 | } 121 | 122 | function virtualenvwrapper_expandpath { 123 | if [ "$1" = "" ]; then 124 | return 1 125 | else 126 | "$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.normpath(os.path.expanduser(os.path.expandvars(\"$1\")))+'\n')" 127 | return 0 128 | fi 129 | } 130 | 131 | function virtualenvwrapper_absolutepath { 132 | if [ "$1" = "" ]; then 133 | return 1 134 | else 135 | "$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.abspath(\"$1\")+'\n')" 136 | return 0 137 | fi 138 | } 139 | 140 | function virtualenvwrapper_derive_workon_home { 141 | typeset workon_home_dir="$WORKON_HOME" 142 | 143 | # Make sure there is a default value for WORKON_HOME. 144 | # You can override this setting in your .bashrc. 145 | if [ "$workon_home_dir" = "" ] 146 | then 147 | workon_home_dir="$HOME/.virtualenvs" 148 | fi 149 | 150 | # If the path is relative, prefix it with $HOME 151 | # (note: for compatibility) 152 | if echo "$workon_home_dir" | (unset GREP_OPTIONS; command \grep '^[^/~]' > /dev/null) 153 | then 154 | workon_home_dir="$HOME/$WORKON_HOME" 155 | fi 156 | 157 | # Only call on Python to fix the path if it looks like the 158 | # path might contain stuff to expand. 159 | # (it might be possible to do this in shell, but I don't know a 160 | # cross-shell-safe way of doing it -wolever) 161 | if echo "$workon_home_dir" | (unset GREP_OPTIONS; command \egrep '([\$~]|//)' >/dev/null) 162 | then 163 | # This will normalize the path by: 164 | # - Removing extra slashes (e.g., when TMPDIR ends in a slash) 165 | # - Expanding variables (e.g., $foo) 166 | # - Converting ~s to complete paths (e.g., ~/ to /home/brian/ and ~arthur to /home/arthur) 167 | workon_home_dir="$(virtualenvwrapper_expandpath "$workon_home_dir")" 168 | fi 169 | 170 | echo "$workon_home_dir" 171 | return 0 172 | } 173 | 174 | # Check if the WORKON_HOME directory exists, 175 | # create it if it does not 176 | # seperate from creating the files in it because this used to just error 177 | # and maybe other things rely on the dir existing before that happens. 178 | function virtualenvwrapper_verify_workon_home { 179 | RC=0 180 | if [ ! -d "$WORKON_HOME/" ] 181 | then 182 | if [ "$1" != "-q" ] 183 | then 184 | echo "NOTE: Virtual environments directory $WORKON_HOME does not exist. Creating..." 1>&2 185 | fi 186 | mkdir -p "$WORKON_HOME" 187 | RC=$? 188 | fi 189 | return $RC 190 | } 191 | 192 | #HOOK_VERBOSE_OPTION="-q" 193 | 194 | # Function to wrap mktemp so tests can replace it for error condition 195 | # testing. 196 | function virtualenvwrapper_mktemp { 197 | command \mktemp "$@" 198 | } 199 | 200 | # Expects 1 argument, the suffix for the new file. 201 | function virtualenvwrapper_tempfile { 202 | # Note: the 'X's must come last 203 | typeset suffix=${1:-hook} 204 | typeset file 205 | 206 | file="$(virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix-XXXXXXXXXX)" 207 | touch "$file" 208 | if [ $? -ne 0 ] || [ -z "$file" ] || [ ! -f "$file" ] 209 | then 210 | echo "ERROR: virtualenvwrapper could not create a temporary file name." 1>&2 211 | return 1 212 | fi 213 | echo $file 214 | return 0 215 | } 216 | 217 | # Run the hooks 218 | function virtualenvwrapper_run_hook { 219 | typeset hook_script 220 | typeset result 221 | 222 | hook_script="$(virtualenvwrapper_tempfile ${1}-hook)" || return 1 223 | 224 | # Use a subshell to run the python interpreter with hook_loader so 225 | # we can change the working directory. This avoids having the 226 | # Python 3 interpreter decide that its "prefix" is the virtualenv 227 | # if we happen to be inside the virtualenv when we start. 228 | ( \ 229 | virtualenvwrapper_cd "$WORKON_HOME" && 230 | "$VIRTUALENVWRAPPER_PYTHON" -m 'virtualenvwrapper.hook_loader' \ 231 | $HOOK_VERBOSE_OPTION --script "$hook_script" "$@" \ 232 | ) 233 | result=$? 234 | 235 | if [ $result -eq 0 ] 236 | then 237 | if [ ! -f "$hook_script" ] 238 | then 239 | echo "ERROR: virtualenvwrapper_run_hook could not find temporary file $hook_script" 1>&2 240 | command \rm -f "$hook_script" 241 | return 2 242 | fi 243 | # cat "$hook_script" 244 | source "$hook_script" 245 | elif [ "${1}" = "initialize" ] 246 | then 247 | cat - 1>&2 <&2 325 | return 1 326 | fi 327 | if [ ! -e "$exe_path" ] 328 | then 329 | echo "ERROR: Found $1 in path as \"$exe_path\" but that does not exist" >&2 330 | return 1 331 | fi 332 | return 0 333 | } 334 | 335 | 336 | # Verify that virtualenv is installed and visible 337 | function virtualenvwrapper_verify_virtualenv { 338 | virtualenvwrapper_verify_resource $VIRTUALENVWRAPPER_VIRTUALENV 339 | } 340 | 341 | 342 | function virtualenvwrapper_verify_virtualenv_clone { 343 | virtualenvwrapper_verify_resource $VIRTUALENVWRAPPER_VIRTUALENV_CLONE 344 | } 345 | 346 | 347 | # Verify that the requested environment exists 348 | function virtualenvwrapper_verify_workon_environment { 349 | typeset env_name="$1" 350 | if [ ! -d "$WORKON_HOME/$env_name" ] 351 | then 352 | echo "ERROR: Environment '$env_name' does not exist. Create it with 'mkvirtualenv $env_name'." >&2 353 | return 1 354 | fi 355 | return 0 356 | } 357 | 358 | # Verify that the active environment exists 359 | function virtualenvwrapper_verify_active_environment { 360 | if [ ! -n "${VIRTUAL_ENV}" ] || [ ! -d "${VIRTUAL_ENV}" ] 361 | then 362 | echo "ERROR: no virtualenv active, or active virtualenv is missing" >&2 363 | return 1 364 | fi 365 | return 0 366 | } 367 | 368 | # Help text for mkvirtualenv 369 | function virtualenvwrapper_mkvirtualenv_help { 370 | echo "Usage: mkvirtualenv [-a project_path] [-i package] [-r requirements_file] [virtualenv options] env_name" 371 | echo 372 | echo " -a project_path" 373 | echo 374 | echo " Provide a full path to a project directory to associate with" 375 | echo " the new environment." 376 | echo 377 | echo " -i package" 378 | echo 379 | echo " Install a package after the environment is created." 380 | echo " This option may be repeated." 381 | echo 382 | echo " -r requirements_file" 383 | echo 384 | echo " Provide a pip requirements file to install a base set of packages" 385 | echo " into the new environment." 386 | echo; 387 | echo 'virtualenv help:'; 388 | echo; 389 | "$VIRTUALENVWRAPPER_VIRTUALENV" $@; 390 | } 391 | 392 | # Create a new environment, in the WORKON_HOME. 393 | # 394 | # Usage: mkvirtualenv [options] ENVNAME 395 | # (where the options are passed directly to virtualenv) 396 | # 397 | #:help:mkvirtualenv: Create a new virtualenv in $WORKON_HOME 398 | function mkvirtualenv { 399 | typeset -a in_args 400 | typeset -a out_args 401 | typeset -i i 402 | typeset tst 403 | typeset a 404 | typeset envname 405 | typeset requirements 406 | typeset packages 407 | typeset interpreter 408 | typeset project 409 | 410 | in_args=( "$@" ) 411 | 412 | if [ -n "$ZSH_VERSION" ] 413 | then 414 | i=1 415 | tst="-le" 416 | else 417 | i=0 418 | tst="-lt" 419 | fi 420 | while [ $i $tst $# ] 421 | do 422 | a="${in_args[$i]}" 423 | # echo "arg $i : $a" 424 | case "$a" in 425 | -a) 426 | i=$(( $i + 1 )) 427 | project="${in_args[$i]}" 428 | if [ ! -d "$project" ] 429 | then 430 | echo "Cannot associate project with $project, it is not a directory" 1>&2 431 | return 1 432 | fi 433 | project="$(virtualenvwrapper_absolutepath ${project})";; 434 | -h|--help) 435 | virtualenvwrapper_mkvirtualenv_help $a; 436 | return;; 437 | -i) 438 | i=$(( $i + 1 )); 439 | packages="$packages ${in_args[$i]}";; 440 | -p|--python*) 441 | if echo "$a" | grep -q "=" 442 | then 443 | interpreter="$(echo "$a" | cut -f2 -d=)" 444 | else 445 | i=$(( $i + 1 )) 446 | interpreter="${in_args[$i]}" 447 | fi;; 448 | -r) 449 | i=$(( $i + 1 )); 450 | requirements="${in_args[$i]}"; 451 | requirements="$(virtualenvwrapper_expandpath "$requirements")";; 452 | *) 453 | if [ ${#out_args} -gt 0 ] 454 | then 455 | out_args=( "${out_args[@]-}" "$a" ) 456 | else 457 | out_args=( "$a" ) 458 | fi;; 459 | esac 460 | i=$(( $i + 1 )) 461 | done 462 | 463 | if [ ! -z $interpreter ] 464 | then 465 | out_args=( "--python=$interpreter" ${out_args[@]} ) 466 | fi; 467 | 468 | set -- "${out_args[@]}" 469 | 470 | eval "envname=\$$#" 471 | virtualenvwrapper_verify_workon_home || return 1 472 | virtualenvwrapper_verify_virtualenv || return 1 473 | ( 474 | [ -n "$ZSH_VERSION" ] && setopt SH_WORD_SPLIT 475 | virtualenvwrapper_cd "$WORKON_HOME" && 476 | "$VIRTUALENVWRAPPER_VIRTUALENV" $VIRTUALENVWRAPPER_VIRTUALENV_ARGS "$@" && 477 | [ -d "$WORKON_HOME/$envname" ] && \ 478 | virtualenvwrapper_run_hook "pre_mkvirtualenv" "$envname" 479 | ) 480 | typeset RC=$? 481 | [ $RC -ne 0 ] && return $RC 482 | 483 | # If they passed a help option or got an error from virtualenv, 484 | # the environment won't exist. Use that to tell whether 485 | # we should switch to the environment and run the hook. 486 | [ ! -d "$WORKON_HOME/$envname" ] && return 0 487 | 488 | # If they gave us a project directory, set it up now 489 | # so the activate hooks can find it. 490 | if [ ! -z "$project" ] 491 | then 492 | setvirtualenvproject "$WORKON_HOME/$envname" "$project" 493 | RC=$? 494 | [ $RC -ne 0 ] && return $RC 495 | fi 496 | 497 | # Now activate the new environment 498 | workon "$envname" 499 | 500 | if [ ! -z "$requirements" ] 501 | then 502 | pip install -r "$requirements" 503 | fi 504 | 505 | for a in $packages 506 | do 507 | pip install $a 508 | done 509 | 510 | virtualenvwrapper_run_hook "post_mkvirtualenv" 511 | } 512 | 513 | #:help:rmvirtualenv: Remove a virtualenv 514 | function rmvirtualenv { 515 | virtualenvwrapper_verify_workon_home || return 1 516 | if [ ${#@} = 0 ] 517 | then 518 | echo "Please specify an enviroment." >&2 519 | return 1 520 | fi 521 | 522 | # support to remove several environments 523 | typeset env_name 524 | # Must quote the parameters, as environments could have spaces in their names 525 | for env_name in "$@" 526 | do 527 | echo "Removing $env_name..." 528 | typeset env_dir="$WORKON_HOME/$env_name" 529 | if [ "$VIRTUAL_ENV" = "$env_dir" ] 530 | then 531 | echo "ERROR: You cannot remove the active environment ('$env_name')." >&2 532 | echo "Either switch to another environment, or run 'deactivate'." >&2 533 | return 1 534 | fi 535 | 536 | if [ ! -d "$env_dir" ]; then 537 | echo "Did not find environment $env_dir to remove." >&2 538 | fi 539 | 540 | # Move out of the current directory to one known to be 541 | # safe, in case we are inside the environment somewhere. 542 | typeset prior_dir="$(pwd)" 543 | virtualenvwrapper_cd "$WORKON_HOME" 544 | 545 | virtualenvwrapper_run_hook "pre_rmvirtualenv" "$env_name" 546 | command \rm -rf "$env_dir" 547 | virtualenvwrapper_run_hook "post_rmvirtualenv" "$env_name" 548 | 549 | # If the directory we used to be in still exists, move back to it. 550 | if [ -d "$prior_dir" ] 551 | then 552 | virtualenvwrapper_cd "$prior_dir" 553 | fi 554 | done 555 | } 556 | 557 | # List the available environments. 558 | function virtualenvwrapper_show_workon_options { 559 | virtualenvwrapper_verify_workon_home || return 1 560 | # NOTE: DO NOT use ls or cd here because colorized versions spew control 561 | # characters into the output list. 562 | # echo seems a little faster than find, even with -depth 3. 563 | # Note that this is a little tricky, as there may be spaces in the path. 564 | # 565 | # 1. Look for environments by finding the activate scripts. 566 | # Use a subshell so we can suppress the message printed 567 | # by zsh if the glob pattern fails to match any files. 568 | # This yields a single, space-separated line containing all matches. 569 | # 2. Replace the trailing newline with a space, so every 570 | # possible env has a space following it. 571 | # 3. Strip the bindir/activate script suffix, replacing it with 572 | # a slash, as that is an illegal character in a directory name. 573 | # This yields a slash-separated list of possible env names. 574 | # 4. Replace each slash with a newline to show the output one name per line. 575 | # 5. Eliminate any lines with * on them because that means there 576 | # were no envs. 577 | (virtualenvwrapper_cd "$WORKON_HOME" && echo */$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate) 2>/dev/null \ 578 | | command \tr "\n" " " \ 579 | | command \sed "s|/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate |/|g" \ 580 | | command \tr "/" "\n" \ 581 | | command \sed "/^\s*$/d" \ 582 | | (unset GREP_OPTIONS; command \egrep -v '^\*$') 2>/dev/null 583 | } 584 | 585 | function _lsvirtualenv_usage { 586 | echo "lsvirtualenv [-blh]" 587 | echo " -b -- brief mode" 588 | echo " -l -- long mode" 589 | echo " -h -- this help message" 590 | } 591 | 592 | #:help:lsvirtualenv: list virtualenvs 593 | function lsvirtualenv { 594 | 595 | typeset long_mode=true 596 | if command -v "getopts" &> /dev/null 597 | then 598 | # Use getopts when possible 599 | OPTIND=1 600 | while getopts ":blh" opt "$@" 601 | do 602 | case "$opt" in 603 | l) long_mode=true;; 604 | b) long_mode=false;; 605 | h) _lsvirtualenv_usage; 606 | return 1;; 607 | ?) echo "Invalid option: -$OPTARG" >&2; 608 | _lsvirtualenv_usage; 609 | return 1;; 610 | esac 611 | done 612 | else 613 | # fallback on getopt for other shell 614 | typeset -a args 615 | args=($(getopt blh "$@")) 616 | if [ $? != 0 ] 617 | then 618 | _lsvirtualenv_usage 619 | return 1 620 | fi 621 | for opt in $args 622 | do 623 | case "$opt" in 624 | -l) long_mode=true;; 625 | -b) long_mode=false;; 626 | -h) _lsvirtualenv_usage; 627 | return 1;; 628 | esac 629 | done 630 | fi 631 | 632 | if $long_mode 633 | then 634 | allvirtualenv showvirtualenv "$env_name" 635 | else 636 | virtualenvwrapper_show_workon_options 637 | fi 638 | } 639 | 640 | #:help:showvirtualenv: show details of a single virtualenv 641 | function showvirtualenv { 642 | typeset env_name="$1" 643 | if [ -z "$env_name" ] 644 | then 645 | if [ -z "$VIRTUAL_ENV" ] 646 | then 647 | echo "showvirtualenv [env]" 648 | return 1 649 | fi 650 | env_name=$(basename "$VIRTUAL_ENV") 651 | fi 652 | 653 | virtualenvwrapper_run_hook "get_env_details" "$env_name" 654 | echo 655 | } 656 | 657 | # Show help for workon 658 | function virtualenvwrapper_workon_help { 659 | echo "Usage: workon env_name" 660 | echo "" 661 | echo " Deactivate any currently activated virtualenv" 662 | echo " and activate the named environment, triggering" 663 | echo " any hooks in the process." 664 | echo "" 665 | echo " workon" 666 | echo "" 667 | echo " Print a list of available environments." 668 | echo " (See also lsvirtualenv -b)" 669 | echo "" 670 | echo " workon (-h|--help)" 671 | echo "" 672 | echo " Show this help message." 673 | echo "" 674 | echo " workon (-c|--cd) envname" 675 | echo "" 676 | echo " After activating the environment, cd to the associated" 677 | echo " project directory if it is set." 678 | echo "" 679 | echo " workon (-n|--no-cd) envname" 680 | echo "" 681 | echo " After activating the environment, do not cd to the" 682 | echo " associated project directory." 683 | echo "" 684 | } 685 | 686 | #:help:workon: list or change working virtualenvs 687 | function workon { 688 | typeset -a in_args 689 | typeset -a out_args 690 | 691 | in_args=( "$@" ) 692 | 693 | if [ -n "$ZSH_VERSION" ] 694 | then 695 | i=1 696 | tst="-le" 697 | else 698 | i=0 699 | tst="-lt" 700 | fi 701 | typeset cd_after_activate=$VIRTUALENVWRAPPER_WORKON_CD 702 | while [ $i $tst $# ] 703 | do 704 | a="${in_args[$i]}" 705 | case "$a" in 706 | -h|--help) 707 | virtualenvwrapper_workon_help; 708 | return 0;; 709 | -n|--no-cd) 710 | cd_after_activate=0;; 711 | -c|--cd) 712 | cd_after_activate=1;; 713 | *) 714 | if [ ${#out_args} -gt 0 ] 715 | then 716 | out_args=( "${out_args[@]-}" "$a" ) 717 | else 718 | out_args=( "$a" ) 719 | fi;; 720 | esac 721 | i=$(( $i + 1 )) 722 | done 723 | 724 | set -- "${out_args[@]}" 725 | 726 | typeset env_name="$1" 727 | if [ "$env_name" = "" ] 728 | then 729 | lsvirtualenv -b 730 | return 1 731 | elif [ "$env_name" = "." ] 732 | then 733 | # The IFS default of breaking on whitespace causes issues if there 734 | # are spaces in the env_name, so change it. 735 | IFS='%' 736 | env_name="$(basename $(pwd))" 737 | unset IFS 738 | fi 739 | 740 | virtualenvwrapper_verify_workon_home || return 1 741 | virtualenvwrapper_verify_workon_environment "$env_name" || return 1 742 | 743 | activate="$WORKON_HOME/$env_name/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate" 744 | if [ ! -f "$activate" ] 745 | then 746 | echo "ERROR: Environment '$WORKON_HOME/$env_name' does not contain an activate script." >&2 747 | return 1 748 | fi 749 | 750 | # Deactivate any current environment "destructively" 751 | # before switching so we use our override function, 752 | # if it exists. 753 | type deactivate >/dev/null 2>&1 754 | if [ $? -eq 0 ] 755 | then 756 | deactivate 757 | unset -f deactivate >/dev/null 2>&1 758 | fi 759 | 760 | virtualenvwrapper_run_hook "pre_activate" "$env_name" 761 | 762 | source "$activate" 763 | 764 | # Save the deactivate function from virtualenv under a different name 765 | virtualenvwrapper_original_deactivate=`typeset -f deactivate | sed 's/deactivate/virtualenv_deactivate/g'` 766 | eval "$virtualenvwrapper_original_deactivate" 767 | unset -f deactivate >/dev/null 2>&1 768 | 769 | # Replace the deactivate() function with a wrapper. 770 | eval 'deactivate () { 771 | typeset env_postdeactivate_hook 772 | typeset old_env 773 | 774 | # Call the local hook before the global so we can undo 775 | # any settings made by the local postactivate first. 776 | virtualenvwrapper_run_hook "pre_deactivate" 777 | 778 | env_postdeactivate_hook="$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/postdeactivate" 779 | old_env=$(basename "$VIRTUAL_ENV") 780 | 781 | # Call the original function. 782 | virtualenv_deactivate $1 783 | 784 | virtualenvwrapper_run_hook "post_deactivate" "$old_env" 785 | 786 | if [ ! "$1" = "nondestructive" ] 787 | then 788 | # Remove this function 789 | unset -f virtualenv_deactivate >/dev/null 2>&1 790 | unset -f deactivate >/dev/null 2>&1 791 | fi 792 | 793 | }' 794 | 795 | VIRTUALENVWRAPPER_PROJECT_CD=$cd_after_activate virtualenvwrapper_run_hook "post_activate" 796 | 797 | return 0 798 | } 799 | 800 | 801 | # Prints the Python version string for the current interpreter. 802 | function virtualenvwrapper_get_python_version { 803 | # Uses the Python from the virtualenv rather than 804 | # VIRTUALENVWRAPPER_PYTHON because we're trying to determine the 805 | # version installed there so we can build up the path to the 806 | # site-packages directory. 807 | "$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/python" -V 2>&1 | cut -f2 -d' ' | cut -f-2 -d. 808 | } 809 | 810 | # Prints the path to the site-packages directory for the current environment. 811 | function virtualenvwrapper_get_site_packages_dir { 812 | "$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/python" -c "import distutils; print(distutils.sysconfig.get_python_lib())" 813 | } 814 | 815 | # Path management for packages outside of the virtual env. 816 | # Based on a contribution from James Bennett and Jannis Leidel. 817 | # 818 | # add2virtualenv directory1 directory2 ... 819 | # 820 | # Adds the specified directories to the Python path for the 821 | # currently-active virtualenv. This will be done by placing the 822 | # directory names in a path file named 823 | # "virtualenv_path_extensions.pth" inside the virtualenv's 824 | # site-packages directory; if this file does not exist, it will be 825 | # created first. 826 | # 827 | #:help:add2virtualenv: add directory to the import path 828 | function add2virtualenv { 829 | virtualenvwrapper_verify_workon_home || return 1 830 | virtualenvwrapper_verify_active_environment || return 1 831 | 832 | site_packages="`virtualenvwrapper_get_site_packages_dir`" 833 | 834 | if [ ! -d "${site_packages}" ] 835 | then 836 | echo "ERROR: currently-active virtualenv does not appear to have a site-packages directory" >&2 837 | return 1 838 | fi 839 | 840 | # Prefix with _ to ensure we are loaded as early as possible, 841 | # and at least before easy_install.pth. 842 | path_file="$site_packages/_virtualenv_path_extensions.pth" 843 | 844 | if [ "$*" = "" ] 845 | then 846 | echo "Usage: add2virtualenv dir [dir ...]" 847 | if [ -f "$path_file" ] 848 | then 849 | echo 850 | echo "Existing paths:" 851 | cat "$path_file" | grep -v "^import" 852 | fi 853 | return 1 854 | fi 855 | 856 | remove=0 857 | if [ "$1" = "-d" ] 858 | then 859 | remove=1 860 | shift 861 | fi 862 | 863 | if [ ! -f "$path_file" ] 864 | then 865 | echo "import sys; sys.__plen = len(sys.path)" > "$path_file" || return 1 866 | echo "import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)" >> "$path_file" || return 1 867 | fi 868 | 869 | for pydir in "$@" 870 | do 871 | absolute_path="$(virtualenvwrapper_absolutepath "$pydir")" 872 | if [ "$absolute_path" != "$pydir" ] 873 | then 874 | echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2 875 | fi 876 | 877 | if [ $remove -eq 1 ] 878 | then 879 | sed -i.tmp "\:^$absolute_path$: d" "$path_file" 880 | else 881 | sed -i.tmp '1 a\ 882 | '"$absolute_path"' 883 | ' "$path_file" 884 | fi 885 | rm -f "${path_file}.tmp" 886 | done 887 | return 0 888 | } 889 | 890 | # Does a ``cd`` to the site-packages directory of the currently-active 891 | # virtualenv. 892 | #:help:cdsitepackages: change to the site-packages directory 893 | function cdsitepackages { 894 | virtualenvwrapper_verify_workon_home || return 1 895 | virtualenvwrapper_verify_active_environment || return 1 896 | typeset site_packages="`virtualenvwrapper_get_site_packages_dir`" 897 | virtualenvwrapper_cd "$site_packages/$1" 898 | } 899 | 900 | # Does a ``cd`` to the root of the currently-active virtualenv. 901 | #:help:cdvirtualenv: change to the $VIRTUAL_ENV directory 902 | function cdvirtualenv { 903 | virtualenvwrapper_verify_workon_home || return 1 904 | virtualenvwrapper_verify_active_environment || return 1 905 | virtualenvwrapper_cd "$VIRTUAL_ENV/$1" 906 | } 907 | 908 | # Shows the content of the site-packages directory of the currently-active 909 | # virtualenv 910 | #:help:lssitepackages: list contents of the site-packages directory 911 | function lssitepackages { 912 | virtualenvwrapper_verify_workon_home || return 1 913 | virtualenvwrapper_verify_active_environment || return 1 914 | typeset site_packages="`virtualenvwrapper_get_site_packages_dir`" 915 | ls $@ "$site_packages" 916 | 917 | path_file="$site_packages/_virtualenv_path_extensions.pth" 918 | if [ -f "$path_file" ] 919 | then 920 | echo 921 | echo "_virtualenv_path_extensions.pth:" 922 | cat "$path_file" 923 | fi 924 | } 925 | 926 | # Toggles the currently-active virtualenv between having and not having 927 | # access to the global site-packages. 928 | #:help:toggleglobalsitepackages: turn access to global site-packages on/off 929 | function toggleglobalsitepackages { 930 | virtualenvwrapper_verify_workon_home || return 1 931 | virtualenvwrapper_verify_active_environment || return 1 932 | typeset no_global_site_packages_file="`virtualenvwrapper_get_site_packages_dir`/../no-global-site-packages.txt" 933 | if [ -f $no_global_site_packages_file ]; then 934 | rm $no_global_site_packages_file 935 | [ "$1" = "-q" ] || echo "Enabled global site-packages" 936 | else 937 | touch $no_global_site_packages_file 938 | [ "$1" = "-q" ] || echo "Disabled global site-packages" 939 | fi 940 | } 941 | 942 | #:help:cpvirtualenv: duplicate the named virtualenv to make a new one 943 | function cpvirtualenv { 944 | virtualenvwrapper_verify_workon_home || return 1 945 | virtualenvwrapper_verify_virtualenv_clone || return 1 946 | 947 | typeset src_name="$1" 948 | typeset trg_name="$2" 949 | typeset src 950 | typeset trg 951 | 952 | # without a source there is nothing to do 953 | if [ "$src_name" = "" ]; then 954 | echo "Please provide a valid virtualenv to copy." 955 | return 1 956 | else 957 | # see if it's already in workon 958 | if [ ! -e "$WORKON_HOME/$src_name" ]; then 959 | # so it's a virtualenv we are importing 960 | # make sure we have a full path 961 | # and get the name 962 | src="$(virtualenvwrapper_expandpath "$src_name")" 963 | # final verification 964 | if [ ! -e "$src" ]; then 965 | echo "Please provide a valid virtualenv to copy." 966 | return 1 967 | fi 968 | src_name="$(basename "$src")" 969 | else 970 | src="$WORKON_HOME/$src_name" 971 | fi 972 | fi 973 | 974 | if [ "$trg_name" = "" ]; then 975 | # target not given, assume 976 | # same as source 977 | trg="$WORKON_HOME/$src_name" 978 | trg_name="$src_name" 979 | else 980 | trg="$WORKON_HOME/$trg_name" 981 | fi 982 | trg="$(virtualenvwrapper_expandpath "$trg")" 983 | 984 | # validate trg does not already exist 985 | # catch copying virtualenv in workon home 986 | # to workon home 987 | if [ -e "$trg" ]; then 988 | echo "$trg_name virtualenv already exists." 989 | return 1 990 | fi 991 | 992 | echo "Copying $src_name as $trg_name..." 993 | ( 994 | [ -n "$ZSH_VERSION" ] && setopt SH_WORD_SPLIT 995 | virtualenvwrapper_cd "$WORKON_HOME" && 996 | "$VIRTUALENVWRAPPER_VIRTUALENV_CLONE" "$src" "$trg" 997 | [ -d "$trg" ] && 998 | virtualenvwrapper_run_hook "pre_cpvirtualenv" "$src" "$trg_name" && 999 | virtualenvwrapper_run_hook "pre_mkvirtualenv" "$trg_name" 1000 | ) 1001 | typeset RC=$? 1002 | [ $RC -ne 0 ] && return $RC 1003 | 1004 | [ ! -d "$WORKON_HOME/$trg_name" ] && return 1 1005 | 1006 | # Now activate the new environment 1007 | workon "$trg_name" 1008 | 1009 | virtualenvwrapper_run_hook "post_mkvirtualenv" 1010 | virtualenvwrapper_run_hook "post_cpvirtualenv" 1011 | } 1012 | 1013 | # 1014 | # virtualenvwrapper project functions 1015 | # 1016 | 1017 | # Verify that the PROJECT_HOME directory exists 1018 | function virtualenvwrapper_verify_project_home { 1019 | if [ -z "$PROJECT_HOME" ] 1020 | then 1021 | echo "ERROR: Set the PROJECT_HOME shell variable to the name of the directory where projects should be created." >&2 1022 | return 1 1023 | fi 1024 | if [ ! -d "$PROJECT_HOME" ] 1025 | then 1026 | [ "$1" != "-q" ] && echo "ERROR: Project directory '$PROJECT_HOME' does not exist. Create it or set PROJECT_HOME to an existing directory." >&2 1027 | return 1 1028 | fi 1029 | return 0 1030 | } 1031 | 1032 | # Given a virtualenv directory and a project directory, 1033 | # set the virtualenv up to be associated with the 1034 | # project 1035 | #:help:setvirtualenvproject: associate a project directory with a virtualenv 1036 | function setvirtualenvproject { 1037 | typeset venv="$1" 1038 | typeset prj="$2" 1039 | if [ -z "$venv" ] 1040 | then 1041 | venv="$VIRTUAL_ENV" 1042 | fi 1043 | if [ -z "$prj" ] 1044 | then 1045 | prj="$(pwd)" 1046 | else 1047 | prj=$(virtualenvwrapper_absolutepath "${prj}") 1048 | fi 1049 | 1050 | # If what we were given isn't a directory, see if it is under 1051 | # $WORKON_HOME. 1052 | if [ ! -d "$venv" ] 1053 | then 1054 | venv="$WORKON_HOME/$venv" 1055 | fi 1056 | if [ ! -d "$venv" ] 1057 | then 1058 | echo "No virtualenv $(basename $venv)" 1>&2 1059 | return 1 1060 | fi 1061 | 1062 | # Make sure we have a valid project setting 1063 | if [ ! -d "$prj" ] 1064 | then 1065 | echo "Cannot associate virtualenv with \"$prj\", it is not a directory" 1>&2 1066 | return 1 1067 | fi 1068 | 1069 | echo "Setting project for $(basename $venv) to $prj" 1070 | echo "$prj" > "$venv/$VIRTUALENVWRAPPER_PROJECT_FILENAME" 1071 | } 1072 | 1073 | # Show help for mkproject 1074 | function virtualenvwrapper_mkproject_help { 1075 | echo "Usage: mkproject [-f|--force] [-t template] [virtualenv options] project_name" 1076 | echo 1077 | echo "-f, --force Create the virtualenv even if the project directory" 1078 | echo " already exists" 1079 | echo 1080 | echo "Multiple templates may be selected. They are applied in the order" 1081 | echo "specified on the command line." 1082 | echo 1083 | echo "mkvirtualenv help:" 1084 | echo 1085 | mkvirtualenv -h 1086 | echo 1087 | echo "Available project templates:" 1088 | echo 1089 | "$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' -l project.template 1090 | } 1091 | 1092 | #:help:mkproject: create a new project directory and its associated virtualenv 1093 | function mkproject { 1094 | typeset -a in_args 1095 | typeset -a out_args 1096 | typeset -i i 1097 | typeset tst 1098 | typeset a 1099 | typeset t 1100 | typeset force 1101 | typeset templates 1102 | 1103 | in_args=( "$@" ) 1104 | force=0 1105 | 1106 | if [ -n "$ZSH_VERSION" ] 1107 | then 1108 | i=1 1109 | tst="-le" 1110 | else 1111 | i=0 1112 | tst="-lt" 1113 | fi 1114 | while [ $i $tst $# ] 1115 | do 1116 | a="${in_args[$i]}" 1117 | case "$a" in 1118 | -h|--help) 1119 | virtualenvwrapper_mkproject_help; 1120 | return;; 1121 | -f|--force) 1122 | force=1;; 1123 | -t) 1124 | i=$(( $i + 1 )); 1125 | templates="$templates ${in_args[$i]}";; 1126 | *) 1127 | if [ ${#out_args} -gt 0 ] 1128 | then 1129 | out_args=( "${out_args[@]-}" "$a" ) 1130 | else 1131 | out_args=( "$a" ) 1132 | fi;; 1133 | esac 1134 | i=$(( $i + 1 )) 1135 | done 1136 | 1137 | set -- "${out_args[@]}" 1138 | 1139 | # echo "templates $templates" 1140 | # echo "remainder $@" 1141 | # return 0 1142 | 1143 | eval "typeset envname=\$$#" 1144 | virtualenvwrapper_verify_project_home || return 1 1145 | 1146 | if [ -d "$PROJECT_HOME/$envname" -a $force -eq 0 ] 1147 | then 1148 | echo "Project $envname already exists." >&2 1149 | return 1 1150 | fi 1151 | 1152 | mkvirtualenv "$@" || return 1 1153 | 1154 | virtualenvwrapper_cd "$PROJECT_HOME" 1155 | 1156 | virtualenvwrapper_run_hook "project.pre_mkproject" $envname 1157 | 1158 | echo "Creating $PROJECT_HOME/$envname" 1159 | mkdir -p "$PROJECT_HOME/$envname" 1160 | setvirtualenvproject "$VIRTUAL_ENV" "$PROJECT_HOME/$envname" 1161 | 1162 | virtualenvwrapper_cd "$PROJECT_HOME/$envname" 1163 | 1164 | for t in $templates 1165 | do 1166 | echo 1167 | echo "Applying template $t" 1168 | # For some reason zsh insists on prefixing the template 1169 | # names with a space, so strip them out before passing 1170 | # the value to the hook loader. 1171 | virtualenvwrapper_run_hook --name $(echo $t | sed 's/^ //') "project.template" "$envname" "$PROJECT_HOME/$envname" 1172 | done 1173 | 1174 | virtualenvwrapper_run_hook "project.post_mkproject" 1175 | } 1176 | 1177 | #:help:cdproject: change directory to the active project 1178 | function cdproject { 1179 | virtualenvwrapper_verify_workon_home || return 1 1180 | virtualenvwrapper_verify_active_environment || return 1 1181 | if [ -f "$VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME" ] 1182 | then 1183 | typeset project_dir="$(cat "$VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME")" 1184 | if [ ! -z "$project_dir" ] 1185 | then 1186 | virtualenvwrapper_cd "$project_dir" 1187 | else 1188 | echo "Project directory $project_dir does not exist" 1>&2 1189 | return 1 1190 | fi 1191 | else 1192 | echo "No project set in $VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME" 1>&2 1193 | return 1 1194 | fi 1195 | return 0 1196 | } 1197 | 1198 | # 1199 | # Temporary virtualenv 1200 | # 1201 | # Originally part of virtualenvwrapper.tmpenv plugin 1202 | # 1203 | #:help:mktmpenv: create a temporary virtualenv 1204 | function mktmpenv { 1205 | typeset tmpenvname 1206 | typeset RC 1207 | typeset -a in_args 1208 | typeset -a out_args 1209 | 1210 | in_args=( "$@" ) 1211 | 1212 | if [ -n "$ZSH_VERSION" ] 1213 | then 1214 | i=1 1215 | tst="-le" 1216 | else 1217 | i=0 1218 | tst="-lt" 1219 | fi 1220 | typeset cd_after_activate=$VIRTUALENVWRAPPER_WORKON_CD 1221 | while [ $i $tst $# ] 1222 | do 1223 | a="${in_args[$i]}" 1224 | case "$a" in 1225 | -n|--no-cd) 1226 | cd_after_activate=0;; 1227 | -c|--cd) 1228 | cd_after_activate=1;; 1229 | *) 1230 | if [ ${#out_args} -gt 0 ] 1231 | then 1232 | out_args=( "${out_args[@]-}" "$a" ) 1233 | else 1234 | out_args=( "$a" ) 1235 | fi;; 1236 | esac 1237 | i=$(( $i + 1 )) 1238 | done 1239 | 1240 | set -- "${out_args[@]}" 1241 | 1242 | # Generate a unique temporary name 1243 | tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid,sys; sys.stdout.write(uuid.uuid4()+"\n")' 2>/dev/null) 1244 | if [ -z "$tmpenvname" ] 1245 | then 1246 | # This python does not support uuid 1247 | tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import random,sys; sys.stdout.write(hex(random.getrandbits(64))[2:-1]+"\n")' 2>/dev/null) 1248 | fi 1249 | tmpenvname="tmp-$tmpenvname" 1250 | 1251 | # Create the environment 1252 | mkvirtualenv "$@" "$tmpenvname" 1253 | RC=$? 1254 | if [ $RC -ne 0 ] 1255 | then 1256 | return $RC 1257 | fi 1258 | 1259 | # Change working directory 1260 | [ "$cd_after_activate" = "1" ] && cdvirtualenv 1261 | 1262 | # Create the tmpenv marker file 1263 | echo "This is a temporary environment. It will be deleted when you run 'deactivate'." | tee "$VIRTUAL_ENV/README.tmpenv" 1264 | 1265 | # Update the postdeactivate script 1266 | cat - >> "$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/postdeactivate" < "$req_file" 1285 | if [ -n "$(cat "$req_file")" ] 1286 | then 1287 | echo "Uninstalling packages:" 1288 | cat "$req_file" 1289 | echo 1290 | pip uninstall -y $(cat "$req_file" | grep -v '^-f' | sed 's/>/=/g' | cut -f1 -d=) 1291 | else 1292 | echo "Nothing to remove." 1293 | fi 1294 | rm -f "$req_file" 1295 | } 1296 | 1297 | # 1298 | # Run a command in each virtualenv 1299 | # 1300 | #:help:allvirtualenv: run a command in all virtualenvs 1301 | function allvirtualenv { 1302 | virtualenvwrapper_verify_workon_home || return 1 1303 | typeset d 1304 | 1305 | # The IFS default of breaking on whitespace causes issues if there 1306 | # are spaces in the env_name, so change it. 1307 | IFS='%' 1308 | virtualenvwrapper_show_workon_options | while read d 1309 | do 1310 | [ ! -d "$WORKON_HOME/$d" ] && continue 1311 | echo "$d" 1312 | echo "$d" | sed 's/./=/g' 1313 | # Activate the environment, but not with workon 1314 | # because we don't want to trigger any hooks. 1315 | (source "$WORKON_HOME/$d/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate"; 1316 | virtualenvwrapper_cd "$VIRTUAL_ENV"; 1317 | "$@") 1318 | echo 1319 | done 1320 | unset IFS 1321 | } 1322 | 1323 | #:help:virtualenvwrapper: show this help message 1324 | function virtualenvwrapper { 1325 | cat <= 1 { 60 | # drop ranks below 1 61 | if( $1 == path ) { 62 | rank[$1] = $2 + 1 63 | time[$1] = now 64 | } else { 65 | rank[$1] = $2 66 | time[$1] = $3 67 | } 68 | count += $2 69 | } 70 | END { 71 | if( count > 6000 ) { 72 | # aging 73 | for( x in rank ) print x "|" 0.99*rank[x] "|" time[x] 74 | } else for( x in rank ) print x "|" rank[x] "|" time[x] 75 | } 76 | ' 2>/dev/null >| "$tempfile" 77 | # do our best to avoid clobbering the datafile in a race condition 78 | if [ $? -ne 0 -a -f "$datafile" ]; then 79 | env rm -f "$tempfile" 80 | else 81 | env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile" 82 | fi 83 | 84 | # tab completion 85 | elif [ "$1" = "--complete" -a -s "$datafile" ]; then 86 | while read line; do 87 | [ -d "${line%%\|*}" ] && echo $line 88 | done < "$datafile" | awk -v q="$2" -F"|" ' 89 | BEGIN { 90 | if( q == tolower(q) ) imatch = 1 91 | split(substr(q, 3), fnd, " ") 92 | } 93 | { 94 | if( imatch ) { 95 | for( x in fnd ) tolower($1) !~ tolower(fnd[x]) && $1 = "" 96 | } else { 97 | for( x in fnd ) $1 !~ fnd[x] && $1 = "" 98 | } 99 | if( $1 ) print $1 100 | } 101 | ' 2>/dev/null 102 | 103 | else 104 | # list/go 105 | while [ "$1" ]; do case "$1" in 106 | --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;; 107 | -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in 108 | c) local fnd="^$PWD $fnd";; 109 | h) echo "${_Z_CMD:-z} [-chlrtx] args" >&2; return;; 110 | x) sed -i -e "\:^${PWD}|.*:d" "$datafile";; 111 | l) local list=1;; 112 | r) local typ="rank";; 113 | t) local typ="recent";; 114 | esac; opt=${opt:1}; done;; 115 | *) local fnd="$fnd${fnd:+ }$1";; 116 | esac; local last=$1; shift; done 117 | [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 118 | 119 | # if we hit enter on a completion just go there 120 | case "$last" in 121 | # completions will always start with / 122 | /*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;; 123 | esac 124 | 125 | # no file yet 126 | [ -f "$datafile" ] || return 127 | 128 | local cd 129 | cd="$(while read line; do 130 | [ -d "${line%%\|*}" ] && echo $line 131 | done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" ' 132 | function frecent(rank, time) { 133 | # relate frequency and time 134 | dx = t - time 135 | if( dx < 3600 ) return rank * 4 136 | if( dx < 86400 ) return rank * 2 137 | if( dx < 604800 ) return rank / 2 138 | return rank / 4 139 | } 140 | function output(files, out, common) { 141 | # list or return the desired directory 142 | if( list ) { 143 | cmd = "sort -n >&2" 144 | for( x in files ) { 145 | if( files[x] ) printf "%-10s %s\n", files[x], x | cmd 146 | } 147 | if( common ) { 148 | printf "%-10s %s\n", "common:", common > "/dev/stderr" 149 | } 150 | } else { 151 | if( common ) out = common 152 | print out 153 | } 154 | } 155 | function common(matches) { 156 | # find the common root of a list of matches, if it exists 157 | for( x in matches ) { 158 | if( matches[x] && (!short || length(x) < length(short)) ) { 159 | short = x 160 | } 161 | } 162 | if( short == "/" ) return 163 | # use a copy to escape special characters, as we want to return 164 | # the original. yeah, this escaping is awful. 165 | clean_short = short 166 | gsub(/[\(\)\[\]\|]/, "\\\\&", clean_short) 167 | for( x in matches ) if( matches[x] && x !~ clean_short ) return 168 | return short 169 | } 170 | BEGIN { split(q, words, " "); hi_rank = ihi_rank = -9999999999 } 171 | { 172 | if( typ == "rank" ) { 173 | rank = $2 174 | } else if( typ == "recent" ) { 175 | rank = $3 - t 176 | } else rank = frecent($2, $3) 177 | matches[$1] = imatches[$1] = rank 178 | for( x in words ) { 179 | if( $1 !~ words[x] ) delete matches[$1] 180 | if( tolower($1) !~ tolower(words[x]) ) delete imatches[$1] 181 | } 182 | if( matches[$1] && matches[$1] > hi_rank ) { 183 | best_match = $1 184 | hi_rank = matches[$1] 185 | } else if( imatches[$1] && imatches[$1] > ihi_rank ) { 186 | ibest_match = $1 187 | ihi_rank = imatches[$1] 188 | } 189 | } 190 | END { 191 | # prefer case sensitive 192 | if( best_match ) { 193 | output(matches, best_match, common(matches)) 194 | } else if( ibest_match ) { 195 | output(imatches, ibest_match, common(imatches)) 196 | } 197 | } 198 | ')" 199 | [ $? -gt 0 ] && return 200 | [ "$cd" ] && cd "$cd" 201 | fi 202 | } 203 | 204 | alias ${_Z_CMD:-z}='_z 2>&1' 205 | 206 | [ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P" 207 | 208 | if compctl >/dev/null 2>&1; then 209 | # zsh 210 | [ "$_Z_NO_PROMPT_COMMAND" ] || { 211 | # populate directory list, avoid clobbering any other precmds. 212 | if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then 213 | _z_precmd() { 214 | _z --add "${PWD:a}" 215 | } 216 | else 217 | _z_precmd() { 218 | _z --add "${PWD:A}" 219 | } 220 | fi 221 | [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || { 222 | precmd_functions[$(($#precmd_functions+1))]=_z_precmd 223 | } 224 | } 225 | _z_zsh_tab_completion() { 226 | # tab completion 227 | local compl 228 | read -l compl 229 | reply=(${(f)"$(_z --complete "$compl")"}) 230 | } 231 | compctl -U -K _z_zsh_tab_completion _z 232 | elif complete >/dev/null 2>&1; then 233 | # bash 234 | # tab completion 235 | complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z} 236 | [ "$_Z_NO_PROMPT_COMMAND" ] || { 237 | # populate directory list. avoid clobbering other PROMPT_COMMANDs. 238 | grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || { 239 | PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;' 240 | } 241 | } 242 | fi 243 | -------------------------------------------------------------------------------- /lights.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Enable keyboard backlight on resume 4 | # Disable red LED. 5 | 6 | # Put in /usr/lib/systemd/system-sleep/ so systemd runs this after resume 7 | if [ "${1}" = "post" ]; then 8 | light -s sysfs/leds/tpacpi::kbd_backlight -S 100 9 | fi 10 | -------------------------------------------------------------------------------- /lock-screen: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | LOCKFILE=/tmp/sway.lock 4 | 5 | if [ -f $LOCKFILE ] 6 | then 7 | echo 'swaylock already running' 8 | exit 0 9 | fi 10 | 11 | #swaylock -f -i "${BACKGROUND_IMAGE}" --font "Source Code Pro" --scaling fill 12 | swaylock -c 999999 -k -F -f --font "Source Code Pro" --scaling fill 13 | exit 0 14 | 15 | # handle being called from systemd service 16 | if [ -z "$XDG_RUNTIME_DIR" ] && [ -z "$SWAYSOCK" ] 17 | then 18 | if [ -z "$USER" ] 19 | then 20 | # Horrible hack 21 | USER=ggreer 22 | fi 23 | uid=$(id -u "$USER") 24 | export XDG_RUNTIME_DIR="/run/user/$uid/" 25 | SWAYSOCK=$(find "$XDG_RUNTIME_DIR" -maxdepth 1 -iname "sway*sock") 26 | export SWAYSOCK 27 | fi 28 | 29 | #if [ -z "$DISPLAY" ] 30 | #then 31 | # Horrible hack in case we lack this env var 32 | # export DISPLAY=:0 33 | #fi 34 | 35 | LOCK_IMG=/home/$USER/.cache/lockscreen.png 36 | grim -o eDP-1 "$LOCK_IMG" && \ 37 | #convert -blur 0x10 "$LOCK_IMG" "$LOCK_IMG" && \ 38 | # convert -scale 12.5% -scale 800% "$LOCK_IMG" "$LOCK_IMG" && \ 39 | convert -scale 5% -scale 2000% "$LOCK_IMG" "$LOCK_IMG" && \ 40 | touch $LOCKFILE 41 | # swaylock -c 000000 42 | # -u == hide lock feedback 43 | #swaylock -u -i "$LOCK_IMG" --font ProggyTinyTTSZ --scaling fill 44 | swaylock -f -i "$LOCK_IMG" --font "Source Code Pro" --scaling fill 45 | rm $LOCKFILE 46 | -------------------------------------------------------------------------------- /org.freedesktop.Notifications.service: -------------------------------------------------------------------------------- 1 | # Place in /usr/share/dbus-1/services on most systems 2 | [D-BUS Service] 3 | Name=org.freedesktop.Notifications 4 | Exec=/usr/local/bin/mako 5 | -------------------------------------------------------------------------------- /rc-local.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=/etc/rc.local Compatibility 3 | ConditionPathExists=/etc/rc.local 4 | 5 | [Service] 6 | Type=forking 7 | ExecStart=/etc/rc.local 8 | TimeoutSec=0 9 | StandardOutput=tty 10 | RemainAfterExit=yes 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /rules.d/70-persistent-net.rules: -------------------------------------------------------------------------------- 1 | ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:1f.6", NAME="eth0" 2 | ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:14.3", NAME="wlan0" 3 | ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="00:c0:ca:8a:f2:a5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1" 4 | -------------------------------------------------------------------------------- /rules.d/backlight.rules: -------------------------------------------------------------------------------- 1 | ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness" 2 | ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness" 3 | --------------------------------------------------------------------------------