Sway: Rewrite to replaceVars.
This commit is contained in:
parent
ff6e01975f
commit
d0af9eca9e
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
__findFile,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
@ -6,7 +7,166 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
swayRcRaw = pkgs.writeText "sway-rc-raw" (util.readFiles [
|
fontName = config.module.style.font.sansSerif.name;
|
||||||
|
keyboardLayouts = config.module.keyboard.layouts;
|
||||||
|
keyboardOptions = config.module.keyboard.options;
|
||||||
|
|
||||||
|
alpha = config.module.style.opacity.hex;
|
||||||
|
accent = config.module.style.color.accent + alpha;
|
||||||
|
border = config.module.style.color.border + alpha;
|
||||||
|
borderSize = config.module.style.window.border;
|
||||||
|
fg = config.module.style.color.fg.light;
|
||||||
|
wallpaper = config.module.wallpaper.path;
|
||||||
|
windowGap = config.module.style.window.gap;
|
||||||
|
|
||||||
|
codec = "libsvtav1";
|
||||||
|
color = config.module.style.color;
|
||||||
|
container = "mp4";
|
||||||
|
format = "%Y-%m-%d_%H-%M-%S";
|
||||||
|
framerate = 10;
|
||||||
|
opacity = "26";
|
||||||
|
pixfmt = "yuv420p10le";
|
||||||
|
selection = "slurp -d -b ${color.bg.light}${opacity} -c ${color.fg.light} -w 0 -s 00000000";
|
||||||
|
|
||||||
|
notifyStart = ''swayscript notify_short'';
|
||||||
|
notifyEnd = ''swayscript notify_long'';
|
||||||
|
picEdit = ''swappy -f - -o -'';
|
||||||
|
picFull = ''-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -'';
|
||||||
|
picPrepFile = prepFile "\${XDG_PICTURES_DIR[0]}" "png";
|
||||||
|
picRefLatestFile = refLatestFile "png";
|
||||||
|
picSelected = ''-g "''${scrSelection}" -'';
|
||||||
|
picToBuffer = ''wl-copy -t image/png'';
|
||||||
|
picToFile = ''tee "''${scrFile}"'';
|
||||||
|
screenshot = ''grim'';
|
||||||
|
updateWaybar = ''{ pkill -RTMIN+4 waybar; } & disown''; # NOTE: Might need to add a delay here if it becomes inconsistent one day.
|
||||||
|
vidFull = ''-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -'';
|
||||||
|
vidPrepFile = prepFile "\${XDG_VIDEOS_DIR[0]}" container;
|
||||||
|
vidRefLatestFile = refLatestFile container;
|
||||||
|
vidSelected = ''--geometry "''${scrSelection}"'';
|
||||||
|
vidStop = ''pkill -SIGINT wf-recorder'';
|
||||||
|
|
||||||
|
prepFile = path: ext: ''
|
||||||
|
# Focused app id by default.
|
||||||
|
curWindow=$(parse_snake $(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .app_id'))
|
||||||
|
|
||||||
|
# If no id (i.e. xwayland), then use a name (title).
|
||||||
|
[[ "''${curWindow}" = "null" ]] && curWindow=$(parse_snake $(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .name'))
|
||||||
|
|
||||||
|
# If no app in focus, use "unknown" dir.
|
||||||
|
[[ "''${curWindow}" =~ ^[0-9]+$ ]] && curWindow="unknown"
|
||||||
|
|
||||||
|
# Prepare dir and file path.
|
||||||
|
scrPath="${path}"
|
||||||
|
scrDir="${path}/''${curWindow}"
|
||||||
|
mkdir -p "''${scrDir}"
|
||||||
|
scrName="$(date +${format}).${ext}"
|
||||||
|
scrFile="''${scrDir}/''${scrName}"
|
||||||
|
scrLatestRef="./''${curWindow}/''${scrName}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
refLatestFile = ext: ''
|
||||||
|
scrLatest="''${scrPath}/Latest.${ext}"
|
||||||
|
rm "''${scrLatest}"
|
||||||
|
ln -s "''${scrLatestRef}" "''${scrLatest}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
getSelection = ''
|
||||||
|
scrSelection=$(${selection})
|
||||||
|
[[ -n "''${scrSelection}" ]] || exit
|
||||||
|
'';
|
||||||
|
|
||||||
|
getTransform = ''
|
||||||
|
scrTransform="$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .transform')"
|
||||||
|
[[ "''${scrTransform}" = "normal" ]] && scrTransform=""
|
||||||
|
'';
|
||||||
|
|
||||||
|
vidStart = ''
|
||||||
|
wf-recorder \
|
||||||
|
--no-damage \
|
||||||
|
--codec ${codec} \
|
||||||
|
--file "''${scrFile}" \
|
||||||
|
--framerate ${toString framerate} \
|
||||||
|
--pixel-format ${pixfmt} \
|
||||||
|
'';
|
||||||
|
|
||||||
|
vidMuxAudio = ''
|
||||||
|
ffmpeg \
|
||||||
|
-f lavfi \
|
||||||
|
-i anullsrc=channel_layout=stereo:sample_rate=44100 \
|
||||||
|
-i "''${scrFile}" \
|
||||||
|
-c:v copy \
|
||||||
|
-c:a libopus \
|
||||||
|
-shortest \
|
||||||
|
-f ${container} \
|
||||||
|
"''${scrFile}_" \
|
||||||
|
&& mv "''${scrFile}_" "''${scrFile}" \
|
||||||
|
|| rm "''${scrFile}_"
|
||||||
|
'';
|
||||||
|
|
||||||
|
vidTransform = ''
|
||||||
|
if [[ -n "''${scrTransform}" ]]; then
|
||||||
|
ffmpeg \
|
||||||
|
-display_rotation ''${scrTransform} \
|
||||||
|
-i "''${scrFile}" \
|
||||||
|
-c copy \
|
||||||
|
-f ${container} \
|
||||||
|
"''${scrFile}_" \
|
||||||
|
&& mv "''${scrFile}_" "''${scrFile}" \
|
||||||
|
|| rm "''${scrFile}_"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
SelectRecording = pkgs.writeShellScriptBin "SelectRecording" ''
|
||||||
|
${vidStop} || {
|
||||||
|
${getSelection}
|
||||||
|
${getTransform}
|
||||||
|
${vidPrepFile}
|
||||||
|
${notifyStart}
|
||||||
|
${updateWaybar}
|
||||||
|
${vidStart} ${vidSelected}
|
||||||
|
${notifyEnd}
|
||||||
|
${updateWaybar}
|
||||||
|
${vidMuxAudio}
|
||||||
|
${vidTransform}
|
||||||
|
${vidRefLatestFile}
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
|
||||||
|
FullscreenRecording = pkgs.writeShellScriptBin "FullscreenRecording" ''
|
||||||
|
${vidStop} || {
|
||||||
|
${getTransform}
|
||||||
|
${vidPrepFile}
|
||||||
|
${notifyStart}
|
||||||
|
${updateWaybar}
|
||||||
|
${vidStart} ${vidFull}
|
||||||
|
${notifyEnd}
|
||||||
|
${updateWaybar}
|
||||||
|
${vidMuxAudio}
|
||||||
|
${vidTransform}
|
||||||
|
${vidRefLatestFile}
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
|
||||||
|
FullscreenScreenshot = pkgs.writeShellScriptBin "FullscreenScreenshot" ''
|
||||||
|
${notifyEnd}
|
||||||
|
${picPrepFile}
|
||||||
|
|
||||||
|
${screenshot} ${picFull} | ${picToFile} | ${picToBuffer}
|
||||||
|
${picRefLatestFile}
|
||||||
|
'';
|
||||||
|
|
||||||
|
SelectScreenshot = pkgs.writeShellScriptBin "SelectScreenshot" ''
|
||||||
|
${getSelection}
|
||||||
|
${notifyStart}
|
||||||
|
${picPrepFile}
|
||||||
|
|
||||||
|
${screenshot} ${picSelected} | ${picEdit} | ${picToFile} | ${picToBuffer}
|
||||||
|
${notifyEnd}
|
||||||
|
${picRefLatestFile}
|
||||||
|
'';
|
||||||
|
|
||||||
|
swayRcRaw = pkgs.writeText "sway-rc-raw" (
|
||||||
|
util.readFiles [
|
||||||
./module/Mod.conf
|
./module/Mod.conf
|
||||||
./module/Style.conf
|
./module/Style.conf
|
||||||
./module/Display.conf
|
./module/Display.conf
|
||||||
|
@ -23,12 +183,32 @@ let
|
||||||
./module/Sound.conf
|
./module/Sound.conf
|
||||||
./module/Tiling.conf
|
./module/Tiling.conf
|
||||||
./module/Workspace.conf
|
./module/Workspace.conf
|
||||||
./module/Session.conf
|
|
||||||
./module/Keyd.conf
|
./module/Keyd.conf
|
||||||
./module/Waybar.conf
|
./module/Waybar.conf
|
||||||
./module/System.conf
|
./module/System.conf
|
||||||
./module/Mouse.conf
|
./module/Mouse.conf
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
swayRc = (pkgs.replaceVars swayRcRaw {
|
||||||
|
inherit
|
||||||
|
FullscreenRecording
|
||||||
|
FullscreenScreenshot
|
||||||
|
SelectRecording
|
||||||
|
SelectScreenshot
|
||||||
|
accent
|
||||||
|
border
|
||||||
|
borderSize
|
||||||
|
fg
|
||||||
|
fontName
|
||||||
|
keyboardLayouts
|
||||||
|
keyboardOptions
|
||||||
|
wallpaper
|
||||||
|
windowGap
|
||||||
|
;
|
||||||
|
}).overrideAttrs (old: {
|
||||||
|
doCheck = false;
|
||||||
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
text =
|
text =
|
||||||
|
@ -36,6 +216,6 @@ in
|
||||||
# Read `man 5 sway` for a complete reference.
|
# Read `man 5 sway` for a complete reference.
|
||||||
include /etc/sway/config.d/*
|
include /etc/sway/config.d/*
|
||||||
''
|
''
|
||||||
+ swayRc
|
+ builtins.readFile swayRc
|
||||||
+ lib.concatStringsSep "\n" config.module.sway.extraConfig;
|
+ lib.concatStringsSep "\n" config.module.sway.extraConfig;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
{ ... }:
|
# You can get the names of your outputs by running: swaymsg -t get_outputs
|
||||||
{
|
output * scale 1
|
||||||
text = ''
|
|
||||||
# You can get the names of your outputs by running: swaymsg -t get_outputs
|
|
||||||
output * scale 1
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,9 +1 @@
|
||||||
{ config, ... }:
|
font "@fontName@ Medium 0.01"
|
||||||
let
|
|
||||||
fontName = config.module.style.font.sansSerif.name;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
text = ''
|
|
||||||
font "${fontName} Medium 0.01"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +1,42 @@
|
||||||
{ config, ... }:
|
### Input configuration
|
||||||
{
|
#
|
||||||
text = ''
|
# Example configuration:
|
||||||
### Input configuration
|
#
|
||||||
#
|
# input "2:14:SynPS/2_Synaptics_TouchPad" {
|
||||||
# Example configuration:
|
# dwt enabled
|
||||||
#
|
# tap enabled
|
||||||
# input "2:14:SynPS/2_Synaptics_TouchPad" {
|
# natural_scroll enabled
|
||||||
# dwt enabled
|
# middle_emulation enabled
|
||||||
# tap enabled
|
# }
|
||||||
# natural_scroll enabled
|
#
|
||||||
# middle_emulation enabled
|
# You can get the names of your inputs by running: swaymsg -t get_inputs
|
||||||
# }
|
# Read `man 5 sway-input` for more information about this section.
|
||||||
#
|
|
||||||
# You can get the names of your inputs by running: swaymsg -t get_inputs
|
|
||||||
# Read `man 5 sway-input` for more information about this section.
|
|
||||||
|
|
||||||
input type:pointer {
|
input type:pointer {
|
||||||
accel_profile flat
|
accel_profile flat
|
||||||
pointer_accel 0
|
pointer_accel 0
|
||||||
dwt enabled
|
dwt enabled
|
||||||
tap enabled
|
tap enabled
|
||||||
natural_scroll enabled
|
natural_scroll enabled
|
||||||
middle_emulation enabled
|
middle_emulation enabled
|
||||||
}
|
|
||||||
|
|
||||||
input type:touchpad {
|
|
||||||
accel_profile flat
|
|
||||||
pointer_accel 0
|
|
||||||
dwt enabled
|
|
||||||
tap enabled
|
|
||||||
natural_scroll enabled
|
|
||||||
middle_emulation enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
input type:keyboard {
|
|
||||||
xkb_layout ${config.module.keyboard.layouts}
|
|
||||||
xkb_options ${config.module.keyboard.options}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Hide mouse cursor after a period of inactivity.
|
|
||||||
seat seat0 hide_cursor 5000
|
|
||||||
|
|
||||||
# Per-window languages.
|
|
||||||
exec swaykbdd
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input type:touchpad {
|
||||||
|
accel_profile flat
|
||||||
|
pointer_accel 0
|
||||||
|
dwt enabled
|
||||||
|
tap enabled
|
||||||
|
natural_scroll enabled
|
||||||
|
middle_emulation enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
input type:keyboard {
|
||||||
|
xkb_layout @keyboardLayouts@
|
||||||
|
xkb_options @keyboardOptions@
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hide mouse cursor after a period of inactivity.
|
||||||
|
seat seat0 hide_cursor 5000
|
||||||
|
|
||||||
|
# Per-window languages.
|
||||||
|
exec swaykbdd
|
||||||
|
|
|
@ -1,6 +1 @@
|
||||||
{ ... }:
|
exec keyd-application-mapper -d
|
||||||
{
|
|
||||||
text = ''
|
|
||||||
exec keyd-application-mapper -d
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
{ ... }:
|
# Application launcher.
|
||||||
{
|
# Note: pass the final command to swaymsg so that the resulting window can be opened
|
||||||
text = ''
|
# on the original workspace that the command was run on.
|
||||||
# Application launcher.
|
set $menu fuzzel
|
||||||
# Note: pass the final command to swaymsg so that the resulting window can be opened
|
|
||||||
# on the original workspace that the command was run on.
|
|
||||||
set $menu fuzzel
|
|
||||||
|
|
||||||
bindsym $mod+space exec $menu
|
bindsym $mod+space exec $menu
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
{ ... }:
|
# Meta key. Use Mod1 for Alt.
|
||||||
{
|
set $mod Mod4
|
||||||
text = ''
|
set $sysmod print
|
||||||
# Meta key. Use Mod1 for Alt.
|
|
||||||
set $mod Mod4
|
|
||||||
set $sysmod print
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
{ ... }:
|
bindsym --whole-window $mod+button2 kill
|
||||||
{
|
bindsym --whole-window $mod+button8 floating toggle
|
||||||
text = ''
|
bindsym --whole-window $mod+button9 fullscreen
|
||||||
bindsym --whole-window $mod+button2 kill
|
|
||||||
bindsym --whole-window $mod+button8 floating toggle
|
|
||||||
bindsym --whole-window $mod+button9 fullscreen
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
{ ... }:
|
# Move focus.
|
||||||
{
|
bindsym --to-code $mod+a focus left
|
||||||
text = ''
|
bindsym --to-code $mod+d focus right
|
||||||
# Move focus.
|
bindsym --to-code $mod+s focus down
|
||||||
bindsym --to-code $mod+a focus left
|
bindsym --to-code $mod+w focus up
|
||||||
bindsym --to-code $mod+d focus right
|
|
||||||
bindsym --to-code $mod+s focus down
|
|
||||||
bindsym --to-code $mod+w focus up
|
|
||||||
|
|
||||||
# Move the focused window.
|
# Move the focused window.
|
||||||
bindsym --to-code $mod+Shift+a move left
|
bindsym --to-code $mod+Shift+a move left
|
||||||
bindsym --to-code $mod+Shift+d move right
|
bindsym --to-code $mod+Shift+d move right
|
||||||
bindsym --to-code $mod+Shift+s move down
|
bindsym --to-code $mod+Shift+s move down
|
||||||
bindsym --to-code $mod+Shift+w move up
|
bindsym --to-code $mod+Shift+w move up
|
||||||
|
|
||||||
# Focus mouse following.
|
# Focus mouse following.
|
||||||
focus_follows_mouse yes
|
focus_follows_mouse yes
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
{ ... }:
|
# Show last notification.
|
||||||
{
|
bindsym --to-code $mod+shift+n exec makoctl restore
|
||||||
text = ''
|
|
||||||
# Show last notification.
|
|
||||||
bindsym --to-code $mod+shift+n exec makoctl restore
|
|
||||||
|
|
||||||
# Hide all notifications.
|
# Hide all notifications.
|
||||||
bindsym --to-code $mod+n exec makoctl dismiss --all
|
bindsym --to-code $mod+n exec makoctl dismiss --all
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +1,4 @@
|
||||||
{ ... }:
|
bindsym --to-code $mod+j resize grow height 10px
|
||||||
let
|
bindsym --to-code $mod+k resize shrink height 10px
|
||||||
stepHorizontal = 10;
|
bindsym --to-code $mod+h resize shrink width 10px
|
||||||
stepVertical = 10;
|
bindsym --to-code $mod+l resize grow width 10px
|
||||||
in
|
|
||||||
{
|
|
||||||
text = ''
|
|
||||||
bindsym --to-code $mod+j resize grow height ${toString stepVertical}px
|
|
||||||
bindsym --to-code $mod+k resize shrink height ${toString stepVertical}px
|
|
||||||
bindsym --to-code $mod+h resize shrink width ${toString stepHorizontal}px
|
|
||||||
bindsym --to-code $mod+l resize grow width ${toString stepHorizontal}px
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,53 +1,48 @@
|
||||||
{ ... }:
|
# Sway has a "scratchpad", which is a bag of holding for windows.
|
||||||
{
|
# You can send windows there and get them back later.
|
||||||
text = ''
|
# NOTE: Get id with `swaymsg -t get_tree`.
|
||||||
# Sway has a "scratchpad", which is a bag of holding for windows.
|
|
||||||
# You can send windows there and get them back later.
|
|
||||||
# NOTE: Get id with `swaymsg -t get_tree`.
|
|
||||||
|
|
||||||
# Show the next scratchpad window or hide the focused scratchpad window.
|
# Show the next scratchpad window or hide the focused scratchpad window.
|
||||||
# If there are multiple scratchpad windows, this command cycles through them.
|
# If there are multiple scratchpad windows, this command cycles through them.
|
||||||
bindsym --to-code $mod+c scratchpad show
|
bindsym --to-code $mod+c scratchpad show
|
||||||
bindsym --to-code $mod+shift+C move scratchpad
|
bindsym --to-code $mod+shift+C move scratchpad
|
||||||
bindsym --to-code $mod+shift+X exec swayscript scratchpad_kill
|
bindsym --to-code $mod+shift+X exec swayscript scratchpad_kill
|
||||||
|
|
||||||
# Fix for a goddamn Firefox WebRTC indicator.
|
# Fix for a goddamn Firefox WebRTC indicator.
|
||||||
for_window [app_id="firefox" title="Firefox — Sharing Indicator"] {
|
for_window [app_id="firefox" title="Firefox — Sharing Indicator"] {
|
||||||
kill
|
kill
|
||||||
}
|
}
|
||||||
|
|
||||||
# NetworkManager.
|
# NetworkManager.
|
||||||
for_window [app_id="nm-connection-editor"] {
|
for_window [app_id="nm-connection-editor"] {
|
||||||
move scratchpad
|
move scratchpad
|
||||||
scratchpad show
|
scratchpad show
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bluetooth.
|
# Bluetooth.
|
||||||
for_window [app_id=".blueman-manager-wrapped"] {
|
for_window [app_id=".blueman-manager-wrapped"] {
|
||||||
move scratchpad
|
move scratchpad
|
||||||
scratchpad show
|
scratchpad show
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sound.
|
# Sound.
|
||||||
for_window [app_id="pavucontrol"] {
|
for_window [app_id="pavucontrol"] {
|
||||||
move scratchpad
|
move scratchpad
|
||||||
scratchpad show
|
scratchpad show
|
||||||
}
|
}
|
||||||
|
|
||||||
# Android emulator controls.
|
# Android emulator controls.
|
||||||
for_window [title="Emulator" window_type="utility"] {
|
for_window [title="Emulator" window_type="utility"] {
|
||||||
move scratchpad
|
move scratchpad
|
||||||
}
|
}
|
||||||
|
|
||||||
# Calculator.
|
# Calculator.
|
||||||
for_window [app_id="org.gnome.Calculator"] {
|
for_window [app_id="org.gnome.Calculator"] {
|
||||||
move scratchpad
|
move scratchpad
|
||||||
scratchpad show
|
scratchpad show
|
||||||
}
|
}
|
||||||
|
|
||||||
# JamesDsp.
|
# JamesDsp.
|
||||||
for_window [title="JamesDSP for Linux"] {
|
for_window [title="JamesDSP for Linux"] {
|
||||||
move scratchpad
|
move scratchpad
|
||||||
}
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,165 +1,5 @@
|
||||||
{
|
bindsym --to-code $mod+y exec @FullscreenScreenshot@/bin/FullscreenScreenshot}
|
||||||
__findFile,
|
bindsym --to-code $mod+shift+y exec @FullscreenRecording@/bin/FullscreenRecording}
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
codec = "libsvtav1";
|
|
||||||
color = config.module.style.color;
|
|
||||||
container = "mp4";
|
|
||||||
format = "%Y-%m-%d_%H-%M-%S";
|
|
||||||
framerate = 10;
|
|
||||||
opacity = "26";
|
|
||||||
pixfmt = "yuv420p10le";
|
|
||||||
selection = "slurp -d -b ${color.bg.light}${opacity} -c ${color.fg.light} -w 0 -s 00000000";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
text =
|
|
||||||
let
|
|
||||||
notifyStart = ''swayscript notify_short'';
|
|
||||||
notifyEnd = ''swayscript notify_long'';
|
|
||||||
picEdit = ''swappy -f - -o -'';
|
|
||||||
picFull = ''-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -'';
|
|
||||||
picPrepFile = prepFile "\${XDG_PICTURES_DIR[0]}" "png";
|
|
||||||
picRefLatestFile = refLatestFile "png";
|
|
||||||
picSelected = ''-g "''${scrSelection}" -'';
|
|
||||||
picToBuffer = ''wl-copy -t image/png'';
|
|
||||||
picToFile = ''tee "''${scrFile}"'';
|
|
||||||
screenshot = ''grim'';
|
|
||||||
updateWaybar = ''{ pkill -RTMIN+4 waybar; } & disown''; # NOTE: Might need to add a delay here if it becomes inconsistent one day.
|
|
||||||
vidFull = ''-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -'';
|
|
||||||
vidPrepFile = prepFile "\${XDG_VIDEOS_DIR[0]}" container;
|
|
||||||
vidRefLatestFile = refLatestFile container;
|
|
||||||
vidSelected = ''--geometry "''${scrSelection}"'';
|
|
||||||
vidStop = ''pkill -SIGINT wf-recorder'';
|
|
||||||
|
|
||||||
prepFile = path: ext: ''
|
bindsym --to-code $mod+v exec @SelectScreenshot@/bin/SelectScreenshot}
|
||||||
# Focused app id by default.
|
bindsym --to-code $mod+shift+v exec @SelectRecording@/bin/SelectRecording}
|
||||||
curWindow=$(parse_snake $(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .app_id'))
|
|
||||||
|
|
||||||
# If no id (i.e. xwayland), then use a name (title).
|
|
||||||
[[ "''${curWindow}" = "null" ]] && curWindow=$(parse_snake $(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .name'))
|
|
||||||
|
|
||||||
# If no app in focus, use "unknown" dir.
|
|
||||||
[[ "''${curWindow}" =~ ^[0-9]+$ ]] && curWindow="unknown"
|
|
||||||
|
|
||||||
# Prepare dir and file path.
|
|
||||||
scrPath="${path}"
|
|
||||||
scrDir="${path}/''${curWindow}"
|
|
||||||
mkdir -p "''${scrDir}"
|
|
||||||
scrName="$(date +${format}).${ext}"
|
|
||||||
scrFile="''${scrDir}/''${scrName}"
|
|
||||||
scrLatestRef="./''${curWindow}/''${scrName}"
|
|
||||||
'';
|
|
||||||
|
|
||||||
refLatestFile = ext: ''
|
|
||||||
scrLatest="''${scrPath}/Latest.${ext}"
|
|
||||||
rm "''${scrLatest}"
|
|
||||||
ln -s "''${scrLatestRef}" "''${scrLatest}"
|
|
||||||
'';
|
|
||||||
|
|
||||||
getSelection = ''
|
|
||||||
scrSelection=$(${selection})
|
|
||||||
[[ -n "''${scrSelection}" ]] || exit
|
|
||||||
'';
|
|
||||||
|
|
||||||
getTransform = ''
|
|
||||||
scrTransform="$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .transform')"
|
|
||||||
[[ "''${scrTransform}" = "normal" ]] && scrTransform=""
|
|
||||||
'';
|
|
||||||
|
|
||||||
vidStart = ''
|
|
||||||
wf-recorder \
|
|
||||||
--no-damage \
|
|
||||||
--codec ${codec} \
|
|
||||||
--file "''${scrFile}" \
|
|
||||||
--framerate ${toString framerate} \
|
|
||||||
--pixel-format ${pixfmt} \
|
|
||||||
'';
|
|
||||||
|
|
||||||
vidMuxAudio = ''
|
|
||||||
ffmpeg \
|
|
||||||
-f lavfi \
|
|
||||||
-i anullsrc=channel_layout=stereo:sample_rate=44100 \
|
|
||||||
-i "''${scrFile}" \
|
|
||||||
-c:v copy \
|
|
||||||
-c:a libopus \
|
|
||||||
-shortest \
|
|
||||||
-f ${container} \
|
|
||||||
"''${scrFile}_" \
|
|
||||||
&& mv "''${scrFile}_" "''${scrFile}" \
|
|
||||||
|| rm "''${scrFile}_"
|
|
||||||
'';
|
|
||||||
|
|
||||||
vidTransform = ''
|
|
||||||
if [[ -n "''${scrTransform}" ]]; then
|
|
||||||
ffmpeg \
|
|
||||||
-display_rotation ''${scrTransform} \
|
|
||||||
-i "''${scrFile}" \
|
|
||||||
-c copy \
|
|
||||||
-f ${container} \
|
|
||||||
"''${scrFile}_" \
|
|
||||||
&& mv "''${scrFile}_" "''${scrFile}" \
|
|
||||||
|| rm "''${scrFile}_"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
|
|
||||||
SelectRecording = pkgs.writeShellScriptBin "SelectRecording" ''
|
|
||||||
${vidStop} || {
|
|
||||||
${getSelection}
|
|
||||||
${getTransform}
|
|
||||||
${vidPrepFile}
|
|
||||||
${notifyStart}
|
|
||||||
${updateWaybar}
|
|
||||||
${vidStart} ${vidSelected}
|
|
||||||
${notifyEnd}
|
|
||||||
${updateWaybar}
|
|
||||||
${vidMuxAudio}
|
|
||||||
${vidTransform}
|
|
||||||
${vidRefLatestFile}
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
|
|
||||||
FullscreenRecording = pkgs.writeShellScriptBin "FullscreenRecording" ''
|
|
||||||
${vidStop} || {
|
|
||||||
${getTransform}
|
|
||||||
${vidPrepFile}
|
|
||||||
${notifyStart}
|
|
||||||
${updateWaybar}
|
|
||||||
${vidStart} ${vidFull}
|
|
||||||
${notifyEnd}
|
|
||||||
${updateWaybar}
|
|
||||||
${vidMuxAudio}
|
|
||||||
${vidTransform}
|
|
||||||
${vidRefLatestFile}
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
|
|
||||||
FullscreenScreenshot = pkgs.writeShellScriptBin "FullscreenScreenshot" ''
|
|
||||||
${notifyEnd}
|
|
||||||
${picPrepFile}
|
|
||||||
|
|
||||||
${screenshot} ${picFull} | ${picToFile} | ${picToBuffer}
|
|
||||||
${picRefLatestFile}
|
|
||||||
'';
|
|
||||||
|
|
||||||
SelectScreenshot = pkgs.writeShellScriptBin "SelectScreenshot" ''
|
|
||||||
${getSelection}
|
|
||||||
${notifyStart}
|
|
||||||
${picPrepFile}
|
|
||||||
|
|
||||||
${screenshot} ${picSelected} | ${picEdit} | ${picToFile} | ${picToBuffer}
|
|
||||||
${notifyEnd}
|
|
||||||
${picRefLatestFile}
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
''
|
|
||||||
bindsym --to-code $mod+y exec ${lib.getExe FullscreenScreenshot}
|
|
||||||
bindsym --to-code $mod+shift+y exec ${lib.getExe FullscreenRecording}
|
|
||||||
|
|
||||||
bindsym --to-code $mod+v exec ${lib.getExe SelectScreenshot}
|
|
||||||
bindsym --to-code $mod+shift+v exec ${lib.getExe SelectRecording}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{ config, ... }:
|
|
||||||
let
|
|
||||||
lock = "swaylock -f -F -c 000000 -k --font \"${config.module.style.font.serif.name}\" --font-size ${toString config.module.style.font.size.desktop}";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
text = ''
|
|
||||||
bindsym --to-code $mod+z exec '_twice 1 ${lock}'
|
|
||||||
bindsym --to-code $mod+Shift+Z exec _twice 1 bash -c '${lock}; systemctl suspend -i'
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,22 +1,13 @@
|
||||||
{ ... }:
|
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +5%'
|
||||||
let
|
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -5%'
|
||||||
step_music = 10;
|
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
|
||||||
step_volume = 5;
|
bindsym XF86AudioMicMute exec 'pactl set-source-mute @DEFAULT_SOURCE@ toggle'
|
||||||
in
|
|
||||||
{
|
|
||||||
text = ''
|
|
||||||
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%'
|
|
||||||
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -${toString step_volume}%'
|
|
||||||
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
|
|
||||||
bindsym XF86AudioMicMute exec 'pactl set-source-mute @DEFAULT_SOURCE@ toggle'
|
|
||||||
|
|
||||||
bindsym XF86AudioPlay exec 'playerctl play-pause'
|
bindsym XF86AudioPlay exec 'playerctl play-pause'
|
||||||
bindsym XF86AudioPause exec 'playerctl pause'
|
bindsym XF86AudioPause exec 'playerctl pause'
|
||||||
bindsym XF86AudioStop exec 'playerctl stop'
|
bindsym XF86AudioStop exec 'playerctl stop'
|
||||||
bindsym XF86AudioNext exec 'playerctl next'
|
bindsym XF86AudioNext exec 'playerctl next'
|
||||||
bindsym XF86AudioPrev exec 'playerctl previous'
|
bindsym XF86AudioPrev exec 'playerctl previous'
|
||||||
bindsym XF86Forward exec 'playerctl position ${toString step_music}+'
|
bindsym XF86Forward exec 'playerctl position 10+'
|
||||||
bindsym XF86Back exec 'playerctl position ${toString step_music}-'
|
bindsym XF86Back exec 'playerctl position 10-'
|
||||||
bindsym XF86Eject exec 'swayscript sound_output_cycle'
|
bindsym XF86Eject exec 'swayscript sound_output_cycle'
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,17 +1,6 @@
|
||||||
{ config, ... }:
|
output * bg @wallpaper@ fill
|
||||||
let
|
client.focused "#@accent@" "#@accent@" "#@fg@" "#@accent@" "#@accent@"
|
||||||
accent = config.module.style.color.accent + alpha;
|
client.focused_inactive "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@"
|
||||||
alpha = config.module.style.opacity.hex;
|
client.unfocused "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@"
|
||||||
border = config.module.style.color.border + alpha;
|
client.urgent "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@"
|
||||||
fg = config.module.style.color.fg.light;
|
client.placeholder "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@"
|
||||||
in
|
|
||||||
{
|
|
||||||
text = ''
|
|
||||||
output * bg ${config.module.wallpaper.path} fill
|
|
||||||
client.focused "#${accent}" "#${accent}" "#${fg}" "#${accent}" "#${accent}"
|
|
||||||
client.focused_inactive "#${border}" "#${border}" "#${fg}" "#${border}" "#${border}"
|
|
||||||
client.unfocused "#${border}" "#${border}" "#${fg}" "#${border}" "#${border}"
|
|
||||||
client.urgent "#${border}" "#${border}" "#${fg}" "#${border}" "#${border}"
|
|
||||||
client.placeholder "#${border}" "#${border}" "#${fg}" "#${border}" "#${border}"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
{ ... }:
|
bindsym $sysmod input * xkb_switch_layout 0
|
||||||
let
|
bindsym --to-code $sysmod+a exec 'swayscript network'
|
||||||
brstep = 5;
|
bindsym --to-code $sysmod+c exec 'systemctl reboot -i'
|
||||||
in
|
bindsym --to-code $sysmod+d exec 'swayscript dnd'
|
||||||
{
|
bindsym --to-code $sysmod+g exec 'swayscript gaming'
|
||||||
text = ''
|
bindsym --to-code $sysmod+l exec 'powerlimit toggle'
|
||||||
bindsym $sysmod input * xkb_switch_layout 0
|
bindsym --to-code $sysmod+m exec 'swayscript monitor'
|
||||||
bindsym --to-code $sysmod+a exec 'swayscript network'
|
bindsym --to-code $sysmod+p exec 'powersave toggle'
|
||||||
bindsym --to-code $sysmod+c exec 'systemctl reboot -i'
|
bindsym --to-code $sysmod+r exec 'swayscript reload'
|
||||||
bindsym --to-code $sysmod+d exec 'swayscript dnd'
|
bindsym --to-code $sysmod+v exec 'swayscript vpn'
|
||||||
bindsym --to-code $sysmod+g exec 'swayscript gaming'
|
bindsym --to-code $sysmod+x exec 'systemctl poweroff -i'
|
||||||
bindsym --to-code $sysmod+l exec 'powerlimit toggle'
|
bindsym --to-code $sysmod+z exec 'systemctl suspend -i'
|
||||||
bindsym --to-code $sysmod+m exec 'swayscript monitor'
|
|
||||||
bindsym --to-code $sysmod+p exec 'powersave toggle'
|
|
||||||
bindsym --to-code $sysmod+r exec 'swayscript reload'
|
|
||||||
bindsym --to-code $sysmod+v exec 'swayscript vpn'
|
|
||||||
bindsym --to-code $sysmod+x exec 'systemctl poweroff -i'
|
|
||||||
bindsym --to-code $sysmod+z exec 'systemctl suspend -i'
|
|
||||||
|
|
||||||
bindsym --to-code $sysmod+w exec light -A ${toString brstep}
|
bindsym --to-code $sysmod+w exec light -A 5
|
||||||
bindsym XF86MonBrightnessUp exec light -A ${toString brstep}
|
bindsym XF86MonBrightnessUp exec light -A 5
|
||||||
bindsym --to-code $sysmod+s exec light -U ${toString brstep}
|
bindsym --to-code $sysmod+s exec light -U 5
|
||||||
bindsym XF86MonBrightnessDown exec light -U ${toString brstep}
|
bindsym XF86MonBrightnessDown exec light -U 5
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
{ ... }:
|
set $term foot
|
||||||
{
|
|
||||||
text = ''
|
|
||||||
set $term foot
|
|
||||||
|
|
||||||
bindsym --to-code $mod+Escape exec $term -e bash -i -c "tmux new-session -A -s $USER; bash -i"
|
bindsym --to-code $mod+Escape exec $term -e bash -i -c "tmux new-session -A -s $USER; bash -i"
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,36 +1,31 @@
|
||||||
{ config, ... }:
|
# Toggle tiling.
|
||||||
{
|
bindsym --to-code $mod+shift+f floating toggle
|
||||||
text = ''
|
|
||||||
# Toggle tiling.
|
|
||||||
bindsym --to-code $mod+shift+f floating toggle
|
|
||||||
|
|
||||||
# Swap focus between the tiling area and the floating area
|
# Swap focus between the tiling area and the floating area
|
||||||
bindsym --to-code $mod+r focus mode_toggle
|
bindsym --to-code $mod+r focus mode_toggle
|
||||||
|
|
||||||
# Split directions.
|
# Split directions.
|
||||||
bindsym --to-code $mod+backslash splith
|
bindsym --to-code $mod+backslash splith
|
||||||
bindsym --to-code $mod+minus splitv
|
bindsym --to-code $mod+minus splitv
|
||||||
|
|
||||||
# Switch the current container between different layout styles.
|
# Switch the current container between different layout styles.
|
||||||
bindsym --to-code $mod+Tab layout toggle split tabbed
|
bindsym --to-code $mod+Tab layout toggle split tabbed
|
||||||
|
|
||||||
# Fullscreen.
|
# Fullscreen.
|
||||||
bindsym --to-code $mod+f fullscreen
|
bindsym --to-code $mod+f fullscreen
|
||||||
|
|
||||||
# Drag floating windows by holding down $mod and left mouse button.
|
# Drag floating windows by holding down $mod and left mouse button.
|
||||||
# Resize them with right mouse button + $mod.
|
# Resize them with right mouse button + $mod.
|
||||||
# Despite the name, also works for non-floating windows.
|
# Despite the name, also works for non-floating windows.
|
||||||
# Change normal to inverse to use left mouse button for resizing and right
|
# Change normal to inverse to use left mouse button for resizing and right
|
||||||
# mouse button for dragging.
|
# mouse button for dragging.
|
||||||
floating_modifier $mod normal
|
floating_modifier $mod normal
|
||||||
|
|
||||||
# Kill focused window.
|
# Kill focused window.
|
||||||
bindsym --to-code $mod+x kill
|
bindsym --to-code $mod+x kill
|
||||||
|
|
||||||
# Add gaps.
|
# Add gaps.
|
||||||
gaps inner ${toString config.module.style.window.gap}
|
gaps inner @windowGap@
|
||||||
|
|
||||||
# Launch everything tiled.
|
# Launch everything tiled.
|
||||||
# for_window [all] floating disable
|
# for_window [all] floating disable
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
{ config, ... }:
|
# Disable title bar.
|
||||||
let
|
default_border pixel @borderSize@
|
||||||
borderSize = toString config.module.style.window.border;
|
default_floating_border pixel @borderSize@
|
||||||
in
|
titlebar_padding 1
|
||||||
{
|
titlebar_border_thickness 0
|
||||||
text = ''
|
|
||||||
# Disable title bar.
|
|
||||||
default_border pixel ${borderSize}
|
|
||||||
default_floating_border pixel ${borderSize}
|
|
||||||
titlebar_padding 1
|
|
||||||
titlebar_border_thickness 0
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
{ ... }:
|
bindsym --to-code $mod+shift+r exec 'pkill waybar || exec waybar'
|
||||||
{
|
exec waybar
|
||||||
text = ''
|
|
||||||
bindsym --to-code $mod+shift+r exec 'pkill waybar || exec waybar'
|
|
||||||
exec waybar
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,38 +1,33 @@
|
||||||
{ ... }:
|
# Switch to workspace.
|
||||||
{
|
bindsym --to-code $mod+1 workspace number 1
|
||||||
text = ''
|
bindsym --to-code $mod+2 workspace number 2
|
||||||
# Switch to workspace.
|
bindsym --to-code $mod+3 workspace number 3
|
||||||
bindsym --to-code $mod+1 workspace number 1
|
bindsym --to-code $mod+4 workspace number 4
|
||||||
bindsym --to-code $mod+2 workspace number 2
|
bindsym --to-code $mod+5 workspace number 5
|
||||||
bindsym --to-code $mod+3 workspace number 3
|
bindsym --to-code $mod+6 workspace number 6
|
||||||
bindsym --to-code $mod+4 workspace number 4
|
bindsym --to-code $mod+7 workspace number 7
|
||||||
bindsym --to-code $mod+5 workspace number 5
|
bindsym --to-code $mod+8 workspace number 8
|
||||||
bindsym --to-code $mod+6 workspace number 6
|
bindsym --to-code $mod+9 workspace number 9
|
||||||
bindsym --to-code $mod+7 workspace number 7
|
bindsym --to-code $mod+0 workspace number 10
|
||||||
bindsym --to-code $mod+8 workspace number 8
|
|
||||||
bindsym --to-code $mod+9 workspace number 9
|
|
||||||
bindsym --to-code $mod+0 workspace number 10
|
|
||||||
|
|
||||||
# Move focused container to workspace.
|
# Move focused container to workspace.
|
||||||
bindsym --to-code $mod+Shift+1 move container to workspace number 1
|
bindsym --to-code $mod+Shift+1 move container to workspace number 1
|
||||||
bindsym --to-code $mod+Shift+2 move container to workspace number 2
|
bindsym --to-code $mod+Shift+2 move container to workspace number 2
|
||||||
bindsym --to-code $mod+Shift+3 move container to workspace number 3
|
bindsym --to-code $mod+Shift+3 move container to workspace number 3
|
||||||
bindsym --to-code $mod+Shift+4 move container to workspace number 4
|
bindsym --to-code $mod+Shift+4 move container to workspace number 4
|
||||||
bindsym --to-code $mod+Shift+5 move container to workspace number 5
|
bindsym --to-code $mod+Shift+5 move container to workspace number 5
|
||||||
bindsym --to-code $mod+Shift+6 move container to workspace number 6
|
bindsym --to-code $mod+Shift+6 move container to workspace number 6
|
||||||
bindsym --to-code $mod+Shift+7 move container to workspace number 7
|
bindsym --to-code $mod+Shift+7 move container to workspace number 7
|
||||||
bindsym --to-code $mod+Shift+8 move container to workspace number 8
|
bindsym --to-code $mod+Shift+8 move container to workspace number 8
|
||||||
bindsym --to-code $mod+Shift+9 move container to workspace number 9
|
bindsym --to-code $mod+Shift+9 move container to workspace number 9
|
||||||
bindsym --to-code $mod+Shift+0 move container to workspace number 10
|
bindsym --to-code $mod+Shift+0 move container to workspace number 10
|
||||||
# Note: workspaces can have any name you want, not just numbers.
|
# Note: workspaces can have any name you want, not just numbers.
|
||||||
# We just use 1-10 as the default.
|
# We just use 1-10 as the default.
|
||||||
|
|
||||||
# Switch left-right.
|
# Switch left-right.
|
||||||
bindsym --to-code $mod+e workspace next
|
bindsym --to-code $mod+e workspace next
|
||||||
bindsym --to-code $mod+q workspace prev
|
bindsym --to-code $mod+q workspace prev
|
||||||
|
|
||||||
# Move left-right.
|
# Move left-right.
|
||||||
bindsym --to-code $mod+Shift+e move container to workspace next
|
bindsym --to-code $mod+Shift+e move container to workspace next
|
||||||
bindsym --to-code $mod+Shift+q move container to workspace prev
|
bindsym --to-code $mod+Shift+q move container to workspace prev
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue