summaryrefslogtreecommitdiff
path: root/main.fish
blob: df753f23df4abb773bed49edb39d8b6494dc7f7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/fish

cd (dirname (realpath (status filename))) || exit

. ./util.fish

if test "$argv[1]" = shell
    if contains 'caelestia' (astal -l)
        if test -n "$argv[2..]"
            log "Sent command '$argv[2..]' to shell"
            astal -i caelestia $argv[2..]
        else
            warn 'No args given, ignoring'
        end
    else
        warn 'Shell unavailable'
    end
    exit
end

if test "$argv[1]" = screenshot
    ./screenshot.fish $argv[2..]
    exit
end

if test "$argv[1]" = workspace-action
    ./workspace-action.sh $argv[2..]
    exit
end

if test "$argv[1]" = change-wallpaper
    ./change-wallpaper.fish $argv[2..]
    exit
end

if test "$argv[1]" = pip
    ./pip.fish $argv[2..]
    exit
end

test "$argv[1]" != help && error "Unknown command: $argv[1]"

echo 'Usage: caelestia COMMAND [ ...args ]'
echo
echo 'COMMAND := help | shell | workspace-action | change-wallpaper'
echo
echo '  help: show this help message'
echo '  shell: send a message to the shell'
echo '  screenshot: take a screenshot'
echo '  workspace-action: execute a Hyprland workspace dispatcher in the current group'
echo '  change-wallpaper: change the wallpaper'
echo '  pip: move the focused window into picture in picture mode or start the pip daemon'