feat: implement scratchpad window toggling
This commit is contained in:
parent
5c2f631fdb
commit
d756c8a6a2
17 changed files with 515 additions and 3 deletions
|
|
@ -64,6 +64,8 @@ pub enum SimpleCommand {
|
|||
SetFloating(bool),
|
||||
ToggleFullscreen,
|
||||
SetFullscreen(bool),
|
||||
SendToScratchpad,
|
||||
ToggleScratchpad,
|
||||
Forward(bool),
|
||||
EnableWindowManagement(bool),
|
||||
SetFloatAboveFullscreen(bool),
|
||||
|
|
@ -130,6 +132,12 @@ pub enum Action {
|
|||
MoveToWorkspace {
|
||||
name: String,
|
||||
},
|
||||
SendToScratchpad {
|
||||
name: String,
|
||||
},
|
||||
ToggleScratchpad {
|
||||
name: String,
|
||||
},
|
||||
Multi {
|
||||
actions: Vec<Action>,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ impl ActionParser<'_> {
|
|||
"toggle-fullscreen" => ToggleFullscreen,
|
||||
"enter-fullscreen" => SetFullscreen(true),
|
||||
"exit-fullscreen" => SetFullscreen(false),
|
||||
"send-to-scratchpad" => SendToScratchpad,
|
||||
"toggle-scratchpad" => ToggleScratchpad,
|
||||
"focus-parent" => FocusParent,
|
||||
"close" => Close,
|
||||
"disable-pointer-constraint" => DisablePointerConstraint,
|
||||
|
|
@ -222,6 +224,24 @@ impl ActionParser<'_> {
|
|||
Ok(Action::MoveToWorkspace { name })
|
||||
}
|
||||
|
||||
fn parse_send_to_scratchpad(&mut self, ext: &mut Extractor<'_>) -> ParseResult<Self> {
|
||||
let name = ext
|
||||
.extract(opt(str("name")))?
|
||||
.map(|name| name.value)
|
||||
.unwrap_or("")
|
||||
.to_string();
|
||||
Ok(Action::SendToScratchpad { name })
|
||||
}
|
||||
|
||||
fn parse_toggle_scratchpad(&mut self, ext: &mut Extractor<'_>) -> ParseResult<Self> {
|
||||
let name = ext
|
||||
.extract(opt(str("name")))?
|
||||
.map(|name| name.value)
|
||||
.unwrap_or("")
|
||||
.to_string();
|
||||
Ok(Action::ToggleScratchpad { name })
|
||||
}
|
||||
|
||||
fn parse_configure_connector(&mut self, ext: &mut Extractor<'_>) -> ParseResult<Self> {
|
||||
let con = ext
|
||||
.extract(val("connector"))?
|
||||
|
|
@ -551,6 +571,8 @@ impl Parser for ActionParser<'_> {
|
|||
"switch-to-vt" => self.parse_switch_to_vt(&mut ext),
|
||||
"show-workspace" => self.parse_show_workspace(&mut ext),
|
||||
"move-to-workspace" => self.parse_move_to_workspace(&mut ext),
|
||||
"send-to-scratchpad" => self.parse_send_to_scratchpad(&mut ext),
|
||||
"toggle-scratchpad" => self.parse_toggle_scratchpad(&mut ext),
|
||||
"configure-connector" => self.parse_configure_connector(&mut ext),
|
||||
"configure-input" => self.parse_configure_input(&mut ext),
|
||||
"configure-output" => self.parse_configure_output(&mut ext),
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ impl Action {
|
|||
SimpleCommand::Move(dir) => window_or_seat!(s, s.move_(dir)),
|
||||
SimpleCommand::ToggleFullscreen => window_or_seat!(s, s.toggle_fullscreen()),
|
||||
SimpleCommand::SetFullscreen(b) => window_or_seat!(s, s.set_fullscreen(b)),
|
||||
SimpleCommand::SendToScratchpad => window_or_seat!(s, s.send_to_scratchpad("")),
|
||||
SimpleCommand::ToggleScratchpad => b.new(move || s.toggle_scratchpad("")),
|
||||
SimpleCommand::FocusParent => b.new(move || s.focus_parent()),
|
||||
SimpleCommand::Close => window_or_seat!(s, s.close()),
|
||||
SimpleCommand::DisablePointerConstraint => {
|
||||
|
|
@ -306,6 +308,8 @@ impl Action {
|
|||
let workspace = get_workspace(&name);
|
||||
window_or_seat!(s, s.set_workspace(workspace))
|
||||
}
|
||||
Action::SendToScratchpad { name } => window_or_seat!(s, s.send_to_scratchpad(&name)),
|
||||
Action::ToggleScratchpad { name } => b.new(move || s.toggle_scratchpad(&name)),
|
||||
Action::ConfigureConnector { con } => b.new(move || {
|
||||
for c in connectors() {
|
||||
if con.match_.matches(c) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue