Programming :: Get Width/height Of A Terminal Window In C++?
May 28, 2010
How do I find out how many characters fit into a terminal window horizontally and how many lines the terminal window is high (i.e. how many rows and columns are visible - the width and height)? I am using c++ and Linux Mint 8 - Gnome.
I use ioctl to get the cosole window size (the SSH window).
I use the following code:
When I debug on linux pc, it gives me the correct window width. But after I try it on router (this is my enventual place where my code shall run), ioctl always give me 0 width, that is, numberOfColumnsOfTerminalWindow == 0. but the returnValue is 0 which means that the function call succeeds.
After spending a few hours and having some little sleep, I am very puzzled and disturbed by the fact that new-new-02-5-1.png does not have the intended 818x788. It must have to do with cropping with nonzero offsets.
I am trying to sort image files I've assembled for document production, and I need to be able to see the height and width of the images without having to open them one by one. Is there a way to view an image's physical size in the folder window?
In 10.4 I had set my default terminal size to my screen width - I type some long commands. After running an update this morning, my terminal comes up in the install default size. Using the preferences dialog, I cannot find the control to set the default width. Has it been removed? I hope I'm looking in the wrong place, but I have a chilling feeling that it's been dropped or perhaps just accidentally commented out.
I use ioctl to get the console window size (the SSH window). I use the following code: struct winsize ws; int returnValue = ioctl(pCommandStructure->terminal, TIOCGWINSZ, &ws); int numberOfColumnsOfTerminalWindow = ws.ws_col; When I debug on linux pc, it gives me the correct window width. But after I try it on router (this is my enventual place where my code shall run), ioctl always give me 0 width, that is, numberOfColumnsOfTerminalWindow == 0. but the returnValue is 0 which means that the function call succeeds.
A couple of days I started using latex and have still one question about the table width. My table is too wide for a page. How can I adjust it so that it fits on the full width of a page? Can I use a command or do I have to specify each column widths by hand?
My table looks like this;
I did try several commands likeextwidth, esizebox, setlength but didn't found the solution yet.
My task bar is quite broad. so when ever i open more than 6 windows at a time then the task bar adjusts the tabs in two row. how can explicitly specify the width for those tabs. so that they all fit in one line.
This has bugged me forever.....and I mean really bugged me. The 'pixel width' is too low, such that trying to get my mouse to line up just perfectly on the window edge to get the resize icon, is very difficult. After a bit of searching, I discovered Alt F8, which, for those that don't know, is a resize shortcut and works very well, however, I will still use the 'edge resizing' option quite a bit, and would like to widen the 'line' a few pixels. Is this possible in a user settings file, or is this hardcoded? I am learning to develop, so I wouldn't mind looking into this one as a beginning project. If that's the case, could someone point me to the appropriate package?
I have a server client prog in which server is my 'agent' and client is 'manager'. Following is the code for both agent and manager. I want my agent to send what manager is requesting. But it is not working the way I want. The parameters which manager is requesting, agent has to send to manager but in this program result for those parameters is shown on agent's own terminal window. Where as I want them on manager's window. Secondly, there result is not correct, means it is giving ' 0 K ram and 0 no of process....
Way back from Windows 3.x days to the latest 64bit Windows 7 (classic/standard theme)there is a way to make the window edge border wider then 1 pixel.I often use 3 to 5 pixel to make it easy to grab on hi-resolutions displays and hi DPI monitors.There doesn't seem to be an easy or obvious way to do this with the Gnome X-Windowing system?
i'm not sure for using the correct channel here but i hope someone out there can answer my little questions. 1st in older version i was able to change the settings of the terminal look as the font color, background color and so on. I was also able to define a default window size of a new terminal window. But since after upgrading to to the first release this year and a complete new installation of the current release Maverick i do not find this option anymore. Is there a way how to set up the terminal default window size?
Newly installed Debian system from years with Fedora. Ran system update and system got hosed, booted but no Gnome. Got Gnome back after MANY 'aptitude upgrade's. Xemacs disappeared! Along with other things I installed. Tried to install Xemacs but it is broken and will not install, complains about dpkg TOO current(?). So downloaded Xemacs for Xemacs.org and compiled source, installed.
Now when I start Xemacs is does not run in an X window but runs emacs in a terminal window. If I run it from a script, it complains about 'not in tty window'.
My env show:
The Xemacs install on Debian ( Bug written ) Install and configuration of Xemacs from source. A better understanding of the Debian upgrade process.
I am new to Samba.I'm running Fedora 10 and I've just download samba successfully and have the smb service running on my system.I'm in GNOME and select System and then Administration and Samba does not appear in the drop down menu.I have an NFS menu selection but no samba selection.I ran yum install and it installed successfully. If I can't get the samba config window is there a way I can configure in terminal window?
I find xcompmgr more than adequate for making a desktop look pretty modern, and I don't like the more extravagentCompiz gimmicks - but there is one thing that irritates when using xcompmgr which someone here might have worked round.
Rounded window borders don't draw and redraw properly when using the Terminal (gnome-terminal and the LXDE and Xfce ones) or system monitor and moving them from their default place. You get this little white botch at the corners. I'm not massively technical and I'm ambivalent about how much more I want to learn as I have plenty of creative outlets already, but I would like to solve this. Somehow xcompmgr is treating these programs as a different class? It's capable of drawing the window borders properly as it is just these two programs that get botched. Possibly this doesn't get noticed as maybe people usually use xcompmgr with openbox and LXDE and their square window borders. I did do a search but there was nothing matching what I saw.
The screen info says it is 1280*1024*60Hz.I put this into the nouvou monitors hardware control centre. The screen is too stretched in the vertical. Some icons are cut off at the top.The screen is a V7 videoseven.For some reason the menu controls on the screen only work on the non screen movement icons. I cannot access them .how to get the vertical height corrected? If I have I will go back to the NV proprietary drivers but I would prefer not to do so.
I reduced my system font sizes from default 10 down to 8, but I want to also reduce the height of the Main Menu correspondingly. I've searched the forums and Google, but can't find a method for doing this. See the screenshots - both menu heights are exactly the same, but if I reduce the font size, I'd like the menu to shrink too.
Have installed fedora core 10 [kernel 22.214.171.124-170.2.68.fc10.i686 on intel core 2 Duo machine all disks encrypted. When I try to obtain a terminal window from run level 5 (KDE desktop environment) I get a bouncy terminal icon that disappears after about 15-20 seconds. No terminal window. The only way to get a command line is to press ctrl-alt-F2 and return to runlevel 3. How do I get a functional command line in runlevel 5?
if there was an easy way to get a transparent terminal window. I am running Fedora Core 11 in Gnome desktop. I am sort of a newby and i am really getting into Linux but i want to know some of the cool features too.
I am using OpenSuSe 11.3 and Xfce. When i start my Xfce session, in left down corner I can see useful terminal with logs. Propably it is /var/log/message or something. When I use Remote Administration (VNC) this terminal is missing.
1. Where can I find configuration file or command which is starting this terminal ?
After finally fixing a problem with screen resolutions on my son's PC, (it was stuck at 640x480), now the Terminal window comes up as blank space. I can still type command lines, but can't see what I'm typing nor the response - it's all a white box