Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasOnatsu committed Oct 16, 2024
1 parent f1bef50 commit 5db7196
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 37 deletions.
15 changes: 7 additions & 8 deletions modules/desktop/graphics/sway/waybar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ with lib; let

modules-right = [
"sway/language"
"group/network"
"network"
"group/battery"
"group/hardware"
"tray"
"clock"
"custom/power"
];

"custom/menu" = {
format = "";
format = "<span size='large'></span>";
on-click = "swaymsg exec \\$menu";
tooltip = false;
};
Expand All @@ -84,7 +85,7 @@ with lib; let
};

"idle_inhibitor" = {
format = "{icon}";
format = "<span size='large'>{icon}</span>";
format-icons = {
activated = "";
deactivated = "";
Expand All @@ -93,7 +94,7 @@ with lib; let

"custom/clipboard" = {
tooltip = false;
format = "";
format = "<span size='large'></span>";
interval = "once";
#return-type = "json";
on-click = "swaymsg -q exec '$clipboard'; waybar-signal clipboard";
Expand All @@ -119,7 +120,7 @@ with lib; let
};

"sway/language" = {
format = " {short}";
format = "<span size='large'> {short}</span>";
tooltip-format = "{long}";
on-click = "swaymsg input type:keyboard xkb_switch_layout next";
on-scroll-up = "swaymsg input type:keyboard xkb_switch_layout next";
Expand Down Expand Up @@ -176,7 +177,6 @@ with lib; let
interval = 15;
format = "{icon} {capacity}%";
format-charging = "󰢟 {capacity}%";
format-plugged = " {capacity}%";
format-alt = "{icon} {time}";
format-icons = [
""
Expand All @@ -185,7 +185,6 @@ with lib; let
""
""
];
tooltip-format = "{timeTo} {power}W";
};
"battery#bat2" = {
bat = "BAT1";
Expand Down Expand Up @@ -239,7 +238,7 @@ with lib; let
};

"custom/power" = {
format = "";
format = "<span size='large'>⏻</span>";
tooltip = false;
on-click = "swaymsg exec \\$powermenu";
};
Expand Down
4 changes: 2 additions & 2 deletions modules/desktop/graphics/sway/waybar/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
window#waybar {
background-color: @background_color;
color: @text_color;
transition-property: background-color;
transition-duration: .5s;
/*transition-property: background-color;
transition-duration: .5s;*/
}

window#waybar.hidden {
Expand Down
37 changes: 25 additions & 12 deletions modules/packages/squeekboard/default.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
(final: _prev: {
squeekboard = _prev.squeekboard.overrideAttrs (oldAttrs: {
postPatch = oldAttrs.postPatch or "" + ''
${_prev.coreutils}/bin/cp -rf ${./us_wide.yaml} data/keyboards/terminal/us_wide.yaml
'';
(final: prev: let
pkgSrc = prev.fetchFromGitLab {
domain = "gitlab.gnome.org";
group = "World";
owner = "Phosh";
repo = "${prev.squeekboard.pname}";
rev = "v${prev.squeekboard.version}";
hash = "sha256-ZVSnLH2wLPcOHkU2pO0BgIdGmULMNiacIYMRmhN+bZ8=";
};
in {
squeekboard = prev.squeekboard.overrideAttrs (oldAttrs: {
postPatch =
oldAttrs.postPatch
or ""
+ ''
${prev.coreutils}/bin/cp -rf ${./us_wide.yaml} data/keyboards/terminal/us_wide.yaml
${prev.coreutils}/bin/cp -rf ${./fi_wide.yaml} data/keyboards/terminal/fi_wide.yaml
'';
postInstall = ''
mkdir -p $out/share/dbus-1/services
cat <<END > $out/share/dbus-1/services/sm.puri.OSK0.service
[D-BUS Service]
Name=sm.puri.OSK0
Exec=$out/bin/squeekboard
END
mkdir -p $out/share/dbus-1/services
cat <<END > $out/share/dbus-1/services/sm.puri.OSK0.service
[D-BUS Service]
Name=sm.puri.OSK0
Exec=$out/bin/squeekboard
END
'';
});
squeekboard-control = final.callPackage ./squeekboard.nix {pkgs=final;};
squeekboard-control = final.callPackage ./squeekboard.nix {pkgs = final;};
})
Empty file.
37 changes: 22 additions & 15 deletions modules/packages/squeekboard/squeekboard.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{pkgs}:
pkgs.writeShellApplication {
name = "squeekboard-control";
runtimeInputs = [
pkgs.systemd
];
text = ''
function visible {
case "$(busctl --user get-property sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible)" in
*true*) return 0;;
*) return 1;;
esac
}
{
pkgs,
}:
pkgs.writeScriptBin "squeekboard-control" ''
#${pkgs.bash}/bin/bash
i=$(busctl --user get-property sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible)
echo $i
if [ "$i" == "b true" ]
then
pkill squeekboard
else
busctl --user call sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
fi
echo "Toggling on-screen keyboard..."
''
printf "Toggling on-screen keyboard..."
if visible; then
busctl --user call sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false
else
busctl --user call sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
fi
'';
}

0 comments on commit 5db7196

Please sign in to comment.