How to starts apps always on primary display?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







7















I have dual display configuration, and want all new and old applications start on primary display, which is on the right. But some apps start on second screen, regardless where focus/mouse pointer is. I think this is because top:left corner 0:0 is on second monitor. And its bigger then primary, can this be a cause?



Secondary is a TV where I run kodi, which have a setting to choose display.



May be there are some app what remember for every app position and display, and also take care when second is turned off - mean remember position until monitor is on again. In earlier versions of ubuntu compiz do that, but no more.



Update: Changed DE to cinnamon










share|improve this question

















This question has an open bounty worth +50
reputation from LeonidMew ending in 5 days.


One or more of the answers is exemplary and worthy of an additional bounty.

















  • I'm also looking for this, have you had any luck?

    – Felipe
    Apr 8 at 22:21











  • @Felipe No luck

    – LeonidMew
    2 days ago











  • In applications list in cinnamon, I have menu option to move app to different monitor, its useful especially when secondary is turned off. But this not solution to a question.

    – LeonidMew
    2 days ago






  • 1





    A solution could be a little deamon-like process, to watch out for new windows, move them to your primary screen. Would that be an acceptable solution? You'd probably even not see it being moved.

    – Jacob Vlijm
    2 days ago











  • @JacobVlijm Yes, this can be solution. But I don't known how to write it, can you please give two code pieces - how to determine new window and how to move

    – LeonidMew
    2 days ago


















7















I have dual display configuration, and want all new and old applications start on primary display, which is on the right. But some apps start on second screen, regardless where focus/mouse pointer is. I think this is because top:left corner 0:0 is on second monitor. And its bigger then primary, can this be a cause?



Secondary is a TV where I run kodi, which have a setting to choose display.



May be there are some app what remember for every app position and display, and also take care when second is turned off - mean remember position until monitor is on again. In earlier versions of ubuntu compiz do that, but no more.



Update: Changed DE to cinnamon










share|improve this question

















This question has an open bounty worth +50
reputation from LeonidMew ending in 5 days.


One or more of the answers is exemplary and worthy of an additional bounty.

















  • I'm also looking for this, have you had any luck?

    – Felipe
    Apr 8 at 22:21











  • @Felipe No luck

    – LeonidMew
    2 days ago











  • In applications list in cinnamon, I have menu option to move app to different monitor, its useful especially when secondary is turned off. But this not solution to a question.

    – LeonidMew
    2 days ago






  • 1





    A solution could be a little deamon-like process, to watch out for new windows, move them to your primary screen. Would that be an acceptable solution? You'd probably even not see it being moved.

    – Jacob Vlijm
    2 days ago











  • @JacobVlijm Yes, this can be solution. But I don't known how to write it, can you please give two code pieces - how to determine new window and how to move

    – LeonidMew
    2 days ago














7












7








7


1






I have dual display configuration, and want all new and old applications start on primary display, which is on the right. But some apps start on second screen, regardless where focus/mouse pointer is. I think this is because top:left corner 0:0 is on second monitor. And its bigger then primary, can this be a cause?



Secondary is a TV where I run kodi, which have a setting to choose display.



May be there are some app what remember for every app position and display, and also take care when second is turned off - mean remember position until monitor is on again. In earlier versions of ubuntu compiz do that, but no more.



Update: Changed DE to cinnamon










share|improve this question
















I have dual display configuration, and want all new and old applications start on primary display, which is on the right. But some apps start on second screen, regardless where focus/mouse pointer is. I think this is because top:left corner 0:0 is on second monitor. And its bigger then primary, can this be a cause?



Secondary is a TV where I run kodi, which have a setting to choose display.



May be there are some app what remember for every app position and display, and also take care when second is turned off - mean remember position until monitor is on again. In earlier versions of ubuntu compiz do that, but no more.



Update: Changed DE to cinnamon







18.04 multiple-monitors window window-manager cinnamon






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Jacob Vlijm

66.5k9137234




66.5k9137234










