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-10 22:32:27 +02:00
parent 4d2ac57dab
commit fd50ecf445
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" language = "en"
multilingual = false multilingual = false
src = "." src = "."
title = "devos docs" title = "PubSolarOS documentation"

View file

@ -14,8 +14,9 @@ assign [app_id="telegramdesktop"] $ws4
# Launcher # Launcher
for_window [app_id="launcher" title="Alacritty"] floating enable, border pixel 10, sticky enable 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 # Floating menus
for_window [app_id="pavucontrol"] floating enable
for_window [app_id="blueman-manager"] floating enable for_window [app_id="blueman-manager"] floating enable
# Open specific applications in floating mode # 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 [window_type="menu"] floating enable
for_window [title="About Mozilla Firefox"] floating enable for_window [title="About Mozilla Firefox"] floating enable
for_window [title="Password Required - 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 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 # qMasterPassword floating menu
for_window [title="qMasterPassword"] focus for_window [title="qMasterPassword"] focus
for_window [title="qMasterPassword"] floating enable for_window [title="qMasterPassword"] floating enable

View file

@ -13,21 +13,26 @@ bindsym $mod+Ctrl+m exec pavucontrol
################################################################################################ ################################################################################################
# Quickstart application shortcuts # 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+F2 exec firefox
bindsym $mod+F3 exec $term -e vifm bindsym $mod+F3 exec $term -e vifm
bindsym $mod+Shift+F3 exec gksu $term -e vifm bindsym $mod+Shift+F3 exec gksu $term -e vifm
bindsym $mod+F4 exec nautilus -w bindsym $mod+F4 exec nautilus -w
bindsym $mod+Shift+F4 exec signal-desktop bindsym $mod+Shift+F4 exec signal-desktop
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+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+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+f exec "( pkill flameshot || true && flameshot & ) && ( sleep 0.5s && flameshot gui )"
bindsym $mod+Ctrl+r exec record-screen
# Launcher # Launcher
set $menu exec alacritty --class launcher -e env TERMINAL_COMMAND="alacritty -e" sway-launcher set $menu exec alacritty --class launcher -e env TERMINAL_COMMAND="alacritty -e" sway-launcher
bindsym $mod+Space exec $menu bindsym $mod+Space exec $menu

View file

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

View file

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

View file

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

View file

@ -9,6 +9,7 @@ with final; {
mopidy-jellyfin = import ./mopidy-jellyfin.nix final; mopidy-jellyfin = import ./mopidy-jellyfin.nix final;
mu = writeShellScriptBin "mu" (import ./mu.nix final); mu = writeShellScriptBin "mu" (import ./mu.nix final);
psos = writeShellScriptBin "psos" (import ./psos.nix final); psos = writeShellScriptBin "psos" (import ./psos.nix final);
psos-docs = import ./psos-docs.nix final;
s = writeShellScriptBin "s" (import ./s.nix final); s = writeShellScriptBin "s" (import ./s.nix final);
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final);
@ -16,6 +17,7 @@ with final; {
toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final);
uhk-agent = import ./uhk-agent.nix final; uhk-agent = import ./uhk-agent.nix final;
wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final);
record-screen = writeShellScriptBin "record-screen" (import ./record-screen.nix final);
# ps-fixes # ps-fixes
ps-signal-desktop = writeShellScriptBin "signal-desktop" (import ./ps-signal-desktop.nix final); ps-signal-desktop = writeShellScriptBin "signal-desktop" (import ./ps-signal-desktop.nix final);

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; shift;
exec nixos-option -I nixpkgs=/etc/nixos/lib/compat $@ exec nixos-option -I nixpkgs=/etc/nixos/lib/compat $@
;; ;;
help)
shift;
exec xdg-open http://help.local/
;;
*) *)
if [[ "$@" != "" ]]; then if [[ "$@" != "" ]]; then
echo "Unknown command: psos $@" 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"
''