Skip to content

Commit

Permalink
feat: add planify
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Dec 14, 2024
1 parent 8fcf746 commit 550e856
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1 deletion.
1 change: 1 addition & 0 deletions machines/liadtop/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ rec {
};
mpv.enable = true;
obsidian.enable = true;
planify.enable = true;
redshift = {
enable = true;
latitude = 50.061389;
Expand Down
1 change: 1 addition & 0 deletions machines/piecyk/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ rec {
};
mpv.enable = true;
obsidian.enable = true;
planify.enable = true;
redshift = {
enable = true;
latitude = 50.061389;
Expand Down
8 changes: 7 additions & 1 deletion modules/apps/awesome/rc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ awful.rules.rules = {
"Wpa_gui",
"veromix",
"xtightvncviewer",
"io.github.alainm23.planify.quick-add",
},

-- Note that the name property shown in xprop might be set slightly after creation of the client
Expand Down Expand Up @@ -184,7 +185,12 @@ awful.rules.rules = {

{ rule = { class = "obsidian" }, properties = { screen = (RC.vars.singleScreen and 1 or 2), tag = " 6 " } },
{ rule = { class = "thunderbird" }, properties = { screen = (RC.vars.singleScreen and 1 or 2), tag = " 5 " } },
{
rule = { class = "io.github.alainm23.planify" },
except = { class = "io.github.alainm23.planify.quick-add" },
properties = { screen = (RC.vars.singleScreen and 1 or 2), tag = " 4 " },
},

{ rule = { class = "Slack" }, properties = { screen = (RC.vars.singleScreen and 1 or 2), tag = " 4 " } },
{ rule = { class = "Slack" }, properties = { screen = (RC.vars.singleScreen and 1 or 2), tag = " 3 " } },
}
-- }}}
1 change: 1 addition & 0 deletions modules/apps/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ _: {
./kitty
./mpv
./obsidian
./planify
./redshift
./rofi
./rustdesk
Expand Down
57 changes: 57 additions & 0 deletions modules/apps/planify/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.myHomeApps.planify;

mkPlanifyWrapper =
name: cmd:
(pkgs.writeShellScriptBin name ''
# hack to make planify behave properly in high DPI (GDK_SCALE will scale icons, while settings.ini hack will scale font back down)
TMPCONFIG="$(mktemp -d)"
cp -arL "$XDG_CONFIG_HOME/gtk-4.0" "$TMPCONFIG"
cp -arL "$XDG_CONFIG_HOME/dconf" "$TMPCONFIG"
NEWSIZE="$(( "$(sed -nE 's/gtk-font-name[^0-9]*([0-9]+)$/\1/p' "$TMPCONFIG/gtk-4.0/settings.ini")" / 2 ))"
sed -i -E "s/(gtk-font-name[^0-9]*) [0-9]+$/\1 $NEWSIZE/" "$TMPCONFIG/gtk-4.0/settings.ini"
export GDK_SCALE=2
export XDG_CONFIG_HOME="$TMPCONFIG"
${cmd}
rm -rf "$TMPCONFIG"
'');

planifyPkg = mkPlanifyWrapper "planify" (lib.getExe pkgs.planify);
planifyQuickAddPkg = mkPlanifyWrapper "planify-quickadd" (
lib.getExe' pkgs.planify "io.github.alainm23.planify.quick-add"
);
in
{
options.myHomeApps.planify = {
enable = lib.mkEnableOption "planify";
};

config = lib.mkIf cfg.enable {
home.packages = [
planifyPkg
planifyQuickAddPkg
];

myHomeApps.awesome.extraConfig = ''
local home = os.getenv("HOME")
local xdg_config_home = os.getenv("XDG_CONFIG_HOME") or (os.getenv("HOME") .. "/.config")
local planifykeys = gears.table.join(
awful.key({ RC.vars.modkey }, "'", function()
awful.util.spawn("${lib.getExe planifyQuickAddPkg}")
end, { description = "planify quick add", group = "apps" })
)
RC.globalkeys = gears.table.join(RC.globalkeys, planifykeys)
root.keys(RC.globalkeys)
'';

myHomeApps.awesome.autorun = [ (lib.getExe planifyPkg) ];
};
}

0 comments on commit 550e856

Please sign in to comment.