mirror of
https://git.sr.ht/~coasteen/dotfiles
synced 2026-03-21 23:19:22 +01:00
I dont know
This commit is contained in:
parent
677f7a4205
commit
4b5f5cf2a5
6 changed files with 312 additions and 174 deletions
|
|
@ -1,8 +1,9 @@
|
|||
monitor=HDMI-A-1,1920x1080@75,auto,auto
|
||||
#monitor=DP-1,1920x1080@75,auto,1
|
||||
monitor=HDMI-A-1,1920x1080@100.00,auto,1
|
||||
|
||||
hide_on_fullscreen = true
|
||||
|
||||
$terminal = foot
|
||||
$terminal = footclient
|
||||
$menu = rofi -show drun -config /home/coast/.config/rofi/config.rasi
|
||||
$webBrowser = firefox-bin
|
||||
$discordApp = vesktop-bin --proxy-server="socks5://127.0.0.1:65000"
|
||||
|
|
@ -10,7 +11,7 @@ $restartWaybar = pkill waybar; waybar&disown
|
|||
$fileManager = pcmanfm
|
||||
|
||||
exec-once = hyprctl setcursor Adwaita 24 &
|
||||
exec-once = wbg /home/coast/Pictures/walls/wallhaven-d83vjl_1920x1080.png &
|
||||
exec-once = wbg /home/coast/Pictures/walls/wallhaven-yq5dmg_1920x1080.png &
|
||||
exec-once = hypridle &
|
||||
exec-once = hyprpm reload -n;
|
||||
exec-once = dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland
|
||||
|
|
@ -19,6 +20,10 @@ exec-once = waybar &
|
|||
exec-once = mpd ~/.mpdconf &
|
||||
exec-once = mpc add /;
|
||||
|
||||
exec-once = foot --server;
|
||||
|
||||
exec-once = flatpak override --env=GTK_THEME=Catppuccin-B-MB-Dark --user;
|
||||
|
||||
env = XCURSOR_SIZE,24
|
||||
env = HYPRCURSOR_SIZE,24
|
||||
|
||||
|
|
@ -121,6 +126,8 @@ binde = $mainMod SHIFT, down, resizeactive, 0 40
|
|||
|
||||
bind = $mainMod, Backslash, centerwindow,
|
||||
|
||||
workspace = 2, monitor:HDMI-A-1
|
||||
|
||||
bind = $mainMod, 1, workspace, 1
|
||||
bind = $mainMod, 2, workspace, 2
|
||||
bind = $mainMod, 3, workspace, 3
|
||||
|
|
@ -197,11 +204,12 @@ bind = $mainMod ALT, down, exec, /home/coast/.local/bin/mpc-shuf.sh shufno
|
|||
bind = $mainMod ALT, right, exec, /home/coast/.local/bin/mpc-shuf.sh next
|
||||
bind = $mainMod ALT, left, exec, /home/coast/.local/bin/mpc-shuf.sh prev
|
||||
bind = $mainMod SHIFT, R, exec, /home/coast/.local/bin/mpc-shuf.sh search
|
||||
bind = $mainMod CONTROL, R, exec, /home/coast/.local/bin/mpc-shuf.sh album
|
||||
bind = $mainMod ALT, R, exec, /home/coast/.local/bin/mpc-shuf.sh artist
|
||||
bind = $mainMod, slash, exec, /home/coast/.local/bin/mpc-shuf.sh info
|
||||
bind = $mainMod, comma, exec, mpc volume -5
|
||||
bind = $mainMod, period, exec, mpc volume +5
|
||||
bind = $mainMod SHIFT, up, exec, mpc pause; notify-send "Paused: $(mpc current)"
|
||||
bind = $mainMod SHIFT, down, exec, mpc play; notify-send "Unpaused: $(mpc current)"
|
||||
bind = $mainMod, bracketright, exec, /home/coast/.local/bin/mpc-shuf.sh toggle
|
||||
bind = $mainMod CONTROL, up, exec, mpc stop; mpc add /; notify-send "Reset MPC!"
|
||||
|
||||
xwayland {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ input-field {
|
|||
monitor =
|
||||
size = 350, 60
|
||||
position = 0, -100
|
||||
rounding = 14
|
||||
rounding = 0
|
||||
border_width = 2
|
||||
|
||||
font = "JetBrainsMono Nerd Font"
|
||||
|
|
|
|||
|
|
@ -1,167 +1,133 @@
|
|||
exec autotiling
|
||||
exec foot -s
|
||||
input "1267:12448:ELAN0709:00_04F3:30A0_Touchpad" {
|
||||
dwt enabled
|
||||
tap enabled
|
||||
middle_emulation enabled
|
||||
}
|
||||
exec "foot --server"
|
||||
exec "wbg /home/coast/Pictures/walls/wallhaven-yq5dmg_1920x1080.png"
|
||||
exec "dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Sway"
|
||||
exec "gnome-keyring-daemon --start --components=secrets"
|
||||
exec "waybar"
|
||||
exec "mpd ~/.mpdconf"
|
||||
exec "mpc add /"
|
||||
exec "flatpak override --env=GTK_THEME=Catppuccin-B-MB-Dark --user"
|
||||
exec "hyprpm reload -n"
|
||||
exec "seat seat0 xcursor-theme Adwaita 24"
|
||||
|
||||
gaps inner 5
|
||||
gaps outer 15
|
||||
|
||||
set $mod Mod4
|
||||
set $left h
|
||||
set $down j
|
||||
set $up k
|
||||
set $right l
|
||||
|
||||
set $term footclient
|
||||
set $filemgr footclient -e yazi
|
||||
set $filemgr2 caja
|
||||
set $menu wmenu-run -f "UbuntuMono 15" -N "#1c1c1c" -n "#B0B0B0" -S "#2d2d2d" -s "#ffffff" -l 10
|
||||
set $browser brave
|
||||
set $menu rofi -show drun -config /home/coast/.config/rofi/config.rasi
|
||||
set $webBrowser firefox-bin
|
||||
set $discordApp vesktop-bin --proxy-server="socks5://127.0.0.1:65000"
|
||||
set $restartWaybar pkill waybar; waybar &
|
||||
set $fileManager pcmanfm
|
||||
|
||||
output eDP-1 disable
|
||||
output HDMI-A-1 pos 1920 0
|
||||
|
||||
output * bg /home/coast/Pictures/nature4.png fill
|
||||
output HDMI-A-1 resolution 1920x1080 position 1920,0
|
||||
output HDMI-A-1 resolution 1920x1080@100Hz position 0,0
|
||||
|
||||
exec swayidle -w \
|
||||
timeout 300 'swaylock -f -c 000000' \
|
||||
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
|
||||
before-sleep 'swaylock -f -c 000000'
|
||||
workspace 2 output HDMI-A-1
|
||||
|
||||
input * {
|
||||
xkb_options caps:escape
|
||||
output * bg /home/coast/Pictures/walls/wallhaven-yq5dmg_1920x1080.png fill
|
||||
|
||||
## Idle / lock (hypridle not available in sway, use swayidle)
|
||||
exec swayidle -w \
|
||||
timeout 300 'hyprlock' \
|
||||
timeout 600 'swaymsg "output * power off"' \
|
||||
resume 'swaymsg "output * power on"' \
|
||||
before-sleep 'hyprlock'
|
||||
|
||||
input type:keyboard {
|
||||
xkb_layout us
|
||||
}
|
||||
|
||||
default_border pixel 4
|
||||
default_floating_border pixel 4
|
||||
gaps inner 5
|
||||
gaps outer 15
|
||||
|
||||
for_window [class=".*"] border pixel 4
|
||||
default_border pixel 2
|
||||
|
||||
client.focused #666666 #000000 #ffffff #666666 #666666
|
||||
client.unfocused #444444 #000000 #ffffff #444444 #444444
|
||||
client.focused_inactive #444444 #000000 #ffffff #444444 #444444
|
||||
client.urgent #ff0000 #000000 #ffffff #ff0000 #ff0000
|
||||
client.focused #6c6c9d #6c6c9d #ffffff #6c6c9d #6c6c9d
|
||||
client.unfocused #1e1e2e #1e1e2e #5c5c5c #1e1e2e #1e1e2e
|
||||
client.focused_inactive #1e1e2e #1e1e2e #5c5c5c #1e1e2e #1e1e2e
|
||||
|
||||
bindsym $mod+Return exec $term
|
||||
bindsym $mod+s kill
|
||||
bindsym $mod+r exec $menu
|
||||
bindsym $mod+Shift+q exec swaymsg exit
|
||||
bindsym $mod+Control+r reload
|
||||
|
||||
bindsym $mod+Return exec $term
|
||||
floating_modifier $mod normal
|
||||
|
||||
bindsym $mod+s kill
|
||||
bindsym $mod+space exec swaymsg floating toggle && swaymsg resize set 1000 800 && swaymsg move position center
|
||||
|
||||
bindsym $mod+r exec $menu
|
||||
bindsym $mod+backslash move position center
|
||||
|
||||
bindsym $mod+Shift+b exec $browser
|
||||
bindsym $mod+$left focus left
|
||||
bindsym $mod+$down focus down
|
||||
bindsym $mod+$up focus up
|
||||
bindsym $mod+$right focus right
|
||||
|
||||
floating_modifier $mod normal
|
||||
bindsym $mod+Shift+$left move left
|
||||
bindsym $mod+Shift+$down move down
|
||||
bindsym $mod+Shift+$up move up
|
||||
bindsym $mod+Shift+$right move right
|
||||
|
||||
bindsym $mod+Shift+c reload
|
||||
bindsym $mod+Mod1+$left resize shrink width 30px
|
||||
bindsym $mod+Mod1+$right resize grow width 30px
|
||||
bindsym $mod+Mod1+$up resize shrink height 30px
|
||||
bindsym $mod+Mod1+$down resize grow height 30px
|
||||
|
||||
bindsym $mod+Shift+q exec 'swaymsg exit'
|
||||
bindsym $mod+Left move left 40px
|
||||
bindsym $mod+Right move right 40px
|
||||
bindsym $mod+Up move up 40px
|
||||
bindsym $mod+Down move down 40px
|
||||
|
||||
bindsym $mod+Shift+f exec $filemgr
|
||||
bindsym $mod+Shift+i exec $filemgr2
|
||||
bindsym $mod+$left focus left
|
||||
bindsym $mod+$down focus down
|
||||
bindsym $mod+$up focus up
|
||||
bindsym $mod+$right focus right
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
bindsym $mod+Shift+Left resize shrink width 40px
|
||||
bindsym $mod+Shift+Right resize grow width 40px
|
||||
bindsym $mod+Shift+Up resize shrink height 40px
|
||||
bindsym $mod+Shift+Down resize grow height 40px
|
||||
|
||||
bindsym $mod+Shift+$left move left
|
||||
bindsym $mod+Shift+$down move down
|
||||
bindsym $mod+Shift+$up move up
|
||||
bindsym $mod+Shift+$right move right
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
bindsym $mod+2 workspace number 2
|
||||
bindsym $mod+3 workspace number 3
|
||||
bindsym $mod+4 workspace number 4
|
||||
bindsym $mod+5 workspace number 5
|
||||
bindsym $mod+6 workspace number 6
|
||||
bindsym $mod+7 workspace number 7
|
||||
bindsym $mod+8 workspace number 8
|
||||
bindsym $mod+9 workspace number 9
|
||||
|
||||
bindsym $mod+1 workspace number 1
|
||||
bindsym $mod+2 workspace number 2
|
||||
bindsym $mod+3 workspace number 3
|
||||
bindsym $mod+4 workspace number 4
|
||||
bindsym $mod+5 workspace number 5
|
||||
bindsym $mod+6 workspace number 6
|
||||
bindsym $mod+7 workspace number 7
|
||||
bindsym $mod+8 workspace number 8
|
||||
bindsym $mod+9 workspace number 9
|
||||
bindsym $mod+Shift+1 move container to workspace number 1
|
||||
bindsym $mod+Shift+2 move container to workspace number 2
|
||||
bindsym $mod+Shift+3 move container to workspace number 3
|
||||
bindsym $mod+Shift+4 move container to workspace number 4
|
||||
bindsym $mod+Shift+5 move container to workspace number 5
|
||||
bindsym $mod+Shift+6 move container to workspace number 6
|
||||
bindsym $mod+Shift+7 move container to workspace number 7
|
||||
bindsym $mod+Shift+8 move container to workspace number 8
|
||||
bindsym $mod+Shift+9 move container to workspace number 9
|
||||
|
||||
bindsym $mod+Shift+1 move container to workspace number 1
|
||||
bindsym $mod+Shift+2 move container to workspace number 2
|
||||
bindsym $mod+Shift+3 move container to workspace number 3
|
||||
bindsym $mod+Shift+4 move container to workspace number 4
|
||||
bindsym $mod+Shift+5 move container to workspace number 5
|
||||
bindsym $mod+Shift+6 move container to workspace number 6
|
||||
bindsym $mod+Shift+7 move container to workspace number 7
|
||||
bindsym $mod+Shift+8 move container to workspace number 8
|
||||
bindsym $mod+Shift+9 move container to workspace number 9
|
||||
bindsym $mod+c scratchpad show
|
||||
bindsym $mod+Shift+c move scratchpad
|
||||
|
||||
bindsym $mod+b splith
|
||||
bindsym $mod+v splitv
|
||||
bindsym $mod+Shift+b exec $webBrowser
|
||||
bindsym $mod+Shift+v exec $discordApp
|
||||
bindsym $mod+f exec $fileManager
|
||||
bindsym $mod+Shift+p exec $restartWaybar
|
||||
bindsym $mod+ctrl+l exec hyprlock
|
||||
|
||||
bindsym $mod+Shift+s layout stacking
|
||||
bindsym $mod+Shift+w layout tabbed
|
||||
bindsym $mod+Shift+e layout toggle split
|
||||
bindsym $mod+Shift+s exec grim -g "$(slurp)" - | wl-copy
|
||||
|
||||
bindsym $mod+f fullscreen
|
||||
bindsym $mod+Mod1+Up exec /home/coast/.local/bin/mpc-shuf.sh shuf
|
||||
bindsym $mod+Mod1+Down exec /home/coast/.local/bin/mpc-shuf.sh shufno
|
||||
bindsym $mod+Mod1+Right exec /home/coast/.local/bin/mpc-shuf.sh next
|
||||
bindsym $mod+Mod1+Left exec /home/coast/.local/bin/mpc-shuf.sh prev
|
||||
bindsym $mod+Shift+r exec /home/coast/.local/bin/mpc-shuf.sh search
|
||||
bindsym $mod+ctrl+a exec /home/coast/.local/bin/mpc-shuf.sh album
|
||||
bindsym $mod+Mod1+r exec /home/coast/.local/bin/mpc-shuf.sh artist
|
||||
bindsym $mod+slash exec /home/coast/.local/bin/mpc-shuf.sh info
|
||||
bindsym $mod+comma exec mpc volume -5
|
||||
bindsym $mod+period exec mpc volume +5
|
||||
bindsym $mod+bracketright exec /home/coast/.local/bin/mpc-shuf.sh toggle
|
||||
bindsym $mod+ctrl+Up exec mpc stop; mpc add /; notify-send "Reset MPC!"
|
||||
|
||||
bindsym Print exec /home/coast/.local/src/local/bin/screenie-wl
|
||||
|
||||
bindsym $mod+space floating toggle
|
||||
|
||||
bindsym $mod+Shift+space focus mode_toggle
|
||||
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
bindsym $mod+Shift+u exec 'pkill waybar; waybar &'
|
||||
|
||||
bindsym $mod+Shift+minus move scratchpad
|
||||
|
||||
bindsym $mod+minus scratchpad show
|
||||
mode "resize" {
|
||||
bindsym $left resize shrink width 10px
|
||||
bindsym $down resize grow height 10px
|
||||
bindsym $up resize shrink height 10px
|
||||
bindsym $right resize grow width 10px
|
||||
|
||||
bindsym Right resize shrink width 10px
|
||||
bindsym Up resize grow height 10px
|
||||
bindsym Down resize shrink height 10px
|
||||
bindsym Left resize grow width 10px
|
||||
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
bindsym $mod+Shift+d mode "resize"
|
||||
|
||||
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
|
||||
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
|
||||
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
|
||||
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
|
||||
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||
|
||||
bar {
|
||||
position top
|
||||
font pango:Ubuntu 12
|
||||
|
||||
status_command while date +'%I:%M %p'; do sleep 1; done
|
||||
status_command while $HOME/.local/bin/sway-status; do sleep 1; done
|
||||
|
||||
tray_output primary
|
||||
|
||||
colors {
|
||||
statusline #ffffff
|
||||
background #1c1c1c
|
||||
inactive_workspace #1c1c1c #1c1c1c #aaaaaa
|
||||
focused_workspace #2d2d2d #262626 #ffffff
|
||||
urgent_workspace #aa0000 #ff0000 #ffffff
|
||||
}
|
||||
}
|
||||
|
||||
include /etc/sway/config.d/*
|
||||
for_window [app_id="foot"] opacity 0.9
|
||||
xwayland enable
|
||||
|
|
|
|||
|
|
@ -1,32 +1,96 @@
|
|||
#!/usr/bin/env sh
|
||||
case "$1" in
|
||||
shuf) mpc random on && notify-send "Shuffle enabled" && exit 0 ;;
|
||||
shufno) mpc random off && notify-send "Shuffle disabled" && exit 0 ;;
|
||||
next) mpc next ;;
|
||||
prev) mpc prev ;;
|
||||
current) mpc current && exit 0 ;;
|
||||
info)
|
||||
song_file=$(mpc --format '%file%' current)
|
||||
song_dir=$(dirname "/home/coast/Music/$song_file")
|
||||
cover=$(find "$song_dir" -maxdepth 1 \( -iname '*cover*.jpg' -o -iname '*cover*.png' -o -iname '*folder*.jpg' -o -iname '*folder*.png' -o -iname '*front*.jpg' -o -iname '*front*.png' \) | head -n 1)
|
||||
[ -z "$cover" ] && cover="/usr/share/icons/hicolor/48x48/apps/musical-note.png"
|
||||
notify-send "Currently Playing" "$(mpc current)" -i "$cover" && exit 0
|
||||
;;
|
||||
search)
|
||||
choice=$(mpc --format '%title% - %artist% - %album%\t%file%' search any "" \
|
||||
| rofi -dmenu -i -p "Search music" -display-columns 1)
|
||||
[ -z "$choice" ] && exit 0
|
||||
file=$(printf '%s' "$choice" | cut -f2)
|
||||
[ -z "$file" ] && exit 0
|
||||
mpc clear && mpc add "$file" && mpc play && exit 0
|
||||
;;
|
||||
esac
|
||||
mpc play
|
||||
mpc volume 15
|
||||
song_file=$(mpc --format '%file%' current)
|
||||
music_dir="/home/coast/Music"
|
||||
song_abs="$music_dir/$song_file"
|
||||
song_dir=$(dirname "$song_abs")
|
||||
cover=$(find "$song_dir" -maxdepth 1 \( -iname '*cover*.jpg' -o -iname '*cover*.png' -o -iname '*folder*.jpg' -o -iname '*folder*.png' -o -iname '*front*.jpg' -o -iname '*front*.png' \) | head -n 1)
|
||||
[ -z "$cover" ] && cover="/usr/share/icons/hicolor/48x48/apps/musical-note.png"
|
||||
notify-send "Now playing..." "$(mpc current)" -i "$cover"
|
||||
#!/usr/bin/env lua
|
||||
|
||||
local music_dir = "/home/coast/Music"
|
||||
local max_length = 30
|
||||
local default_icon = "/usr/share/icons/hicolor/48x48/apps/musical-note.png"
|
||||
|
||||
local function escape(str)
|
||||
return str:gsub("'", "'\\''")
|
||||
end
|
||||
|
||||
local function capture(cmd)
|
||||
local f = io.popen(cmd, 'r')
|
||||
local s = f:read('*a')
|
||||
f:close()
|
||||
return s:gsub("^%s*(.-)%s*$", "%1")
|
||||
end
|
||||
|
||||
local function truncate(str, len)
|
||||
if #str > len then
|
||||
return str:sub(1, len) .. "..."
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
local function get_cover(song_file)
|
||||
if not song_file or song_file == "" then return default_icon end
|
||||
local full_path = music_dir .. "/" .. song_file
|
||||
local dir = full_path:match("(.*[/\\])") or music_dir
|
||||
local names = {"cover.jpg", "cover.png", "folder.jpg", "folder.png", "front.jpg", "front.png"}
|
||||
|
||||
for _, name in ipairs(names) do
|
||||
local path = dir .. name
|
||||
local f = io.open(path, "r")
|
||||
if f then
|
||||
f:close()
|
||||
return path
|
||||
end
|
||||
end
|
||||
return default_icon
|
||||
end
|
||||
|
||||
local action = arg[1]
|
||||
|
||||
if action == "shuf" then
|
||||
os.execute("mpc random on >/dev/null && notify-send 'Shuffle enabled'")
|
||||
os.exit(0)
|
||||
elseif action == "shufno" then
|
||||
os.execute("mpc random off >/dev/null && notify-send 'Shuffle disabled'")
|
||||
os.exit(0)
|
||||
elseif action == "next" then
|
||||
os.execute("mpc next >/dev/null")
|
||||
elseif action == "prev" then
|
||||
os.execute("mpc prev >/dev/null")
|
||||
elseif action == "toggle" then
|
||||
os.execute("mpc toggle >/dev/null")
|
||||
os.exit(0)
|
||||
elseif action == "current" then
|
||||
local current = capture("mpc current")
|
||||
if current ~= "" then io.write(current .. "\n") end
|
||||
os.exit(0)
|
||||
elseif action == "info" then
|
||||
local file = capture("mpc --format '%file%' current")
|
||||
local title = capture("mpc current")
|
||||
local cover = get_cover(file)
|
||||
os.execute(string.format("notify-send 'Currently Playing' '%s' -i '%s'", escape(title), cover))
|
||||
os.exit(0)
|
||||
elseif action == "album" then
|
||||
local album = capture("mpc list album | rofi -dmenu -i -p 'Select Album'")
|
||||
if album ~= "" then
|
||||
os.execute(string.format("mpc clear >/dev/null && mpc find album '%s' | mpc add && mpc play >/dev/null", escape(album)))
|
||||
end
|
||||
os.exit(0)
|
||||
elseif action == "artist" then
|
||||
local artist = capture("mpc list artist | rofi -dmenu -i -p 'Select Artist'")
|
||||
if artist ~= "" then
|
||||
os.execute(string.format("mpc clear >/dev/null && mpc find artist '%s' | mpc add && mpc play >/dev/null", escape(artist)))
|
||||
end
|
||||
os.exit(0)
|
||||
elseif action == "search" then
|
||||
local menu = "mpc --format '%title% - %artist% - %album%\t%file%' search any '' | rofi -dmenu -i -p 'Search music'"
|
||||
local choice = capture(menu)
|
||||
if choice == "" then os.exit(0) end
|
||||
local file = choice:match("\t(.-)$")
|
||||
if file then
|
||||
os.execute(string.format("mpc clear >/dev/null && mpc add '%s' >/dev/null && mpc play >/dev/null", escape(file)))
|
||||
os.exit(0)
|
||||
end
|
||||
end
|
||||
|
||||
os.execute("mpc play >/dev/null 2>&1")
|
||||
os.execute("mpc volume 15 >/dev/null 2>&1")
|
||||
local file = capture("mpc --format '%file%' current")
|
||||
local title = capture("mpc current")
|
||||
local cover = get_cover(file)
|
||||
local display = truncate(title, max_length)
|
||||
os.execute(string.format("notify-send 'Now playing...' '%s' -i '%s'", escape(display), cover))
|
||||
|
|
|
|||
79
local/bin/updateriver
Executable file
79
local/bin/updateriver
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env lua
|
||||
|
||||
local home = os.getenv("home") or os.getenv("HOME")
|
||||
local cache_dir = home .. "/.cache"
|
||||
local zig_cache = cache_dir .. "/zig"
|
||||
local proxy_cmd = "ssh -o ProxyCommand='nc -X 5 -x 127.0.0.1:65000 %h %p'"
|
||||
|
||||
local project_dir = arg[1] or (home .. "/Projects/river/river")
|
||||
|
||||
local function run(cmd)
|
||||
local ok = os.execute(cmd)
|
||||
if not ok then
|
||||
io.stderr:write("failed: " .. cmd .. "\n")
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
local function fetch_git_dep(path, commit)
|
||||
local name = path:match("([^/]+)$"):gsub("^zig%-", "")
|
||||
local tmp = cache_dir .. "/" .. name .. "-tmp"
|
||||
local tarball = cache_dir .. "/" .. name .. ".tar.gz"
|
||||
|
||||
run("rm -rf " .. tmp)
|
||||
run('GIT_SSH_COMMAND="' .. proxy_cmd .. '" git clone git@codeberg.org:' .. path .. ".git " .. tmp)
|
||||
run("git -C " .. tmp .. " checkout " .. commit)
|
||||
run("tar -czf " .. tarball .. " -C " .. cache_dir .. " " .. name .. "-tmp")
|
||||
run("zig fetch --global-cache-dir " .. zig_cache .. " file://" .. tarball)
|
||||
run(
|
||||
"sed -i '/\\."
|
||||
.. name
|
||||
.. ' = /,/\\.hash/{s|.url = "[^"]*"|.url = "file://'
|
||||
.. tarball
|
||||
.. "\"|}' "
|
||||
.. project_dir
|
||||
.. "/build.zig.zon"
|
||||
)
|
||||
end
|
||||
|
||||
local function fetch_https_dep(url)
|
||||
local filename = url:match("([^/]+)$")
|
||||
local name = filename:gsub("^zig%-", ""):gsub("%-v?[0-9].*$", ""):gsub("%.tar%.gz$", "")
|
||||
local tarball = cache_dir .. "/" .. filename
|
||||
|
||||
run('GIT_SSH_COMMAND="' .. proxy_cmd .. '" curl -x socks5h://127.0.0.1:65000 -Lo ' .. tarball .. " " .. url)
|
||||
run("zig fetch --global-cache-dir " .. zig_cache .. " file://" .. tarball)
|
||||
run(
|
||||
"sed -i '/\\."
|
||||
.. name
|
||||
.. ' = /,/\\.hash/{s|.url = "[^"]*"|.url = "file://'
|
||||
.. tarball
|
||||
.. "\"|}' "
|
||||
.. project_dir
|
||||
.. "/build.zig.zon"
|
||||
)
|
||||
end
|
||||
|
||||
run("git -C " .. project_dir .. " pull")
|
||||
|
||||
local zon = io.open(project_dir .. "/build.zig.zon", "r")
|
||||
if not zon then
|
||||
io.stderr:write("cant open build.zig.zon\n")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
for line in zon:lines() do
|
||||
local path, commit = line:match("git%+https://codeberg%.org/([^?]+)%?ref=[^#]+#([a-f0-9]+)")
|
||||
if path and commit then
|
||||
fetch_git_dep(path, commit)
|
||||
else
|
||||
local url = line:match('"(https://codeberg%.org/[^"]+%.tar%.gz)"')
|
||||
if url then
|
||||
fetch_https_dep(url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
zon:close()
|
||||
|
||||
run("cd " .. project_dir .. " && zig build -Doptimize=ReleaseSafe --prefix " .. home .. "/.local install")
|
||||
21
local/bin/upim
Executable file
21
local/bin/upim
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env sh
|
||||
if [ -z "$1" ]; then
|
||||
echo "usage: $0 <file>"
|
||||
exit 1
|
||||
fi
|
||||
FILE="$1"
|
||||
RESPONSE=$(curl -s -X POST \
|
||||
-F "file=@${FILE}" \
|
||||
https://coast.is-terrible.com/api/files/create)
|
||||
URL=$(echo "$RESPONSE" | jq -r '.url')
|
||||
THUMBNAIL_URL=$(echo "$RESPONSE" | jq -r '.thumb')
|
||||
DELETION_URL=$(echo "$RESPONSE" | jq -r '.del_url')
|
||||
ERROR=$(echo "$RESPONSE" | jq -r '.error')
|
||||
if [ "$ERROR" != "null" ]; then
|
||||
echo "Error uploading file: $ERROR"
|
||||
exit 1
|
||||
fi
|
||||
echo "file uploaded successfully!"
|
||||
echo "url: $URL"
|
||||
echo "thumbnail url: $THUMBNAIL_URL"
|
||||
echo "deletion url: $DELETION_URL"
|
||||
Loading…
Add table
Reference in a new issue