Improve help and screen recording keybindings in sway

This commit shuffles around some sway keybindings and improves the
screen recording experience by adding a small wrapper around `slurp` and
`wf-recorder` conveniently called `record-screen`.

* `$mod+F5` now reload the sway configuration,
* `$mod+Ctrl+r` starts a screen recording (to stop it, go to workspace 7
  and kill the process),
* `record-screen` and the firefox sharing indicator are both on
  workspace 7 now, making it the "trash" workspace,
* `$mod+F1` and `$mod+Shift+h` now open Firefox with the docs of our
repository availabe under `help.local`.
* To not infuriate `qMasterPassword` users, that is now available under
`$mod+Shift+m` instead of `$mod+F1`.
This commit is contained in:
Benjamin Bädorf 2022-08-14 18:03:32 +02:00
parent 55d5f6938a
commit 043178172b
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
10 changed files with 74 additions and 15 deletions

View file

@ -3,4 +3,4 @@ authors = ["Timothy DeHerrera"]
language = "en"
multilingual = false
src = "."
title = "devos docs"
title = "PubSolarOS documentation"

View file

@ -34,20 +34,26 @@ in
# These entries get added to /etc/hosts
networking.hosts = {
"127.0.0.1" = [ "cups.local" ];
"127.0.0.1" = [ "cups.local" "help.local" "caddy.local" ];
};
# Caddy reverse proxy for local services like cups
services.caddy = {
enable = true;
globalConfig = ''
default_bind 127.0.0.1
auto_https off
'';
extraConfig = ''
cups.local:80
bind 127.0.0.1
request_header Host localhost:631
reverse_proxy unix//run/cups/cups.sock
cups.local:80 {
request_header Host localhost:631
reverse_proxy unix//run/cups/cups.sock
}
help.local:80 {
root * ${pkgs.psos-docs}/lib/html
file_server
}
'';
};
};

View file

@ -14,8 +14,9 @@ assign [app_id="telegramdesktop"] $ws4
# Launcher
for_window [app_id="launcher" title="Alacritty"] floating enable, border pixel 10, sticky enable
for_window [app_id="pavucontrol"] floating enable, border pixel 10, sticky enable
# Floating menus
for_window [app_id="pavucontrol"] floating enable
for_window [app_id="blueman-manager"] floating enable
# Open specific applications in floating mode
@ -60,10 +61,14 @@ for_window [window_type="dialog"] floating enable
for_window [window_type="menu"] floating enable
for_window [title="About Mozilla Firefox"] floating enable
for_window [title="Password Required - Mozilla Firefox"] floating enable
for_window [title="Firefox — Sharing Indicator"] move to workspace $ws7, floating enable
no_focus [title="Firefox — Sharing Indicator"]
for_window [title="Extension: (Open in Browser)*"] floating enable
# Technical media stuff happens on ws7
for_window [app_id="screen-recorder" title="Alacritty"] move to workspace $ws7, floating disable
no_focus [app_id="screen-recorder"]
for_window [title="Firefox — Sharing Indicator"] move to workspace $ws7, floating disable
no_focus [title="Firefox — Sharing Indicator"]
# qMasterPassword floating menu
for_window [title="qMasterPassword"] focus
for_window [title="qMasterPassword"] floating enable

View file

@ -13,21 +13,26 @@ bindsym $mod+Ctrl+m exec pavucontrol
################################################################################################
# Quickstart application shortcuts
bindsym $mod+F1 exec qMasterPassword
bindsym $mod+F1 exec psos help
bindsym $mod+Shift+h exec psos help
bindsym $mod+F2 exec firefox
bindsym $mod+F3 exec $term -e vifm
bindsym $mod+Shift+F3 exec gksu $term -e vifm
bindsym $mod+F4 exec nautilus -w
bindsym $mod+Shift+F4 exec signal-desktop --use-tray-icon
bindsym $mod+F5 exec $term -e 'mocp -C $XDG_CONFIG_DIR/mocp/config'
bindsym $mod+Shift+m exec mu
bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf
# Screenshofts
bindsym $mod+Shift+m exec qMasterPassword
# Screenshots and screen recordings
bindsym $mod+Ctrl+p exec grim -g "$(slurp -d -b \#ffffff11)" ~/Pictures/Screenshots/$(date +%Y%m%d_%Hh%Mm%Ss)_grim.png
bindsym $mod+Shift+p exec grim ~/Pictures/Screenshots/$(date +%Y%m%d_%Hh%Mm%Ss)_grim.png
bindsym $mod+Ctrl+f exec "( pkill flameshot || true && flameshot & ) && ( sleep 0.5s && flameshot gui )"
bindsym $mod+Ctrl+r exec record-screen
# Launcher
set $menu exec alacritty --class launcher -e env TERMINAL_COMMAND="alacritty -e" sway-launcher
bindsym $mod+Space exec $menu

View file

@ -50,7 +50,7 @@
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Ctrl+r reload
bindsym $mod+F5 reload
#
# Moving around:

View file

@ -77,6 +77,7 @@ in
swaylock-bg
sway-launcher
record-screen
import-gtk-settings
s
wcwd

View file

@ -9,6 +9,7 @@ with final; {
mopidy-jellyfin = import ./mopidy-jellyfin.nix final;
mu = writeShellScriptBin "mu" (import ./mu.nix final);
psos = writeShellScriptBin "psos" (import ./psos.nix final);
psos-docs = import ./psos-docs.nix final;
s = writeShellScriptBin "s" (import ./s.nix final);
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final);
@ -17,6 +18,7 @@ with final; {
uhk-agent = import ./uhk-agent.nix final;
wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final);
drone-docker-runner = writeShellScriptBin "drone-docker-runner" (import ./drone-docker-runner.nix final);
record-screen = writeShellScriptBin "record-screen" (import ./record-screen.nix final);
# ps-fixes
}

26
pkgs/psos-docs.nix Normal file
View file

@ -0,0 +1,26 @@
self: with self;
stdenv.mkDerivation rec {
pname = "psos-docs";
version = "0.0.1";
buildInputs = [
mdbook
mdbook-pdf
];
src = ../docs/..; # wut
phases = [ "buildPhase" "installPhase" ];
buildPhase = ''
cp -r $src/doc ./doc
cp $src/README.md ./README.md
chmod ug+w -R .
ls -la .
mdbook build doc
'';
installPhase = ''
mkdir -p $out/lib/
cp -r doc/book $out/lib/html
'';
}

View file

@ -14,6 +14,10 @@ self: with self; ''
shift;
exec nixos-option -I nixpkgs=/etc/nixos/lib/compat $@
;;
help)
shift;
exec xdg-open http://help.local/
;;
*)
if [[ "$@" != "" ]]; then
echo "Unknown command: psos $@"

10
pkgs/record-screen.nix Normal file
View file

@ -0,0 +1,10 @@
self: with self; ''
mkdir -p "$HOME/Videos/Screenrecordings"
GEOMETRY="$(slurp -d -b \#ffffff11)"
RESOLUTION="$(echo $GEOMETRY | awk '{print $2}')"
FILE_LOCATION="$HOME/Videos/Screenrecordings/$(${coreutils}/bin/date +%Y%m%d_%Hh%Mm%Ss)_$RESOLUTION.mp4"
echo "Recording $GEOMETRY into $FILE_LOCATION"
${alacritty}/bin/alacritty \
--class screen-recorder \
-e ${wf-recorder}/bin/wf-recorder -g "$GEOMETRY" -f "$FILE_LOCATION"
''