diff --git a/Main.Designer.cs b/Main.Designer.cs index cb11073..5ed1b36 100644 --- a/Main.Designer.cs +++ b/Main.Designer.cs @@ -82,7 +82,7 @@ private void InitializeComponent() this.title.AutoSize = true; this.title.Font = new System.Drawing.Font("Consolas", 10F); this.title.ForeColor = System.Drawing.Color.White; - this.title.Location = new System.Drawing.Point(52, 12); + this.title.Location = new System.Drawing.Point(53, 12); this.title.Name = "title"; this.title.Size = new System.Drawing.Size(48, 17); this.title.TabIndex = 2; diff --git a/Main.cs b/Main.cs index ba9abf3..9dc2330 100644 --- a/Main.cs +++ b/Main.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.IO; namespace x1 { @@ -92,18 +93,35 @@ public Main() bool helpdialog = false; PowerStatus battery = SystemInformation.PowerStatus; Help help = new Help(); - + string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); private void Main_Load(object sender, EventArgs e) { + + SetProcessDPIAware(); - spotifytrack.Anchor = AnchorStyles.Right; - seperator.Anchor = AnchorStyles.Right; - btry.Anchor = AnchorStyles.Right; - time.Anchor = AnchorStyles.Right; - panel_StuffHere.Anchor = AnchorStyles.Right; - Width = Screen.PrimaryScreen.Bounds.Width; + if (File.Exists(appdata + "/x1left")) + { + Width = 62; + spotifytrack.Anchor = AnchorStyles.Right; + seperator.Anchor = AnchorStyles.Right; + btry.Anchor = AnchorStyles.Right; + time.Anchor = AnchorStyles.Right; + panel_StuffHere.Anchor = AnchorStyles.Right; + + Height = Screen.PrimaryScreen.Bounds.Height; + } + else + { + spotifytrack.Anchor = AnchorStyles.Right; + seperator.Anchor = AnchorStyles.Right; + btry.Anchor = AnchorStyles.Right; + time.Anchor = AnchorStyles.Right; + panel_StuffHere.Anchor = AnchorStyles.Right; + + Width = Screen.PrimaryScreen.Bounds.Width; + } t1.Start(); @@ -183,8 +201,25 @@ bool IsOnDesktop() #region haha im epic private void t1_Tick(object sender, EventArgs e) { - var ScreenHeight = Screen.PrimaryScreen.Bounds.Height; - Location = new Point(0, ScreenHeight - 40); + if (File.Exists(appdata + "/x1left")) + { + // idfk how to do it its hard man please make a pull request thanks + Location = new Point(0, 0); + } + + if (File.Exists(appdata + "/x1top")) + { + Location = new Point(0, 0); + } + else + { + if (!File.Exists(appdata + "/x1left")) + { + var ScreenHeight = Screen.PrimaryScreen.Bounds.Height; + Location = new Point(0, ScreenHeight - 40); + } + } + Rectangle window = new Rectangle(); Rectangle edited = new Rectangle(); @@ -199,7 +234,7 @@ private void t1_Tick(object sender, EventArgs e) //label1.Text = Convert.ToString(GetDesktopWindow()); //this is so fucking retarded that i dont even know why it doesnt work only if i add a retarded bool that checks every process this is anoying. install gentoo - + if (edited.Height >= Screen.PrimaryScreen.Bounds.Height && edited.Width >= Screen.PrimaryScreen.Bounds.Width && GetActiveWindowTitle() != "" && GetForegroundWindow() != null && GetForegroundWindow() != GetShellWindow() && GetForegroundWindow() != GetDesktopWindow() && !IsOnDesktop()) { Hide(); diff --git a/help.Designer.cs b/help.Designer.cs index 7e3d4d7..3c61caa 100644 --- a/help.Designer.cs +++ b/help.Designer.cs @@ -34,7 +34,12 @@ private void InitializeComponent() this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); + this.panel2 = new System.Windows.Forms.Panel(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.label4 = new System.Windows.Forms.Label(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); this.SuspendLayout(); // // label1 @@ -51,7 +56,7 @@ private void InitializeComponent() // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Arial", 12F); - this.label2.Location = new System.Drawing.Point(156, 9); + this.label2.Location = new System.Drawing.Point(13, 39); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(139, 18); this.label2.TabIndex = 1; @@ -60,20 +65,19 @@ private void InitializeComponent() // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel1.Controls.Add(this.label6); this.panel1.Controls.Add(this.label5); this.panel1.Controls.Add(this.label3); this.panel1.Font = new System.Drawing.Font("Arial", 10F); - this.panel1.Location = new System.Drawing.Point(12, 40); + this.panel1.Location = new System.Drawing.Point(12, 65); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(278, 355); + this.panel1.Size = new System.Drawing.Size(278, 86); this.panel1.TabIndex = 2; // // label6 // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("Arial", 8F); - this.label6.Location = new System.Drawing.Point(214, 338); + this.label6.Location = new System.Drawing.Point(238, 390); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(64, 14); this.label6.TabIndex = 3; @@ -97,12 +101,60 @@ private void InitializeComponent() this.label3.TabIndex = 0; this.label3.Text = "open help dialog = f7"; // + // panel2 + // + this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel2.Controls.Add(this.checkBox2); + this.panel2.Controls.Add(this.checkBox1); + this.panel2.Location = new System.Drawing.Point(12, 181); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(278, 205); + this.panel2.TabIndex = 3; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Enabled = false; + this.checkBox1.Font = new System.Drawing.Font("Arial", 10F); + this.checkBox1.Location = new System.Drawing.Point(15, 15); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(235, 20); + this.checkBox1.TabIndex = 0; + this.checkBox1.Text = "bar on left (note restart required)"; + this.checkBox1.UseVisualStyleBackColor = true; + this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Arial", 12F); + this.label4.Location = new System.Drawing.Point(13, 159); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(62, 18); + this.label4.TabIndex = 4; + this.label4.Text = "settings"; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Font = new System.Drawing.Font("Arial", 10F); + this.checkBox2.Location = new System.Drawing.Point(15, 41); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(92, 20); + this.checkBox2.TabIndex = 1; + this.checkBox2.Text = "bar on top"; + this.checkBox2.UseVisualStyleBackColor = true; + this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); + // // Help // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(35)))), ((int)(((byte)(35))))); this.ClientSize = new System.Drawing.Size(302, 407); + this.Controls.Add(this.label6); + this.Controls.Add(this.label4); + this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Controls.Add(this.label2); this.Controls.Add(this.label1); @@ -115,8 +167,11 @@ private void InitializeComponent() this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "x1 Help"; this.TopMost = true; + this.Load += new System.EventHandler(this.Help_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -130,5 +185,9 @@ private void InitializeComponent() private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.CheckBox checkBox2; } } \ No newline at end of file diff --git a/help.cs b/help.cs index 8e7d65f..8238a0b 100644 --- a/help.cs +++ b/help.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.IO; namespace x1 { @@ -16,5 +17,66 @@ public Help() { InitializeComponent(); } + string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + private void checkBox1_CheckedChanged(object sender, EventArgs e) + { + //tfw you are too lazy to code a left sided bar + try + { + if (checkBox1.Checked) + { + if (!checkBox2.Checked) + File.Create(appdata + "/x1left"); + } + else + { + if (!checkBox2.Checked) + File.Delete(appdata + "/x1left"); + } + } + catch (Exception ex) + { + } + } + + private void Help_Load(object sender, EventArgs e) + { + try + { + if (File.Exists(appdata + "/x1left")) + { + checkBox1.Checked = true; + } + + if (File.Exists(appdata + "/x1top")) + { + checkBox2.Checked = true; + } + } + catch (Exception ex) + { + } + + } + + private void checkBox2_CheckedChanged(object sender, EventArgs e) + { + try + { + if (checkBox2.Checked) + { + if (!checkBox1.Checked) + File.Create(appdata + "/x1top"); + } + else + { + if (!checkBox1.Checked) + File.Delete(appdata + "/x1top"); + } + } + catch (Exception ex) + { + } + } } }