asked Jan 10 at 17:34









LeonidMewLeonidMew

1,036622




1,036622






This question has an open bounty worth +50
reputation from LeonidMew ending in 5 days.


One or more of the answers is exemplary and worthy of an additional bounty.








This question has an open bounty worth +50
reputation from LeonidMew ending in 5 days.


One or more of the answers is exemplary and worthy of an additional bounty.















  • I'm also looking for this, have you had any luck?

    – Felipe
    Apr 8 at 22:21











  • @Felipe No luck

    – LeonidMew
    2 days ago











  • In applications list in cinnamon, I have menu option to move app to different monitor, its useful especially when secondary is turned off. But this not solution to a question.

    – LeonidMew
    2 days ago






  • 1





    A solution could be a little deamon-like process, to watch out for new windows, move them to your primary screen. Would that be an acceptable solution? You'd probably even not see it being moved.

    – Jacob Vlijm
    2 days ago











  • @JacobVlijm Yes, this can be solution. But I don't known how to write it, can you please give two code pieces - how to determine new window and how to move

    – LeonidMew
    2 days ago



















  • I'm also looking for this, have you had any luck?

    – Felipe
    Apr 8 at 22:21











  • @Felipe No luck

    – LeonidMew
    2 days ago











  • In applications list in cinnamon, I have menu option to move app to different monitor, its useful especially when secondary is turned off. But this not solution to a question.

    – LeonidMew
    2 days ago






  • 1





    A solution could be a little deamon-like process, to watch out for new windows, move them to your primary screen. Would that be an acceptable solution? You'd probably even not see it being moved.

    – Jacob Vlijm
    2 days ago











  • @JacobVlijm Yes, this can be solution. But I don't known how to write it, can you please give two code pieces - how to determine new window and how to move

    – LeonidMew
    2 days ago

















I'm also looking for this, have you had any luck?

– Felipe
Apr 8 at 22:21





I'm also looking for this, have you had any luck?

– Felipe
Apr 8 at 22:21













@Felipe No luck

– LeonidMew
2 days ago





@Felipe No luck

– LeonidMew
2 days ago













In applications list in cinnamon, I have menu option to move app to different monitor, its useful especially when secondary is turned off. But this not solution to a question.

– LeonidMew
2 days ago





In applications list in cinnamon, I have menu option to move app to different monitor, its useful especially when secondary is turned off. But this not solution to a question.

– LeonidMew
2 days ago




1




1





A solution could be a little deamon-like process, to watch out for new windows, move them to your primary screen. Would that be an acceptable solution? You'd probably even not see it being moved.

– Jacob Vlijm
2 days ago





A solution could be a little deamon-like process, to watch out for new windows, move them to your primary screen. Would that be an acceptable solution? You'd probably even not see it being moved.

– Jacob Vlijm
2 days ago













@JacobVlijm Yes, this can be solution. But I don't known how to write it, can you please give two code pieces - how to determine new window and how to move

– LeonidMew
2 days ago





@JacobVlijm Yes, this can be solution. But I don't known how to write it, can you please give two code pieces - how to determine new window and how to move

– LeonidMew
2 days ago










1 Answer
1






active

oldest

votes


















10














Be prepared to get your hands dirty

On the edge of what I feel we could ask users to do, but on the other hand, when instructions are clear, why not? So here we go...





Background process to set on which monitor new windows should appear



The Vala snippet



using Wnck;
using Gdk;
using Gtk;

// compile:
// valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" 'file.vala'

namespace move_newwins {

private int monitor_geo_x;
private int monitor_geo_y;
private int monitorindex;
private string currmon;

private void getwins() {
var dsp = Gdk.Display.get_default();
var gdkscr = Gdk.Screen.get_default();
unowned Wnck.Screen scr = Wnck.Screen.get_default();
scr.force_update();
get_monitors(dsp, gdkscr);
scr.window_opened.connect(newwin);
}

private void newwin (Wnck.Window newwin) {
newwin.unmaximize();
int winx;
int winy;
int winwidth;
int winheight;
newwin.get_geometry(out winx, out winy, out winwidth, out winheight);
Wnck.WindowType type = newwin.get_window_type();
if (type == Wnck.WindowType.NORMAL) {
newwin.set_geometry(
Wnck.WindowGravity.NORTHWEST,
Wnck.WindowMoveResizeMask.X |
Wnck.WindowMoveResizeMask.Y |
Wnck.WindowMoveResizeMask.WIDTH |
Wnck.WindowMoveResizeMask.HEIGHT,
monitor_geo_x[monitorindex] + 100,
monitor_geo_y[monitorindex] + 100,
winwidth, winheight
);
}
}

private int get_stringindex (string s, string arr) {
for (int i=0; i < arr.length; i++) {
if(s == arr[i]) return i;
} return -1;
}

private void get_monitors(Gdk.Display dsp, Gdk.Screen gdkscr) {
int nmons = dsp.get_n_monitors();
string monitornames = {};
for (int i=0; i < nmons; i++) {
Gdk.Monitor newmon = dsp.get_monitor(i);
monitornames += newmon.get_model();
Rectangle geo = newmon.get_geometry();
monitor_geo_x += geo.x;
monitor_geo_y += geo.y;
monitorindex = get_stringindex(
currmon, monitornames
);
}
}

public static void main (string args) {
currmon = args[1];
Gtk.init(ref args);
getwins();
Gtk.main();
}
}




  1. The Vala snippet needs to be compiled. To do so you need to install a few things:



    sudo apt install valac libwnck-3-dev libgtk-3-dev


  2. Copy the snippet below, save it as win_tomonitor.vala



  3. Compile the snippet with the command:



    valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" '/path/to/win_tomonitor.vala' 


    (I know, the wnck argument is silly, but needed), an executable will be produced in the working directory.



  4. Find out the name of your primary monitor by running the command xrandrin terminal.


  5. Run the executable with the targeted monitor as argument, e.g.



    /path/to/win_tomonitor HDMI-1



New ("normal") windows will appear on 100px (x + y) from topleft of the targeted monitor.



N.B.



When adding this as a startup item, you might need to add a break of a few seconds before running it. If you run into issues on login/startup, please mention.






share|improve this answer


























  • Upvoting because I love seeing extra bounties :)

    – WinEunuuchs2Unix
    2 days ago












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1108654%2fhow-to-starts-apps-always-on-primary-display%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









10














Be prepared to get your hands dirty

On the edge of what I feel we could ask users to do, but on the other hand, when instructions are clear, why not? So here we go...





Background process to set on which monitor new windows should appear



The Vala snippet



using Wnck;
using Gdk;
using Gtk;

// compile:
// valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" 'file.vala'

namespace move_newwins {

private int monitor_geo_x;
private int monitor_geo_y;
private int monitorindex;
private string currmon;

private void getwins() {
var dsp = Gdk.Display.get_default();
var gdkscr = Gdk.Screen.get_default();
unowned Wnck.Screen scr = Wnck.Screen.get_default();
scr.force_update();
get_monitors(dsp, gdkscr);
scr.window_opened.connect(newwin);
}

private void newwin (Wnck.Window newwin) {
newwin.unmaximize();
int winx;
int winy;
int winwidth;
int winheight;
newwin.get_geometry(out winx, out winy, out winwidth, out winheight);
Wnck.WindowType type = newwin.get_window_type();
if (type == Wnck.WindowType.NORMAL) {
newwin.set_geometry(
Wnck.WindowGravity.NORTHWEST,
Wnck.WindowMoveResizeMask.X |
Wnck.WindowMoveResizeMask.Y |
Wnck.WindowMoveResizeMask.WIDTH |
Wnck.WindowMoveResizeMask.HEIGHT,
monitor_geo_x[monitorindex] + 100,
monitor_geo_y[monitorindex] + 100,
winwidth, winheight
);
}
}

private int get_stringindex (string s, string arr) {
for (int i=0; i < arr.length; i++) {
if(s == arr[i]) return i;
} return -1;
}

private void get_monitors(Gdk.Display dsp, Gdk.Screen gdkscr) {
int nmons = dsp.get_n_monitors();
string monitornames = {};
for (int i=0; i < nmons; i++) {
Gdk.Monitor newmon = dsp.get_monitor(i);
monitornames += newmon.get_model();
Rectangle geo = newmon.get_geometry();
monitor_geo_x += geo.x;
monitor_geo_y += geo.y;
monitorindex = get_stringindex(
currmon, monitornames
);
}
}

public static void main (string args) {
currmon = args[1];
Gtk.init(ref args);
getwins();
Gtk.main();
}
}




  1. The Vala snippet needs to be compiled. To do so you need to install a few things:



    sudo apt install valac libwnck-3-dev libgtk-3-dev


  2. Copy the snippet below, save it as win_tomonitor.vala



  3. Compile the snippet with the command:



    valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" '/path/to/win_tomonitor.vala' 


    (I know, the wnck argument is silly, but needed), an executable will be produced in the working directory.



  4. Find out the name of your primary monitor by running the command xrandrin terminal.


  5. Run the executable with the targeted monitor as argument, e.g.



    /path/to/win_tomonitor HDMI-1



New ("normal") windows will appear on 100px (x + y) from topleft of the targeted monitor.



N.B.



When adding this as a startup item, you might need to add a break of a few seconds before running it. If you run into issues on login/startup, please mention.






share|improve this answer


























  • Upvoting because I love seeing extra bounties :)

    – WinEunuuchs2Unix
    2 days ago
















10














Be prepared to get your hands dirty

On the edge of what I feel we could ask users to do, but on the other hand, when instructions are clear, why not? So here we go...





Background process to set on which monitor new windows should appear



The Vala snippet



using Wnck;
using Gdk;
using Gtk;

// compile:
// valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" 'file.vala'

namespace move_newwins {

private int monitor_geo_x;
private int monitor_geo_y;
private int monitorindex;
private string currmon;

private void getwins() {
var dsp = Gdk.Display.get_default();
var gdkscr = Gdk.Screen.get_default();
unowned Wnck.Screen scr = Wnck.Screen.get_default();
scr.force_update();
get_monitors(dsp, gdkscr);
scr.window_opened.connect(newwin);
}

private void newwin (Wnck.Window newwin) {
newwin.unmaximize();
int winx;
int winy;
int winwidth;
int winheight;
newwin.get_geometry(out winx, out winy, out winwidth, out winheight);
Wnck.WindowType type = newwin.get_window_type();
if (type == Wnck.WindowType.NORMAL) {
newwin.set_geometry(
Wnck.WindowGravity.NORTHWEST,
Wnck.WindowMoveResizeMask.X |
Wnck.WindowMoveResizeMask.Y |
Wnck.WindowMoveResizeMask.WIDTH |
Wnck.WindowMoveResizeMask.HEIGHT,
monitor_geo_x[monitorindex] + 100,
monitor_geo_y[monitorindex] + 100,
winwidth, winheight
);
}
}

private int get_stringindex (string s, string arr) {
for (int i=0; i < arr.length; i++) {
if(s == arr[i]) return i;
} return -1;
}

private void get_monitors(Gdk.Display dsp, Gdk.Screen gdkscr) {
int nmons = dsp.get_n_monitors();
string monitornames = {};
for (int i=0; i < nmons; i++) {
Gdk.Monitor newmon = dsp.get_monitor(i);
monitornames += newmon.get_model();
Rectangle geo = newmon.get_geometry();
monitor_geo_x += geo.x;
monitor_geo_y += geo.y;
monitorindex = get_stringindex(
currmon, monitornames
);
}
}

public static void main (string args) {
currmon = args[1];
Gtk.init(ref args);
getwins();
Gtk.main();
}
}




  1. The Vala snippet needs to be compiled. To do so you need to install a few things:



    sudo apt install valac libwnck-3-dev libgtk-3-dev


  2. Copy the snippet below, save it as win_tomonitor.vala



  3. Compile the snippet with the command:



    valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" '/path/to/win_tomonitor.vala' 


    (I know, the wnck argument is silly, but needed), an executable will be produced in the working directory.



  4. Find out the name of your primary monitor by running the command xrandrin terminal.


  5. Run the executable with the targeted monitor as argument, e.g.



    /path/to/win_tomonitor HDMI-1



