mirror of
https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles.git
synced 2025-09-15 09:45:58 +03:00
first commit
This commit is contained in:
33
home/.config/fish/functions/airplane_mode_toggle.fish
Normal file
33
home/.config/fish/functions/airplane_mode_toggle.fish
Normal file
@@ -0,0 +1,33 @@
|
||||
function airplane_mode_toggle
|
||||
set backup_file ~/.cache/airplane_backup
|
||||
|
||||
if test -e $backup_file
|
||||
# Read network states from the backup file
|
||||
set -l wifi_status (cat $backup_file | grep -o 'wifi:\(on\|off\)$' | cut -d':' -f2)
|
||||
set -l bluetooth_status (cat $backup_file | grep -o 'bluetooth:\(on\|off\)$' | cut -d':' -f2)
|
||||
|
||||
# Restore network states
|
||||
if test "$wifi_status" = "on"
|
||||
nmcli radio wifi on
|
||||
# else
|
||||
# nmcli radio wifi off
|
||||
end
|
||||
|
||||
if test "$bluetooth_status" = "on"
|
||||
rfkill unblock bluetooth
|
||||
# else
|
||||
# rfkill block bluetooth
|
||||
end
|
||||
|
||||
# Remove the backup file
|
||||
rm $backup_file
|
||||
else
|
||||
# Backup the current network states and turn off all networks
|
||||
echo "wifi:$(rfkill list wifi | grep -q "Soft blocked: no" && echo "on" || echo "off")" > $backup_file
|
||||
echo "bluetooth:$(rfkill list bluetooth | grep -qi "Soft blocked: no" && echo "on" || echo "off")" >> $backup_file
|
||||
# Add more lines to backup other network types if needed
|
||||
|
||||
nmcli radio wifi off
|
||||
rfkill block bluetooth
|
||||
end
|
||||
end
|
9
home/.config/fish/functions/bluetooth_toggle.fish
Normal file
9
home/.config/fish/functions/bluetooth_toggle.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function bluetooth_toggle
|
||||
set bluetooth_status (rfkill list bluetooth | grep -i -o "Soft blocked: yes")
|
||||
|
||||
if [ -z "$bluetooth_status" ]
|
||||
rfkill block bluetooth
|
||||
else
|
||||
rfkill unblock bluetooth
|
||||
end
|
||||
end
|
10
home/.config/fish/functions/bookmark_add.fish
Normal file
10
home/.config/fish/functions/bookmark_add.fish
Normal file
@@ -0,0 +1,10 @@
|
||||
function bookmark_add
|
||||
if [ -z $(wl-paste) ]
|
||||
dunstify "Bookmarks" "Can`t add empty space" -u critical -t 2000
|
||||
else if grep -q "^$(wl-paste)\$" .bookmarks
|
||||
dunstify "Bookmarks" "Bookmark '$(wl-paste)' already exists" -u critical -t 2000
|
||||
else
|
||||
wl-paste >> .bookmarks;
|
||||
dunstify "Bookmarks" "Bookmark '$(wl-paste)' was added" -t 2000
|
||||
end
|
||||
end
|
7
home/.config/fish/functions/bookmark_delete.fish
Normal file
7
home/.config/fish/functions/bookmark_delete.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function bookmark_delete
|
||||
set bookmark $(cat .bookmarks | rofi -dmenu -p 'delete bookmark')
|
||||
if not [ -z $bookmark ]
|
||||
sed -i -e /$bookmark/d .bookmarks
|
||||
dunstify "Bookmarks" "Bookmark '$bookmark' was deleted" -t 2000
|
||||
end
|
||||
end
|
3
home/.config/fish/functions/bookmark_to_type.fish
Normal file
3
home/.config/fish/functions/bookmark_to_type.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function bookmark_to_type
|
||||
cat .bookmarks | rofi -dmenu -p bookmarks | tr -d '\n' | wtype -
|
||||
end
|
9
home/.config/fish/functions/check_airplane_mode.fish
Normal file
9
home/.config/fish/functions/check_airplane_mode.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function check_airplane_mode
|
||||
set backup_file ~/.cache/airplane_backup
|
||||
|
||||
if test -e $backup_file
|
||||
echo "{ \"text\":\"\", \"tooltip\": \"airplane-mode <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
|
||||
else
|
||||
echo "{ \"text\":\"\", \"tooltip\": \"airplane-mode <span color='#ee99a0'>off</span>\", \"class\": \"off\" }"
|
||||
end
|
||||
end
|
7
home/.config/fish/functions/check_geo_module.fish
Normal file
7
home/.config/fish/functions/check_geo_module.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function check_geo_module
|
||||
set target_process "geoclue"
|
||||
|
||||
if pgrep $target_process > /dev/null
|
||||
echo "{\"text\":\"\", \"tooltip\":\"Geopositioning\", \"alt\":\"Geo\"}"
|
||||
end
|
||||
end
|
9
home/.config/fish/functions/check_night_mode.fish
Normal file
9
home/.config/fish/functions/check_night_mode.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function check_night_mode
|
||||
set target_process "gammastep"
|
||||
|
||||
if pgrep $target_process > /dev/null
|
||||
echo "{ \"text\":\"\", \"tooltip\": \"night-mode <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
|
||||
else
|
||||
echo "{ \"text\":\"\", \"tooltip\": \"night-mode <span color='#ee99a0'>off</span>\", \"class\": \"off\" }"
|
||||
end
|
||||
end
|
7
home/.config/fish/functions/check_recording.fish
Normal file
7
home/.config/fish/functions/check_recording.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function check_recording
|
||||
set target_process "wf-recorder"
|
||||
|
||||
if pgrep $target_process > /dev/null
|
||||
echo "{\"text\":\"\", \"tooltip\":\"Recording\", \"alt\":\"Recording\"}"
|
||||
end
|
||||
end
|
5
home/.config/fish/functions/clipboard_clear.fish
Normal file
5
home/.config/fish/functions/clipboard_clear.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
function clipboard_clear
|
||||
rm "$HOME/.cache/cliphist/db"
|
||||
cb clr -a
|
||||
dunstify "Clipboard" "Cleared" -t 2000
|
||||
end
|
7
home/.config/fish/functions/clipboard_delete_item.fish
Normal file
7
home/.config/fish/functions/clipboard_delete_item.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function clipboard_delete_item
|
||||
set clip $(cliphist list | rofi -dmenu -p 'clipboard delete item')
|
||||
if not [ -z $clip ]
|
||||
echo $clip | cliphist delete
|
||||
dunstify "Clipboard" "Clip '$clip' was deleted" -t 2000
|
||||
end
|
||||
end
|
3
home/.config/fish/functions/clipboard_to_type.fish
Normal file
3
home/.config/fish/functions/clipboard_to_type.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function clipboard_to_type
|
||||
cliphist list | rofi -dmenu -p clipboard | cliphist decode | wtype -
|
||||
end
|
7
home/.config/fish/functions/clipboard_to_wlcopy.fish
Normal file
7
home/.config/fish/functions/clipboard_to_wlcopy.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function clipboard_to_wlcopy
|
||||
set clip $(cliphist list | rofi -dmenu -p 'clipboard copy')
|
||||
if not [ -z $clip ]
|
||||
echo $clip | cliphist decode | wl-copy
|
||||
dunstify "Clipboard" "Clip '$clip' was copied" -t 2000
|
||||
end
|
||||
end
|
20
home/.config/fish/functions/dunst_pause.fish
Normal file
20
home/.config/fish/functions/dunst_pause.fish
Normal file
@@ -0,0 +1,20 @@
|
||||
function dunst_pause
|
||||
set COUNT_WAITING (dunstctl count waiting)
|
||||
set COUNT_DISPLAYED (dunstctl count displayed)
|
||||
set ENABLED "{ \"text\": \"\", \"tooltip\": \"notifications <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
|
||||
set DISABLED "{ \"text\": \"\", \"tooltip\": \"notifications <span color='#ee99a0'>off</span>\", \"class\": \"off\" }"
|
||||
|
||||
if [ $COUNT_DISPLAYED != 0 ]
|
||||
set ENABLED "{ \"text\": \"$COUNT_DISPLAYED\", \"tooltip\": \"$COUNT_DISPLAYED notifications\", \"class\": \"on\" }"
|
||||
end
|
||||
|
||||
if [ $COUNT_WAITING != 0 ]
|
||||
set DISABLED "{ \"text\": \"$COUNT_WAITING\", \"tooltip\": \"(silent) $COUNT_WAITING notifications\", \"class\": \"off\" }"
|
||||
end
|
||||
|
||||
if dunstctl is-paused | rg -q "false"
|
||||
echo $ENABLED
|
||||
else
|
||||
echo $DISABLED
|
||||
end
|
||||
end
|
3
home/.config/fish/functions/fetch_music_player_data.fish
Normal file
3
home/.config/fish/functions/fetch_music_player_data.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function fetch_music_player_data
|
||||
playerctl -a metadata --format "{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"<i><span color='#a6da95'>{{playerName}}</span></i>: <b><span color='#f5a97f'>{{artist}}</span> - <span color='#c6a0f6'>{{markup_escape(title)}}</span></b>\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}" -F
|
||||
end
|
8
home/.config/fish/functions/fish_greeting.fish
Normal file
8
home/.config/fish/functions/fish_greeting.fish
Normal file
@@ -0,0 +1,8 @@
|
||||
function fish_greeting
|
||||
set_color blue; echo " Distro: NixOS"
|
||||
set_color white; echo " Langs: Rust Go JS TS Python WasmEdge"
|
||||
set_color green; echo " Shell: Fish"
|
||||
set_color yellow; echo " Mood: 👨💻"
|
||||
set_color cyan; figlet random -f binary
|
||||
# clear
|
||||
end
|
10
home/.config/fish/functions/fish_user_key_bindings.fish
Normal file
10
home/.config/fish/functions/fish_user_key_bindings.fish
Normal file
@@ -0,0 +1,10 @@
|
||||
function fish_user_key_bindings
|
||||
# Execute this once per mode that emacs bindings should be used in
|
||||
fish_default_key_bindings -M insert
|
||||
|
||||
# Then execute the vi-bindings so they take precedence when there's a conflict.
|
||||
# Without --no-erase fish_vi_key_bindings will default to
|
||||
# resetting all bindings.
|
||||
# The argument specifies the initial mode (insert, "default" or visual).
|
||||
fish_vi_key_bindings --no-erase insert
|
||||
end
|
9
home/.config/fish/functions/night_mode_toggle.fish
Normal file
9
home/.config/fish/functions/night_mode_toggle.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function night_mode_toggle
|
||||
set target_process "gammastep"
|
||||
|
||||
if pgrep $target_process > /dev/null
|
||||
killall -s SIGINT .gammastep-wrap
|
||||
else
|
||||
gammastep
|
||||
end
|
||||
end
|
16
home/.config/fish/functions/record_screen_gif.fish
Normal file
16
home/.config/fish/functions/record_screen_gif.fish
Normal file
@@ -0,0 +1,16 @@
|
||||
function record_screen_gif
|
||||
set target_process "wf-recorder"
|
||||
|
||||
if pgrep $target_process > /dev/null
|
||||
killall -s SIGINT $target_process
|
||||
cb cp ~/Pictures/Records/(cd ~/Pictures/Records && ls -tA | head -n1 | awk '{print $NF}')
|
||||
dunstify -i ~/.config/fish/icons/camera_gif_icon.png -r $(cd ~/Pictures/Records/ && ls -1 | wc -l) "Recording Stopped (GIF)" -t 2000
|
||||
else
|
||||
set geometry (slurp)
|
||||
if not [ -z $geometry ]
|
||||
set record_name $(echo "recrod-$(date +"%Y-%m-%d--%H:%M:%S").gif")
|
||||
dunstify -i ~/.config/fish/icons/camera_gif_icon.png -r $(cd ~/Pictures/Records/ && ls -1 | wc -l) "Recording Started (GIF)" -t 2000
|
||||
wf-recorder -g "$geometry" -f "$HOME/Pictures/Records/$record_name" -c gif -F fps=30
|
||||
end
|
||||
end
|
||||
end
|
16
home/.config/fish/functions/record_screen_mp4.fish
Normal file
16
home/.config/fish/functions/record_screen_mp4.fish
Normal file
@@ -0,0 +1,16 @@
|
||||
function record_screen_mp4
|
||||
set target_process "wf-recorder"
|
||||
|
||||
if pgrep $target_process > /dev/null
|
||||
killall -s SIGINT $target_process
|
||||
cb cp ~/Videos/Records/(cd ~/Videos/Records && ls -tA | head -n1 | awk '{print $NF}')
|
||||
dunstify -i ~/.config/fish/icons/camera_mp4_icon.png -r $(cd ~/Videos/Records/ && ls -1 | wc -l) "Recording Stopped (MP4)" -t 2000
|
||||
else
|
||||
set geometry (slurp)
|
||||
if not [ -z $geometry ]
|
||||
set record_name $(echo "recrod-$(date +"%Y-%m-%d--%H:%M:%S").mp4")
|
||||
dunstify -i ~/.config/fish/icons/camera_mp4_icon.png -r $(cd ~/Videos/Records/ && ls -1 | wc -l) "Recording Started (MP4)" -t 2000
|
||||
wf-recorder -g "$geometry" -f "$HOME/Videos/Records/$record_name" -c h264_vaapi -d /dev/dri/renderD128
|
||||
end
|
||||
end
|
||||
end
|
3
home/.config/fish/functions/screenshot_edit.fish
Normal file
3
home/.config/fish/functions/screenshot_edit.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function screenshot_edit
|
||||
swappy -f ~/Pictures/Screenshots/(cd ~/Pictures/Screenshots && ls -tA | head -n1 | awk '{print $NF}')
|
||||
end
|
9
home/.config/fish/functions/screenshot_to_clipboard.fish
Normal file
9
home/.config/fish/functions/screenshot_to_clipboard.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function screenshot_to_clipboard
|
||||
set screenshot_filename (echo "$HOME/Pictures/Screenshots/screenshot-$(date +"%Y-%m-%d--%H:%M:%S").png")
|
||||
grim -g (slurp) $screenshot_filename
|
||||
|
||||
if [ -e $screenshot_filename ]
|
||||
cat $screenshot_filename | wl-copy --type image/png
|
||||
dunstify -i $screenshot_filename -r (cd ~/Pictures/Screenshots/ && ls -1 | wc -l) "Screenshots" "Screenshot was taken" -t 2000
|
||||
end
|
||||
end
|
9
home/.config/fish/functions/startup.fish
Normal file
9
home/.config/fish/functions/startup.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function startup
|
||||
wpaperd & \
|
||||
waybar & \
|
||||
poweralertd & \
|
||||
wl-paste --watch cliphist store & \
|
||||
avizo-service & \
|
||||
systemctl --user start psi-notify &\
|
||||
swayidle -w
|
||||
end
|
3
home/.config/fish/functions/tre.fish
Normal file
3
home/.config/fish/functions/tre.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function tre
|
||||
command tre $argv -e; and source /tmp/tre_aliases_$USER ^/dev/null
|
||||
end
|
9
home/.config/fish/functions/wifi_toggle.fish
Normal file
9
home/.config/fish/functions/wifi_toggle.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function wifi_toggle
|
||||
set wifi_status (nmcli radio wifi)
|
||||
|
||||
if [ "$wifi_status" = "enabled" ]
|
||||
nmcli radio wifi off
|
||||
else
|
||||
nmcli radio wifi on
|
||||
end
|
||||
end
|
5
home/.config/fish/functions/wlogout_uniqe.fish
Normal file
5
home/.config/fish/functions/wlogout_uniqe.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
function wlogout_uniqe
|
||||
if [ -z $(pidof wlogout) ]
|
||||
wlogout
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user