Feat: New Scripts, new functions

This commit is contained in:
coolnsx
2025-10-22 14:17:33 +05:30
parent 135b8ce642
commit 46ba34c8e5
26 changed files with 469 additions and 353 deletions

View File

@@ -1,7 +1,7 @@
################### File Generated by Goverlay ###################
legacy_layout=false
horizontal
background_alpha=0.4
round_corners=10
background_alpha=0.4
@@ -15,15 +15,23 @@ pci_dev=0:04:00.0
table_columns=3
gpu_text=Vega 12
gpu_stats
gpu_load_change
gpu_load_value=50,90
gpu_load_color=FFFFFF,FFAA7F,CC0000
gpu_temp
gpu_color=2E9762
cpu_text=r7 7730U
cpu_stats
cpu_temp
cpu_load_change
cpu_load_value=50,90
cpu_load_color=FFFFFF,FFAA7F,CC0000
cpu_temp
cpu_power
cpu_color=2E97CB
vram
vram_color=AD64C1
vram_color=AD64C1
ram
ram_color=C26693
fps
@@ -31,6 +39,9 @@ fps_limit_method=late
toggle_fps_limit=Shift_L+F1
fps_limit=0
fps_color_change
fps_color=B22222,FDFD09,39F900
fps_value=30,60
#offset=0
vsync=3
gl_vsync=-1
@@ -43,5 +54,6 @@ output_folder=/home/tanveer
log_duration=30
autostart_log=0
log_interval=500
toggle_logging=none
toggle_logging=Shift_L+F2
blacklist=pamac-manager,lact,ghb,bitwig-studio,ptyxis,yumex

View File