New ("normal") windows will appear on 100px (x + y) from topleft of the targeted monitor.



N.B.



When adding this as a startup item, you might need to add a break of a few seconds before running it. If you run into issues on login/startup, please mention.






share|improve this answer


























  • Upvoting because I love seeing extra bounties :)

    – WinEunuuchs2Unix
    2 days ago














10












10








10







Be prepared to get your hands dirty

On the edge of what I feel we could ask users to do, but on the other hand, when instructions are clear, why not? So here we go...





Background process to set on which monitor new windows should appear



The Vala snippet



using Wnck;
using Gdk;
using Gtk;

// compile:
// valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" 'file.vala'

namespace move_newwins {

private int monitor_geo_x;
private int monitor_geo_y;
private int monitorindex;
private string currmon;

private void getwins() {
var dsp = Gdk.Display.get_default();
var gdkscr = Gdk.Screen.get_default();
unowned Wnck.Screen scr = Wnck.Screen.get_default();
scr.force_update();
get_monitors(dsp, gdkscr);
scr.window_opened.connect(newwin);
}

private void newwin (Wnck.Window newwin) {
newwin.unmaximize();
int winx;
int winy;
int winwidth;
int winheight;
newwin.get_geometry(out winx, out winy, out winwidth, out winheight);
Wnck.WindowType type = newwin.get_window_type();
if (type == Wnck.WindowType.NORMAL) {
newwin.set_geometry(
Wnck.WindowGravity.NORTHWEST,
Wnck.WindowMoveResizeMask.X |
Wnck.WindowMoveResizeMask.Y |
Wnck.WindowMoveResizeMask.WIDTH |
Wnck.WindowMoveResizeMask.HEIGHT,
monitor_geo_x[monitorindex] + 100,
monitor_geo_y[monitorindex] + 100,
winwidth, winheight
);
}
}

private int get_stringindex (string s, string arr) {
for (int i=0; i < arr.length; i++) {
if(s == arr[i]) return i;
} return -1;
}

private void get_monitors(Gdk.Display dsp, Gdk.Screen gdkscr) {
int nmons = dsp.get_n_monitors();
string monitornames = {};
for (int i=0; i < nmons; i++) {
Gdk.Monitor newmon = dsp.get_monitor(i);
monitornames += newmon.get_model();
Rectangle geo = newmon.get_geometry();
monitor_geo_x += geo.x;
monitor_geo_y += geo.y;
monitorindex = get_stringindex(
currmon, monitornames
);
}
}

public static void main (string args) {
currmon = args[1];
Gtk.init(ref args);
getwins();
Gtk.main();
}
}




  1. The Vala snippet needs to be compiled. To do so you need to install a few things:



    sudo apt install valac libwnck-3-dev libgtk-3-dev


  2. Copy the snippet below, save it as win_tomonitor.vala



  3. Compile the snippet with the command:



    valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" '/path/to/win_tomonitor.vala' 


    (I know, the wnck argument is silly, but needed), an executable will be produced in the working directory.



  4. Find out the name of your primary monitor by running the command xrandrin terminal.


  5. Run the executable with the targeted monitor as argument, e.g.



    /path/to/win_tomonitor HDMI-1



New ("normal") windows will appear on 100px (x + y) from topleft of the targeted monitor.



N.B.



When adding this as a startup item, you might need to add a break of a few seconds before running it. If you run into issues on login/startup, please mention.






