blob: dae8246b3b25c75fe983ba4aeb369265b80e473e (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
{
config,
pkgs,
lib,
...
}: let
cfg = config.features.gui.desktops.niri.parts.selectors;
aes = config.aesthetics;
in {
options.features.gui.desktops.niri.parts.selectors.enable = lib.mkEnableOption "selectors";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
# Tool Selector
(
pkgs.writers.writeNuBin "tool-selector"
/*
nu
*/
''
# Tools
let tools = {
"rebuild nixos": {
# footclient -H sudo nixos-rebuild switch --flake ($"~/Sync/setup#(hostname)" | path expand)
footclient -H nh os switch
}
"rebuild home": {
# footclient -H home-manager switch --flake ($"~/Sync/setup#(whoami)@(hostname)" | path expand)
footclient -H nh home switch
}
"update flake": {
footclient -H nix flake update --flake ($"~/Sync/setup/" | path expand)
}
"manage wifi": {
footclient ${pkgs.impala}/bin/impala
}
"manage bluetooth": {
footclient ${lib.getExe pkgs.bluetui}
}
"create qr-code": {
let temp_file = mktemp
let qr_code_bin = ${lib.getExe pkgs.qrtool} encode (${pkgs.wl-clipboard}/bin/wl-paste)
$qr_code_bin | ${pkgs.wl-clipboard}/bin/wl-copy
$qr_code_bin | save -f $temp_file
${lib.getExe pkgs.imv} $temp_file
}
"steam big-picture": {
gamescope -f -- steam -bigpicture
}
}
# Logic
let user_tool_choice = $tools
| columns
| to text
| fuzzel -d --placeholder "Tools"
if ($user_tool_choice != "") {
do ($tools | get $user_tool_choice)
}
''
)
# Wallpaper Selector
(
writers.writeNuBin "wallpaper-selector"
/*
nu
*/
''
def main [
--all-outputs # Change wallpaper for all outputs
--randomize
] {
mut wallpapers = {}
for path in (ls ${aes.wallpapersDir}/**/* | where {|item| $item.type != dir} | get name) {
$wallpapers = $wallpapers | insert ($path | path basename | split row "." | get 0) $path
}
mut prompt = "Wallpaper (current)"
if $all_outputs {
$prompt = "Wallpaper (all)"
}
mut wallpaper_path = ""
if $randomize {
$wallpaper_path = $wallpapers | get (
$wallpapers
| columns
| shuffle
| get 0
)
} else {
$wallpaper_path = $wallpapers | get (
$wallpapers
| columns
| to text
| ${lib.getExe pkgs.fuzzel} -d --placeholder $prompt
)
}
if $all_outputs {
${lib.getExe pkgs.swww} img $wallpaper_path -t wipe --transition-fps 60 --transition-angle 45
} else {
let focused_display = niri msg -j focused-output
| from json
| get name
${lib.getExe pkgs.swww} img $wallpaper_path -t wipe --transition-fps 60 --transition-angle 45 --outputs $focused_display
}
}
''
)
# Clipboard Selector
(
writers.writeNuBin "clipboard-selector" ''
${lib.getExe pkgs.cliphist} list
| cut -f 2-
| ${lib.getExe pkgs.fuzzel} --dmenu
| ${pkgs.wl-clipboard}/bin/wl-copy
''
)
];
};
}
|