Compare commits

..

3 Commits

Author SHA1 Message Date
Nathan McCarty f27ca0cfd0
Setup scratchpads 2023-06-17 18:36:26 -04:00
Nathan McCarty f8bcbb144f
Package pyprland 2023-06-17 16:35:44 -04:00
Nathan McCarty 98633f798c
Configure waybar icons 2023-06-17 16:15:31 -04:00
8 changed files with 121 additions and 5 deletions

View File

@ -301,6 +301,7 @@
swayimg = pkgs.callPackage ./packages/swayimg/default.nix { }; swayimg = pkgs.callPackage ./packages/swayimg/default.nix { };
hyprland-autoname-workspaces = hyprland-autoname-workspaces =
pkgs.callPackage ./packages/workspace-renamer/default.nix { }; pkgs.callPackage ./packages/workspace-renamer/default.nix { };
pyprland = pkgs.callPackage ./packages/pyprland { };
shortcuts = let shortcuts = let
script = writePython311Script "shortcuts" { } script = writePython311Script "shortcuts" { }
(builtins.readFile ./scripts/shortcuts/shortcuts.py); (builtins.readFile ./scripts/shortcuts/shortcuts.py);

View File

@ -53,6 +53,7 @@
home.sessionVariables = { home.sessionVariables = {
EDITOR = "emacsclient -c"; EDITOR = "emacsclient -c";
VISUAL = "emacsclient -c"; VISUAL = "emacsclient -c";
ALTERNATE_EDITOR = "";
}; };
})) }))
(lib.mkIf (config.nathan.programs.emacs.enable && pkgs.stdenv.isLinux) { (lib.mkIf (config.nathan.programs.emacs.enable && pkgs.stdenv.isLinux) {

View File

@ -52,10 +52,11 @@ in with lib; {
evince evince
# Productivity # Productivity
libreoffice-fresh libreoffice-fresh
## Sway addons ## Hyprland addons
font-awesome font-awesome
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprpaper inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprpaper
swayosd swayosd
inputs.self.packages.${pkgs.system}.pyprland
# For fancy x11 scaling # For fancy x11 scaling
sommelier sommelier
# Polkit # Polkit
@ -138,7 +139,7 @@ in with lib; {
bind = $mainMod, Q, exec, alacritty bind = $mainMod, Q, exec, alacritty
bind = $mainMod, C, killactive, bind = $mainMod, C, killactive,
bind = $mainMod, M, exit, # bind = $mainMod, M, exit,
bind = $mainMod, E, exec, dolphin bind = $mainMod, E, exec, dolphin
bind = $mainMod, V, togglefloating, bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, ${fuzzel-command} bind = $mainMod, R, exec, ${fuzzel-command}
@ -215,6 +216,32 @@ in with lib; {
windowrulev2 = noborder,class:^(.gamescope-wrapped)$,title:VMware Workstation windowrulev2 = noborder,class:^(.gamescope-wrapped)$,title:VMware Workstation
windowrulev2 = rounding 0,class:^(.gamescope-wrapped)$,title:VMware Workstation windowrulev2 = rounding 0,class:^(.gamescope-wrapped)$,title:VMware Workstation
## Scratchpads
# Alacritty
bind = SUPER ALT, Q, exec, pypr toggle term
$dropterm = ^(alacritty-dropterm)$
windowrule = float,$dropterm
windowrule = size 40% 50%,$dropterm
windowrule = workspace special silent,$dropterm
windowrule = center,$dropterm
# Emacs
bind = SUPER ALT, W, exec, pypr toggle emacs
$scratchmacs = title:^(scratchmacs)$
windowrulev2 = float,$scratchmacs
windowrulev2 = size 40% 50%,$scratchmacs
windowrulev2 = workspace special silent,$scratchmacs
windowrulev2 = center,$scratchmacs
# Ario
bind = SUPER ALT, E, exec, pypr toggle ario
$dropario = class:^(ario)$
windowrulev2 = float,$dropario
windowrulev2 = size 50% 70%,$dropario
windowrulev2 = workspace special silent,$dropario
windowrulev2 = center,$dropario
# Clipboard history management # Clipboard history management
exec-once=wl-paste --watch cliphist store exec-once=wl-paste --watch cliphist store
bind = $mainMod, X, exec, cliphist list | ${fuzzel-command} --dmenu | cliphist decode | wl-copy bind = $mainMod, X, exec, cliphist list | ${fuzzel-command} --dmenu | cliphist decode | wl-copy
@ -273,7 +300,54 @@ in with lib; {
onChange = '' onChange = ''
mkdir -p ~/.config/shortcuts/shortcuts mkdir -p ~/.config/shortcuts/shortcuts
''; '';
};
# Setup pyprland
systemd.user.services.pypr = {
Unit = {
Description = "pypr";
After = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = "${inputs.self.packages.${pkgs.system}.pyprland}/bin/pypr";
Restart = "on-failure";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
# And its config file
xdg.configFile."hypr/pyprland.json" = let
emacsStart = pkgs.writeShellScript "emacsStart.sh" ''
exec emacsclient -c --frame-parameters='(quote (name . "scratchmacs"))'
'';
# https://github.com/hyprland-community/pyprland/issues/6
# "emacs": {
# "command": "${emacsStart}",
# "animation": "",
# "unfocus": "hide"
# }
in {
text = ''
{
"pyprland": {
"plugins": [
"scratchpads"
]
},
"scratchpads": {
"term": {
"command": "alacritty --class alacritty-dropterm --working-directory ~ -e tmux new -A -s scratch",
"animation": "",
"unfocus": "hide"
},
"ario": {
"command": "ario",
"animation": "",
"unfocus": "hide"
}
}
}
'';
onChange = "systemctl --user restart pypr";
}; };
######################### #########################
## SwayNotificationCenter (notifications) ## SwayNotificationCenter (notifications)
@ -408,6 +482,8 @@ in with lib; {
max-length = 50; max-length = 50;
format-icons = { format-icons = {
spotify = " "; spotify = " ";
firefox = " ";
mopidy = " ";
default = " "; default = " ";
}; };
escape = true; escape = true;

View File

@ -18,7 +18,8 @@ in {
mpc-cli mpc-cli
calibre calibre
playerctl playerctl
ymuse ncmpcpp
ario
]; ];
# Register haruna as the default video player # Register haruna as the default video player
xdg.mimeApps.defaultApplications = { xdg.mimeApps.defaultApplications = {

View File

@ -0,0 +1,15 @@
{ config, lib, pkgs, poetry2nix, ... }:
let
vals = builtins.fromJSON (builtins.readFile ../../sources/pyprland.json);
rev = vals.rev;
hash = vals.hash;
src = pkgs.fetchFromGitHub {
owner = "hyprland-community";
repo = "pyprland";
inherit rev hash;
};
in poetry2nix.mkPoetryApplication {
inherit src;
poetrylock = ./poetry.lock;
pyproject = "${src}/pyproject.toml";
}

7
packages/pyprland/poetry.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand.
package = []
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "53f2eabc9c26446fbcc00d348c47878e118afc2054778c3c803a0a8028af27d9"

4
sources/pyprland.json Normal file
View File

@ -0,0 +1,4 @@
{
"rev": "8b42c1dec296854241e024f731e5707cf997b9d5",
"hash": "sha256-InwPUPNVW0fYrwrvmc3PhzLm2tK8IDM4CHpgfft/WJM="
}

View File

@ -28,6 +28,18 @@ echo "swayimg now at $SWAYIMG_VERSION"
# > $DIRECTORY/autoname.json # > $DIRECTORY/autoname.json
# echo "autoname now at $AUTONAME_REV" # echo "autoname now at $AUTONAME_REV"
# Update pyprland
PYPRLAND_BRANCH=$(curl https://api.github.com/repos/hyprland-community/pyprland | jq -r '.default_branch')
PYPRLAND_REV=$(curl https://api.github.com/repos/hyprland-community/pyprland/git/refs/heads/$PYPRLAND_BRANCH | \
jq -r '.object.sha')
PYPRLAND_HASH=$(nix-prefetch fetchFromGitHub --owner hyprland-community --repo pyprland --rev $PYPRLAND_REV)
jq --null-input \
--arg rev "$PYPRLAND_REV" \
--arg hash "$PYPRLAND_HASH" \
'{"rev": $rev, "hash": $hash}' \
> $DIRECTORY/pyprland.json
echo "pyprland now at $PYPRLAND_REV"
# Update gamescope # Update gamescope
GAMESCOPE_BRANCH=$(curl https://api.github.com/repos/ValveSoftware/gamescope | jq -r '.default_branch') GAMESCOPE_BRANCH=$(curl https://api.github.com/repos/ValveSoftware/gamescope | jq -r '.default_branch')
GAMESCOPE_REV=$(curl https://api.github.com/repos/ValveSoftware/gamescope/git/refs/heads/$GAMESCOPE_BRANCH | \ GAMESCOPE_REV=$(curl https://api.github.com/repos/ValveSoftware/gamescope/git/refs/heads/$GAMESCOPE_BRANCH | \
@ -39,4 +51,3 @@ jq --null-input \
'{"rev": $rev, "hash": $hash}' \ '{"rev": $rev, "hash": $hash}' \
> $DIRECTORY/gamescope.json > $DIRECTORY/gamescope.json
echo "gamescope now at $GAMESCOPE_REV" echo "gamescope now at $GAMESCOPE_REV"