Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
Q&A How to append commands to startx from console

MWE startx && xrandr-invert-colors Problem It seems that anything after startx does not get issued in the resulting X session. I'd like to make a bash function that sets up my monito...

2 answers  ·  posted 1y ago by mcp‭  ·  last activity 1y ago by celtschk‭

#4: Post edited by user avatar mcp‭ · 2022-11-17T19:01:07Z (over 1 year ago)
Add space to Xsession
  • # MWE
  • ```sh
  • startx && xrandr-invert-colors
  • ```
  • # Problem
  • It seems that anything after `startx` does not get issued in the
  • resulting Xsession. I'd like to make a bash function that sets up my
  • monitors based on which office I'm working out of. Assuming the
  • `*-display` commands are `xrandr` commands, that can be substituted with
  • `xrandr-invert-colors`:
  • ```sh
  • office-one()
  • {
  • startx
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • office-two-display
  • }
  • ```
  • Both of these are accessible from the console on startup, and both
  • successfully `startx`, but everything after that has no effect.
  • # Tried
  • Spinning until in an X session:
  • ```sh
  • in_xsession()
  • {
  • xhost &> /dev/null
  • return !$?
  • }
  • office-one()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-two-display
  • }
  • ```
  • but it has the same behavior.
  • # Question
  • How do I "append" commands to `startx` such that they issue in the
  • resulting X session? For convenience, I'd like to be able to do this
  • from a bash function as shown.
  • # Notes
  • I used `xrandr-invert-colors` for a visual effect, but you can replace
  • that with any application launch like `emacs`, `firefox`, etc..
  • I am using `zsh`.
  • # MWE
  • ```sh
  • startx && xrandr-invert-colors
  • ```
  • # Problem
  • It seems that anything after `startx` does not get issued in the
  • resulting X session. I'd like to make a bash function that sets up my
  • monitors based on which office I'm working out of. Assuming the
  • `*-display` commands are `xrandr` commands, that can be substituted with
  • `xrandr-invert-colors`:
  • ```sh
  • office-one()
  • {
  • startx
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • office-two-display
  • }
  • ```
  • Both of these are accessible from the console on startup, and both
  • successfully `startx`, but everything after that has no effect.
  • # Tried
  • Spinning until in an X session:
  • ```sh
  • in_xsession()
  • {
  • xhost &> /dev/null
  • return !$?
  • }
  • office-one()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-two-display
  • }
  • ```
  • but it has the same behavior.
  • # Question
  • How do I "append" commands to `startx` such that they issue in the
  • resulting X session? For convenience, I'd like to be able to do this
  • from a bash function as shown.
  • # Notes
  • I used `xrandr-invert-colors` for a visual effect, but you can replace
  • that with any application launch like `emacs`, `firefox`, etc..
  • I am using `zsh`.
#3: Post edited by user avatar mcp‭ · 2022-11-17T18:58:33Z (over 1 year ago)
Add space to Xsession
  • # MWE
  • ```sh
  • startx && xrandr-invert-colors
  • ```
  • # Problem
  • It seems that anything after `startx` does not get issued in the
  • resulting Xsession. I'd like to make a bash function that sets up my
  • monitors based on which office I'm working out of. Assuming the
  • `*-display` commands are `xrandr` commands, that can be substituted with
  • `xrandr-invert-colors`:
  • ```sh
  • office-one()
  • {
  • startx
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • office-two-display
  • }
  • ```
  • Both of these are accessible from the console on startup, and both
  • successfully `startx`, but everything after that has no effect.
  • # Tried
  • Spinning until in an X session:
  • ```sh
  • in_xsession()
  • {
  • xhost &> /dev/null
  • return !$?
  • }
  • office-one()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-two-display
  • }
  • ```
  • but it has the same behavior.
  • # Question
  • How do I "append" commands to `startx` such that they issue in the
  • resulting Xsession? For convenience, I'd like to be able to do this from
  • a bash function as shown.
  • # Notes
  • I used `xrandr-invert-colors` for a visual effect, but you can replace
  • that with any application launch like `emacs`, `firefox`, etc..
  • I am using `zsh`.
  • # MWE
  • ```sh
  • startx && xrandr-invert-colors
  • ```
  • # Problem
  • It seems that anything after `startx` does not get issued in the
  • resulting Xsession. I'd like to make a bash function that sets up my
  • monitors based on which office I'm working out of. Assuming the
  • `*-display` commands are `xrandr` commands, that can be substituted with
  • `xrandr-invert-colors`:
  • ```sh
  • office-one()
  • {
  • startx
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • office-two-display
  • }
  • ```
  • Both of these are accessible from the console on startup, and both
  • successfully `startx`, but everything after that has no effect.
  • # Tried
  • Spinning until in an X session:
  • ```sh
  • in_xsession()
  • {
  • xhost &> /dev/null
  • return !$?
  • }
  • office-one()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-two-display
  • }
  • ```
  • but it has the same behavior.
  • # Question
  • How do I "append" commands to `startx` such that they issue in the
  • resulting X session? For convenience, I'd like to be able to do this
  • from a bash function as shown.
  • # Notes
  • I used `xrandr-invert-colors` for a visual effect, but you can replace
  • that with any application launch like `emacs`, `firefox`, etc..
  • I am using `zsh`.
