From 69336f4aebe8fce9884dae2375eabc9948f43beb Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Fri, 28 Aug 2020 16:38:57 +0200 Subject: Added touchpad toggle --- .vimrc | 2 +- .xinitrc | 2 +- .zsh_aliases | 4 ++-- bin/touchpad-toggle | 9 +++++++++ install | 1 + xmonad.hs | 1 + 6 files changed, 15 insertions(+), 4 deletions(-) create mode 100755 bin/touchpad-toggle diff --git a/.vimrc b/.vimrc index 27f9bdd..76dd3e9 100644 --- a/.vimrc +++ b/.vimrc @@ -29,7 +29,7 @@ set wrapmargin=0 " disable auto line wrapping set encoding=utf-8 " utf-8 encoding set formatoptions-=t " do not auto break line > 89 character filetype plugin indent on " allow to add specific rules for certain type of file -set mouse=a " mouse scrolling (heretic) +" set mouse=a " mouse scrolling (heretic) " }}} " browse list with tab {{{ diff --git a/.xinitrc b/.xinitrc index abb4622..fd3a72a 100755 --- a/.xinitrc +++ b/.xinitrc @@ -1,4 +1,4 @@ -xinput disable 'ETPS/2 Elantech Touchpad' & +# xinput disable 'ETPS/2 Elantech Touchpad' & redshift -c /home/charles/.config/redshift.conf & dunst & exec xmonad diff --git a/.zsh_aliases b/.zsh_aliases index b2bd6ee..1410f07 100644 --- a/.zsh_aliases +++ b/.zsh_aliases @@ -10,8 +10,8 @@ alias valgrindc='colour-valgrind' # common commands alias less='less -N' # enable line number -alias v='nvim' -alias vim='nvim' +alias v='vim' +# alias vim='nvim' # alias mkdir='mkdir -p' alias gdb='gdb -q' # disable long intro message alias sudo='sudo ' # enable color (the search for aliases continues) diff --git a/bin/touchpad-toggle b/bin/touchpad-toggle new file mode 100755 index 0000000..f0a86a1 --- /dev/null +++ b/bin/touchpad-toggle @@ -0,0 +1,9 @@ +#!/bin/sh + +touchpad_name='ETPS/2 Elantech Touchpad' + +active="$(xinput list-props "$touchpad_name" | grep 'Device Enabled' | cut -f 3)" + +[ "$active" -eq 1 ] && + xinput disable "$touchpad_name" || + xinput enable "$touchpad_name" diff --git a/install b/install index 9106ed2..013b9bb 100755 --- a/install +++ b/install @@ -44,6 +44,7 @@ create_dotfile_link dunst/dunstrc .config/dunst/dunstrc mkdir -p "$HOME/.newsboat" create_dotfile_link_same .newsboat/config +#create_dotfile_link_same .newsboat/urls # create_dotfile_link_same slock/config.def.h diff --git a/xmonad.hs b/xmonad.hs index 9d05782..4b7ee10 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -39,6 +39,7 @@ myKeys = [ ("", spawn "~/bin/volume-ctl up") , ("", spawn "~/bin/backlight-ctl up") , ("", spawn "~/bin/backlight-ctl down") , ("", spawn "slock") + , ("", spawn "~/bin/touchpad-toggle") , ("M-o", spawn "~/bin/project-open") , ("M-m", spawn "st -e mocp") -- cgit From 0459e513045d3de259c5f2068718f00252a8abab Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 13 Sep 2020 19:32:19 +0200 Subject: Added mutt Send mailbox, zsh alias gpa doesn't push all branches, minishell_test configuration variables, pacman-url get url of package --- .muttrc | 18 +++++++++--------- .zsh_aliases | 19 ++++++++++++++----- .zshrc | 3 +++ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.muttrc b/.muttrc index 9393baf..4d5e9c1 100644 --- a/.muttrc +++ b/.muttrc @@ -18,7 +18,7 @@ set record = "+Send" set trash = "+Trash" set postponed = "+Drafts" -mailboxes =INBOX =Sent =Trash =Drafts +mailboxes =INBOX =Sent =Send =Trash =Drafts set editor = 'vim' set sort = 'reverse-date' # newest at the top @@ -27,14 +27,14 @@ set date_format = "%d/%m %I:%M" set index_format = "%2C %Z %d %-15.15F %s (%-4.4c)" # one line format in home # from https://github.com/LukeSmithxyz/mutt-wizard/blob/master/share/mutt-wizard.muttrc -set rfc2047_parameters = yes # decode non standard stuff -set sleep_time = 0 # don't pause -set markers = no # no '+' on line wrap -set mark_old = no # don't mark mail as read if not seen -set mime_forward = yes # attachements forwarded -set wait_key = no # no press to continue... -set forward_format = "Fwd: %s" # forward subject -set forward_quote # include previous message in forward +set rfc2047_parameters = yes # decode non standard stuff +set sleep_time = 0 # don't pause +set markers = no # no '+' on line wrap +set mark_old = no # don't mark mail as read if not seen +set mime_forward = yes # attachements forwarded +set wait_key = no # no press to continue... +set forward_format = "Fwd: %s" # forward subject +set forward_quote # include previous message in forward set sidebar_visible = yes set sidebar_width = 20 diff --git a/.zsh_aliases b/.zsh_aliases index 1410f07..1a0ffac 100644 --- a/.zsh_aliases +++ b/.zsh_aliases @@ -32,7 +32,7 @@ alias ta='tree -a' alias t1='tree -L 1' alias t2='tree -L 2' alias t3='tree -L 3' -alias treeI="tree -I '__pycache__' -I '*.o' -I vendor" +# alias ti="tree | grep -v -E '*.pyc'" # man alias ma="man" @@ -56,8 +56,8 @@ alias gd='git diff' alias gds='git diff --staged' alias gdt='git diff --stat' alias gl='git pull' -alias glg='git log --stat' -alias glgg='git log --graph' +alias glg='git log --abbrev-commit --stat' +alias glgg='git log --abbrev-commit --graph' alias glgo='git log --oneline --no-decorate' alias gp='git push' alias gcl='git clone --recurse-submodules' @@ -67,9 +67,13 @@ alias gss='git status --short' alias gco='git checkout' alias gsta='git stash push' alias gstp='git stash pop' -alias gpa="git remote | xargs -L1 git push --all" alias grv="git remote -v" alias gra="git remote add" +gpa() { + branch="$1" + [ -z "$1" ] && branch=master + git remote | xargs -I{} git push {} "$branch" +} # lpass (lastpass-cli) alias lpassp='lpass show --password --clip' # put password in clipboard @@ -118,9 +122,14 @@ wificonnect() { # alias mutt='neomutt' -alias ytdl='youtube-dl' +alias ytdl='youtube-dl --output "%(title)s.%(ext)s"' +alias ytdlp='youtube-dl -i --output "%(playlist_index)s-%(title)s.%(ext)s"' alias ytdla='youtube-dl -i -x -f bestaudio/best --output "%(playlist_index)s-%(title)s.%(ext)s"' alias qmvdest='qmv --format=do' alias xclip='xclip -selection clipboard' + +pacman-url() { + pacman -Si "$1" | grep URL | tr -s ' ' | cut -d ' ' -f 3 +} diff --git a/.zshrc b/.zshrc index 8cf539c..cc6bd78 100644 --- a/.zshrc +++ b/.zshrc @@ -106,3 +106,6 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:$DOTDIR/bin" # export PATH="$PATH:$HOME/.vim/plugged/vim-superman/bin" export GPG_TTY=$(tty) # fixing gpg fatal error about tty + +export MINISHELL_TEST_BONUS=yes +export MINISHELL_TEST_PAGER=vim -- cgit From 2a8eaf57d0a8090ac10fe011e527774e484c96f9 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 14 Sep 2020 09:11:20 +0200 Subject: Added tag-music script --- bin/tag-music | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 bin/tag-music diff --git a/bin/tag-music b/bin/tag-music new file mode 100755 index 0000000..17d6aac --- /dev/null +++ b/bin/tag-music @@ -0,0 +1,48 @@ +#!/bin/sh + +music_dir="$HOME/Music" + +for artist_dir in "$music_dir"/* +do + [ ! -d "$artist_dir" ] && continue + artist="$(basename "$artist_dir")" + [ "$artist" = backup ] && continue + + for album_dir in "$artist_dir"/* + do + album="$(basename "$album_dir")" + [ ! -d "$album_dir" ] && continue + + for song_file in "$album_dir"/* + do + [ ! -f "$song_file" ] && continue + song="$(basename "$song_file" | cut -d '.' -f 1)" + # echo "$artist" + # echo "$album" + # echo "$song" + case "$song_file" in + *.ogg) + ;; + *.opus) + echo "OPUS: $song_file" + echo "Title=$song +Artist=$artist +Album=$album +Track= +Total= +Date= +Genre= +Comment=" | opustags -i -S "$song_file" + ;; + *.mp3) + id3tag --artist "$artist" --album "$album" --song "$song" "$songfile" + ;; + *.m4a) + id3tag --artist "$artist" --album "$album" --song "$song" "$songfile" + ;; + *) + ;; + esac + done + done +done -- cgit From cb9e981c80476a7297ecd7c80ba9cd8eafe0f0d1 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 16 Sep 2020 10:21:01 +0200 Subject: Added XMonad confirmation before shutdown and notification on restart --- .zsh_aliases | 4 ++++ xmonad.hs | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.zsh_aliases b/.zsh_aliases index 1a0ffac..5627844 100644 --- a/.zsh_aliases +++ b/.zsh_aliases @@ -133,3 +133,7 @@ alias xclip='xclip -selection clipboard' pacman-url() { pacman -Si "$1" | grep URL | tr -s ' ' | cut -d ' ' -f 3 } + +grep-kill() { + ps aux | grep "$1" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill +} diff --git a/xmonad.hs b/xmonad.hs index 4b7ee10..578868b 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -1,9 +1,15 @@ +import Control.Monad +import Data.List +import System.Exit + + import XMonad import XMonad.Config.Desktop -- Utilities import XMonad.Util.EZConfig (additionalKeysP, additionalKeys) import XMonad.Util.SpawnOnce +import XMonad.Util.Dmenu -- Layouts import XMonad.Layout.NoBorders @@ -44,4 +50,18 @@ myKeys = [ ("", spawn "~/bin/volume-ctl up") , ("M-o", spawn "~/bin/project-open") , ("M-m", spawn "st -e mocp") , ("M-S-d", spawn "notify-send \"$(date +\"%H:%M %A %d/%m/%Y %B\")\"") + , ("M-q", spawn "notify-send Restart" >> spawn restartCmd) + , ("M-S-q", confirm "Are you sure you want to shutdown?" $ io (exitWith ExitSuccess)) ] + +confirm :: String -> X () -> X () +confirm prompt f = do + result <- menuArgs "dmenu" ["-p", prompt] ["yes", "no"] + when (result == "yes") f + +restartCmd :: String +restartCmd = intercalate "; " [ "if type xmonad" + , "then xmonad --recompile && xmonad --restart" + , "else xmessage xmonad not in \\$PATH: \"$PATH\"" + , "fi" + ] -- cgit