Compare commits

...

104 Commits

Author SHA1 Message Date
d36941b3d1 New DWL utility to switch context 2025-04-20 11:00:17 -07:00
4de2de5cf7 Merge remote-tracking branch 'refs/remotes/origin/master' 2025-04-20 10:56:00 -07:00
8ef05d2a11 Minor font and theme updates 2025-04-20 10:52:12 -07:00
257c6a0b38 More editor updates 2025-04-20 10:51:04 -07:00
fd9de58b0f Wttr location updated 2025-04-20 10:48:36 -07:00
263aeed08f Editor setup changes 2025-04-20 10:22:13 -07:00
e986f0eabb Add notification when display setup is changed 2025-04-20 10:10:39 -07:00
267e505265 Adjust neovim updater to match GitHub name change 2025-04-20 10:09:26 -07:00
3f7e576869 Extend idle timeout 2025-04-20 10:08:31 -07:00
f683d77a39 Support for Apple MacBook Pro panel 2025-02-02 14:35:51 -08:00
065f16607f Always use tmux with unicode enabled 2025-02-02 14:34:59 -08:00
a502df8e81 Added Ghostty config 2024-12-30 17:45:49 -08:00
8bac906e77 Using swaync for notifications 2024-11-09 17:56:08 -08:00
9fef9181e1 MPD pause/palying status icons 2024-09-29 13:41:22 -07:00
430064c8de MPD status changes 2024-09-29 13:27:00 -07:00
0aa36e8575 Action buttons with SHIFT/CTRL modifiers 2024-09-29 13:26:40 -07:00
f5ab4aad25 Rofi to select pipewire sink 2024-09-18 19:01:11 -07:00
5623991a73 Modified conky setup for Lenovo laptop 2024-09-18 18:48:30 -07:00
2158f65d7a Miscellaneous dot file updates 2024-09-18 18:48:08 -07:00
ff4ad34194 Added media control keys 2024-09-18 18:46:07 -07:00
a018d06955 Made curl calls less verbose 2024-09-18 18:45:41 -07:00
0ea7a9251f Restructured DWL startup files 2024-09-18 18:44:47 -07:00
d9cca35b59 Fix for Debian release 2024-04-07 13:19:33 -07:00
52e892a323 Miscellaneous DWL and Update changes 2024-04-07 13:07:53 -07:00
5e56166650 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2024-03-30 14:29:26 -07:00
4225603852 New init.lua for root 2024-03-30 14:28:41 -07:00
6e4ee2efd2 Nvim and bashrc update 2024-03-30 14:28:12 -07:00
52d9a2773d DWL startup scripting cleanup 2024-03-24 12:37:05 -07:00
464d2a6a25 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2023-12-25 11:38:04 -08:00
00c69cb17c Added script to handle button actions 2023-12-25 11:35:15 -08:00
70c89479ad Using Pipewire/Wireplumber for volume info 2023-12-25 11:33:35 -08:00
1502bfe4b0 Added telescope configuration 2023-12-25 11:33:13 -08:00
ab53be3749 Pipewire support 2023-12-25 11:31:27 -08:00
c9e3e7ae53 Support for updated somebar
Better logging
2023-12-25 11:30:33 -08:00
4fd1cc8d31 Excluding gitsigns config
Need to address some error with luv callbacks
2023-09-10 17:11:35 -07:00
aa98527ae6 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2023-09-10 17:10:27 -07:00
8deae594e4 Added telescope to lazy init.lua 2023-09-10 17:09:17 -07:00
ccf2897cb8 Neovide settings 2023-08-27 11:40:10 -07:00
7e3c5f1a73 Conflict resolution 2023-08-27 11:39:03 -07:00
48cce9e0c4 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2023-08-26 20:58:00 -07:00
6739e1e280 General updates 2023-08-26 20:54:52 -07:00
c014c60534 Tmux and bash alias updates 2023-08-26 20:43:35 -07:00
09856a3d9f Added onedark in Lazy init.lua 2023-08-26 20:39:29 -07:00
Mahesh Asolkar
1b6e7bb311 New file: Lazy init.lua 2023-08-26 19:19:24 -07:00
Mahesh Asolkar
b280ce46ba vimrc and tmux conf updates 2023-08-26 19:19:05 -07:00
b71231d96f Use USCS units for wttr.in 2023-07-23 16:53:06 -07:00
120560ddc5 Updated randr for DELL 1920x1200 monitor 2023-04-26 20:50:15 -07:00
e4eb211aaa Added neovim init lua file 2023-03-19 13:03:16 -07:00
d4778fad0f Somebar related setup updates 2023-03-19 13:02:51 -07:00
a530048c76 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2022-11-06 18:12:41 -08:00
825ef53255 DWL and vim updates 2022-11-06 18:07:44 -08:00
1a9a8f748f Fullscreen handling on MacOS 2022-09-25 09:49:52 -07:00
c14d5d1710 Added wezterm.lua for Mac 2022-08-03 10:39:55 -07:00
fdbfba1e93 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2022-03-27 12:30:27 -07:00
59a0f3c075 DWL: Support for somebar 2022-02-12 16:09:24 -08:00
cc578dd0e8 Font updates 2022-02-05 14:16:45 -08:00
332576ccfb Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2021-12-28 18:39:20 -08:00
d5fd6d3567 Vim Plug, not vundle 2021-12-28 18:38:57 -08:00
5072042a0f Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2021-12-20 14:47:45 -08:00
ebd4c493c7 Added ligature prints 2021-12-20 14:46:29 -08:00
6de1ddf4a8 DWL updates
* Added support for displaying unoccupied tags
* DWL log file writing
* Added support for locking screan after 10 min idle
2021-12-20 14:45:53 -08:00
ae5df119bf Nvim support 2021-11-13 23:38:31 -08:00
9df4b326ae Added ligatures to colors.sh 2021-11-13 23:37:34 -08:00
a9df8abf10 Using %h for home directory 2021-06-13 18:32:15 -07:00
5c49226514 Multiple display setup 2021-06-13 18:19:49 -07:00
d89f1eb34b Multi monitor support in DWL 2021-05-31 22:23:35 -07:00
b84e9ff6ee DWL: Both bars on top 2021-05-30 18:37:37 -07:00
7301a83a83 Rename DWL starter 2021-05-29 16:43:47 -07:00
381321a9d9 Import XDG env variables into DWL service 2021-05-29 16:43:05 -07:00
0e7225343f DWL clean up 2021-05-29 16:08:06 -07:00
f395651a46 DWL environment updates 2021-05-29 15:40:00 -07:00
3adcb1e58b Support for multiple instances of DWL 2021-05-25 22:43:12 -07:00
b794ef8737 DWL launching with systemd and setup changes 2021-05-25 22:23:50 -07:00
d2386bca8d Changes for DWL on Arch 2021-05-16 11:31:19 -07:00
bd28feb6b8 Nvim support changes 2021-04-10 20:07:26 -07:00
f21157994c Conkyrc and Conky based dwm_status 2021-03-08 19:19:16 -08:00
b9e63735a3 Better commands for battery and network 2021-01-22 20:14:40 -08:00
0c694f8b09 Session leave and tmux conf changes 2020-12-24 22:05:18 -08:00
7ad96623fe Added xsession and tmux_status files 2020-12-24 22:00:28 -08:00
2f0e1af64b Use hybrid suspend 2020-09-13 10:24:03 -07:00
6cff06e8c1 Dotfile updates 2020-09-06 19:22:55 -07:00
c4af834b4b Added uptodate function in root.bashrc 2020-04-19 13:19:47 -07:00
94e65ed548 Fixed nerdtree path after Plug 2020-02-09 12:06:08 -08:00
e8db3352ac Updated colors 2020-01-18 16:35:51 -08:00
Mahesh Asolkar
20eb4e54d8 Added clipboard integration 2019-12-26 13:59:23 -08:00
Mahesh Asolkar
effa93526f Moving from Vundle to vim-plug 2019-12-26 13:59:01 -08:00
0a3753f35b Vimrc changes 2019-12-10 20:35:42 -08:00
480f7c5925 Bash and tmux updates 2019-11-18 07:31:43 -08:00
acc32f7bfd New color = deus 2019-11-13 21:46:21 -08:00
0a4f30a4f5 Terminal overrides for tmux 2019-11-13 20:57:09 -08:00
4b14f3f50a Cursor shape in tmux/terminal 2019-11-10 22:17:16 -08:00
8f02d25ab0 Misc Tmux/Vim config updates 2019-11-10 13:05:25 -08:00
547540dfe6 Added fontsize plugin
* Changed nerd-tree key binding from C-e to C-t to not conflict with
  scrolling keys
* Changed firefox key binding from C-S-w to C-S-f to avoid stacking
  enabling
2019-10-06 11:46:07 -07:00
83d2f034bf Source bash completion for git prompt 2019-08-22 22:37:36 -07:00
4f3ba44634 Tmux config 2019-08-16 20:11:59 -07:00
47f34ca29f Bash files 2019-08-16 20:06:22 -07:00
f2602d913b Added dwm helpers for laptop computers 2019-05-04 20:18:08 -07:00
b3c4b69d29 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2019-04-27 18:08:46 -07:00
d5fc9dacf2 Added i3 and i3blocks config 2019-04-27 18:08:02 -07:00
Mahesh Asolkar
f33c669bc1 vimrc updates 2019-04-22 16:58:36 -07:00
74dfd52460 Added xbindkeysrc for Apple Mouse/Keyboard 2019-04-21 22:15:30 -07:00
4ff1489b0b Added a script to show terminal colors
Aids in setting up colors in your setup
2019-04-21 20:02:30 -07:00
f0e2f21251 Merge branch 'master' of https://git.heshapps.com/asolkar/snips 2019-02-13 21:59:09 -08:00
1c478c51a3 Git signify and other changes 2019-02-13 21:53:34 -08:00
35 changed files with 2771 additions and 74 deletions

