Skip to content

Commit

Permalink
fix window title adding change geomitry and top hint
Browse files Browse the repository at this point in the history
  • Loading branch information
zakariakov committed Nov 30, 2017
1 parent 0c8dae9 commit 0a4c893
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 116 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,28 @@ make

sudo make install

# AppImage
# Nautilus script - terminal-here

This script will open a elokab-Terminal in the current directory.

Save this script under $HOME/.local/nautilus/scripts/terminal-here. Make sure that

you give this file executable permission. { chmod +x terminal-here }

#!/bin/bash

if [ "$NAUTILUS_SCRIPT_CURRENT_URI" == "x-nautilus-desktop:///" ]; then
DIR=$HOME
else
DIR=`echo $NAUTILUS_SCRIPT_CURRENT_URI | sed 's/^file:\/\///' | sed 's/%20/ /g'`
fi

elokab-terminal --working-directory "$DIR"

exit 0


# AppImage v:02

x86_64

Expand Down
9 changes: 5 additions & 4 deletions elokab-terminal/buttonColor/buttoncolor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ ButtonColor::ButtonColor(const QString &text, bool showAlphaChannel, QColor colo
tButtonColor->setFocusPolicy(Qt::StrongFocus);
tButtonPicker->setAutoRaise(true);
tButtonPicker->setIcon(QIcon::fromTheme("color-picker",QIcon(":/icons/color-picker")));
tButtonColor->setIconSize(QSize(32,16));
tButtonColor->setMinimumWidth(48);
tButtonPicker->setIconSize(QSize(16,16));
tButtonColor->setIconSize(QSize(24,16));
tButtonColor->setMinimumWidth(36);

setLayout(layout);
layout->addWidget(mLabel);
Expand All @@ -50,7 +51,7 @@ void ButtonColor::setColor(QColor color)
{

m_color=color;
QPixmap pix(32,16);
QPixmap pix(26,16);
pix.fill(Qt::transparent);
QPainter p;

Expand All @@ -60,7 +61,7 @@ void ButtonColor::setColor(QColor color)
p.setPen(this->palette().shadow().color());
p.drawRect(pix.rect());
p.setPen(this->palette().light().color());
p.drawRect(-1,-1,32,16);
p.drawRect(-1,-1,26,16);
// pix.fill(m_color);
tButtonColor->setIcon(pix);
}
Expand Down
84 changes: 63 additions & 21 deletions elokab-terminal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,29 @@

void helpMe()
{

printf("Usage: elokab-terminal [OPTION]\n");
puts("elokab-terminal v: 0.3 \n" );
puts("OPTION:\n");
puts(" -h --help Print this help.\n");
puts(" -w --working-directory <dir> Start session with specified work directory.\n");
puts(" -e, --execute <command> Execute command instead of shel\n");
puts(" -b, --hide-border FramelessWindow no border\n");
puts(" -h --help Print this help.\n");
puts(" -w --working-directory <dir> Start session with specified work directory.\n");
puts(" -e, --execute <command> Execute command instead of shel\n");
puts(" -b, --hide-border FramelessWindow no border\n");
puts(" -t, --on-top On top hint\n");
puts(" -g, --geometry <left,top,width,height> Run in specific dimensions ex: 0,0,800,600 \n");
}


int main(int argc, char *argv[])
{
QApplication a(argc, argv);


setenv("TERM", "xterm", 1); // TODO/FIXME: why?

a.setApplicationName("elokab-terminal");
a.setApplicationName("elokab-terminal");
a.setOrganizationName("elokab");
a.setApplicationVersion("0.1");
a.setApplicationVersion("0.3");

/// جلب ترجمة البرنامج من مجلد البرنامج

Expand Down Expand Up @@ -62,35 +67,72 @@ int main(int argc, char *argv[])
QIcon icon=QIcon::fromTheme("terminal",QIcon(":/icons/terminal.png"));
a.setWindowIcon(icon);
//------------------------------------argument-------------------------------------------------
QString workdir= QDir::currentPath(),command;
QString workdir,command,geometry;
bool framless=false;
bool ontop=false;
QStringList args = a.arguments();

if(args.count()>1)
{

for (int i = 0; i < args.count(); ++i) {

QString arg = args.at(i);
if (arg == "-h" || arg == "--help" ) {helpMe();return 0; }

else if (arg == "-w" || arg == "--working-directory" ) {

if(i+1>args.count()-1){helpMe();return 0;}
QDir dir(args.at(i+1));
if(dir.exists()) workdir=args.at(i+1);

}

else if (arg == "-e" ||arg == "-x" || arg == "--execute"|| arg == "--command" ) {
if(i+1>args.count()-1){helpMe();return 0;}
command=args.at(i+1);
}

else if (arg == "-b" || arg == "--hide-border" ) {framless=true;}

else if (arg == "-g" || arg == "--geometry" ) {
if(i+1>args.count()-1){helpMe();return 0;}
geometry=args.at(i+1);
}

else if (arg == "-t" || arg == "--on-top" ) {ontop=true;}

QString arg = args.at(1);
if (arg == "-h" || arg == "--help" ) {helpMe();return 0; }
else if (arg == "-w" || arg == "--working-directory" ) {workdir=args.at(2);}
else if (arg == "-e" ||arg == "-x" || arg == "--execute"|| arg == "--command" ) {command=args.at(2);}
else if (arg == "-b" || arg == "--hide-border" ) {framless=true;}
else {
QDir dir(arg);

// qWarning() << "echo Unknown option: " << args; helpMe(); return 0;
// command= "echo \"Unknown option: " + arg+"\n"+ help+"\"";


}

if(workdir.isEmpty())
{

QDir dir(args.at(1));
if(dir.exists())
workdir=arg;
else
qWarning() << "echo Unknown option: " << args; helpMe(); return 0;
// command= "echo \"Unknown option: " + arg+"\n"+ help+"\"";
}
workdir=args.at(1);
}



}
// qWarning() << "echo Unknown option: " << args; qDebug()<<help; return 0;}
qDebug()<<"=======main========="<<workdir<<command;

MainWindow w(workdir,command,framless);
if(workdir.isEmpty())
{ workdir=QDir::currentPath();}

qWarning() <<"=======Main========="
<<"\n Workdir: "<<workdir
<<"\n Command: "<<command
<<"\n Framless:"<<framless
<<"\n Geometry:"<<geometry;

MainWindow w(workdir,command,framless,geometry,ontop);


w.show();

Expand Down
Loading

0 comments on commit 0a4c893

Please sign in to comment.