From 8071d696d85718c096bc838235692108a4c5bd7a Mon Sep 17 00:00:00 2001 From: arcan1s Date: Wed, 26 Nov 2014 12:10:58 +0300 Subject: [PATCH] update zsh configuration files --- README.md | 10 +- kdmrc | 591 ---------------------------------------- sddm.conf | 32 +++ zlogout | 1 + zsh/archive_functions | 50 ++++ zsh/custom_rm | 40 +++ zsh/custom_su | 15 + zsh/filetypes_aliases | 7 + zsh/hash_common | 4 + zsh/hash_desktop | 3 + zsh/highlighting | 44 +++ zsh/pacman_common | 7 + zsh/pacman_test | 7 + zsh/pkgfile | 2 + zsh/prompt | 41 +++ zsh/prompt_server | 27 ++ zsh/sudo_aliases_pc | 12 + zsh/sudo_aliases_server | 28 ++ zsh/vimpager | 5 + zsh/xrandr_e530 | 48 ++++ zsh/xrandr_t440 | 50 ++++ zshrc | 354 ++---------------------- zshrc_foreing_server | 181 ------------ zshrc_server | 317 --------------------- zshrc_t440 | 419 ---------------------------- 25 files changed, 447 insertions(+), 1848 deletions(-) delete mode 100644 kdmrc create mode 100644 sddm.conf create mode 100644 zlogout create mode 100644 zsh/archive_functions create mode 100644 zsh/custom_rm create mode 100644 zsh/custom_su create mode 100644 zsh/filetypes_aliases create mode 100644 zsh/hash_common create mode 100644 zsh/hash_desktop create mode 100644 zsh/highlighting create mode 100644 zsh/pacman_common create mode 100644 zsh/pacman_test create mode 100644 zsh/pkgfile create mode 100644 zsh/prompt create mode 100644 zsh/prompt_server create mode 100644 zsh/sudo_aliases_pc create mode 100644 zsh/sudo_aliases_server create mode 100644 zsh/vimpager create mode 100644 zsh/xrandr_e530 create mode 100644 zsh/xrandr_t440 delete mode 100644 zshrc_foreing_server delete mode 100644 zshrc_server delete mode 100644 zshrc_t440 diff --git a/README.md b/README.md index d999bce..97654df 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,18 @@ Some of using configuration files Description ----------- * `arch_install.sh` - simple script for automatic installation -* `Bespin` (directory) - settings for [BESpin](http://kde-look.org/content/show.php/Bespin?content=63928). It is stored in `$HOME/.config/`. * `awesome` (directory) - settings for Awesome-WM. It is stored in `$HOME/.config/`. +* `Bespin` (directory) - settings for [BESpin](http://kde-look.org/content/show.php/Bespin?content=63928). It is stored in `$HOME/.config/`. * `festival` (directory tree) - settings for festival Russian speaking. * `get-coord-matrix.py` - python script which calculates xinput coordinate matrix for screens * `kbdlayout` (files) - settings for Russian language with layout switching on CapsLock. `20-keyboard.conf` (X11 settings) is stored in `/etc/X11/xorg.conf.d/`. `my.map.gz` (keymap) is stored in `/usr/share/kbd/keymaps/i386/qwerty`. -* `kdmrc` - settings for KDM. It is stored as `/usr/share/config/kdm/kdmrc`. * `local.conf` - custom settings for fontconfig. It is stored as `/etc/fonts/local.conf` * `qtcurve` (directory) - custom settings for QtCurve (including colors). -* `repo-update` - simple script for building and updating own repository * `sakura.conf` - settings for [Sakura terminal](https://launchpad.net/sakura). It is stored in `$HOME/.config/sakura/`. +* `sddm.conf` - settings for SDDM. It is stored as `/etc/sddm.conf`. * `themes` - directory with some of my custom color schemas * `vimrc` - settings for VIM. It is stored as `$HOME/.vimrc`. * `Xresources` - settings for some Xorg applications (for example, urxvt). It is stored as `$HOME/.Xresources` +* `zsh` - directory with different configuration files for zsh. It is stored as `$HOME/.zsh` +* `zlogout` - zsh related script * `zshrc` - settings (for root and normal user) for zsh. It is stored as `$HOME/.zshrc`. -* `zshrc_t440` - settings (for root and normal user) for zsh using on work machine. It is stored as `$HOME/.zshrc`. -* `zshrc_foreing_server` - settings (for root and normal user) for zsh using on foreing server. It is stored as `$HOME/.zshrc`. -* `zshrc_server` - settings (for root and normal user) for zsh using on server. It is stored as `$HOME/.zshrc`. diff --git a/kdmrc b/kdmrc deleted file mode 100644 index f3e7b17..0000000 --- a/kdmrc +++ /dev/null @@ -1,591 +0,0 @@ -# KDM master configuration file -# -# Definition: the greeter is the login dialog, i.e., the part of KDM -# which the user sees. -# -# You can configure every X-display individually. -# Every display has a display name, which consists of a host name -# (which is empty for local displays specified in {Static|Reserve}Servers), -# a colon, and a display number. Additionally, a display belongs to a -# display class (which can be ignored in most cases; the control center -# does not support this feature at all). -# Sections with display-specific settings have the formal syntax -# "[X-" host [":" number [ "_" class ]] "-" sub-section "]" -# You can use the "*" wildcard for host, number, and class. You may omit -# trailing components; they are assumed to be "*" then. -# The host part may be a domain specification like ".inf.tu-dresden.de". -# It may also be "+", which means non-empty, i.e. remote displays only. -# From which section a setting is actually taken is determined by these -# rules: -# - an exact match takes precedence over a partial match (for the host part), -# which in turn takes precedence over a wildcard ("+" taking precedence -# over "*") -# - precedence decreases from left to right for equally exact matches -# Example: display name "myhost:0", class "dpy". -# [X-myhost:0_dpy] precedes -# [X-myhost:0_*] (same as [X-myhost:0]) precedes -# [X-myhost:*_dpy] precedes -# [X-myhost:*_*] (same as [X-myhost]) precedes -# [X-+:0_dpy] precedes -# [X-*:0_dpy] precedes -# [X-*:0_*] (same as [X-*:0]) precedes -# [X-*:*_*] (same as [X-*]) -# These sections do NOT match this display: -# [X-hishost], [X-myhost:0_dec], [X-*:1], [X-:*] -# If a setting is not found in any matching section, the default is used. -# -# Every comment applies to the following section or key. Note that all -# comments will be lost if you change this file with the systemsettings frontend. -# The defaults refer to KDM's built-in values, not anything set in this file. -# -# Special characters need to be backslash-escaped (leading and trailing -# spaces (\s), tab (\t), linefeed (\n), carriage return (\r) and the -# backslash itself (\\)). -# In lists, fields are separated with commas without whitespace in between. -# Some command strings are subject to simplified sh-style word splitting: -# single quotes (') and double quotes (") have the usual meaning; the backslash -# quotes everything (not only special characters). Note that the backslashes -# need to be doubled because of the two levels of quoting. - -[General] -# This option exists solely for the purpose of a clean automatic upgrade. -# Do not even think about changing it! -ConfigVersion=2.4 -# List of permanent displays. Displays with a hostname are foreign. A display -# class may be specified separated by an underscore. -# Default is ":0" -StaticServers=:0 -# List of on-demand displays. See StaticServers for syntax. -# Default is "" -ReserveServers=:1,:2,:3 -# VTs to allocate to X-servers. A negative number means that the VT will be -# used only if it is free. If all VTs in this list are used up, the next free -# one greater than the last one in this list will be allocated. -# Default is "" -ServerVTs=-7 -# TTYs (without /dev/) to monitor for activity while in console mode. -# Default is "" -ConsoleTTYs=tty1,tty2,tty3,tty4,tty5,tty6 -# Where KDM should store its PID (do not store if empty). -# Default is "" -PidFile=/var/run/kdm.pid -# Whether KDM should lock the PID file to prevent having multiple KDM -# instances running at once. Do not change unless you are brave. -# Default is true -#LockPidFile=false -# Where to store authorization files. -# Default is "/var/run/xauth" -#AuthDir=/tmp -# Whether KDM should automatically re-read configuration files, if it -# finds them having changed. -# Default is true -#AutoRescan=false -# Additional environment variables KDM should pass on to all programs it runs. -# LD_LIBRARY_PATH and XCURSOR_THEME are good candidates; -# otherwise, it should not be necessary very often. -# Default is "" -#ExportList=LD_LIBRARY_PATH,ANOTHER_IMPORTANT_VAR -# A character device KDM should read entropy from. -# Empty means use the system's preferred entropy device. -# Default is "" -#RandomDevice=/dev/altrandom -# Where the command sockets should be created; make it empty to disable -# them. -# Default is "/var/run/xdmctl" -#FifoDir=/tmp -# The group to which the global command socket should belong; -# can be either a name or a numerical ID. -# Default is 0 -#FifoGroup=xdmctl -# The user the greeter should run as. Empty results in root. -# Consider the impact on LogSource when setting it. -# Default is "" -GreeterUID=kdm -# The directory in which KDM should store persistent working data. -# Default is "/var/lib/kdm" -#DataDir= -# The directory in which KDM should store users' .dmrc files. This is only -# needed if the home directories are not readable before actually logging in -# (like with AFS). -# Default is "" -#DmrcDir=/nfs-shared/var/dmrcs - -[Xdmcp] -# Whether KDM should listen to incoming XDMCP requests. -# Default is true -Enable=false -# The UDP port on which KDM should listen for XDMCP requests. Do not change. -# Default is 177 -#Port=177 -# File with the private keys of X-terminals. Required for XDM authentication. -# Default is "" -#KeyFile=/usr/share/config/kdm/kdmkeys -# XDMCP access control file in the usual XDM-Xaccess format. -# Default is "/usr/share/config/kdm/Xaccess" -Xaccess=/usr/share/config/kdm/Xaccess -# Number of seconds to wait for display to respond after the user has -# selected a host from the chooser. -# Default is 15 -#ChoiceTimeout=10 -# Strip domain name from remote display names if it is equal to the local -# domain. -# Default is true -#RemoveDomainname=false -# Use the numeric IP address of the incoming connection on multihomed hosts -# instead of the host name. -# Default is false -#SourceAddress=true -# The program which is invoked to dynamically generate replies to XDMCP -# DirectQuery or BroadcastQuery requests. -# If empty, no program is invoked and "Willing to manage" is sent. -# Default is "" -Willing=/usr/share/config/kdm/Xwilling - -[Shutdown] -# The command (subject to word splitting) to run to halt the system. -# Default is "/sbin/shutdown -h -P now" -HaltCmd=/usr/bin/systemctl poweroff -# The command (subject to word splitting) to run to reboot the system. -# Default is "/sbin/shutdown -r now" -RebootCmd=/usr/bin/systemctl reboot -# Whether it is allowed to shut down the system via the global command socket. -# Default is false -#AllowFifo=true -# Whether it is allowed to abort active sessions when shutting down the -# system via the global command socket. -# Default is true -#AllowFifoNow=false -# The boot manager KDM should use for offering boot options in the -# shutdown dialog. -# "None" - no boot manager -# "Grub" - Grub boot manager -# "Grub2" - Grub2 boot manager -# "Burg" - Burg boot manager -# "Lilo" - Lilo boot manager (Linux on i386 & x86-64 only) -# Default is None -#BootManager=Grub - -# Rough estimations about how many seconds KDM will spend at most on -# - opening a connection to the X-server (OpenTime) if the attempt -# - times out: OpenTimeout -# - is refused: OpenRepeat * OpenDelay -# - starting a local X-server (ServerTime): -# ServerAttempts * (ServerTimeout + OpenDelay) -# - starting a display: -# - local display: ServerTime + OpenTime -# - foreign display: StartAttempts * OpenTime -# - XDMCP display: OpenTime (repeated indefinitely by client) - -# Core config for all displays -[X-*-Core] -# How long to wait before retrying to connect a display. -# Default is 15 -#OpenDelay=15 -# How long to wait before timing out a display connection attempt. -# Default is 120 -#OpenTimeout=120 -# How many connection attempts to make during a start attempt. Note that -# a timeout aborts the entire start attempt. -# Default is 5 -#OpenRepeat=5 -# Try at most that many times to start a display. If this fails, the display -# is disabled. -# Default is 4 -#StartAttempts=4 -# Ping remote display every that many minutes. -# Default is 5 -#PingInterval=5 -# Wait for a Pong that many minutes. -# Default is 5 -#PingTimeout=5 -# The name of this X-server's Xauth file. -# If empty, a random name in the AuthDir directory will be used. -# Default is "" -#AuthFile= -# Specify a file with X-resources for the greeter, chooser and background. -# The KDE frontend does not use this file, so you do not need it unless you -# use another background generator than krootimage. -# Default is "" -#Resources= -# The xrdb program to use to read the above specified recources. -# Subject to word splitting. -# Default is "/usr/bin/xrdb" -#Xrdb= -# A program to run before the greeter is shown. Can be used to start an -# xconsole or an alternative background generator. Subject to word splitting. -# Default is "" -Setup=/usr/share/config/kdm/Xsetup -# A program to run before a user session starts. Subject to word splitting. -# Default is "" -Startup=/usr/share/config/kdm/Xstartup -# A program to run after a user session exits. Subject to word splitting. -# Default is "" -Reset=/usr/share/config/kdm/Xreset -# The program which is run as the user which logs in. It is supposed to -# interpret the session argument (see SessionsDirs) and start an appropriate -# session according to it. Subject to word splitting. -# Default is "/usr/bin/xterm -ls -T" -Session=/usr/share/config/kdm/Xsession -# The program to run if Session fails. -# Default is "/usr/bin/xterm" -#FailsafeClient= -# The PATH for the Session program. -# Default is "/usr/local/bin:/usr/bin:/bin:/usr/games" -#UserPath= -# The PATH for Setup, Startup and Reset, etc. -# Default is "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -#SystemPath= -# The default system shell. -# Default is "/bin/sh" -#SystemShell=/bin/bash -# Where to put the user's X-server authorization file if ~/.Xauthority -# cannot be created. -# Default is "/tmp" -#UserAuthDir= -# If true, UserAuthDir will be used unconditionally. -# Default is false -#ForceUserAuthDir=true -# Whether to automatically restart sessions after X-server crashes. -# Note that enabling this makes circumventing screen lockers other than -# KDE's built-in one possible! -# Default is false -#AutoReLogin=true -# Allow root logins? -# Default is true -AllowRootLogin=false -# Allow to log in, when user has set an empty password? -# Default is true -AllowNullPasswd=true -# Who is allowed to shut down the system. This applies both to the -# greeter and to the command sockets. -# "None" - no "Shutdown..." menu entry is shown at all -# "Root" - the root password must be entered to shut down -# "All" - everybody can shut down the machine -# Default is All -AllowShutdown=Root -# Who is allowed to abort active sessions when shutting down. -# "None" - no forced shutdown is allowed at all -# "Root" - the root password must be entered to shut down forcibly -# "All" - everybody can shut down the machine forcibly -# Default is All -#AllowSdForceNow=Root -# The default choice for the shutdown condition/timing. -# "Schedule" - shut down after all active sessions exit (possibly at once) -# "TryNow" - shut down, if no active sessions are open; otherwise, do nothing -# "ForceNow" - shut down unconditionally -# Default is Schedule -#DefaultSdMode=ForceNow -# How to offer shutdown scheduling options: -# "Never" - not at all -# "Optional" - as a button in the simple shutdown dialogs -# "Always" - instead of the simple shutdown dialogs -# Default is Never -#ScheduledSd=Optional -# The directories containing session type definitions in .desktop format, -# ordered by falling priority. -# Default is "/usr/share/apps/kdm/sessions" -SessionsDirs=/usr/share/config/kdm/sessions,/usr/share/apps/kdm/sessions -# The file (relative to $HOME) to redirect the session output to. The -# following character pairs are replaced: -# - %d -> current display -# - %u -> current user -# - %r -> empty at first. See below. -# - %% -> a single % -# When the constructed filename cannot be used safely and the specification -# contains %r, other names will be tried - this time expanding %r -# to followed by a random number. -# Default is ".xsession-errors" -ClientLogFile=.xsession-errors-%d -# Fallback when ClientLogFile cannot be used. The same expansions are -# supported. DO NOT use relative paths here. -# Default is "/tmp/xerr-%u-%d%-r" -#ClientLogFallback=/var/log/xsession-errors/%u-%d%-r -# Whether KDM's built-in utmp/wtmp/lastlog registration should be used. -# Default is true -#UseSessReg=false - -# Greeter config for all displays -[X-*-Greeter] -# Specify the widget style for the greeter. Empty means to use the -# built-in default which currently is "Oxygen-air". -# Default is "" -GUIStyle=Bespin -# Specify the widget color scheme for the greeter. Empty means to use the -# built-in default which currently is "Oxygen-air". -# Default is "" -#ColorScheme=MidnightMeadow -# What should be shown in the greeter's logo are: -# "None" - nothing -# "Logo" - the image specified by LogoPixmap -# "Clock" - a neat analog clock -# Default is Clock -LogoArea=Logo -# The image to show when LogoArea=Logo. -# Default is "" -LogoPixmap=/usr/share/apps/kdm/pics/kdelogo.png -# The relative coordinates (X,Y in percent) of the center of the greeter. -# Default is "50,50" -#GreeterPos=30,40 -# The screen the greeter should be displayed on in multi-headed and Xinerama -# setups. The numbering starts with 0. For Xinerama, it corresponds to the -# listing order in the active ServerLayout section of XF86Config; -1 means -# to use the upper-left screen, -2 means to use the upper-right screen. -# Default is 0 -#GreeterScreen=-1 -# The headline in the greeter. The following character pairs are replaced: -# - %d -> current display -# - %h -> host name, possibly with domain name -# - %n -> node name, most probably the host name without domain name -# - %s -> the operating system -# - %r -> the operating system's version -# - %m -> the machine (hardware) type -# - %% -> a single % -# Default is "Welcome to %s at %n" -#GreetString=K Desktop Environment (%n) -# Whether the fonts used in the greeter should be antialiased. -# Default is false -#AntiAliasing=true -# The font for the greeter headline. The value is encoded. -# Default is "Serif 20pt bold" -#GreetFont=Serif,20,-1,5,50,0,0,0,0,0 -# The normal font used in the greeter. The value is encoded. -# Default is "Sans Serif 10pt" -#StdFont=Sans Serif,10,-1,5,50,0,0,0,0,0 -# The font used for the "Login Failed" message. The value is encoded. -# Default is "Sans Serif 10pt bold" -#FailFont=Sans Serif,10,-1,5,75,0,0,0,0,0 -# What to do with the Num Lock modifier for the time the greeter is running: -# "Off" - turn off -# "On" - turn on -# "Keep" - do not change the state -# Default is Keep -#NumLock=Off -# Language and locale to use in the greeter, encoded like $LANGUAGE. -# If empty, the settings from the environment are used. -# Default is "" -#Language=de_DE -# Enable autocompletion in the username line edit. -# Default is false -#UserCompletion=true -# Enable user list (names along with images) in the greeter. -# Default is true -#UserList=false -# User selection for UserCompletion and UserList: -# "NotHidden" - all users except those listed in HiddenUsers -# "Selected" - only the users listed in SelectedUsers -# Default is NotHidden -#ShowUsers=Selected -# For ShowUsers=Selected. @ means all users in that group. -# Default is "" -#SelectedUsers=root,johndoe -# For ShowUsers=NotHidden. @ means all users in that group. -# Default is "" -HiddenUsers=git,i2p,root,secwall,share -# Special case of HiddenUsers: users with a non-zero UID less than this number -# will not be shown as well. -# Default is 0 -MinShowUID=500 -# Complement to MinShowUID: users with a UID greater than this number will -# not be shown as well. -# Default is 65535 -MaxShowUID=65000 -# If false, the users are listed in the order they appear in /etc/passwd. -# If true, they are sorted alphabetically. -# Default is true -#SortUsers=false -# Specify, where the users' pictures should be taken from. -# "AdminOnly" - from /$USER.face[.icon] -# "PreferAdmin" - prefer , fallback on $HOME -# "PreferUser" - ... and the other way round -# "UserOnly" - from the user's $HOME/.face[.icon] -# Default is AdminOnly -FaceSource=UserOnly -# The directory containing the user images if FaceSource is not UserOnly. -# Default is "/usr/share/apps/kdm/faces" -#FaceDir=/usr/share/faces -# Specify, if/which user should be preselected for log in. -# "None" - do not preselect any user -# "Previous" - the user which successfully logged in last time -# "Default" - the user specified in the DefaultUser option -# Default is None -#PreselectUser=Previous -# If this is true, the password input line is focused automatically if -# a user is preselected. -# Default is false -#FocusPasswd=true -# If this is true, the entered password is echoed as bullets. Otherwise, -# no feedback is given at all. -# Default is true -#EchoPasswd=false -# If true, krootimage will be automatically started by KDM; otherwise, the -# Setup script should be used to setup the background. -# Default is true -#UseBackground=false -# The configuration file to be used by krootimage. -# Default is "/usr/share/config/kdm/backgroundrc" -BackgroundCfg=/usr/share/config/kdm/backgroundrc -# Whether to grab keyboard and mouse while the greeter is visible. Grabs -# may improve security, but make on-screen keyboards, etc. unusable. -# "Never" - never grab -# "IfNoAuth" - grab if the display requires no X authorization -# "Always" - always grab -# Default is IfNoAuth -#GrabInput=Always -# Hold the X-server grabbed the whole time the greeter is visible. This -# may be more secure, but it will disable any background and other -# X-clients started from the Setup script. -# Default is false -#GrabServer=true -# How many seconds to wait for grab to succeed. -# Default is 3 -#GrabTimeout=3 -# Warn, if display has no X-authorization (local auth cannot be created, -# XDMCP display wants no auth, or display is foreign from StaticServers). -# Default is true -#AuthComplain=false -# Random seed for forging saved session types, etc. of unknown users. -# This value should be random but constant across the login domain. -# Default is 0 -ForgingSeed=1367919444 -# Specify conversation plugins for the login dialog. Each plugin can be -# specified as a base name (which expands to $kde_modulesdir/kgreet_$base) -# or as a full pathname. -# Default is "classic" -#PluginsLogin=sign -# Same as PluginsLogin, but for the shutdown dialog. -# Default is "classic" -#PluginsShutdown=modern -# A list of options of the form Key=Value. The conversation plugins can query -# these settings; it is up to them what possible keys are. -# Default is "" -#PluginOptions=SomeKey=randomvalue,Foo=bar -# Show the "Console Login" action in the greeter (if ServerTTY/ConsoleTTYs -# is configured). -# Default is true -#AllowConsole=false -# A program to run while the greeter is visible. It is supposed to preload -# as much as possible of the session that is going to be started (most -# probably). -# Default is "" -Preloader=/usr/bin/preloadkde -# Whether the greeter should be themed. -# Default is false -UseTheme=true -# The theme to use for the greeter. Can point to either a directory or an XML -# file. -# Default is "" -Theme=/usr/share/apps/kdm/themes/modernarchlinux -# Enable the Alt-Ctrl-D shortcut to toggle greeter theme debugging. -# Default is false -#AllowThemeDebug=true - -# Core config for local displays -[X-:*-Core] -# How often to try to run the X-server. Running includes executing it and -# waiting for it to come up. -# Default is 1 -#ServerAttempts=1 -# How long to wait for a local X-server to come up. -# Default is 30 -#ServerTimeout=30 -# The command line to start the X-server, without display number and VT spec. -# This string is subject to word splitting. -# Default is "/usr/bin/X" -ServerCmd=/usr/bin/X -br -novtswitch -quiet -# Additional arguments for the X-servers for local sessions. -# This string is subject to word splitting. -# Default is "" -ServerArgsLocal=-nolisten tcp -# Additional arguments for the X-servers for remote sessions. -# This string is subject to word splitting. -# Default is "" -#ServerArgsRemote= -# The user the X-server should run as. Empty results in root. -# Default is "" -#ServerUID=_x11 -# Restart instead of resetting the local X-server after session exit. -# Use it if the server leaks memory etc. -# Default is true -#TerminateServer=false -# Create X-authorizations for local displays. -# Default is true -#Authorize=false -# Which X-authorization mechanisms should be used. -# Default is "MIT-MAGIC-COOKIE-1" -#AuthNames= -# Need to reset the X-server to make it read initial Xauth file. -# Default is false -#ResetForAuth=true -# See above -AllowNullPasswd=true -# See above -AllowShutdown=All -# Enable password-less logins on this display. USE WITH EXTREME CARE! -# Default is false -NoPassEnable=true -# The users that do not need to provide a password to log in. NEVER list root! -# "*" means all non-root users. @ means all users in that group. -# Default is "" -NoPassUsers=arcanis - -# Greeter config for local displays -[X-:*-Greeter] -# See above -PreselectUser=Previous -# See above -FocusPasswd=true -# Specify whether the greeter of local displays should start up in host chooser -# (remote) or login (local) mode and whether it is allowed to switch to the -# other mode. -# "LocalOnly" - only local login possible -# "DefaultLocal" - start up in local mode, but allow switching to remote mode -# "DefaultRemote" - ... and the other way round -# "RemoteOnly" - only choice of remote host possible -# Default is LocalOnly -LoginMode=DefaultLocal -# A list of hosts to be automatically added to the remote login menu. The -# special name "*" means broadcast. -# Default is "*" -#ChooserHosts=*,host1,host2,host3.local,login.domain.com -# Show the "Restart X Server"/"Close Connection" action in the greeter. -# Default is true -AllowClose=false - -# Core config for 1st local display -[X-:0-Core] -# The VT the X-server should run on; auto-assign if zero, don't assign if -1. -# Better leave it zero and use ServerVTs. -# Default is 0 -#ServerVT=7 -# Enable automatic login. USE WITH EXTREME CARE! -# Default is false -AutoLoginEnable=true -# If true, auto-login after logout. If false, auto-login is performed only -# when a display session starts up. -# Default is false -#AutoLoginAgain=true -# The delay in seconds before automatic login kicks in. -# Default is 0 -#AutoLoginDelay=10 -# The user to log in automatically. NEVER specify root! -# Default is "" -AutoLoginUser=arcanis -# The password for the user to log in automatically. This is NOT required -# unless the user is logged into a NIS or Kerberos domain. If you use this -# option, you should "chmod 600 kdmrc" for obvious reasons. -# Default is "" -#AutoLoginPass=secret! -# Immediately lock the automatically started session. This works only with -# KDE sessions. -# Default is false -#AutoLoginLocked=true -# See above -ClientLogFile=.xsession-errors - -# Greeter config for 1st local display -[X-:0-Greeter] -# See above -PreselectUser=Default -# The user to preselect if PreselectUser=Default. -# Default is "" -DefaultUser=arcanis diff --git a/sddm.conf b/sddm.conf new file mode 100644 index 0000000..682ba64 --- /dev/null +++ b/sddm.conf @@ -0,0 +1,32 @@ +[General] +HaltCommand=/usr/bin/systemctl poweroff +RebootCommand=/usr/bin/systemctl reboot +Numlock=none + +[Theme] +ThemeDir=/usr/share/sddm/themes +Current=archlinux +FacesDir=/usr/share/sddm/faces +CursorTheme=Pulse-Glass + +[XDisplay] +ServerPath=/usr/bin/X +XauthPath=/usr/bin/xauth +SessionDir=/usr/share/xsessions +SessionCommand=/usr/share/sddm/scripts/Xsession +DisplayCommand=/usr/share/sddm/scripts/Xsetup +MinimumVT=7 + +[Users] +DefaultPath=/bin:/usr/bin:/usr/local/bin +MinimumUid=1000 +MaximumUid=65000 +HideUsers=secwall,share +HideShells= +RememberLastUser=true +RememberLastSession=true + +[Autologin] +User=arcanis +Session=kde-plasma.desktop +Relogin=false diff --git a/zlogout b/zlogout new file mode 100644 index 0000000..5b4f8bb --- /dev/null +++ b/zlogout @@ -0,0 +1 @@ +clear diff --git a/zsh/archive_functions b/zsh/archive_functions new file mode 100644 index 0000000..a5732ad --- /dev/null +++ b/zsh/archive_functions @@ -0,0 +1,50 @@ +# function to extract archives +# EXAMPLE: unpack file +unpack() { + if [[ -f $1 ]]; then + case $1 in + *.tar.bz2) tar xjfv $1 ;; + *.tar.gz) tar xzfv $1 ;; + *.tar.xz) tar xvJf $1 ;; + *.bz2) bunzip2 $1 ;; + *.gz) gunzip $1 ;; + *.rar) unrar x $1 ;; + *.tar) tar xf $1 ;; + *.tbz) tar xjvf $1 ;; + *.tbz2) tar xjf $1 ;; + *.tgz) tar xzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *) echo "I don't know how to extract '$1'" ;; + esac + else + case $1 in + *help) echo "Usage: unpack ARCHIVE_NAME" ;; + *) echo "'$1' is not a valid file" ;; + esac + fi +} + +# function to create archives +# EXAMPLE: pack tar file +pack() { + if [ $1 ]; then + case $1 in + tar.bz2) tar -cjvf $2.tar.bz2 $2 ;; + tar.gz) tar -czvf $2.tar.bz2 $2 ;; + tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;; + bz2) bzip $2 ;; + gz) gzip -c -9 -n $2 > $2.gz ;; + tar) tar cpvf $2.tar $2 ;; + tbz) tar cjvf $2.tar.bz2 $2 ;; + tgz) tar czvf $2.tar.gz $2 ;; + zip) zip -r $2.zip $2 ;; + 7z) 7z a $2.7z $2 ;; + *help) echo "Usage: pack TYPE FILES" ;; + *) echo "'$1' cannot be packed via pack()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} diff --git a/zsh/custom_rm b/zsh/custom_rm new file mode 100644 index 0000000..ef75a74 --- /dev/null +++ b/zsh/custom_rm @@ -0,0 +1,40 @@ +# redefine rm command +rm() { + # error check + [ $# -eq 0 ] && { echo "Files are not set"; return 1 } + echo "$@" | grep -qe '-h\|--help' && { echo "Usage: rm FILE..."; return 0 } + echo "$@" | grep -q " -" && echo "Warning: this function doesn't support any flags" + # set trash path + TRASHDIR="$HOME/.local/share/Trash" + TRASHFILE="${TRASHDIR}/files" + TRASHINFO="${TRASHDIR}/info" + for DIRECTORY in "${TRASHDIR}" "${TRASHFILE}" "${TRASHINFO}"; do + if [ -e "${DIRECTORY}" ]; then + [ -d "${DIRECTORY}" ] || { echo "'${DIRECTORY}' is a file"; return 1 } + else + mkdir -p -m755 "${DIRECTORY}" + fi + done + # confirm + CONFIRM="" + echo -n "Do you realy want to remove '$@'? [ny] "; read -k1 CONFIRM; echo + [[ ! $CONFIRM =~ [yY] ]] && return 1 + # move + for FILE in "$@"; do + DESTFILE="$(basename -- "${FILE}")" + SUFFIX=''; + ITER=0; + while [ -e "${TRASHFILE}/${DESTFILE}${SUFFIX}" ]; do + SUFFIX="_${ITER}"; + ITER=$(expr ${ITER} + 1) + done + echo "Remove '${FILE}'" + if [ "$(dirname -- "$(realpath -- "${FILE}")")" == "${TRASHFILE}" ]; then + /usr/bin/rm -rf -- "${FILE}" + /usr/bin/rm -rf -- "${TRASHINFO}/${DESTFILE}.trashinfo" + else + mv -- "${FILE}" "${TRASHFILE}/${DESTFILE}${SUFFIX}" || return 1 + echo "[Trash Info]\nPath=$(realpath -- "${FILE}")\nDeletionDate=$(date +%Y-%m-%dT%H:%M:%S)" > "${TRASHINFO}/${DESTFILE}${SUFFIX}.trashinfo" || return 1 + fi + done +} diff --git a/zsh/custom_su b/zsh/custom_su new file mode 100644 index 0000000..9fa2718 --- /dev/null +++ b/zsh/custom_su @@ -0,0 +1,15 @@ +# redefine su command +su() { + CHECKSU=0 + for FLAG in $*; do + [[ $FLAG == "-" ]] && CHECKSU=1 + [[ $FLAG == "-l" ]] && CHECKSU=1 + [[ $FLAG == "--login" ]] && CHECKSU=1 + done + if [[ $CHECKSU == 0 ]]; then + echo "Use 'su -', Luke" + /usr/bin/su - $* + else + /usr/bin/su $* + fi +} diff --git a/zsh/filetypes_aliases b/zsh/filetypes_aliases new file mode 100644 index 0000000..2b7c443 --- /dev/null +++ b/zsh/filetypes_aliases @@ -0,0 +1,7 @@ +# alias -s +alias -s {avi,mpeg,mpg,mov,m2v,mkv}=mpv +alias -s {mp3,flac}=qmmp +alias -s {odt,doc,xls,ppt,docx,xlsx,pptx,csv}=libreoffice +alias -s {pdf}=okular +autoload -U pick-web-browser +alias -s {html,htm}=firefox diff --git a/zsh/hash_common b/zsh/hash_common new file mode 100644 index 0000000..461ed8e --- /dev/null +++ b/zsh/hash_common @@ -0,0 +1,4 @@ +# common hashs +hash -d iso="/mnt/iso" +hash -d u1="/mnt/usbdev1" +hash -d u2="/mnt/usbdev2" diff --git a/zsh/hash_desktop b/zsh/hash_desktop new file mode 100644 index 0000000..2f2131e --- /dev/null +++ b/zsh/hash_desktop @@ -0,0 +1,3 @@ +# hash +hash -d global="/mnt/global" +hash -d windows="/mnt/windows" diff --git a/zsh/highlighting b/zsh/highlighting new file mode 100644 index 0000000..017c629 --- /dev/null +++ b/zsh/highlighting @@ -0,0 +1,44 @@ +# highlighting +source "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) +# brackets +ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' +ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' +ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold' +ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold' +# cursor +#ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' +# main +# default +ZSH_HIGHLIGHT_STYLES[default]='none' +# unknown +ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red' +# command +ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold' +ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold' +ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold' +ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold' +ZSH_HIGHLIGHT_STYLES[command]='fg=green' +ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,bold' +ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow' +ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green' +ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold' +ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold' +# path +ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold' +ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan' +ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan' +# shell +ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan' +ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue' +ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta' +ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan' +ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan' +ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue' +# quotes +ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline' +ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' +# pattern +ZSH_HIGHLIGHT_PATTERNS+=('\~b/rm ' 'fg=green') +# root +#ZSH_HIGHLIGHT_STYLES[root]='bg=red' diff --git a/zsh/pacman_common b/zsh/pacman_common new file mode 100644 index 0000000..4752943 --- /dev/null +++ b/zsh/pacman_common @@ -0,0 +1,7 @@ +# redefine pacman and yaourt +pacman() { + /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash +} +yaourt() { + /usr/bin/yaourt $* && echo "$*" | grep -q "S\|R\|U" && rehash +} diff --git a/zsh/pacman_test b/zsh/pacman_test new file mode 100644 index 0000000..9bc7bb8 --- /dev/null +++ b/zsh/pacman_test @@ -0,0 +1,7 @@ +# pacman commands with repo variations +yatest() { + /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash +} +yaaur() { + /usr/bin/yaourt --config /etc/pacaur.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash +} diff --git a/zsh/pkgfile b/zsh/pkgfile new file mode 100644 index 0000000..8ed8898 --- /dev/null +++ b/zsh/pkgfile @@ -0,0 +1,2 @@ +# pkgfile +source "/usr/share/doc/pkgfile/command-not-found.zsh" diff --git a/zsh/prompt b/zsh/prompt new file mode 100644 index 0000000..1cfcb92 --- /dev/null +++ b/zsh/prompt @@ -0,0 +1,41 @@ +# PROMPT && RPROMPT +if [[ $EUID == 0 ]]; then +# [root@host dir]# + PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ +%{$fg_bold[red]%}%n%{$reset_color%}\ +%{$fg_bold[white]%}@%{$reset_color%}\ +%{$fg_no_bold[red]%}%m %{$reset_color%}\ +%{$fg_bold[yellow]%}%1/%{$reset_color%}\ +%{$fg_bold[white]%}]# %{$reset_color%}" +else +# [user@host dir]$ + PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ +%{$fg_bold[green]%}%n%{$reset_color%}\ +%{$fg_bold[white]%}@%{$reset_color%}\ +%{$fg_no_bold[green]%}%m %{$reset_color%}\ +%{$fg_bold[yellow]%}%1/%{$reset_color%}\ +%{$fg_bold[white]%}]$ %{$reset_color%}" +fi +precmd() { + # battery charge + function batcharge { + bat_perc=$(acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//") + if [[ ${bat_perc} < 15 ]]; then + col="%{$fg_bold[red]%}" + elif [[ ${bat_perc} < 50 ]]; then + col="%{$fg_bold[yellow]%}" + else + col="%{$fg_bold[green]%}" + fi + echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}" + } + # last command + returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}" + RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ +%{$fg_bold[cyan]%}%T%{$reset_color%}\ +%{$fg_bold[white]%}]%{$reset_color%}"\ +$(batcharge)\ +"%{$fg_bold[white]%}[%{$reset_color%}"\ +${returncode}\ +"%{$fg_bold[white]%}]%{$reset_color%}" +} diff --git a/zsh/prompt_server b/zsh/prompt_server new file mode 100644 index 0000000..51ca04e --- /dev/null +++ b/zsh/prompt_server @@ -0,0 +1,27 @@ +# PROMPT && RPROMPT +if [[ $EUID == 0 ]]; then +# [root@host dir]# + PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ +%{$fg_bold[red]%}%n%{$reset_color%}\ +%{$fg_bold[white]%}@%{$reset_color%}\ +%{$fg_no_bold[blue]%}%m %{$reset_color%}\ +%{$fg_bold[yellow]%}%1/%{$reset_color%}\ +%{$fg_bold[white]%}]# %{$reset_color%}" +else +# [user@host dir]$ + PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ +%{$fg_bold[green]%}%n%{$reset_color%}\ +%{$fg_bold[white]%}@%{$reset_color%}\ +%{$fg_no_bold[blue]%}%m %{$reset_color%}\ +%{$fg_bold[yellow]%}%1/%{$reset_color%}\ +%{$fg_bold[white]%}]$ %{$reset_color%}" +fi +precmd() { + # last command + returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}" + RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ +%{$fg_bold[cyan]%}%T%{$reset_color%}\ +%{$fg_bold[white]%}][%{$reset_color%}"\ +${returncode}\ +"%{$fg_bold[white]%}]%{$reset_color%}" +} diff --git a/zsh/sudo_aliases_pc b/zsh/sudo_aliases_pc new file mode 100644 index 0000000..f9b5254 --- /dev/null +++ b/zsh/sudo_aliases_pc @@ -0,0 +1,12 @@ +# sudo alias +if [[ ${EUID} == 0 ]]; then + alias mts_3g='eject /dev/sr1 && sleep 5 && wvdial mts3g && disown' + alias sddm='systemctl start sddm && exit' +else + alias cpu='sudo cpu' + alias backlight='sudo backlight' + alias exante='sudo netctl start exante && sudo systemctl start exante-vpn && sddm' + alias mts_3g='sudo eject /dev/sr1 && sleep 5 && sudo wvdial mts3g && disown' + alias sddm='sudo systemctl start sddm && exit' + alias wifi-menu='sudo wifi-menu' +fi diff --git a/zsh/sudo_aliases_server b/zsh/sudo_aliases_server new file mode 100644 index 0000000..402e491 --- /dev/null +++ b/zsh/sudo_aliases_server @@ -0,0 +1,28 @@ +# sudo alias +if [[ ${EUID} == 0 ]]; then + alias fat32mnt='mount -t vfat -o codepage=866,iocharset=utf8,umask=000' + alias synctime='{ ntpd -qg; hwclock -w; date; }' +else + alias dhcpcd='sudo dhcpcd' + alias extra-i686-build='sudo extra-i686-build' + alias extra-x86_64-build='sudo extra-x86_64-build' + alias fat32mnt='sudo mount -t vfat -o codepage=866,iocharset=utf8,umask=000' + alias modprobe='sudo modprobe' + alias mount='sudo mount' + alias multilib-build='sudo multilib-build' + alias multilib-staging-build='sudo multilib-staging-build' + alias multilib-testing-build='sudo multilib-testing-build' + alias netctl='sudo netctl' + alias pacdiff='sudo pacdiff' + alias rmmod='sudo rmmod' + alias scat='sudo cat' + alias sgrep='sudo grep' + alias staging-i686-build='sudo staging-i686-build' + alias staging-x86_64-build='sudo staging-x86_64-build' + alias svim='sudo vim' + alias synctime='{ sudo ntpd -qg; sudo hwclock -w; date; }' + alias systemctl='sudo systemctl' + alias testing-i686-build='sudo testing-i686-build' + alias testing-x86_64-build='sudo testing-x86_64-build' + alias umount='sudo umount' +fi diff --git a/zsh/vimpager b/zsh/vimpager new file mode 100644 index 0000000..5d9dfc6 --- /dev/null +++ b/zsh/vimpager @@ -0,0 +1,5 @@ +# use vimpager instead of less +alias less='vimpager' +alias zless='vimpager' + +export PAGER="vimpager" diff --git a/zsh/xrandr_e530 b/zsh/xrandr_e530 new file mode 100644 index 0000000..6aff8bf --- /dev/null +++ b/zsh/xrandr_e530 @@ -0,0 +1,48 @@ +# xrandr functions for ThinkPad E530 +# functions to contorl xrandr +# EXAMPLE: projctl 1024x768 +projctl() { + MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" + echo "Available monitors are: ${MONITORS}" + FIRSTMON="LVDS1" + SECONDMON="VGA1" + RESOLUTION="1366x768" + until [ -z $1 ]; do + case "$1" in + "-h" | "--help" ) echo "Usage: projctl [ off/resol ] [ -o MON | --output MON ]" && return 0 ;; + "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; + * ) RESOLUTION="$1" ;; + esac + shift + done + if [[ "${RESOLUTION}" == "off" ]]; then + echo "Disable ${SECONDMON}" + xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --off + else + echo "Using resolution: ${RESOLUTION}" + xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --mode ${RESOLUTION} + fi +} + +twinmon() { + MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" + echo "Available monitors are: ${MONITORS}" + FIRSTMON="LVDS1" + SECONDMON="VGA1" + MODE="on" + until [ -z $1 ]; do + case "$1" in + "-h" | "--help" ) echo "Usage: twinmon [ off ] [ -o MON | --output MON ]" && return 0 ;; + "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; + "off" ) MODE="off" ;; + esac + shift + done + if [[ "${MODE}" == "off" ]]; then + echo "Disable ${SECONDMON}" + xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --off + else + echo "Enable ${SECONDMON}" + xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --auto --left-of ${FIRSTMON} + fi +} diff --git a/zsh/xrandr_t440 b/zsh/xrandr_t440 new file mode 100644 index 0000000..08ad3de --- /dev/null +++ b/zsh/xrandr_t440 @@ -0,0 +1,50 @@ +# xrandr functions for ThinkPad T440 +# functions to contorl xrandr +# EXAMPLE: projctl 1024x768 +projctl() { + MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" + echo "Available monitors are: ${MONITORS}" + FIRSTMON="eDP1" + SECONDMON="DP2" + RESOLUTION="1600x900" + until [ -z $1 ]; do + case "$1" in + "-h" | "--help" ) echo "Usage: projctl [ off/resol ] [ -o MON | --output MON ]" && return 0 ;; + "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; + * ) RESOLUTION="$1" ;; + esac + shift + done + if [[ "${RESOLUTION}" == "off" ]]; then + echo "Disable ${SECONDMON}" + xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --off + else + echo "Using resolution: ${RESOLUTION}" + xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --mode ${RESOLUTION} + fi + xinput set-prop 10 137 $(get-coord-matrix.py) +} + +twinmon() { + MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" + echo "Available monitors are: ${MONITORS}" + FIRSTMON="eDP1" + SECONDMON="DP2" + MODE="on" + until [ -z $1 ]; do + case "$1" in + "-h" | "--help" ) echo "Usage: twinmon [ off ] [ -o MON | --output MON ]" && return 0 ;; + "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; + "off" ) MODE="off" ;; + esac + shift + done + if [[ "${MODE}" == "off" ]]; then + echo "Disable ${SECONDMON}" + xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --off + else + echo "Enable ${SECONDMON}" + xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --auto --left-of ${FIRSTMON} + fi + xinput set-prop 10 137 $(get-coord-matrix.py) +} diff --git a/zshrc b/zshrc index 85f6761..2e16cad 100644 --- a/zshrc +++ b/zshrc @@ -1,53 +1,9 @@ +## global settings # history -HISTFILE=~/.zsh_history +HISTFILE="${HOME}/.zsh_history" HISTSIZE=500000 SAVEHIST=500000 -# highlighting -source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) -# brackets -ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold' -# cursor -#ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' -# main -# default -ZSH_HIGHLIGHT_STYLES[default]='none' -# unknown -ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red' -# command -ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold' -ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold' -ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold' -ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold' -ZSH_HIGHLIGHT_STYLES[command]='fg=green' -ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow' -ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green' -ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold' -# path -ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold' -ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan' -# shell -ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue' -ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta' -ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue' -# quotes -ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline' -ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' -# pattern -ZSH_HIGHLIGHT_PATTERNS+=('\~b/rm ' 'fg=green') -# root -#ZSH_HIGHLIGHT_STYLES[root]='bg=red' - # bindkeys bindkey '^[[A' up-line-or-search # up arrow for back-history-search bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search @@ -67,7 +23,7 @@ bashcompinit zstyle ':completion:*' insert-tab false zstyle ':completion:*' max-errors 2 # correct host complete -[[ -f ~/.ssh/config ]] && zstyle ':completion:*' hosts $(awk '/^Host .*$/ { print $2 }' ~/.ssh/config) +[[ -f ${HOME}/.ssh/config ]] && zstyle ':completion:*' hosts $(awk '/^Host .*$/ { print $2 }' "${HOME}/.ssh/config") # prompt autoload -U promptinit @@ -108,129 +64,11 @@ autoload zcalc # automatically log of on 10*60 sec inactivity export TMOUT=600 -# PROMPT && RPROMPT -if [[ $EUID == 0 ]]; then -# [root@host dir]# - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[red]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[red]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]# %{$reset_color%}" -else -# [user@host dir]$ - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[green]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[green]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]$ %{$reset_color%}" -fi -precmd() { - # battery charge - function batcharge { - bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"` - - if [[ $bat_perc < 15 ]]; then - col="%{$fg_bold[red]%}" - elif [[ $bat_perc < 50 ]]; then - col="%{$fg_bold[yellow]%}" - else - col="%{$fg_bold[green]%}" - fi - - echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}" - } - # last command - returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}" - RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[cyan]%}%T%{$reset_color%}\ -%{$fg_bold[white]%}]%{$reset_color%}"\ -$(batcharge)\ -"%{$fg_bold[white]%}[%{$reset_color%}"\ -$returncode\ -"%{$fg_bold[white]%}]%{$reset_color%}" -} - -show_which() { - OUTPUT=$(which $1 | cut -d " " -f7-) - echo "Running '$OUTPUT'" 1>&2 -} -## alias +## common alias alias grep='grep --colour=auto' alias top='htop' -alias chrommsu='chromium --proxy-server=cache.msu:3128' -alias chromtor='chromium --proxy-server="socks://localhost:9050" --incognito' -alias chromi2p='chromium --proxy-server="http=127.0.0.1:4444;http=127.0.0.1:4444" --incognito' alias df='df -k --print-type --human-readable' alias du='du -k --total --human-readable' -alias less='vimpager' -alias zless='vimpager' -rm() { - # error check - [ $# -eq 0 ] && { echo "Files are not set"; return 1 } - echo "$@" | grep -qe '-h\|--help' && { echo "Usage: rm FILE..."; return 0 } - echo "$@" | grep -q "-" && echo "Warning: this function doesn't support any flags" - # set trash path - TRASHDIR="$HOME/.local/share/Trash" - TRASHFILE="${TRASHDIR}/files" - TRASHINFO="${TRASHDIR}/info" - for DIRECTORY in "${TRASHDIR}" "${TRASHFILE}" "${TRASHINFO}"; do - if [ -e "${DIRECTORY}" ]; then - [ -d "${DIRECTORY}" ] || { echo "'${DIRECTORY}' is a file"; return 1 } - else - mkdir -p -m755 "${DIRECTORY}" - fi - done - # confirm - CONFIRM="" - echo -n "Do you realy want to remove '$@'? [ny] "; read -k1 CONFIRM; echo - [[ ! $CONFIRM =~ [yY] ]] && return 1 - # move - for FILE in "$@"; do - DESTFILE="$(basename -- "${FILE}")" - SUFFIX=''; - ITER=0; - while [ -e "${TRASHFILE}/${DESTFILE}${SUFFIX}" ]; do - SUFFIX="_${ITER}"; - ITER=$(expr ${ITER} + 1) - done - echo "Remove '${FILE}'" - if [ "$(dirname -- "$(realpath -- "${FILE}")")" == "${TRASHFILE}" ]; then - /usr/bin/rm -rf -- "${FILE}" - /usr/bin/rm -rf -- "${TRASHINFO}/${DESTFILE}.trashinfo" - else - mv -- "${FILE}" "${TRASHFILE}/${DESTFILE}${SUFFIX}" || return 1 - echo "[Trash Info]\nPath=$(realpath -- "${FILE}")\nDeletionDate=$(date +%Y-%m-%dT%H:%M:%S)" > "${TRASHINFO}/${DESTFILE}${SUFFIX}.trashinfo" || return 1 - fi - done -} -su() { - CHECKSU=0 - for FLAG in $*; do - [[ $FLAG == "-" ]] && CHECKSU=1 - [[ $FLAG == "-l" ]] && CHECKSU=1 - [[ $FLAG == "--login" ]] && CHECKSU=1 - done - if [[ $CHECKSU == 0 ]]; then - echo "Use 'su -', Luke" - /usr/bin/su - $* - else - /usr/bin/su $* - fi -} -pacman() { - /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash -} -yaourt() { - /usr/bin/yaourt $* && echo "$*" | grep -q "S\|R\|U" && rehash -} -yatest() { - /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash -} -yaaur() { - /usr/bin/yaourt --config /etc/pacaur.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash -} alias ls='ls --color=auto --group-directories-first' alias ll='ls -l --human-readable' @@ -241,186 +79,34 @@ alias lz='ll -S --reverse' alias lt='ll -t --reverse' alias lm='la | more' -# alias -s -alias -s {avi,mpeg,mpg,mov,m2v,mkv}=mpv -alias -s {mp3,flac}=qmmp -alias -s {odt,doc,xls,ppt,docx,xlsx,pptx,csv}=libreoffice -alias -s {pdf}=okular -autoload -U pick-web-browser -alias -s {html,htm}=qupzilla - -# function to extract archives -# EXAMPLE: unpack file -unpack() { - if [[ -f $1 ]]; then - case $1 in - *.tar.bz2) tar xjfv $1 ;; - *.tar.gz) tar xzfv $1 ;; - *.tar.xz) tar xvJf $1 ;; - *.bz2) bunzip2 $1 ;; - *.gz) gunzip $1 ;; - *.rar) unrar x $1 ;; - *.tar) tar xf $1 ;; - *.tbz) tar xjvf $1 ;; - *.tbz2) tar xjf $1 ;; - *.tgz) tar xzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.7z) 7z x $1 ;; - *) echo "I don't know how to extract '$1'" ;; - esac - else - case $1 in - *help) echo "Usage: unpack ARCHIVE_NAME" ;; - *) echo "'$1' is not a valid file" ;; - esac - fi -} - -# function to create archives -# EXAMPLE: pack tar file -pack() { - if [ $1 ]; then - case $1 in - tar.bz2) tar -cjvf $2.tar.bz2 $2 ;; - tar.gz) tar -czvf $2.tar.bz2 $2 ;; - tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;; - bz2) bzip $2 ;; - gz) gzip -c -9 -n $2 > $2.gz ;; - tar) tar cpvf $2.tar $2 ;; - tbz) tar cjvf $2.tar.bz2 $2 ;; - tgz) tar czvf $2.tar.gz $2 ;; - zip) zip -r $2.zip $2 ;; - 7z) 7z a $2.7z $2 ;; - *help) echo "Usage: pack TYPE FILES" ;; - *) echo "'$1' cannot be packed via pack()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -# functions to contorl xrandr -# EXAMPLE: projctl 1024x768 -projctl() { - MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" - echo "Available monitors are: ${MONITORS}" - FIRSTMON="LVDS1" - SECONDMON="VGA1" - RESOLUTION="1366x768" - until [ -z $1 ]; do - case "$1" in - "-h" | "--help" ) echo "Usage: projctl [ off/resol ] [ -o MON | --output MON ]" && exit 0 ;; - "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; - * ) RESOLUTION="$1" ;; - esac - shift - done - if [[ "${RESOLUTION}" == "off" ]]; then - echo "Disable ${SECONDMON}" - xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --off - else - echo "Using resolution: ${RESOLUTION}" - xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --mode ${RESOLUTION} - fi -} - -twinmon() { - MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" - echo "Available monitors are: ${MONITORS}" - FIRSTMON="LVDS1" - SECONDMON="VGA1" - MODE="on" - until [ -z $1 ]; do - case "$1" in - "-h" | "--help" ) echo "Usage: twinmon [ off ] [ -o MON | --output MON ]" && exit 0 ;; - "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; - "off" ) MODE="off" ;; - esac - shift - done - if [[ "${MODE}" == "off" ]]; then - echo "Disable ${SECONDMON}" - xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --off - else - echo "Enable ${SECONDMON}" - xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --auto --left-of ${FIRSTMON} - fi -} - -# sudo alias -if [[ $EUID == 0 ]]; then - alias fat32mnt='mount -t vfat -o codepage=866,iocharset=utf8,umask=000' - # MTS 3G modem - alias mts_3g='eject /dev/sr1 && sleep 5 && wvdial mts3g && disown' - alias sddm='systemctl start sddm && exit' - alias synctime='{ ntpd -qg; hwclock -w; date; }' -else - alias fat32mnt='sudo mount -t vfat -o codepage=866,iocharset=utf8,umask=000' - alias umount='sudo umount' - alias mount='sudo mount' - alias netctl='sudo netctl' - # MTS 3G modem - alias mts_3g='sudo eject /dev/sr1 && sleep 5 && sudo wvdial mts3g && disown' - alias desktop='sudo systemctl start sshd && sudo systemctl start sddm && exit' - alias sddm='sudo systemctl start sddm && exit' - alias synctime='{ sudo ntpd -qg; sudo hwclock -w; date; }' - alias wifi-menu='sudo wifi-menu' - alias dhcpcd='sudo dhcpcd' - alias systemctl='sudo systemctl' - alias modprobe='sudo modprobe' - alias rmmod='sudo rmmod' - alias pacdiff='sudo pacdiff' - alias staging-i686-build='sudo staging-i686-build' - alias staging-x86_64-build='sudo staging-x86_64-build' - alias extra-i686-build='sudo extra-i686-build' - alias extra-x86_64-build='sudo extra-x86_64-build' - alias multilib-staging-build='sudo multilib-staging-build' - alias backlight='sudo backlight' - alias cpu='sudo cpu' - alias svim='sudo vim' - alias scat='sudo cat' - alias sgrep='sudo grep' -fi - # global alias -alias -g g="| grep" -alias -g l="| less" -alias -g t="| tail" -alias -g h="| head" -alias -g n="| wc -l" -alias -g dn="&> /dev/null &" +alias -g g='| grep' +alias -g l='| less' +alias -g t='| tail' +alias -g h='| head' +alias -g n='| wc -l' +alias -g dn='&> /dev/null &' -# pkgfile -source /usr/share/doc/pkgfile/command-not-found.zsh - -# editor -export EDITOR="vim" -export PAGER="vimpager" - -# hash -hash -d global=/mnt/global -hash -d windows=/mnt/windows -hash -d iso=/mnt/iso -hash -d u1=/mnt/usbdev1 -hash -d u2=/mnt/usbdev2 # to run command ignoring aliases -hash -d b=/usr/bin +hash -d b="/usr/bin" # umask umask 022 -# path -export PATH="$HOME/.local/bin/:$HOME/.local/bin/namd:$HOME/.local/bin/namd_gpu:$PATH" - +## environment +# editor +export EDITOR="vim" # color gcc export GCC_COLOR="auto" - +# path +for _DIR in $(find "${HOME}/.local/bin" -type d 2> /dev/null); do export PATH="${_DIR}:${PATH}"; done # fix urxvt if [[ ${TERM} =~ "rxvt-unicode-*" ]] export TERM="xterm" - # ssh-agent -if [[ $EUID != 0 ]]; then +if [[ ${EUID} != 0 ]]; then eval $(ssh-agent) > /dev/null ssh-add -l > /dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh' fi + +## load custom settings from $HOME/.zsh +for _SCR in $(find "${HOME}/.zsh" -type f 2> /dev/null); do source "${_SCR}"; done diff --git a/zshrc_foreing_server b/zshrc_foreing_server deleted file mode 100644 index f601675..0000000 --- a/zshrc_foreing_server +++ /dev/null @@ -1,181 +0,0 @@ -# history -HISTFILE=~/.zsh_history -HISTSIZE=500000 -SAVEHIST=500000 - -# bindkeys -bindkey '^[[A' up-line-or-search # up arrow for back-history-search -bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search -bindkey '\e[1~' beginning-of-line # home -bindkey '\e[2~' overwrite-mode # insert -bindkey '\e[3~' delete-char # del -bindkey '\e[4~' end-of-line # end -bindkey '\e[5~' up-line-or-history # page-up -bindkey '\e[6~' down-line-or-history # page-down - -# autocomplit -autoload -U compinit -compinit -autoload -U bashcompinit -bashcompinit -# first symbol autocomplete -zstyle ':completion:*' insert-tab false -zstyle ':completion:*' max-errors 2 -# correct host complete -[[ -f ~/.ssh/config ]] && zstyle ':completion:*' hosts $(awk '/^Host .*$/ { print $2 }' ~/.ssh/config) - -# prompt -autoload -U promptinit -promptinit - -# colors -autoload -U colors -colors - -# autocd -setopt autocd - -# correct -setopt CORRECT_ALL -SPROMPT="Correct '%R' to '%r' ? (nyae) " - -# append history -setopt APPEND_HISTORY - -# ignore dups in history -setopt HIST_IGNORE_ALL_DUPS - -# ighore additional space in history -setopt HIST_IGNORE_SPACE - -# reduce blanks in history -setopt HIST_REDUCE_BLANKS - -# =cmd without autocomplit -unsetopt EQUALS - -# disable beeps -unsetopt beep - -# autoload calc -autoload zcalc - -# automatically log of on 10*60 sec inactivity -export TMOUT=600 - -# PROMPT && RPROMPT -if [[ $EUID == 0 ]]; then -# [root@host dir]# - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[red]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[blue]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]# %{$reset_color%}" -else -# [user@host dir]$ - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[green]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[blue]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]$ %{$reset_color%}" -fi -precmd() { - # last command - returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}" - RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[cyan]%}%T%{$reset_color%}\ -%{$fg_bold[white]%}][%{$reset_color%}"\ -$returncode\ -"%{$fg_bold[white]%}]%{$reset_color%}" -} - -## alias -alias grep='grep --colour=auto' -alias top='htop' -alias df='df -k --print-type --human-readable' -alias du='du -k --total --human-readable' - -alias ls='ls --color=auto --group-directories-first' -alias ll='ls -l --human-readable' -alias lr='ls --recursive' -alias la='ll --almost-all' -alias lx='ll -X --ignore-backups' -alias lz='ll -S --reverse' -alias lt='ll -t --reverse' -alias lm='la | more' - -# function to extract archives -# EXAMPLE: unpack file -unpack() { - if [[ -f $1 ]]; then - case $1 in - *.tar.bz2) tar xjfv $1 ;; - *.tar.gz) tar xzfv $1 ;; - *.tar.xz) tar xvJf $1 ;; - *.bz2) bunzip2 $1 ;; - *.gz) gunzip $1 ;; - *.rar) unrar x $1 ;; - *.tar) tar xf $1 ;; - *.tbz) tar xjvf $1 ;; - *.tbz2) tar xjf $1 ;; - *.tgz) tar xzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.7z) 7z x $1 ;; - *) echo "I don't know how to extract '$1'" ;; - esac - else - case $1 in - *help) echo "Usage: unpack ARCHIVE_NAME" ;; - *) echo "'$1' is not a valid file" ;; - esac - fi -} - -# function to create archives -# EXAMPLE: pack tar file -pack() { - if [ $1 ]; then - case $1 in - tar.bz2) tar -cjvf $2.tar.bz2 $2 ;; - tar.gz) tar -czvf $2.tar.bz2 $2 ;; - tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;; - bz2) bzip $2 ;; - gz) gzip -c -9 -n $2 > $2.gz ;; - tar) tar cpvf $2.tar $2 ;; - tbz) tar cjvf $2.tar.bz2 $2 ;; - tgz) tar czvf $2.tar.gz $2 ;; - zip) zip -r $2.zip $2 ;; - 7z) 7z a $2.7z $2 ;; - *help) echo "Usage: pack TYPE FILES" ;; - *) echo "'$1' cannot be packed via pack()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -# global alias -alias -g g="| grep" -alias -g l="| less" -alias -g t="| tail" -alias -g h="| head" -alias -g n="| wc -l" -alias -g dn="&> /dev/null &" - -# to run command ignoring aliases -hash -d b=/usr/bin - -# editor -export EDITOR="vim" - -# umask -umask 022 - -# path -export PATH="$PATH:$HOME/.local/bin/" - -# fix urxvt -if [[ ${TERM} =~ "rxvt-unicode-*" ]] export TERM="xterm" diff --git a/zshrc_server b/zshrc_server deleted file mode 100644 index 58deca5..0000000 --- a/zshrc_server +++ /dev/null @@ -1,317 +0,0 @@ -# history -HISTFILE=~/.zsh_history -HISTSIZE=500000 -SAVEHIST=500000 - -# highlighting -source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) -# brackets -ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold' -# cursor -#ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' -# main -# default -ZSH_HIGHLIGHT_STYLES[default]='none' -# unknown -ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red' -# command -ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold' -ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold' -ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold' -ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold' -ZSH_HIGHLIGHT_STYLES[command]='fg=green' -ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow' -ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green' -ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold' -# path -ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold' -ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan' -# shell -ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue' -ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta' -ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue' -# quotes -ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline' -ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' -# pattern -ZSH_HIGHLIGHT_PATTERNS+=('\~b/rm' 'fg=green') -# root -#ZSH_HIGHLIGHT_STYLES[root]='bg=red' - -# bindkeys -bindkey '^[[A' up-line-or-search # up arrow for back-history-search -bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search -bindkey '\e[1~' beginning-of-line # home -bindkey '\e[2~' overwrite-mode # insert -bindkey '\e[3~' delete-char # del -bindkey '\e[4~' end-of-line # end -bindkey '\e[5~' up-line-or-history # page-up -bindkey '\e[6~' down-line-or-history # page-down - -# autocomplit -autoload -U compinit -compinit -autoload -U bashcompinit -bashcompinit -# first symbol autocomplete -zstyle ':completion:*' insert-tab false -zstyle ':completion:*' max-errors 2 -# correct host complete -[[ -f ~/.ssh/config ]] && zstyle ':completion:*' hosts $(awk '/^Host .*$/ { print $2 }' ~/.ssh/config) - -# prompt -autoload -U promptinit -promptinit - -# colors -autoload -U colors -colors - -# autocd -setopt autocd - -# correct -setopt CORRECT_ALL -SPROMPT="Correct '%R' to '%r' ? [nyae] " - -# append history -setopt APPEND_HISTORY - -# ignore dups in history -setopt HIST_IGNORE_ALL_DUPS - -# ighore additional space in history -setopt HIST_IGNORE_SPACE - -# reduce blanks in history -setopt HIST_REDUCE_BLANKS - -# =cmd without autocomplit -unsetopt EQUALS - -# disable beeps -unsetopt beep - -# autoload calc -autoload zcalc - -# automatically log of on 10*60 sec inactivity -export TMOUT=600 - -# PROMPT && RPROMPT -if [[ $EUID == 0 ]]; then -# [root@host dir]# - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[red]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[blue]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]# %{$reset_color%}" -else -# [user@host dir]$ - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[green]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[blue]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]$ %{$reset_color%}" -fi -precmd() { - # last command - returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}" - RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[cyan]%}%T%{$reset_color%}\ -%{$fg_bold[white]%}][%{$reset_color%}"\ -$returncode\ -"%{$fg_bold[white]%}]%{$reset_color%}" -} - -## alias -alias grep='grep --colour=auto' -alias top='htop' -alias df='df -k --print-type --human-readable' -alias du='du -k --total --human-readable' -alias less='vimpager' -alias zless='vimpager' -rm() { - # error check - [ $# -eq 0 ] && { echo "Files are not set"; return 1 } - echo "$@" | grep -qe '-h\|--help' && { echo "Usage: rm FILE..."; return 0 } - echo "$@" | grep -q "-" && echo "Warning: this function doesn't support any flags" - # set trash path - TRASHDIR="$HOME/.local/share/Trash" - TRASHFILE="${TRASHDIR}/files" - TRASHINFO="${TRASHDIR}/info" - for DIRECTORY in "${TRASHDIR}" "${TRASHFILE}" "${TRASHINFO}"; do - if [ -e "${DIRECTORY}" ]; then - [ -d "${DIRECTORY}" ] || { echo "'${DIRECTORY}' is a file"; return 1 } - else - mkdir -p -m755 "${DIRECTORY}" - fi - done - # confirm - CONFIRM="" - echo -n "Do you realy want to remove '$@'? [ny] "; read -k1 CONFIRM; echo - [[ ! $CONFIRM =~ [yY] ]] && return 1 - # move - for FILE in "$@"; do - DESTFILE="$(basename -- "${FILE}")" - SUFFIX=''; - ITER=0; - while [ -e "${TRASHFILE}/${DESTFILE}${SUFFIX}" ]; do - SUFFIX="_${ITER}"; - ITER=$(expr ${ITER} + 1) - done - echo "Remove '${FILE}'" - if [ "$(dirname -- "$(realpath -- "${FILE}")")" == "${TRASHFILE}" ]; then - /usr/bin/rm -rf -- "${FILE}" - /usr/bin/rm -rf -- "${TRASHINFO}/${DESTFILE}.trashinfo" - else - mv -- "${FILE}" "${TRASHFILE}/${DESTFILE}${SUFFIX}" || return 1 - echo "[Trash Info]\nPath=$(realpath -- "${FILE}")\nDeletionDate=$(date +%Y-%m-%dT%H:%M:%S)" > "${TRASHINFO}/${DESTFILE}${SUFFIX}.trashinfo" || return 1 - fi - done -} -su() { - CHECKSU=0 - for FLAG in $*; do - [[ $FLAG == "-" ]] && CHECKSU=1 - [[ $FLAG == "-l" ]] && CHECKSU=1 - [[ $FLAG == "--login" ]] && CHECKSU=1 - done - if [[ $CHECKSU == 0 ]]; then - echo "Use 'su -', Luke" - /usr/bin/su - $* - else - /usr/bin/su $* - fi -} -pacman() { - /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash -} -yaourt() { - /usr/bin/yaourt $* && echo "$*" | grep -q "S\|R\|U" && rehash -} - -alias ls='ls --color=auto --group-directories-first' -alias ll='ls -l --human-readable' -alias lr='ls --recursive' -alias la='ll --almost-all' -alias lx='ll -X --ignore-backups' -alias lz='ll -S --reverse' -alias lt='ll -t --reverse' -alias lm='la | more' - -# function to extract archives -# EXAMPLE: unpack file -unpack() { - if [[ -f $1 ]]; then - case $1 in - *.tar.bz2) tar xjfv $1 ;; - *.tar.gz) tar xzfv $1 ;; - *.tar.xz) tar xvJf $1 ;; - *.bz2) bunzip2 $1 ;; - *.gz) gunzip $1 ;; - *.rar) unrar x $1 ;; - *.tar) tar xf $1 ;; - *.tbz) tar xjvf $1 ;; - *.tbz2) tar xjf $1 ;; - *.tgz) tar xzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.7z) 7z x $1 ;; - *) echo "I don't know how to extract '$1'" ;; - esac - else - case $1 in - *help) echo "Usage: unpack ARCHIVE_NAME" ;; - *) echo "'$1' is not a valid file" ;; - esac - fi -} - -# function to create archives -# EXAMPLE: pack tar file -pack() { - if [ $1 ]; then - case $1 in - tar.bz2) tar -cjvf $2.tar.bz2 $2 ;; - tar.gz) tar -czvf $2.tar.bz2 $2 ;; - tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;; - bz2) bzip $2 ;; - gz) gzip -c -9 -n $2 > $2.gz ;; - tar) tar cpvf $2.tar $2 ;; - tbz) tar cjvf $2.tar.bz2 $2 ;; - tgz) tar czvf $2.tar.gz $2 ;; - zip) zip -r $2.zip $2 ;; - 7z) 7z a $2.7z $2 ;; - *help) echo "Usage: pack TYPE FILES" ;; - *) echo "'$1' cannot be packed via pack()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -# sudo alias -if [[ $EUID == 0 ]]; then - alias fat32mnt='mount -t vfat -o codepage=866,iocharset=utf8,umask=000' - alias synctime='{ ntpd -qg; hwclock -w; date; }' -else - alias fat32mnt='sudo mount -t vfat -o codepage=866,iocharset=utf8,umask=000' - alias umount='sudo umount' - alias mount='sudo mount' - alias netctl='sudo netctl' - alias synctime='{ sudo ntpd -qg; sudo hwclock -w; date; }' - alias dhcpcd='sudo dhcpcd' - alias systemctl='sudo systemctl' - alias modprobe='sudo modprobe' - alias rmmod='sudo rmmod' - alias pacdiff='sudo pacdiff' - alias staging-i686-build='sudo staging-i686-build' - alias staging-x86_64-build='sudo staging-x86_64-build' - alias multilib-staging-build='sudo multilib-staging-build' - alias svim='sudo vim' - alias scat='sudo cat' - alias sgrep='sudo grep' -fi - -# global alias -alias -g g="| grep" -alias -g l="| less" -alias -g t="| tail" -alias -g h="| head" -alias -g n="| wc -l" -alias -g dn="&> /dev/null &" - -# to run command ignoring aliases -hash -d b=/usr/bin - -# pkgfile -source /usr/share/doc/pkgfile/command-not-found.zsh - -# editor -export EDITOR="vim" -export PAGER="vimpager" - -# umask -umask 022 - -# path -export PATH="$PATH:$HOME/.local/bin/" - -# color gcc -export GCC_COLOR="auto" - -# fix urxvt -if [[ ${TERM} =~ "rxvt-unicode-*" ]] export TERM="xterm" diff --git a/zshrc_t440 b/zshrc_t440 deleted file mode 100644 index 39c914d..0000000 --- a/zshrc_t440 +++ /dev/null @@ -1,419 +0,0 @@ -# history -HISTFILE=~/.zsh_history -HISTSIZE=500000 -SAVEHIST=500000 - -# highlighting -source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) -# brackets -ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold' -ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold' -# cursor -#ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' -# main -# default -ZSH_HIGHLIGHT_STYLES[default]='none' -# unknown -ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red' -# command -ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold' -ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold' -ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold' -ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold' -ZSH_HIGHLIGHT_STYLES[command]='fg=green' -ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow' -ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green' -ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold' -ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold' -# path -ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold' -ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan' -# shell -ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue' -ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta' -ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan' -ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue' -# quotes -ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline' -ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' -# pattern -ZSH_HIGHLIGHT_PATTERNS+=('\~b/rm ' 'fg=green') -# root -#ZSH_HIGHLIGHT_STYLES[root]='bg=red' - -# bindkeys -bindkey '^[[A' up-line-or-search # up arrow for back-history-search -bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search -bindkey '\e[1~' beginning-of-line # home -bindkey '\e[2~' overwrite-mode # insert -bindkey '\e[3~' delete-char # del -bindkey '\e[4~' end-of-line # end -bindkey '\e[5~' up-line-or-history # page-up -bindkey '\e[6~' down-line-or-history # page-down - -# autocomplit -autoload -U compinit -compinit -autoload -U bashcompinit -bashcompinit -# first symbol autocomplete -zstyle ':completion:*' insert-tab false -zstyle ':completion:*' max-errors 2 -# correct host complete -[[ -f ~/.ssh/config ]] && zstyle ':completion:*' hosts $(awk '/^Host .*$/ { print $2 }' ~/.ssh/config) - -# prompt -autoload -U promptinit -promptinit - -# colors -autoload -U colors -colors - -# autocd -setopt autocd - -# correct -setopt CORRECT_ALL -SPROMPT="Correct '%R' to '%r' ? [nyae] " - -# append history -setopt APPEND_HISTORY - -# ignore dups in history -setopt HIST_IGNORE_ALL_DUPS - -# ighore additional space in history -setopt HIST_IGNORE_SPACE - -# reduce blanks in history -setopt HIST_REDUCE_BLANKS - -# =cmd without autocomplit -unsetopt EQUALS - -# disable beeps -unsetopt beep - -# autoload calc -autoload zcalc - -# automatically log of on 10*60 sec inactivity -export TMOUT=600 - -# PROMPT && RPROMPT -if [[ $EUID == 0 ]]; then -# [root@host dir]# - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[red]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[red]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]# %{$reset_color%}" -else -# [user@host dir]$ - PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[green]%}%n%{$reset_color%}\ -%{$fg_bold[white]%}@%{$reset_color%}\ -%{$fg_no_bold[green]%}%m %{$reset_color%}\ -%{$fg_bold[yellow]%}%1/%{$reset_color%}\ -%{$fg_bold[white]%}]$ %{$reset_color%}" -fi -precmd() { - # battery charge - function batcharge { - bat_perc=$((($(cat /sys/class/power_supply/BAT0/capacity)+$(cat /sys/class/power_supply/BAT1/capacity))/2)) - - if [[ $bat_perc < 15 ]]; then - col="%{$fg_bold[red]%}" - elif [[ $bat_perc < 50 ]]; then - col="%{$fg_bold[yellow]%}" - else - col="%{$fg_bold[green]%}" - fi - - echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}" - } - # last command - returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}" - RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\ -%{$fg_bold[cyan]%}%T%{$reset_color%}\ -%{$fg_bold[white]%}]%{$reset_color%}"\ -$(batcharge)\ -"%{$fg_bold[white]%}[%{$reset_color%}"\ -$returncode\ -"%{$fg_bold[white]%}]%{$reset_color%}" -} - -## alias -alias grep='grep --colour=auto' -alias top='htop' -alias df='df -k --print-type --human-readable' -alias du='du -k --total --human-readable' -alias less='vimpager' -alias zless='vimpager' -rm() { - # error check - [ $# -eq 0 ] && { echo "Files are not set"; return 1 } - echo "$@" | grep -qe '-h\|--help' && { echo "Usage: rm FILE..."; return 0 } - echo "$@" | grep -q "-" && echo "Warning: this function doesn't support any flags" - # set trash path - TRASHDIR="$HOME/.local/share/Trash" - TRASHFILE="${TRASHDIR}/files" - TRASHINFO="${TRASHDIR}/info" - for DIRECTORY in "${TRASHDIR}" "${TRASHFILE}" "${TRASHINFO}"; do - if [ -e "${DIRECTORY}" ]; then - [ -d "${DIRECTORY}" ] || { echo "'${DIRECTORY}' is a file"; return 1 } - else - mkdir -p -m755 "${DIRECTORY}" - fi - done - # confirm - CONFIRM="" - echo -n "Do you realy want to remove '$@'? [ny] "; read -k1 CONFIRM; echo - [[ ! $CONFIRM =~ [yY] ]] && return 1 - # move - for FILE in "$@"; do - DESTFILE="$(basename -- "${FILE}")" - SUFFIX=''; - ITER=0; - while [ -e "${TRASHFILE}/${DESTFILE}${SUFFIX}" ]; do - SUFFIX="_${ITER}"; - ITER=$(expr ${ITER} + 1) - done - echo "Remove '${FILE}'" - if [ "$(dirname -- "$(realpath -- "${FILE}")")" == "${TRASHFILE}" ]; then - /usr/bin/rm -rf -- "${FILE}" - /usr/bin/rm -rf -- "${TRASHINFO}/${DESTFILE}.trashinfo" - else - mv -- "${FILE}" "${TRASHFILE}/${DESTFILE}${SUFFIX}" || return 1 - echo "[Trash Info]\nPath=$(realpath -- "${FILE}")\nDeletionDate=$(date +%Y-%m-%dT%H:%M:%S)" > "${TRASHINFO}/${DESTFILE}${SUFFIX}.trashinfo" || return 1 - fi - done -} -su() { - CHECKSU=0 - for FLAG in $*; do - [[ $FLAG == "-" ]] && CHECKSU=1 - [[ $FLAG == "-l" ]] && CHECKSU=1 - [[ $FLAG == "--login" ]] && CHECKSU=1 - done - if [[ $CHECKSU == 0 ]]; then - echo "Use 'su -', Luke" - /usr/bin/su - $* - else - /usr/bin/su $* - fi -} -pacman() { - /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash -} -yaourt() { - /usr/bin/yaourt $* && echo "$*" | grep -q "S\|R\|U" && rehash -} -yatest() { - /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash -} -yaaur() { - /usr/bin/yaourt --config /etc/pacaur.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash -} - -alias ls='ls --color=auto --group-directories-first' -alias ll='ls -l --human-readable' -alias lr='ls --recursive' -alias la='ll --almost-all' -alias lx='ll -X --ignore-backups' -alias lz='ll -S --reverse' -alias lt='ll -t --reverse' -alias lm='la | more' - -# alias -s -alias -s {avi,mpeg,mpg,mov,m2v,mkv}=mpv -alias -s {mp3,flac}=qmmp -alias -s {odt,doc,xls,ppt,docx,xlsx,pptx,csv}=libreoffice -alias -s {pdf}=okular -autoload -U pick-web-browser -alias -s {html,htm}=firefox - -# function to extract archives -# EXAMPLE: unpack file -unpack() { - if [[ -f $1 ]]; then - case $1 in - *.tar.bz2) tar xjfv $1 ;; - *.tar.gz) tar xzfv $1 ;; - *.tar.xz) tar xvJf $1 ;; - *.bz2) bunzip2 $1 ;; - *.gz) gunzip $1 ;; - *.rar) unrar x $1 ;; - *.tar) tar xf $1 ;; - *.tbz) tar xjvf $1 ;; - *.tbz2) tar xjf $1 ;; - *.tgz) tar xzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.7z) 7z x $1 ;; - *) echo "I don't know how to extract '$1'" ;; - esac - else - case $1 in - *help) echo "Usage: unpack ARCHIVE_NAME" ;; - *) echo "'$1' is not a valid file" ;; - esac - fi -} - -# function to create archives -# EXAMPLE: pack tar file -pack() { - if [ $1 ]; then - case $1 in - tar.bz2) tar -cjvf $2.tar.bz2 $2 ;; - tar.gz) tar -czvf $2.tar.bz2 $2 ;; - tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;; - bz2) bzip $2 ;; - gz) gzip -c -9 -n $2 > $2.gz ;; - tar) tar cpvf $2.tar $2 ;; - tbz) tar cjvf $2.tar.bz2 $2 ;; - tgz) tar czvf $2.tar.gz $2 ;; - zip) zip -r $2.zip $2 ;; - 7z) 7z a $2.7z $2 ;; - *help) echo "Usage: pack TYPE FILES" ;; - *) echo "'$1' cannot be packed via pack()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -# functions to contorl xrandr -# EXAMPLE: projctl 1024x768 -projctl() { - MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" - echo "Available monitors are: ${MONITORS}" - FIRSTMON="eDP1" - SECONDMON="DP2" - RESOLUTION="1600x900" - until [ -z $1 ]; do - case "$1" in - "-h" | "--help" ) echo "Usage: projctl [ off/resol ] [ -o MON | --output MON ]" && return 0 ;; - "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; - * ) RESOLUTION="$1" ;; - esac - shift - done - if [[ "${RESOLUTION}" == "off" ]]; then - echo "Disable ${SECONDMON}" - xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --off - else - echo "Using resolution: ${RESOLUTION}" - xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --mode ${RESOLUTION} - fi - xinput set-prop 10 137 $(get-coord-matrix.py) -} - -twinmon() { - MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')" - echo "Available monitors are: ${MONITORS}" - FIRSTMON="eDP1" - SECONDMON="DP2" - MODE="on" - until [ -z $1 ]; do - case "$1" in - "-h" | "--help" ) echo "Usage: twinmon [ off ] [ -o MON | --output MON ]" && return 0 ;; - "-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;; - "off" ) MODE="off" ;; - esac - shift - done - if [[ "${MODE}" == "off" ]]; then - echo "Disable ${SECONDMON}" - xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --off - else - echo "Enable ${SECONDMON}" - xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --auto --left-of ${FIRSTMON} - fi - xinput set-prop 10 137 $(get-coord-matrix.py) -} - -# sudo alias -if [[ $EUID == 0 ]]; then - alias fat32mnt='mount -t vfat -o codepage=866,iocharset=utf8,umask=000' - # MTS 3G modem - alias mts_3g='eject /dev/sr1 && sleep 5 && wvdial mts3g && disown' - alias sddm='systemctl start sddm && exit' - alias synctime='{ ntpd -qg; hwclock -w; date; }' -else - alias fat32mnt='sudo mount -t vfat -o codepage=866,iocharset=utf8,umask=000' - alias umount='sudo umount' - alias mount='sudo mount' - alias netctl='sudo netctl' - # MTS 3G modem - alias mts_3g='sudo eject /dev/sr1 && sleep 5 && sudo wvdial mts3g && disown' - alias sddm='sudo systemctl start sddm && exit' - alias synctime='{ sudo ntpd -qg; sudo hwclock -w; date; }' - alias wifi-menu='sudo wifi-menu' - alias dhcpcd='sudo dhcpcd' - alias systemctl='sudo systemctl' - alias modprobe='sudo modprobe' - alias rmmod='sudo rmmod' - alias pacdiff='sudo pacdiff' - alias staging-i686-build='sudo staging-i686-build' - alias staging-x86_64-build='sudo staging-x86_64-build' - alias extra-i686-build='sudo extra-i686-build' - alias extra-x86_64-build='sudo extra-x86_64-build' - alias multilib-staging-build='sudo multilib-staging-build' - alias multilib-build='sudo multilib-build' - alias svim='sudo vim' - alias scat='sudo cat' - alias sgrep='sudo grep' - alias cpu='sudo cpu' - alias cpu='sudo backlight' -fi - -# global alias -alias -g g="| grep" -alias -g l="| less" -alias -g t="| tail" -alias -g h="| head" -alias -g n="| wc -l" -alias -g dn="&> /dev/null &" - -# pkgfile -source /usr/share/doc/pkgfile/command-not-found.zsh - -# editor -export EDITOR="vim" -export PAGER="vimpager" - -# hash -hash -d iso=/mnt/iso -hash -d u1=/mnt/usbdev1 -hash -d u2=/mnt/usbdev2 -# to run command ignoring aliases -hash -d b=/usr/bin - -# umask -umask 022 - -# path -export PATH="$HOME/.local/bin/:$HOME/.local/bin/exante:$PATH" - -# color gcc -export GCC_COLOR="auto" - -# fix urxvt -if [[ ${TERM} =~ "rxvt-unicode-*" ]] export TERM="xterm" - -# ssh-agent -if [[ $EUID != 0 ]]; then - eval $(ssh-agent) > /dev/null - ssh-add -l > /dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh' -fi