58
colors.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
for fgbg in 38 48 ; do # Foreground / Background
for color in {0..255} ; do # Colors
# Display the color
printf "\e[${fgbg};5;%sm %3s \e[0m" $color $color
# Display 6 colors per lines
if [ $((($color + 1) % 6)) == 4 ] ; then
echo # New line
fi
done
echo # New line
done
echo -e "Powerline glyphs:\n\
Code points Glyphe Description Old code point
U+E0A0 \xee\x82\xa0 Version control branch (U+2B60 \xe2\xad\xa0 )\n\
U+E0A1 \xee\x82\xa1 LN (line) symbol (U+2B61 \xe2\xad\xa1 )\n\
U+E0A2 \xee\x82\xa2 Closed padlock (U+2B64 \xe2\xad\xa4 )\n\
U+E0B0 \xee\x82\xb0 Rightwards black arrowhead (U+2B80 \xe2\xae\x80 )\n\
U+E0B1 \xee\x82\xb1 Rightwards arrowhead (U+2B81 \xe2\xae\x81 )\n\
U+E0B2 \xee\x82\xb2 Leftwards black arrowhead (U+2B82 \xe2\xae\x82 )\n\
U+E0B3 \xee\x82\xb3 Leftwards arrowhead (U+2B83 \xe2\xae\x83 )\n\
"
echo -e "Ligature support:\n\
-> -----> ----------> <---------- <----- <-\n\
=> =====> ==========> <========== <===== <=\n\
+++++\n\
>= <= !=\n\
"
echo -e "Default \e[39mDefault\e[0m"
echo -e "Default \e[30mBlack\e[0m"
echo -e "Default \e[31mRed\e[0m"
echo -e "Default \e[32mGreen\e[0m"
echo -e "Default \e[33mYellow\e[0m"
echo -e "Default \e[34mBlue\e[0m"
echo -e "Default \e[35mMagenta\e[0m"
echo -e "Default \e[36mCyan\e[0m"
echo -e "Default \e[37mLight gray\e[0m"
echo -e "Default \e[90mDark gray\e[0m"
echo -e "Default \e[91mLight red\e[0m"
echo -e "Default \e[92mLight green\e[0m"
echo -e "Default \e[93mLight yellow\e[0m"
echo -e "Default \e[94mLight blue\e[0m"
echo -e "Default \e[95mLight magenta\e[0m"
echo -e "Default \e[96mLight cyan\e[0m"
echo -e "Default \e[97mWhite\e[0m"
exit 0

39
dwl.entourage Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
function log_this() {
TSTMP=$(date)
echo "$TSTMP : " $1 >> $DWL_LOG_FILE
}
log_this "Entourage: $XDG_RUNTIME_DIR"
# ----------------------------------------------------------
# Let DWL start
# ----------------------------------------------------------
while [ ! -e "$XDG_RUNTIME_DIR/wayland-0.lock" ]
do
log_this "DWL getting ready..."
sleep 1
done
log_this "DWL ready!"
# ----------------------------------------------------------
# Background and support tasks
# ----------------------------------------------------------
# TODO: Consuimng too much CPU - keeps fan spinning
# source ~/bin/dwl.wallpaper_setup
log_this "Entourage: Starting screen locker with 10min idle time"
source ~/bin/dwl.idle_setup
log_this "Entourage: Configuring $(wlr-randr | grep -E "^\w+" | wc -l) displays"
source ~/bin/dwl.randr_setup
log_this "Entourage: Setting up notification"
source ~/bin/dwl.notification_setup
log_this "Entourage: Setting up MPD support"
source ~/bin/dwl.mpd_support_setup
log_this "Entourage: Starting somebar using $SOMEBAR_FIFO"
source ~/bin/dwl.bar_setup

47
dwl.service Normal file
View File

@@ -0,0 +1,47 @@
# Systemd service to start DWL
# ----------------------------------------------------------
#
# Symlink this file in following directory as follows:
#
# $ cd ~/.config/systemd/user
# $ ln -s <snips>/dwl.service dwl@.service
#
# Be sure to link it as a named service with (@.service)
#
# Start this service with something like this:
#
# #!/usr/bin/env bash
#
# # Start DWL
# RUNTIME_DIR=$(mktemp --directory --suffix=.${USER})
#
# # Escape slashes in the path
# SNAME=$(systemd-escape ${RUNTIME_DIR}.service)
#
# # Start service blocking. Remove runtime directory upon completion.
# # Be sure to import XDG session variables for graphical-session to work
# systemctl --user import-environment XDG_SEAT && \
# systemctl --user import-environment XDG_SESSION_TYPE && \
# systemctl --user import-environment XDG_SESSION_CLASS && \
# systemctl --user import-environment XDG_VTNR && \
# systemctl --user import-environment XDG_SESSION_ID && \
# systemctl --wait --user start dwl@${SNAME} && \
# rm -rf ${RUNTIME_DIR}
[Unit]
Description=DWL session service
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
[Service]
Type=oneshot
Environment=XDG_RUNTIME_DIR=%I
Environment=DWL_TAGS_FILE=%I/dwl.tags
Environment=DWL_LOG_FILE=%I/dwl.log
Environment=DWLTAGS_FMT=DZEN
Environment=XDG_CURRENT_DESKTOP=DWL
Environment=PIPEWIRE_RUNTIME_DIR=/run/user/501
ExecStart=%h/bin/dwl.session
Restart=on-failure
RestartSec=1
TimeoutStopSec=10

20
dwl.session Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
echo $XDG_RUNTIME_DIR used for Wayland session
export WLR_LIBINPUT_NO_DEVICES=1
export DWL_PATH=/usr/local/bin
# export DWL_PATH=/home/mahesh/git/furnish/heshapps_dwl
export DWL_BAR_PATH=/usr/local/bin
# export DWL_BAR_PATH=/home/mahesh/git/somebar_20240217/build
export DWL_BAR=$DWL_BAR_PATH/somebar
export SOMEBAR_FIFO=$XDG_RUNTIME_DIR/somebar.fifo
# export DWLTAGS_SHOW_MON=1
export PATH=~/bin:$PATH
# export DWL_LOG_VERBOSE=1
echo "Session: in $XDG_RUNTIME_DIR" >> $DWL_LOG_FILE
env
exec $DWL_PATH/dwl -s $HOME/bin/dwl.entourage

17
dwl.start Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Start DWL
RUNTIME_DIR=$(mktemp --directory --suffix=.${USER})
# Escape slashes in the path
SNAME=$(systemd-escape ${RUNTIME_DIR}.service)
# Start service blocking. Remove runtime directory upon completion.
# Be sure to import XDG session variables for graphical-session to work
systemctl --user import-environment XDG_SEAT && \
systemctl --user import-environment XDG_SESSION_TYPE && \
systemctl --user import-environment XDG_SESSION_CLASS && \
systemctl --user import-environment XDG_VTNR && \
systemctl --user import-environment XDG_SESSION_ID && \
systemctl --wait --user start dwl@${SNAME} && \
rm -rf ${RUNTIME_DIR}

16
dwl.switch_context Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
function log_this() {
TSTMP=$(date)
echo "$TSTMP : " $1 >> $DWL_LOG_FILE
}
# ----------------------------------------------------------
# Let DWL start
# ----------------------------------------------------------
log_this "Switch Context: Configuring $(wlr-randr | grep -E "^\w+" | wc -l) displays"
source ~/bin/dwl.randr_setup
log_this "Switch Context: Starting somebar using $SOMEBAR_FIFO"
source ~/bin/dwl.bar_setup

89
dwl_act Executable file
View File

@@ -0,0 +1,89 @@
#!/usr/bin/env bash
act=$1
timestamp=$(date)
echo "$0 - $timestamp - $act" >> ~/dwl_key_act.log
# In Wayland, use the following like X11's xev:
#
# % wev | grep "sym"
#
case $act in
# Without modifier
vol_mute) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle;;
vol_lower) wpctl set-volume --limit 1.0 @DEFAULT_AUDIO_SINK@ 10%-;;
vol_raise) wpctl set-volume --limit 1.0 @DEFAULT_AUDIO_SINK@ 10%+;;
mic_mute) rofi -show sound -modes "sound:~/bin/rofi_sound.pl";;
bright_low) echo 20 >> /sys/class/backlight/intel_backlight/brightness;;
bright_high) echo 200 >> /sys/class/backlight/intel_backlight/brightness;;
media_toggle) mpc toggle;; # XF86AudioPlay
media_stop) mpc stop;; # XF86AudioStop
media_prev) mpc prev;; # XF86AudioPrev
media_next) mpc next;; # XF86AudioNext
disp) /home/mahesh/bin/switch_context.sh;;
# wlan) ;;
# tools) ;;
# search) ;;
launch) wldash;;
# explore) ;;
print) grim -c -g "$(slurp -o -r -c '#ff0000ff')" -t ppm - | satty --filename - --fullscreen --output-filename ~/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png ;;
# With CTRL modifier
# C_vol_mute) ;;
# C_vol_lower) ;;
# C_vol_raise) ;;
# C_mic_mute) ;;
# C_bright_low) ;;
# C_bright_high) ;;
# C_media_toggle) ;;
# C_media_stop) ;;
# C_media_prev) ;;
# C_media_next) ;;
# C_disp) ;;
# C_wlan) ;;
# C_tools) ;;
# C_search) ;;
# C_launch) ;;
# C_explore) ;;
C_print) grim -c -g "$(slurp -d -c '#0000ffff')" -t ppm - | satty --filename - --fullscreen --output-filename ~/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png ;;
# With SHIFT modifier
# S_vol_mute) ;;
# S_vol_lower) ;;
# S_vol_raise) ;;
# S_mic_mute) ;;
# S_bright_low) ;;
# S_bright_high) ;;
# S_media_toggle) ;;
# S_media_stop) ;;
# S_media_prev) ;;
# S_media_next) ;;
# S_disp) ;;
# S_wlan) ;;
# S_tools) ;;
# S_search) ;;
# S_launch) ;;
# S_explore) ;;
# S_print) ;;
# With SHIFT+CTRL modifiers
# SC_vol_mute) ;;
# SC_vol_lower) ;;
# SC_vol_raise) ;;
# SC_mic_mute) ;;
# SC_bright_low) ;;
# SC_bright_high) ;;
# SC_media_toggle) ;;
# SC_media_stop) ;;
# SC_media_prev) ;;
# SC_media_next) ;;
# SC_disp) ;;
# SC_wlan) ;;
# SC_tools) ;;
# SC_search) ;;
# SC_launch) ;;
*) echo "Unknown action '$act'";;
esac

View File

@@ -0,0 +1,9 @@
killall conky
killall somebar
mkfifo $SOMEBAR_FIFO -m666
conky -c ~/.conkyrc > $SOMEBAR_FIFO &
$DWL_BAR -s $SOMEBAR_FIFO > $XDG_RUNTIME_DIR/somebar.log 2>&1

View File

@@ -0,0 +1,3 @@
swayidle -w \
timeout 6000 'systemctl hybrid-sleep' &

View File

@@ -0,0 +1,2 @@
musnify-mpd -h localhost -p 6600 &

View File

@@ -0,0 +1,9 @@
# mako --font "Iosevka Term" \
# --background-color "#777777AA" \
# --text-color "#EEEEEE" \
# --border-color "#777777AA" \
# --border-radius 5 \
# --default-timeout 5000 &
swaync &

View File

@@ -0,0 +1,3 @@
cmd=$(get_randr.pl)
$cmd

View File

@@ -0,0 +1,3 @@
swaybg --mode fill --image ~/.config/wallpaper.jpg &

