Merge branch 'master' of github.com:JakeGinesin/nix-dots
This commit is contained in:
@@ -24,12 +24,18 @@ in {
|
||||
|
||||
home.stateVersion = "24.11"; # Please read the comment before changing.
|
||||
|
||||
# age.secrets.zsh_remote.file = ../secrets/zsh_remote.age;
|
||||
# age.secretsDir = "/home/synchronous/.agenix/agenix";
|
||||
# age.secretsMountPoint = "/home/synchronous/.agenix/agenix.d";
|
||||
# age.identityPaths = ["/home/synchronous/.ssh/id_ed25519"];
|
||||
|
||||
# home.packages = with pkgs; [xrandr procps polybar bspwm sxhkd polybar-pulseaudio-control bluez];
|
||||
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
HOME = "/home/synchronous";
|
||||
XDG_CACHE_HOME = "$HOME/.cache";
|
||||
DBUS_SESSION_BUS_ADDRESS = "unix:path=$XDG_RUNTIME_DIR/bus";
|
||||
};
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
@@ -45,6 +51,8 @@ in {
|
||||
beets
|
||||
netcat
|
||||
zathura
|
||||
keepassxc
|
||||
sshpass
|
||||
]
|
||||
++ (
|
||||
with lib; let
|
||||
@@ -64,4 +72,10 @@ in {
|
||||
(builtins.readFile file)
|
||||
)
|
||||
);
|
||||
|
||||
# home.file.".profile".text = ''
|
||||
# if [ -f "$HOME/.scripts/res.sh" ]; then
|
||||
# . "$HOME/.scripts/res.sh"
|
||||
# fi
|
||||
# '';
|
||||
}
|
||||
|
||||
@@ -10,9 +10,10 @@ pgrep -x sxhkd > /dev/null || sxhkd &
|
||||
|
||||
# xrandr --output eDP-1 --mode 1920x1080 --primary
|
||||
# xrandr --output HDMI-1 --mode 1920x1080 --same-as eDP-1 --scale 1x1
|
||||
xrandr --output eDP-1 --scale 1x1 --auto
|
||||
# xrandr --output eDP-1 --scale 1x1 --auto
|
||||
xrandr --output LVDS-1 --mode 1366x768 --primary
|
||||
|
||||
bspc monitor eDP-1 -d 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
bspc monitor LVDS-1 -d 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
|
||||
bspc config border_width 2
|
||||
bspc config window_gap 2
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
# osConfig carries config from configuration.nix
|
||||
scale =
|
||||
if osConfig.res == "1366x768"
|
||||
then 0.80
|
||||
else if osConfig.res == "2560x1440"
|
||||
then 1.25
|
||||
else 1.00;
|
||||
in {
|
||||
home.activation.copyStartpage = lib.mkAfter ''
|
||||
mkdir -p ~/.firefox-startpage
|
||||
cp -r ${./startpage}/* ~/.firefox-startpage/
|
||||
@@ -118,10 +127,10 @@
|
||||
# for tiling window managers expands to the size of the window
|
||||
|
||||
# https://support.mozilla.org/en-US/questions/1253302
|
||||
"mousewheel.with_control.action" = "1";
|
||||
"mousewheel.with_control.action" = 1;
|
||||
|
||||
# should change this based on your resolution
|
||||
"layout.css.devPixelsPerPx" = 1.25;
|
||||
"layout.css.devPixelsPerPx" = scale;
|
||||
|
||||
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
|
||||
"full-screen-api.ignore-widgets" = true;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services.ssh-agent.enable = true;
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
|
||||
7
home/programs/keepassxc/default.nix
Normal file
7
home/programs/keepassxc/default.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.file.".config/keepassxc/keepassxc.ini".source = ./keepassxc.ini;
|
||||
}
|
||||
21
home/programs/keepassxc/keepassxc.ini
Normal file
21
home/programs/keepassxc/keepassxc.ini
Normal file
@@ -0,0 +1,21 @@
|
||||
[General]
|
||||
ConfigVersion=2
|
||||
|
||||
[Browser]
|
||||
CustomProxyLocation=
|
||||
|
||||
[GUI]
|
||||
ApplicationTheme=dark
|
||||
ShowExpiredEntriesOnDatabaseUnlockOffsetDays=6
|
||||
TrayIconAppearance=monochrome-light
|
||||
|
||||
[PasswordGenerator]
|
||||
AdditionalChars=
|
||||
ExcludedChars=
|
||||
Length=31
|
||||
LowerCase=true
|
||||
Numbers=true
|
||||
SpecialChars=true
|
||||
UpperCase=true
|
||||
WordCount=8
|
||||
WordSeparator=!
|
||||
12
home/programs/nf/default.nix
Normal file
12
home/programs/nf/default.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
home.activation.makeNfDir = lib.mkAfter ''
|
||||
mkdir -p ~/journal
|
||||
mkdir -p ~/journal/rest
|
||||
chmod -R u+w ~/journal
|
||||
'';
|
||||
}
|
||||
@@ -9,4 +9,4 @@ view=icon
|
||||
recurse=true
|
||||
sort=alpha
|
||||
icon_caps=false
|
||||
dirs=/home/synchronous/.wallpapers;
|
||||
dirs=$HOME/.wallpapers;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
rust-analyzer-unwrapped
|
||||
black
|
||||
nodejs_22
|
||||
latexrun
|
||||
# gh
|
||||
];
|
||||
|
||||
|
||||
@@ -12,3 +12,51 @@ vim.api.nvim_create_autocmd("VimResized", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- hide and unhide lualine when entering and leaving goyo
|
||||
|
||||
local lualine = require('lualine')
|
||||
local grp = vim.api.nvim_create_augroup('goyo_lualine_toggle', { clear = true })
|
||||
|
||||
local function hide() lualine.hide{ place = {'statusline', 'winbar', 'tabline'} } end
|
||||
local function unhide() lualine.hide{ place = {'statusline', 'winbar', 'tabline'}, unhide = true } end
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
group = grp,
|
||||
pattern = 'GoyoEnter',
|
||||
callback = function()
|
||||
lualine.hide({ place = {'statusline', 'winbar', 'tabline'} })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
group = grp,
|
||||
pattern = 'GoyoLeave',
|
||||
callback = function()
|
||||
lualine.hide({ place = {'statusline', 'winbar', 'tabline'}, unhide = true })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('VimEnter', {
|
||||
group = grp,
|
||||
once = true,
|
||||
callback = function()
|
||||
local w = vim.g.goyo_if
|
||||
if w then
|
||||
vim.schedule(hide)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('UIEnter', {
|
||||
once = true,
|
||||
group = grp,
|
||||
callback = function()
|
||||
local w = vim.g.goyo_if
|
||||
if w then
|
||||
vim.opt.showtabline = 0
|
||||
vim.cmd('BarbarDisable')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -19,9 +19,9 @@ line-size = 3
|
||||
;locale = tr_TR.UTF-8
|
||||
|
||||
width = 99.7%
|
||||
height = 25
|
||||
offset-x = 4
|
||||
offset-y = 3
|
||||
; height = 25
|
||||
; offset-x = 4
|
||||
; offset-y = 3
|
||||
padding-left = 2
|
||||
padding-right = 2
|
||||
module-margin-left = 3
|
||||
@@ -29,14 +29,16 @@ module-margin-right = 0
|
||||
tray-position = right
|
||||
tray-detached = false
|
||||
|
||||
; font-0 = "NotoSans-Regular:size=11;2.5"
|
||||
; font-1 = "JetBrainsMono Nerd Font:style=Regular:size=11;2.5"
|
||||
; font-2 = "Noto Sans Symbols:size=13;1"
|
||||
|
||||
background = ${colors.background}
|
||||
foreground = ${colors.foreground}
|
||||
|
||||
|
||||
; noto -> text font
|
||||
; jetbrains -> icons
|
||||
font-0 = "NotoSans-Regular:size=11;2.5"
|
||||
font-1 = "JetBrainsMono Nerd Font:style=Regular:size=11;2.5"
|
||||
font-2 = "Noto Sans Symbols:size=13;1"
|
||||
|
||||
; font-0 = B612:style=Regular:size=9;3
|
||||
; font-0 = "NotoSans Nerd Font:size=9;3"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}: let
|
||||
mypolybar = pkgs.polybar.override {
|
||||
@@ -37,6 +38,43 @@
|
||||
# ${ip} route | ${grep} default | ${awk} '{print $5}' > $out
|
||||
# '';
|
||||
|
||||
hd = ''
|
||||
[bar/mybar]
|
||||
height = 20
|
||||
font-0 = "NotoSans-Regular:size=9;2.5"
|
||||
font-1 = "JetBrainsMono Nerd Font:style=Regular:size=9;2.5"
|
||||
font-2 = "Noto Sans Symbols:size=9;1"
|
||||
offset-x = 2
|
||||
offset-y = 2
|
||||
'';
|
||||
|
||||
fhd = ''
|
||||
[bar/mybar]
|
||||
height = 20
|
||||
font-0 = "NotoSans-Regular:size=11;2.5"
|
||||
font-1 = "JetBrainsMono Nerd Font:style=Regular:size=11;2.5"
|
||||
font-2 = "Noto Sans Symbols:size=11;1"
|
||||
offset-x = 4
|
||||
offset-y = 3
|
||||
'';
|
||||
|
||||
qhd = ''
|
||||
[bar/mybar]
|
||||
height = 25
|
||||
font-0 = "NotoSans-Regular:size=11;2.5"
|
||||
font-1 = "JetBrainsMono Nerd Font:style=Regular:size=11;2.5"
|
||||
font-2 = "Noto Sans Symbols:size=13;1"
|
||||
offset-x = 4
|
||||
offset-y = 3
|
||||
'';
|
||||
|
||||
mon =
|
||||
if osConfig.res == "1366x768"
|
||||
then hd
|
||||
else if osConfig.res == "2560x1440"
|
||||
then qhd
|
||||
else fhd;
|
||||
|
||||
internets = ''
|
||||
[module/network]
|
||||
type = internal/network
|
||||
@@ -61,7 +99,7 @@ in {
|
||||
enable = true;
|
||||
package = mypolybar;
|
||||
config = ./config.ini;
|
||||
extraConfig = bctl + internets;
|
||||
extraConfig = bctl + internets + mon;
|
||||
# my savior: https://www.reddit.com/r/NixOS/comments/v8ikwq/polybar_doesnt_start_at_launch/
|
||||
script = ''
|
||||
# echo "none"
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# ./nitrogen/defualt.nix
|
||||
./rofi/default.nix
|
||||
./polybar/default.nix
|
||||
|
||||
# wm stuff
|
||||
./sxhkd/default.nix
|
||||
./bspwm/default.nix
|
||||
@@ -23,5 +22,7 @@
|
||||
./firefox/default.nix
|
||||
./git/default.nix
|
||||
./zathura/default.nix
|
||||
./keepassxc/default.nix
|
||||
./nf/default.nix
|
||||
];
|
||||
}
|
||||
|
||||
91
home/programs/rofi/styles/prompt-search.rasi
Normal file
91
home/programs/rofi/styles/prompt-search.rasi
Normal file
@@ -0,0 +1,91 @@
|
||||
@import "/home/synchronous/.config/rofi/styles/colors.rasi"
|
||||
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
* {
|
||||
pink: @base0C;
|
||||
cyan: @base0F;
|
||||
green: #9ece6a;
|
||||
|
||||
accent-color: @base06;
|
||||
urgent-color: @base0A;
|
||||
|
||||
background-color: transparent;
|
||||
text-color: @text;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
window {
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
y-offset: 0px;
|
||||
|
||||
enabled: true;
|
||||
background-color: @background;
|
||||
cursor: "default";
|
||||
border: 1px;
|
||||
border-color: #565657;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
inputbar {
|
||||
enabled: true;
|
||||
background-color: @prompt;
|
||||
padding: 10px;
|
||||
children: ["entry"];
|
||||
}
|
||||
|
||||
entry {
|
||||
enabled: true;
|
||||
padding: 0.75em 0.75em;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 10;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
margin: 0.25em 0 0.25em;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
prompt {
|
||||
text-color: @accent-color;
|
||||
|
||||
}
|
||||
|
||||
textbox {
|
||||
padding: 0.5em 1.5em;
|
||||
background-color: @prompt;
|
||||
}
|
||||
|
||||
element {
|
||||
enabled: true;
|
||||
margin: 0 0.25em;
|
||||
padding: 0.5em 0.75em;
|
||||
cursor: pointer;
|
||||
orientation: vertical;
|
||||
}
|
||||
|
||||
element-text {
|
||||
highlight: @green;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
font: "Liga SFMono Nerd Font 14";
|
||||
}
|
||||
|
||||
element-text selected {
|
||||
text-color: @cyan;
|
||||
}
|
||||
@@ -181,18 +181,18 @@ super + bracket{left,right}
|
||||
# alacritty -e nvim /home/synchronous/Documents/Obsidian/Journal/Daily.md -c "execute 'normal G' | Goyo | autocmd VimResized * call GoyoWrapper()"
|
||||
# open my notes file in nvim w/ a new alacritty window, then jump to end of file
|
||||
super + {o}
|
||||
open_daily
|
||||
sh nf daily
|
||||
|
||||
# open my notes without goyo and with nvimteee
|
||||
super + {shift} + {o}
|
||||
alacritty -e nvim /home/synchronous/journal/Daily.md -c "execute 'normal G' | NvimTreeOpen /home/synchronous/journal"
|
||||
sh nf daily
|
||||
|
||||
# search my notes using rofi and open the right one
|
||||
super + {ctrl} + {o}
|
||||
sh /home/synchronous/.scripts/vimwiki/search_notes.sh
|
||||
sh nf search
|
||||
|
||||
super + {ctrl} + {p}
|
||||
sh /home/synchronous/.scripts/papers/paper-search-cached.sh
|
||||
# super + {ctrl} + {p}
|
||||
# sh /home/synchronous/.scripts/papers/paper-search-cached.sh
|
||||
|
||||
super + {ctrl} + {l}
|
||||
sh /home/synchronous/.scripts/papers/paper-search.sh
|
||||
@@ -211,7 +211,8 @@ super + {alt} + {c}
|
||||
find /home/synchronous/current-semester -follow -maxdepth 1 | cut -c36- | sed '/^[[:space:]]*$/d' | rofi -dmenu | read rsem; yq ".url" "/home/synchronous/current-semester/$rsem/info.yaml" | xargs firefox
|
||||
|
||||
super + {p}
|
||||
sh /home/synchronous/.scripts/vimwiki/open_todo.sh
|
||||
# sh /home/synchronous/.scripts/vimwiki/open_todo.sh
|
||||
nf todo
|
||||
|
||||
super + {m}
|
||||
sh /home/synchronous/.scripts/vimwiki/open-learning.sh
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
pkgs,
|
||||
lib,
|
||||
system,
|
||||
config,
|
||||
osConfig,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [zsh-powerlevel10k meslo-lgs-nf];
|
||||
@@ -39,6 +41,13 @@
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
'';
|
||||
|
||||
initExtra = builtins.readFile ./zshrc;
|
||||
# recall agenix secrets cannot be used at eval time, so we must do this trash
|
||||
# like what the fuck? I spent 4 hours figuring this out. will i ever reach nix nirvana?
|
||||
initExtra = ''
|
||||
${builtins.readFile ./zshrc}
|
||||
if [ -f "${osConfig.age.secrets.zsh_remote.path}" ]; then
|
||||
source "${osConfig.age.secrets.zsh_remote.path}"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ alias ytdl-mp3="yt-dlp -x --audio-format mp3 --audio-quality 0 -o '/home/synchro
|
||||
alias ntpsync="sudo ntpdate pool.ntp.org"
|
||||
# alias fb="cd /home/synchronous/code/tob/fb"
|
||||
alias nuid="echo 002141542"
|
||||
# alias gb="sh /home/synchronous/.scripts/bluetooth/gb.sh"
|
||||
alias gb="sh /etc/profiles/per-user/synchronous/bin/gb"
|
||||
alias gbdc="bluetoothctl disconnect"
|
||||
# alias sxhkdrc="vim /home/synchronous/.config/sxhkd/sxhkdrc"
|
||||
# alias bspwmrc="vim /home/synchronous/.config/bspwm/bspwmrc"
|
||||
|
||||
167
home/scripts/journal/nf.sh
Normal file
167
home/scripts/journal/nf.sh
Normal file
@@ -0,0 +1,167 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
main="/home/synchronous/journal"
|
||||
#main_dir="$main/abstract"
|
||||
#main="/home/synchronous/code/nm/notes"
|
||||
main_dir="$main/rest"
|
||||
rofi_prompt="/home/synchronous/.config/rofi/styles/prompt-search.rasi"
|
||||
len_maindir=${#main_dir}
|
||||
|
||||
search() {
|
||||
rs="$(find "$main_dir" -follow -printf "%T@ %Tc %p\n" | sort -n -r | cut -c"$((len_maindir + 56))"- | rg -a '\.md$')"
|
||||
rcv=$(echo "$rs" | rofi -dmenu -theme "$rofi_prompt")
|
||||
if [[ "$rcv" == "" ]]; then exit 1; fi
|
||||
if [[ $(echo "$rs" | rg "$rcv") ]]; then # check if we actually have our note
|
||||
alacritty -t "$rcv" -e nvim "$main_dir/$rcv" \
|
||||
-c "execute 'lua vim.g.goyo_if = 1' | Goyo | execute 'normal 4j' | set path+=$main_dir | autocmd BufEnter * let b:coc_suggest_disable=1" &!
|
||||
# -c "lua vim.g.goyo_if = 1"
|
||||
# -c "syntax match LinkPattern /[a-zA-Z0-9\-][a-zA-Z0-9\-]*\.md/" \
|
||||
# -c "highlight LinkPattern guifg=LightBlue gui=underline" \
|
||||
# -c "nnoremap <CR> :call CustomGf()<CR>" \
|
||||
# -c "nnoremap gf :call CustomGf()<CR>" \
|
||||
else
|
||||
|
||||
# if rcv doesn't contain md, add it
|
||||
if [[ $(echo "$rcv" | rg -v '\.md$') ]]; then
|
||||
rcv="$rcv.md"
|
||||
fi
|
||||
|
||||
no_md="${rcv%.md}"
|
||||
replaced="${no_md//[-_]/ }"
|
||||
# echo "lol"
|
||||
|
||||
alacritty -t "$rcv" -e nvim "$main_dir/$rcv" \
|
||||
-c "execute 'lua vim.g.goyo_if = 1' | Goyo | set path+=$main_dir | autocmd BufEnter * let b:coc_suggest_disable=1" \
|
||||
-c "call setline(1, ['---', 'title: $replaced', 'tags: ', '---', '']) | execute 'normal G'" &!
|
||||
# make sure standardized frontmatter is there
|
||||
fi
|
||||
}
|
||||
|
||||
open_daily() {
|
||||
alacritty -t "daily.md" -e nvim "$main/daily.md" \
|
||||
-c "Goyo | set path+=$main_dir" \
|
||||
-c "execute 'normal G'" \
|
||||
-c "lua vim.g.goyo_if = 1" &!
|
||||
}
|
||||
|
||||
open_todo() {
|
||||
alacritty -t "todo.md" -e nvim "$main/todo.md" \
|
||||
-c "execute 'lua vim.g.goyo_if = 1' | Goyo | set path+=$main_dir" &!
|
||||
# -c "execute 'normal G'"
|
||||
}
|
||||
|
||||
notes_find() {
|
||||
rg $2 $main_dir
|
||||
}
|
||||
|
||||
search_by_tags() {
|
||||
tt=""
|
||||
# while IFS= read -r -d '' file; do
|
||||
# is_tags=$(awk 'NR==3 {print substr($0, 1, 4)}' "$file")
|
||||
# if [[ $is_tags == "tags" ]]; then
|
||||
# line=$(sed -n '3p' "$file")
|
||||
# tt+=$(echo "$file" | cut -c"$((len_maindir + 2))"- )
|
||||
# tt+=" [$(echo "$line" | cut -c7-)]\n"
|
||||
# fi
|
||||
# done < <(find $main_dir -type f -print0)
|
||||
|
||||
rs="$(find "$main_dir" -follow -printf "%T@ %Tc %p\n" | sort -n -r | cut -c"$((len_maindir + 49))"- | rg -a '\.md$')"
|
||||
|
||||
while IFS= read -r -d '' file; do
|
||||
{ read -r _; read -r _; read -r line; } < "$file"
|
||||
|
||||
if [[ ${line:0:4} == "tags" ]]; then
|
||||
tags="${line:6}"
|
||||
tags="${tags#"${tags%%[![:space:]]*}"}"
|
||||
tags="${tags%"${tags##*[![:space:]]}"}"
|
||||
filename="${file:$((len_maindir + 1))}"
|
||||
tt+="$filename [$tags]\n"
|
||||
fi
|
||||
done < <(find "$main_dir" -type f -print0)
|
||||
|
||||
rcv=$(echo -e "$tt" | awk 'NR > 1 {print prev} {prev=$0} END {printf "%s", prev}' | rofi -dmenu -theme "$rofi_prompt")
|
||||
rcv=$(echo $rcv | sed 's/ \[[^]]*\]$//')
|
||||
if [[ "$rcv" == "" ]]; then exit 1; fi
|
||||
if [[ $(echo "$rs" | rg "$rcv") ]]; then # check if we actually have our note
|
||||
alacritty -t "$rcv" -e nvim "$main_dir/$rcv" \
|
||||
-c "execute 'lua vim.g.goyo_if = 1' | Goyo | execute 'normal 4j' | set path+=$main_dir | autocmd BufEnter * let b:coc_suggest_disable=1" &!
|
||||
else
|
||||
|
||||
# if rcv doesn't contain md, add it
|
||||
if [[ $(echo "$rcv" | rg -v '\.md$') ]]; then
|
||||
rcv="$rcv.md"
|
||||
fi
|
||||
|
||||
no_md="${rcv%.md}"
|
||||
replaced="${no_md//[-_]/ }"
|
||||
|
||||
alacritty -t "$rcv" -e nvim "$main_dir/$rcv" \
|
||||
-c "execute 'lua vim.g.goyo_if = 1' | Goyo | set path+=$main_dir | autocmd BufEnter * let b:coc_suggest_disable=1" \
|
||||
-c "call setline(1, ['---', 'title: $replaced', 'tags: ', '---', '']) | execute 'normal G'" &!
|
||||
fi
|
||||
}
|
||||
|
||||
search_by_title() {
|
||||
# tt=""
|
||||
# while IFS= read -r -d '' file; do
|
||||
# is_title=$(awk 'NR==2 {print substr($0, 1, 5)}' "$file")
|
||||
# if [[ $is_title == "title" ]]; then
|
||||
# line=$(sed -n '2p' "$file")
|
||||
# # tt+="$(echo "$line" | cut -c7-)"
|
||||
# tt+="$(echo "$line" | cut -c7- | sed 's/^ *//; s/ *$//')"
|
||||
# tt+=' ('$(echo "$file" | cut -c"$((len_maindir + 2))"- )')\n'
|
||||
# fi
|
||||
# done < <(find $main_dir -type f -print0)
|
||||
|
||||
rs="$(find "$main_dir" -follow -printf "%T@ %Tc %p\n" | sort -n -r | cut -c"$((len_maindir + 49))"- | rg -a '\.md$')"
|
||||
|
||||
tt=""
|
||||
while IFS= read -r -d '' file; do
|
||||
{ read -r _; read -r line; } < "$file"
|
||||
|
||||
if [[ ${line:0:5} == "title" ]]; then
|
||||
title="${line:6}"
|
||||
|
||||
title="${title#"${title%%[![:space:]]*}"}"
|
||||
title="${title%"${title##*[![:space:]]}"}"
|
||||
filename="${file:$((len_maindir + 1))}"
|
||||
tt+="$title ($filename)\n"
|
||||
fi
|
||||
done < <(find "$main_dir" -type f -print0)
|
||||
|
||||
rcv=$(echo -e "$tt" | awk 'NR > 1 {print prev} {prev=$0} END {printf "%s", prev}' | rofi -dmenu -theme "$rofi_prompt")
|
||||
rcv=$(echo $rcv | rg -e "[a-zA-Z0-9]*\.md" -o)
|
||||
if [[ "$rcv" == "" ]]; then exit 1; fi
|
||||
# echo "$rcv"
|
||||
if [[ $(echo "$rs" | rg "$rcv") ]]; then # check if we actually have our note
|
||||
alacritty -t "$rcv" -e nvim "$main_dir/$rcv" \
|
||||
-c "execute 'lua vim.g.goyo_if = 1' | Goyo | execute 'normal 4j' | set path+=$main_dir | autocmd BufEnter * let b:coc_suggest_disable=1" &!
|
||||
else
|
||||
|
||||
# if rcv doesn't contain md, add it
|
||||
if [[ $(echo "$rcv" | rg -v '\.md$') ]]; then
|
||||
rcv="$rcv.md"
|
||||
fi
|
||||
|
||||
no_md="${rcv%.md}"
|
||||
replaced="${no_md//[-_]/ }"
|
||||
|
||||
alacritty -t "$rcv" -e nvim "$main_dir/$rcv" \
|
||||
-c "execute 'lua vim.g.goyo_if = 1' | Goyo | set path+=$main_dir | autocmd BufEnter * let b:coc_suggest_disable=1" \
|
||||
-c "call setline(1, ['---', 'title: $replaced', 'tags: ', '---', '']) | execute 'normal G'" &!
|
||||
fi
|
||||
}
|
||||
|
||||
run_command() {
|
||||
case $1 in
|
||||
"search") search ;;
|
||||
"daily") open_daily ;;
|
||||
"todo") open_todo ;;
|
||||
"find") notes_find ;;
|
||||
"tags") search_by_tags ;;
|
||||
"title") search_by_title ;;
|
||||
*)
|
||||
esac
|
||||
}
|
||||
|
||||
run_command "$1"
|
||||
@@ -14,7 +14,7 @@ if git --git-dir /home/synchronous/nix-cfg/.git diff-index --quiet HEAD; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/run/current-system/sw/bin/nix flake check /home/synchronous/nix-cfg/ || { echo "Flake check failed. Exiting."; exit 1; }
|
||||
# /run/current-system/sw/bin/nix flake check /home/synchronous/nix-cfg/ || { echo "Flake check failed. Exiting."; exit 1; }
|
||||
|
||||
# Autoformat your nix files
|
||||
alejandra . &>/dev/null \
|
||||
@@ -34,8 +34,10 @@ git status --porcelain
|
||||
echo ""
|
||||
echo "NixOS Rebuilding..."
|
||||
|
||||
prev=$(basename $(readlink /run/current-system) | sed 's/.*nixos-system-\(.*\)-.*$/\1/')
|
||||
|
||||
# Rebuild, output simplified errors, log trackebacks
|
||||
sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /home/synchronous/nix-cfg/flake.nix 2>&1 | tee /tmp/nixos-switch.log
|
||||
sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /home/synchronous/nix-cfg/flake.nix#"$prev" 2>&1 | tee /tmp/nixos-switch.log
|
||||
|
||||
# cat /tmp/nixos-switch.log | grep --color error && exit 1
|
||||
|
||||
|
||||
2
home/scripts/res.sh
Normal file
2
home/scripts/res.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
export SCREEN_RES=$(xrandr | grep "*" | awk '{print $1}')
|
||||
@@ -6,6 +6,6 @@
|
||||
imports = [
|
||||
./picom/default.nix
|
||||
./dunst/default.nix
|
||||
./gpg-agent/default.nix
|
||||
# ./gpg-agent/default.nix
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user