From 0b92f0fe457fb541642192a02c117474e9771578 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 25 Jun 2020 14:39:59 +0200 Subject: Added slock color, merged master --- .zsh_aliases | 5 +++++ install.sh | 2 ++ slock/config.def.h | 12 ++++++++++++ xmonad.hs | 3 +-- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 slock/config.def.h diff --git a/.zsh_aliases b/.zsh_aliases index 69975d1..da8e309 100644 --- a/.zsh_aliases +++ b/.zsh_aliases @@ -110,3 +110,8 @@ alias openpdf='zathura `ls -1 *.pdf | dmenu` &' alias cagob='RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo build' alias cagor='RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo run' + +# wifi +wificonnect() { + nmcli device wifi connect $1 password $2 +} diff --git a/install.sh b/install.sh index e6cff50..c33481a 100755 --- a/install.sh +++ b/install.sh @@ -34,6 +34,8 @@ create_dotfile_link_same .gitconfig [ ! -d $HOME/.config ] && mkdir $HOME/.config create_dotfile_link redshift.conf .config/redshift.conf +create_dotfile_link_same slock/config.def.h + ln -sf $DOTDIR/.xinitrc $HOME/.xinitrc ln -sf $DOTDIR/.zprofile $HOME/.zprofile diff --git a/slock/config.def.h b/slock/config.def.h new file mode 100644 index 0000000..a21b349 --- /dev/null +++ b/slock/config.def.h @@ -0,0 +1,12 @@ +/* user and group to drop privileges to */ +static const char *user = "charles"; +static const char *group = "wheel"; + +static const char *colorname[NUMCOLS] = { + [INIT] = "#003355", /* after initialization */ + [INPUT] = "#005577", /* during input */ + [FAILED] = "#CC3333", /* wrong password */ +}; + +/* treat a cleared input like a wrong password (color) */ +static const int failonclear = 1; diff --git a/xmonad.hs b/xmonad.hs index a0ac671..6fe103a 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -18,7 +18,7 @@ main = xmonad $ desktopConfig , focusedBorderColor = "#bbc5ff" , terminal = "st" , layoutHook = myLayouts - , manageHook = myManageHook + , manageHook = myManageHook , modMask = mod4Mask -- mod key to super , borderWidth = 1 , startupHook = myStartupHook @@ -33,7 +33,6 @@ myLayouts = tiledBigMaster -- bigger master for code and smaller slave fo tiledEven = Tall 1 (3 / 100) (1 / 2) myStartupHook = do - spawnOnce "xinput disable 'ETPS/2 Elantech Touchpad' &" -- disable touchpad spawnOnce "redshift -c /home/charles/.config/redshift.conf &" -- start redshift myManageHook = insertPosition End Newer -- insert new window at the end of the current layout -- cgit From c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 10 Aug 2020 02:50:57 +0200 Subject: Added repo clone in project-open, cleaning installation script --- bin/battery-low-check | 5 ++++ bin/project-open | 27 +++++++++++++------ dunst/dunstrc | 2 +- install | 75 ++++++++++++++++++++++++++++++--------------------- 4 files changed, 70 insertions(+), 39 deletions(-) create mode 100755 bin/battery-low-check diff --git a/bin/battery-low-check b/bin/battery-low-check new file mode 100755 index 0000000..dbbdc6b --- /dev/null +++ b/bin/battery-low-check @@ -0,0 +1,5 @@ +#!/bin/sh + +capacity=$(cat /sys/class/power_supply/BAT0/capacity) + +[ "$capacity" -lt 10 ] && notify-send -u critical "Battery low $capacity%" diff --git a/bin/project-open b/bin/project-open index a4bf523..0dd5d31 100755 --- a/bin/project-open +++ b/bin/project-open @@ -10,22 +10,33 @@ dest=$( [ -z "$dest" ] && exit 1 -if cd "$HOME/git/$dest" 2> /dev/null +dest_path="$HOME/git/$dest" + +if cd "$dest_path" 2> /dev/null then - touch "$HOME/git/$dest" + touch "$dest_path" st else while [ -z "$choice" ] do - choice=$(printf 'yes\nno\n' | dmenu -p "Create a repository at ~/git/$dest?") + choice=$(printf 'create\nclone\ncancel' | dmenu -p "New repository at ~/git/$dest?") done case "$choice" in - "no") exit ;; - "yes") mkdir -p "$HOME/git/$dest" ;; - *) exit 1 ;; + "create") + mkdir -p "$dest_path" + cd "$dest_path" || exit 1 + git init + ;; + "clone") + url="$(echo '' | dmenu -p "Entry repository url: ")" + notify-send "Cloning $url to $dest_path" + git clone --recursive "$url" "$dest_path" || + (notify-send -u critical "Clone failed"; exit 1) + cd "$dest_path" || exit 1 + ;; + "cancel") exit ;; + *) exit 1 ;; esac - cd "$HOME/git/$dest" || exit 1 - git init st fi diff --git a/dunst/dunstrc b/dunst/dunstrc index 12198ed..a9eba7f 100644 --- a/dunst/dunstrc +++ b/dunst/dunstrc @@ -292,7 +292,7 @@ background = "#900000" foreground = "#ffffff" frame_color = "#ff0000" - timeout = 0 + timeout = 15 # Icon for notifications with critical urgency, uncomment to enable #icon = /path/to/icon diff --git a/install b/install index 893c96f..93ea77a 100755 --- a/install +++ b/install @@ -2,30 +2,30 @@ create_dotfile_link() { - ln -svf $DOTDIR/$1 $HOME/$2 + ln -svf "$DOTDIR/$1" "$HOME/$2" } create_dotfile_link_same() { - create_dotfile_link $1 $1 + create_dotfile_link "$1" "$1" } -########################### -# dotfiles install script # -########################### +############################################################################### +# link dotfiles +############################################################################### # dotfiles directory -[ -z $DOTDIR ] && export DOTDIR=`pwd` +[ -z "$DOTDIR" ] && DOTDIR=$(pwd) && export DOTDIR # Creating links create_dotfile_link_same .zshrc create_dotfile_link_same .bashrc create_dotfile_link_same .vimrc create_dotfile_link_same .pluggins.vim -[ ! -d $HOME/.vim/plugin ] && mkdir -p $HOME/.vim/plugin +mkdir -p "$HOME/.vim/plugin" create_dotfile_link grep.vim .vim/plugin/grep.vim -[ ! -d $HOME/.xmonad ] && mkdir $HOME/.xmonad +mkdir -p "$HOME/.xmonad" create_dotfile_link xmonad.hs .xmonad/xmonad.hs create_dotfile_link_same .gdbinit @@ -36,37 +36,52 @@ create_dotfile_link_same .mailcap create_dotfile_link_same .xinitrc create_dotfile_link_same .zprofile -[ ! -d $HOME/.config ] && mkdir $HOME/.config +mkdir -p "$HOME/.config" create_dotfile_link redshift.conf .config/redshift.conf -create_dotfile_link_same slock/config.def.h +mkdir -p "$HOME/.config/dunst" +create_dotfile_link dunst/dunstrc .config/dunst/dunstrc -################ -# dependencies # -################ +mkdir -p "$HOME/.newsboat" +create_dotfile_link_same .newsboat/config -[ $# -ge 1 ] || [ "$1" = "--ln" ] && exit 0 +# create_dotfile_link_same slock/config.def.h + + +############################################################################### +# dependencies +############################################################################### + +[ "$#" -ne 1 ] || [ ! "$1" = "-a" ] && exit 0 echo "Installing Dependencies" +############################################################################### # vim Plug -PLUGFILE=$HOME/.vim/autoload/plug.vim +PLUGFILE="$HOME/.vim/autoload/plug.vim" PLUGURL='https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' -[ ! -f $PLUGFILE ] && echo "Downloading plug.vim" && \ - curl -fLo $PLUGFILE --create-dirs $PLUGURL +[ ! -f "$PLUGFILE" ] && echo "Downloading plug.vim" && \ + curl -fLo "$PLUGFILE" --create-dirs "$PLUGURL" echo "Installing plug.vim Pluggins" vim -c "PlugInstall" -c "qa" +############################################################################### # zsh pluggins -[ ! -d $HOME/.zsh ] && make $HOME/.zsh -# pure theme -[ ! -d $HOME/.zsh/pure ] && echo "Installing zsh pure theme" && \ - git clone https://github.com/sindresorhus/pure \ - $HOME/.zsh/pure -# syntax hightlighting -[ ! -d $HOME/.zsh/zsh-syntax-highlighting ] && echo "Installing zsh syntax highlighting plugin" && \ - git clone https://github.com/zsh-users/zsh-syntax-highlighting \ - $HOME/.zsh/zsh-syntax-highlighting -# you should use -[ ! -d $HOME/.zsh/zsh-you-should-use ] && echo "Installing zsh you should use plugin" && \ - git clone https://github.com/MichaelAquilina/zsh-you-should-use \ - $HOME/.zsh/zsh-you-should-use + +update_plugin() +{ + url="$1" + dest_path="$2" + if [ ! -d "$dest_path" ] + then + echo "Installing $dest_path" + git clone "$url" "$dest_path" + else + echo "Updating $dest_path" + git -C "$dest_path" pull + fi +} + +mkdir -p "$HOME/.zsh" +update_plugin 'https://github.com/sindresorhus/pure' "$HOME/.zsh/pure" +update_plugin 'https://github.com/zsh-users/zsh-syntax-highlighting' "$HOME/.zsh/zsh-syntax-highlighting" +update_plugin 'https://github.com/MichaelAquilina/zsh-you-should-use' "$HOME/.zsh/zsh-you-should-use" -- cgit From 5f97842b01d98c586d3b6bc0834ec6704a2b1d3a Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 10 Aug 2020 04:53:57 +0200 Subject: Added notification on volume and backlight change --- bin/backlight-ctl | 11 +++++++++++ bin/volume-ctl | 12 ++++++++++++ install | 1 + xmonad.hs | 16 ++++++++-------- 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100755 bin/backlight-ctl create mode 100755 bin/volume-ctl diff --git a/bin/backlight-ctl b/bin/backlight-ctl new file mode 100755 index 0000000..7153276 --- /dev/null +++ b/bin/backlight-ctl @@ -0,0 +1,11 @@ +#!/bin/sh + +[ "$#" -ne 1 ] && exit 1; + +case "$1" in + "up") xbacklight -inc 5 ;; + "down") xbacklight -dec 5 ;; + *) exit 1 ;; +esac + +notify-send "backlight $(xbacklight | cut -d '.' -f 1)" diff --git a/bin/volume-ctl b/bin/volume-ctl new file mode 100755 index 0000000..7e3ec83 --- /dev/null +++ b/bin/volume-ctl @@ -0,0 +1,12 @@ +#!/bin/sh + +[ "$#" -ne 1 ] && exit 1; + +case "$1" in + "up") pulseaudio-ctl up ;; + "down") pulseaudio-ctl down ;; + "mute") pulseaudio-ctl mute ;; + *) exit 1 ;; +esac + +notify-send "volume $(pulseaudio-ctl full-status | cut -d ' ' -f 1)" diff --git a/install b/install index 93ea77a..9106ed2 100755 --- a/install +++ b/install @@ -47,6 +47,7 @@ create_dotfile_link_same .newsboat/config # create_dotfile_link_same slock/config.def.h +ln -sv "$DOTDIR/bin" "$HOME/bin" ############################################################################### # dependencies diff --git a/xmonad.hs b/xmonad.hs index 1730b3c..566c332 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -33,14 +33,14 @@ myLayouts = tiledBigMaster -- bigger master for code and smaller slave fo myManageHook = insertPosition End Newer -- insert new window at the end of the current layout -myKeys = [ ("", spawn "pulseaudio-ctl up") -- volume up - , ("", spawn "pulseaudio-ctl down") -- volume down - , ("", spawn "pulseaudio-ctl mute") -- volume mute - , ("", spawn "light -A 5") -- backlight up - , ("", spawn "light -U 5") -- backlight down - , ("", spawn "slock") -- lock screen - - , ("M-o", spawn "~/git/dotfiles/bin/project-open") -- TODO could could be generalized +myKeys = [ ("", spawn "~/bin/volume-ctl up") + , ("", spawn "~/bin/volume-ctl down") + , ("", spawn "~/bin/volume-ctl mute") + , ("", spawn "~/bin/backlight-ctl up") + , ("", spawn "~/bin/backlight-ctl down") + , ("", spawn "slock") + + , ("M-o", spawn "~/bin/project-open") , ("M-S-o", spawn "cd ~/test && st") , ("M-d", spawn "cd ~/Downloads && st") , ("M-m", spawn "st -e mocp") -- cgit