155
dwltags.pl Executable file
View File

@@ -0,0 +1,155 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Term::ANSIColor;
use FileHandle;
use Getopt::Long;
my $info = {};
my $tags_file = $ENV{'DWL_TAGS_FILE'};
my $dwl_log_h = FileHandle->new(">> " . $ENV{'DWL_LOG_FILE'});
die "Could not open $ENV{'DWL_LOG_FILE'} to append" unless (defined $dwl_log_h);
$dwl_log_h->autoflush();
my @mons = map { /^([\w-]+)/; $1 } grep { /^([\w-]+)/ } `wlr-randr`;
GetOptions("file=s" => \$tags_file)
or die("Command line usage error");
# Color scheme is only used in ANSI mode
# <class>_f/_g: class is used in JSON mode to be used in style.css for styling
my $colorscheme = {
'occ_f' => '#ffffff',
'occ_b' => '#111111',
'occsel_f' => '#ffffff',
'occsel_b' => '#aa4444',
'unocc_f' => '#ffffff',
'unocc_b' => '#888888',
'unoccsel_f' => '#ffffff',
'unoccsel_b' => '#aa8888',
'mon_f' => '#000000',
'mon_b' => '#777777',
'lay_f' => '#111111',
'lay_b' => '#77aaaa',
'title_f' => '#ffcccc',
'title_b' => '#111111'
# 'occ_f' => 'white',
# 'occ_b' => 'black',
# 'sel_f' => 'black',
# 'sel_b' => 'red',
# 'mon_f' => 'black',
# 'mon_b' => 'grey23',
# 'lay_f' => 'black',
# 'lay_b' => 'cyan',
# 'title_f' => 'red',
# 'title_b' => 'black'
};
print_log("DWLTAGS: $tags_file");
for my $mon (@mons) {
print_tags({
'selmon' => '1',
'mon' => $mon,
'tags' => '0 1',
'title' => '',
'layout' => '[]='
}, $tags_file . "." . $mon);
}
while (<>) {
my $line = $_;
chomp $line;
print STDOUT "$_";
if (exists $ENV{'DWL_LOG_VERBOSE'}) {
print_log("DWLTAGS [VV] : $line");
}
if (my ($mon, $key, $val) = $line =~ /^(\S+)\s+(\S+)\s(.*)$/) {
$info->{$key} = $val;
if ($key eq "layout") {
# Commit a status
# Assumption: layout is the last piece of information dumped by DWL
$info->{'mon'} = $mon;
print_tags($info, $tags_file.".".$mon);
$info = {};
}
} else {
print_log("DWL: Printed out of format - $line");
}
}
sub print_tags {
my ($info, $tags_file) = @_;
my $numtags = 10;
return if ($info->{'selmon'} ne "1");
if (my ($tuse, $tsel) = $info->{'tags'} =~ /(\d+)\s+(\d+)/) {
my $tags = "";
for (my $i = 0; $i < ($numtags-1); $i++) {
my $sel = "unocc";
if (($tuse & (1 << $i))) {
$sel = "occ";
}
if ($tsel & (1 << $i)) {
$sel .= "sel";
}
$tags .= getformatted($sel, " ". ($i+1) . " ");
}
if (exists $ENV{'DWLTAGS_SHOW_MON'}) {
$tags .= getformatted("mon", " $info->{'mon'} ");
}
$tags .= getformatted("lay", " $info->{'layout'} ");
$tags .= getformatted("title", " $info->{'title'} ");
my $fh = FileHandle->new("> " . $tags_file);
if (defined $fh) {
print $fh $tags . "\n";
$fh->close;
}
} else {
print_log("DWL: Printed out of format - tags");
}
}
sub getformatted {
my ($c, $txt) = @_;
if ((exists $ENV{'DWLTAGS_FMT'}) && ($ENV{'DWLTAGS_FMT'} eq "DZEN")) {
return dzen_colored($c, $txt);
} elsif ((exists $ENV{'DWLTAGS_FMT'}) && ($ENV{'DWLTAGS_FMT'} eq "ANSI")) {
return colored([$colorscheme->{$c . '_f'} . " on_" . $colorscheme->{$c . '_b'}], $txt);
} elsif ((exists $ENV{'DWLTAGS_FMT'}) && ($ENV{'DWLTAGS_FMT'} eq "JSON")) {
return '{"text": "' . $txt . '", "class": "dwltags-' . $c . '"}';
} else {
if ($c eq "sel") {
$txt =~ s/\s+//g;
$txt = "[$txt]";
}
return $txt;
}
}
sub dzen_colored {
my ($class, $txt) = @_;
my $fc = $colorscheme->{$class . '_f'};
my $bc = $colorscheme->{$class . '_b'};
# return colored([$colorscheme->{$c . '_f'} . " on_" . $colorscheme->{$c . '_b'}], $txt);
return "^fg(" . $fc . ")^bg(" . $bc . ")" . $txt . "^fg()^bg()";
}
sub print_log {
my ($line) = @_;
if (defined $dwl_log_h) {
print $dwl_log_h $line . "\n";
}
}

14
dwm.xsession Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
xrdb -merge $HOME/.Xresources
# Use DWM
# while true
# do
# $HOME/bin/dwm_status
# sleep 10s
# done &
(conky -c ~/.conkyrc | while read LINE; do xsetroot -name "$LINE"; done) &
feh --bg-fill $HOME/.config/wallpaper.jpg &
picom -b -cCGf -r 5 -l -6 -t -6 -o 0.5
exec /usr/local/bin/dwm "#662211"

12
dwm_status.laptop Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
# vim: filetype=sh
VOL=$(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/')
LOCALTIME=$(date +"%Y %h %d %I:%M%p %Z")
#IP=$(for i in `ip r`; do echo $i; done | grep -A 1 src | tail -n1)
IP=$(getent ahosts google.com | head -n 1 | awk '{print $1}' | xargs ip route get | head -n 1 | awk '{print $7}')
WEATHER=$(weather fips4105192520 | grep Tempera | awk '{print $2}')
BAT=$(acpi -b | awk '{ print " " $5 }' | tr -d ',')
xsetroot -name " 🔊 $VOL | $IP | 🔋 $BAT | ${WEATHER}°F | $LOCALTIME"

59
get_neovim.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/bash
function die() {
echo "ERROR! $1" && exit 1
}
START_DIR=$(pwd)
FILE_DIR="/opt/neovim"
FILE_NAME="nvim-linux-x86_64.appimage"
FILE_URL="https://github.com/neovim/neovim/releases/download/nightly"
TMP_FILE=$(mktemp $FILE_DIR/nvim.XXXXXX.appimage)
echo "Downloading latest nightly $FILE_NAME to $TMP_FILE"
# curl -L -o $TMP_FILE $FILE_URL/$FILE_NAME || die "Can't cURL $FILE_NAME"
wget -O $TMP_FILE $FILE_URL/$FILE_NAME > /dev/null 2>&1 || die "Can't cURL $FILE_NAME"
chmod +x $TMP_FILE || die "Can't chmod $TMP_FILE"
NEWVER=$($TMP_FILE --version | head -1)
EXTVER=$(test -e $FILE_DIR/.version && cat $FILE_DIR/.version || echo "")
echo "Version check - New version ($NEWVER) =?= current ($EXTVER)"
if [ "$NEWVER" == "$EXTVER" ]; then
echo "Not updating. New version ($NEWVER) same as current ($EXTVER)"
else
if [ -e $FILE_NAME ]; then
rm $FILE_NAME || die "Can't remove $FILE_NAME"
echo "Removed $FILE_NAME"
fi
cp $TMP_FILE $FILE_DIR/$FILE_NAME || die "Can't copy $TMP_FILE to $FILE_NAME"
echo "Making $FILE_DIR/$FILE_NAME executable"
chmod +x $FILE_DIR/$FILE_NAME || die "Can't chmod $FILE_DIR/$FILE_NAME"
echo $NEWVER > $FILE_DIR/.version || die "Can't write $FILE_DIR/.version"
# Extract nvim for other (non-root) users to run
if [ -d "$FILE_DIR/squashfs-root" ]; then
rm -rf $FILE_DIR/squashfs-root || die "Can't delete $FILE_DIR/squashfs-root"
fi
cd $FILE_DIR
echo "Extracting $NEWVER"
$TMP_FILE --appimage-extract > /dev/null 2>&1 || die "Can't extract appimage $FILE_NAME"
if [ -L "$FILE_DIR/nvim" ]; then
rm $FILE_DIR/nvim || die "Can't remove $FILE_DIR/nvim"
fi
if [ -x "$FILE_DIR/squashfs-root/AppRun" ]; then
ln -s $FILE_DIR/squashfs-root/AppRun nvim
else
die "$FILE_DIR/squash-root/AppRun not executable"
fi
cd $START_DIR
echo "Version $NEWVER ready!"
fi
rm $TMP_FILE || die "Can't delete $TMP_FILE"
echo "Done with Neovim"

176
get_randr.pl Executable file
View File

@@ -0,0 +1,176 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
unless (exists $ENV{'WAYLAND_DISPLAY'}) {
die "Not running in WAYLAND";
}
my $app = {};
$app->{'displays'} = {};
$app->{'setup'} = "";
get_display_info($app);
show_debug(Data::Dumper->Dump([$app]));
my $wlr_line = get_wlr_line($app);
notify($app);
print "${wlr_line}\n";
# -----------
# Subroutines
# -----------
sub get_display_info {
my ($app) = @_;
open (my $RANDRH, "wlr-randr |") or die "Couldn't run wlr-randr";
my @lines = map { chomp(); $_ } <$RANDRH>;
close ($RANDRH);
my $state = "IDLE";
my $curr_disp = "UNDEF";
my $disp_info = {};
foreach my $ln (@lines) {
if (my ($dn, $dd) = $ln =~ /^(\S+)\s+"([^"]+)"$/) {
$state = "IN_DISP";
unless (exists $disp_info->{$dn}) {
$disp_info->{$dn} = {};
$disp_info->{$dn}->{'name'} = $dn;
$curr_disp = $dn;
$disp_info->{$dn}->{'desc'} = $dd;
}
}
if (($state eq "IN_DISP") || ($state eq "IN_MODES")) {
if (my ($k,$v) = $ln =~ /\s+(\w+)\s*:\s*(.*)?$/) {
if ($k eq "Modes") {
$state = "IN_MODES";
$disp_info->{$curr_disp}->{'modes'} = [];
} else {
$disp_info->{$curr_disp}->{$k} = $v;
$state = "IN_DISP"
}
}
}
if ($state eq "IN_MODES") {
if (my ($mode_string) = $ln =~ /\s+(.+)$/) {
# 1920x1080 px, 60.000999 Hz (preferred, current)
my ($h, $v, $f, $a) = $mode_string =~ /(\d+)x(\d+)\s*px,\s*(\S+)\s*Hz\s*\((.*)\)$/;
my $mode_info = {};
$mode_info->{'horizontal'} = $h;
$mode_info->{'vertical'} = $v;
$mode_info->{'refresh_freq'} = $f;
if (defined $a) {
$mode_info->{'attributes'} = [split (/\s*,\s*/, $a)];
if ($a =~ /current/) {
$disp_info->{$curr_disp}->{'current_mode'} = $mode_info;
}
if ($a =~ /preferred/) {
$disp_info->{$curr_disp}->{'preferred_mode'} = $mode_info;
}
}
push(@{$disp_info->{$curr_disp}->{'modes'}}, $mode_info);
}
}
# show_debug("$state: $ln");
}
$app->{'displays'} = $disp_info;
}
# -----------
sub get_wlr_line {
my ($app) = @_;
my $matching_disps;
my $wlr_line = "UNKNOWN";
my $num_disps = scalar(keys(%{$app->{'displays'}}));
if ($num_disps == 1) {
show_debug("Single display configuration");
$app->{'setup'} = "Single display configuration";
$wlr_line = "wlr-randr --output HDMI-A-1 --off --output eDP-1 --on --pos 0,0"
} elsif ($num_disps > 1) {
# Determine setup (Custom)
#
# - Den room (DELL 27" monitor on the left of laptop display)
$matching_disps = has_display_with_name($app, "DELL U27");
if (scalar (@{$matching_disps}) == 1) {
my ($h, $v) = get_display_current_dimensions($app, $matching_disps->[0]);
my $disp_name = $matching_disps->[0]->{'name'};
show_debug("Multiple display configuration: Den room");
$app->{'setup'} = "Multiple display configuration: Den room";
$wlr_line = "wlr-randr --output ${disp_name} --on --pos 0,0 --output eDP-1 --on --pos ${h},0";
}
#
# - Media room (DELL 24" monitor above laptop display)
$matching_disps = has_display_with_name($app, "DELL U24");
if (scalar (@{$matching_disps}) == 1) {
my ($h, $v) = get_display_current_dimensions($app, $matching_disps->[0]);
my $disp_name = $matching_disps->[0]->{'name'};
show_debug("Multiple display configuration: Media room");
$app->{'setup'} = "Multiple display configuration: Media room";
$wlr_line = "wlr-randr --output ${disp_name} --on --pos 0,0 --output eDP-1 --on --pos 0,${v}";
}
} else {
show_debug("No displays?!");
}
# Adjust scale on Apple pane. Assumes that above lines always put eDP-1 as the last display
$matching_disps = has_display_with_name($app, "Apple Computer");
if (scalar (@{$matching_disps}) == 1) {
show_debug("Scaling Apple MacBook Pro display");
$wlr_line .= " --scale 1.5";
}
return $wlr_line;
}
# -----------
sub has_display_with_name {
my ($app, $name) = @_;
my $found = [];
foreach my $k (keys %{$app->{'displays'}}) {
if ($app->{'displays'}->{$k}->{'desc'} =~ /$name/) {
push(@{$found}, $app->{'displays'}->{$k});
}
}
return $found;
}
# -----------
sub get_display_current_dimensions {
my ($app, $disp) = @_;
return ($disp->{'current_mode'}->{'horizontal'}, $disp->{'current_mode'}->{'vertical'});
}
# -----------
sub notify {
my ($app) = @_;
system("notify-send",
"--app-name=get_randr.pl",
"--icon=/usr/share/icons/Adwaita/scalable/devices/video-display.svg",
"--expire-time=5000",
"Display Configuration Changed", "Now set to - $app->{'setup'}");
}
# -----------
sub show_debug {
my ($str) = @_;
# UNCOMMENT TO DEBUG # print "[DEBUG] $str\n";
}

59
get_wezterm.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/bash
function die() {
echo "ERROR! $1" && exit 1
}
START_DIR=$(pwd)
FILE_DIR="/opt/wezterm"
FILE_NAME="WezTerm-nightly-Ubuntu20.04.AppImage"
FILE_URL="https://github.com/wez/wezterm/releases/download/nightly"
TMP_FILE=$(mktemp $FILE_DIR/wezterm.XXXXXX.appimage)
echo "Downloading latest nightly $FILE_NAME to $TMP_FILE"
# curl -L -o $TMP_FILE $FILE_URL/$FILE_NAME || die "Can't cURL $FILE_NAME"
wget -O $TMP_FILE $FILE_URL/$FILE_NAME > /dev/null 2>&1 || die "Can't cURL $FILE_NAME"
chmod +x $TMP_FILE || die "Can't chmod $TMP_FILE"
NEWVER=$($TMP_FILE --version | head -1)
EXTVER=$(test -e $FILE_DIR/.version && cat $FILE_DIR/.version || echo "")
echo "Version check - New version ($NEWVER) =?= current ($EXTVER)"
if [ "$NEWVER" == "$EXTVER" ]; then
echo "Not updating. New version ($NEWVER) same as current ($EXTVER)"
else
if [ -e $FILE_NAME ]; then
rm $FILE_NAME || die "Can't remove $FILE_NAME"
echo "Removed $FILE_NAME"
fi
cp $TMP_FILE $FILE_DIR/$FILE_NAME || die "Can't copy $TMP_FILE to $FILE_NAME"
echo "Making $FILE_DIR/$FILE_NAME executable"
chmod +x $FILE_DIR/$FILE_NAME || die "Can't chmod $FILE_DIR/$FILE_NAME"
echo $NEWVER > $FILE_DIR/.version || die "Can't write $FILE_DIR/.version"
# Extract wezterm for other (non-root) users to run
if [ -d "$FILE_DIR/squashfs-root" ]; then
rm -rf $FILE_DIR/squashfs-root || die "Can't delete $FILE_DIR/squashfs-root"
fi
cd $FILE_DIR
echo "Extracting $NEWVER"
$TMP_FILE --appimage-extract > /dev/null 2>&1 || die "Can't extract appimage $FILE_NAME"
if [ -L "$FILE_DIR/wezterm" ]; then
rm $FILE_DIR/wezterm || die "Can't remove $FILE_DIR/wezterm"
fi
if [ -x "$FILE_DIR/squashfs-root/AppRun" ]; then
ln -s $FILE_DIR/squashfs-root/AppRun wezterm
else
die "$FILE_DIR/squash-root/AppRun not executable"
fi
cd $START_DIR
echo "Version $NEWVER ready!"
fi
rm $TMP_FILE || die "Can't delete $TMP_FILE"
echo "Done with Wezterm"

23
ghostty.config Normal file
View File

@@ -0,0 +1,23 @@
# Ghostty configuration
# ---------------------
# Font
font-family = Iosevka Term
font-size = 15
# Theme
# theme = MaterialOcean
theme = 0x96f
# Cursor
cursor-color = #aa2222
cursor-opacity = 0.8
cursor-style = block
cursor-style-blink = false
shell-integration-features = no-cursor
# Window
window-decoration = false
window-padding-x = 5
window-padding-y = 5
window-padding-balance = true

139
i3blocks.conf Normal file
View File

@@ -0,0 +1,139 @@
# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
#
# List of valid properties:
#
# align
# color
# command
# full_text
# instance
# interval
# label
# min_width
# name
# separator
# separator_block_width
# short_text
# signal
# urgent
# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
command=/usr/share/i3blocks/$BLOCK_NAME
separator_block_width=15
markup=none
# Key indicators
#
# Add the following bindings to i3 config file:
#
# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
[keyindicator]
instance=CAPS
interval=once
signal=11
separator=false
[keyindicator]
instance=NUM
interval=once
signal=11
separator=false
# Volume indicator
#
# The first parameter sets the step (and units to display)
# The second parameter overrides the mixer selection
# See the script for details.
[volume]
# label=VOL
label=♬
instance=Master
#instance=PCM
interval=1
signal=10
# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
# label=MEM
label=⛃
separator=false
interval=30
[memory]
label=♺
instance=swap
separator=false
interval=30
# Disk usage
#
# The directory defaults to $HOME if the instance is not specified.
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
[disk]
label=⛺
#instance=/mnt/data
interval=30
# Network interface monitoring
#
# If the instance is not specified, use the interface used for default route.
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
[iface]
label=⛜
instance=enp2s0
color=#00FF00
interval=10
# [bandwidth]
# label=B
# instance=enp2s0
# interval=5
# CPU usage
#
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
[cpu_usage]
label=⚅
interval=10
min_width=U:100.00%
#separator=false
# Date Time
[time]
command=date '+%a %d %h %Y %r'
interval=5
# Generic media player support
#
# This displays "ARTIST - SONG" if a music is playing.
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
#[mediaplayer]
#instance=spotify
#interval=5
#signal=10
# OpenVPN support
#
# Support multiple VPN, with colors.
#[openvpn]
#interval=20
# Temperature
#
# Support multiple chips, though lm-sensors.
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
#[temperature]
#label=TEMP
#interval=10

222
i3config Normal file
View File

@@ -0,0 +1,222 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:Iosevka Term Regular 10
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
# bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec /home/mahesh/apps/install/bin/st
# bindsym $mod+Return exec urxvt
bindsym $mod+Shift+Return exec gvim
bindsym $mod+Shift+f exec /opt/nightly/firefox/firefox
# kill focused window
bindsym $mod+Shift+q kill
# Launch dmenu for suspend/reboot/shutdown options
bindsym $mod+Control+l exec /home/mahesh/bin/leave_session.sh
# start dmenu (a program launcher)
# bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+semicolon split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "Research"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "Media"
set $ws9 "Tenor"
set $ws10 "Root"
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressting left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym j resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position top
# status_command i3status
status_command i3blocks
# tray_output primary
}
# exec_always --no-startup-id $HOME/.config/polybar/launch.sh
#
# Additional configuration
#
for_window [class="^.*"] border pixel 0
# smart_borders on
#
# Gaps
#
gaps inner 5
gaps outer 10
gaps horizontal 5
gaps vertical 5
gaps top 10
gaps right 10
gaps bottom 10
gaps left 10
#
# Border colors
#
# class border backgr. text indicator child_border
# client.focused #6f9abb #285577 #ffffff #2e9ef4
# client.focused_inactive #333333 #5f676a #ffffff #484e50
# client.unfocused #333333 #222222 #888888 #292d2e
# client.urgent #2f343a #900000 #ffffff #900000
client.focused #6f9abb #285577 #ffffff #2e9ef4 #2e9ef4
client.focused_inactive #333333 #5f676a #ffffff #484e50 #484e50
client.unfocused #333333 #222222 #888888 #292d2e #292d2e
client.urgent #2f343a #900000 #ffffff #900000 #900000
# Wallpaper
exec_always --no-startup-id feh --bg-fill $HOME/.config/i3/wallpaper.jpg
#output "*" background $HOME/.config/i3/wallpaper.jpg fill
# Compositor
exec_always --no-startup-id compton -b
# Key bindings
exec_always --no-startup-id xbindkeys

