From 102aa36798f17adf2eaac48c399ea8643d503ac4 Mon Sep 17 00:00:00 2001 From: Smirnov Olexandr Date: Sat, 2 Jan 2021 21:48:35 +0200 Subject: [PATCH] Update i3, polybar, emacs, qtile, zsh & sctipts --- bin/catfetch | 4 +- config/i3/config | 38 +++++------ config/nvim/init.vim | 2 +- config/picom.conf | 10 +-- config/polybar/config | 23 ++++++- config/qtile/config.py | 12 +--- config/rofi/themes/nten-dmenu.rasi | 2 +- doom.d/config.el | 11 +++ doom.d/custom.el | 13 +++- doom.d/init.el | 18 ++--- doom.d/packages.el | 2 + script/dmenu/dmenu-config-edit.sh | 103 +++++++++++++++-------------- script/dmenu/dmenu-power.sh | 36 +++------- script/dmenu/dmenu-sysmon.sh | 15 ----- zshrc | 3 + 15 files changed, 152 insertions(+), 140 deletions(-) delete mode 100755 script/dmenu/dmenu-sysmon.sh diff --git a/bin/catfetch b/bin/catfetch index 8024267..84a3129 100755 --- a/bin/catfetch +++ b/bin/catfetch @@ -11,7 +11,7 @@ kernel=$(cat /proc/sys/kernel/osrelease|cut -d '-' -f1) # Shell shell=$(basename $SHELL) -# Pakages +# Packages manager=$(which apt pacman yay apk xbps-query 2>/dev/null) manager=${manager##*/} case "$manager" in @@ -42,5 +42,5 @@ echo -e " ${blue}${bold} WM ${reset}${wmname}" echo -e " /\_/\ ${blue}${bold} SHELL ${reset}${shell}" echo -e " (=^.^=) ${blue}${bold}KERNEL ${reset}${kernel}" echo -e " (\") (\")_/ ${blue}${bold} PKG ${reset}${packages}" -echo -e " ${black}卑${red}卑${green}卑${yellow}卑${blue}卑${magenta}卑${cyan}卑${reset} " +echo -e " ${black} ${red} ${green} ${yellow} ${blue} ${magenta} ${cyan} ${reset} " exit 0 diff --git a/config/i3/config b/config/i3/config index 9c47ee9..77e65e8 100644 --- a/config/i3/config +++ b/config/i3/config @@ -25,12 +25,12 @@ exec --no-startup-id exec picom --experimental-backends -b exec --no-startup-id exec nitrogen --restore exec --no-startup-id exec setxkbmap "us,ua" ",winkeys" "grp:alt_shift_toggle" -option "ctrl:nocaps" exec --no-startup-id exec org.telegram.desktop -exec --no-startup-id exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 -exec_always --no-startup-id exec xautolock -time 3 -locker "betterlockscreen --off 180 -t \"Computer is lockerd\" -l" +exec --no-startup-id exec lxsession +exec --no-startup-id exec xautolock -time 3 -locker "betterlockscreen --off 180 -t \"Computer is lockerd\" -l" exec_always --no-startup-id exec $HOME/.config/i3/bar.sh +exec --no-startup-id exec discord #exec --no-startup-id exec conky #exec --no-startup-id exec redshift-gtk -#exec --no-startup-id exec discord ############## WM keys ############ @@ -60,11 +60,11 @@ bindsym $mod+grave scratchpad show, floating disable ############## User key ########### # Menus -bindsym $mod+Shift+apostrophe exec "rofi -show run" -bindsym $mod+Shift+Return exec "rofi -show drun" -bindsym $mod+Escape exec ~/.script/dmenu/dmenu-power.sh -h 24 -bindsym $mod+Control+u exec ~/.script/dmenu/dmenu-config-edit.sh -h 24 -bindsym $mod+Control+i exec passmenu -h 24 -p Passwords +bindsym $mod+Shift+apostrophe exec "rofi -location 6 -show run" +bindsym $mod+Shift+Return exec "rofi -location 6 -show drun" +bindsym $mod+Escape exec ~/.script/dmenu/dmenu-power.sh -b -h 24 +bindsym $mod+Control+u exec ~/.script/dmenu/dmenu-config-edit.sh -b -h 24 +bindsym $mod+Control+i exec passmenu -b -h 24 -p Passwords # Apps bindsym $mod+Return exec $terminal @@ -84,11 +84,11 @@ bindsym $mod+minus exec "pactl set-sink-volume alsa_output.pci-0000_00_1b.0.anal bindsym $mod+Shift+minus exec "pactl set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo toggle" ######### Window preferens ######## -assign [class="(?i)firefox|qutebrowser"] $ws2 -assign [class="(?i)telegram|discord|viber"] $ws6 +assign [class="(?i)telegram|discord"] $ws6 +for_window [class="(?i)telegram|discord"] layout tabbed #focus_on_window_activation focus -########## Change focus ########## +########## Change focus ########### bindsym $mod+h focus left bindsym $mod+Left focus left bindsym $mod+j focus down @@ -109,14 +109,14 @@ bindsym $mod+Shift+l move right bindsym $mod+Shift+Right move right ########## Resize window ########## -bindsym $mod+Control+h resize shrink width 20 px or 20 ppt -bindsym $mod+Control+Left resize shrink width 20 px or 20 ppt -bindsym $mod+Control+j resize grow height 20 px or 20 ppt -bindsym $mod+Control+Down resize grow height 20 px or 20 ppt -bindsym $mod+Control+k resize shrink height 20 px or 20 ppt -bindsym $mod+Control+Up resize shrink height 20 px or 20 ppt -bindsym $mod+Control+l resize grow width 20 px or 20 ppt -bindsym $mod+Control+Right resize grow width 20 px or 20 ppt +bindsym $mod+Control+h resize shrink width 5 px or 5 ppt +bindsym $mod+Control+Left resize shrink width 5 px or 5 ppt +bindsym $mod+Control+j resize grow height 5 px or 5 ppt +bindsym $mod+Control+Down resize grow height 5 px or 5 ppt +bindsym $mod+Control+k resize shrink height 5 px or 5 ppt +bindsym $mod+Control+Up resize shrink height 5 px or 5 ppt +bindsym $mod+Control+l resize grow width 5 px or 5 ppt +bindsym $mod+Control+Right resize grow width 5 px or 5 ppt ############ Workspaces ########### set $ws1 "1" diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 084b358..0d7e2b5 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -37,7 +37,7 @@ call plug#end() " Colors set termguicolors set background=dark -colorscheme nten16 +colo nten16 set t_Co=256 " Syntax & line numbars diff --git a/config/picom.conf b/config/picom.conf index 456dd45..494a673 100644 --- a/config/picom.conf +++ b/config/picom.conf @@ -9,7 +9,7 @@ shadow-offset-y = -7; shadow-exclude = [ "override_redirect", "class_g = 'Firefox' && argb", - "class_g = 'Polybar'" + #"class_g = 'Polybar'" ]; ############ Fading ########### @@ -27,10 +27,10 @@ opacity-rule = [ "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" ]; no-fading-openclose = true ##### Background-Blurring ##### -blur-method = "dual_kawase"; -blur-strength = 5; -blur-kern = "3x3box"; -blur-background-exclude = []; +#blur-method = "dual_kawase"; +#blur-strength = 5; +#blur-kern = "3x3box"; +#blur-background-exclude = []; ####### General Settings ###### diff --git a/config/polybar/config b/config/polybar/config index 85963b1..a26071f 100644 --- a/config/polybar/config +++ b/config/polybar/config @@ -11,6 +11,7 @@ alert = #FF6C6B [bar/i3bar] width = 100% height = 24 +bottom = true fixed-center = true wm-restack = i3 background = ${colors.background} @@ -20,7 +21,7 @@ module-margin-right = 1 font-0 = Iosevka Nerd Font:style=Medium:size=8;3 font-1 = FontAwesome5Free:style=Solid:size=7.5;2.5 font-2 = Weather Icons:size=7;2 -modules-left = i3 pacman-up +modules-left = i3 menu pacman-up window-name modules-right = keyboard pulseaudio backlight wifi-signal time date tray-position = right @@ -104,6 +105,10 @@ type = custom/script exec = ~/.config/polybar/scripts/updates-pacman-aur.sh interval = 60 +[module/window-name] +type = internal/xwindow +label-maxlen = 100 + [module/keyboard] type = internal/xkeyboard format-prefix = "" @@ -112,6 +117,22 @@ blacklist-0 = num lock blacklist-1 = scroll lock blacklist-2= caps lock +[module/menu] +type = custom/menu +format = +format-padding = 1 +format-spacing = 2 +label-open =  +label-close =  +menu-0-0 =  +menu-0-0-exec = thunar +menu-0-1 =  +menu-0-1-exec = firefox +menu-0-2 =  +menu-0-2-exec = alacritty +menu-0-3 =  +menu-0-3-exec = emacs + [module/date] type = internal/date interval = 600 diff --git a/config/qtile/config.py b/config/qtile/config.py index d0f2826..d2abb15 100644 --- a/config/qtile/config.py +++ b/config/qtile/config.py @@ -44,14 +44,6 @@ keys = [ lazy.spawn(filemanager), desc="Launch filemanager" ), - Key([mod, "shift"], "f", - lazy.spawn("dmenufm"), - desc="Launch dmenu filemanager" - ), - Key([mod, alt], "t", - lazy.spawn(f"{terminal} -e nvim /home/{user}/.todo"), - desc="Open ~/.todo file in nvim" - ), # Window control Key([mod], "q", @@ -137,11 +129,11 @@ keys = [ # Menus(dmenu or/and rofi) Key([mod, "shift"], "Return", - lazy.spawn("rofi -show drun"), + lazy.spawn("rofi -location 2 -show drun"), desc="(Rofi) Program launcher" ), Key([mod, "shift"], "apostrophe", - lazy.spawn("rofi -show run"), + lazy.spawn("rofi -location 2 -show run"), desc="(Rofi) Program launcher" ), Key([mod],"Escape", diff --git a/config/rofi/themes/nten-dmenu.rasi b/config/rofi/themes/nten-dmenu.rasi index b224b42..1a274fb 100644 --- a/config/rofi/themes/nten-dmenu.rasi +++ b/config/rofi/themes/nten-dmenu.rasi @@ -7,7 +7,7 @@ selected-foreground: #ffffff; } #window { - location: north; + /* location: north; */ width: 100%; height: 24px; padding: 0px; diff --git a/doom.d/config.el b/doom.d/config.el index 81cd5c7..af7f18c 100644 --- a/doom.d/config.el +++ b/doom.d/config.el @@ -4,3 +4,14 @@ (setq doom-theme 'doom-one) (setq org-directory "~/org/") (setq display-line-numbers-type t) + + +(defun gk-markdown-preview-buffer () + (interactive) + (let* ((buf-this (buffer-name (current-buffer))) + (buf-html (get-buffer-create + (format "*gk-md-html (%s)*" buf-this)))) + (markdown-other-window (buffer-name buf-html)) + (shr-render-buffer buf-html) + (eww-mode) + (kill-buffer buf-html))) diff --git a/doom.d/custom.el b/doom.d/custom.el index e505fa1..2bef680 100644 --- a/doom.d/custom.el +++ b/doom.d/custom.el @@ -1,3 +1,12 @@ (custom-set-variables - '(package-selected-packages '(zoutline))) -(custom-set-faces) + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(package-selected-packages '(markdown-mode zoutline))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/doom.d/init.el b/doom.d/init.el index 782ab8d..d3f86f5 100644 --- a/doom.d/init.el +++ b/doom.d/init.el @@ -23,16 +23,16 @@ ;;minimap ; show a map of the code on the side modeline ; snazzy, Atom-inspired modeline, plus API ;;nav-flash ; blink cursor line after big motions - ;;neotree ; a project drawer, like NERDTree for vim + neotree ; a project drawer, like NERDTree for vim ophints ; highlight the region an operation acts on (popup +defaults) ; tame sudden yet inevitable temporary windows tabs ; a tab bar for Emacs - treemacs ; a project drawer, like neotree but cooler + ;;treemacs ; a project drawer, like neotree but cooler unicode ; extended unicode support for various languages - vc-gutter ; vcs diff in the fringe - vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;vc-gutter ; vcs diff in the fringe + ;;vi-tilde-fringe ; fringe tildes to mark beyond EOB ;;window-select ; visually switch windows - workspaces ; tab emulation, persistence & separate workspaces + ;;workspaces ; tab emulation, persistence & separate workspaces ;;zen ; distraction-free coding or writing :editor @@ -51,7 +51,7 @@ :emacs dired ; making dired pretty [functional] - electric ; smarter, keyword-based electric-indent + ;;electric ; smarter, keyword-based electric-indent ;;ibuffer ; interactive buffer management undo ; persistent, smarter undo for your inevitable mistakes vc ; version-control and Emacs, sitting in a tree @@ -64,7 +64,7 @@ :checkers syntax ; tasing you for every semicolon you forget - ;;spell ; tasing you for misspelling mispelling + spell ; tasing you for misspelling mispelling ;;grammar ; tasing grammar mistake every you make :tools @@ -91,7 +91,7 @@ :os (:if IS-MAC macos) ; improve compatibility with macOS - tty ; improve the terminal Emacs experience + ;;tty ; improve the terminal Emacs experience :lang ;;agda ; types of types of types of types... @@ -150,7 +150,7 @@ ;;swift ; who asked for emoji variables? ;;terra ; Earth and Moon in alignment for performance. ;;web ; the tubes - yaml ; JSON, but readable + ;;yaml ; JSON, but readable :email ;;(mu4e +gmail) diff --git a/doom.d/packages.el b/doom.d/packages.el index fe0425a..6b7e218 100644 --- a/doom.d/packages.el +++ b/doom.d/packages.el @@ -1,3 +1,5 @@ (package! rainbow-mode) (package! async) (package! go-autocomplete) +(package! markdown-mode) +(package! hy-mode) diff --git a/script/dmenu/dmenu-config-edit.sh b/script/dmenu/dmenu-config-edit.sh index 660a7b1..f7da217 100755 --- a/script/dmenu/dmenu-config-edit.sh +++ b/script/dmenu/dmenu-config-edit.sh @@ -3,75 +3,78 @@ declare options=("i3 qtile berry openbox -polybar -picom -dunst -qutebrowser -taskwarrior -tmux alacritty kitty -neovim +picom ranger -sh") +qutebrowser +emacs +nvim +tmux +dunst +castero +redshift +rofi") -choice=$(echo -e "${options[@]}" | dmenu -p 'Edit config file' $@) +choice=$(echo -e "${options[@]}"|dmenu -p "Config edit" $@) case "$choice" in - dunst) choice="$HOME/.config/dunst/dunstrc" ;; - neovim) choice="$HOME/.config/nvim/init.vim" ;; - taskwarior) choice="$HOME/.taskrc" ;; - picom) choice="$HOME/.config/picom.conf" ;; - kitty) choice="$HOME/.config/kitty/kitty.conf" ;; - alacritty) choice="$hoME/.config/alacritty.yml" ;; - polybar) choice="$HOME/.config/polybar/config" ;; - tmux) choice="$HOME/.tmux.conf" ;; - i3) choice="$HOME/.config/i3/config" ;; - qtile) - opt=$(echo -e "config.py\nautostart.sh"|dmenu -p 'Qtile' $@) - case "$opt" in - "config.py") choice="$HOME/.config/qtile/config.py" ;; - "autostart.sh") choice="$HOME/.config/qtile/autostart.sh" ;; + i3) + case "$(echo -e "config\npolybar"|dmenu -p "I3wm" $@)" in + config) choice="$HOME/.config/i3/config" ;; + polybar) choice="$HOME/.config/polybar/config" ;; + esac + ;; + qtile) + case "$(echo -e "config\nautostart"|dmenu -p "Qtile" $@)" in + config) choice="$HOME/.config/qtile/config.py" ;; + autostart) choice="$HOME/.config/qtile/autostart.sh" ;; esac ;; berry) - declare opt=$(echo -e "berry\npolybar\nsxhkd"|dmenu -p 'Berry' $@) - case "$opt" in - "berry") choice="$HOME/.config/berry/autostart" ;; - "polybar") choice="$HOME/.config/berry/polybar/polybar" ;; - "sxhkd") choice="$HOME/.config/berry/sxhkdrc" ;; + case "$(echo -e "config\npolybar\nsxhkd"|dmenu -p "Berry" $@)" in + config) choice="$HOME/.config/berry/autostart" ;; + polybar) choice="$HOME/.config/berry/polybar/polybar" ;; + sxhkd) choice="$HOME/.config/berry/sxhkdrc" ;; esac ;; openbox) - opt=$(echo -e "openbox\nautostart\nmenu\nreload"|dmenu -p 'OpenBox' $@) - case "$opt" in - "openbox") choice="$HOME/.config/openbox/rc.xml" ;; - "autostart") choice="$HOME/.config/openbox/autostart" ;; - "menu") choice="$HOME/.config/openbox/menu.xml" ;; - "reload") openbox --reconfigure && pkill kitty ;; + case "$(echo -p "config\nautostart\nmenu\ntint2|dmenu -p "OpenBox" $@")" in + config) choice="$HOME/.config/openbox/rc.xml" ;; + autostart) choice="$HOME/.config/openbox/autostart" ;; + menu) choice="$HOME/.config/openbox/menu.xml" ;; + tint2) choice="$HOME/.config/tint2/tint2rc" ;; esac ;; + alacritty) choice="$hoME/.config/alacritty.yml" ;; + kitty) choice="$HOME/.config/kitty/kitty.conf" ;; + picom) choice="$HOME/.config/picom.conf" ;; + ranger) choice="$HOME/.config/ranger/rc.conf" ;; qutebrowser) - why=$(echo -e "config.py\nquickmarks"|dmenu -p 'Qutebrowser' $@) - case "$why" in - "config.py") choice="$HOME/.config/qutebrowser/config.py" ;; - "quickmarks") choice="$HOME/.config/qutebrowser/quickmarks" ;; + case "$(echo -e "config\nquickmarks"|dmenu -p "Qutebrowser" $@)" in + config) choice="$HOME/.config/qutebrowser/config.py" ;; + quickmarks) choice="$HOME/.config/qutebrowser/quickmarks" ;; esac ;; - ranger) - why=$(echo -e "rc.conf\nrifle.conf"|dmenu -p 'Ranger' $@) - case "$why" in - "rc.conf") choice="$HOME/.config/ranger/rc.conf" ;; - "rifle.conf") choice="$HOME/.config/ranger/rifle.conf" ;; + emacs) + case "$(echo -e "config.el\ncustom.el\ninit.el\npackages.el"|dmenu -p "Doom emacs" $@)" in + config.el) choice="$HOME/.doom.d/config.el" ;; + init.el) choice="$HOME/.doom.d/init.el" ;; + custom.el) choice="$HOME/.doom.d/custom.el" ;; + packages.el) choice="$HOME/.doom.d/packages.el" ;; esac ;; - sh) - why=$(echo -e "zsh\nfish\nbash"|dmenu -p "Shell" $@) - case "$why" in - zsh) choice="$HOME/.zshrc" ;; - fish) choice="$HOME/.config/fish/config.fish" ;; - bash) choice="$hoME/.bashrc" + nvim) choice="$HOME/.config/nvim/init.vim" ;; + tmux) choice="$HOME/.tmux.conf" ;; + dunst) choice="$HOME/.config/dunst/dunstrc" ;; + zsh) choice="$HOME/.zshrc" ;; + castero) choice="$HOME/.config/castero/castero.conf" ;; + redshift) choice="$HOME/.config/redshift.conf" ;; + rofi) + case "$(echo -e "config\nnten-dmenu"|dmenu -p "Rofi" $@)" in + config) choice="$HOME/.config/rofi/config" ;; + nten-dmenu) choice="$HOME/.config/rofi/themes/nten-dmenu.rasi" ;; esac ;; - *) exit 1 ;; esac alacritty -e nvim "$choice" +# emacsclient -c -a emacs "$choice" diff --git a/script/dmenu/dmenu-power.sh b/script/dmenu/dmenu-power.sh index 733bc76..49d9694 100755 --- a/script/dmenu/dmenu-power.sh +++ b/script/dmenu/dmenu-power.sh @@ -1,42 +1,28 @@ #!/bin/sh -declare options=("Poweroff +declare options=("ShutDown Lock Logout Reboot") -choice=$(echo -e "${options[@]}" | dmenu -p 'Power' $@) +choice=$(echo -e "${options[@]}" | dmenu -p "Power" $@) case "$choice" in - "Poweroff") - declare opt=("Yes\nNo") - yesno=$(echo -e "${opt[@]}" | dmenu -p 'Power' $@) - case "$yesno" in + "ShutDown") + case "$(echo -e "Yes\nNo"|dmenu -p "ShutDown" $@)" in "Yes") exec systemctl poweroff ;; - "No") exec exit 0 ;; + "No") exec exit 0 ;; esac ;; - "Lock") - exec betterlockscreen --off 300 -t "Computer is lockerd" -l ;; + "Lock") exec betterlockscreen --off 300 -t "Computer is lockerd" -l ;; "Logout") - declare opt=("Yes\nNo") - yesno=$(echo -e "${opt[@]}" | dmenu -p 'Logout' $@) - case "$yesno" in - "Yes") - if [[ "$(pgrep spectrwm)" ]]; then - exec pkill spectrwm - else - exec loginctl terminate-session $XDG_SESSION_ID - fi - ;; - "No") exec exit 0 ;; + case "$(echo -e "Yes\nNo"|dmenu -p "ShutDown" $@)" in + "Yes") exec loginctl terminate-session $XDG_SESSION_ID ;; + "No") exec exit 0 ;; esac ;; "Reboot") - declare opt=("Yes\nNo") - yesno=$(echo -e "${opt[@]}" | dmenu -p 'Power' $@) - case "$yesno" in + case "$(echo -e "Yes\nNo"|dmenu -p "Reboot" $@)" in "Yes") exec systemctl reboot ;; - "No") exec exit 0 ;; + "No") exec exit 0 ;; esac ;; - *) exit 1 ;; esac diff --git a/script/dmenu/dmenu-sysmon.sh b/script/dmenu/dmenu-sysmon.sh deleted file mode 100755 index 87c83b8..0000000 --- a/script/dmenu/dmenu-sysmon.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -declare options=("htop -bashtop -gtop") - -choice=$(echo -e "${options[@]}" | dmenu -h 24 -p 'System monitor ') - -case "$choice" in - htop) choice="htop" ;; - bashtop) choice="bashtop" ;; - gtop) choice="gtop" ;; - *) exit 1 ;; -esac -kitty -e "$choice" diff --git a/zshrc b/zshrc index 019441d..7e540bd 100644 --- a/zshrc +++ b/zshrc @@ -42,6 +42,7 @@ alias du="du -sh" alias df="df -h" alias lns="ln -s" alias uln="unlink" +alias rf="rm -rf" # Program alias vim="nvim" @@ -69,3 +70,5 @@ alias doomsync="$HOME/.emacs.d/bin/doom sync" alias doomupgrade="$HOME/.emacs.d/bin/doom upgrade" alias doomdoctor="$HOME/.emacs.d/bin/doom doctor" alias doom="$HOME/.emacs.d/bin/doom" + +eval $(thefuck --alias)