share|improve this answer















Be prepared to get your hands dirty

On the edge of what I feel we could ask users to do, but on the other hand, when instructions are clear, why not? So here we go...





Background process to set on which monitor new windows should appear



The Vala snippet



using Wnck;
using Gdk;
using Gtk;

// compile:
// valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" 'file.vala'

namespace move_newwins {

private int monitor_geo_x;
private int monitor_geo_y;
private int monitorindex;
private string currmon;

private void getwins() {
var dsp = Gdk.Display.get_default();
var gdkscr = Gdk.Screen.get_default();
unowned Wnck.Screen scr = Wnck.Screen.get_default();
scr.force_update();
get_monitors(dsp, gdkscr);
scr.window_opened.connect(newwin);
}

private void newwin (Wnck.Window newwin) {
newwin.unmaximize();
int winx;
int winy;
int winwidth;
int winheight;
newwin.get_geometry(out winx, out winy, out winwidth, out winheight);
Wnck.WindowType type = newwin.get_window_type();
if (type == Wnck.WindowType.NORMAL) {
newwin.set_geometry(
Wnck.WindowGravity.NORTHWEST,
Wnck.WindowMoveResizeMask.X |
Wnck.WindowMoveResizeMask.Y |
Wnck.WindowMoveResizeMask.WIDTH |
Wnck.WindowMoveResizeMask.HEIGHT,
monitor_geo_x[monitorindex] + 100,
monitor_geo_y[monitorindex] + 100,
winwidth, winheight
);
}
}

private int get_stringindex (string s, string arr) {
for (int i=0; i < arr.length; i++) {
if(s == arr[i]) return i;
} return -1;
}

private void get_monitors(Gdk.Display dsp, Gdk.Screen gdkscr) {
int nmons = dsp.get_n_monitors();
string monitornames = {};
for (int i=0; i < nmons; i++) {
Gdk.Monitor newmon = dsp.get_monitor(i);
monitornames += newmon.get_model();
Rectangle geo = newmon.get_geometry();
monitor_geo_x += geo.x;
monitor_geo_y += geo.y;
monitorindex = get_stringindex(
currmon, monitornames
);
}
}

public static void main (string args) {
currmon = args[1];
Gtk.init(ref args);
getwins();
Gtk.main();
}
}




  1. The Vala snippet needs to be compiled. To do so you need to install a few things:



    sudo apt install valac libwnck-3-dev libgtk-3-dev


  2. Copy the snippet below, save it as win_tomonitor.vala



  3. Compile the snippet with the command:



    valac --pkg gtk+-3.0 --pkg gio-2.0 --pkg libwnck-3.0 -X "-D WNCK_I_KNOW_THIS_IS_UNSTABLE" '/path/to/win_tomonitor.vala' 


    (I know, the wnck argument is silly, but needed), an executable will be produced in the working directory.



  4. Find out the name of your primary monitor by running the command xrandrin terminal.


  5. Run the executable with the targeted monitor as argument, e.g.



    /path/to/win_tomonitor HDMI-1



New ("normal") windows will appear on 100px (x + y) from topleft of the targeted monitor.



N.B.



When adding this as a startup item, you might need to add a break of a few seconds before running it. If you run into issues on login/startup, please mention.







share|improve this answer














share|improve this answer



share|improve this answer








edited 17 hours ago

























answered 2 days ago









Jacob VlijmJacob Vlijm

66.5k9137234




66.5k9137234













  • Upvoting because I love seeing extra bounties :)

    – WinEunuuchs2Unix
    2 days ago



















  • Upvoting because I love seeing extra bounties :)

    – WinEunuuchs2Unix
    2 days ago

















Upvoting because I love seeing extra bounties :)

– WinEunuuchs2Unix
2 days ago





Upvoting because I love seeing extra bounties :)

– WinEunuuchs2Unix
2 days ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1108654%2fhow-to-starts-apps-always-on-primary-display%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

香粉寮

GameSpot