47
leave_session.laptop.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
#
# For this to work, something along the following lines needs to be
# in a file in /etc/sudoers.d/. The file must have 0440 permissions
#
# username ALL=(ALL:ALL) NOPASSWD:/usr/sbin/pm-suspend,/usr/sbin/pm-hibernate,/sbin/reboot,/sbin/shutdown
#
if [[ -v WAYLAND_DISPLAY ]]; then
DMCMD='wofi -d -p'
else
DMCMD='dmenu -p'
fi
confirm() {
ans=$(echo -e "Yes\nNo" | $DMCMD "$1 - Confirm?")
echo $ans
if [ "$ans" = "Yes" ]; then
echo "Leaving..."
else
echo "Abort!"
exit 1
fi
}
cmd=$(echo -e "hibernate\nsuspend\nreboot\nshutdown" | $DMCMD "Leave session:")
echo $cmd
case "$cmd" in
suspend)
confirm "Suspend"
sudo /usr/sbin/pm-suspend-hybrid
;;
hibernate)
confirm "Hibernate"
sudo /usr/sbin/pm-hibernate
;;
reboot)
confirm "Reboot"
sudo /sbin/reboot
;;
shutdown)
confirm "Shutdown"
sudo /sbin/shutdown
;;
esac

View File

@@ -2,7 +2,7 @@
" Vim customization and package management
"
" This uses Vundle for package management, so Vundle is installed on the first
" This uses Vim Plug for package management, so Vim Plug is installed on the first
" run.
"
" Run the following to install plugins:
@@ -10,13 +10,21 @@
" * Launch vim and run :PluginInstall
" * To install from command line: vim +PluginInstall +qall
" Vundle Installation {{{
" Bootstrap Vundle if it's not installed
if empty(system("grep lazy_load ~/.vim/bundle/Vundle.vim/autoload/vundle.vim"))
silent !mkdir -p ~/.vim/bundle
silent !rm -rf ~/.vim/bundle/Vundle.vim
silent !git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
endif
" Plug Installation {{{
" Bootstrap Plug if it's not installed
if has("nvim")
if empty(glob("~/.config/nvim/autoload/plug.vim"))
echo "No vim-plug, getting it ..."
execute '!curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echo "Getting vim-plug ... done"
endif
else
if empty(glob("~/.vim/autoload/plug.vim"))
echo "No vim-plug, getting it ..."
execute '!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echo "Getting vim-plug ... done"
endif
endif
" }}}
" Base settings {{{
@@ -27,44 +35,54 @@
set mouse=a
set mousehide
scriptencoding utf-8
set encoding=utf-8
let g:airline_powerline_fonts=1
let mapleader=","
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_enable_on_vim_startup=0
let g:indent_guides_start_level=2
let g:indent_guides_guide_size=1
let g:indent_guides_soft_pattern = ' '
" }}}
" Vundle setup - Preamble {{{
" Vim Plug setup - Preamble {{{
set runtimepath+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
call plug#begin()
" }}}
" Vundle setup - Packages {{{
" Vim Plug setup - Packages {{{
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'spf13/vim-colors'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat'
Plugin 'jiangmiao/auto-pairs'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'Shougo/denite.nvim'
Plugin 'pR0Ps/molokai-dark'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'luochen1990/rainbow'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify'
Plug 'tmhedberg/matchit'
Plug 'spf13/vim-colors'
Plug 'romainl/vim-cool'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'drmikehenry/vim-fontsize'
Plug 'jiangmiao/auto-pairs'
Plug 'mg979/vim-visual-multi'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"Plug 'roxma/vim-hug-neovim-rpc'
"Plug 'roxma/nvim-yarp'
"Plug 'Shougo/denite.nvim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'asolkar/vim-color-molokini'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'luochen1990/rainbow'
Plug 'https://gitlab.devtools.intel.com/masolkar/vim-iosf.git' " intel
Plug 'vhda/verilog_systemverilog.vim'
Plug 'nanotech/jellybeans.vim'
" }}}
" Vundle - Closing {{{
" Vim Plug - Closing {{{
call vundle#end() " required
filetype plugin indent on " required
call plug#end()
" }}}
@@ -73,47 +91,61 @@
" Base customization {{{
if has("gui_running")
if has("mac")
set guifont=Iosevka:h13
elseif has("win32")
set guifont=Iosevka\ Term\ Regular\ 13
if has("nvim")
else
set guifont=Iosevka\ Term\ Regular\ 12
if has("mac")
set guifont=Iosevka-Term:h20
elseif has("win32")
set guifont=Iosevka\ Term\ Regular\ 15
else
set guifont=Iosevka\ Term\ Regular\ 13.5
end
end
set columns=120 lines=54
hi Search guifg=black guibg=yellow
hi Cursor guifg=white guibg=maroon
" Hide/Show menu and tool bar
" Hide/Show menu and tool bar
function! ToggleGUICruft()
if &guioptions=='i'
exec('set guioptions=imTrL')
if &guioptions=='iaA'
exec('set guioptions=imTrLaA')
else
exec('set guioptions=i')
exec('set guioptions=iaA')
endif
endfunction
map <F11> <Esc>:call ToggleGUICruft()<cr>
" By default, hide gui menus
set guioptions=i
" GUI default:
" - 'i' : Hide gui menus
" - 'aA' : Modal and modeless autoselect copy to yank buffer
set guioptions=iaA
else
set background=dark
if has('vcon')
set termguicolors
endif
endif
colorscheme molokai-dark
" check to make sure vim has been compiled with colorcolumn support
" before enabling it
if exists("+colorcolumn")
set colorcolumn=120
endif
"let g:molokini_gui_italic = 0
colorscheme molokini
set norelativenumber
set number
set visualbell t_vb=
set cindent
set noautoindent
set tabstop=2
set shiftwidth=2
set scrolloff=10
set tabstop=4
set softtabstop=4
set shiftwidth=4
set cmdheight=2
set scrolloff=5
set expandtab
set showmatch
set cursorline
@@ -129,19 +161,16 @@
set ruler
set hid
set viminfo='20,\"50
set backspace=2 whichwrap+=<,>,h,l
set cmdheight=2
set smartcase
set magic
set showmode
let g:spf13_no_autochdir=1
set backspace=indent,eol,start
set autochdir
set list
set listchars=tab:\ ,trail:,extends:#,nbsp:. " Highlight problematic whitespace
set listchars=tab:\ ,trail:,extends:#,nbsp:. " Highlight problematic whitespace
" Directories {{{
set backup " backups are nice ...
set backupdir=$HOME/.vimbackup// " but not when they clog .
set directory=$HOME/.vimswap// " Same for swap files
@@ -153,48 +182,63 @@
silent execute '!mkdir -p $HOME/.vimviews'
au BufWinLeave \* silent! mkview "make vim save view (state) (fds, cursor, etc)
au BufWinEnter \* silent! loadview "make vim load view (state) (fds, cursor, etc)
" }}}
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
else
let &t_SI = "\e[5 q"
let &t_EI = "\e[2 q"
endif
" }}}
" }}}
" Module customization {{{
if isdirectory(expand("~/.vim/bundle/nerdtree"))
map <C-e> <plug>NERDTreeTabsToggle<CR>
map <leader>e :NERDTreeFind<CR>
nmap <leader>nt :NERDTreeFind<CR>
if isdirectory(expand("~/.vim/plugged/nerdtree"))
map <C-t> <plug>NERDTreeTabsToggle<CR>
map <leader>e :NERDTreeFind<CR>
nmap <leader>nt :NERDTreeFind<CR>
let NERDTreeShowBookmarks=1
let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=1
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeKeepTreeInNewTab=1
let g:nerdtree_tabs_open_on_gui_startup=0
let g:NERDTreeShowBookmarks=1
let g:NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
let g:NERDTreeChDirMode=1
let g:NERDTreeQuitOnOpen=1
let g:NERDTreeMouseMode=2
let g:NERDTreeShowHidden=1
let g:NERDTreeKeepTreeInNewTab=1
let g:nerdtree_tabs_open_on_gui_startup=0
endif
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='molokai'
let g:airline_theme='deus'
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
let g:iosftrk_folddisable = 1 " intel
let g:iosfsbtrk_folddisable = 1 " intel
let g:fugitive_git_executable = '/usr/intel/bin/git' " intel
" }}}
" Key bindings {{{
map <C-e> :NERDTreeToggle<CR>
map <C-t> :NERDTreeToggle<CR>
nnoremap <F5> :e<CR> G
nnoremap <F6> <C-W>w
nnoremap <S-F6> <C-W>W
nnoremap <C-F6> :IndentGuidesToggle<CR>
nnoremap <C-F11> :confirm bd<CR>
nnoremap <F7> <C-w>o
nnoremap <S-F8> <C-w>s
nnoremap <F8> <C-w>v
nnoremap <F9> :Denite buffer<CR>
nnoremap <leader>b :Denite buffer<CR>
"nnoremap <F9> :Denite buffer<CR>
"nnoremap <leader>b :Denite buffer<CR>
nnoremap <F9> :CtrlPMixed<CR>
nnoremap <leader>b :CtrlPBuffer<CR>
nnoremap <S-F10> :set wrap!<CR>
nnoremap <S-F1> :set spell!<CR>
@@ -206,6 +250,10 @@
nnoremap <C-Z> :bnext <CR>
" Visual mode: Keep selection after indent
vnoremap < <gv
vnoremap > >gv
if has("nvim")
nnoremap <C-Space> za
elseif has("gui_running")
@@ -223,7 +271,24 @@
nnoremap <C-S-F3> :%s/\s\+$//g<CR>:noh<CR>
" }}}
" Highlights {{{
"
" Highlight coloring I prefer
highlight Search guibg=yellow guifg=black
highlight Cursor guifg=white guibg=red
highlight iCursor guifg=white guibg=red
highlight SpecialKey guifg=#772222 guibg=#331111
" }}}
"
" File associations {{{
au! BufRead,BufNewFile *_iosf*_trk.out set filetype=iosftrk " intel
au! BufRead,BufNewFile *_iosfsb*_trk.out set filetype=iosfsbtrk " intel
au! BufRead,BufNewFile * RainbowToggleOn
" }}}
"
" }}}
" vim: foldenable foldmethod=marker

280
nvim.init.lazy.lua Normal file
View File