#2: Post edited by user avatar mcp‭ · 2022-11-17T18:57:17Z (over 1 year ago)
Close code block
  • # MWE
  • ```sh
  • startx && xrandr-invert-colors
  • ```
  • # Problem
  • It seems that anything after `startx` does not get issued in the
  • resulting Xsession. I'd like to make a bash function that sets up my
  • monitors based on which office I'm working out of. Assuming the
  • `*-display` commands are `xrandr` commands, that can be substituted with
  • `xrandr-invert-colors`:
  • ```sh
  • office-one()
  • {
  • startx
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • office-two-display
  • }
  • ```
  • Both of these are accessible from the console on startup, and both
  • successfully `startx`, but everything after that has no effect.
  • # Tried
  • Spinning until in an X session:
  • ```sh
  • in_xsession()
  • {
  • xhost &> /dev/null
  • return !$?
  • }
  • office-one()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-two-display
  • }
  • but it has the same behavior.
  • # Question
  • How do I "append" commands to `startx` such that they issue in the
  • resulting Xsession? For convenience, I'd like to be able to do this from
  • a bash function as shown.
  • # Notes
  • I used `xrandr-invert-colors` for a visual effect, but you can replace
  • that with any application launch like `emacs`, `firefox`, etc..
  • I am using `zsh`.
  • # MWE
  • ```sh
  • startx && xrandr-invert-colors
  • ```
  • # Problem
  • It seems that anything after `startx` does not get issued in the
  • resulting Xsession. I'd like to make a bash function that sets up my
  • monitors based on which office I'm working out of. Assuming the
  • `*-display` commands are `xrandr` commands, that can be substituted with
  • `xrandr-invert-colors`:
  • ```sh
  • office-one()
  • {
  • startx
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • office-two-display
  • }
  • ```
  • Both of these are accessible from the console on startup, and both
  • successfully `startx`, but everything after that has no effect.
  • # Tried
  • Spinning until in an X session:
  • ```sh
  • in_xsession()
  • {
  • xhost &> /dev/null
  • return !$?
  • }
  • office-one()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-one-display
  • }
  • office-two()
  • {
  • startx
  • until [ in_xsession ]; do done
  • office-two-display
  • }
  • ```
  • but it has the same behavior.
  • # Question
  • How do I "append" commands to `startx` such that they issue in the
  • resulting Xsession? For convenience, I'd like to be able to do this from
  • a bash function as shown.
  • # Notes
  • I used `xrandr-invert-colors` for a visual effect, but you can replace
  • that with any application launch like `emacs`, `firefox`, etc..
  • I am using `zsh`.
#1: Initial revision by user avatar mcp‭ · 2022-11-17T18:56:14Z (over 1 year ago)
How to append commands to startx from console
# MWE
```sh
startx && xrandr-invert-colors
```
# Problem
It seems that anything after `startx` does not get issued in the
resulting Xsession. I'd like to make a bash function that sets up my
monitors based on which office I'm working out of. Assuming the
`*-display` commands are `xrandr` commands, that can be substituted with
`xrandr-invert-colors`:
```sh
office-one()
{
    startx
    office-one-display
}

office-two()
{
    startx
    office-two-display
}
```
Both of these are accessible from the console on startup, and both
successfully `startx`, but everything after that has no effect.

# Tried
Spinning until in an X session:
```sh
in_xsession()
{
    xhost &> /dev/null

    return !$?
}

office-one()
{
    startx
    until [ in_xsession ]; do done
    office-one-display
}

office-two()
{
    startx
    until [ in_xsession ]; do done
    office-two-display
}

but it has the same behavior.

# Question
How do I "append" commands to `startx` such that they issue in the
resulting Xsession? For convenience, I'd like to be able to do this from
a bash function as shown.

# Notes
I used `xrandr-invert-colors` for a visual effect, but you can replace
that with any application launch like `emacs`, `firefox`, etc..

I am using `zsh`.