From 30aafcd35de8bb291237d95ebf5569977c89662e Mon Sep 17 00:00:00 2001 From: Kaulfield Date: Thu, 2 Jan 2020 22:56:47 +0100 Subject: [PATCH] dotfiles --- .Xresources | 36 ++++ .config/i3/config | 221 +++++++++++++++++++++++ .config/i3status/config | 83 +++++++++ .dmenurc | 1 + .urxvt/ext/vtwheel | 49 +++++ .vimrc | 387 ++++++++++++++++++++++++++++++++++++++++ .xinitrc | 4 + bin/dexit | 2 + bin/disable_touchpad | 5 + bin/dmenu_exit | 39 ++++ bin/dpass | 2 + 11 files changed, 829 insertions(+) create mode 100644 .Xresources create mode 100644 .config/i3/config create mode 100644 .config/i3status/config create mode 100644 .dmenurc create mode 100644 .urxvt/ext/vtwheel create mode 100644 .vimrc create mode 100644 .xinitrc create mode 100755 bin/dexit create mode 100755 bin/disable_touchpad create mode 100755 bin/dmenu_exit create mode 100755 bin/dpass diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..aa81f02 --- /dev/null +++ b/.Xresources @@ -0,0 +1,36 @@ +! urxvt +URxvt*buffered: true +URxvt*cursorBlink: true +URxvt*underlineColor: blue +URxvt*font: xft:Terminus:size=9:antialias=true +!URxvt*depth: 8 +URxvt*borderless: 1 +URxvt*scrollBar: false +URxvt*termName: rxvt-unicode +URxvt.perl-ext-common: default,matcher,vtwheel +URxvt.urlLauncher: chromium +URxvt.matcher.button: 1 + + +! Dracula Xresources palette +*.foreground: #F8F8F2 +*.background: #282A36 +*.color0: #000000 +*.color8: #4D4D4D +*.color1: #FF5555 +*.color9: #FF6E67 +*.color2: #50FA7B +*.color10: #5AF78E +*.color3: #F1FA8C +*.color11: #F4F99D +*.color4: #BD93F9 +*.color12: #CAA9FA +*.color5: #FF79C6 +*.color13: #FF92D0 +*.color6: #8BE9FD +*.color14: #9AEDFE +*.color7: #BFBFBF +*.color15: #E6E6E6 + +urxvt*depth: 32 +urxvt*background: rgba:0000/0000/0200/c800 diff --git a/.config/i3/config b/.config/i3/config new file mode 100644 index 0000000..4451251 --- /dev/null +++ b/.config/i3/config @@ -0,0 +1,221 @@ +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# + +# i3 config file (v4) +# +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod4 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). + +#font pango:DejaVu Sans Mono 8 +font pango:xor4 Terminus, WenQuanYi Bitmap Song,FontAwesome 8 +#font pango:Terminus 8 + +#COLORS + +#cyan & red +set $color1 #2aa198 +set $color2 #d33682 + +# class border backgr. text indicator child_border +client.focused $color1 #222222 #ffffff $color2 $color1 +client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a +client.unfocused #333333 #222222 #888888 #292d2e #403C38 +client.urgent #2f343a #900000 #ffffff #900000 #900000 +#client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c + + +# Before i3 v4.8, we used to recommend this one as the default: +# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +# The font above is very space-efficient, that is, it looks good, sharp and +# clear in small sizes. However, its unicode glyph coverage is limited, the old +# X core fonts rendering does not support right-to-left and this being a bitmap +# font, it doesn’t scale on retina/hidpi displays. + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec urxvt + +# kill focused window +bindsym $mod+Shift+q kill + +# start dmenu (a program launcher) +bindsym $mod+d exec dmenu_run -fn 'Terminus:size=8' -nb '#000000' -nf '#2aa198' -sf '#000000' -sb '#2aa198' +# There also is the (new) i3-dmenu-desktop which only displays applications +# shipping a .desktop file. It is a wrapper around dmenu, so you need that +# installed. +# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -fn 'xos4 Terminus:size=8' -nb '#000000' -nf '#2aa198' -sf '#000000' -sb '#2aa198' + +# change focus +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+ntilde focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+ntilde move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# switch to workspace +bindsym $mod+1 workspace 一 +bindsym $mod+2 workspace 二 +bindsym $mod+3 workspace 三 +bindsym $mod+4 workspace 四 +bindsym $mod+5 workspace 五 +bindsym $mod+6 workspace 六 +bindsym $mod+7 workspace 七 +bindsym $mod+8 workspace 八 +bindsym $mod+9 workspace 九 +bindsym $mod+0 workspace 十 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace 一 +bindsym $mod+Shift+2 move container to workspace 二 +bindsym $mod+Shift+3 move container to workspace 三 +bindsym $mod+Shift+4 move container to workspace 四 +bindsym $mod+Shift+5 move container to workspace 五 +bindsym $mod+Shift+6 move container to workspace 六 +bindsym $mod+Shift+7 move container to workspace 七 +bindsym $mod+Shift+8 move container to workspace 八 +bindsym $mod+Shift+9 move container to workspace 九 +bindsym $mod+Shift+0 move container to workspace 十 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +#bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym ntilde resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + font pango:Terminus, FontAwesome 8 + #status_command ~/bin/my_i3status.sh + status_command i3status + colors { + background #000000 + statusline #dddddd + separator #666666 + focused_workspace $color1 #000000 #ffffff + active_workspace #000000 #000000 #888888 + inactive_workspace #000000 #000000 #888888 + urgent_workspace #2f343a #900000 #ffffff +} + +} + +exec --no-startup-id compton -b + +# Wallpaper +exec --no-startup-id nitrogen --restore +#exec --no-startup-id feh --bg-center ~/Wallpapers/wallpaper.jpg + +# Alsa Audio controls +bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -q set Master 2dB+ unmute #increase sound volume +bindsym XF86AudioLowerVolume exec --no-startup-id amixer -q set Master 2dB- unmute #decrease sound volume +bindsym XF86AudioMute exec --no-startup-id amixer -q set Master toggle # mute sound + +# Pulse Audio Controls +#bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume +#bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5% #decrease sound volume +#bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle # mute sound + +#toggle speakers +bindsym $mod+shift+h exec --no-startup-id amixer -q set 'Speaker' toggle && amixer -q set 'Bass Speaker' toggle + +# Sreen brightness controls +bindsym XF86MonBrightnessUp exec xbacklight -inc 5 # increase screen brightness +bindsym XF86MonBrightnessDown exec xbacklight -dec 5 # decrease screen brightness + +# web browser +bindsym $mod+b exec --no-startup-id chromium + +#Shutdown +bindsym $mod+shift+e exec --no-startup-id dexit + +#File manager +bindsym $mod+shift+f exec --no-startup-id thunar + +#Borders +new_window pixel 3 + +gaps inner 10 +gaps outer 10 diff --git a/.config/i3status/config b/.config/i3status/config new file mode 100644 index 0000000..2400d30 --- /dev/null +++ b/.config/i3status/config @@ -0,0 +1,83 @@ +# i3status configuration file. +# see "man i3status" for documentation. + +# It is important that this file is edited as UTF-8. +# The following line should contain a sharp s: +# ß +# If the above line is not correctly displayed, fix your editor first! + +general { + colors = false + color_good = "#ba0202" #some neon blue + color_degraded = "#006298" + color_bad = "#FF5555" + interval = 1 +} + +#order += "external_script NowPlaying" +#order += "ipv6" +order += "disk /" +#order += "run_watch DHCP" +#order += "run_watch VPN" +order += "wireless wlp5s0" +order += "ethernet enp3s0" +order += "battery 1" +order += "volume master" +order += "cpu_temperature 5" +order += "load" +order += "tztime local" +order += "tztime clock" + +wireless wlp5s0 { + format_up = " (%quality at %essid) %ip" + format_down = "" +} + +ethernet enp3s0 { + # if you use %speed, i3status requires root privileges + format_up = " %ip" + format_down = "" +} + +battery 1 { + format = " %percentage %remaining" + path = "/sys/class/power_supply/BAT1/uevent" +} + + +run_watch DHCP { + pidfile = "/var/run/dhcpcd*.pid" +} + +run_watch VPN { + pidfile = "/var/run/vpnc/pid" +} + +tztime local { + format = " %Y-%m-%d" +} + +tztime clock { + format = " %H:%M:%S" +} + +load { + format = " %1min" +} + +disk "/" { + format = " %avail" +} + +cpu_temperature 5{ + format = " %degrees°C" + path="/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp5_input" + max_threshold=75 +} + +volume master { + format = " %volume" + format_muted = " Muted" + device = "default" + mixer = "Master" +} diff --git a/.dmenurc b/.dmenurc new file mode 100644 index 0000000..70da27b --- /dev/null +++ b/.dmenurc @@ -0,0 +1 @@ +dmenu_args='-fn Terminus:size=8 -nb #000000 -nf #2aa198 -sf #000000 -sb #2aa198' diff --git a/.urxvt/ext/vtwheel b/.urxvt/ext/vtwheel new file mode 100644 index 0000000..7f51226 --- /dev/null +++ b/.urxvt/ext/vtwheel @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +# Implements a scrollwheel just like in good old vt100's mices + +sub simulate_keypress { + my ($self, $type) = @_; #type: 0:up, 1:down + + my $keycode_up = 111; + my $keycode_down = 116; + + my $numlines = 3; + + my $keycode = 0; + if ($type eq 0) { + $keycode = $keycode_up; + } elsif ($type eq 1) { + $keycode = $keycode_down; + } else { + return; + } + + for (my $i = 0 ; $i ne $numlines ; $i++) { + $self->key_press(0,$keycode); + $self->key_release(0,$keycode); + } +} + +sub on_button_release { + my ($self, $event) = @_; + + #my $res_ss = $self->resource("secondaryScroll"); + #warn("ressource ss is <$res_ss>"); + + !$self->current_screen and return (); + + #warn("foo, event: <$event->{button}>\n"); + if ($event->{button} eq "4") { # scroll up + $self->simulate_keypress(0); + return 1; + } elsif ($event->{button} eq "5") { # scroll down + $self->simulate_keypress(1); + return 1; + } + + return (); +} diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..85c510f --- /dev/null +++ b/.vimrc @@ -0,0 +1,387 @@ +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Maintainer: +" Amir Salihefendic — @amix3k +" +" Awesome_version: +" Get this config, nice color schemes and lots of plugins! +" +" Install the awesome version from: +" +" https://github.com/amix/vimrc +" +" Sections: +" -> General +" -> VIM user interface +" -> Colors and Fonts +" -> Files and backups +" -> Text, tab and indent related +" -> Visual mode related +" -> Moving around, tabs and buffers +" -> Status line +" -> Editing mappings +" -> vimgrep searching and cope displaying +" -> Spell checking +" -> Misc +" -> Helper functions +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => General +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Sets how many lines of history VIM has to remember +set history=500 + +" Enable filetype plugins +filetype plugin on +filetype indent on + +" Set to auto read when a file is changed from the outside +set autoread +au FocusGained,BufEnter * checktime + +" With a map leader it's possible to do extra key combinations +" like w saves the current file +let mapleader = "," + +" Fast saving +nmap w :w! + +" :W sudo saves the file +" (useful for handling the permission-denied error) +command! W execute 'w !sudo tee % > /dev/null' edit! + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => VIM user interface +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Set 7 lines to the cursor - when moving vertically using j/k +set so=7 + +" Avoid garbled characters in Chinese language windows OS +let $LANG='en' +set langmenu=en +source $VIMRUNTIME/delmenu.vim +source $VIMRUNTIME/menu.vim + +" Turn on the Wild menu +set wildmenu + +" Ignore compiled files +set wildignore=*.o,*~,*.pyc +if has("win16") || has("win32") + set wildignore+=.git\*,.hg\*,.svn\* +else + set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store +endif + +"Always show current position +set ruler + +" Height of the command bar +set cmdheight=1 + +" A buffer becomes hidden when it is abandoned +set hid + +" Configure backspace so it acts as it should act +set backspace=eol,start,indent +set whichwrap+=<,>,h,l + +" Ignore case when searching +set ignorecase + +" When searching try to be smart about cases +set smartcase + +" Highlight search results +set hlsearch + +" Makes search act like search in modern browsers +set incsearch + +" Don't redraw while executing macros (good performance config) +set lazyredraw + +" For regular expressions turn magic on +set magic + +" Show matching brackets when text indicator is over them +set showmatch +" How many tenths of a second to blink when matching brackets +set mat=2 + +" No annoying sound on errors +set noerrorbells +set novisualbell +set t_vb= +set tm=500 + +" Properly disable sound on errors on MacVim +if has("gui_macvim") + autocmd GUIEnter * set vb t_vb= +endif + + +" Add a bit extra margin to the left +set foldcolumn=1 + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Colors and Fonts +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Enable syntax highlighting +syntax enable + +" Enable 256 colors palette in Gnome Terminal +if $COLORTERM == 'gnome-terminal' + set t_Co=256 +endif + +try + colorscheme desert +catch +endtry + +set background=dark + +" Set extra options when running in GUI mode +if has("gui_running") + set guioptions-=T + set guioptions-=e + set t_Co=256 + set guitablabel=%M\ %t +endif + +" Set utf8 as standard encoding and en_US as the standard language +set encoding=utf8 + +" Use Unix as the standard file type +set ffs=unix,dos,mac + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Files, backups and undo +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Turn backup off, since most stuff is in SVN, git etc. anyway... +set nobackup +set nowb +set noswapfile + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Text, tab and indent related +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Use spaces instead of tabs +set expandtab + +" Be smart when using tabs ;) +set smarttab + +" 1 tab == 4 spaces +set shiftwidth=4 +set tabstop=4 + +" Linebreak on 500 characters +set lbr +set tw=500 + +set ai "Auto indent +set si "Smart indent +set wrap "Wrap lines + + +"""""""""""""""""""""""""""""" +" => Visual mode related +"""""""""""""""""""""""""""""" +" Visual mode pressing * or # searches for the current selection +" Super useful! From an idea by Michael Naumann +vnoremap * :call VisualSelection('', '')/=@/ +vnoremap # :call VisualSelection('', '')?=@/ + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Moving around, tabs, windows and buffers +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Map to / (search) and Ctrl- to ? (backwards search) +map / +map ? + +" Disable highlight when is pressed +map :noh + +" Smart way to move between windows +map j +map k +map h +map l + +" Close the current buffer +map bd :Bclose:tabclosegT + +" Close all the buffers +map ba :bufdo bd + +map l :bnext +map h :bprevious + +" Useful mappings for managing tabs +map tn :tabnew +map to :tabonly +map tc :tabclose +map tm :tabmove +map t :tabnext + +" Let 'tl' toggle between this and the last accessed tab +let g:lasttab = 1 +nmap tl :exe "tabn ".g:lasttab +au TabLeave * let g:lasttab = tabpagenr() + + +" Opens a new tab with the current buffer's path +" Super useful when editing files in the same directory +map te :tabedit =expand("%:p:h")/ + +" Switch CWD to the directory of the open buffer +map cd :cd %:p:h:pwd + +" Specify the behavior when switching between buffers +try + set switchbuf=useopen,usetab,newtab + set stal=2 +catch +endtry + +" Return to last edit position when opening files (You want this!) +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + + +"""""""""""""""""""""""""""""" +" => Status line +"""""""""""""""""""""""""""""" +" Always show the status line +set laststatus=2 + +" Format the status line +set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Editing mappings +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Remap VIM 0 to first non-blank character +map 0 ^ + +" Move a line of text using ALT+[jk] or Command+[jk] on mac +nmap mz:m+`z +nmap mz:m-2`z +vmap :m'>+`mzgv`yo`z +vmap :m'<-2`>my` + nmap + vmap + vmap +endif + +" Delete trailing white space on save, useful for some filetypes ;) +fun! CleanExtraSpaces() + let save_cursor = getpos(".") + let old_query = getreg('/') + silent! %s/\s\+$//e + call setpos('.', save_cursor) + call setreg('/', old_query) +endfun + +if has("autocmd") + autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces() +endif + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Spell checking +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Pressing ,ss will toggle and untoggle spell checking +map ss :setlocal spell! + +" Shortcuts using +map sn ]s +map sp [s +map sa zg +map s? z= + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Misc +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Remove the Windows ^M - when the encodings gets messed up +noremap m mmHmt:%s///ge'tzt'm + +" Quickly open a buffer for scribble +map q :e ~/buffer + +" Quickly open a markdown buffer for scribble +map x :e ~/buffer.md + +" Toggle paste mode on and off +map pp :setlocal paste! + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Helper functions +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Returns true if paste mode is enabled +function! HasPaste() + if &paste + return 'PASTE MODE ' + endif + return '' +endfunction + +" Don't close window, when deleting a buffer +command! Bclose call BufcloseCloseIt() +function! BufcloseCloseIt() + let l:currentBufNum = bufnr("%") + let l:alternateBufNum = bufnr("#") + + if buflisted(l:alternateBufNum) + buffer # + else + bnext + endif + + if bufnr("%") == l:currentBufNum + new + endif + + if buflisted(l:currentBufNum) + execute("bdelete! ".l:currentBufNum) + endif +endfunction + +function! CmdLine(str) + call feedkeys(":" . a:str) +endfunction + +function! VisualSelection(direction, extra_filter) range + let l:saved_reg = @" + execute "normal! vgvy" + + let l:pattern = escape(@", "\\/.*'$^~[]") + let l:pattern = substitute(l:pattern, "\n$", "", "") + + if a:direction == 'gv' + call CmdLine("Ack '" . l:pattern . "' " ) + elseif a:direction == 'replace' + call CmdLine("%s" . '/'. l:pattern . '/') + endif + + let @/ = l:pattern + let @" = l:saved_reg +endfunction + +"-- AUTOCOMPLETION -- +filetype plugin on +set omnifunc=syntaxcomplete#Complete diff --git a/.xinitrc b/.xinitrc new file mode 100644 index 0000000..18e898d --- /dev/null +++ b/.xinitrc @@ -0,0 +1,4 @@ +setxkbmap es +xset m 0 0 +xrdb .Xresources +exec i3 diff --git a/bin/dexit b/bin/dexit new file mode 100755 index 0000000..b33f728 --- /dev/null +++ b/bin/dexit @@ -0,0 +1,2 @@ +#!/bin/bash +SUDO_ASKPASS=~/bin/dpass sudo -A $(dirname "$0")/dmenu_exit diff --git a/bin/disable_touchpad b/bin/disable_touchpad new file mode 100755 index 0000000..3439e95 --- /dev/null +++ b/bin/disable_touchpad @@ -0,0 +1,5 @@ +#!/bin/bash +if [ "$(xinput list | grep 'Mouse')" != "" ]; then + /usr/bin/xinput --disable 'ETPS/2 Elantech Touchpad' +fi +exit 0 diff --git a/bin/dmenu_exit b/bin/dmenu_exit new file mode 100755 index 0000000..b283cc6 --- /dev/null +++ b/bin/dmenu_exit @@ -0,0 +1,39 @@ +#!/bin/bash +# +# a simple logout dialog +# +### + +kill_apps() { + while read -r app; do + wmctrl -i -c "$app" + done < <(wmctrl -l | awk '{print $1}') +} + +choice() { + if [[ -f "$HOME/.dmenurc" ]]; then + . "$HOME/.dmenurc" + DMENU="dmenu -i $dmenu_args" + else + DMENU='dmenu -i' + fi + + choice=$(echo -e "0: Logout\n1: Shutdown\n2: Reboot\n3: Lock" | $DMENU | cut -d ':' -f 1) +} + +[[ -z "$DISPLAY" ]] && exit 1 + +choice + +[[ -z "$choice" ]] && exit 1 + +# gracefully close all open apps +#kill_apps + +# execute the choice in background +case "$choice" in + 0) i3-msg exit & ;; + 1) poweroff & ;; + 2) reboot & ;; + 3) i3lock & +esac diff --git a/bin/dpass b/bin/dpass new file mode 100755 index 0000000..d220de4 --- /dev/null +++ b/bin/dpass @@ -0,0 +1,2 @@ +#!/bin/bash +dmenu -p "$1" -fn 'xos4 Terminus:size=8' -nb '#000000' -nf '#000000' -sf '#000000' -sb '#00C0C0' <&- && echo