@@ -0,0 +1,280 @@
-- Install Lazy package
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Lazy setup
require("lazy").setup({
-- Config
defaults = {
lazy = true
},
-- Packages
"asolkar/vim-color-molokini",
"navarasu/onedark.nvim",
"kyazdani42/nvim-web-devicons",
"nvim-lualine/lualine.nvim",
"preservim/nerdtree",
"tpope/vim-fugitive",
"mhinz/vim-signify",
"lewis6991/gitsigns.nvim",
"mg979/vim-visual-multi",
"jiangmiao/auto-pairs",
"luochen1990/rainbow",
"tpope/vim-surround",
"nathanaelkane/vim-indent-guides",
-- "https://github.com/intel-sandbox/vim-iosf.git", -- intel
-- "https://github.com/intel-sandbox/vim-pcietrk", -- intel
"vhda/verilog_systemverilog.vim",
{
'nvim-telescope/telescope.nvim', tag = '0.1.2',
dependencies = { 'nvim-lua/plenary.nvim' }
},
{
'nvim-telescope/telescope-fzf-native.nvim',
-- build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
build = 'make'
}
})
-- LuaLine
require('lualine').setup {
options = {
icons_enabled = false,
theme = 'nightfly',
section_separators = { left = '', right = '' },
component_separators = { left = '', right = '' }
},
sections = {
lualine_c = {
{
'filename',
path = 2,
symbols = {
modified = '', -- Text to show when the buffer is modified
alternate_file = '', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory
},
}
}
},
tabline = {
lualine_a = {
{
'buffers',
show_filename_only = true, -- Shows shortened relative path when set to false.
hide_filename_extension = false, -- Hide filename extension when set to true.
show_modified_status = true, -- Shows indicator when the buffer is modified.
mode = 4, -- 0: Shows buffer name
-- 1: Shows buffer index
-- 2: Shows buffer name + buffer index
-- 3: Shows buffer number
-- 4: Shows buffer name + buffer number
max_length = vim.o.columns * 2 / 3, -- Maximum width of buffers component,
-- it can also be a function that returns
-- the value of `max_length` dynamically.
symbols = {
modified = '', -- Text to show when the buffer is modified
alternate_file = '', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory
},
}}
}
}
-- -- Gitsigns
-- -- See `:help gitsigns.txt`
-- require('gitsigns').setup {
-- signs = {
-- add = { text = '+' },
-- change = { text = '~' },
-- delete = { text = '_' },
-- topdelete = { text = '‾' },
-- changedelete = { text = '~' },
-- },
-- }
-- Onedark theme
require('onedark').setup {
style = 'deep'
}
require('onedark').load()
-- [[ Setting options ]]
-- See `:help vim.o`
if vim.g.neovide then
vim.o.guifont = "Iosevka Term:h15"
vim.g.neovide_scale_factor = 1.0
end
-- Set highlight on search
vim.o.hlsearch = true
-- Highlight problematic whitespace
vim.o.list = true
vim.opt.listchars = { tab = '', trail = '', extends = '#', nbsp = '.' }
-- Whitespace/tab management
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
-- Make line numbers default
vim.wo.number = true
vim.opt.colorcolumn = '120'
vim.opt.cursorline = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Enable break indent
vim.o.breakindent = true
vim.o.wrap = false
-- Save undo history
vim.o.undofile = true
-- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Decrease update time
vim.o.updatetime = 250
vim.wo.signcolumn = 'yes'
-- Set colorscheme
vim.o.termguicolors = true
-- vim.cmd [[colorscheme molokini]]
-- vim.cmd.colorscheme('molokini')
vim.cmd.colorscheme('onedark')
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- Do not auto read file when in focus
vim.o.autoread = false
-- [[ Basic Keymaps ]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ','
vim.g.maplocalleader = ','
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.api.nvim_set_keymap('n', '<c-z>', ':bn<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('v', '<c-z>', ':bn<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<c-x>', ':bp<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F5>', ':e<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F6>', '<C-W>w', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F18>', '<C-W>W', { noremap = 1 }) -- S-F6 (F18 defined in ST's config.h)
vim.api.nvim_set_keymap('n', '<F7>', '<C-W>o', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F8>', '<C-W>v', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F20>', '<C-W>s', { noremap = 1 }) -- S-F8 (F20 defined in ST's config.h)
vim.api.nvim_set_keymap('n', '<F35>', ':confirm bd<CR>', { noremap = 1 }) -- C-F11 (F35 defined in ST's config.h)
vim.api.nvim_set_keymap('v', '<LeftRelease>','"*ygv', { noremap = 1 }) -- Copy selection to clipboard
vim.api.nvim_set_keymap('v', '<2-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy word selection to clipboard
vim.api.nvim_set_keymap('v', '<3-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy line selection to clipboard
vim.api.nvim_set_keymap('v', '<4-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy column selection to clipboard
vim.api.nvim_set_keymap('v', '<c-r>', '"hy/<C-r>h<cr>', { noremap = 1 }) -- Search selected text
vim.api.nvim_set_keymap('n', '<c-Space>', 'za', { noremap = 1 }) -- Toggle fold
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = 1 }) -- Preserve selection after left indent
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = 1 }) -- Preserve selection after right indent
vim.api.nvim_set_keymap('v', 'Q', 'gqa', { noremap = 1 }) -- Reflow visually highlighted lines with Q
vim.api.nvim_set_keymap('n', 'Q', 'gq', { noremap = 1 }) -- Reflow text
-- Insert time/date stamps
vim.api.nvim_set_keymap('n', '<leader>td', 'i<C-R>=strftime(\'%Y/%m/%d\')<CR><Esc>', { noremap = 1 }) -- 'Insert [T]imestamp - [d]ate'
vim.api.nvim_set_keymap('n', '<leader>tt', 'i<C-R>=strftime(\'%Y/%m/%d %H:%M:%S\')<CR><Esc>', { noremap = 1 }) -- 'Insert [T]imestamp - date[t]ime'
vim.g.rainbow_active = 1 -- 0 if you want to enable it later via :RainbowToggle
-- vim.g.iosftrk_folddisable = 1 -- intel
-- vim.g.iosfsbtrk_folddisable = 1 -- intel
-- vim.g.pcietrk_folddisable = 1 -- intel
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
-- NERDTree
vim.api.nvim_set_keymap('n', '<c-t>', ':NERDTreeToggle %<CR>', { noremap = 1 })
vim.g.NERDTreeShowBookmarks = 1
vim.g.NERDTreeIgnore = {'\\.py[cd]$', '\\~$', '\\.swo$', '\\.swp$',
'^\\.git$', '^\\.hg$', '^\\.svn$', '\\.bzr$'}
vim.g.NERDTreeChDirMode = 3
vim.g.NERDTreeQuitOnOpen = 1
vim.g.NERDTreeMouseMode = 2
vim.g.NERDTreeShowHidden = 1
vim.g.NERDTreeKeepTreeInNewTab = 1
vim.g.nerdtree_tabs_open_on_gui_startup = 0
-- Filetype assignments - TODO: Is there an automatic way for this?
vim.cmd("au! BufRead,BufNewFile *.sv,*.svh set filetype=verilog_systemverilog")
vim.cmd("au! BufRead,BufNewFile *iosfsb_trk.out set filetype=iosfsbtrk")
vim.cmd("au! BufRead,BufNewFile *iosf_trk.out set filetype=iosftrk")
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
}
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
-- See `:help telescope.builtin`
vim.keymap.set('n', '<ldeader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer]' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ft=lua ts=4 sts=4 sw=4 et

540
nvim.init.lua Normal file
View File

@@ -0,0 +1,540 @@
-- Install packer
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
is_bootstrap = true
vim.fn.system({'mkdir', '-p', install_path})
vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
end
require('packer').startup(function(use)
-- Package manager
use 'wbthomason/packer.nvim'
-- Look and Colors
use 'navarasu/onedark.nvim'
use 'asolkar/vim-color-molokini'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'onedark',
section_separators = { left = '', right = '' },
component_separators = { left = '', right = '' }
},
sections = {
lualine_c = {
{
'filename',
path = 2,
symbols = {
modified = '', -- Text to show when the buffer is modified
alternate_file = '', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory
},
}
}
},
tabline = {
lualine_a = {
{
'buffers',
show_filename_only = true, -- Shows shortened relative path when set to false.
hide_filename_extension = false, -- Hide filename extension when set to true.
show_modified_status = true, -- Shows indicator when the buffer is modified.
mode = 4, -- 0: Shows buffer name
-- 1: Shows buffer index
-- 2: Shows buffer name + buffer index
-- 3: Shows buffer number
-- 4: Shows buffer name + buffer number
max_length = vim.o.columns * 2 / 3, -- Maximum width of buffers component,
-- it can also be a function that returns
-- the value of `max_length` dynamically.
symbols = {
modified = '', -- Text to show when the buffer is modified
alternate_file = '', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory
},
}}
}
}
-- Nerd Tree (File navigation)
use 'preservim/nerdtree'
vim.api.nvim_set_keymap('n', '<c-t>', ':NERDTreeToggle %<CR>', { noremap = 1 })
vim.g.NERDTreeShowBookmarks = 1
vim.g.NERDTreeIgnore = {'\\.py[cd]$', '\\~$', '\\.swo$', '\\.swp$',
'^\\.git$', '^\\.hg$', '^\\.svn$', '\\.bzr$'}
vim.g.NERDTreeChDirMode = 3
vim.g.NERDTreeQuitOnOpen = 1
vim.g.NERDTreeMouseMode = 2
vim.g.NERDTreeShowHidden = 1
vim.g.NERDTreeKeepTreeInNewTab = 1
vim.g.nerdtree_tabs_open_on_gui_startup = 0
-- Indent and brackets
use 'jiangmiao/auto-pairs'
use 'luochen1990/rainbow'
use 'tpope/vim-surround'
use 'nathanaelkane/vim-indent-guides'
use { -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
requires = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP
use {
'j-hui/fidget.nvim',
tag = 'legacy',
config = function()
require("fidget").setup {
-- options
}
end,
}
},
}
use { -- Autocompletion
'hrsh7th/nvim-cmp',
requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
}
use { -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
run = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
end,
}
use { -- Additional text objects via treesitter
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter',
}
-- Git related plugins
use 'tpope/vim-fugitive'
use 'mhinz/vim-signify'
use 'tpope/vim-rhubarb'
use 'lewis6991/gitsigns.nvim'
use 'mg979/vim-visual-multi'
-- use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
-- Fuzzy Finder (files, lsp, etc)
use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 }
-- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua
local has_plugins, plugins = pcall(require, 'custom.plugins')
if has_plugins then
plugins(use)
end
if is_bootstrap then
require('packer').sync()
end
end)
-- When we are bootstrapping a configuration, it doesn't
-- make sense to execute the rest of the init.lua.
--
-- You'll need to restart nvim, and then it will work.
if is_bootstrap then
print '=================================='
print ' Plugins are being installed'
print ' Wait until Packer completes,'
print ' then restart nvim'
print '=================================='
return
end
-- Automatically source and re-compile packer whenever you save this init.lua
local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
vim.api.nvim_create_autocmd('BufWritePost', {
command = 'source <afile> | PackerCompile',
group = packer_group,
pattern = vim.fn.expand '$MYVIMRC',
})
-- [[ Setting options ]]
-- See `:help vim.o`
if vim.g.neovide then
vim.o.guifont = "Iosevka Term:h12"
vim.g.neovide_scale_factor = 1.0
end
-- Set highlight on search
vim.o.hlsearch = true
-- Highlight problematic whitespace
vim.o.list = true
vim.opt.listchars = { tab = '', trail = '', extends = '#', nbsp = '.' }
vim.o.wrap = false
-- Make line numbers default
vim.wo.number = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Decrease update time
vim.o.updatetime = 250
vim.wo.signcolumn = 'yes'
-- Set colorscheme
vim.o.termguicolors = true
vim.cmd [[colorscheme onedark]]
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- Do not auto read file when in focus
vim.o.autoread = false
-- [[ Basic Keymaps ]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ','
vim.g.maplocalleader = ','
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
-- Personal keymapping
vim.keymap.set('n', '<c-z>', ':bn<CR>', { silent = true })
vim.keymap.set('v', '<c-z>', ':bn<CR>', { silent = true })
vim.keymap.set('n', '<c-x>', ':bp<CR>', { silent = true })
vim.keymap.set('n', '<F5>', ':e<CR>', { silent = true })
vim.keymap.set('n', '<F6>', '<C-W>w', { silent = true })
vim.keymap.set('n', '<F18>', '<C-W>W', { silent = true }) -- S-F6 (F18 defined in ST's config.h)
vim.keymap.set('n', '<F7>', '<C-W>o', { silent = true })
vim.keymap.set('n', '<F8>', '<C-W>v', { silent = true })
vim.keymap.set('n', '<F20>', '<C-W>s', { silent = true }) -- S-F8 (F20 defined in ST's config.h)
vim.keymap.set('n', '<F35>', ':confirm bd<CR>', { silent = true }) -- C-F11 (F35 defined in ST's config.h)
vim.keymap.set('v', '<LeftRelease>','"*ygv', { silent = true }) -- Copy selection to clipboard
vim.keymap.set('v', '<2-LeftRelease>','"*ygv', { silent = true }) -- Copy word selection to clipboard
vim.keymap.set('v', '<3-LeftRelease>','"*ygv', { silent = true }) -- Copy line selection to clipboard
vim.keymap.set('v', '<4-LeftRelease>','"*ygv', { silent = true }) -- Copy column selection to clipboard
vim.keymap.set('v', '<c-r>', '"hy/<C-r>h<cr>', { silent = true }) -- Search selected text
vim.keymap.set('n', '<c-Space>', 'za', { silent = true }) -- Toggle fold
vim.keymap.set('v', '<', '<gv', { silent = true }) -- Preserve selection after left indent
vim.keymap.set('v', '>', '>gv', { silent = true }) -- Preserve selection after right indent
vim.keymap.set('v', 'Q', 'gqap', { silent = true }) -- Reflow visually highlighted lines with Q
vim.keymap.set('n', 'Q', 'gq', { silent = true }) -- Reflow text
vim.keymap.set('n', '<leader>td', 'a[<C-r>=strftime("%Y/%m/%d")<CR>] <Esc>', { silent = true }) -- Insert Date after cursor
vim.keymap.set('n', '<leader>tt', 'a[<C-r>=strftime("%Y/%m/%d %X")<CR>] <Esc>', { silent = true }) -- Insert Date and time after cursor
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
-- Enable Comment.nvim
require('Comment').setup()
-- Gitsigns
-- See `:help gitsigns.txt`
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
}
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
}
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
-- See `:help telescope.builtin`
vim.keymap.set('n', '<ldeader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer]' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'perl', 'ruby', 'verilog' },
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<c-backspace>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself
-- many times.
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
if vim.lsp.buf.format then
vim.lsp.buf.format()
elseif vim.lsp.buf.formatting then
vim.lsp.buf.formatting()
end
end, { desc = 'Format current buffer with LSP' })
end
-- Setup mason so it can manage external tooling
require('mason').setup()
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed
-- local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'gopls' }
local servers = { 'rust_analyzer', 'pyright', 'lua_ls', 'gopls', 'perlnavigator', 'bashls' }
-- Ensure the servers above are installed
require('mason-lspconfig').setup {
ensure_installed = servers,
}
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
for _, lsp in ipairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
-- Turn on lsp status information
require('fidget').setup()
-- Example custom configuration for lua
--
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
require('lspconfig').lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
}
-- nvim-cmp setup
local cmp = require 'cmp'
local luasnip = require 'luasnip'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=4 sts=4 sw=4 et

