214 current 1970-01-01 01:00:00 24.05.20240303.b8697e5 6.6.19 *

This commit is contained in:
Max Känner 2024-03-13 21:51:32 +01:00
parent ebdc037b07
commit 871acbd8e6
2 changed files with 56 additions and 87 deletions

View File

@ -6,39 +6,24 @@
}: let }: let
schema = "org.gnome.desktop.a11y.applications"; schema = "org.gnome.desktop.a11y.applications";
key = "screen-keyboard-enabled"; key = "screen-keyboard-enabled";
squeekboard_toggle = pkgs.writeTextFile {
name = "squeekboard_toggle"; squeekboard_toggle = pkgs.writeShellScriptBin "squeekboard_toggle" ''
destination = "/bin/squeekboard_toggle";
executable = true;
text = ''
#!${pkgs.bash}/bin/bash
if [ "$(gsettings get ${schema} ${key})" == "true" ]; then if [ "$(gsettings get ${schema} ${key})" == "true" ]; then
gsettings set ${schema} ${key} false gsettings set ${schema} ${key} false
else else
gsettings set ${schema} ${key} true gsettings set ${schema} ${key} true
fi fi
''; '';
};
squeekboard_format = pkgs.writeTextFile { squeekboard_format = pkgs.writeShellScriptBin "squeekboard_format" ''
name = "squeekboard_format";
destination = "/bin/squeekboard_format";
executable = true;
text = ''
#!${pkgs.bash}/bin/bash
if [ "$(gsettings get ${schema} ${key})" == "true" ]; then if [ "$(gsettings get ${schema} ${key})" == "true" ]; then
echo '{ "text": "󰌌", "tooltip": "enabled", "percentage": 100 }' echo '{ "text": "󰌌", "tooltip": "enabled", "percentage": 100 }'
else else
echo '{ "text": "󰌐", "tooltip": "disabled", "percentage": 0 }' echo '{ "text": "󰌐", "tooltip": "disabled", "percentage": 0 }'
fi fi
''; '';
};
rotate_lisgd = pkgs.writeTextFile {
name = "rotate_lisgd";
destination = "/bin/rotate_lisgd";
executable = true;
text = ''
#!${pkgs.bash}/bin/bash
rotate_lisgd = pkgs.writeShellScriptBin "rotate_lisgd" ''
# PREV_ORIENTATION and ORIENTATION are given by rot8 # PREV_ORIENTATION and ORIENTATION are given by rot8
LISGD_INPUT=/dev/input/by-path/platform-AMDI0010:02-event LISGD_INPUT=/dev/input/by-path/platform-AMDI0010:02-event
@ -65,7 +50,21 @@
${pkgs.lisgd}/bin/lisgd -v -d "$LISGD_INPUT" "''${LISGD_ACTION_OPTIONS[@]}" & ${pkgs.lisgd}/bin/lisgd -v -d "$LISGD_INPUT" "''${LISGD_ACTION_OPTIONS[@]}" &
''; '';
};
# bash script to let dbus know about impotant env variables and
# propagate them to relevent services run at the end of sway config
dbus-sway-environment = pkgs.writeShellScriptBin "dubs-sway-environment" ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
configure-gtk = pkgs.writeShellScriptBin "configure-gtk" ''
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Dracula'
'';
in { in {
home.packages = with pkgs; [ home.packages = with pkgs; [
waybar # status bar waybar # status bar
@ -186,8 +185,8 @@ in {
}; };
startup = [ startup = [
{command = "dbus-sway-environment";} {command = "${dbus-sway-environment}/bin/dbus-sway-environment";}
{command = "configure-gtk";} {command = "${configure-gtk}/bin/configure-gtk";}
{command = "${pkgs.squeekboard}/bin/squeekboard";} {command = "${pkgs.squeekboard}/bin/squeekboard";}
{command = "${pkgs.rot8}/bin/rot8 -n 10 -h ${rotate_lisgd}/bin/rotate_lisgd";} {command = "${pkgs.rot8}/bin/rot8 -n 10 -h ${rotate_lisgd}/bin/rotate_lisgd";}
{command = "${rotate_lisgd}/bin/rotate_lisgd";} {command = "${rotate_lisgd}/bin/rotate_lisgd";}

View File

@ -3,39 +3,9 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }: {
# bash script to let dbus know about impotant env variables and
# propagate them to relevent services run at the end of sway config
dbus-sway-environment = pkgs.writeTextFile {
name = "dubs-sway-environment";
destination = "/bin/dbus-sway-environment";
executable = true;
text = ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
};
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
configure-gtk = pkgs.writeTextFile {
name = "configure-gtk";
destination = "/bin/configure-gtk";
executable = true;
text = let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in ''
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Dracula'
'';
};
in {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
dbus # make dbus-update-activation-environment available in the path dbus # make dbus-update-activation-environment available in the path
dbus-sway-environment
configure-gtk
wayland wayland
xdg-utils # for opening default programs when clicking links xdg-utils # for opening default programs when clicking links
glib # gsettings glib # gsettings