Add x.com Chrome app scratchpad
This commit is contained in:
@@ -258,9 +258,10 @@ Required behavior:
|
|||||||
- A named scratchpad exists for spotify.
|
- A named scratchpad exists for spotify.
|
||||||
- A named scratchpad exists for transmission.
|
- A named scratchpad exists for transmission.
|
||||||
- A named scratchpad exists for volume.
|
- A named scratchpad exists for volume.
|
||||||
|
- A named scratchpad exists for x.com.
|
||||||
- Scratchpads appear near-fullscreen and centered by default.
|
- Scratchpads appear near-fullscreen and centered by default.
|
||||||
- The codex scratchpad can be tiled into the normal workspace when desired,
|
- The codex, claude, and x.com scratchpads can be tiled into the normal
|
||||||
while retaining its summon/dismiss toggle.
|
workspace when desired, while retaining their summon/dismiss toggles.
|
||||||
- Toggling a scratchpad deactivates fullscreen/tabbed state first.
|
- Toggling a scratchpad deactivates fullscreen/tabbed state first.
|
||||||
- Floating scratchpads are hidden from normal workspace and window listings.
|
- Floating scratchpads are hidden from normal workspace and window listings.
|
||||||
|
|
||||||
@@ -447,6 +448,7 @@ Required behavior:
|
|||||||
- `Super+Alt+s` toggles the spotify scratchpad.
|
- `Super+Alt+s` toggles the spotify scratchpad.
|
||||||
- `Super+Alt+t` toggles the transmission scratchpad.
|
- `Super+Alt+t` toggles the transmission scratchpad.
|
||||||
- `Super+Alt+v` toggles the volume scratchpad.
|
- `Super+Alt+v` toggles the volume scratchpad.
|
||||||
|
- `Super+Alt+x` toggles the x.com scratchpad.
|
||||||
|
|
||||||
Important behavior:
|
Important behavior:
|
||||||
|
|
||||||
|
|||||||
@@ -291,6 +291,9 @@ function M.setup(ctx)
|
|||||||
bind(mod_alt .. " + V", function()
|
bind(mod_alt .. " + V", function()
|
||||||
toggle_scratchpad("volume")
|
toggle_scratchpad("volume")
|
||||||
end, desc("Toggle volume scratchpad"))
|
end, desc("Toggle volume scratchpad"))
|
||||||
|
bind(mod_alt .. " + X", function()
|
||||||
|
toggle_scratchpad("x_com")
|
||||||
|
end, desc("Toggle X scratchpad"))
|
||||||
bind(mod_alt .. " + grave", function()
|
bind(mod_alt .. " + grave", function()
|
||||||
toggle_scratchpad("dropdown")
|
toggle_scratchpad("dropdown")
|
||||||
end, desc("Toggle dropdown scratchpad"))
|
end, desc("Toggle dropdown scratchpad"))
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ function M.setup(ctx)
|
|||||||
command = "google-chrome-stable --profile-directory=Default --app=https://messages.google.com/web/conversations",
|
command = "google-chrome-stable --profile-directory=Default --app=https://messages.google.com/web/conversations",
|
||||||
class = "chrome-messages.google.com",
|
class = "chrome-messages.google.com",
|
||||||
},
|
},
|
||||||
|
x_com = {
|
||||||
|
command = "x-com-pwa",
|
||||||
|
classes = { "x-com-pwa", "chrome-x.com" },
|
||||||
|
title = "X",
|
||||||
|
allow_tiling = true,
|
||||||
|
},
|
||||||
transmission = {
|
transmission = {
|
||||||
command = "transmission-gtk",
|
command = "transmission-gtk",
|
||||||
class = "transmission-gtk",
|
class = "transmission-gtk",
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ spawnBindings =
|
|||||||
, key (super .|. alt) xK_s (toggleScratchpad "spotify")
|
, key (super .|. alt) xK_s (toggleScratchpad "spotify")
|
||||||
, key (super .|. alt) xK_t (toggleScratchpad "transmission")
|
, key (super .|. alt) xK_t (toggleScratchpad "transmission")
|
||||||
, key (super .|. alt) xK_v (toggleScratchpad "volume")
|
, key (super .|. alt) xK_v (toggleScratchpad "volume")
|
||||||
|
, key (super .|. alt) xK_x (toggleScratchpad "x-com")
|
||||||
, key (super .|. alt) xK_c (spawnAction "google-chrome-stable")
|
, key (super .|. alt) xK_c (spawnAction "google-chrome-stable")
|
||||||
, key super xK_e (spawnAction "emacsclient --eval '(emacs-everywhere)'")
|
, key super xK_e (spawnAction "emacsclient --eval '(emacs-everywhere)'")
|
||||||
, key (super .|. ctrl) xK_e (shiftFocusedToNextEmptyWorkspace False)
|
, key (super .|. ctrl) xK_e (shiftFocusedToNextEmptyWorkspace False)
|
||||||
@@ -297,6 +298,8 @@ scratchpadDefinitions =
|
|||||||
anyMatcher [titleContains "Transmission", appIdContains "transmission"]
|
anyMatcher [titleContains "Transmission", appIdContains "transmission"]
|
||||||
, ScratchpadDefinition "volume" "pavucontrol" $
|
, ScratchpadDefinition "volume" "pavucontrol" $
|
||||||
anyMatcher [appIdMatches "Pavucontrol", appIdContains "pavucontrol"]
|
anyMatcher [appIdMatches "Pavucontrol", appIdContains "pavucontrol"]
|
||||||
|
, ScratchpadDefinition "x-com" "x-com-pwa" $
|
||||||
|
anyMatcher [appIdMatches "x-com-pwa", appIdContains "chrome-x.com"]
|
||||||
]
|
]
|
||||||
|
|
||||||
anyMatcher :: [RiverWMWindowState -> Bool] -> RiverWMWindowState -> Bool
|
anyMatcher :: [RiverWMWindowState -> Bool] -> RiverWMWindowState -> Bool
|
||||||
|
|||||||
@@ -244,6 +244,11 @@ slackSelector = className =? "Slack"
|
|||||||
spotifySelector = className =? "Spotify"
|
spotifySelector = className =? "Spotify"
|
||||||
transmissionSelector = fmap (isPrefixOf "Transmission") title
|
transmissionSelector = fmap (isPrefixOf "Transmission") title
|
||||||
volumeSelector = className =? "Pavucontrol"
|
volumeSelector = className =? "Pavucontrol"
|
||||||
|
xComSelector =
|
||||||
|
className =? "x-com-pwa"
|
||||||
|
<||> fmap ("chrome-x.com" `isInfixOf`) className
|
||||||
|
<||> (chromeSelectorBase <&&> title =? "X")
|
||||||
|
<||> fmap ("x.com" `isInfixOf`) title
|
||||||
|
|
||||||
virtualClasses =
|
virtualClasses =
|
||||||
[ (chromeSelector, "Chrome")
|
[ (chromeSelector, "Chrome")
|
||||||
@@ -261,6 +266,7 @@ slackCommand = "slack"
|
|||||||
spotifyCommand = "spotify"
|
spotifyCommand = "spotify"
|
||||||
transmissionCommand = "transmission-gtk"
|
transmissionCommand = "transmission-gtk"
|
||||||
volumeCommand = "pavucontrol"
|
volumeCommand = "pavucontrol"
|
||||||
|
xComCommand = "x-com-pwa"
|
||||||
|
|
||||||
-- Startup hook
|
-- Startup hook
|
||||||
|
|
||||||
@@ -811,6 +817,7 @@ scratchpads =
|
|||||||
, NS "spotify" spotifyCommand spotifySelector nearFullFloat
|
, NS "spotify" spotifyCommand spotifySelector nearFullFloat
|
||||||
, NS "transmission" transmissionCommand transmissionSelector nearFullFloat
|
, NS "transmission" transmissionCommand transmissionSelector nearFullFloat
|
||||||
, NS "volume" volumeCommand volumeSelector nearFullFloat
|
, NS "volume" volumeCommand volumeSelector nearFullFloat
|
||||||
|
, NS "x-com" xComCommand xComSelector nearFullFloat
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -1018,6 +1025,7 @@ addKeys conf@XConfig { modMask = modm } =
|
|||||||
, ((modalt, xK_s), doScratchpad "spotify")
|
, ((modalt, xK_s), doScratchpad "spotify")
|
||||||
, ((modalt, xK_t), doScratchpad "transmission")
|
, ((modalt, xK_t), doScratchpad "transmission")
|
||||||
, ((modalt, xK_v), doScratchpad "volume")
|
, ((modalt, xK_v), doScratchpad "volume")
|
||||||
|
, ((modalt, xK_x), doScratchpad "x-com")
|
||||||
|
|
||||||
-- Specific program spawning
|
-- Specific program spawning
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,34 @@
|
|||||||
exec google-chrome-stable --profile-directory="$profile_dir" --new-window
|
exec google-chrome-stable --profile-directory="$profile_dir" --new-window
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
xComPwa = pkgs.writeShellApplication {
|
||||||
|
name = "x-com-pwa";
|
||||||
|
runtimeInputs = [
|
||||||
|
googleChromeCommandWrappers
|
||||||
|
pkgs.jq
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
profile_args=()
|
||||||
|
local_state="''${CHROME_USER_DATA_DIR:-$HOME/.config/google-chrome}/Local State"
|
||||||
|
|
||||||
|
if [ -r "$local_state" ]; then
|
||||||
|
profile_dir="$(
|
||||||
|
jq -r '
|
||||||
|
(.profile.info_cache // {})
|
||||||
|
| to_entries
|
||||||
|
| sort_by(if .key == "Default" then 0 else 1 end, -(.value.active_time // 0))
|
||||||
|
| .[0].key // empty
|
||||||
|
' "$local_state" 2>/dev/null || true
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [ -n "$profile_dir" ]; then
|
||||||
|
profile_args+=(--profile-directory="$profile_dir")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec google-chrome-stable "''${profile_args[@]}" --class=x-com-pwa --app=https://x.com/
|
||||||
|
'';
|
||||||
|
};
|
||||||
googleChromeDesktopEntries = pkgs.runCommand "google-chrome-desktop-entries" {nativeBuildInputs = [pkgs.gnused];} ''
|
googleChromeDesktopEntries = pkgs.runCommand "google-chrome-desktop-entries" {nativeBuildInputs = [pkgs.gnused];} ''
|
||||||
mkdir -p "$out/share/applications"
|
mkdir -p "$out/share/applications"
|
||||||
|
|
||||||
@@ -242,6 +270,21 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.desktopEntries.x-com-pwa = {
|
||||||
|
name = "X";
|
||||||
|
genericName = "Social Network";
|
||||||
|
comment = "Open x.com in a dedicated Chrome app window";
|
||||||
|
icon = "google-chrome";
|
||||||
|
terminal = false;
|
||||||
|
type = "Application";
|
||||||
|
categories = ["Network"];
|
||||||
|
startupNotify = true;
|
||||||
|
exec = "${xComPwa}/bin/x-com-pwa";
|
||||||
|
settings = {
|
||||||
|
StartupWMClass = "x-com-pwa";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
xdg.configFile."ghostty/config" = {
|
xdg.configFile."ghostty/config" = {
|
||||||
force = true;
|
force = true;
|
||||||
text = ''
|
text = ''
|
||||||
@@ -354,6 +397,7 @@
|
|||||||
spotify
|
spotify
|
||||||
spotifyWaylandPatch
|
spotifyWaylandPatch
|
||||||
tor-browser
|
tor-browser
|
||||||
|
xComPwa
|
||||||
# vscode
|
# vscode
|
||||||
zulip
|
zulip
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user