114
rofi_sound.pl Executable file
View File

@@ -0,0 +1,114 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
my $selection = $ARGV[0];
my $app = {};
if (defined $selection) {
select_sink($app, $selection);
} else {
show_sinks($app);
}
# -----------
# Subroutines
# -----------
sub show_sinks {
my ($app) = @_;
my @sinks = get_sinks($app);
print join("\n", @sinks);
}
# -----------
sub select_sink {
my ($app, $sink) = @_;
my $wp_h;
my ($id,$name) = $sink =~ /(\d+):(.*)/;
my $seld_sink = "NONE";
my $seld_id = "NONE";
open($wp_h, "pw-cli info $id |") or die "Could not run pw-cli command";
while (my $ln = <$wp_h>) {
if (my ($node_name) = $ln =~ /node.name\s*=\s*"(.*)"/) {
warn "Selected [$id] ($name) - $node_name\n";
$seld_sink = $node_name;
$seld_id = $id;
last;
}
}
enable_sink($app, $seld_sink, $seld_id);
}
# -----------
sub enable_sink {
my ($app, $sink, $id) = @_;
`wpctl set-default $id`;
unmute_master($app);
}
# -----------
sub unmute_master {
my ($app) = @_;
`amixer -c 0 set Master unmute`;
}
# -----------
sub parse_wpctl {
my $wp_h;
open($wp_h, "wpctl status |") or die "Could not run wpctl command";
my @lines = <$wp_h>;
my $section = "None";
my $sub_section = "None";
my $wp_data = {};
foreach my $ln (@lines) {
# Section
if (my ($mat) = $ln =~ /(^(PipeWire)|^(\w+)$)/) {
$section = $mat;
$wp_data->{$section} = {} unless (exists $wp_data->{$section});
}
# Sub-section
if (my ($mat) = $ln =~ /\s+(\w+):$/) {
$sub_section = $mat;
$wp_data->{$section}->{$sub_section} = [] unless (exists $wp_data->{$section}->{$sub_section});
}
# Entries
if (($section ne "None") && ($sub_section ne "None")) {
if (my ($sel, $id, $name) = $ln =~ /\s+(\*)?\s+(\d+)\.\s+(.*?)(\[|$)/) {
my $seld = (defined $sel) ? 1 : 0;
$name =~ s/^\s*//; $name =~ s/\s*$//;
push(@{$wp_data->{$section}->{$sub_section}}, {
'sel' => $seld,
'id' => $id,
'name' => $name
});
}
}
}
$app->{'wp_data'} = $wp_data;
}
# -----------
sub get_sinks {
my ($app) = @_;
parse_wpctl($app);
# warn Data::Dumper->Dump([$app->{'wp_data'}]);
return map { "$_->{'id'}:$_->{'name'}" } @{$app->{'wp_data'}->{'Audio'}->{'Sinks'}}
}

54
root.bashrc Normal file
View File

@@ -0,0 +1,54 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# --------------------------------
# Shell RC
# --------------------------------
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;41m\]$(hostnamectl hostname)\[\033[00m\]\[\033[01;34m\] \w\[\033[00m\] \$ '
#
# Variables
#
export PATH=~/bin:$PATH
#
# Editor setup
#
export PATH=/opt/neovim:$PATH
export EDITOR=nvim
function n () {
/opt/neovim/nvim $* || nvim $*
}
#
# Aliases
#
alias ls='ls -al --color'
alias q=exit
alias a=clear
alias h=history
#
# Functions
#
function hgrep () {
history | grep $1
}
function pgrep () {
ps aux | grep $1
}
function u2d () {
~mahesh/git/snips/get_neovim.sh
# ~mahesh/git/snips/get_wezterm.sh
cd
if [ -e /etc/arch-release ]; then
pacman --sync --refresh --sysupgrade --noconfirm
elif [ -e /etc/debian_version ]; then
apt update && apt full-upgrade -y && apt autoremove -y
else
echo "Auto update not supported."
exit 1
fi
}

94
root.init.lua Normal file
View File

@@ -0,0 +1,94 @@
-- [[ Setting options ]]
-- See `:help vim.o`
-- Set highlight on search
vim.o.hlsearch = true
-- Highlight problematic whitespace
vim.o.list = true
vim.opt.listchars = { tab = '', trail = '', extends = '#', nbsp = '.' }
-- Whitespace/tab management
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
-- Make line numbers default
vim.wo.number = true
vim.opt.colorcolumn = '120'
vim.opt.cursorline = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Enable break indent
vim.o.breakindent = true
vim.o.wrap = false
-- Save undo history
vim.o.undofile = true
-- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Decrease update time
vim.o.updatetime = 250
vim.wo.signcolumn = 'yes'
-- Set colorscheme
vim.o.termguicolors = true
-- vim.cmd [[colorscheme molokini]]
-- vim.cmd.colorscheme('molokini')
vim.cmd.colorscheme('habamax')
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- Do not auto read file when in focus
vim.o.autoread = false
-- [[ Basic Keymaps ]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ','
vim.g.maplocalleader = ','
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.api.nvim_set_keymap('n', '<c-t>', ':Explore<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<c-z>', ':bn<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('v', '<c-z>', ':bn<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<c-x>', ':bp<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F5>', ':e<CR>', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F6>', '<C-W>w', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F18>', '<C-W>W', { noremap = 1 }) -- S-F6 (F18 defined in ST's config.h)
vim.api.nvim_set_keymap('n', '<F7>', '<C-W>o', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F8>', '<C-W>v', { noremap = 1 })
vim.api.nvim_set_keymap('n', '<F20>', '<C-W>s', { noremap = 1 }) -- S-F8 (F20 defined in ST's config.h)
vim.api.nvim_set_keymap('n', '<F35>', ':confirm bd<CR>', { noremap = 1 }) -- C-F11 (F35 defined in ST's config.h)
vim.api.nvim_set_keymap('v', '<LeftRelease>','"*ygv', { noremap = 1 }) -- Copy selection to clipboard
vim.api.nvim_set_keymap('v', '<2-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy word selection to clipboard
vim.api.nvim_set_keymap('v', '<3-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy line selection to clipboard
vim.api.nvim_set_keymap('v', '<4-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy column selection to clipboard
vim.api.nvim_set_keymap('v', '<c-r>', '"hy/<C-r>h<cr>', { noremap = 1 }) -- Search selected text
vim.api.nvim_set_keymap('n', '<c-Space>', 'za', { noremap = 1 }) -- Toggle fold
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = 1 }) -- Preserve selection after left indent
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = 1 }) -- Preserve selection after right indent
vim.api.nvim_set_keymap('v', 'Q', 'gqa', { noremap = 1 }) -- Reflow visually highlighted lines with Q
vim.api.nvim_set_keymap('n', 'Q', 'gq', { noremap = 1 }) -- Reflow text
-- Insert time/date stamps
vim.api.nvim_set_keymap('n', '<leader>td', 'a<C-R>=strftime(\'%Y/%m/%d\')<CR><Esc>', { noremap = 1 }) -- 'Insert [T]imestamp - [d]ate'
vim.api.nvim_set_keymap('n', '<leader>tt', 'a<C-R>=strftime(\'%Y/%m/%d %H:%M:%S\')<CR><Esc>', { noremap = 1 }) -- 'Insert [T]imestamp - date[t]ime'
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ft=lua ts=4 sts=4 sw=4 et

18
tmux_status.laptop Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
# vim: filetype=sh
#while true; do
VOL=$(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/')
LOCALTIME=$(date +"%Y %h %d %I:%M%p %Z")
IP=$(for i in `ip r`; do echo $i; done | grep -A 1 src | tail -n1)
# WEATHER=$(weather fips4105192520 | grep Tempera | awk '{print $2}')
WEATHER=$(curl wttr.in/45.54,-122.83?format="%c%t")
BAT=$(acpi -b | awk '{ print $4 " " $5 }' | tr -d ',')
echo "$IP  ${WEATHER}"
#sleep 30
#done

65
user.bash_aliases Normal file
View File

@@ -0,0 +1,65 @@
# --------------------------------
# Shell RC
# --------------------------------
# If git-prompt does not exist, get it with following command:
#
# $ wget https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh [ -r /usr/share/bash-completion/completions/git ] && . /usr/share/bash-completion/completions/git
if [ -f /etc/bash_completion.d/git-prompt ]; then
source /etc/bash_completion.d/git-prompt
fi
if [ -f /usr/share/git/git-prompt.sh ]; then
source /usr/share/git/git-prompt.sh
fi
export GIT_PS1_SHOWDIRTYSTATE=1
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;92m\]$(hostnamectl hostname)\[\033[01;34m\] \w\[\033[01;35m\]$(__git_ps1 "  %s") \[\033[0m\]$ '
#
# Variables
#
export PATH=~/bin:~/.local/bin:$PATH
export IGNOREEOF=50 # Ignore first 50 Ctrl-D on shell
export GPG_TTY=$(tty)
#
# Editor setup
#
export PATH=/opt/neovim:$PATH
export EDITOR=nvim
function n () {
/opt/neovim/nvim $* || nvim $*
}
#
# Aliases
#
alias ls='ls -altrh --color'
alias q=exit
alias a=clear
alias h=history
alias gn='neovide --fork'
#
# Functions
#
function pyedit () {
gedit $1 >& /dev/null &
disown %1
}
function hgrep () {
history | grep $1
}
function pgrep () {
ps aux | grep $1
}
function start_tmux () {
TERM=screen-256color tmux -u new -A -s DevEnv
}
function start_gitui() {
GPG_TTY=$(tty) gitui
}

88
user.conkyrc Normal file
View File

@@ -0,0 +1,88 @@
--[[
Conky, a system monitor, based on torsmo
Any original torsmo code is licensed under the BSD license
All code written since the fork of torsmo is licensed under the GPL
Please see COPYING for details
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2019 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
conky.config = {
net_avg_samples = 2,
no_buffers = true,
out_to_console = true,
out_to_ncurses = false,
out_to_stderr = false,
out_to_x = false,
update_interval = 2.0,
uppercase = false,
use_spacer = 'left',
}
--[[ For Somebar ]]
conky.text = [[
${if_existing /usr/local/bin/somebar}status${endif} \
${if_mpd_playing}${if_match "${mpd_status}" == "Paused"}⏸${else}𝄞${endif} [${mpd_percent}] ${mpd_smart 50}${endif} \
💻 ${cpu}% \
💾 ${memperc}% \
${if_existing /sys/class/net/enp0s20f0u1u1u2/operstate up}🌎 ${addr enp0s20f0u1u1u2}${else}\
${if_existing /sys/class/net/enp0s20f0u1u1/operstate up}🌎 ${addr enp0s20f0u1u1}${else}\
${if_existing /sys/class/net/wlp0s20f3/operstate up}📶 ${addr wlp0s20f3}${else}\
${if_existing /sys/class/net/enp3s0/operstate up}🌎 ${addr enp3s0}${else}\
${if_existing /sys/class/net/wlp4s0/operstate up}📶 ${addr wlp4s0}${else}\
${if_up eth0}🌎 ${addr eth0}${else}\
network down ${endif}${endif}${endif}${endif}${endif}${endif} \
${execi 600 curl 'wttr.in/~45.5202471,-122.6741948?u&format=%c%t'} \
🔊 ${execi 10 wpctl get-volume 53 | tail -1 | perl -ne 'm/([\d\.]+)/; print scalar (($1>1) ? 100 : ($1*100))'} \
${if_existing /sys/class/power_supply/ADP0/online 1}🔌${else}🔋${endif} ${battery_percent}% \
📅 ${time %Y %h %d} \
🕑 ${time %I:%M%p %Z}
]]
--[[
Reference
${execi 600 curl 'wttr.in/~45.54,-122.83?u&format=%c%t'} \
🌡 ${execi 600 weather fips4105192520 | grep Tempera | awk '{print $2}'}°F | \
${execi 1 cat /tmp/dwl.tags.out} | \
🌦 ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ KHIO temperature 10} | \
🔋apcupsd_charge${execi 60 acpi -b | awk '{ print " " $5 }' | tr -d ','} | \
${color grey}Info:$color ${scroll 32 Conky $conky_version - $sysname $nodename $kernel $machine}
$hr
${color grey}Uptime:$color $uptime
${color grey}Frequency (in MHz):$color $freq
${color grey}Frequency (in GHz):$color $freq_g
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
/ $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
Up:$color ${upspeed} ${color grey} - Down:$color ${downspeed}
$hr
${color grey}Name PID CPU% MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
]]

79
user.tmux.conf Normal file
View File

@@ -0,0 +1,79 @@
#
# TMUX Configuration file
#
# General settings {{{
# set -g default-terminal "xterm-256color"
set -g default-terminal "screen-256color"
set -g default-command "$SHELL -l"
set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
# vi mode
set-window-option -g mode-keys vi
set -as terminal-overrides ",*:U8=a0"
# set-option -ga terminal-overrides ",screen-256color:Tc"
set -g mouse on
set -g status-position top
# set -g status-windows-justify middle
# Package management {{{
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
set -g @themepack-status-right-area-left-format "#(~/bin/tmux_status)  %H:%M"
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'jimeh/tmux-themepack'
set -g @themepack 'powerline/default/gray'
# }}}
# }}}
# Keyboard shortcuts {{{
# Reload tmux config
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# Navigation
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# # Clipboard integration
# # ctrl+c to send to clipboard
# # Selection with mouse should copy to clipboard right away, in addition to the default action.
# unbind -n -T copy-mode-vi MouseDragEnd1Pane
# bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
# unbind -n -T copy-mode-vi 'v'
# bind -T copy-mode-vi 'v' send -X begin-selection
# unbind -n -T copy-mode-vi 'y'
# bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
# # Middle click to paste from the clipboard
# unbind-key MouseDown2Pane
# bind-key -n MouseDown2Pane run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# }}}
# Footer {{{
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
if "test -d ~/.tmux/plugins/tpm" \
"run -b '~/.tmux/plugins/tpm/tpm'"
# }}}
# vim: foldenable foldmethod=marker

44
wezterm.lua.mac Normal file
View File

@@ -0,0 +1,44 @@
local wezterm = require 'wezterm';
return {
-- On MacOS, wezTerm hangs when reloading config
automatically_reload_config = false,
-- MacBook Pro setting with proper DPI
font = wezterm.font("Iosevka Term"),
font_size = 18,
-- font_antialias = "Subpixel",
dpi = 144.0,
-- Don't want tabbar by default
hide_tab_bar_if_only_one_tab = true,
-- Native fullscreen behavior on MacOS
native_macos_fullscreen_mode = true,
-- -- Acceleration
-- front_end = "WebGpu",
-- webgpu_power_preference = "HighPerformance",
-- Keyboard bindings
keys = {
{ key = 'f', mods = 'CMD|CTRL', action = wezterm.action.ToggleFullScreen, },
},
-- Color scheme and cursor
colors = {
cursor_bg = "red",
cursor_fg = "black",
cursor_border = "grey",
compose_cursor = "orange",
-- Color scheme
-- Molokini (https://github.com/asolkar/vim-color-molokini/blob/master/colors/molokini.vim)
-- Order: black, red, green, yellow, blue, magenta, cyan, white
ansi = { "#000000", "#F92672", "#A6E22E", "#FFDF5F",
"#66D9EF", "#7070F0", "#A1FFA4", "#ffffff" },
brights = { "#808080", "#f51d5a", "#9EC400", "#E7C547",
"#7AA6DA", "#B77EE0", "#54AE96", "#ffffff" },
}
}

35
xbindkeysrc Normal file
View File

@@ -0,0 +1,35 @@
###########################
# xbindkeys configuration #
###########################
# Mouse click emulation for Apple Single Button Mouse with Apple Keyboard
# F14 - Click 1 (left click)
"xdotool click 1"
XF86Launch5
# F15 - Click 2 (middle click)
"xdotool click 2"
XF86Launch6
# F16 - Click 3 (right click)
"xdotool click 3"
XF86Launch7
# Media keys on Apple keyboard
# FIXME: Media keys (except eject) don't work by themselves on my keyboard -
# they have to be pressed with a modifier key (Mod4 = Command key)
"pactl set-sink-volume 0 -5%"
Mod4 + XF86AudioLowerVolume
"pactl set-sink-volume 0 +5%"
Mod4 + XF86AudioRaiseVolume
"pactl set-sink-mute 0 toggle"
Mod4 + XF86AudioMute
"eject -T /dev/cdrom"
XF86Eject
# Examples of commands:
"xbindkeys_show"
control+shift + q
##################################
# End of xbindkeys configuration #
##################################