@@ -1,7 +1,7 @@
[FileDialog]
history=@Invalid()
lastVisited=file:///home/tanveer/Downloads
qtVersion=5.15.15
lastVisited=file:///home/tanveer
qtVersion=6.9.1
shortcuts=file:, file:///home/tanveer
sidebarWidth=48
treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xb8\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xe8\0\0\0\x1\0\0\0\0\0\0\0\x36\0\0\0\x1\0\0\0\0\0\0\0:\0\0\0\x1\0\0\0\0\0\0\0`\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff)

2
electron-flags.conf Normal file
View File

@@ -0,0 +1,2 @@
--enable-features=WaylandWindowDecorations
--ozone-platform-hint=auto

View File

@@ -43,7 +43,7 @@
:y "25"
:width "30%"
:height "40px"
:anchor "top left")
:anchor "bottom left")
:stacking "bg"
:reserve (struts :distance "10px" :side "bottom")
:windowtype "dock"
@@ -66,7 +66,7 @@
(defpoll song :interval "1s" "./script songdata")
(defpoll STATUS :interval "0.3s" "./script status")
(defpoll CURRENT :interval "0.3s" "./script time")
(defpoll LYRICS :interval "0.4s" "./script lyrics")
(defpoll LYRICS :interval "0.3s" "./script lyrics")
(defwidget music []
(box :class "genwin" :orientation "h" :spacing 40 :space-evenly "false" :vexpand "false" :hexpand "false"

View File

@@ -36,10 +36,10 @@ case $1 in
echo cycle pause | socat - "$datadir/yt-music-mpvsocket"
;;
next)
pgrep -f mpvsocket >/dev/null 2>&1 && "$HOME/repos_scripts/yt-music" play_next
pgrep -f mpvsocket >/dev/null 2>&1 && flock -n /tmp/yt-music/play_next.lock "$HOME/repos_scripts/yt-music" play_next
;;
prev)
pgrep -f mpvsocket >/dev/null 2>&1 && counter=$(cat "$datadir/counter") && [ "$counter" -gt 0 ] && "$HOME/repos_scripts/yt-music" play "$(sed -n "${counter}p" "$datadir/next")" && printf "%s" "$((counter-1))" > "$datadir/counter" &
pgrep -f mpvsocket >/dev/null 2>&1 && counter=$(cat "$datadir/counter") && [ "$counter" -gt 0 ] && flock -n /tmp/yt-music/play_prev.lock "$HOME/repos_scripts/yt-music" play "$(sed -n "${counter}p" "$datadir/next")" && printf "%s" "$((counter-1))" > "$datadir/counter" &
;;
seek)
echo '{"command" :["seek" ,"'"$2"'","relative-percent"]}' | socat - "$datadir/yt-music-mpvsocket"

View File

@@ -1 +1,2 @@
file:///home/tanveer/Downloads Downloads
file:///home/tanveer/.config/wall

View File

@@ -1,6 +1,6 @@
[Settings]
gtk-theme-name=Materia-dark
gtk-icon-theme-name=ePapirus-Dark
gtk-icon-theme-name=Papirus-Dark
gtk-font-name=IBM Plex Sans 13
gtk-cursor-theme-name=Adwaita
gtk-cursor-theme-size=0

View File

@@ -2,25 +2,22 @@
#script for bookmarking selected items and later using it..
data="$(wl-paste -p | tr '\n' '\`' | sed 's/$/ /g')"
data="$(wl-paste -p | tr '\n' '\`' | sed 's/$/ /g' | base64)"
file="$HOME/.cache/bookmarks"
oshi_file="$HOME/.cache/oshi-urls"
menu() {
bemenu --fn 'IBM Plex Sans 15' -i -c -W 0.6 -B 3 -l 30 -p "$1" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT"
bemenu -R 20 --fn 'IBM Plex Sans 15' -i -c -W 0.6 -B 3 -l 30 -p "$1" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT"
}
case $1 in
add)
if [ -z "$data" ]; then
notify-send -e "Please select anything to bookmark"
elif grep -q "${data}" "$file"; then
notify-send -e -i "bookmark-missing" "Already bookmarked"
else
printf "%s" "$data" >>"$file"
notify-send -e -i "user-bookmarks" "Bookmarked" "$data"
fi
[ -z "$data" ] && notify-send -e "Please select anything to bookmark" && exit 1
grep -q "${data}" "$file" && notify-send -e -i "bookmark-missing" "Already bookmarked" && exit 1
label=$(cut -d '|' -f1 .cache/bookmarks | sed '/^$/d' | tr -d ' ' | menu "Enter Label : ")
[ -z "$label" ] && notify-send -e "Please enter label for identification" && exit 1
printf "%s | %s" "$label" "$data" >>"$file"
notify-send -e -i "user-bookmarks" "Bookmarked" "$label | $data"
;;
rm)
data="$(sed '/^$/d' "$file" | nl -n'ln')"
@@ -29,12 +26,12 @@ case $1 in
[ -z "$del" ] || (sed -i "${del}d" "$file" && notify-send -e -i "bookmark-missing" "Bookmark deleted" -u critical)
;;
copy)
data=$(sed '/^$/d' "$file" "$oshi_file" | sed -E 's/.*DL: ([^|]*).*/\1/g' | menu "COPY-bookmark :" | tr '\`' '\n')
data=$(sed '/^$/d' "$file" | menu "COPY-bookmark :" | cut -d'|' -f2 | tr -d ' ' | base64 -d | tr '\`' '\n')
[ -z "$data" ] && notify-send -e -u critical "No Bookmark selected" && exit 1
printf '%s' "$data" | wl-copy && notify-send -e "Copied to clipboard" -i "com.github.davidmhewitt.clipped"
;;
*)
result="$(sed '/^$/d' "$file" "$oshi_file" | sed -E 's/.*DL: ([^|]*).*/\1/g' | menu "Put-bookmark :" | tr '\`' '\n')"
result="$(sed '/^$/d' "$file" | menu "Put-bookmark :" | cut -d'|' -f2 | tr -d ' ' | base64 -d | tr '\`' '\n')"
if printf '%s' "$result" | grep -q 'B>'; then
google-chrome-stable "$(printf '%s' "$result" | cut -d'>' -f2- | tr -d '\n ')"
else

View File

@@ -30,7 +30,7 @@ max=$(cat "$root_dir/$backlight_dir/max_brightness")
#runtime values
opr=$1 # [+|-], required
increment=${2:-5} # [ default:5, optional] "around 2% brightness"
increment=${2:-1296} # [ default:1296, optional] "around 2% brightness"
#shellcheck disable=SC2004
[ "$opr" = "s" ] && printf "%s" "$((${current}00/${max}))" && exit 0

View File

@@ -46,6 +46,7 @@ input {
touchpad {
natural_scroll = yes
drag_lock = 0
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
@@ -107,15 +108,13 @@ dwindle {
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = true
workspace_swipe_fingers = 3
gesture = 3, horizontal, workspace
#gesture = 3, up, fullscreen,maximize
}
misc {
force_default_wallpaper = 0
vfr = 1
#vrr = 1
#no_direct_scanout = false
}
xwayland {
@@ -191,6 +190,7 @@ bind = $mainMod SHIFT, Print, exec, $hypr_dir/screenshot 'fullclip'
bind = $mainMod,Print, exec, $hypr_dir/screenshot 'fullsave'
bind = $mainMod, F12, exec, $hypr_dir/date
bind = $mainMod, Delete, exec, $hypr_dir/workspace 'list'
bind = $mainMod SHIFT, M, exec, $hypr_dir/pinmpv
#xf86 keys
binde =, XF86AudioLowerVolume, exec, $hypr_dir/volume set-volume -l 1.4 @DEFAULT_SINK@ 2%-
@@ -200,8 +200,8 @@ binde =, XF86AudioMicMute, exec, $hypr_dir/volume set-mute @DEFAULT_SOURCE@ togg
binde =, XF86AudioPlay, exec, echo cycle pause | socat - "/tmp/yt-music/yt-music-mpvsocket"
binde =, XF86AudioPause, exec, echo cycle pause | socat - "/tmp/yt-music/yt-music-mpvsocket"
binde = $mainMod, XF86Favorites, exec, $HOME/repos_scripts/yt-music search_play #why not :)
binde =, XF86HangupPhone, exec, $HOME/repos_scripts/yt-music play_next
binde =, XF86PickupPhone, exec, $HOME/repos_scripts/yt-music play_next menu
binde =, XF86HangupPhone, exec, flock -n /tmp/yt-music/play_next.lock $HOME/repos_scripts/yt-music play_next
binde =, XF86PickupPhone, exec, flock -n /tmp/yt-music/play_next_menu.lock $HOME/repos_scripts/yt-music play_next menu
binde =, XF86MonBrightnessUp, exec, $hypr_dir/brightness '+'
binde =, XF86MonBrightnessDown, exec, $hypr_dir/brightness '-'
bind = , XF86SelectiveScreenshot, exec, $hypr_dir/screenshot 'selclip'
@@ -226,6 +226,7 @@ windowrulev2 = size 640 360, title:(Picture-in-Picture)
windowrulev2 = pin, title:^(Picture-in-Picture)$
windowrulev2 = move 100%-641 100%-361, title:(Picture-in-Picture)
windowrulev2 = float, title:^(Picture-in-Picture)$
windowrulev2 = float, class:^(xdg-desktop-portal-gtk)$
#workspace rules
workspace = 1, on-created-empty:$browser
@@ -233,11 +234,12 @@ workspace = 2, on-created-empty:foot
workspace = special, on-created-empty:[float] foot
#startup applications
exec-once = systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP QT_QPA_PLATFORMTHEME GTK_THEME
exec-once = dbus-update-activation-environment --systemd --all
exec-once = hypridle
exec-once = ssh-agent
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once = swaybg -i $HOME/.config/wall/1.png -m fill
exec-once = swaybg -i $HOME/.config/wall/4.jpg -m fill
exec-once = $hypr_dir/workspace 'focus'
exec-once = $hypr_dir/battery
exec-once = $hypr_dir/themes

21
hypr/pinmpv Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
# make window floating
hyprctl dispatch togglefloating
socket_file="/tmp/jellyfin-mpvsocket"
# use fallback if specified file doesn't exist
[ -e "$socket_file" ] || socket_file="/tmp/mpvsocket"
# dimension to resize the mpv window
dimension=$(printf '{ "command": ["get_property", "width"] }\n{ "command": ["get_property", "height"] }\n' | socat - "$socket_file" | sed -nE 's|.*"data":([^,]*),.*|\1|p' | tr '\n' ' ')
# resize window to match video resolution
hyprctl dispatch resizeactive exact $dimension
# move window to bottom right
hyprctl dispatch movewindow r
hyprctl dispatch movewindow d
#pin
#hyprctl dispatch pin

View File

@@ -1,6 +1,6 @@
#!/bin/sh
gamedir="$HOME/games"
gamedir="$HOME/Games"
games=$(find "$gamedir" -maxdepth 5 -type f -name '*.exe' -executable | sed "s|$gamedir/||g;/[U|u]nin.*/d")
@@ -19,6 +19,6 @@ trap 'wineserver -k' INT HUP
#DXVK_CONFIG=dxgi.hideAmdGpu=True WINEFSYNC=1 WINEESYNC=1 MANGOHUD=1 gamescope -W 1280 -H 800 -r 60 -- gamemoderun wine "$gamename"
#hyprctl keyword monitor "eDP-1",'1280x800@120','auto','1'
WINEFSYNC=1 WINEESYNC=1 MANGOHUD=1 gamemoderun wine "$gamename" -windowed
#hyprctl keyword monitor "eDP-1",highrr,'auto','1.5'
#hyprctl keyword monitor "eDP-1",'1280x800@60','auto','1'
WINEFSYNC=1 WINEESYNC=1 MANGOHUD=1 env -u DISPLAY gamemoderun wine "$gamename"
#hyprctl keyword monitor "eDP-1",highrr,'auto','1'

View File

@@ -1,5 +1,5 @@
#!/bin/sh
gsettings set org.gnome.desktop.interface gtk-theme Materia-dark
gsettings set org.gnome.desktop.interface icon-theme ePapirus-Dark
gsettings set org.gnome.desktop.interface icon-theme Papirus-Dark
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'

View File

@@ -17,7 +17,7 @@ setup_dual_monitor() {
handle_it() {
[ -z "$1" ] || notify-send -e "$1"
choice=$(printf "Extend\nMirror" | bemenu --fn 'IBM Plex Sans 15' -i -c -W 0.2 -B 3 -l 20 -p "what to do??: " -m 1 --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT")
choice=$(printf "Extend\nMirror" | bemenu -R 20 --fn 'IBM Plex Sans 15' -i -c -W 0.2 -B 3 -l 20 -p "what to do??: " -m 1 --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT")
[ -z "$choice" ] && return 0
notify-send -e "${choice}ing screen"
if [ "$choice" = "Extend" ]; then
@@ -44,7 +44,7 @@ case $1 in
printf "%s" "$line" | grep -q "monitoraddedv2" && handle_it "$line"
#recent workspace switcher
current=$(printf "%s" "$line" | sed -nE 's_^(workspace)v2>>([^,]*),.*_\1 \2_p')
notify-send -e -i "lol" "$current" -h "string:x-canonical-private-synchronous:monitor" -t 700 2>/dev/null
[ -n "$current" ] && notify-send -e -i "lol" "$current" -h "string:x-canonical-private-synchronous:monitor" -t 700 2>/dev/null
done
;;
toggle)

12
kdeglobals Normal file
View File

@@ -0,0 +1,12 @@
[General]
TerminalApplication=foot
[Icons]
Theme=Papirus-Dark
[PreviewSettings]
EnableRemoteFolderThumbnail=false
MaximumRemoteSize=0
[UiSettings]
ColorScheme=Materia-dark

View File

@@ -8,6 +8,7 @@ x-scheme-handler/https=firefox.desktop
x-scheme-handler/about=firefox.desktop
x-scheme-handler/unknown=firefox.desktop
image/png=nsxiv.desktop
image/webp=nsxiv.desktop
plain/text=nvim.desktop
text/x-python=nvim.desktop
text/english=nvim.deskop

View File

@@ -1,6 +1,7 @@
hwdec=auto
profile=gpu-hq
gpu-context=wayland
demuxer-max-bytes=300MiB
input-ipc-server=/tmp/mpvsocket
# Optimized shaders for lower-end GPU: Mode A (Fast)
glsl-shaders="~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/Anime4K_Restore_CNN_M.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl:~~/shaders/Anime4K_AutoDownscalePre_x2.glsl:~~/shaders/Anime4K_AutoDownscalePre_x4.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_S.glsl"

View File

@@ -59,33 +59,12 @@ local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
local lspconfig = require('lspconfig')
local configs = require ('lspconfig.configs')
--for enabling intelephense
if not configs.intelephense then
configs.intelephense = {
default_config = {
cmd = { 'intelephense', '--stdio' };
filetypes = { 'php' };
root_dir = function ()
return vim.loop.cwd();
end;
settings = {
intelephense = {
files = {
maxSize = 1000000;
};
}
}
}
}
end
--for enabling phpactor
lspconfig.phpactor.setup{
on_attach = on_attach,
init_options = {
["language_server_phpstan.enabled"] = false,
["language_server_phpstan.enabled"] = true,
["language_server_psalm.enabled"] = false,
}
}

View File

@@ -1,26 +1,26 @@
{
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"LuaSnip": { "branch": "master", "commit": "66b5c2707e624dcd2cd3605676c64a2efe47e9d1" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2daa8921b7afdcfa47419a21ea343c3df6d74fa0" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c2465eb07db648026eee81005a659abe26e6d077" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"monokai-pro.nvim": { "branch": "main", "commit": "8ba1fea7774e7c522b006091a9adb32b5cef95b9" },
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
"nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "a6070b4e9e9a8ff1bc513c3748eff27080b0f44a" },
"nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" },
"nvim-lspconfig": { "branch": "master", "commit": "f1405c1ea5d7a1051a8ced3110d7cf3b8524041b" },
"nvim-dap": { "branch": "master", "commit": "1c75a797b4017fec6491f509cf196c8c8833f26f" },
"nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" },
"nvim-lspconfig": { "branch": "master", "commit": "7fac9025a967a4d0846660f751cd392fac6bb788" },
"nvim-parinfer": { "branch": "master", "commit": "5ca09287ab3f4144f78ff7977fabc27466f71044" },
"nvim-treesitter": { "branch": "master", "commit": "2a75d8065cff33216e106b651eb0f58b90375717" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"packer.nvim": { "branch": "master", "commit": "ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }
}

View File

@@ -25,8 +25,8 @@ focus_previous=0
side_pane_mode=places
view_mode=list
show_hidden=0
sort=desc;ascending;
columns=name:200;desc:143;size;mtime:1143;
sort=name;ascending;
columns=name:200;desc:143;size:76;mtime:127;
toolbar=newtab;navigation;home;
show_statusbar=1
pathbar_mode_buttons=0

BIN
wall/10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

View File

@@ -1,11 +1,3 @@
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette
{
"terminal": {
"dock": "bottom"
@@ -14,17 +6,22 @@
"dock": "right"
},
"features": {
"inline_completion_provider": "none"
"edit_prediction_provider": "none"
},
"ssh_connections": [
{
"host": "se-live",
"projects": [
{
"paths": ["/var/www/qa/student_edge_admin"]
"paths": ["/var/www/html/student_edge_admin"]
}
]
},
{
"paths": ["/var/www/html/student_edge_admin"]
"host": "se-gcp",
"projects": [
{
"paths": ["/var/www/qa/student_edge_admin"]
}
]
}
@@ -35,10 +32,11 @@
},
"soft_wrap": "editor_width",
"ui_font_size": 16,
"buffer_font_size": 14,
"buffer_font_size": 14.0,
"ui_font_family": "IBM Plex Sans",
"buffer_font_family": "Helvetica",
"format_on_save": "off",
"tab_size": 4,
"format_on_save": "on",
"theme": {
"mode": "dark",
"light": "Base16 Monokai",
@@ -46,7 +44,8 @@
},
"languages": {
"PHP": {
"language_servers": ["intelephense", "!phpactor"]
"language_servers": ["intelephense","!phpactor"],
"format_on_save": "off"
}
}
}

View File

@@ -34,6 +34,15 @@
"reveal": "always",
"hide": "never",
"shell": "system"
},
{
"label": "Docker Compose Deploy",
"command": "deploy up --build",
"use_new_terminal": false,
"allow_concurrent_runs": false,
"reveal": "always",
"hide": "never",
"shell": "system"
}
]

15
zsh/completions/_screen Normal file
View File

@@ -0,0 +1,15 @@
#compdef yt-music
local -a subcmds
subcmds=(
'record:shows the record page, then starts recording'
'stop:stops the current recording.'
'compress:compress the given video to target size (default: 25 MB)'
)
if (( $#words > 3 )); then
return 1
fi
# Describe the available subcommands
_describe 'command' subcmds

318
zsh/zsh_functions Normal file
View File

@@ -0,0 +1,318 @@
##########################
# user-defined functions #
##########################
########
# misc #
########
hex_to_string() {
for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do
[ "$hex" = "00" ] && continue
printf "\x$hex"
done
unset hex
}
megamind() {
len=$(printf '%s' "$*" | wc -c)
printf "———————————%s———————————
⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝
⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇
⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀
⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀
⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀
⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀
⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
——————————————————————" "$*"
for i in $(seq $len); do
printf '—'
done
printf '\n'
unset len
}
b64() {
# base64 wrapper , also converts url base64
printf "%s" "$1" | tr "._-" '=/+' | base64 -w 0 $2
}
deploy() {
source ./.env
ext="yml"
docker_compose_file="docker-compose"
[ "$APP_ENV" = "dev" ] && docker_compose_file="docker-compose-dev"
[ -f "$docker_compose_file.$ext" ] || ext="yaml"
[ ! -f "$docker_compose_file.$ext" ] && printf "Docker compose file not found." && return 1
systemctl is-active docker.socket || systemctl start docker.socket
docker compose -f "$docker_compose_file.$ext" "$@"
docker compose -f "$docker_compose_file.$ext" down
}
clshist() {
tmpfile="${TMPDIR:-/tmp}/histfile"
# keep recent entries at bottom
tac "$HISTFILE" | awk '!seen[$0]++' | tac >"$tmpfile"
# Trim to HISTSIZE (default:1000)
local total_lines
total_lines=$(wc -l <"$tmpfile")
if [ "$total_lines" -gt "${HISTSIZE:-1000}" ]; then
sed -i "1,$((total_lines - HISTSIZE))d" "$tmpfile"
fi
# Replace original file
mv "$tmpfile" "$HISTFILE"
}
v() {
[ -z "$*" ] && nvim -O $(fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}' -m | tr '\n' ' ') || nvim -O $*
}
help() {
"$@" --help 2>&1 | bat --plain --language=help
}
#########################
# Git Related Functions #
#########################
gtp() {
[ -z "$*" ] && commit=$(curl -s "https://raw.githubusercontent.com/ngerakines/commitment/master/commit_messages.txt" | shuf -n1) || commit=$*
git add -p
git commit -m "$commit"
git push
unset commit
}
gtb() {
[ -z "$*" ] && br=$(git branch -a | fzf --border=rounded --layout=reverse --height=10 | tr -d ' ') || br=$*
[ -z "$br" ] || git switch $br
unset br
}
gtd() {
preview="git diff $@ --color=always -- {-1}"
file=$(git diff $@ --name-only --relative | fzf --ansi --preview $preview --preview-window right:65%:wrap -0)
[ -n "$file" ] && nvim $file
unset preview file
}
gtc() {
[ -z "$1" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$1
git clone "$query"
}
gtr() {
source "$HOME"/.config/.env
github_creds #load creds
[ -z "$1" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$1
curl -s "https://api.github.com/users/$query/repos" -H "Authorization: Bearer $GH_TOKEN" | sed -nE 's|.*ssh_url": "([^"]*)".*|\1|p' | fzf --border --height=10 --layout=reverse -0
github_creds unload
}
gtu() {
source "$HOME"/.config/.env
github_creds #load creds
[ -z "$1" ] || curl -s "https://api.github.com/search/users?q=$1" -H "Authorization: Bearer $GH_TOKEN" | sed -nE 's_.*login": "([^"]*)".*_\1_p' | fzf --layout=reverse --border --height=10 -0
github_creds unload
}
##################################
# Using Android as Second Screen #
##################################
headless_add() {
set -x
#define ur preferred port
for PORT in {11000..11100}; do
! ss -tln | grep -q ":$PORT" && break
done
# check existing headless display
[ -z "$1" ] && headless=$(hyprctl monitors | sed -nE 's|.*(HEADLESS-[0-9]*).*|\1|p')
#create, if not exists
if [ -z "$headless" ]; then
hyprctl output create headless | grep -q "ok"
for i in $(hyprctl monitors | sed -nE 's|.*(HEADLESS-[0-9]*).*|\1|p'); do
pgrep -af "wayvnc --output=$i" && continue
headless=$i
done
printf '\n\nCreate Headless Display: %s' "$headless"
fi
#there is issue
[ -z "$headless" ] && printf "Something went wrong\n" && return 1
#check for android devices, and select which one u wanna work upon
device=$(adb devices | sed '/^\*/d;/^List of devices/d;/^$/d' | cut -f1 | fzf -1)
#throw issue if no android has been there
[ -z "$device" ] && printf "Unable to detect Android using ADB" && return 1
#select device resolution and fps
RES=$(adb -s "$device" shell dumpsys display | sed -nE 's|^[[:space:]]*DisplayModeRecord.*width=([0-9]*), height=([0-9]*), fps=([0-9\.]*).*|\2x\1@\3|p' | fzf --prompt="Select Resolution > " -1)
#device fps for wayvnc
device_fps=$(printf '%s' "$RES" | cut -d'@' -f2)
position=$(printf 'auto\nauto-left' | fzf --prompt="Which position? >")
# set resolution,fps, and scaling
hyprctl keyword monitor $headless,$RES,$position,'1'
# kill existing wayvnc and start a new one
#pgrep -af "wayvnc" && killall wayvnc
setsid -f wayvnc --output="$headless" --socket="/tmp/$headless" --max-fps="$device_fps" 0.0.0.0 $PORT
#reverse port forward to device, and start VNC
adb -s "$device" reverse tcp:$PORT tcp:$PORT
adb -s "$device" shell am start --user 0 -a android.intent.action.VIEW -d "vnc://127.0.0.1:$PORT"
#cleanup
unset PORT headless RES
hyprctl dispatch moveworkspacetomonitor 2 1
set +x
}
headless_rm() {
set -x
headless=$(hyprctl monitors | sed -nE 's|.*(HEADLESS-[0-9]*).*|\1|p' | fzf --prompt="Select Which Device to Remove >" -0 -1)
[ -n "$headless" ] && hyprctl output remove $headless
pid=$(pgrep -af "wayvnc --output=$headless" | cut -d' ' -f1)
kill -9 $pid
unset headless
set +x
}
###################################
# Cookies Extraction from browser #
###################################
get_cookies() {
# the user has firefox installed
logdir="/tmp"
if [ ! -f "$HOME/.config/google-chrome/Default/Cookies" ]; then
cp "$(find "$HOME/.mozilla" -type f -iname 'cookies.sqlite' | head -1)" "$logdir/cookies.sqlite"
sqlite3 "$logdir/cookies.sqlite" "SELECT name, value FROM moz_cookies WHERE host='$1';" | tr '|\n' '=;'
rm "$logdir/cookies.sqlite"
return 0
fi
for i in $(sqlite3 "$HOME/.config/google-chrome/Default/Cookies" "SELECT name,REPLACE(base64(SUBSTR(encrypted_value,4)),CHAR(10),'') FROM cookies WHERE host_key='$1';"); do
printf "%s=%s; " "$(printf '%s' "$i" | cut -d'|' -f1)" "$(printf '%s' "$i" | cut -d'|' -f2 | base64 -d | openssl enc -d -aes-128-cbc -K fd621fe5a2b402539dfa147ca9272778 -iv 20202020202020202020202020202020 | cut -c33-)"
done
}
#############################################
# Downloading | Streaming Related Functions #
#############################################
mkvcinemas() {
local base_url="https://mkvcinemas.ist"
local agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[ -z "$*" ] && printf "Search> " && read -r query || query="$*"
local movie=$(curl -s "$base_url/wp-admin/admin-ajax.php" -X POST -d "s=$query&action=searchwp_live_search&swpengine=default&swpquery=$query" -e "$base_url" -H "X-Requested-With:XMLHttpRequest" -L -A "$agent" | sed -nE 's|.*url\(([^\)]*).*href=".*/([^"]*)/".*|\1\t\2|p' | fzf -0 --preview="img2sixel {1} -w 280" --with-nth 2.. --layout=reverse --height=20 --border --preview-window right:36%:wrap | cut -f2)
[ -z "$movie" ] && printf "No Movie Found/Selected." && return 1
local url=$(curl -s "$base_url/$movie" -e "$base_url" -LA "$agent" | sed 's|<span>|\n|g' | sed -nE 's|.*title="([^"]*)" href="([^"]*)" target.*[>|;](.*)</a><.*|\2`[\3] \1|p;' | fzf -0 -d'`' --with-nth 2.. --layout=reverse --height=20 --border | cut -d'`' -f1)
[ -z "$url" ] && printf "No Url Selected" && return 1
xdg-open "$url"
}
gdown() {
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/13$(head /dev/urandom | tr -dc '6-8' | cut -c1).0.0.0 Safari/537.36"
uuid=$(curl -sL "$1" -A "$agent" | sed -nE 's|.*name="(uuid)" value="([^"]*)".*|\1=\2|p')
aria2c -x16 -s16 "$1&confirm=t&$uuid" -U "$agent" --summary-interval=0 -d "${2:-.}"
}
mpv_jellyfin() {
url=${1:-$(wl-paste)}
uuid=$(printf '%s' "$url" | sed -nE 's|.*/Items/([^/]*)/Download.*|\1|p')
key=$(printf '%s' "$url" | sed -nE 's|.*api_key=([^&]*)|\1|p')
formatted_uuid=$(printf '%s' "$uuid" | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{12})/\1-\2-\3-\4-\5/')
subtitle="$(printf '%s' "$url" | sed -nE 's|(.*)/Items/.*|\1|p')/Videos/$formatted_uuid/$uuid/Subtitles/0/0/Stream.ass?api_key=$key"
if ! curl -s "$subtitle" | grep -q "Error processing request."; then
sub_arg="--sub-file=$subtitle"
fi
setsid -f mpv "$url" $sub_arg
unset subtitle sub_arg uuid formatted_uuid key
}
####################################################
# Notification API, Sends Notification to my phone #
####################################################
ntfy() {
source $HOME/.config/.env
ntfy_creds #load
curl -s "$NTFY_URL/$NTFY_TOPIC" -d "$1" -H "Authorization: Bearer $NTFY_TOKEN" -H "Title: $2"
ntfy_creds "unload" #unload
}
############################################
# Functions for uploading file for sharing #
############################################
url_oshi() {
days=${2:-1}
out=$(curl -k https://oshi.at -F shorturl=0 -F "f=@$1" -F "expire=$((days * 1440))") #1440 means 1 day duration
[ -z "$out" ] && return 1
printf "%s" "$out" | sed -nE 's|DL: (.*)|\1|p' | wl-copy && notify-send "Link copied to clipboard"
wl-paste
curr=$(date '+%s')
#storing only long duration links
[ -z "$2" ] && printf "%s\n%s" "$out" "$((curr + (86400 * days)))" | tr '\n' '>' | sed 's/>/ | /g' >>$HOME/.cache/oshi-urls
#deleting file uploaded than nth day ago
for i in $(cut -d'|' -f3 $HOME/.cache/oshi-urls | tr -d ' '); do
[ "$curr" -ge "$i" ] && sed -i "/$i/d" $HOME/.cache/oshi-urls &
done
echo >>$HOME/.cache/oshi-urls
}
url_nextcloud() {
[ ! -f "$HOME/.config/.env" ] && notify-send "Credentials not found" -u critical && return 1
source "$HOME"/.config/.env
nextcloud_creds #load creds
cloudname="$(basename "$1")"
curl -u "$NC_USER:$NC_TOKEN" -s "$NC_URL/remote.php/dav/files/${NC_USER}${NC_SHARE_PATH}/$cloudname" -T "$tmp_file" || return 1
#To enable sharing, the output will be in json containing share link
curl -u "$NC_USER:$NC_TOKEN" -s "$NC_URL/ocs/v2.php/apps/files_sharing/api/v1/shares" -H 'content-type: application/json' -H 'accept: application/json, text/plain, */*' -H 'OCS-APIRequest: true' --data-raw '{"path":"'"${NC_SHARE_PATH}/$cloudname"'","shareType":3,"expireDate":"'"$expire_date"'"}' | sed -nE 's|.*"url":"([^"]*)".*|\1|p' | sed 's/\\//g' | wl-copy && info "com.github.davidmhewitt.clipped" "2000" "Share Link Created and copied to clipboard"
nextcloud_creds "unload"
}
##############################################
# Package Management Wrapper for Paru|Pacman #
##############################################
addpkg() {
[ -z "$*" ] && printf "\033[1;31mPlease write the name of package (just some words)..\033[0m" && return 1
packages=$(paru -Ss "$*" | sed -nE 's|^([a-zA-Z]*)/([^ ]*).*|[\1] \2|p' | fzf --layout=reverse --border --preview 'paru -Si $(echo {} | cut -d" " -f2) | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | cut -d' ' -f2- | tr '\n' ' ' | tr -d "'")
[ -z "$packages" ] && printf "\033[1;31mNo package selected..\033[0m" && return 1
paru -S $(printf "%s" "$packages")
}
rmpkg() {
packages=$(paru -Qq | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | tr '\n' ' ')
[ -z "$packages" ] && printf "\033[1;31mNo package selected..\033[0m" && return 1
paru -Rcns $(printf "%s" "$packages")
}
####################
# Open VPN Wrapper #
####################
vpn() {
query="${1:-stop}"
[ "$query" = "up" ] && query="start"
# check and stop if tailscale is running
[ "$query" = "start" ] && ! tailscale status | grep -qi 'tailscale is stopped' && doas tailscale down
doas systemctl $query openvpn-client@vpn.service && printf "Openvpn %sed" "$query"
}

263
zsh/zshrc
View File

@@ -1,268 +1,15 @@
#user-defined functions
hex_to_string() {
for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do
[ "$hex" = "00" ] && continue
printf "\x$hex"
done
unset hex
}
gtp() {
[ -z "$*" ] && commit=$(curl -s "https://raw.githubusercontent.com/ngerakines/commitment/master/commit_messages.txt" | shuf -n1) || commit=$*
git add -p
git commit -m "$commit"
git push
unset commit
}
megamind() {
len=$(printf '%s' "$*" | wc -c)
printf "———————————%s———————————
⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝
⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇
⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀
⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀
⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀
⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀
⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
——————————————————————" "$*"
for i in $(seq $len); do
printf '—'
done
printf '\n'
unset len
}
gtb() {
[ -z "$*" ] && br=$(git branch -a | fzf --border=rounded --layout=reverse --height=10 | tr -d ' ') || br=$*
[ -z "$br" ] || git checkout $br
unset br
}
b64() {
# base64 wrapper , also converts url base64
printf "%s" "$1" | tr "._-" '=/+' | base64 -w 0 $2
}
gdown () {
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '2-5' | cut -c1).0.0.0 Safari/537.36"
uuid=$(curl -sL "$1" -A "$agent" | sed -nE 's|.*(uuid=[^"]*)".*|\1|p')
aria2c -x16 -s16 "$1&confirm=t&$uuid" -U "$agent" --summary-interval=0 -d "${2:-.}"
}
mpv_jellyfin() {
url=${1:-$(wl-paste)}
uuid=$(printf '%s' "$url" | sed -nE 's|.*/Items/([^/]*)/Download.*|\1|p')
key=$(printf '%s' "$url" | sed -nE 's|.*api_key=([^&]*)|\1|p')
formatted_uuid=$(printf '%s' "$uuid" | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{12})/\1-\2-\3-\4-\5/')
subtitle="$(printf '%s' "$url" | sed -nE 's|(.*)/Items/.*|\1|p')/Videos/$formatted_uuid/$uuid/Subtitles/0/0/Stream.ass?api_key=$key"
if ! curl -s "$subtitle" | grep -q "Error processing request.";then
sub_arg="--sub-file=$subtitle"
fi
setsid -f mpv "$url" $sub_arg
unset subtitle sub_arg uuid formatted_uuid key
}
headless_add() {
set -x
#define ur preferred port
for PORT in {11000..11100};do
! ss -tln | grep -q ":$PORT" && break
done
# check existing headless display
[ -z "$1" ] && headless=$(hyprctl monitors | sed -nE 's|.*(HEADLESS-[0-9]*).*|\1|p')
#create, if not exists
if [ -z "$headless" ];then
hyprctl output create headless | grep -q "ok"
for i in $(hyprctl monitors | sed -nE 's|.*(HEADLESS-[0-9]*).*|\1|p');do
pgrep -af "wayvnc --output=$i" && continue
headless=$i
done
printf '\n\nCreate Headless Display: %s' "$headless"
fi
#there is issue
[ -z "$headless" ] && printf "Something went wrong\n" && return 1
#check for android devices, and select which one u wanna work upon
device=$(adb devices | sed '/^\*/d;/^List of devices/d;/^$/d' | cut -f1 | fzf -1)
#throw issue if no android has been there
[ -z "$device" ] && printf "Unable to detect Android using ADB" && return 1
#select device resolution and fps
RES=$(adb -s "$device" shell dumpsys display | sed -nE 's|^[[:space:]]*DisplayModeRecord.*width=([0-9]*), height=([0-9]*), fps=([0-9\.]*).*|\2x\1@\3|p' | fzf --prompt="Select Resolution > " -1)
#device fps for wayvnc
device_fps=$(printf '%s' "$RES" | cut -d'@' -f2)
position=$(printf 'auto\nauto-left' | fzf --prompt="Which position? >")
# set resolution,fps, and scaling
hyprctl keyword monitor $headless,$RES,$position,'1'
# kill existing wayvnc and start a new one
#pgrep -af "wayvnc" && killall wayvnc
setsid -f wayvnc --output="$headless" --socket="/tmp/$headless" --max-fps="$device_fps" 0.0.0.0 $PORT
#reverse port forward to device, and start VNC
adb -s "$device" reverse tcp:$PORT tcp:$PORT
adb -s "$device" shell am start --user 0 -a android.intent.action.VIEW -d "vnc://127.0.0.1:$PORT"
#cleanup
unset PORT headless RES
hyprctl dispatch moveworkspacetomonitor 2 1
set +x
}
headless_rm() {
set -x
headless=$(hyprctl monitors | sed -nE 's|.*(HEADLESS-[0-9]*).*|\1|p' | fzf --prompt="Select Which Device to Remove >" -0 -1)
[ -n "$headless" ] && hyprctl output remove $headless
pid=$(pgrep -af "wayvnc --output=$headless" | cut -d' ' -f1)
kill -9 $pid
unset headless
set +x
}
get_cookies() {
# the user has firefox installed
logdir="/tmp"
if [ ! -f "$HOME/.config/google-chrome/Default/Cookies" ];then
cp "$(find "$HOME/.mozilla" -type f -iname 'cookies.sqlite' | head -1)" "$logdir/cookies.sqlite"
sqlite3 "$logdir/cookies.sqlite" "SELECT name, value FROM moz_cookies WHERE host='$1';" | tr '|\n' '=;'
rm "$logdir/cookies.sqlite"
return 0
fi
for i in $(sqlite3 "$HOME/.config/google-chrome/Default/Cookies" "SELECT name,REPLACE(base64(SUBSTR(encrypted_value,4)),CHAR(10),'') FROM cookies WHERE host_key='$1';"); do
printf "%s=%s; " "$(printf '%s' "$i" | cut -d'|' -f1)" "$(printf '%s' "$i" | cut -d'|' -f2 | base64 -d | openssl enc -d -aes-128-cbc -K fd621fe5a2b402539dfa147ca9272778 -iv 20202020202020202020202020202020)"
done
}
mkvcinemas() {
local base_url="https://mkvcinemas.cymru"
local agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[ -z "$*" ] && printf "Search> " && read -r query || query="$*"
local movie=$(curl -s "$base_url/wp-admin/admin-ajax.php" -X POST -d "s=$query&action=searchwp_live_search&swpengine=default&swpquery=$query" -e "$base_url" -H "X-Requested-With:XMLHttpRequest" -L -A "$agent" | sed -nE 's|.*url\(([^\)]*).*href=".*/([^"]*)/".*|\1\t\2|p' | fzf -0 --preview="img2sixel {1} -w 280" --with-nth 2.. --layout=reverse --height=20 --border --preview-window right:36%:wrap | cut -f2)
[ -z "$movie" ] && printf "No Movie Found/Selected." && return 1
local url=$(curl -s "$base_url/$movie" -e "$base_url" -LA "$agent" | sed 's|<span>|\n|g' | sed -nE 's|.*title="([^"]*)" href="([^"]*)" target.*[>|;](.*)</a><.*|\2`[\3] \1|p;' | fzf -0 -d'`' --with-nth 2.. --layout=reverse --height=20 --border | cut -d'`' -f1)
[ -z "$url" ] && printf "No Url Selected" && return 1
xdg-open "$url"
}
ntfy() {
source $HOME/.config/.env
ntfy_creds #load
curl -s "$NTFY_URL/$NTFY_TOPIC" -d "$1" -H "Authorization: Bearer $NTFY_TOKEN" -H "Title: $2"
ntfy_creds "unload" #unload
}
url_oshi() {
days=${2:-1}
out=$(curl -k https://oshi.at -F shorturl=0 -F "f=@$1" -F "expire=$((days * 1440))") #1440 means 1 day duration
[ -z "$out" ] && return 1
printf "%s" "$out" | sed -nE 's|DL: (.*)|\1|p' | wl-copy && notify-send "Link copied to clipboard"
wl-paste
curr=$(date '+%s')
#storing only long duration links
[ -z "$2" ] && printf "%s\n%s" "$out" "$((curr + (86400 * days)))" | tr '\n' '>' | sed 's/>/ | /g' >>$HOME/.cache/oshi-urls
#deleting file uploaded than nth day ago
for i in $(cut -d'|' -f3 $HOME/.cache/oshi-urls | tr -d ' '); do
[ "$curr" -ge "$i" ] && sed -i "/$i/d" $HOME/.cache/oshi-urls &
done
echo >>$HOME/.cache/oshi-urls
}
url_nextcloud() {
[ ! -f "$HOME/.config/.env" ] && notify-send "Credentials not found" -u critical && return 1
source "$HOME"/.config/.env
nextcloud_creds #load creds
cloudname="$(basename "$1")"
curl -u "$NC_USER:$NC_TOKEN" -s "$NC_URL/remote.php/dav/files/${NC_USER}${NC_SHARE_PATH}/$cloudname" -T "$tmp_file" || return 1
#To enable sharing, the output will be in json containing share link
curl -u "$NC_USER:$NC_TOKEN" -s "$NC_URL/ocs/v2.php/apps/files_sharing/api/v1/shares" -H 'content-type: application/json' -H 'accept: application/json, text/plain, */*' -H 'OCS-APIRequest: true' --data-raw '{"path":"'"${NC_SHARE_PATH}/$cloudname"'","shareType":3,"expireDate":"'"$expire_date"'"}' | sed -nE 's|.*"url":"([^"]*)".*|\1|p' | sed 's/\\//g' | wl-copy && info "com.github.davidmhewitt.clipped" "2000" "Share Link Created and copied to clipboard"
nextcloud_creds "unload"
}
open_nc_aio() {
[ ! -f "$HOME/.config/.env" ] && notify-send "Credentials not found" -u critical && return 1
source "$HOME"/.config/.env
nextcloud_creds #load creds
xdg-open $(curl -s "$NC_URL/settings/admin/overview" -u "$NC_USER:$NC_TOKEN" | sed -nE 's|.* href="([^"]*)".*AIO.*|\1|p')
nextcloud_creds "unload"
}
gtd() {
preview="git diff $@ --color=always -- {-1}"
file=$(git diff $@ --name-only --relative | fzf --ansi --preview $preview --preview-window right:65%:wrap -0)
[ -n "$file" ] && nvim $file
unset preview file
}
gtc() {
[ -z "$1" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$1
git clone "$query"
}
gtr() {
[ -z "$1" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$1
curl -s "https://api.github.com/users/$query/repos" | sed -nE 's|.*ssh_url": "([^"]*)".*|\1|p' | fzf --border --height=10 --layout=reverse -0
}
gtu() { [ -z "$1" ] || curl -s "https://api.github.com/search/users?q=$1" | sed -nE 's_.*login": "([^"]*)".*_\1_p' | fzf --layout=reverse --border --height=10 -0; }
clshist() {
a=$(\cat ~/.histfile | wc -l)
[ "$a" -gt $HISTSIZE ] && sed -i "1,$((a - HISTSIZE))d" ~/.histfile
}
v() {
[ -z "$*" ] && nvim -O $(fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}' -m | tr '\n' ' ') || nvim -O $*
}
help() {
"$@" --help 2>&1 | bat --plain --language=help
}
addpkg() {
[ -z "$*" ] && printf "\033[1;31mPlease write the name of package (just some words)..\033[0m" && return 1
paru -Ss "$*" | sed -nE 's|^([a-zA-Z]*)/([^ ]*).*|[\1] \2|p' | fzf --layout=reverse --border --preview 'paru -Si $(echo {} | cut -d" " -f2) | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | cut -d' ' -f2- | paru -S -
}
rmpkg() {
paru -Qq | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | paru -Rcns -
}
#source user-defined functions
source "${${(%):-%x}:A:h}/zsh_functions"
# Alias and exports
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export TZ="Asia/Kolkata"
export PODMAN_COMPOSE_WARNING_LOGS=false
export PATH="$PATH:$HOME/repos_scripts:$HOME/.local/bin"
alias cat="bat -pp --color=always"
alias open="xdg-open"
alias cp="cp -v"
alias lsblk="lsblk -o 'NAME,SIZE,FSAVAIL,FSUSED,FSUSE%,MOUNTPOINTS'"
alias lsblk="lsblk -o 'NAME,SIZE,FSAVAIL,FSUSED,FSUSE%,FSTYPE,MOUNTPOINTS'"
alias art="php artisan"
alias rm="rm -v"
alias mv="mv -v"
@@ -274,7 +21,7 @@ alias ls="lsd --color=auto"
alias nchh="nvim ~/.config/hypr/hyprland.conf"
alias shfmt="shfmt -ci -d -w"
alias reboot_firmware="systemctl reboot --firmware-setup"
alias sail="PODMAN_COMPOSE_WARNING_LOGS=false ./vendor/bin/sail"
alias sail="./vendor/bin/sail"
#config
HISTFILE=~/.histfile